function popup(url) {
  var width = 500;
  var height = 250;
  var left = window.innerWidth / 2 - width / 2;
  var top  = window.innerHeight / 2 - height / 2;
  window.open(url, 'popup', 'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes');
}