$(document).ready(function() {
	
	// Hash
	loadContent(window.location.hash);	
	
	$("#content_loading").fadeOut(250,function(){
		$("#content_loader").fadeIn(250);
	});	

});

// Hash
function loadContent(thePage){
	close_img();
	cleanHash = thePage.replace('#','');
	if(cleanHash == '') { cleanHash = "home"; }
	$('#content_loader').fadeOut(250,function(){
	$('#content_loading').show();
		$('#content_loader').load('incl/_content.php?pageAndParam='+cleanHash, function() {
		_gaq.push(['_trackPageview', cleanHash]);
		  $("#content_loading").fadeOut(250,function() {
			  $("#content_loader").fadeIn(250);
		  });
		});	

	});	
}

// Hash
$(window).bind('hashchange', function() {
	loadContent(window.location.hash);	
});


function load_img(img,title){
	$("#artIndex_series").hide();
	$("#artIndex_cards").hide();
	$("#artIndex_icons").hide();
	$("#img_title").hide();
	$("#img_placeholder").hide();
	$("#img_loader").hide(function() {
		document.getElementById('img_title').innerHTML = title;
		$("#img_loader").fadeIn(250);	
		$("#artIndex_series").hide();
		$("#img_placeholder").load("incl/image.php?img="+img, function() {
			$("body").scrollTo("#top");
			$("#artIndex_series").hide();
			_gaq.push(['_trackPageview', title]);
			$("#artIndex_series").hide();
			$("#img_title").show();
			$("#img_placeholder").show();
		});		
	
	});
	$("#artIndex_series").hide();
	$("#artIndex_cards").hide();
	$("#artIndex_icons").hide();	
	$("#artIndex_series").hide();
}

function close_img(){
		document.getElementById('img_title').innerHTML = '';
		document.getElementById('img_placeholder').innerHTML = '';
		$("#img_title").hide();
		$("#img_placeholder").hide();
		$("#img_loader").fadeOut(250);
}

function go_back() {
	window.history.back();
}
