// nav ----------------------------------------------------------------------//

var Navigation = {}

Navigation.init = function()
{
	if(location.hash.length == 0)
	{
		Navigation.section('#work');
	}
	else
	{
		Navigation.section(location.hash, false);
	}
	$('ul.nav a').click(Navigation.clickHandler);
}

Navigation.section = function(hash, animate)
{
	if(animate == undefined) { animate = true; }
	
	$('ul.nav a').removeClass('selected'); 
	$('ul.nav a[href=' + hash + ']').addClass('selected'); 
	if(hash == '#work')
	{
		if(animate)
		{
			$('#about').slideUp( ); 
			$('#contact').slideUp( ); 
		}
		else
		{
			$('#about').hide(); $('#contact').hide( );
		}
	}
	else if (hash == '#about')
	{
		
		if(animate)
		{
			$('#contact').slideUp();
			$('#about').slideDown( );
		}
		else
		{
			$('#contact').hide();
			$('#about').show();
		}
	}
	else if (hash == '#contact')
	{
		if(animate)
		{
			$('#about').slideUp();
			$('#contact').slideDown( );
		}
		else
		{
			$('#about').hide();
			$('#contact').show();
		}
	}
}

Navigation.clickHandler = function(e)
{
	e.preventDefault(); 
	Navigation.section($(this).attr('href'), true); 
}





// init ---------------------------------------------------------------------//

function init()
{
	var ie6 = ($.browser.msie && $.browser.version.substr(0,1) == '6');
	if(ie6)
	{
		$(':first-child').addClass('first-child');
		$(':last-child').addClass('last-child');	
		if(DD_belatedPNG)
		{
			DD_belatedPNG.fix('.screenshots li' ); 
		}
		$('.piece').append('<div style="clear:both;"></div>');
	}
	Navigation.init();
	
	
	$('ul.screenshots li').each( 
		function()
		{
			$(this).shadow('css/images/shadow.png',18)
		} 
	);
}	
$(document).ready(init);


//Cufon.replace('h2');
//	Cufon.replace('a.button', { hover:true });	