/////////////////////////////////////////////////////////////////////////////
// Function : MDEBreadcrumb
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function MDEBreadcrumb(strSeparator)
{
	this.m_Separator  = '&nbsp;&gt;&nbsp;';

	this.m_NavPath    = g_navNode_Path;
	
	if (strSeparator != '')
		this.m_Separator = strSeparator;
		
	MDEBreadcrumb.prototype.Display = MDEBreadcrumb_Display;
	MDEBreadcrumb.prototype.DisplayNode = MDEBreadcrumb_DisplayNode;
}

function MDEBreadcrumb_Display (node)
{
	this.DisplayNode(node);
}

function MDEBreadcrumb_DisplayNode(node)	
{
	var level = node.m_level;

	var bExpand = false;

	var ds = new Array();
	var di = 0;
	
	if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length)
	{
		if (this.m_NavPath[node.m_level] == node.m_id)
			bExpand = true;
	}
	
	if (bExpand)
	{
		var label = node.m_label.replace(/\'\'/g,"'");
		
		if (customSectionPropertyExists(node.cp_cspBreadcrumbName))
                	label = node.cp_cspBreadcrumbName;

		if (node.m_level == this.m_NavPath.length-1 )
		{
			// Don't hyperlink the current location
			ds[di++] = '<b>';
			ds[di++] = label;
			ds[di++] = '</b>';
		}
		else
		{

			ds[di++] = '<a href="' + node.m_href + '"';
		
		
			ds[di++] = '>'
			ds[di++] = label;
			ds[di++] = '</a>';
		}
		
		if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length-1)
			ds[di++] = this.m_Separator;

		document.write(ds.join(''));	// Write out the "live" path only
	
		// expand sub-levels (if any)
		for (var i = 0; i < node.m_subNodes.length; i++)
		{
			this.DisplayNode(node.m_subNodes[i]);
		}
	}
}

