$(document).ready(function(){  
     setInterval("interativa()", 300); 
	 
 });  

 var currentAnchor = null;  
 //Function which chek if there are anchor changes, if there are, sends the ajax petition  
 function interativa(){  
     //Check if it has changes 
	 
     if(currentAnchor != document.location.hash){  
         currentAnchor = document.location.hash;  
         //if there is not anchor, the loads the default section  
         if(!currentAnchor)  
             query = "";  
         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 = "cat=" + section + params;  
         }  
         //Send the petition  
		 
		 	if(section=='index'){
				$('html, body').animate({scrollTop:0}, 1000);
			}
		 
		 	if(section=='trabalhos'){
				$('html, body').animate({scrollTop:0}, 1000);
			}
		 
		 	if(section=='contato'){
				$('html, body').animate({scrollTop:1000}, 1000);
			}
						
	}  
 }

