var killCurrent = null;  // storage for code that hides the submenu

var currentSubmenuId = null;  // id of the currently visible submenu

var submenuTimeout = null;  // reference to the timeout used to delay hiding of submenus





// show submenu

function show(submenuId) {

	

	// clear the timeout (from earlier rolloff)

	clearTimeout(submenuTimeout);

	

	// if the current submenu and the new one are different, hide the current submenu

	if (currentSubmenuId != null && currentSubmenuId != submenuId) {

		eval(killCurrent);

	}

	

	// get reference to named submenu and show it

	sE(gE(submenuId));

	

	

	

	// store this submenu as the current one

	currentSubmenuId = submenuId;

}





// delayed hide of submenu 

function timedHide(submenuId) {

	

	// store the code that will do the true hiding in a global variable

	killCurrent = "hide('" + submenuId + "');"

	

	// execute that code in 30 seconds

	submenuTimeout = setTimeout(killCurrent, 30);

}



// immediate hide of submenu

function hide(submenuId) {

	

	// get reference to named submenu and hide it

	hE(gE(submenuId));

	

	

}



	