function newWindow(link)
{
// Open a new window for links outside the domain.
// People shouldn't leave the site.

    window.open(link.href); 
}

function pulldowns()
{
// Extend hovering to implement pulldown menus.

   if (!document.getElementsByTagName) return

   var divs = document.getElementsByTagName("div");
   
   for (var i = 0; i < divs.length; i++)
   {
      if ( divs[i].className == "submenu" )
      {
         divs[i].onmouseover = function()
         {        
// Using this function, submenus are displayed when the 
// cursor hovers over the main menu bar link. The submenus 
// are extracted from the ul tag that's embedded in each 
// div tag with the submenu class. 
//
// An example is as follows: 
//
// <div class="submenu">
//    <a href="#">Main Menu Bar Link</a>
//    <ul>
//       <li><a href="#">Submenu Link 1</a></li>
//       <li><a href="#">Submenu Link 2</a></li>
//       <li><a href="#">Submenu Link 3</a></li>
//    </ul>
// </div>

// Look for the nested element with the tooltip content
// and position the tooltip relative to the default
// tooltip position.   

            var nodenum = this.childNodes.length;
            var parentLeft = this.offsetLeft;
            var parentTop = this.offsetTop;
            var parentHt = this.offsetHeight;
            var parentTopIE = 0;
            var parentHtIE = 0;
            var parentLeftIE = 0;

            if ( document.all )
            {
               parentTopIE = document.all.menu.offsetTop;
               parentHtIE = document.all.menu.offsetHeight;
               parentLeftIE = document.all.menu.offsetLeft;
            } 

            for (var i = nodenum-1; i >= 0; i--)
            {
               var elem = this.childNodes[i];
               
               if (elem)
               {
                  if ( elem.nodeName == "UL" )
                  {
                     elem.style.display = "block";

// Position the UL element relative to its parent element but 
// use absolute positioning in the stylesheet so the menus 
// overlay instead of insert.

                     elem.style.left = parentLeft + "px";
                     elem.style.top = parentTop + parentHt + "px";

                     if ( document.all )
                     {
                        elem.style.posLeft = parentLeft + parentLeftIE + 30;
                        elem.style.posTop = parentTopIE + parentHtIE - 12;
                     }

                     break;
                  }
               }
            }

         }  // end of anonymous onmouseover function

         divs[i].onmouseout = function()
         {
// This function hides the submenu (associated ul tag) when the  
// cursor leaves the  hovering area (the main menu bar link).

            var nodenum = this.childNodes.length;

            for (var i = nodenum-1; i >= 0; i--)
            {
               var elem = this.childNodes[i];
               
               if (elem)
               {
                  if ( elem.nodeName == "UL" )
                  {
                     elem.style.display = "none";

                     break;
                  }
               }
            }
         }  // end of anonymous onmouseout function
         
      }  // end of if ( divs[i].className == "submenu" )
      
   } // end of for (var i = 0; i < divs.length; i++)

}  // end of function pulldowns()

window.onload = pulldowns;  // set hover event handling only once

