/* ***** Visible Statement Javascript **********************************
*               dataSpheric
*
* This code helps MSIE perform the same magic that newer browsers can do
* without any scripting, while at the same time adding an "organic"
* delay to menu collapse on mouseout.
*
* Some of this code is adapted from the Suckerfish Dropdown menu system
********************************************************************* */

window.onload = initiate;

var tos = new Array();

function destroyMenus(refrain) {
  if (document.all && document.getElementById) {
    navRoot = document.getElementById("menu");
    for (i = 0, y = 0; i < navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName == "LI" && node.id != refrain) {
        node.className = node.className.replace(' over', '');
      }
    }
  }
}

function initiate() {
  if (document.all && document.getElementById) {
    navRoot = document.getElementById("menu");
    for (i = 0, y = 0; i < navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName == "LI") {
        node.id = "node" + (++y);
        node.onmouseover = function() {
          destroyMenus('" + this.id + "');
          clearTimeout(tos['" + this.id + "']);
          this.className += " over";
        }
        node.onmouseout = function() {
          var mkfunc = "var submenu=document.getElementById('" + this.id + "');\n";
              mkfunc += "submenu.className=submenu.className.replace(' over', '');";
          tos['" + this.id + "'] = setTimeout(mkfunc, 500);
        }
      }
    }
  }
}
