// JavaScript Document

function ToggleChild() {
  var node, parent, i;
  parent = this.parentNode;
  for (i=0; i<parent.childNodes.length; i++) {
    node = parent.childNodes[i];
    if (node.nodeName=="UL") {
      if (node.style.display == "none") {
        node.style.display = "block";
        this.className += " open";
      }
      else {
        node.style.display = "none";
        this.className=this.className.replace(" open", "");
      }
    }
  }
  this.blur();
}
function InitializeNavigation() {
  var navRoot = document.getElementById("nav");
  if(navRoot){
    InitializeNavigation_ById();
  }else{
    InitializeNavigation_ByClass();
  }
  return true;
}
function InitializeNavigation_ById() {
  var navRoot, node, child, i, j;
  navRoot = document.getElementById("nav");
  for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
      for (j=0; j<node.childNodes.length; j++) {
        child = node.childNodes[j];
        if (child.nodeName=="UL") {
          child.style.display = "none";
        }
        if (child.nodeName=="A") {
          child.onclick = ToggleChild;
        }
      }
    }
  }
}
function InitializeNavigation_ByClass() {
  var node,navRoot, child, i, j,x;
  var zNavList = new Array();
//			  var zFullULList = GetElementsWithClassName('UL','NavTree')
	var zFullULList=$('NavTreeDiv').select('ul[class="NavTree"]');
  for(x=0;x<zFullULList.length;x++){
      zNavList[zNavList.length] = zFullULList[x];
  }
  for(x=0;x<zNavList.length;x++){
    navRoot = zNavList[x];
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        for (j=0; j<node.childNodes.length; j++) {
          child = node.childNodes[j];
          if (child.nodeName=="UL") {
            child.style.display = "none";
          }
          if (child.nodeName=="A") {
            child.onclick = ToggleChild;
          }
        }
      }
    }
  }
}
