//====================================================================
// Function : nvh_mainnavigation_displaynode
// Comments : this method draws the navigation elements for the supplied
//            node and all its children (if appropriate)
//====================================================================
function nvh_mainnavigation_displaynode(path, node, strFragRoot)
{
    var strClass, strClassHover, strShowPopup = "", strHidePopup = "";

	if ((path[node.m_level] == node.m_id) && (node.cp_Navigation < 3))
   {
      strClass      = "TIDSidebarNav-level" + node.m_level + "selected";
      strClassHover = "TIDSidebarNav-level" + node.m_level + "selectedhover";
   }
   else
   {
      strClass      = "TIDSidebarNav-level" + node.m_level;
      strClassHover = "TIDSidebarNav-level" + node.m_level + "hover";

      if (((node.m_level == 1) || (node.m_level == 2)) && (node.m_subNodes.length > 0))
      {
         if (g_objBrowserDetection.is_ie5up) // only bother with popups in IE5 and up
         {
          //  strShowPopup = "TIDSidebarNav" + node.m_id + ".style.display='inline';";
          //  strHidePopup = "TIDSidebarNav" + node.m_id + ".style.display='none';";
         }
      }
   }

   var strIcon = (customSectionPropertyExists(node.cp_MainNavIcon) ? "<img border=0 width=16 height=16 src='" + node.cp_MainNavIcon + "'>&nbsp;" : "");
    if ((node.m_level == 1) && ((node.cp_Navigation != 1) && (node.cp_Navigation != 2)))
           {
           }
           else
           {
			document.write("<tr>");
			// document.write("   <td width='1%' class='" + strClass + "Lead'\">");
			document.write("<td>");
			//if (node.m_subNodes[i] > 0 )
				document.write("   <td width='100%' class='" + strClass + "' onmouseover=\"className='" + strClassHover + "';" + strShowPopup + "\" onmouseout=\"className='" + strClass + "';" + strHidePopup + "\">");

			document.write("      <table width=207px cellspacing=0 cellpadding=0>");
			document.write("         <tr>");
			// if (node. != null)
			//  {
			document.write("            <td width='100%'><a href='" + node.m_href + "'>" + strIcon + node.m_label + "</a></td>");
			//  }
			// else
			//{
			// document.write ("<td>");
			// }
			document.write("            <td>");

			if (((node.m_level == 1) || (node.m_level == 2)) &&
				(node.m_subNodes.length > 0))
			{
				if (path[node.m_level] == node.m_id)
				{
				document.write("<img src='" + strFragRoot + "/TIDSidebarNav-level" + node.m_level + "-downarrow.gif'></img>");
				}
				else
				{
				document.write("<img src='" + strFragRoot + "/TIDSidebarNav-level" + node.m_level + "-rightarrow.gif'></img>");

					if (g_objBrowserDetection.is_ie5up) // only bother with popups in IE5 and up
					{
						document.write("<table style='border: 1px solid black;background-color:white;' id='TIDSidebarNav" + node.m_id + "' style='position:absolute;display:none;' cellspacing=1 cellpadding=0 width=1%");
						for (var i = 0 ; i < node.m_subNodes.length ; i++)
						nvh_mainnavigation_displaynode(path, node.m_subNodes[i], strFragRoot);
						document.write("</table>");
					}
				}
			}
			else
			{
				document.write("&nbsp;");
			}

			document.write("            </td>");
			document.write("         </tr>");
			document.write("      </table>");
			document.write("   </td>");
			document.write("</tr>");
            }
 if ((node.m_level <= 2) && (path[node.m_level] == node.m_id)  && ((node.cp_Navigation == 1) || (node.cp_Navigation == 2)))
      for (var i = 0 ; i < node.m_subNodes.length ; i++)
         nvh_mainnavigation_displaynode(path, node.m_subNodes[i], strFragRoot);
}

//====================================================================
// Function : nvh_mainnavigation_display
// Comments : this method draws the main navigation fragment
//====================================================================
function nvh_mainnavigation_display(path, node, strFragRoot, bDisplayRoot)
{
   document.write("<table cellspacing=1 cellpadding=0 width=100%>");

   if (bDisplayRoot)
   {
  nvh_mainnavigation_displaynode(path, node, strFragRoot);
   }
   else
   {
      for (var i = 0 ; i < node.m_subNodes.length ; i++)
         nvh_mainnavigation_displaynode(path, node.m_subNodes[i], strFragRoot);
   }

   /********************************************/
   /************ TUTORIAL HYPERLINK ************/
   /********************************************/
 //  if (SSContributor)
 //  {
   //   document.write("<tr><td class=\"TIDSidebarNav-level1Lead\">&nbsp;</td><td class=\"TIDSidebarNav-level1\" align=right onmouseover=\"className='TIDSidebarNav-level1hover';\" onmouseout=\"className='TIDSidebarNav-level1';\">");
    //  generateTutorialLink('TIDSidebarNav', 'click here to learn more about the main navigation fragment');
    //  document.write("</td></tr>");
//   }
   /********************************************/
   /************ TUTORIAL HYPERLINK ************/
   /********************************************/

   document.write("</table>");
}
