/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007, 2008, Oracle. All rights reserved.
// Function : sr_breadcrumb
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function sr_breadcrumb(strSeparator, strNodeId)
{
	this.m_Separator  = '>';

	this.m_NavPath    = g_navNode_Path;

	this.m_currentNodeId = strNodeId;
	if (strSeparator != '')
		this.m_Separator = strSeparator;
		
	sr_breadcrumb.prototype.Display = sr_breadcrumb_Display;
	sr_breadcrumb.prototype.DisplayNode = sr_breadcrumb_DisplayNode;
}

function sr_breadcrumb_Display (node)
{
	document.write ('<div id="bread">');
	this.DisplayNode(node);
	document.write ('</div>');
}

function sr_breadcrumb_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)
	{
		if (node.m_level > 0) {
			if (this.m_currentNodeId == node.m_id || node.cp_nodeHasNoLink == 'TRUE' || node.cp_nodeHasNoLink == 'true') {
				if (node.m_level == 1 && node.m_subNodes.length > 0) {
					ds[di++] = '<a href="' + node.m_subNodes[0].m_href + '"';
					ds[di++] = '>'
					ds[di++] = node.m_label;
					ds[di++] = '</a>';		
				} else {	
					ds[di++] = node.m_label;
				}
			} else {
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = '>'
				ds[di++] = node.m_label;
				ds[di++] = '</a>';		
			}
		}	
		
		if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length-1) {
			if (node.m_level > 0) ds[di++] = '<span class="sep">'+this.m_Separator+'</span>';
		}
		
		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]);
		}
	}
}

