/*
	This function finds the top level section and decides whether or not
	to link to that node.
*/
function sectionToDisplay()
{
	var currentNode = findNode(g_navNode_Root, g_ssSourceNodeId);
	var isLinked = false;
	var currentNodeURL;
	
	if (currentNode.m_parent.m_id != g_navNode_Root.m_id)
	{
		isLinked = true;
	}
	if (currentNode.m_id != g_navNode_Root.m_id)
	{
		while (currentNode.m_parent.m_id != g_navNode_Root.m_id)
		{
			currentNode = currentNode.m_parent;
		}
	}
	
	currentNodeURL = currentNode.m_href;
	if (isLinked == true)
		document.write('<a href="' + currentNodeURL + '">');
	

		label = currentNode.m_label.toUpperCase();

		while(label.indexOf("&LT;") > -1) {
			
			last = " " + label.substring(label.indexOf("&GT;") + 4,label.length)
			first = label.substring(0,label.indexOf("&LT;"))
			label = first + last;
		}


	document.write(label);
	if (isLinked == true)
		document.write('</a>');
}

/*
	This function retrieves the information for the current node.
	It takes the input of the root node and the ID of the current node.
*/
function findNode(theNode, nodeId) {
	var foundNode = false;

	try {
		if (theNode.m_id == nodeId) {
			foundNode = theNode;
		}
		else {
			if (theNode.m_subNodes.length > 0) {
				for (var i = 0; i < theNode.m_subNodes.length; i++) {
					childNode = theNode.m_subNodes[i];
					foundNode = findNode(childNode, nodeId);
					if (foundNode != false){
						break;
					}
				}
			}
		}
	}
	catch (e) {
		//error message would go here
	}
	return foundNode;		
}