/////////////////////////////////////////////////////////////////////////////
// Function : mnsug_nav_plain_horizontal
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function mnsug_nav_plain_horizontal(strTextColor, strFocusColor, strHoverColor, strSeparator, strClassName, strShowHome, cgiPath, queryString, loggedIn)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_FocusColor = '';
	this.m_Separator  = '|';
	this.m_ClassName  = 'mnsug_nav_plain_horizontal';
	
	this.m_ShowHome   = false;
	this.m_NavPath    = g_navNode_Path;
	this.m_cgiPath    = '';
	this.m_queryString = '';
	this.m_loggedIn = false;
			
	mnsug_nav_plain_horizontal.prototype.Display = mnsug_nav_plain_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_NavLevel <= 1)
		this.m_ShowHome = true;
	
	if (cgiPath != '')
		this.m_cgiPath = cgiPath;
	
	if (queryString != '')
		this.m_queryString = queryString;
	if (loggedIn != '')
		this.m_loggedIn = true;
}


function mnsug_nav_plain_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++] = '<span';
	
	if ( this.m_ClassName != '')
		ds[di++] = ' class="' + this.m_ClassName + '"';

	if (this.m_TextColor != '')
		ds[di++] = ' style="color: ' + this.m_TextColor + ';"';
		
	ds[di++] = '>'; 
	
//	ds[di++] = '&nbsp;';
		
	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;
		}
		
		if (label == 'Login')
		{
			if (this.m_loggedIn)
			{}
			else
			{	

			ds[di++] = '<form name="URLQueryString" action="' + this.m_cgiPath + '" style="display:inline">';
			ds[di++] = '<input type="hidden" name="IdcService" value="LOGIN">';
			ds[di++] = '<input type="hidden" name="Action" value="GetTemplatePage">';
			ds[di++] = '<input type="hidden" name="Page" value="REDIRECT_TEMPLATE">';
			ds[di++] = '<input type="hidden" name="Auth" value="Internet">';
			ds[di++] = '<input type="hidden" name="RedirectUrl" value="/mnsug/idcplg?' + this.m_queryString + '">';
			ds[di++] = '</form>';						
			ds[di++] = '<a href="Login" onclick="document.URLQueryString.submit(); return false"';

			ds[di++] = ' class="' + nodeClass + '"';
		
			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 + '\'"';
				}
			}
			}
		}
		else if (label == 'Register' && this.m_loggedIn)
		{}
		else
		{	
			ds[di++] = '<a href="' + href + '"';
			ds[di++] = ' class="' + nodeClass + '"';
		
			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 + '\'"';
				}
			}
		}
		
		if ((label == 'Register' || label == 'Login') && this.m_loggedIn)
		{}
		else
		{
			ds[di++] = '>';
			ds[di++] = label;
			ds[di++] = '</a>';
		

			if (count < node.m_subNodes.length - 1)
			{
				ds[di++] = '&nbsp;';
				ds[di++] = this.m_Separator;
				ds[di++] = '&nbsp;';
			}
			else
			{
				ds[di++] = '&nbsp;';
			}
		}
	} 

	ds[di++] = '</span>';
	
	document.write(ds.join(''));
}

