var w_popup;

/**
 * popup - open general popup window.
 * - url (string) - URL to open
 * - width (int) - width in pixels
 * - height (int) - height in pixels
 * - scrollbars (string) - if "1", show scrollbars
 * - toolbar (string) - if "1", show toolbar
 */
function popup(url, width, height, scrollbars, toolbar) {
   // check for existing popup
   if (! w_popup || w_popup.closed) {
      // set defaults
      if (width == null) width = 570;
      if (height == null) height = 510;
      if (scrollbars == null) scrollbars = 1;
      if (toolbar == null) toolbar = 0;
      w_popup = open(url, "popup_window", "directories=0,location=0,menubar=0,resizable=yes,scrollbars=" + scrollbars + ",status=0,toolbar=" + toolbar + ",width=" + width + ",height=" + height + ",left=50,top=20");
      if (! w_popup.opener)
         w_popup.opener = self;
      if (w_popup)
         w_popup.focus();
   } else {
      w_popup.focus();
      w_popup.location = url;
   }
}

/**
 * loadpage - load new URL given in the dropdown box.
 */
function loadpage(dropdown) {
   newlocation = dropdown.options[dropdown.selectedIndex].value;
   if (newlocation != "")
      document.location = newlocation;
}

/**
 * resizeContentArea - resize content window based on browser window size.
 * - scrollArea (string) - div name of scrollable area
 * - remainHeight (int) - remaining window height not used by scroll area
 */
function resizeContentArea(scrollArea, remainHeight) {

   // get scroll area
   var oContent = (document.getElementById ? document.getElementById(scrollArea) :
      (document.all ? eval("document.all." + scrollArea) : null));
   var contentHeight = (window.innerHeight ? window.innerHeight :
      document.body.parentNode.clientHeight) - remainHeight;
   oContent.style.height = contentHeight + "px";
}
