
// -- functions for drop menu

var menu_timer = new Array();
var menu_cell = "";
var highlight = '#cccccc';
var menu_status = new Array();
var browser;

function browser(){
	if (document.all){
		browser = 'ie'
	}else if (document.getElementById){
		browser = 'moz'
	}else if (document.layers){
		browser = 'ns4'
	}
	return browser
}
browser = browser()



function persistent_highlight(cell){
	close_all_subs()
	if (cell) {
		menu_cell = cell
	}
}
function mouseon(cell,submenu){
	if (browser != 'ns4' && cell){
		cell.style.backgroundColor = highlight;
		cell.style.borderColor = '';
		cell.style.borderWidth = '1px';
		cell.style.paddingLeft = '5';
	}
	if (submenu){
		submenu_on(submenu)
	} else {
		close_all_subs()
	}
}
function mouseout(cell,submenu){
	
	if (browser != 'ns4' && menu_cell != cell && cell){
		cell.style.backgroundColor = ""
		cell.style.borderColor = '';
		cell.style.borderWidth = '1px';
		cell.style.paddingLeft = '5';
	}
	if (submenu){
		submenu_off(submenu)
	}
}

function menu(file_path){
	winpop=window.open(file_path,"ConsoleWindow1","toolbar=no,,width=550,height=447,directories=no,status=no,scrollbars=yes,resize=no,menubar=no");
	winpop.focus();
}


function menu_div(div_name){
	
	if (browser == 'ie'){
		construct = document.all[div_name].style;
	}else if (browser == 'moz'){
		construct = document.getElementById(div_name).style
	}else if (browser == 'ns4'){
		construct = document.layers[div_name]
	}
	return construct
}

function subClick(href){
	document.location.href = href
}
function submenu_on(menu){
	menu_status[menu] = 0;
	close_all_subs();
	clear_timer(menu);
	menu_status[menu] = 1;
	if (document.getElementById("hide_me")){
		menu_div("hide_me").visibility = 'hidden';
	}
	menu_div(menu).visibility = 'visible';
  	//menu_div(menu+"_bg").visibility = 'visible';
}
function submenu_off(menu){
	set_timer(menu)
}
function close_menu(menu){
		menu_div(menu).visibility = 'hidden';
		//menu_div(menu+"_bg").visibility = 'hidden';
		if (document.getElementById("hide_me")){
			menu_div("hide_me").visibility = 'visible';
		}
		menu_status[menu] = 0;
		if (!document.layers && menu_cell) menu_cell.style.backgroundColor = "";
}
function set_timer(menu){
	menu_timer[menu] = setTimeout("close_menu('"+menu+"')",1000)
}
function clear_timer(menu){
	clearTimeout(menu_timer[menu]);
}
function close_all_subs(){
	for (i in menu_status){
		if (menu_status[i] == 1) {
			close_menu(i);
			clear_timer(i);
		}
	}
}



function openWindow(url,win){
	if (win)
		newWin = window.open(url)
		newWin.location=url
}
