
var sw = null;
var i = 0;
function PopUp(width, height, url) {
    // Close the window if it's open
    if (sw != null && !sw.closed) {
        sw.close();
    }

    // Find the screen width
    var screenWidth = screen.width;
    var screenHeight = screen.height;

    // Set the appropriate left and top to center the window
    var left = Math.round((screenWidth - width) / 2);
    var top = Math.round((screenHeight - height) / 2);

    // Set up the features string
    var features =
        "width=" + width
        + ",height=" + height
        + ",left=" + left
        + ",top=" + top
        + ",status=no"
        + ",scrollbars=yes"
        + ",toolbar=no"
        + ",resizable=no"
    ;

    // Open the new window
    // Give it a different name each time
    ++i;
    sw = window.open(url, "suppwin" + i, features, true);
}
