var hideMenuAfter = 200; // in milliseconds
var hideMenuAfterMain = 10;

var timerArray = new Array();

function hideSubmenu(id) {
	hideLayer(id);
}

function showSubmenu(id) {
	showLayer(id);
}

function showLayer(link,id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) {
		lyr.css.visibility = "visible";
		link.onmouseover = function() {
			clearTimeout(timerArray[id]);
			showLayer(link,id);
		}
		link.onmouseout = function() {
			startTimer(id, hideMenuAfterMain);
		}
		anc = lyr.getElementsByTagName('a');
		for (i=0;i<anc.length;i++)
		{
			anc[i].onmouseover = function () {
										clearTimeout(timerArray[id]);
									}
			anc[i].onmouseout = function () {
										startTimer(id, hideMenuAfter);
									}
		}
	}
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) {
		lyr.css.visibility = "hidden";
	}
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function startTimer(id, menudelay) {
	clearTimeout(timerArray[id]);
	timerArray[id] = setTimeout("hideSubmenu('" + id + "')", menudelay);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}