/** * File: popup.js * Author: Brian Borowski * Date created: December 28, 2001 * Date last modified: July 10, 2010 */ var win; function launchCenter(url, name, popupHeight, popupWidth) { var leftPos = 0, topPos = 0, width, height; if (self.innerHeight) { // All except Explorer width = self.innerWidth; height = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } else if (document.body) { // Other Explorers width = document.body.clientWidth; height = document.body.clientHeight; } topPos = (height - popupHeight) / 2; leftPos = (width - popupWidth) / 2; if (window.screenY) { topPos += window.top.screenY; leftPos += window.top.screenX; } else if (window.screenTop) { topPos += window.top.screenTop / 2; leftPos += window.top.screenLeft; } if (topPos < 0) { topPos = 0; } if (topPos + popupHeight > screen.availHeight) { topPos = screen.availHeight - popupHeight; } if (leftPos < 0) { leftPos = 0; } if (leftPos + popupWidth > screen.availWidth) { leftPos = screen.availWidth - popupWidth; } if (win == null || win.closed) { win = window.open(url, name, 'screenX=' + leftPos + ',screenY=' + topPos + ',screenLeft=' + leftPos + ',screenTop=' + topPos + ',left=' + leftPos + ',top=' + topPos + ',width=' + popupWidth + ',height=' + popupHeight + ',location=no,toolbar=no,menubar=no,status=no' + ',directories=no,scrollbars=yes,resizable=yes'); } else { win.location = url; } win.focus(); }