function popUp(url, name, popupWidth, popupHeight, focusNow, extra) { if (screen.width && screen.height) { w = screen.width; h = screen.height; } else { w = popupWidth; h = popupHeight; } horizontalPosition = (w - popupWidth) / 2; verticalPosition = (h - popupHeight) / 2; settings = "width=" + popupWidth + ",height=" + popupHeight + ",left=" + horizontalPosition + ",top=" + verticalPosition + "," + extra; popUpWindow = window.open(url, name, settings); if (focusNow == true){ popUpWindow.focus(); } else { document.focus(); } }