function init(e)
{
  activateMenu('nav');
  externalLinks();
}

// fix IE's non-support of hover on elements other than "a"
// for the multi-level dropdowns
activateMenu = function(nav) 
{
	if(document.all && document.getElementById(nav).currentStyle)
	{
	  // only MSIE supports document.all
    var navroot = document.getElementById(nav);

    /* Get all the list items within the menu */
    var lis=navroot.getElementsByTagName("LI");
    for(i=0;i<lis.length;i++)
    {
      /* If the LI has another menu level */
      if(lis[i].lastChild.tagName=="UL")
      {
        /* assign the function to the LI */
        lis[i].onmouseover=function()
        {
          /* display the inner menu */
          this.lastChild.style.display="block";
        }
        lis[i].onmouseout=function()
        {
          this.lastChild.style.display="none";
        }
      }
    }
  } // end if IE/Win
} // end activateMenu

// verify submission of the "buy-now" for a PDF
function verifyEmail(form)
{
  var err = 0;
  var msg = '';
  var cj = new RegExp();
  
  // email is required
  if(form["email"].value == '')
  {
    msg += "No email address.\n";
    err++;
  }
  // verify email format if present
  if(form["email"].value != '')
  {
    // allow Euro-style and subdomain addresses
    cj.compile(/^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z0-9]{2,3}$/);
    if (!cj.test(form["email"].value))
    {
      msg += "Email address invalid.\n";
      err++;
    }
  } // end email check
  
  if (err > 0)
  {
    msg = "--------------------------------\n" + msg;
    msg = "Please correct the following:\n" + msg;
    alert(msg);
    return false;
  }
  return true;
} // end pdf form verification

function externalLinks() 
{
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

window.onload = init;
