// Create various types of windows

function popupWindow(url, x, y, directories, location, menubar, scrollbars, status, toolbar, resizable) {
  if (screen.width) {
    var xMax = screen.width, yMax = screen.height;
  }
  else if (window.outerWidth) {
    var xMax = window.outerWidth, yMax = window.outerHeight;
  }
  else {
    var xMax = 1024, yMax=768;
  }
  var xOffset = (xMax-x)/2, yOffset = (yMax-y)/2;

  var newWin = window.open(url,'popup','width='+x+',height='+y+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',directories='+directories+',location='+location+',menubar='+menubar+',scrollbars='+scrollbars+',status='+status+',toolbar='+toolbar+',resizable='+resizable);
  newWin.focus();
}