// Get's the URL and parses it
function getURL() {
  var url = document.location.href;
  return parseURL(url);
}

// Strips a URL to just the filename
function parseURL (url) {
  var fileName = url.split("/");
  fileName = (fileName[fileName.length-1]);
  return fileName;
}

// Searches through the doc looking for links
// Only checks the navigation ID
// Changes class of the current link to /currentlink
function highlightCurrentLink() {

  var currentLocation = getURL();
  if(currentLocation==''){
	  currentLocation='index.html';
  }
  //alert ("currentLocation" + currentLocation);
  links = $("menu").getElementsByTagName("a");

  for (i=0; i<links.length; i++) {
    linkHref = links[i].getAttribute("href")
	linkHref = parseURL(linkHref);
//	alert("linkHref: " + linkHref);
//	alert("currentlinkHref: " + currentLocation);
    if (linkHref==currentLocation) {
//	  alert("link found");
	  // Set class for different browsers
      links[i].addClassName('current'); //firefox
   }
 }
}
Event.observe(window,"dom:loaded",highlightCurrentLink);