
function setmyclass()
{
// set this variable to the classname:
	var myclass = "current";
	
	var menubar = document.getElementById("MenuBar1"); // Starting Point
	var hrefs = menubar.getElementsByTagName("a"); // Get all anchors within the starting point
	var cururl, curnode; // used in loops.

	// Step through anchors, find those anchors who's URL contains the directory URL.
	for (i=0; hrefs.length; i++)
	{
		if(hrefs[i] != null)
		{
			cururl = hrefs[i].href;
			cururl = cururl.replace("index.html", ""); // URL of the directory
			curnode = null; // curnode is the parent LI element, whose class we will change
			if(location.href.indexOf(cururl) >= 0)
			{ 	
				// if the parent is a span, the parent of it, is the LI we are looking for
				if (hrefs[i].parentNode.tagName == "SPAN")
					curnode = hrefs[i].parentNode.parentNode
				else if (hrefs[i].parentNode.tagName == "LI") // otherwise, it is the element we're looking fors
					curnode = hrefs[i].parentNode;
					
				if (curnode != null)
					curnode.className = myclass; // set class on target element
			}           
		} 
		else 
		{
			break; // the array always contains an empty element at the end, ignore it.
		}
	}
}