﻿function highlightLink()
{
	//Get filename from the URL
	thisPage = document.URL.substring(document.URL.lastIndexOf("/")+1 ,document.URL.length);
	//alert(thisPage);
	//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
		if (thisPage == pageLink)
		{	
			//BG is the name of a class that I have defined, that sets background color to grey
			document.links[i].className = "selectlink";
			i=document.links.length;
		}
		
	}*/
	var div = document.getElementById('box1'); 
	if(!div ) return; 
	var aNodeList = div.getElementsByTagName("A"); 
	for( var i = 0; i < aNodeList.length; i++ ) 
		{ 
			var	pageLink = aNodeList.item(i).href.substring(aNodeList.item(i).href.lastIndexOf("/")+1 ,aNodeList.item(i).href.length);
  			if (thisPage==pageLink)
  				{
  			aNodeList.item(i).className = "selectlink"; 
  			i=aNodeList.length;
  				}
		} 
}


