/////////////////////////////////////////////////////////////////////////////
// Function : BNB_NAV_HORIZONTAL
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function BNB_NAV_HORIZONTAL(strTextColor, strFocusColor, strHoverColor, strSeparator, strClassName, strShowHome)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_FocusColor = '';
	this.m_Separator  = '|';
	this.m_ClassName  = 'BNB_NAV_HORIZONTAL';
	
	this.m_ShowHome   = false;
	this.m_NavPath    = g_navNode_Path;
			
	BNB_NAV_HORIZONTAL.prototype.Display = BNB_NAV_HORIZONTAL_Display;
		
	if (strTextColor != '')
		this.m_TextColor = strTextColor;
		
	if (strHoverColor != '')
		this.m_HoverColor = strHoverColor;

	if (strFocusColor != '')
		this.m_FocusColor = strFocusColor;

	if (strSeparator != '')
		this.m_Separator = strSeparator;

	if (strClassName != '')
		this.m_ClassName = strClassName;

	if (strShowHome == 'true')
		this.m_ShowHome = true;
}

function BNB_NAV_HORIZONTAL_Display (node)	

{

	var bSelected = false;
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_ClassName;
		
	var ds = new Array();
	var di = 0;
	var count =  this.m_ShowHome ? -1 : 0;

	var href = '';
	var label = '';
	
	
	ds[di++] = '<div id="navigation"><table cellspacing="0" cellpadding="0"><tr>'; 
	
		
	for ( ; count < node.m_subNodes.length; count++)
	{
		bSelected = false;
		
		if (count == -1)	// Root link
		{
			if ( (this.m_NavPath.length == node.m_level+1) &&
				 (this.m_NavPath[node.m_level] == node.m_id) )
			{
				bSelected = true;
			}
			
			label = node.m_label;
			href  = node.m_href;
		}
		else
		{	
			if (this.m_NavPath.length > node.m_subNodes[count].m_level)
			{
				if (this.m_NavPath[node.m_subNodes[count].m_level] == node.m_subNodes[count].m_id)
				{
					bSelected = true;
				}
			}
			
			label = node.m_subNodes[count].m_label;
			href = node.m_subNodes[count].m_href;
		}
		
		if (bSelected)
		{
			nodeColor = this.m_FocusColor;
			nodeClass = this.m_ClassName + '-focus';
		}
		else
		{
			nodeColor = this.m_TextColor;
			nodeClass = this.m_ClassName;
		}
				
		ds[di++] = '<td class="';
		if(count == 0) {//first item
			ds[di++] = 'first';
		}

		if(count == node.m_subNodes.length - 1) {//last item
			ds[di++] = 'last';
		}

		ds[di++] ='"><a href="' + href + '"';
		
		if (bSelected) {
			ds[di++] = ' class="current"';
		}
		
		if (nodeColor != '')	
		{
			ds[di++] = ' style="color:' + nodeColor + ';"';

		/*	if (!bSelected && this.m_HoverColor != '')
			{
				ds[di++] = ' onmouseover="this.style.color=\'' + this.m_HoverColor + '\'"';
				ds[di++] = ' onmouseout="this.style.color=\'' + nodeColor + '\'"';
			} */
			
		}


		ds[di++] = '><span>';
		ds[di++] = label;
		ds[di++] = '</span></a></td>';

	/*	if (count < node.m_subNodes.length - 1)
		{
			ds[di++] = '&nbsp;';
			ds[di++] = this.m_Separator;
			ds[di++] = '&nbsp;';
		}
		else
		{
			ds[di++] = '&nbsp;';
		} */
	} 

	ds[di++] = '</tr></table></div>';

	
	document.write(ds.join(''));
	//alert(ds.join(''));
}

