function trace( msg ){
  if( typeof( jsTrace ) != 'undefined' ){
    jsTrace.send( msg );
  }
}

$(document).ready(function()
{
	trace("Go bitches");
	$("#nav-bar #search #sfield").example("SEARCH");
	
	$("#nav-bar").find(".nav-item").each(function()
	{
		if($(this).attr('class').indexOf('selected') != -1)
		{
			var pos = $(this).css("background-position");
			var splitPos = pos.split(" ");
			var newPos = splitPos[0]+" 0px";
			$(this).animate({backgroundPosition:"("+newPos+")"},{duration:200});	
		}
		else
		{
		
			$(this).mouseover(function()
			{
					var pos = $(this).css("background-position");
					var splitPos = pos.split(" ");
					var newPos = splitPos[0]+" 0px";
					trace(newPos);
										
					$(this).stop().animate({backgroundPosition:"("+newPos+")"},{duration:200});	
							
			})
			
			$(this).mouseout(function()
			{
					var pos = $(this).css("background-position");
					var splitPos = pos.split(" ");
					var newPos = splitPos[0]+" -53px";
					trace(newPos);
					$(this).stop().animate({backgroundPosition:"("+newPos+")"},{duration:500});
			})
		}		
	})
	
	$("#sidebar ul li").find("a").each(function()
	{
		$(this).mouseover(function()
		{
			$(this).stop().animate({paddingLeft: '10px', backgroundColor: "#eaeaea"}, 100);
		})
	
		$(this).mouseout(function()
		{
			$(this).stop().animate({paddingLeft: '5px',backgroundColor: "#ffffff"}, 300);
		})
	})
	
});