var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false; 
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox')>=0?true:false; 
var navigatorVersion = navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,'$1')/1; 
var exceptMenus = new Array(); 

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function menuHover(oE,eV,idm)
{
  if(eV.type=="mouseover")
	{
		var mc = document.getElementById('menu');
		var x2 = getposOffset(mc, "left");
    var x = getposOffset(oE, "left") - x2;
    var y = getposOffset(oE, "top") + 10;
    ShowDiv(idm,x,y);
  }
  if(eV.type=="mouseout")
	{ 
    setTimeout("HideDiv('"+idm+"')",499);
  }
}
function ShowDiv(idm,x,y)
{
  var el;
  el = document.getElementById(idm);
  if(el!=undefined)
	{
		el.style.left = x+"px";
		el.style.top = y+"px";
		el.style.display = 'block';
	}
}
function HideDiv(idm)
{
  if(array_in(exceptMenus,idm)) return; 
  var el;
  el = document.getElementById(idm);
  if(el!=undefined) el.style.display = '';
}
function array_in(arr,idm)
{
  var found = false;
  for(var no=0;no<arr.length;no++)
	{
    if(arr[no]==idm)
		{
      found = true;
    }
  }
  return found;
}
function array_add(arr,idm)
{
 arr.push(idm);
}
function moo(idm) {
  if(!array_in(exceptMenus,idm)) array_add(exceptMenus,idm);
}
function mii(idm) {
  exceptMenus = new Array();
  setTimeout("HideDiv('"+idm+"')",500);
}

activateMenu = function(nav) {
	if (document.all &&	document.getElementById(nav).currentStyle)
	{  
		var navroot = document.getElementById(nav);
    var lis=navroot.getElementsByTagName("LI");
		for (i=0; i<lis.length; i++)
		{
      if(lis[i].lastChild.tagName=="UL")
			{
       	lis[i].onmouseover=function() {	this.lastChild.style.display="block"; }
        lis[i].onmouseout=function() { this.lastChild.style.display="none"; }
      }
    }
  }
}

window.onload= function(){
    activateMenu('vertnav'); 
}

