//On load page, init the timer which check if the there are anchor changes each 100 ms
$().ready(function(){
	setInterval("checkAnchor()", 100);
});
var currentAnchor = null;
//Function which checks if there are anchor changes, if there are, sends the ajax petition
function checkAnchor(){
	//Check if it has changed
	if(currentAnchor != document.location.hash){
		currentAnchor = document.location.hash;
		
		//if there is not anchor, the loads the default section
		if(!currentAnchor)
			query = "section=about";
		else
		{
			//Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2
			var splits = currentAnchor.substring(1).split('&');
			//Get the section
			var section = splits[0];
			delete splits[0];
			//Create the params string
			var params = splits.join('&');
			var query = "section=" + section + params;
			
		}
		//Send the petition
		$("#content").hide(); 
		$("#loading").show();	
		$.get("callbacks.php",query, function(data){
		$("#content").html(data);
		$("#loading").hide();
		$("#content").show();
		});
	}
}