The following seems to work:
popupCenter('', 'formPopup', 900, 400, {
resizable: 'yes',
scrollbar: 'yes'
});
The popupCenter function just uses half of the existing width and height of the window:
function popupCenter(pageURL, title, width, height, options) {
options = options || {};
options.left = (screen.width / 2) - (width / 2);
options.top = (screen.height / 2) - (height / 2);
return popup(pageURL, title, width, height, options);
}
And the popup function can be as complex or as simple as you like, but something like this should mean that it can be used for multiple types of situations:
function popup(pageURL, title, width, height, options) {
return window.open(pageURL, title,
'width=' + (width || options.width || '') + ',' +
'height=' + (height || options.height || '') + ',' +
'left=' + (options.left || '') + ',' +
'top=' + (options.top || '') + ',' +
'toolbar=' + (options.toolbar || 'no') + ',' +
'location=' + (options.location || 'no') + ',' +
'directories=' + (options.directories || 'no') + ',' +
'status=' + (options.status || 'no') + ',' +
'menubar=' + (options.menubar || 'no') + ',' +
'scrollbars=' + (options.scrollbars || 'no') + ',' +
'resizable=' + (options.resizable || 'no') + ',' +
'copyhistory=' + (options.copyhistory || 'no') + ','
);
}