// Javascript Document

// A very cool variation that reminds us about window.onload happening only once in a page
// and lets us do various kinds of popups, with configurable details.
// from http://mar.anomy.net/entry/2004/02/09/12.17.47/



var popupLinkConfig = new Array;
// popupLinkConfig["classname"] = new Array ( "targetname", "width=550,height=350,scrollbars=yes,resizable=yes,status=yes,toolbar=yes,location=yes,menubar=yes");
popupLinkConfig["popillo"]    = new Array ( "Zoom", "width=375,height=425,scrollbar=yes,menubar=no,resizable=yes,status=yes,left=300,top=150, location=no");
popupLinkConfig["glossary"] = new Array ( "Words", "width=550,height=350,resizable=yes");

function initPopupLinks()
{
  if (!document.getElementsByTagName) return false; // [changed from 'true' --KJT]
  var pageLinks = document.getElementsByTagName("a");
  for (var i = 0; i < pageLinks.length; i++) 
  {
    if (((pageLinks[i].className != null) && 
         (pageLinks[i].className != "")) ||
        ((pageLinks[i].parentNode.className != null) && 
         (pageLinks[i].parentNode.className != "")))
    {
      var linkClass = " " + pageLinks[i].className + " ";
      if ((linkClass == "  ") && (pageLinks[i].parentNode.className != ""))
      {
        linkClass = " " + pageLinks[i].parentNode.className + " ";
      }
      for (var theKey in popupLinkConfig) 
      {
        if (linkClass.indexOf(" " + theKey + " ") > -1)
        {
          if ((pageLinks[i].target == "") || (pageLinks[i].target == null))
          {
            pageLinks[i].target = (popupLinkConfig[theKey][0] != "") ? popupLinkConfig[theKey][0] : theKey;
          }
          pageLinks[i].settings = popupLinkConfig[theKey][1];
          pageLinks[i].onclick = popUp;
        }
      }
    }
  }
  return true;
}

function popUp()
{
  newWin = window.open(this.href, this.target, this.settings);
  newWin.focus();
  return false;
}


// ==========================================================================
window.onload = initPage;  
// Note: Make sure that no other javascripts assign a fuction to window.onload
// There can be only one function tied to window.onload at a time.
// But... that initPage function can call other things...


function initPage() {
  initPopupLinks();
  // place here any other code [or functions--KJT] you wish to run when the page loads.
}



