function highlightLink()
{
	//Get filename from the URL
	thisPage = document.URL.substring(document.URL.lastIndexOf("/")+1 ,document.URL.length);
	//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);
		//if the current filename & the link-ed file name are the same, change the background color of that link
		if (thisPage == pageLink)
		{	
			//BG is the name of a class that I have defined, that sets background color to grey
			document.links[i].className = "navilinkon";
		}
		
	}
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}
addEvent(window, 'load', highlightLink);

//window.onload=highlightLink;  