gxhCurrent = function() {
	var location = new String(window.location.href);
	if (location.lastIndexOf("/") > 0)
	{
		location = location.substring(location.lastIndexOf("/") + 1, location.length);
	}
	if (location == "")
	{
		// No explicit file name in location: default to index.html
		location = "index.html";
	}
	var navLIs = document.getElementById("nav").getElementsByTagName("UL")[0].childNodes;
	for (var i = 0; i < navLIs.length; i++)
	{
		if (navLIs[i].tagName == "LI")
		{
			var navAnchor = navLIs[i].childNodes[0];
			var navHREF = navAnchor.getAttribute("href");
			if (navHREF.lastIndexOf("/") > 0)			{
				navHREF = navHREF.substring(navHREF.lastIndexOf("/") + 1, navHREF.length);
			}
			if ((navHREF.indexOf("_") > 0) && (location.indexOf("_") > 0))
			{
				// Compare start of current document file name (up to first underscore)
				// with start of navigation tab link file name
				if ( navHREF.substring(0, navHREF.indexOf("_") + 1) == location.substring(0, location.indexOf("_") + 1) )
				{
					navAnchor.className = "current";
					navAnchor.style.className = "current";
					break;
				}
			}
			else {
				if ( navHREF == location )
				{
					navAnchor.className = "current";
					navAnchor.style.className = "current";
					break;
				}
			}
		}
	}
}

// IE: attach event
if (window.attachEvent) window.attachEvent("onload", gxhCurrent);

// Others: attach event
if (window.addEventListener) window.addEventListener("load", gxhCurrent, false);
