// JavaScript Document

function getCurrentPageFromURL()
{
	var pathName = window.location.pathname.toString();
	var pageName = pathName.substring(pathName.lastIndexOf("/") + 1);
	return pageName;

}

function checkSelected()
{
	document.write(getCurrentPageFromURL());	
}
/* get HREF link value from the tag passed in 
function getHREF(oTag)
{
	
}*/
function highlightCurrentLink()
{
	var currentLocation = document.location.href;
	var targetNode = document;
	
	// sets targetNode to leftNav to only search for links only within the leftNav
	//targetNode = 
	
	//get all links within targetNode
	links = document.getElementById("leftnav").getElementsByTagName("a");
	
	// loop through the links and compare to the currentLocation
	// if a match is found, change the class to "selected"
	for (i=0; i<links.length; i++){
		linkHref = links[i].href;
		
		if (linkHref==currentLocation){
			links[i].setAttribute("class",     "selected");
			links[i].setAttribute("className", "selected");
		}
	}

}

function addLoadEvent(func){
	var oldOnLoad = window.onload;
	if (typeof window.onload != 'function') 
	{
		window.onload = func;
	} 
	else 
	{
		window.onload = function() 
		{
			oldonLoad();
			func();
		}
	}
}

//addLoadEvent(highlightCurrentLink);