window.onload=init;

nn4=(document.layers)?true:false;
ie4=(document.all)?true:false;


var timeout_id = null;
var current_menu = "";
var keep = "";

var DHTMLok = (document.layers || document.all || document.getElementById) ? true : false;

var curObj=null;


function getObj(obj){
 if(document.all) return document.all[obj].style;
 else if(document.layers)	return document.layers[obj];
 else return document.getElementById(obj).style;
} 


function init() {
//  document.onclick = mouseClick;
//  if(nn4) { document.captureEvents(Event.MOUSECLICK); }
}

//function mouseClick(e) {
//  hide_current();
//  return true;
//}

function hide_current() {
 if (current_menu.length)
 {
   hideLayer(current_menu);
 }
}


function hideLayer(menuName) {
 if (!DHTMLok) return false; 
 if (keep!=menuName) {
  getObj(menuName).visibility = "hidden";
 }
 current_menu = '';
 return true;
}


function cleartimers() {
  if (timeout_id!= null)
  {
	clearTimeout(timeout_id);
  }
}


function hidetimeout(menuName) {
 keep = '';
 if (timeout_id != null)
 {
	clearTimeout(timeout_id);
 }
 timeout_id = setTimeout("hideLayer('" + menuName + "')", 300);
 return true;
}


function hidetimeoutfast(menuName) {
 keep = '';
 if (timeout_id != null)
 {
	clearTimeout(timeout_id);
 }
 timeout_id = setTimeout("hideLayer('" + menuName + "')", 100);
 return true;
}


function popUp(menuName,on) {
 cleartimers();
 if (menuName != current_menu) {
    hide_current();
	getObj(menuName).visibility = "visible";
	current_menu = menuName;
	return true;
 }
}