function Notifier(doc){
	$(doc).click( this.goToPage );
	this.update( doc );
	setInterval(function(){ this.update(doc); }, 1000);
}

Notifier.prototype = {
	goToPage: function(){
		
		Jetpack.tabs.open("http://www.milesrausch.com/");
		Jetpack.tabs[ Jetpack.tabs.length-1 ].focus();
	},
  
	update: function(doc){
		var url = "http://www.milesrausch.com/feed/";
		doc = $(doc);
		$.get(url, function(xml){
			var el = $(xml).find("item:first");

			if (el){
				var item_title = el.find("title").text();
				var item_url = el.find("link").text();
				
				doc.find("#latest").text( item_title );
			}
			else{
				doc.find("#latest").text( "Update failed." );
			}
		});
	}
}

Jetpack.statusBar.append({
  html: <>
		<img src="http://www.milesrausch.com/favicon.ico" />
		<span id="latest">Loading...</span>
	</>,
	onReady: function(doc){
		var ping = new Notifier(doc);
		$("#latest", doc).css({
			padding: "2px",
			fontSize: "11px",
			fontFamily: "verdana",
			verticalAlign: "top",
			cursor: "pointer",
			color: "#800080"
		});
	},
	width: 300
});