/////////////////////////////////////////////////////////////////////////////
// Function : etn_oneweb_nav_multi_vert
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function etn_oneweb_nav_multi_vert(strShowHome, strStartLevel, strNumLevels, varNewWindow)
{
	this.m_ClassName  = 'navigationitem';
	
	this.m_ShowHome   = false;
        this.m_NewWindow    = false;
   
        if (cspLeftNavStartNode != '') {	
	this.m_StartLevel = cspLeftNavStartNode;
	}else{
	this.m_StartLevel = 2;
	}
	this.m_NumLevels  = 10;
	this.m_EndLevel   = 11;
	
	this.m_NavPath    = g_navNode_Path;
			
	etn_oneweb_nav_multi_vert.prototype.Display = etn_oneweb_nav_multi_vert_Display;
	etn_oneweb_nav_multi_vert.prototype.DisplayNode = etn_oneweb_nav_multi_vert_DisplayNode;
		
	if (strShowHome == 'true')
		this.m_ShowHome = true;

      	if (varNewWindow == 'TRUE')
		this.m_NewWindow = true;

	if (strNumLevels != '')
	{
		var value = parseInt(strNumLevels);
		if (value != NaN)
			this.m_NumLevels = value;
	}

	this.m_EndLevel = this.m_StartLevel + this.m_NumLevels - 1 ;
}

function etn_oneweb_nav_multi_vert_Display (node)
{

// Loop through the tree and find out if we are in a Theme page section.
// If we are, the left nav should start at level 2.  Otherwise it should 
// start at level 1.

for (var x = 0; x < node.m_subNodes.length; x++)
		{
			if (this.m_NavPath[1] == node.m_subNodes[x].m_id)
			   {
				for (var y = 0; y < node.m_subNodes[x].m_subNodes.length; y++)
					if (this.m_NavPath[2] == node.m_subNodes[x].m_subNodes[y].m_id)
					   {
						if (node.m_subNodes[x].m_subNodes[y].cp_cspTheme == null) 
							this.m_StartLevel = 1;
						    
					   }

			   }

		}

	this.DisplayNode(node);	
}

function etn_oneweb_nav_multi_vert_DisplayNode(node)
{
	var bSelected = false;
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_ClassName
	var nodeIsCurrent = false;

	var nodeLevel = node.m_level;
	

	if (nodeLevel > 6)
		nodeLevel = 6;
	
	if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length)
	{
		if (this.m_NavPath[node.m_level] == node.m_id)
		{
			if (node.m_level > 0 || (node.m_level == 0 && this.m_NavPath.length == 1))
			{
				bSelected = true;
			}
		}
		nodeIsCurrent = (this.m_NavPath[this.m_NavPath.length - 1] == node.m_id) ;
	}
	
	

	if (nodeLevel > this.m_StartLevel + 1)
		nodeClass += '-' + (nodeLevel - this.m_StartLevel);
		
	showItem = true;
	showLink = true;

	if ( node.m_level == this.m_StartLevel)
	{ 
		nodeClass = "navigationheadline";
		showLink = false;
		if (!bSelected)
		{
			showItem = false;
		}
	}

	else if (nodeIsCurrent)nodeClass += 'selected';

	if ( (node.m_level == 0 && this.m_ShowHome) || 
     	 (node.m_level >= this.m_StartLevel && node.m_level <= this.m_EndLevel)
	   )
	{
		var ds = new Array();
		var di = 0;
		
		if (showItem)
		{
			
			ds[di++] = '<DIV' ;
			ds[di++] = ' class="' + nodeClass + '"';
			ds[di++] = '>';
			
			ds[di++] = '<a href="' + node.m_href + '"';				

			//Check to see if it needs to be opened in a new window
			if (node.cp_NewWindow != null && node.cp_NewWindow.length>0)
				if (node.cp_NewWindow.toUpperCase() == 'TRUE')
					ds[di++] = ' target="_blank "';
			ds[di++] = '>';
			
			if (nodeClass == "navigationheadline")
			{
			ds[di++] = '<font class="navigationheadlinenoresize">' ;
			ds[di++] = node.m_label;
			ds[di++] = '</font>' ;
			}  else {
			ds[di++] = '<font class="reguralnavigationitem">' ;
			ds[di++] = node.m_label;
			ds[di++] = '</font>' ;
			}
						
			ds[di++] = '</a>';			

			// close the div tag for the heading and hide the closing div tag after the children
			ds[di++] = '</DIV>';
			showItem = false;
			
		}
		document.write(ds.join(''));
 	}
	
        //We need to close the DIV to close the style, but we can't close
        //the div on level 1 because, that level has lines above and below.
        //those DIVs are closed after the children are displayed.

        if (node.m_level > 2 && node.m_level <= this.m_EndLevel)
        {
           if (showItem)
           {
              document.write('</DIV>');
           }
        }

	if (bSelected || node.m_level == 0)
	{	// expand sub-levels (if any)
		for (var i = 0; i < node.m_subNodes.length; i++)
		{
			this.DisplayNode(node.m_subNodes[i]);
		}
	}

        //NOW close the div tags for level 2 and higher

	if ( (node.m_level == 0 && this.m_ShowHome) || 
     	 (node.m_level >= this.m_StartLevel && node.m_level <= 2)
	   )
	{
		if (showItem)
		{
			var ds = new Array();
			var di = 0;
			ds[di++] = '</DIV>';
			document.write(ds.join(''));
		}
	}

}
