//The variable used to keep track of the timeout for the hover
//(allows you to have the delay on the hover of the menu, so that the menu sticks around after you moved off the li's)
var currentTimeout;
var config = {    
     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
     interval: 1, // number = milliseconds for onMouseOver polling interval    
     over: function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		}, // function = onMouseOver callback (REQUIRED)    
     timeout: 500, // number = milliseconds delay before onMouseOut    
     out:function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		} // function = onMouseOut callback (REQUIRED)    
};


function mainmenu(){
$(" .navigation ul ").css({display: "none"}); // Opera Fix
$(" .navigation li").hoverIntent( config );
}


//go through each li in the list of "hoverable" li's and remove their hover attributes
function TurnOffAll()
{
	$(" #topNav ul ").css({visibility: "hidden"});
}


//what do do when the li is rolled off
function RollOff(li)
{
    currentTimeout = setTimeout("RemoveSynHover('" + li.id + "')",500);
}

 //remove the hover attributes of an li
function RemoveSynHover(LI_Id)
{
	 $("#" + LI_Id).find('ul:first').css({visibility: "hidden"});
}

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

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

}
