// om en om classes in lijsten
function TMLComenom(id,tag){

  if (document.getElementById) {
    var even = false;
    var root = document.getElementById(id);
    if (! root)
      return;
  
    var childs = root.childNodes;
  
    for(var i=0;i<childs.length;i++) {
      var node=childs[i];
      if (String(node.tagName).toUpperCase() == tag.toUpperCase()){
        if (even)
          node.className += " evenColor";
        else
          node.className += " oddColor";
        even = !even;
      }
    }

  }

}



/* hover-menu for IE */
startList = function() {
    if (document.getElementById) {

        navRoot = document.getElementById("root");
        listElements = navRoot.getElementsByTagName("LI");

        for (i=0; i<listElements.length; i++) {
            node = listElements[i];
            // show on mouseover (only necessary for IE)
            if (document.all) {
                node.onmouseover = function() {
                    this.className += " over";
                }
                node.onmouseout = function() {
                    this.className = this.className.replace(" over","");
                }
            }
            // show on focus
            nodeAnchors = node.getElementsByTagName("A");
            nodeAnchors[0].onfocus = function() { // when anchor is focused
                this.parentNode.className += " over";
            }
            nodeAnchors[0].onblur = function() { // when anchor is blurred
                if (this.parentNode.getElementsByTagName("UL").length < 1) { // if blurred item has no submenu
                    this.parentNode.className = this.parentNode.className.replace(" over","");
                }
                // als LI is laatste LI van UL, dan class van de LI waar die UL in zit halen
                if (this.parentNode == this.parentNode.parentNode.lastChild) {
                    this.parentNode.parentNode.parentNode.className = this.parentNode.parentNode.parentNode.className.replace(" over","");
                }
                // en nog een stap verder
                if (this.parentNode.parentNode.parentNode == this.parentNode.parentNode.parentNode.parentNode.lastChild) {
                    this.parentNode.parentNode.parentNode.parentNode.parentNode.className = this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(" over","");
                }
            }
        }

    }
    TMLComenom('root','li');
}
window.onload = startList;

function submitForm () {
    var idSel = document.getElementById('idSelect');
    var id_subid = idSel.options[idSel.selectedIndex].value;

    var id_arr = id_subid.split(',');

    idSel.options[idSel.selectedIndex].value = id_arr[0];
    document.getElementById('formSubId').value = id_arr[1];
    //alert(document.getElementById('formSubId').value);
    document.forms.xLinksForm.submit();
    return false;
}
