newPageLoadedCallbacks.push(function (page) {
	page.find("div.blog").hide();
	
	$.ajax({
		url: "/ws/blog.php",
		dataType: "json",
		success: function (data) {
			var blog = $("div.blog div#posts");
			
			$.each(data, function (i, element) {
				var div = blog.find("#post" + i).addClass("hand");
				
				var postDate = new Date();
				postDate.setTime(element.post_date * 1000);
				
				div.click(function () {
					window.location.href = "http://blog.invisionsta.com/" + postDate.getYear() + "/" + postDate.getMonth() + "/" + element.post_name;
				})
				
				div.find("#title").html(element.post_title);
				div.find("#body").html(element.post_excerpt);
			});
			
			page.find("div.blog").fadeIn();
		},
		error: function () {
			$("div#slideContainer div#blog").html("Error loading blog");
		}
	})
})
