function getLeaf(url) 
{
  var leaf = url.substring(url.lastIndexOf("/")+1);
  if (leaf.length == 0) {
    var folder = url.substring(0, url.lastIndexOf("/"));
    leaf = folder.substring(folder.lastIndexOf("/")+1);
  }
  return leaf;
}
function highlightCurrentMenuItem() 
{
  var currentLocation = getLeaf(document.location.href);
  var menu = document.getElementById("menu");
  links = menu.getElementsByTagName("a");
  for (i=0; i<links.length; i++) {
    var currentHref = links[i].getAttribute("href");
    var currentLeafName = getLeaf(currentHref);
    if (currentLeafName == currentLocation) {
      links[i].setAttribute("id", "current");
    }
  }
}

highlightCurrentMenuItem();
