
$j(document).ready(function(){
			//alert('ready');	
	
	checkURL();
	$j('a').click(function (e){
			checkURL(this.hash);

	});
	
	//filling in the default content
	//default_content = $j('#pageContent').html();
	
	
	setInterval("checkURL()",250);
	
});

var lasturl="";

function checkURL(hash)
{
	if(!hash) hash=window.location.hash;
	
	if(hash != lasturl)
	{
		lasturl=hash;
		
		// FIX - if we've used the history buttons to return to the homepage,
		// fill the pageContent with the default_content
		
		if(hash=="")
			 requestPage('');

		//$j('#pageContent').html(default_content);
		
		else
		loadPage(hash);
	}
}


function loadPage(url)
{
	//url=url.replace('#page','');

 	   arrayLocation = url.split('#');	
	   //arrayLocation[0];
	    NewLocation =arrayLocation[1];
		
	//alert(NewLocation);
	
	 requestPage(NewLocation);
	

/*
	$j('#loading').css('visibility','visible');
	
	$j.ajax({
		type: "POST",
		url: "load_page.php",
		data: 'page='+url,
		dataType: "html",
		success: function(msg){
			
			if(parseInt(msg)!=0)
			{
				$j('#pageContent').html(msg);
				$j('#loading').css('visibility','hidden');
			}
		}
		
	});
*/
}