// Sunset JavaScript Document
var closetimer = 0;    //the time left before closing a sub-menu
var theTime = 600;     //this is my control for how long it's open
var theOpenMenu = null;    //keep track of the fact that there is a sub menu open



function openMenu(thesubMenu){
	cancelTimer();  //no need to send a "close" command

	closeindexMenu(); //if a menu is already open, close it

	
	theOpenMenu=thesubMenu;	//I now have an open submenu
	document.getElementById(thesubMenu).style.display="block";
}

function closeindexMenu(){
	if(theOpenMenu){	
		document.getElementById(theOpenMenu).style.display="none";
		theOpenMenu=null;	
	}
}

function startTimer(){
	closetimer = window.setTimeout(closeindexMenu, theTime);
}

function cancelTimer(){
		if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
