// globalNav.js
// 	Contains the dynamic functionality for the drop down navigation found at the top of most templates.

// FUNCTION LIST:
// 	init();
// 	menuOn();
// 	menuOff();


var menuTimeout;
var currentMenu;

var navIsLoaded = false;

// Initializing the global navigation

// change init() to globalNavInit()
function init() {
	DynLayerInit()
	navIsLoaded = true;	// boolean to true when initialization is complete
}

// Display the dropdown menu.  // inputs: menuName  - name of the menu DIV layer without the Div.  ie. vehicles  // output: none
function menuOn(menuName) {
	var theMenu
	if (!navIsLoaded) return;	// check if initialization is complete
	if (menuTimeout) clearTimeout(menuTimeout);	// clear the timeout

	if (currentMenu) {			// hide the current menu
		theMenu = eval(currentMenu);
		theMenu.hide();
	}
	currentMenu = menuName;
	theMenu = eval(currentMenu);
	theMenu.show();				// display menuName
	// Next line commented out to match Flash nav version
}

// Hides the dropdown menus  // inputs: menuName - name of the menu DIV layer without the Div.  ie. vehicles  // outputs: none
function menuOff(menuName) {
	if (!navIsLoaded) return;	// check if initialization is complete

	if (menuTimeout) clearTimeout(menuTimeout);	// clear the current timeout
	menuTimeout = setTimeout(menuName + '.hide()', 000);		// set the new timeout -> was 500 before edit for landsystems
}


function menuOffAll() {
	if (currentMenu) {			// hide the current menu
		theMenu = eval(currentMenu);
		theMenu.hide();
	};
}
