
function extractPageName(hrefString)
{
var arr = hrefString.split('.');
// Check to see if the url has a query string by searching for the question mark
var hasquestion=hrefString.indexOf('?');
if (hasquestion == '-1')
{
arr = arr[arr.length-2].split('/');
return arr[arr.length-1].toLowerCase();
}
else
{
return arr[arr.length-1].toLowerCase();
}
}


function setActiveMenu(arr, crtPage)
{
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{
			arr[i].className = "current";
			arr[i].parentNode.className = "current";
		}
}

function setPage()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("MENY")!=null) 
		setActiveMenu(document.getElementById("MENY").getElementsByTagName("a"), extractPageName(hrefString));
}

function setPage2()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("SORT")!=null) 
		setActiveMenu(document.getElementById("SORT").getElementsByTagName("a"), extractPageName(hrefString));
}