
// Global navigation menu
var submenuIO = 0;
var default_menu = null;
var default_submenu = null;
var current_menu = null;
var current_submenu = null;
var current_seciton = null;
var timeOut = null;

var idName = "";

function menusOff(menuIDd) {
	if (current_submenu != null) current_submenu.style.display = 'none';
	if (current_menu != null) {
		menuIDc=menuIDd;
		//alert("menuIDc= " + menuIDc);
		
		if (menuIDc==menuIDd){
				menuIDc=idName;
				//alert("idName= " + idName);
		}
		current_menu.style.backgroundImage = 'url(/nr/yohhrs/images/navs3/' + menuIDc + '.gif)';	
		default_menu.style.backgroundImage = 'url(/nr/yohhrs/images/navs3/' + menuIDd + '_hover.gif)';
		
	}
	submenuIO = 0;
}

function showSubmenu(menuID) {
	if (browser_test != 1) return;
	var menu = document.getElementById(menuID);


	if (submenuIO == 1) {
		//menusOff();
		menusOff(menuID);
	}
	
	if(menu==null){
		alert("menu obj is null");
	}else{

	

	menu.style.backgroundImage = 'url(/nr/yohhrs/images/navs3/' + menuID + '_hover2.gif)';
	default_menu.style.backgroundImage = 'url(/nr/yohhrs/images/navs3/' + menuIDx + '_hover.gif)';
	
	var submenuID = menuID + '-submenu';
	if (document.getElementById(submenuID) != null) {
		current_submenu = document.getElementById(submenuID);
		current_submenu.style.display = 'block';
	} else if (default_submenu != null) {
		default_submenu.style.display = 'block';
		current_submenu = default_submenu;
	}
	submenuIO = 1;
	current_menu = menu;
	idName=menuID;
	clearTimeout(timeOut);
	timeOut = setTimeout("showSubmenu(current_section)", 10000); // display time of mouseover menu event
	}
	return;
}

function browserCheck() {
	var app = navigator.appName.toLowerCase();
	var app_v = parseInt(navigator.appVersion);
	var ua = navigator.userAgent.toLowerCase();
	var plt = navigator.platform.toLowerCase();
	var check;
	if (window.opera) {
		if (ua.indexOf('opera 7') != -1 || ua.indexOf('opera/7') != -1) {
			check = 1;
		} else if (app.indexOf('opera') != -1 && app_v <= 7) {
			check = 0;
		} else {
			check = 0;
		}
	} else {
		check = 1;
	}
	return check;
}

var browser_test;
function initNav(menuID) {
	var submenuID = menuID + '-submenu';
	current_section = menuID;
	browser_test = browserCheck();
	default_menu = document.getElementById(menuID);
	default_submenu = document.getElementById(submenuID);
	current_submenu = default_submenu;
	menuIDx=menuID;
	//alert("menuID= " + menuID);
	//alert("menuIDx= " + menuID);
	submenuIO = 1;
	showSubmenu(menuID);
} 
