// remove link to current page in nav
// (c) 2006 eightize

// the class of the element containing the menu
mainDiv = "navtext";

// the element type of the menu container (ie DIV)
mainType = 'TD';

// the class to apply to current page
thisPg = "currpg";

// the url of the current page
currPg = document.location.href;

// go through document tree and find element with mainDiv class
var divElements = document.getElementsByTagName(mainType);
for (var i=0; i<divElements.length; i++) {
	var thisDiv = divElements[i];
	if (thisDiv.className == mainDiv) {
		// go through this element
		setPage(thisDiv, currPg);
	}
}

// go through tree of elParnt looking for an element with 
//	href == aURL
function setPage(elParnt, aURL) {
	var nTree = elParnt.childNodes;
	for (var j=0; j<nTree.length; j++) {
		if (nTree[j].nodeName == 'A') {
			// only work on links, now check for match
			if (aURL == nTree[j].href) {
				// this page is referenced, so change it
				clearLink(nTree[j]);
			}
		} else {
			if (nTree[j].childNodes) {
				// recurse through children
				setPage(nTree[j], aURL);
			}
		}
	}
}

// change the current page reference
function clearLink(pNode) {
	// copy all child nodes of pNode before pNode
	var ocNod = pNode.parentNode;
	for (var i=0; i<pNode.childNodes.length; i++) {
		var tempNod = document.createElement('SPAN');
		// apply thisPg class to it
		tempNod.className = thisPg;
		tempNod.appendChild(pNode.childNodes[i]);
		ocNod.insertBefore(tempNod, pNode);
	}
	// remove the url and its contents
	ocNod.removeChild(pNode);
}