﻿        function popup(url, w, h, n) {
            var width = w;
            var height = h;
            var windowCoordinates = getCenterWindowCoordinates(width, height);
            var params = 'width=' + width + ', height=' + height;
            var newwin;
            params += ', top=' + windowCoordinates.top + ', left=' + windowCoordinates.left;
            params += ', directories=0';
            params += ', location=0';
            params += ', menubar=0';
            params += ', resizable=1';
            params += ', scrollbars=0';
            params += ', status=0';
            params += ', toolbar=0';
            newwin = window.open(url, n, params);
            if (window.focus) { newwin.focus() }
            return false;
        }

        function getCenterWindowCoordinates(windowWidth, windowHeight) {
            var windowLeft = 0;
            var windowTop = 0;

            if (window.screenX) {
                windowLeft = window.screenX + ((window.outerWidth - windowWidth) / 2);
            }
            else if (window.screenLeft) {
                var isCompatMode = ((document.compatMode) && (document.compatMode != 'BackCompat'));
                window.outerWidth = (isCompatMode) ? document.body.parentElement.clientWidth : document.body.clientWidth;
                window.outerHeight = (isCompatMode) ? document.body.parentElement.clientHeight : document.body.clientHeight;
                window.outerHeight -= 80;
                windowLeft = (window.screenLeft + ((window.outerWidth - windowWidth) / 2));
            }
            else {
                windowLeft = ((screen.width - windowWidth) / 2);
            }

            if (window.screenY) {
                windowTop = window.screenY + ((window.outerHeight - windowHeight) / 2);
            }
            else if (window.screenLeft) {
                var isCompatMode = ((document.compatMode) && (document.compatMode != 'BackCompat'));
                window.outerWidth = (isCompatMode) ? document.body.parentElement.clientWidth : document.body.clientWidth;
                window.outerHeight = (isCompatMode) ? document.body.parentElement.clientHeight : document.body.clientHeight;
                window.outerHeight -= 80;
                windowTop = (window.screenTop + ((window.outerHeight - windowHeight) / 2));
            }
            else {
                windowTop = ((screen.height - windowHeight) / 2);
            }

            if ((windowTop - 10) > 0)
                windowTop -= 10;

            return { left: windowLeft, top: windowTop };
        }
// -->
