function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length < 2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();
}
 
function setActiveMenu(arr, crtPage)
{
	for (var i=0; i < arr.length; i++)
	{
		if(extractPageName(arr[i].href) == crtPage)
		{
			if (arr[i].parentNode.tagName != "DIV")
			{
				arr[i].className = "current_page_item";
				arr[i].parentNode.className = "current_page_item";
			}
		}
	}
}
 
function setPage()
{
	hrefString = document.location.href ? document.location.href : document.location;
 
	if (document.getElementById("menu") !=null )
	setActiveMenu(document.getElementById("menu").getElementsByTagName("a"), extractPageName(hrefString));
	}
	
	window.onload=function()
{
	setPage();
}

// This script is for the quotes page - it shows & hides layers

var currlayerId = "default";

function toglayer(id) {
	if(currlayerId) setDisplay(currlayerId, "");
	if(currlayerId=="default")setDisplay("default", "none");
	if(id)setDisplay(id, "block");
	currlayerId = id;
}

function setDisplay(id,value) {//this function is used by multiple scripts
	var elm = document.getElementById(id);
	elm.style.display = value;
}
