/* Internet Explorer does not properly render a submenu without a link in the title 
"insertMenuFixDivs" function inserts div tags into the title of each submenu to fix the problem. */

  function insertMenuFixDivs(nodeArray)
  {
    for (var i=0; i<nodeArray.length; i++) {
    
      if (nodeArray[i].tagName=='LI')
      {
        targetNodeSet = nodeArray[i].childNodes;
        
        for (var j=0; j<targetNodeSet.length; j++) {
          if ((targetNodeSet[j].nodeType==3)&&(targetNodeSet[j].nextSibling.tagName=='UL'))
          {
            newNode = document.createElement('div');
            newNode.setAttribute('class','iemenufix');
            newNode.appendChild(document.createTextNode(targetNodeSet[j].nodeValue));
            targetNodeSet[j].parentNode.replaceChild(newNode, targetNodeSet[j]);
            insertMenuFixDivs(targetNodeSet[j].nextSibling.childNodes);
          }
        }
      }
    }
  }

sfHover = function() {
  var mnuEl = document.getElementById("topnav");
  var sfEls = mnuEl.getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
      // this.style.zIndex=3000;
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
  
  if (mnuEl.childNodes.length > 1)
  {
    insertMenuFixDivs(mnuEl.childNodes[1].childNodes);
  }

}

sfHover2 = function() {
  var mnuEl = document.getElementById("worldmapmenu");
  var sfEls = mnuEl.getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
      // this.style.zIndex=3000;
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
  
  if (mnuEl.childNodes.length > 1)
  {
    insertMenuFixDivs(mnuEl.childNodes[1].childNodes);
  }

}

if (window.attachEvent) window.attachEvent("onload", sfHover);
if (window.attachEvent) window.attachEvent("onload", sfHover2);
