

function getLeaf(url) { 
	
	return (url.split("/")[3] + '/'); 
	} 
	

function highlightCurrentMenuItem() { 
	var currentLocation = getLeaf(document.location.href);
	var menu = document.getElementById("nav"); 
	var links = menu.getElementsByTagName("li");
	var currentHref = ""; 
	for (i=0; i<links.length; i++) { 
		var currentAnchor = links[i].getElementsByTagName("a");
		if  (currentAnchor[0] != null){
		currentHref = currentAnchor[0].getAttribute("href");}
		var curLocLeaf = getLeaf(currentHref);
		if (curLocLeaf=='home/') { 
				// Setting class is needed for Mozilla compatibility - className appears to be correct 
				// according to the DOM spec 
				currentAnchor[0].setAttribute("class", ""); 
				currentAnchor[0].setAttribute("className", ""); 
				// More obvious to use parentNode.parentNode.firstChild, but this 
				// may give a whitespace text node. 
				 
			} 
			else if (curLocLeaf==currentLocation) { 
				// Setting class is needed for Mozilla compatibility - className appears to be correct 
				// according to the DOM spec 
				if  (currentAnchor[0] != null){
				currentAnchor[0].setAttribute("class", "selected"); 
				currentAnchor[0].setAttribute("className", "selected"); }
				// More obvious to use parentNode.parentNode.firstChild, but this 
				// may give a whitespace text node. 
				 
			} 
	} 
}



