//These functions collectively make the cascading menu work/*'oldWhich' stores the value of the most recent menuheading to make the function call 'show_hide_sub'for the sake of the next menu heading which will call thefunction so that the function essentially knows whichsub-menu to hide and which to show.'timerId' is an integer variable which serves as an identifierfor the window.setTimeout method. Upon mouse out of either themain menu or sub menu, a timer is set so that it expiresafter 'expireTime' milliseconds, at which point it will hide the most recently shown sub menu (which is determined by 'oldWhich.' On mouse over of either a sub menu or main menu, thetimer is cleared and the sub menu indicated by oldWhich remains visible*/var oldWhich;var oldSubMenu;var timerId;var expireTime = 500;/*function to show or hide the sub-menu of the respective menu heading determined by 'which,' the argument passed byand that corresponds to the menu heading making the function call. The argument 'level' determines which level of the menu ismaking the call, either the main level, which we shall call the 'first' level, or the first sub menu level which we shall call the 'second' level (note: the second sub menu level will be denoted as the 'third' level for descriptive purposes although that level is not so pertinent to this function). The function first clears the timeout function which would otherwise hide the sub level menus. It then determines which menu level is making the call and sets the global variable 'secLevel' accordingly. If the level making the call is the second level then the function checks the existence of 'secOldWhich' which represents the previous third level menu displayed and upon verification of its existence it is hidden. It then checks to see if 'which' is null. Some elements of the second level call this function with a value of null. Any element that calls with 'which' as null does not havea third level menu and therefore should only hide the previously displayed third level menu (this is of course taken care of bythe previous 'if' statement described above). So if 'which' is not null, then the third level menu <div> represented by whichis set to visible and the global variable 'secOldWhich' is set to 'which', effectively storing a reference to the third level menu <div> which was just displayed for the sake of the next time this function is called. If the menu level that is making the call('level')is the first level, then the existence of 'secOldWhich' and 'oldWhich' are verified and the elements they represent are hidden. Then the <div> element respresented by 'which' is set to visible and 'oldWhich' is set to 'which' for the sake of the next time the function is called.*/function show_hide_sub(which){	clearTimeout(timerId);		var subMenu = which + "Menu";			if(oldWhich)	{		document.getElementById(oldWhich).style.backgroundColor = "#6699cc";		document.getElementById(oldSubMenu).style.visibility = "hidden";	}			navTwo(which);		if( subMenu )		document.getElementById(subMenu).style.visibility = "visible";		oldWhich = which;	oldSubMenu = subMenu;}/*function determines whether the mouse is over any menuelement and calls or clears the timeout function accordinglyfirst level menu items call this function on mouse outsecond level menu items do not call this functionthird level menu items call this on over and out.AS A GENERAL RULE (not that this has not been tested and proven, it is only conjecture), IT SEEMS THATFOR ANY CASCADING MENU SYSTEM WITH 'N' LEVELS, ONLY LEVEL ONE AND LEVEL 'N' SHOULD CALL THIS FUNCTION.LEVEL ONE SHOULD CALL IT ON MOUSE OUT AND LEVEL 'N' SHOULD CALL IT ON MOUSE OVER AND OUT. ALL OTHERMENU LEVELS SHOULD ONLY CALL THE ABOVE FUNCTION ON MOUSE OVER (also note that this rule only applies tocascading menus built on this methodology).*/function over_sub_menu(what){	if(what == "over")		clearTimeout(timerId);	if(what == "out")		timerId = setTimeout("do_timeout()",expireTime);}/*function handles the timeout of the menu system which basicallyis set so that all sub level menu items disappear after a time of'timerId' milliseconds unless the timeout function is cleared by one of the functions above. The conditions for clearingthe timeout are noted in the function descriptions above.*/function do_timeout(){	document.getElementById(oldWhich).style.backgroundColor = "#6699cc";	document.getElementById(oldSubMenu).style.visibility = "hidden";}/*function sets the background color of the first level nav item which calls it*/function navTwo(which){	document.getElementById(which).style.backgroundColor = "#84875f";}