/////////////////////////////////////////////////////////////////////////////
// Class : WE_Left_Nav_Fragment
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function WE_Left_Nav_Fragment()
{
	this.m_NavPath    = g_navNode_Path;
	this.m_html       = '';
	
	WE_Left_Nav_Fragment.prototype.Display = WE_Left_Nav_Fragment_Display;
	WE_Left_Nav_Fragment.prototype.DisplayNode = WE_Left_Nav_Fragment_DisplayNode;
	
}

function WE_Left_Nav_Fragment_Display (node)
{
	this.DisplayNode(node);
	document.write(this.m_html);
	//document.write('<br /><br /><br />');
	//document.write('<textarea>'+this.m_html+'</textarea>');
}

function WE_Left_Nav_Fragment_DisplayNode(node)
{
	var bSelected = false;
	var nodeLevel = node.m_level;

	if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length)
	{
		if (this.m_NavPath[node.m_level] == node.m_id)
		{
			bSelected = true;
		}
	}

	if (nodeLevel >= 1 && getCustomSectionProperty(node.cp_IncludeInLeftNavigation).toLowerCase() == "true" ) {	
		this.m_html += '<li>';
		this.m_html += '<a ';
		this.m_html += bSelected && node.m_level > 0 ? ' class="highlight-text" ' : '';
		this.m_html += 'href="' + node.m_href + '">';
		this.m_html += node.m_label + '</a></li>';		
	}
	
	if (bSelected)
	{	// expand sub-levels (if any)
		if (node.m_subNodes.length > 0) {

			this.m_html += '<ul class="nav-links">';			
		
			for (var i = 0; i < node.m_subNodes.length; i++) {
				this.DisplayNode(node.m_subNodes[i]);
			}
		
			this.m_html += '</ul>';
		}
	}
}
