
/*alert ("window.location.hash: " + window.location.hash + "\n" +
		"window.location.host: " + window.location.host + "\n" +
		"window.location.hostname: " + window.location.hostname + "\n" +
		"window.location.href: " + window.location.href + "\n" +
		"window.location.pathname: " + window.location.pathname + "\n" +
		"window.location.port: " + window.location.port + "\n" +
		"window.location.protocol: " + window.location.protocol + "\n" +
		"window.location.search: " + window.location.search
);*/


function visualiseNavigationMenu(navLinkName, selectedClassName, isURLFriendlyStyle){
	var navLinks = document.getElementsByName(navLinkName);//'navLink'
	var currentPage = getPageParameter(window.location, isURLFriendlyStyle);
	
	for (i=0; i<navLinks.length; i++){
		
		if (getPageParameter(navLinks[i], isURLFriendlyStyle) == currentPage){
			navLinks[i].setAttribute('class', selectedClassName);
			navLinks[i].className = selectedClassName;
		}
	}
}


function getPageParameter(url, isURLUserFriendly){
	
	if (isURLUserFriendly){
		return url.pathname;
	}
	
	var strSearchURL = url.search.substring(1).split("&");
	var strSearchStr = "page=";
	var strRetVal = "";
	
	for (j=0; j<strSearchURL.length; j++){
		if (
			(strSearchURL[j].length > strSearchStr.length) &&
			(strSearchURL[j].toLowerCase().substring(0, 5) == strSearchStr)){
				strRetVal = strSearchURL[j].substring(5);
				break;
			}
	}
	
	return strRetVal;
}
