var mnuSelected = '';
var subMnuSelected = '';
var defaultTimeOut = 200000;
var timerOn = false;
var img = 'btnFindThePrograms01';

//Optional function allows for timouts on mouse out action.
function startTimeOut () {
	if (mnuSelected != '' && !timerOn) {
		timer = setTimeout('timeOutHideMenus()', defaultTimeOut);
		timerOn = true;
	}
}

//Optional function allows for timouts on mouse out action.
function resetTimeOut () {
	if (timerOn) {
		clearTimeout(timer);
		timerOn = false;
	}
}

//Optional function allows for timouts on mouse out action.
function timeOutHideMenus () {
	if (timerOn) {
		document.getElementById("findTheProgramMenu01").style.display = 'none';
		document.getElementById("btnFindThePrograms01").style.display = 'none';
		mnuSelected = '';
		timerOn = false;
	}
}

//Show the menu defined by 'menu.'
function showMenu (menu) {
	if (mnuSelected == menu) {
		hideMenu(menu);
		mnuSelected = '';
	} else {
		hideMenu(mnuSelected);
		document.getElementById(menu).style.display = 'block';
		document.getElementById(img).style.display = 'block';
		mnuSelected = menu;
	}
	return false;
}

//Will allow for system-style menus. If a user clicks a menu then they
//can pan through the other menus by simple scrolling over them.
function continueShowMenu (menu) {
	if (mnuSelected != '' && mnuSelected != menu) {
		hideMenu(mnuSelected);
		document.getElementById(menu).style.display = 'block';
		document.getElementById(img).style.display = 'block';
		mnuSelected = menu;
	}
}

//Hide the menu defined by 'menu.'
function hideMenu (menu) {
	if (mnuSelected != '' && menu != '') {
		document.getElementById(menu).style.display = 'none';
		document.getElementById(img).style.display = 'none';
		mnuSelected = '';
	}
}

//Show the submenu defined by 'menu.'
function showSubMenu (menu) {
	document.getElementById(menu).style.display = 'block';
	subMnuSelected = menu;
}

//Hide the submenu defined by 'menu.'
function hideSubMenu (menu) {
	if (subMnuSelected != '') {
		document.getElementById(menu).style.display = 'none';
	}
}

//Hides all Menus.
function hideMenus () {
	document.getElementById("findTheProgramMenu01").style.display = 'none';
	document.getElementById("btnFindThePrograms01").style.display = 'none';
}

//Will these menus work in this browser?
function doMenusWork () {
	if (document.getElementById != null &&
		document.body.style.display != null) {
		return true;
	} else {
		return false;
	}
}
