/**
 * JQuery magic happens here...
 */

$(document).ready(function(){
	
	var hash = window.location.toString().split ("#");
	var section = "";
	
	if (hash.length > 1)
		section = hash[hash.length-1];
	
	$().ajaxStart(function (){$("#loading").show();});
	$().ajaxStop(function (){$("#loading").hide();});
	
	$("#blog").load ('../getfeed.php?target=blog');
	
	if (section.length !== 0)
	{
		$(".active").removeClass("active");
		$(".content").hide();
		$("a.tab[title="+section+"]").addClass("active");
		$("#"+section).show();
	}
	
	// When a link is clicked
	$("a.tab").click(function () {
				
		// switch all tabs off
		$(".active").removeClass("active");
			
		// switch this tab on
		$(this).addClass("active");
			
		// slide all content up
		$(".content").slideUp();
			
		// slide this content up
		var content_show = $(this).attr("title");
		$("#"+content_show).slideDown();
		  
	});
});
