//On load page, init the timer which check if the there are anchor changes each 300 ms
$(document).ready(function(){
	setInterval("checarPaginaAtual()", 300);
});
var pagAtual = null;
//Function which chek if there are anchor changes, if there are, sends the ajax petition
function checarPaginaAtual(){
	//Check if it has changes
	if(pagAtual != document.location.hash){
		pagAtual = document.location.hash;
		//if there is not anchor, the loads the default section
		if(!pagAtual)
			query = "pagina=home";
		else
		{
			//Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2
			var splits = pagAtual.substring(1).split('&');
			//Get the section
			var section = splits[0];
			delete splits[0];
			//Create the params string
			var params = splits.join('&');
			var query = "pagina=" + section + params;
		}
		//Send the petition
		$("#loading").show();
		$.get("../_inc/class.php",query, function(data){
		$("#cont").html(data);
		$("a#example1").fancybox();
		$("#foo2").carouFredSel({
			curcular: false,
			infinite: false,
			auto : false,
			prev : {	
			button	: "#foo2_prev",
			key		: "left"
			},
		next : { 
		button	: "#foo2_next",
		key		: "right"
		},
	pagination	: "#foo2_pag"
	});

$(function() {
	$('#one').ContentSlider({
		leftBtn : '_css/i/slide/seta.png',
		rightBtn : '_css/i/slide/seta.png',
		width : '960px',
		height : '300px',
		speed : 400,
		easing : 'easeOutQuad'
	});
});

			$("#loading").hide();
		});
	}
}


