/////////////////////////////////////////////////////////////////////////////
// Function : aurorathirdnav
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function aurorathirdnav(strTextColor, strHoverColor, strFocusColor, strClassName, 
							strShowHome, strStartLevel, strNumLevels)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_FocusColor = '';
	this.m_ClassName  = 'aurorathirdnav';
	
	this.m_ShowHome   = false;
	
	this.m_StartLevel = 2;
	
	this.m_NumLevels  = 10;
	this.m_EndLevel   = 11;
	
	this.m_NavPath    = g_navNode_Path;
//alert('this.m_NavPath:'+this.m_NavPath);
//alert('this.m_NavPath.length:'+this.m_NavPath.length);
			
	aurorathirdnav.prototype.Display = aurorathirdnav_Display;
	aurorathirdnav.prototype.DisplayNode = aurorathirdnav_DisplayNode;
		
	if (strTextColor != '')
		this.m_TextColor = strTextColor;
		
	if (strHoverColor != '')
		this.m_HoverColor = strHoverColor;

	if (strFocusColor != '')
		this.m_FocusColor = strFocusColor;

	if (strClassName != '')
		this.m_ClassName = strClassName;

	if (strShowHome == 'true')
		this.m_ShowHome = true;
		
	if (strStartLevel != '')
	{
		var value = parseInt(strStartLevel);
		if (value != NaN)
			this.m_StartLevel = value;
	}
	
	if (g_ssSourceNodeId == '711' || g_ssSourceNodeId == '907' || g_ssSourceNodeId == '908' || g_ssSourceNodeId == '723' || g_ssSourceNodeId == '704' || g_ssSourceNodeId == '699')
	{
		this.m_StartLevel = value - 1;
	}
	
	if (strNumLevels != '')
	{
		var value = parseInt(strNumLevels);
		if (value != NaN)
			this.m_NumLevels = value;
	}

	this.m_EndLevel = this.m_StartLevel + this.m_NumLevels - 1 ;
}

function aurorathirdnav_Display (node)
{
	document.write('<dl>');
	this.DisplayNode(node);	
	document.write('</dl>');
}

function aurorathirdnav_DisplayNode(node)
{
	var bSelected = false;
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_ClassName

	var nodeLevel = node.m_level;
	var pathLen = this.m_NavPath.length;
	var extraLineB4 = false;
	var extraLineAfter = false;

	
	if (nodeLevel > 6)
		nodeLevel = 6;
//alert('node.m_id:'+node.m_id);
//alert('node.m_level:'+node.m_level);
//alert('node.m_label:'+node.m_label);
	
	if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length)
	{
		if (this.m_NavPath[node.m_level] == node.m_id )
		{
bSelected = true;
			if (node.m_level > 0 || (node.m_level == 0 && this.m_NavPath.length == 1))
			{
				bSelected = true;
				//if (node.m_level== pathLen - 1)
				//{
					nodeColor = this.m_FocusColor;
					nodeClass += '-focus';
					//extraLineB4 = true;
				//}
			}
		}
	}

	if (nodeLevel > 0)
		nodeClass += '-' + nodeLevel;
		
	if ( (node.m_level == 0 && this.m_ShowHome) || (node.m_level >= this.m_StartLevel && node.m_level <= this.m_EndLevel))
	{
		var ds = new Array();
		var di = 0;
		
		ds[di++] = (nodeLevel <= 2) ? '<dt' : '<dd';
		ds[di++] = ' class="' + nodeClass + '"';
		ds[di++] = '>';
//LHibbs added this to allow redirects based on folder property cspRedirect.  10-19-2004
//alert('cp_cspredirectURL:'+childElement.cp_cspRedirectURL);
var url = (customSectionPropertyExists(node.cp_cspRedirectURL) ? node.cp_cspRedirectURL : node.m_href.replace(/'/g, "\\'"));
if (node.m_label == 'Apply For Job Online')
{
url = url + g_ssSourceNodeId;
}
if (node.m_label == 'Library Feedback')
{
url = url + g_ssSourceNodeId;
}


//end Lhibbs 10-19-2004
//original source 10-19-2004
//ds[di++] = '<a href="' + node.m_href + '"';

		ds[di++] = '<a href="' + url + '"';
		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 + '\'"';
			}
		}
				 
		ds[di++] = '>'
		//if (bSelected && extraLineB4 && node.m_subNodes.length > 0 )
		//{
		//	ds[di++] = '&nbsp;<BR>';
		//	extraLineB4 = false;
                //        extraLineAfter = true;
		//}
		ds[di++] = node.m_label;
              
		ds[di++] = (node.m_label == 'Springhill' && !bSelected) ? '<BR>&nbsp;</a>' : '</a>';
		

		document.write(ds.join(''));
	}

	if (bSelected || node.m_level == 0)
	{	// expand sub-levels (if any)
		
		for (var i = 0; i < node.m_subNodes.length; i++)
		{
			this.DisplayNode(node.m_subNodes[i]);
		}

		//if ( extraLineAfter && node.m_subNodes.length > 0)
		//{
		//	document.write('<dd class="' + nodeClass + '">&nbsp;');
		//	extraLineAfter = false;
		//}

	}

}
