/* Open a new window (perfectly centered at 70-90% of screen size) */
function openWin() {
  args = openWin.arguments;

  /*--- Choose window size (full screen minus how many pixels) ---*/
  var windowsize = 150;
  var maxwindowwidth = 1024;
  var maxwindowheight = 768;
  /*--------------------------------------------------------------*/

  if (screen.width > maxwindowwidth)
  {
    var width = maxwindowwidth;
    var widthc = (screen.width - maxwindowwidth) / 2;
  }
  else
  {
    var width = screen.width - windowsize;
    var widthc = windowsize / 2;
  }

  if (screen.height > maxwindowheight)
  {
    var height = maxwindowheight;
    var heightc = ((screen.height - maxwindowheight) / 2) - 50;
  }
  else
  {
    var height = screen.height - (windowsize * 2);
    var heightc = windowsize / 2;
  }
  
  window.open(args[0], 'openWin', 'width=' + width + ',height=' + height + ',top=' + heightc + ',left=' + widthc + ',scrollbars=1,status=1,toolbar=1,menubar=1,resizable=1');
  return false;
}

