var DHDSite = {
	
	// here’s all the options for things
	options:
	{
		navBackgroundTime: 300
	},
	
	
	// the current page (stops the animation from playing twice)
	currentPage: "",
	
		
	navBackground:
	{		
		normal:	{backgroundPosition:"(0 0px)", color:'#FFF'},//, 'textShadow': '0px 1px 0px #000'},
		hover:	{backgroundPosition:"(0 -80px)", color:'#FFF'},// 'textShadow': '0px 1px 0px #000'},
		selected: {backgroundPosition:"(0 -160px)", color:'#000'}//, 'textShadow': '0px 1px 0px #fff'}
	},
	
	
	
	
	setupPage: function(pageName)
	{
		$('#nav_'+DHDSite.currentPage).animate(this.navBackground.normal, {queue:true, duration:this.options.navBackgroundTime});
		$('#nav_'+pageName).stop().animate(this.navBackground.selected);
		
		this.currentPage = pageName;
	},
	
	
	setup: function()
	{
		
		// Only try and animate text shadow if it's supported
		if($('#nav ul a')[0].style.textShadow != null)
		{
			this.navBackground.normal.textShadow   = '0px 1px 0px #000';
			this.navBackground.hover.textShadow    = '0px 1px 0px #000';
			this.navBackground.selected.textShadow = '0px 1px 0px #fff';
		}
		
		$('#nav ul a')
			.css({backgroundPosition:"0 0"})
			.mouseover(
			function()
			{
				$(this).stop().animate(DHDSite.navBackground.hover, DHDSite.options.navBackgroundTime);//.rotateAnimation(20);
			}
			).mouseout(
			function()
			{
				if(this.id=='nav_'+DHDSite.currentPage)
				{
					$(this).stop().animate(DHDSite.navBackground.selected, DHDSite.options.navBackgroundTime);

				}
				else
				{
					$(this).stop().animate(DHDSite.navBackground.normal, DHDSite.options.navBackgroundTime);
				}
			}
			);
	}
}



// setup everything when the page is ready…
$(document).ready(function() {
	DHDSite.setup();
});
