var currentMenuId = 'menuprod'; 
function startList(elem) {
//if (document.all&&document.getElementById) {
if (document.getElementById) {
  navRoot = document.getElementById(elem);
  if(navRoot) {
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
      node.onmouseover = function() {
        document.getElementById(currentMenuId).className="";
        if(this.className != "current") {
          this.className+=" over";
          this.className+=" current";
          currentMenuId = this.id;
        }
      }
      node.onmouseout = function() {
        document.getElementById(currentMenuId).className += "current";
      }
     }
    }
  }
 }
}

function getCurrentMenuId() {
if (document.getElementById) {
  if(document.getElementById("nav")) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        if (node.id.indexOf("current") > -1) {
          currentMenuId = node.id;
        }
      }
    }
    return currentMenuId;
    }
  }
}

function focusInput() {
//if (document.all&&document.getElementById) {
if (document.all&&document.getElementById) {
  nodes = document.getElementsByTagName("INPUT");
  for (i=0; i<nodes.length; i++) {
    node = nodes[i];

    if(node.getAttribute('type') != 'submit') {
      node.onfocus = function() {
        this.className += " inputFocus";
      }
      node.onblur = function() {
				var removeClassExpr = /inputFocus/;											
        this.className = this.className.replace(removeClassExpr, '');
      }
    } 
  }
 }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(getCurrentMenuId);
addLoadEvent(focusInput);
addLoadEvent(function() {
  startList('nav');
});


// Function to add a link to favourites
// For Opera/Mozilla use the rel and title tags 
// i.e. <a href="http://www.melbourneit.com.au" rel="sidebar" title="Melbourne IT">Bookmark me</a>
function addToFavourites(urlAddress,pageName) { 
  if (window.sidebar) { // Mozilla Firefox Bookmark
    //window.sidebar.addPanel(pageName,urlAddress,"");
    return true;
  } else if(window.opera && window.print) { // Opera Hotlist
    return true;  
  } else if (window.external) { // IE
    window.external.AddFavorite(urlAddress,pageName);  
  }
}

