// JavaScript Document
var cur_li = '';

startList = function() {
  if (document.getElementById) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName == "LI") {
        node.onmouseover = function() {
		  hideShowOtherObj(1, this);
          this.className += " over";
        }
        node.onmouseout=function() {
		  hideShowOtherObj(2, this);
          this.className = this.className.replace(" over", "");
        }
      }
    }
  }
}

function hideShowOtherObj(act, nobj) {
  if (document.getElementById) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName == "LI" && node != nobj) {
		if (act == 1) {
		  if (node.className.indexOf('current_page_item') > 0 || node.className.indexOf('current_page_parent') > 0) {
			for (j=0; j<node.childNodes.length; j++) {
			  if (node.childNodes[j].nodeName == "UL") {
				node.childNodes[j].style.display = 'none';
			  }
			}
		    cur_li = i;
		  }
		}
		else {
		  if (cur_li != '' && cur_li == i && node != nobj) {
			for (j=0; j<node.childNodes.length; j++) {
			  if (node.childNodes[j].nodeName == "UL") {
				node.childNodes[j].style.display = 'block';
			  }
			}
			cur_li = '';
		  }
		}
      }
    }
  }
}

window.onload = startList;
