/////////////////////////////////////////////////////////////////////////////
// Function : grhc_nav_vertical
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function grhc_nav_vertical(strTextColor, strHoverColor, strFocusColor, strClassName, 
							strShowHome, strStartLevel, strNumLevels, strImage)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_FocusColor = '';
	this.m_ClassName  = 'grhc_nav_vertical';
	
	this.m_ShowHome   = false;
	
	this.m_StartLevel = 2;
	this.m_NumLevels  = 10;
	this.m_EndLevel   = 11;
        this.m_Image = strImage;
	
	this.m_NavPath    = g_navNode_Path;
			
	grhc_nav_vertical.prototype.Display = grhc_nav_vertical_Display;
	grhc_nav_vertical.prototype.DisplayNode = grhc_nav_vertical_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 (strNumLevels != '')
	{
		var value = parseInt(strNumLevels);
		if (value != NaN)
			this.m_NumLevels = value;
	}

	this.m_EndLevel = this.m_StartLevel + this.m_NumLevels - 1 ;
}

function grhc_nav_vertical_Display(node)
{
        
        this.DisplayNode(node);	
        
	

}

function grhc_nav_vertical_DisplayNode(node)
{
	var bSelected = false;
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_ClassName;
	
	
	
	var nodeLevel = node.m_level;
	
	if (nodeLevel > 6)
		nodeLevel = 6;
	
	if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length)
	{
		if (this.m_NavPath[node.m_level] == node.m_id)
		{
			if (node.m_level > 0 || (node.m_level == 0 && this.m_NavPath.length == 1))
			{
				bSelected = true;
				nodeColor = this.m_FocusColor;
				nodeClass += '-focus';
			}
		}
	}

	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;
	var pi = 0;
	var padding_i = 5;
	if (nodeLevel>1)
	{
		pi = (nodeLevel-1)*10;	}
else
{
	pi=10;
}
//	var padding-node = padding_i*nodeLevel;
	document.write('<table cellspacing="0" cellpadding="0" border="0">');	
        document.write('<tr>');         
        document.write('<td style = "padding-left:'+pi+'px;padding-bottom:'+'10'+'px;padding-top:'+0+'px;padding-right:1px;" align="right" valign="top"><img style="align:right;valign:top" src = "'+this.m_Image+'" border=0></td>');
        document.write('<td  style = "padding-bottom:'+'10'+'px;" valign="top" align="left" width="100%">');   
        document.write('<a href="' + node.m_href+'"');   
        document.write(' class="' + this.m_ClassName+'"');
	if (node.cp_Shortname!=null && node.cp_Shortname.length>0)
	{
		document.write('>'+node.cp_Shortname);
	}
	else
	{
		document.write('>'+node.m_label);	
	}    		
	document.write('</a>');
        document.write('</td>'); 
        document.write('</tr>');
	document.write('</table>');

	}
	
	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]);
		}
	}
}
