jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$.preloadImages("/images/nav_company-hover.gif", "/images/nav_hosting-plans-hover.gif","/images/nav_addons-hover.gif","/images/nav_support-hover.gif","/images/nav_client-area-hover.gif");

if(typeof nav_current === "undefined")
	var nav_current = "";

$(document).ready(function() {
	$("div#navigation ul li.top").hover(
		function() { 
			if($(this).find("a").attr("id") != nav_current)
			{
				$image = $(this).find("img").attr("src");
				$image = $image.substring(0,$image.length-4) + "-hover.gif";
	
				$(this).find("img").attr("src",$image);
				$(this).addClass("over");
			}
		},
		function() {
			if($(this).find("a").attr("id") != nav_current)
			{
				$image = $(this).find("img").attr("src");
				$image = $image.substring(0,$image.length-10) + ".gif";
				
				$(this).find("img").attr("src",$image);
				$(this).removeClass("over");
			}
		}
	);
	
	if(nav_current != "")
	{
		$image = $("#" + nav_current).find("img").attr("src");
		$image = $image.substring(0,$image.length-4) + "-selected.gif";
		$("#" + nav_current).removeAttr("href");
		$("#" + nav_current).find("img").attr("src",$image);
	}
});