/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2007, 2008, Oracle. All rights reserved.
// Function : ilo_breadcrumb_plain
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function ilo_breadcrumb_plain(lang, dDocTitle, strSeparator)
{
	this.lang = 'en';
	this.dDocTitle = '';
	this.m_Separator  = '&nbsp;&gt;&nbsp;';
	this.m_NavPath    = g_navNode_Path;
	
	if (lang != '')
		this.lang = lang;
		
	if (dDocTitle != '')
		this.dDocTitle = dDocTitle;
		
	if (strSeparator != '')
		this.m_Separator = strSeparator;
	
	ilo_breadcrumb_plain.prototype.Display = ilo_breadcrumb_plain_Display;
	ilo_breadcrumb_plain.prototype.DisplayNode = ilo_breadcrumb_plain_DisplayNode;
}

function ilo_breadcrumb_plain_Display (node)
{
	document.write ('<div id="crumbs">');
	
	this.DisplayNode(node);
	
	document.write ('</div>');
}

function ilo_breadcrumb_plain_DisplayNode(node)	
{
	var level = node.m_level;

	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)
	{
		var theLabel = getSectionLabelShortByLang(node,lang);
		if(theLabel==null || theLabel==""){
			theLabel = getSectionLabelByLang(node,lang);
		}
		
		if(this.dDocTitle==''){
			if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length-1){
				if(lang!=null && lang!=""){
					node.m_href = (node.m_href).replace("/index.htm", "");
					ds[di++] = '<a href="' + node.m_href + '/lang--' + lang + '/index.htm' + '">';
				}
				else{
					ds[di++] = '<a href="' + node.m_href + '">';
				}
				//ds[di++] = node.m_label;
				ds[di++] = theLabel;
				ds[di++] = '</a>';
				ds[di++] = this.m_Separator;
			}
			if (this.m_NavPath.length > 0 && node.m_level == this.m_NavPath.length-1){
				//ds[di++] = node.m_label;
				ds[di++] = theLabel;
				
			}
		}
		else{
			if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length){
				if(lang!=null && lang!=""){
					node.m_href = (node.m_href).replace("/index.htm", "");
					ds[di++] = '<a href="' + node.m_href + '/lang--' + lang + '/index.htm' + '">';
				}
				else{
					ds[di++] = '<a href="' + node.m_href + '">';
				}
				//ds[di++] = node.m_label;
				ds[di++] = theLabel;
				ds[di++] = '</a>';
				ds[di++] = this.m_Separator;
			}
			if (this.m_NavPath.length > 0 && node.m_level == this.m_NavPath.length-1){
				//ds[di++] = node.m_label;
				var wordsArray = (this.dDocTitle.split(" ", 10));
				var s = "";
				for(i=0;i<wordsArray.length;i++){
					s = s + wordsArray[i] + " ";
				}
				if((this.dDocTitle).length<=s.length){
					ds[di++] = s;
				}
				else{
					ds[di++] = s + "&hellip;";
				}
			}
		}

		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]);
		}
	}
}

function getSectionLabelShortByLang(node,lang){
	if(lang=="en"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_en);
	}
	else if(lang=="fr"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_fr);
	}
	else if(lang=="es"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_es);
	}
	else if(lang=="zh"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_zh);
	}
	else if(lang=="ar"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_ar);
	}
	else if(lang=="it"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_it);
	}
	else if(lang=="ru"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_ru);
	}
	else if(lang=="de"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_de);
	}
	else if(lang=="nl"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_nl);
	}
	else if(lang=="pt"){
		theLabel = getCustomSectionProperty(node.cp_SectionLabelShort_pt);
	}
	else{
	}
	
	return theLabel;
}

