/////////////////////////////////////////////////////////////////////////////
// Function : LeftNavIFA
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function LeftNavIFA( strClassName, strShowHome, strStartLevel, strNumLevels, strLevelClass)
{

	this.m_ClassName  = 'leftnav';
	this.m_LevelClass  = 'leftnavsub';
	
	this.m_ShowHome   = false;
	
	this.m_StartLevel = 1;
	this.m_NumLevels  = 10;
	this.m_EndLevel   = 11;
	
	this.m_NavPath    = g_navNode_Path;
			
	LeftNavIFA.prototype.Display = LeftNavIFA_Display;
	LeftNavIFA.prototype.DisplayNode = LeftNavIFA_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 LeftNavIFA_Display (node)
{
	document.write('<dl>');
	this.DisplayNode(node);	
	document.write('</dl>');
}

function LeftNavIFA_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;
		
		ds[di++] = (nodeLevel <= 2) ? '<dt' : '<dd';
		ds[di++] = ' class="' + nodeClass + '"';
		ds[di++] = '>';


		if (node.m_level == '1')
		{
			
			if (bSelected == "1")
			{
			ds[di++] = '<tr><td colspan="2" align="left" valign="top" width="146" height="19" style="background: #0099FF;"><div style="margin-top:3px; margin-bottom:3px; margin-left:10px; margin-right:5px;">';
			ds[di++] = '<a href="' + node.m_href + '"';
			ds[di++] = ' class="leftnavselected"';				 
			ds[di++] = '>';
			ds[di++] = node.m_label + '&nbsp;<span style="font-family: Verdana; font-size: 12px;"><img src="http://www.ing-usa.com/us/stellent2/groups/it/documents/image/wht_arrow_blue_bg.gif" border="0"></span>';
			ds[di++] = '</a>';
			ds[di++] = '</div></td></tr>';
			ds[di++] = '<tr><td colspan="2" align="left" valign="top" style="background:#FFFFFF;"> <img src="http://www.ing-usa.com/us/stellent2/groups/it/documents/image/spacer.gif" width="1" height="1"></td></tr>';
			}
			
			if (bSelected != "1")
			{
			ds[di++] = '<tr><td colspan="2" align="left" valign="top" width="146" height="19" style="background: #BDBEC0;"><div style="margin-top:3px; margin-bottom:3px; margin-left:10px; margin-right:5px;">';
			ds[di++] = '<a href="' + node.m_href + '"';
			ds[di++] = ' class="leftnav"';				 
			ds[di++] = '>';
			ds[di++] = node.m_label + '&nbsp;<span style="font-family: Verdana; font-size: 12px;">&#155;</span>';
			ds[di++] = '</a>';
			ds[di++] = '</div></td></tr>';
			ds[di++] = '<tr><td colspan="2" align="left" valign="top" style="background:#FFFFFF;"> <img src="http://www.ing-usa.com/us/stellent2/groups/it/documents/image/spacer.gif" width="1" height="1"></tr>';
			}
			
		}

		if (node.m_level == '2')
		{
			ds[di++] = '<tr><td colspan="2" align="left" valign="top" style="background: #E1E1E1;"><img src="http://www.ing-usa.com/us/stellent2/groups/it/documents/image/spacer.gif" width="1" height="1"></td></tr>';
			ds[di++] = '<tr>';
			
	if (bSelected == "1")
			{
			ds[di++] = '<td align="left" valign="top" height="1"><div style="margin-top:3px; margin-left:10px; color:#0099FF;"> <b>&#183;</b>&nbsp;</div></td>';
			ds[di++] = '<td align="left" valign="top" height="19"><div style="margin-top:3px; margin-bottom:3px;">';
			ds[di++] = '<a href="' + node.m_href + '"';
			ds[di++] = ' class="leftnavsubselected"';				 
			ds[di++] = '>';
			ds[di++] = node.m_label;
			ds[di++] = '</a>';
			}
	if (bSelected != "1")
			{
			ds[di++] = '<td align="left" valign="top" height="1"><div style="margin-top:3px; margin-left:10px;"> <b>&#183;</b>&nbsp;</div></td>';
			ds[di++] = '<td align="left" valign="top" width="146" height="19"><div style="margin-top:3px; margin-bottom:3px;">';
			ds[di++] = '<a href="' + node.m_href + '"';
			ds[di++] = ' class="leftnavsub"';				 
			ds[di++] = '>';
			ds[di++] = node.m_label;
			ds[di++] = '</a>';
			}			
			ds[di++] = '</div></td>';

		}

		if (node.m_level == '3')
		{
			ds[di++] = '<tr>';
			
			if (bSelected == "1")
			{
			ds[di++] = '<td align="left" valign="top"><img src="http://www.ing-usa.com/us/stellent2/groups/it/documents/image/spacer.gif" width="1" height="1"></td>';
	                ds[di++] = '<td align="left" valign="top">';
			ds[di++] = '<table align="left" valign="top" border="0" cellpadding="1" cellspacing="1"><tr><td align="left" valign="top"><div style="margin-left:3px; color:#0099FF">';
			ds[di++] = '<b>&#183;</b></div></td><td align="left" valign="top"><div style="color:#0099FF"><a href="' + node.m_href + '"class="leftnavsubselected">' + node.m_label;
			ds[di++] = '</a></div></td></tr></table>';
			}

			if (bSelected != "1")
			{
			ds[di++] = '<td align="left" valign="top"><img src="http://www.ing-usa.com/us/stellent2/groups/it/documents/image/spacer.gif" width="1" height="1"></td>';
	                ds[di++] = '<td align="left" valign="top">';
			ds[di++] = '<table align="left" valign="top" border="0" cellpadding="1" cellspacing="1"><tr><td align="left" valign="top"><div style="margin-left:3px;">';
			ds[di++] = '<b>&#183;</b></div></td><td align="left" valign="top"><a href="' + node.m_href + '"class="leftnavsub">' + node.m_label;
			ds[di++] = '</a></td></tr></table>';
			}
			ds[di++] = '</div></td>';
			ds[di++] = '</tr>';
		}

		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]);
		}
	}
}

