/////////////////////////////////////////////////////////////////////////////
// Function : TIDSiteMapPlain
// Comments : 
/////////////////////////////////////////////////////////////////////////////

// this version is heavily parameterised with "mainColor" and "hotColor" 
// just like the navigation fragments
// it might be better to leave it all to stylesheet edits...
// or - better still, leave it as server side stuff to generate the <style> defs 
// and the display code...

function TIDSiteMapPlain(strTextColor, strHoverColor, strFocusColor, strClassName, strShowHome, strShowFocus)
{
	this.m_TextColor  = '';
	this.m_HoverColor = '';
	this.m_FocusColor = '';
	this.m_ClassName  = 'TIDSiteMapPlain';
	
	this.m_ShowHome   = false;
	this.m_ShowFocus  = false;	
	
	this.m_NavPath    = g_navNode_Path;
		
	TIDSiteMapPlain.prototype.Display = TIDSiteMapPlain_Display;
	TIDSiteMapPlain.prototype.DisplayNode = TIDSiteMapPlain_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 (strShowFocus == 'true')
		this.m_ShowFocus = true;
	
} 

function TIDSiteMapPlain_Display (node)
{
    
	document.write ('<div class="' + this.m_ClassName + '"');
	
	if (this.m_TextColor != '')
    	document.write (' style="color: ' + this.m_TextColor + ';"');
		
	document.write ('>');
    document.write ('<table cellpadding = "20"> <tbody> <tr> <td valign="top" width="200">');
	this.DisplayNode(node);
	document.write('</td> </tr> </tbody> </table>');
	//document.write('close cell and table');
	
	document.write ('</div>');
	
}
var ncount = 0
function TIDSiteMapPlain_DisplayNode(node)	
{
	var nodeColor = this.m_TextColor;
	var nodeClass = this.m_ClassName;
	var nodeLevel = node.m_level;
	
	   
	if (ncount == 5 && nodeLevel == 1)
	 { 
	  document.write('</td> <td valign="top" width="200">');
	  // document.write ('close cell');
	   }
	
	
	if (nodeLevel > 6)
		nodeLevel = 6;

	if (node.m_level > 0 || this.m_ShowHome)
	{
		var ds = new Array();
		var di = 0;

		if (this.m_ShowFocus && 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 == 1)
	{
	   	document.write ('<br>');
        ncount = ncount+1;
	//   	document.write (ncount);
	   	}
	  
		if (node.m_level > 0)
			nodeClass += '-' + nodeLevel;

		ds[di++] = '<div';
		ds[di++] = ' class="' + nodeClass + '"';
		ds[di++] = '>';
				
		ds[di++] = '<a href="' + node.m_href + '"';
		
		ds[di++] = ' class="' + nodeClass + '"';
		
		if (nodeColor != '')
		{
			ds[di++] = ' style="color: ' + nodeColor + ';"';
			
			if (this.m_HoverColor != '')
			{
				ds[di++] = ' onmouseover="this.style.color=\'' + this.m_HoverColor + '\'"';
				ds[di++] = ' onmouseout="this.style.color=\'' + nodeColor + '\'"';
				
			}
		}
		ds[di++] = '>'
		
		ds[di++] = node.m_label;
		ds[di++] = '</a></div>';
		
		document.write(ds.join(''));
		
	
	}
	
	// expand sub-levels (if any)
	for (var i = 0; i < node.m_subNodes.length; i++)
	{
	   
		this.DisplayNode(node.m_subNodes[i]);
	}
}


