var width = 183; //The width of each of the column links in whatever
var height = 506; //The height of the thingies
function fancyHover(i)
{
}

function fancyDeHover(i)
{
	$('#backgroundHoverThing' + i).css('backgroundPosition','left 506px');
	$('body').css('cursor','inherit');
}

var subNavEnter = '';

function addSubNavHover(id)
{
	var out;
	var over;
    $("li#" + id).bind("mouseover", function() {
		over = setTimeout(
			function() 
			{
				$("li#" + id + ' ul').slideDown("fast")
			}, 100);
		clearTimeout(out);
       
    }).bind("mouseout", function() {
		clearTimeout(over);
        out = setTimeout(
			function() 
			{
				$("li#" + id + ' ul').slideUp("fast")
			}, 100);
    }); 
}


$(document).ready(
	function ()
	{
		$('.hasSubNav').each(function ()
			{
				addSubNavHover($(this).attr("id"));
			});
		var pos = 0;
		
		$('.homeNavigation a').each(
			function (i)
			{
				$(this).mouseover(
					function ()
					{
						var positionLeft = i*width;
						
						//If this is past the third item, which is 185px instead of 183, then we add 2
						if(i > 2)
						{
							positionLeft = positionLeft + 2;
						}
						
						var positionTop = i*height;
						$('#backgroundHoverThing').css('backgroundPosition',positionLeft + 'px -' + positionTop + 'px');
						$('body').css('cursor','pointer');
					}).mouseout(
					function ()
					{
						
						$('#backgroundHoverThing').css('backgroundPosition','left 506px');
						$('body').css('cursor','inherit');
						
					});
			});
			//$('#sideNav').menu({content: $('#sideNav').next().html(), flyOut: true});
			
			//LAWYER LINKS
			$('#column3 ul li a').bind('mouseenter', function ()
				{
					$(this).children('span.normal').hide();
					$(this).children('span.hover').show();					
				}).bind("mouseleave", function ()
				{
					$(this).children('span.normal').show();
					$(this).children('span.hover').hide();					
				});
			
			//Main links
			$('#sideNav ul li a').bind('mouseenter', function ()
				{
					$(this).children('span.normal').hide();
					$(this).children('span.hover').show();					
				}).bind("mouseleave", function ()
				{
					$(this).children('span.normal').show();
					$(this).children('span.hover').hide();					
				});

	});