function setNav()
{
	var theNav = document.getElementById("navigationlist");

	if (theNav)
	{
		collapseChildNodes(theNav, 0);
	}
}


function collapseChildNodes(theObj, theLevel)
{
	var theChildren = getChildNodes(theObj)
	var theShowArray = new Array;

	for (var i = 0; i<theChildren.length; i++)
	{
		var myNode = theChildren[i];

		if (myNode.tagName == "LI")
		{
			if (theLevel >= 2)
			{
				myNode.doNotDisplay = true;
			}
			else
			{
				myNode.doNotDisplay = false;
			}
			
			var nodeChildren = getChildNodes(myNode);

			// If we're another list
			for (var j=0; j<nodeChildren.length; j++)
			{
				if (nodeChildren[j].tagName == "UL")
				{
					collapseChildNodes(nodeChildren[j], theLevel + 1)
				}
				else if (nodeChildren[j].tagName == "A")
				{
					var theLink = nodeChildren[j].href;

					if (theLink == document.location.href)
					{
						nodeChildren[j].className = "currentoption";

						if (nodeChildren[j].parentNode.tagName == "LI")
						{
							theShowArray.push(nodeChildren[j].parentNode);
						}
					}
				}
			}
		}
	}

	for (var i=0; i<theShowArray.length; i++)
	{
		showOneLevel(theShowArray[i], "UL");
		showParent(theShowArray[i]);
	}
}	

function showParent(theObj)
{
	if (theObj.parentNode.tagName == "UL" && theObj.parentNode.parentNode.tagName == "LI")
	{
		showOneLevel(theObj.parentNode.parentNode, "UL");
		showParent(theObj.parentNode.parentNode);
	}
	return true;
}

function showOneLevel (theObj, theTagName)
{
	var theChildren = getChildNodes(theObj)
	
	for (var i = 0; i<theChildren.length; i++)
	{
		var myNode = theChildren[i];
		
		if (myNode.tagName == theTagName)
		{
			if (myNode.doNotDisplay)
			{
				myNode.parentNode.parentNode.className = "currentoption";
			}
			
			if (theTagName == "UL")
			{
				
				showOneLevel(myNode, "LI");
			}
			else
			{
				showOneLevel(myNode, undefined);
			}			
		}
	}
}	
	
function getChildNodes(theObj)
{
	var theChildren = theObj.childNodes;
	var childArray = new Array;

	if (theChildren)
	{
		for (var i=0; i<theChildren.length; i++)
		{
			var myNode = theChildren[i];

			if (myNode.tagName == "LI" || myNode.tagName == "A" || myNode.tagName == "UL")
			{
				childArray.push(myNode);
			}
		}
	}

	return childArray;
}

function debug(theText)
{
	return true;
	var theFooter = document.getElementById("footer");
	if (theFooter)
	{
		theFooter.innerHTML = theFooter.innerHTML + "<br>" + theText;
	}
}
	