/////////////////////////////////////////////////////////////////////////////
// Function : leftnav_tree
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function leftnav_tree( strClassName, strShowHome, strStartLevel, strNumLevels, strLevelClass)
{

	this.m_ClassName  = 'leftnav';
	this.m_LevelClass  = 'leftnavsub';
	
	this.m_ShowHome   = false;
	
	this.m_StartLevel = 2;
	this.m_NumLevels  = 10;
	this.m_EndLevel   = 11;
	
	this.m_NavPath    = g_navNode_Path;
			
	leftnav_tree.prototype.Display = leftnav_tree_Display;
	leftnav_tree.prototype.DisplayNode = leftnav_tree_DisplayNode;

	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 leftnav_tree_Display (node)
{
	document.write('<dl>');
	this.DisplayNode(node);	
	document.write('</dl>');
}

function leftnav_tree_DisplayNode(node)
{
	var bSelected = false;
	var nodeColor = '';
	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 = '';
				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;

/////////////////////////////////////////////////////////////////////////////
// LEVEL 1
/////////////////////////////////////////////////////////////////////////////

		if (node.m_level == '2')
		{
			if (node.m_id == '11')  // About Us Green button
			{

				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="739600">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = '><img src="images/lefnav_about_bg.gif" width="150" height="19" border="0">';
				ds[di++] = '</a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
			}

			if (node.m_id == '12') // Learn More Blue Button
			{

				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="5482ab">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = '><img src="images/lefnav_learn_bg.gif" width="150" height="19" border="0">';
				ds[di++] = '</a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
			}

			if (node.m_id == '13') // Personal Investors Brown Button
			{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="ce8e00">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = '><img src="images/lefnav_personal_bg.gif" width="150" height="19" border="0">';
				ds[di++] = '</a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
			}

		}

/////////////////////////////////////////////////////////////////////////////
// LEVEL 2
/////////////////////////////////////////////////////////////////////////////

		if (node.m_level == '3')
		{
			if ((node.m_id == '111') || (node.m_id == '112') || (node.m_id == '113') || (node.m_id == '114') || (node.m_id == '115')) // Learn More Blue Button
			{
				if (bSelected == "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="c7d599">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub1selected_about"><span class="button_font_bold">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
				
				if (bSelected != "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="f5f7ea">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub1_about"><span class="button_font">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
			}

			if ((node.m_id == '121') || (node.m_id == '122')) // Learn More Blue Button
			{
				if (bSelected == "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="cbd9e6">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub1selected_learn"><span class="button_font_bold">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
				
				if (bSelected != "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="f2f5f8">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub1_learn"><span class="button_font">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
			}

			if ((node.m_id == '131') || (node.m_id == '132') || (node.m_id == '133') || (node.m_id == '134') || (node.m_id == '135') || (node.m_id == '136')) // Learn More Blue Button
			{
				if (bSelected == "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="ebd299">';
				    if (node.m_id == '131')
				    {
				    ds[di++] = '<a target="_blank" href="' + node.m_href + '"';
				    }
				    else
				    {
				    ds[di++] = '<a href="' + node.m_href + '"';
				    }
				ds[di++] = ' class="leftnavsub1selected_personal"><span class="button_font_bold">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
				
				if (bSelected != "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="fbf6eb">';
				if (node.m_id == '131')
				    {
				    ds[di++] = '<a target="_blank" href="' + node.m_href + '"';
				    }
				    else
				    {
				    ds[di++] = '<a href="' + node.m_href + '"';
				    }
				ds[di++] = ' class="leftnavsub1_personal"><span class="button_font">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
			}
		}

/////////////////////////////////////////////////////////////////////////////
// LEVEL 3
/////////////////////////////////////////////////////////////////////////////

		if (node.m_level == '4')
		{
				if (bSelected == "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="f2f2f2">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub2selected"><span class="button_font_bold">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
				
				if (bSelected != "1")
				{
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#d7d7d7"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td>';
				ds[di++] = '<td width="150" height="19" align="center" bgcolor="fdfdfd">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub2"><span class="button_font">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
				ds[di++] = '<td width="1" height="19" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
				ds[di++] = '<tr><td height="1" colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1"></td></tr>';
	
				}
		}

/////////////////////////////////////////////////////////////////////////////
// LEVEL 4
/////////////////////////////////////////////////////////////////////////////

		if (node.m_level == '5')
		{
			ds[di++] = '<tr><td height="1" bgcolor="#FFFFFF" colspan="3" width="147"><div style="margin-left: 17px; margin-right:0px">';
			ds[di++] = '<table border="0" cellpadding="0" cellspacing="0" width="128">';
			ds[di++] = '<tr>';
			
			if (bSelected == "1")
			{
				ds[di++] = '<td align="center" valign="top" width="10" style="color:#ff6600;"><img width="10" height="3" src="images/spacer.gif"><br><b>·</b></td>';
				ds[di++] = '<td align="left" valign="top" width="150" height="19"><div style="margin-top:3px; margin-bottom:3px;">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub3selected"><span class="button_font_bold">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
			}
			
			if (bSelected != "1")
			{
				ds[di++] = '<td align="center" valign="top" width="10"><img width="10" height="3" src="images/spacer.gif"><br><b>·</b></td>';
				ds[di++] = '<td align="left" valign="top" width="150" height="19"><div style="margin-top:3px; margin-bottom:3px;">';
				ds[di++] = '<a href="' + node.m_href + '"';
				ds[di++] = ' class="leftnavsub3"><span class="button_font">';				 
				ds[di++] = node.m_label;				
				ds[di++] = '</span></a></td>';
			}			
				ds[di++] = '</tr></table></div></td></tr>';
		}


		if (node.m_level == '1')
{
		ds[di++] = '<a href="' + node.m_href + '"';
		ds[di++] = ' class="leftnavsub"';
				 
		ds[di++] = '>'
		ds[di++] = node.m_label + ' ' + node.m_level;
		ds[di++] = '</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]);
		}
	}
}
