var thsPage = location.href;
var chk4space = thsPage.indexOf(" ")+1;  //check for spaces
while(chk4space!=0) {
	thsPage = thsPage.substring(0,chk4space-1) + "%20" +  thsPage.substr(chk4space);
	chk4space = thsPage.indexOf(" ")+1;
}
var chk4anchor = thsPage.indexOf('#')+1;  //check for anchor link
if (chk4anchor) { thsPage = thsPage.substring(0, chk4anchor-1); }
var chk4param = thsPage.indexOf('?')+1;  //check for http parameters
if (chk4param) { thsPage = thsPage.substring(0, chk4param-1); }
var chk4htm = thsPage.indexOf('.htm')+1;  //check for index pages
if (!chk4htm) {
	if ( thsPage.charAt(thsPage.length-1) == "/" ) { thsPage += "index.html"; }
	else { thsPage += "/index.html"; }
}
var lnks = document.getElementsByTagName('a');
var n;
for (n=0; n<lnks.length; n++) {
	if ( thsPage == lnks[n].href) {
		lnks[n].className = "currentpage";
	}
}
