// New Window (Pop-up)
// Opens a new window to the passed specifications

var defaultwidth  = 500;
var defaultheight = 350;

function newWindow(url, name, width, height, settings) {

  // URL is required
  if( url == 'undefined' ) { return false; }

  // Set defaults (if data has not been passed)
  name     = (name     == 'undefined') ? 'window' : name;
  width    = (width    == 'undefined') ? defaultwidth  : width;
  height   = (height   == 'undefined') ? defaultheight : height;

  // Center position coordinates
  var setX = Math.floor((window.screen.width - width) / 2);
  var setY = Math.floor(((window.screen.height - 100) - height) / 2);

  // Settings
  settings  = (settings != 'undefined') ? settings : 'toolbar=0';

  // Open the window
  window.open(url, name, 'width=' + width + ', height=' + height + ', ' + settings + ', top=' + setY + ', left=' + setX);

} // ! newWindow

