

//sets up the functions for the mouseover and mouse out for the li's with class of 'top_li' and a parent container with the id 'nav'
function enableMenuImageRollovers(id)
{
	$(id).mouseover(function()
	{
		var src = $(this).attr("src").replace("_off", "_on");
        $(this).attr("src", src);
	});

	
	$(id).mouseout(function()
	{
		var src = $(this).attr("src").replace("_on", "_off");
        $(this).attr("src", src);
	});
}

function correctSidebarBackground()
{
	var height = $("#sideNavInner").height();
	if ($("#sideNavInner").height() > 224)
	{
		$("#sideNavInner").css({backgroundPosition:'bottom center'});
	}
}


function clearReplaceDefault($id)
{
	var defValue = $($id).val();

	$($id).blur(function()
	{
		if(this.value=='')
		{
			this.value=defValue;
		}
	});
	$($id).focus(function()
	{
		if (this.value == defValue)
		{
			this.value = '';
		}
	});
}


function bindBehaviors()
{
	// quit if this function has already been called
	if (arguments.callee.done) return;

	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;

  
	correctSidebarBackground();
	clearReplaceDefault('#Search');


	enableMenuImageRollovers('.replaceMe');
}



if (window.addEventListener)
{
  window.addEventListener('load', bindBehaviors, false);

}
else if (window.attachEvent)
{
  window.attachEvent('onload',bindBehaviors);

}
