// window features constants
var DIRECTORIES = "directories";  // show directory buttons
var LOCATION    = "location";     // show location bar
var MENUBAR     = "menubar";      // show menu bar
var RESIZABLE   = "resizable";    // make window resizable
var SCROLLBARS  = "scrollbars";   // show scrollbars (if needed)
var STATUS      = "status";       // show status bar
var TOOLBAR     = "toolbar";      // show toolbar
var CENTER      = "center";       // center window
var UPPERLEFT   = "upperleft";    // display window in upper-left corner
var UPPERRIGHT  = "upperright";   // display window in upper-right corner

// open a new window with specified properties
function openWin(url, jsName, htmlName, width, height)
  {
  var is4up = true;   // for CENTER, UPPERLEFT, UPPERRIGHT features
  var features = "";  // string to hold features argument

  if (parseInt(navigator.appVersion) < 4)  // set is4up to true/false
    is4up = false;

  // build features string
  features += "width=" + width + ",";     // width
  features += "height=" + height + ",";   // height
  for (var i=5; i<arguments.length; i++)  // additional (optional) features
    {
    if (arguments[i] == CENTER && is4up)  // center window
      {
      features += "screenx=" + (screen.width-width) / 2 + ",";
      features += "left=" + (screen.width-width) / 2 + ",";
      features += "screeny=" + (screen.height-height) / 2 + ",";
      features += "top=" + (screen.height-height) / 2 + ",";
      }
    if (arguments[i] == UPPERLEFT && is4up)  // upper-left window
      {
      features += "screenx=0,left=0,screeny=0,top=0";
      }
    if (arguments[i] == UPPERRIGHT && is4up)  // upper-right window
      {
      features += "screenx=" + (screen.width-width-(screen.width/100)) + ",";
      features += "left=" + (screen.width-width-(screen.width/100)) + ",";
      features += "screeny=0,top=0,";
      }
    else  // all additional features besides CENTER, UPPERLEFT, UPPERRIGHT
      {
      features += arguments[i] + "=1,";
      }
    }
  jsName = window.open(url, htmlName, features);
  }
  
  




