// JavaScript Highlight Current link.
//
// Based on Inigo Surguy's version at:
// http://www.surguy.net/menu/highlight.html

// Modified by Kevin Cannon http://www.multiblah.com
// verion 1.2

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

// Searches through the doc looking for links
// Only checks the navigation ID
// Changes class of the current link to /currentlink
function highlightCurrentLink() {
  
  // Get the current URL
  var currentLocation = getURL();
  
  var links = document.links;
  //getElementsByTagName("a");

  for (i=0; i<links.length; i++) {
  
	  //alert("got it");
	  // Get the link href
	linkHref = links[i].href;
	
    // Compare the target link with URL
	if (linkHref == currentLocation) {
	  //alert("got it");
	  // Set class for different browsers
      links[i].setAttribute("className", "currentlink");
      //links[i].setAttribute("id", "currentlink");
	  links[i].setAttribute("class", "currentlink");
      
   }

  }

}


function addHandler( Target , theEvent , Handler, useCapture ) {
    // (c) Mark Lennox of http://www.webpusher.ie 2004
    eval( "var onTarget = Target.on" + theEvent + ";" );
    if ( Target.addEventListener ) {
        Target.addEventListener( theEvent , Handler , useCapture );
    } else if ( Target.attachEvent ) {
        Target.attachEvent( "on" + theEvent , Handler );
    } else if ( onTarget ) { // theory start
        onTarget = function piggyback() {
            onTarget();
            Handler();
        };
    } else { onTarget = Handler(); } // theory end
    return true; // for Netscape 6
}

// piggy back function onto on load event
addHandler( window, 'load' , highlightCurrentLink , false );

// Trigger the function onload
// window.onload = highlightCurrentLink;
