/////////////////////////////////////////////////////////////////////////////
// Function : breadcrumb
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function breadcrumb(strTextColor, strHoverColor, strSeparator, strClassName)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_Separator  = 'images/breadcrumb_arrow.gif';
	this.m_ClassName  = 'breadcrumb';

	this.m_NavPath    = g_navNode_Path;

	if (strTextColor != '')
		this.m_TextColor = strTextColor;
		
	if (strHoverColor != '')
		this.m_HoverColor = strHoverColor;
	
	if (strSeparator != '')
		this.m_Separator = strSeparator;
		
	if (strClassName != '')
		this.m_ClassName = strClassName;
		
	breadcrumb.prototype.Display = breadcrumb_Display;
	breadcrumb.prototype.DisplayNode = breadcrumb_DisplayNode;
}

function breadcrumb_Display (node)
{
	document.write ('<div');
	
	if (this.m_className != '')
		document.write (' class="breadWhiteSm"');
	
	if (this.textColor != '')
		document.write(' style="margin-top:5px; margin-left:24px;"');
		
	document.write ('>');
	
	this.DisplayNode(node);
	
	document.write ('</div>');
}

function breadcrumb_DisplayNode(node)	
{
	var level = node.m_level;

	var bExpand = false;
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_ClassName;
	var nodeActive = node.m_level + 1;
	
	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)
	{
		if (node.m_label != "home")
		{
			if (nodeActive == this.m_NavPath.length)
			{
			ds[di++] = '<a class="breadWhiteBold">';
			}
			
			else
			{
		ds[di++] = '<a href="' + node.m_href + '"';
		
		if (nodeClass != '')
			ds[di++] = ' class="small"';
			
		if (nodeColor != '')
		{			
			ds[di++] = ' style="color: ' + nodeColor + ';"';

			ds[di++] = ' onmouseover="this.style.color=';
			ds[di++] = "'" + this.m_HoverColor + "'";
			ds[di++] = '"';

			ds[di++] = ' onmouseout="this.style.color=';
			ds[di++] = "'" + nodeColor + "'";
			ds[di++] = '"';
		}			
		ds[di++] = '>'
			}
		ds[di++] = node.m_label;
		ds[di++] = '</a>';
		
		if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length-1)
			ds[di++] = '&nbsp;&nbsp;<img src=" ' + this.m_Separator + '">&nbsp;&nbsp;';

		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]);
		}
	}
}
