/////////////////////////////////////////////////////////////////////////////
// Function : CT_BreadCrumbPlain
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function CT_BreadCrumbPlain(strTextColor, strHoverColor, strSeparator, strClassName, strDocTitle, strSecondaryPage)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_Separator  = '&nbsp;&gt;&nbsp;';
	this.m_ClassName  = 'CT_BreadCrumbPlain';

	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;
	
	if (strDocTitle != '')
		this.m_DocTitle = strDocTitle;

	if (strSecondaryPage != '')
		this.m_SecondaryPage = strSecondaryPage;
		
	CT_BreadCrumbPlain.prototype.Display = CT_BreadCrumbPlain_Display;
	CT_BreadCrumbPlain.prototype.DisplayNode = CT_BreadCrumbPlain_DisplayNode;
}

function CT_BreadCrumbPlain_Display (node)
{
	document.write ('<span');
	
	if (this.m_className != '')
		document.write (' class="' + this.m_ClassName + '"');
	
	if (this.textColor != '')
		document.write(' style="color: ' + this.m_TextColor + ';"');
		
	document.write ('>');
	
	this.DisplayNode(node);
	
	document.write ('</span>');
}

function CT_BreadCrumbPlain_DisplayNode(node)	
{
	var level = node.m_level;
	var bExpand = false;
	var bLastItem = false;
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_className ;

	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_level == this.m_NavPath.length - 1){
			bLastItem = true;
		}

		if ((bLastItem) && (this.m_SecondaryPage == 'Primary'))
		{

			ds[di++] = '<span class="breadCrumbTextBold">';
			ds[di++] = node.m_label;
			ds[di++] = '</span>';

		}else{

			ds[di++] = '<a href="' + node.m_href + '"';
		
			if (nodeClass != '')
				ds[di++] = ' class="' + nodeClass + '"';
				
			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++] = 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]);
		}
		//write out the 
		if((this.m_SecondaryPage == 'Secondary') && (bLastItem) && (this.m_DocTitle != 'Untitled')){
			document.write('<span class="breadCrumbTextBold">');
			document.write(this.m_Separator);
			document.write(this.m_DocTitle);
			document.write('</span>');
		}
	}
}
