function load() {
    if (!("platform" in window)) return;
    
    var IMG_NOTIFY_ICON = "resource://webapp/images/google-wave-52x32.png";

	var lastCount = 0;

	function notifyNewWaves() {
		var oldCount = lastCount;
		var newCount = 0;
		
		var title = window.content.document.title;
		var matches = window.content.document.title.match(/\((\d+)\)/);
		newCount = matches ? matches[1] : 0;

		if (newCount > oldCount) {
            window.platform.showNotification("Wave", newCount + " unread waves.", IMG_NOTIFY_ICON);
            window.platform.getAttention();
		}
        
		lastCount = newCount;
	}
	
	// Check for new messages every 10 seconds
	window.setInterval(function(){notifyNewWaves();}, 10 * 1000);
}
