
// Routines to build the Node Data Structure

// id is the value stored in the field
// label is the language specific label for that id
// URL is the page to display
// role is the user role required to see this link

function makeNode(id,label,URL)
{
	this.node = this;
	this.id = id;
	this.label = label;
	this.URL = URL;
	this.children = new Array();
	this.addNode = addNode;
}

function addNode(node)
{
	this.children[this.children.length] = node;
}

function displayNode(level,node)
{
  var siteRoot = httpCgiPath + "?IdcService=GET_DYNAMIC_CONVERSION&RevisionSelectionMethod=LatestReleased&dDocName=";
	for (var i=0; i<node.children.length; i++)
	{
		var myNode = node.children[i].node;
		
		// Don't display the first two levels
		if (level > 1) {
			if (level == 2) {
				navclass = "leftNav";
				listtag = '<DT class="level1">';
				if (myNode.URL == thisURL) { listtag = '<DT class="level1" style="background-color:#FFF;">'; }
			}
			else if (level == 3) {
				navclass = "leftNavLevel2";
				listtag = '<DD class="level2">';
				if (myNode.URL == thisURL) { listtag = '<DD class="level2" style="background-color:#FFF;">'; }
			}
			else if (level == 4) {
				navclass = "leftNavLevel3";
				listtag = '<DD class="level3">';
				if (myNode.URL == thisURL) { listtag = '<DD class="level3" style="background-color:#FFF;">'; }
			}
			else {
				navclass = "leftNavLevel3";
				listtag = '<DD class="level4">';
				if (myNode.URL == thisURL) { listtag = '<DD class="level4" style="background-color:#FFF;">'; }
			}

			// remove these two lines if it blows up
			if (m_navigationValues[level] == myNode.id)
				navclass = navclass + "On";

			if (level == 2) {
				document.write(listtag + '<a href="' + siteRoot + myNode.URL + '" class="' + navclass + '">' + myNode.label + '</a><br>');
			}
			else if (level == 3) {
				document.write(listtag + '<img src="/main/groups/dev/documents/webasset/left_nav_arrow.gif"  width="9" height="7" hspace="0" vspace="0" border="0">' +'<a href="' + siteRoot + myNode.URL + '" class="' + navclass + '">' + myNode.label + '</a><br>');
			}
			else if (level == 4) {
				document.write(listtag + '<img src="/main/groups/dev/documents/webasset/red_nav_arrow.gif"  width="9" height="7" hspace="0" vspace="0" border="0">' +'<a href="' + siteRoot + myNode.URL + '" class="' + navclass + '">' + myNode.label + '</a><br>');
			} else {
				document.write(listtag + '<img src="/main/groups/dev/documents/webasset/black_nav_arrow.gif"  width="9" height="7" hspace="0" vspace="0" border="0">' +'<a href="' + siteRoot + myNode.URL + '" class="' + navclass + '">' + myNode.label + '</a><br>');
			}
		}
// alert("site root = " + siteRoot + ", listtag = " + listtag + ", and level = " + level);
		// Display the children nodes when appropriate
		if (level < m_navigationValues.length && m_navigationValues[level] == myNode.id && myNode.children.length > 0)
		{
			displayNode(level+1,myNode);
		}
	}
}

function displaySideNav()
{
	document.write('<DL>');
	displayNode(0,n1);
	document.write('</DL>');
}

// Routines to display the Node Data Structure


// show link title in status bar onfocus
function showStat(arg) {
	window.status=arg;
	return true;
}
