  // These scripts were originally found on cooltype.com.
  // Modified 01/01/1999 by Tobias Ratschiller for linuxapps.com

  // Modified 7th June 2000 by Brian Birtles for Mozilla 5.0
  // compatibility for phpMyAdmin

  // Modified May 2001 by Bertrand GAMBAUDO for Alcatel Vacuum


var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4)) ? true : false;
DOM=(!document.layers && !document.all && bV>=4) ? true : false; // A hack to guess if the browser supports the DOM
capable = (NS4 || IE4 || DOM) ? true : false;

function expandIt(){return}
function expandAll(){return}

isExpanded = false;

function getIndex(el) {
  ind = null;
  for (i=0; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    if (whichEl.id == el) {
      ind = i;
      break;
    }
  }
  return ind;
}

function arrange() {
  nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
  for (i=firstInd+1; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    if (whichEl.visibility != "hide") {
      whichEl.pageY = nextY;
      nextY += whichEl.document.height;
    }
  }
}

function initIt(){
  if (NS4) {
    for (i=0; i<document.layers.length; i++) {
      whichEl = document.layers[i];
      if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
    }
    arrange();
  } else if(IE4) {
    tempColl = document.all.tags("DIV");
    for (i=0; i<tempColl.length; i++) {
      if (tempColl(i).className == "child") tempColl(i).style.display = "none";
    }
  } else if(DOM) {
    for (i=0; i<document.getElementsByTagName("DIV").length; i++) {
      if (document.getElementsByTagName("DIV")[i].className == "child") document.getElementsByTagName("DIV")[i].style.display = "none";
    }
  }
}

function expandIt(el) {
  if (!capable) return;
  if (IE4) {
    expandIE(el);
  } else if(NS4) {
    expandNS(el);
  } else if(DOM) {
    expandDOM(el);
  }
}

function expandIE(el) {
  whichEl = eval(el + "Child");

        // Modified Tobias Ratschiller 01-01-99:
        // event.srcElement obviously only works when clicking directly
        // on the image. Changed that to use the images's ID instead (so
        // you've to provide a valid ID!).

  //whichIm = event.srcElement;
        whichIm = eval(el+"Img");

  if (whichEl.style.display == "none") {
    whichEl.style.display = "block";
    whichIm.src = "/all/components/images/menu/puce_on.gif";
  }
  else {
    whichEl.style.display = "none";
    whichIm.src = "/all/components/images/menu/puce_on.gif";
  }
    window.event.cancelBubble = true ;
}

function expandNS(el) {
  whichEl = eval("document." + el + "Child");
  whichIm = eval("document." + el + "Parent.document.images['imEx']");
  if (whichEl.visibility == "hide") {
    whichEl.visibility = "show";
    whichIm.src = "/all/components/images/menu/puce_on.gif";
  }
  else {
    whichEl.visibility = "hide";
    whichIm.src = "/all/components/images/menu/puce_on.gif";
  }
  arrange();
}

function expandDOM(el) {
  whichEl = el + "Child";
  whichIm = el+"Img";

  if (document.getElementById(whichEl).style.display == "none") {
    document.getElementById(whichEl).style.display = "block";
    document.getElementById(whichIm).src = "/all/components/images/menu/puce_on.gif";
  }
  else {
    document.getElementById(whichEl).style.display = "none";
    document.getElementById(whichIm).src = "/all/components/images/menu/puce_on.gif";
  }
  document.getElementById(whichEl).style.visibility = "visible";
}

function showAll() {
  for (i=firstInd; i<document.layers.length; i++) {
    whichEl = document.layers[i];
    whichEl.visibility = "show";
  }
}

function expandAll(isBot) {
  // Brian Birtles 7-Jun-00 : This fn might be unnecessary (for phpMyAdmin).
  // My changes are certainly untested.
  newSrc = (isExpanded) ? "/all/components/images/menu/puce_on.gif" : "/all/components/images/menu/puce_on.gif";

  if (NS4) {
        // TR-02-01-99: Don't need that
        // document.images["imEx"].src = newSrc;
    for (i=firstInd; i<document.layers.length; i++) {
      whichEl = document.layers[i];
      if (whichEl.id.indexOf("Parent") != -1) {
        whichEl.document.images["imEx"].src = newSrc;
      }
      if (whichEl.id.indexOf("Child") != -1) {
        whichEl.visibility = (isExpanded) ? "hide" : "show";
      }
    }

    arrange();
   if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
  } else if(IE4) {
    divColl = document.all.tags("DIV");
    for (i=0; i<divColl.length; i++) {
      if (divColl(i).className == "child") {
        divColl(i).style.display = (isExpanded) ? "none" : "block";
      }
    }
    imColl = document.images.item("imEx");
    for (i=0; i<imColl.length; i++) {
      imColl(i).src = newSrc;
    }
  } else if(DOM) {
    divColl = document.getElementsByTagName("DIV");
    for (i=0; i<divColl.length; i++) {
      if (divColl(i).className == "child") {
        divColl(i).style.visibility = (isExpanded) ? "hidden" : "visible";
      }
    }
    imColl = document.getElementsByName("imEx");
    for (i=0; i<imColl.length; i++) {
      imColl(i).src = newSrc;
    }
  }

  isExpanded = !isExpanded;
}

with (document) {
  if (DOM) {
    var lstyle = "<link rel='stylesheet' href='/all/components/styles/menuDOM.css' type='text/css'>";
    write(lstyle);
  } else if(NS4) {
		write("<link rel='stylesheet' href='/all/components/styles/menuNS4.css' type='text/css'>");
  } else if(IE4) {
		write("<link rel='stylesheet' href='/all/components/styles/menuIE4.css' type='text/css'>");
  }
}


onload = initIt;