
// create variables
var subTimer;
var openMenu;
// to make sure that when user mouses over sub menu ul it stays open
$("ul.sub").mouseover(function() {
	$(this).show();
	// lets remember what's open
	openMenu = $(this).parent();
});
	
// when user mouses over main item in navbar
$("li.line").mouseover(function() {
	// close other nav item submenus
	if (typeof openMenu == "object") openMenu.children("ul").hide();
	// stop the timer
	clearTimeout(subTimer);
	// show this nav item's sub menu
	if ($(this) != openMenu) $(this).children("ul:hidden").show();
	
});

// when user's mouse leaves the navbar item
$("li.line").mouseout(function() {
	// lets keep tabs of what is open
		openMenu = $(this);
	// start the timer for 2 seconds until it closes.
		subTimer = setTimeout('openMenu.children("ul:visible").hide();', 2000);
});


