// change the nav element classes to reflect current page
window.onload = function () { //do the persist		  
	var lis = document.getElementById('navs').getElementsByTagName('li');
	var hrefs = document.getElementById('navs').getElementsByTagName('a');	
	var pg = window.location.href;
	if (pg.charAt(pg.length-1)=='#') pg=pg.substring(0, pg.length-1); // check if there's a trailing anchor and remove it		
	for (i=0;i<lis.length;i++) {
		if(lis[i].className=='sub selected') lis[i].className='sub';
	}	
	for (i=0;i<hrefs.length;i++) {		
		if(hrefs[i].className=='selected') hrefs[i].className='';		
		var pgAt = hrefs[i].href;	
		//var pgAt2 = pgAt.lastIndexOf('/',pgAt.length);		
		//pgAt = pgAt.substring(pgAt2,pgAt.length); 
		if(pg.indexOf(pgAt)>-1) { //&& hrefs[i].parentNode.className!='sub') {	
		//alert(pgAt)			
			hrefs[i].parentNode.parentNode.parentNode.parentNode.className = 'sub selected';
			if (!document.all) hrefs[i].parentNode.parentNode.parentNode.parentNode.firstChild.nextSibling.className = 'selected';
			else hrefs[i].parentNode.parentNode.parentNode.parentNode.firstChild.className = 'selected';		
		}
	}	
// end onload.	
}