var eOpenMenu = null;
var eSRC = null;
var eMenu = null;

if (document.getElementsByTagName) {
 e1 = document.getElementsByTagName("body");
 if (e1[0].addEventListener) {
  e1[0].addEventListener("mouseover", mouseover, false); 
 } else if (e1[0].attachEvent) {
  e1[0].attachEvent("onmouseover", mouseover); 
 } else {
  e1[0].onmouseover = mouseover;
 }
} else {
 document.writeln('<p align="center">Your browser does not support the javascript drop down menus on this page.<br />The following browsers should be OK - IE5+ or Firefox.</p>');  
}

function OpenMenu(eSrctd,eMenu) {
 if (document.getElementById) {
  var eSrctdById = document.getElementById(eSrctd);
  var eMenuById = document.getElementById(eMenu);
  var menuBarById = document.getElementById("menuBar");
  var parentTop = eSrctdById.offsetTop;
  var parentLeft = eSrctdById.offsetLeft;
  if (eSrctdById.offsetParent) {
   while (eSrctdById.offsetParent != null) {
    eSrctdById = eSrctdById.offsetParent;  
    parentTop += eSrctdById.offsetTop;
    parentLeft += eSrctdById.offsetLeft;
   }
  }
//  if (document.all) {
//   selects = document.getElementsByTagName("select")
//   for (s=0;s<selects.length;s++) {
//    selects[s].style.visibility = "hidden";
//   }
//  } 
  eMenuById.style.top = menuBarById.offsetHeight + parentTop + 'px';
  eMenuById.style.left = parentLeft + 'px'; 
  eMenuById.style.visibility = "visible";
 }
 eOpenMenu = eMenu;
 return false;
}

function CloseMenu(eMenu) {
 if (document.getElementById) {
//  if (document.all) {
//   selects = document.getElementsByTagName("select")
//   for (s=0;s<selects.length;s++) {
//    selects[s].style.visibility = "visible";
//   }
//  } 
  document.getElementById(eMenu).style.visibility = "hidden";
 } 
 eOpenMenu = null;
 return false;
}

function mouseover(e) {
 if (e.target) {
   eSrc = e.target;
   if (!eSrc.id && eSrc.nodeName && eSrc.nodeName == "#text" && eSrc.parentNode) {eSrc = eSrc.parentNode;} 
 } else {
  if (window.event) {
   eSrc = window.event.srcElement;
  } 
 }
 if (!eSrc.id && eSrc.className) {eSrc.id = eSrc.className;}
 if (!eSrc.id && eSrc.getAttribute) {eSrc.id = eSrc.getAttribute("class");} 
 if (eSrc.id && eSrc.id.indexOf("menuBarItem") != -1) {
  var eMenu = eSrc.id.replace("menuBarItem","menu");
  var eSrctd = eSrc.id;
  if (eOpenMenu && eOpenMenu != eMenu) {CloseMenu(eOpenMenu);}
  if (eMenu) {OpenMenu(eSrctd,eMenu);}
 } else if (eOpenMenu) {
  if (!eSrc.id) {
   CloseMenu(eOpenMenu);
  } else if (eOpenMenu.indexOf(eSrc.id) == -1 && eSrc.id.indexOf("menu") == -1) {
   CloseMenu(eOpenMenu);
  }
 }
 return false;
}
