$(document).ready(function() {
	loadPage(window.location.hash,true);
});
$(window).hashchange(function() {
	loadPage(window.location.hash,false);
});
function loadPage(page,first)
{
	console.log($("#content_container").html());
	if ($("#content_container").html() == "&nbsp;" || !first)
	{
		$("#page_content").animate({opacity:0},0);
		$.ajax({url:"/files/harm/page.php",type:"POST",data:"p="+page,success: function(respond) {
			$("#content_container").html(respond);
			$("#page_content").scrollTop(0);
			$("#page_content").animate({opacity:1},200);
			var $j_object = $(".slideOutRight");
			var $delay = 400;
			$j_object.each( function(i) 
			{ 
				if (first)
				{
					$("#"+$j_object[i].id).delay($delay).animate({"width":"40px","left":"+=192px"},200);
					$delay += 100;
				}
				else
				{
					$("#"+$j_object[i].id).animate({"width":"40px","left":"+=192px"},0);
				}
			} );
		}});
	}
}
function showDiv(id) {
	$("#"+id).stop(true).animate({opacity:1},1000);
}
function hideDiv(id) {
	$("#"+id).stop(true).animate({opacity:0},10);
}
function desaturate(img) {
	var desat = Pixastic.process(img, "hsl", {saturation:-100,lightness:10});
}
