// pulldown form
$(document).ready(function(){
	$('div#pulldown').click(function() {
		  $('div#form').toggleClass('hidden').fadeTo('verySlow','1')
	});
});

// nav fader
$(document).ready(function(){
//nav fade
	$('#navigation ul li').hover(function(){
	this.check = this.check || 1;
	$(this).stop().fadeTo('veryslow',
	this.check++%2==0 ? 1 : 0.6);
	});
});
//eof

//page loader

var default_content="";

$(document).ready(function(){
	
	checkURL();
	$('ul#navigation-item li a').click(function (e){

			checkURL(this.hash);

	});
	
	//filling in the default content
	default_content = $('#content-wrapper').html();
	
	
	setInterval("checkURL()",500);
	
});

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=="")
		$('#content-wrapper').html(default_content);
		
		else
		loadPage(hash);
	}
}


function loadPage(url)
{
	url=url.replace('#page','');
	

	$.ajax({
		type: "POST",
		url: "loader.php",
		data: 'page='+url,
		dataType: "html",
		success: function(msg){
			
			if(parseInt(msg)!=0)
			{
				$('#content-wrapper').html(msg);
			}
		}
		
	});

}


