/*  Global Variables Start */
	var nodeList = new Array();		// Array of all nodes in the site structure
	var breadcrumb = new Array();		// Array of all nodes in the breadcrumb trail

	var i = 0;				// Index for nodeList array
	var crumbLevel = 0;			// Index for breadcrumb array
	var indent = 5;			// Indent value for display
	var showinNav=1;


	var hexbgcolor="#999999";  //set default hex bgcolor for the table
/*  Global Variables End */

/*  Function Declarations Start */
	
	// This function creates asset Node objects
	function Node(id, name, url, level, children, parent, display, leftnav_name, breadcrumb_name) {
		this.id = id;
		this.name = name;
		this.url = url;
		this.level = level;
		this.children = children;
		this.parent = parent;
		this.display = display;
		this.leftnav_name = leftnav_name;
		this.breadcrumb_name = breadcrumb_name;
		this.showNav = 1;
		
		if(leftnav_name == '')
			this.leftnav_name = name;
		if(breadcrumb_name == '')
			this.breadcrumb_name = this.leftnav_name;
	}

	// This function creates breadcrumb objects
	function breadcrumbNode(id, parent) {
		this.id = id;
		this.parent = parent;
	}
	
	function displayLeftNav()
	{
		var inBreadcrumb;
		var code = '';
		var first=true;
		var inSite=false;
		
		for(j=0; j < nodeList.length; j++)
		{	// Loop through all the nodes in the array
			// If the node is in the breadcrumb, set flag
		    	for(c=0, inBreadcrumb = 0; c < crumbLevel; c++)
				{
					if ((nodeList[j].id == breadcrumb[c].id))
					{
						inBreadcrumb = 1;
					}
		    	}

			if ((nodeList[j].level == 1) || (nodeList[j].display == 0)) //ignore if root or ignore if Navigation Bar is set to no
			{
			}
			else if (inBreadcrumb == 1)
			{ 
				if(first)
				{
					document.write('<div class="leftnavul"><ul>');
					first=false;
				}
				else if(!first&& nodeList[j].level==2)
				{
					document.write('</ul><img src="../images/nav_hr.gif" alt="Gray Line" style="margin-top:-10px; width:90%;" /></div><div class="leftnavul"><ul>');
				}
				
				document.write('<li class="leftnav'+(nodeList[j].level-1)+'"><a href="' + nodeList[j].url + '" class="leftnavli">'+nodeList[j].leftnav_name + '</a></li>');
				inSite=true;
			}
			else
			{ 
				// Display the node only if it shares a common parent with a node from the breadcrumb
					for(s=0; s < crumbLevel; s++)
					{
						if (breadcrumb[s].parent == nodeList[j].parent)
						{
							
							if(first)
							{

								document.write('<div class="leftnavul"><ul>');
								first=false;
								
							}
							else if(!first&& nodeList[j].level==2)
							{

								document.write('</ul><img src="../images/nav_hr.gif" alt="Gray Line" style="margin-top:-10px; width:90%;" /></div><div class="leftnavul"><ul>');
								
							}
													
							document.write('<li class="leftnav'+(nodeList[j].level-1)+'"><a href="' + nodeList[j].url + '" class="leftnavli">'+nodeList[j].leftnav_name + '</a></li>');
							inSite=true;
							break;
						}
				    }
					
					if(showinNav&& nodeList[j].level==2)
					{
						if(first)
						{
							document.write('<div class="leftnavul"><ul>');
							first=false;						
						}
						else
						{
							document.write('</ul><img src="../images/nav_hr.gif" alt="Gray Line" style="margin-top:-10px; width:90%;" /></div><div class="leftnavul"><ul>');
						}
						document.write('<li class="leftnav'+(nodeList[j].level-1)+'"><a href="' + nodeList[j].url + '" class="leftnavli">'+nodeList[j].leftnav_name + '</a></li>');
						inSite=true;
						
					}
				
			}

		}
		if(nodeList.length>1&& inSite==true)
		{
			document.write('</ul></div>');
		}
	}
		
/*  Function Declarations End */

