//  
//  -------------------
//  Script Information
//  -------------------
//  File         : menu.js
//  Project      : SGR
//  Description  : Functions that handle the dynamically expanding menu's
//  Comments     : This script should be included in every page before the BODY tag in 
//                 this site which also uses header.js
//
//  -------------------
//  Version Information
//  -------------------
//  $Revision::                                                    $
//   $Archive::                                                    $
//    $Author::                                                    $
//      $Date::                                                    $ $NoKeywords: $
//
//  Copyright © 1999, CNS International
//
// ------------------------------------------------------------------------------


  // If DHTML is supported then make menu items expandable
  if (is_ie4up)
  {
    document.write("<STYLE> .collapsed{display:none}" +
                   "        .expanded{display:block}" +
                   "</STYLE>");
  }


  // Process page when loading
  window.onload = Function("ProcessPage()");
  

  // Attach code to all items marked as expandable
  function ProcessPage()
  {
    var oDA = document.all
    for (i in oDA)
    {
      // Make menu items expanding in IE
      if (is_ie4up)
      {
        if (oDA[i].className == "masteritem")
        {
          oDA[i].onclick = Function("ToggleState(this)");
          oDA[i].href = "javascript:;"
        }
      }
      // Make current selected page bold
      if ((oDA[i].className == "inhoud") && (oDA[i].tagName == "A"))
      {
        if (oDA[i].href == location.href) 
        { 
          oDA[i].style.fontWeight='bold';
          oDA[i].style.lineHeight='200%';
          // Make sure the parent is expanded 
          oParent = oDA[i].parentElement.parentElement.parentElement.parentElement;
          if (oParent.className = 'expanded') { oParent.className = 'expanded' };
        }
      }
    }
  }

  function ToggleState(oHead)
  {
    var oAll = document.all;
    iIndex = oHead.sourceIndex;
    if (oAll(iIndex + 1).className == "collapsed")
    {
      oAll(iIndex + 1).className = "expanded";
    }
    else 
    {
      oAll(iIndex + 1).className = "collapsed";
    }
  }

