// gets 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();
	var nav = document.getElementById("menu");

	//alert ("currentLocation" + currentLocation);
	links = nav.getElementsByTagName("a");

	for (i=0; i<links.length; i++) {

		var linkHref = links[i].getAttribute("href")
		var linkHref = parseURL(linkHref);
		//alert("linkHref" + linkHref);

		if (linkHref==currentLocation) {
			//alert("link found");
			// Set class for different browsers
			links[i].setAttribute("className", "actmenu");
			links[i].setAttribute("class", "actmenu");
		}
	}
}