
window.onload = function highlightLink(){

	//Get filename from the URL
	thisPage = document.URL.substring(document.URL.lastIndexOf("/")+1 ,document.URL.length);
	//alert(thisPage);
	if (thisPage == ""){
	//alert(document.links[i].className);
	document.getElementById("nav1").className = "current1";
	}

	//Loop through all the links
	for (i=0; i<document.links.length; i++ )
	{
		//Get only the filename from the href of navigation link
		pageLink = document.links[i].href.substring(document.links[i].href.lastIndexOf("/")+1 ,document.links[i].href.length);
		
		//alert(pageLink);
		//if the current filename & the link-ed file name are the same, change the background color of that link

		navnum = i;

		if (thisPage == pageLink)
		{
			//BG is the name of a class that I have defined, that sets background color to grey
			document.links[i].className = "current" + navnum;
			//alert ("current" + navnum);
			//alert (document.links.length);
		}

	}
}

