<!-- //
// this script is run from the bottom of EACH page on the site.
// First it iterates through all the navigation ULs to hide all the list items;
// this happens ONLY if javascript is active in the client browser;
// if javascript is turned off, it leaves the fully expanded left navigation tree visible
// thus staying out of accessibility trouble and 'javascript is off' problems.

// first check if the page HAS the nav panel, and then if it has modern javascript available
if ((document.getElementById('leftNav')) && document.getElementById) {

// if yes, get all the ULs in the leftNav div
	var AllULs = document.getElementById('leftNav').getElementsByTagName('UL');
	var numULs = AllULs.length;

// then loop through and fold up all the sub lists and sub sub lists
	for (i=0; i < numULs; i++) {
		if (AllULs[i].className == "detailContainer") {
		AllULs[i].style.display = "none";
		}
	}

// THEN figure out what the current page's file name is;
// then the file name is compared to each of the URLs of the nav links, 
// and the li containing the currently active link is made red, 
// gets a title that says it's the current page;
// and gets '>>' at the end, all to indicate that 'you are here'.
// there are three cases: a regular page reference, a page reference w/ a '#' in it
// and a page reference that ends w/ a slash, as in the home page shorthand reference. 
// each are addressed.

	var currentLocation = document.location;
	var currentLocationText = new String(currentLocation);
	var currentLocationTextEnd = (currentLocationText.length - 4);
	var lastSlash = currentLocationText.lastIndexOf('/');
	var dropAnchors = currentLocationText.lastIndexOf('#');
	
	var startFileName = lastSlash + 1;

// if there is a '#' inside the page link being used
	if (dropAnchors != -1) {
	var EndOfFileName = dropAnchors - 4;
	var fileText = currentLocationText.slice(startFileName,EndOfFileName);
	} 
	else {
	// if there is NOT a '#' inside the page link being used
	var fileText = currentLocationText.slice(startFileName,currentLocationTextEnd);
	}

	if (lastSlash == (currentLocationText.length-1)) {
		currentLocationText = currentLocationText + 'index.php';
	}

var FileNameLength = currentLocationText.length;
// var wholeFileText = currentLocationText.slice(startFileName,FileNameLength);

// grab only the list items inside the leftNav div
	var listItems = document.getElementById('leftNav').getElementsByTagName('LI');
	var numListItems = listItems.length;

	for (i=0; i < numListItems; i++) {

		if (listItems[i].firstChild.href == currentLocationText) {  
				listItems[i].parentNode.className = "showDetailContainer";

			if ((listItems[i].parentNode.parentNode.parentNode.tagName == "UL") && (listItems[i].parentNode.parentNode.parentNode.className != "contentList")) {
					listItems[i].parentNode.parentNode.parentNode.className = "showDetailContainer";
				}
				
				if((listItems[i].parentNode.parentNode.id == "leftNav") && (listItems[i].childNodes[2])) {
					listItems[i].childNodes[2].className = "showDetailContainer";
				}

				var textNow = listItems[i].firstChild.innerHTML;
				listItems[i].firstChild.innerHTML = textNow + " >>";
				listItems[i].firstChild.title = "this is the current page";
				listItems[i].firstChild.id = "activeLink";
		}
	}
}

//-->
