/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007, 2008, Oracle. All rights reserved.
// Function : TS_GE_Breadcrumb
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function TS_GE_Breadcrumb()
{
	this.m_Separator  = '&nbsp;&gt;&nbsp;';
	this.m_ClassName  = 'breadcrumb';
	this.m_ClassNameSelected  = 'breadcrumbSelected';

	this.m_NavPath    = g_navNode_Path;

	TS_GE_Breadcrumb.prototype.Display = TS_GE_Breadcrumb_Display;
	TS_GE_Breadcrumb.prototype.DisplayNode = TS_GE_Breadcrumb_DisplayNode;
}

function TS_GE_Breadcrumb_Display (node)
{

	document.write ('<div class="breadcrumb">');
	
	this.DisplayNode(node);
	
	document.write ('</div>');
}

function TS_GE_Breadcrumb_DisplayNode(node)	
{
	var level = node.m_level;
	//var label = node.m_label.substring(0,1) + node.m_label.substring(1).toLowerCase();
var label = node.m_label; 

	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)
	{
		if(node.m_level < this.m_NavPath.length-1){
			ds[di++] = '<a href="' + node.m_href + '">';
		}
		ds[di++] = label;
		if(node.m_level < this.m_NavPath.length-1){
			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]);
		}
	}
}

