/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007, 2008, Oracle. All rights reserved.
// Function : HDS_Breadcrumbs
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function HDS_Breadcrumbs(strTextColor, strHoverColor, strSeparator, strClassName)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_Separator  = '&nbsp;&gt;&nbsp;';
	this.m_ClassName  = 'TopicPath';

	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;
		
	HDS_Breadcrumbs.prototype.Display = HDS_Breadcrumbs_Display;
	HDS_Breadcrumbs.prototype.DisplayNode = HDS_Breadcrumbs_DisplayNode;
}

function HDS_Breadcrumbs_Display (node, breadcrumbTail)
{
	document.write ('<div');
	
	if (this.m_className != '')
		document.write (' id="' + this.m_ClassName + '"');
	
	document.write ('><ul>');
	 
	this.DisplayNode(node, breadcrumbTail);
	
	
}

function HDS_Breadcrumbs_DisplayNode(node, bNodeLabel)	
{
	var level = node.m_level;
	var nodeValue="";
	var bExpand = 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)
	{
		ds[di++] = '<li ';
		
		//if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length-1)
		if (this.m_NavPath.length > 0 && node.m_level == 0)
			ds[di++] ='class = "FirstItem"';
		var mlabel1 = node.m_label;
		
		
		if(bNodeLabel.toString() == mlabel1.toString() && node.m_level == this.m_NavPath.length-1 ){
			ds[di++] ='>';
			ds[di++] = node.m_label;
			ds[di++] = '</li>';
			document.write(ds.join(''));
			document.write ('</ul></div>');			
		}
		
		
		else {
			
			ds[di++] ='><a href="' + node.m_href + '">';
			
			ds[di++] = node.m_label;
			ds[di++] = '</a></li>'

			document.write(ds.join(''));	
			if (node.m_level == this.m_NavPath.length-1)
			{
				document.write ('<li>'+bNodeLabel+'</li></ul></div>');
			}
			
		}
		
			// 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], bNodeLabel);
			
		}
		
	}

	
	
}
