// Function opens a new window centred on the screen
function popupWindow(pageUrl, windowName, popupWidth, popupHeight, scrollBar, status)
{
    // Get the monitor screen's width and height (resolution)
    if (document.all)
    {
        // IE and NS6
        screenWidth = screen.availWidth;
        screenHeight = screen.availHeight;
    }
    else
    {
        // NS4
        screenWidth = screen.width;
        screenHeight = screen.height;
    }

    // Get the centred positions of the popup window
    posX = (screenWidth - popupWidth) / 2;
    posY = (screenHeight - popupHeight) / 2;


    // Create the command string to open the window with features
    popupStr  = "window.open('" + pageUrl + "','" + windowName + "','";

    if (scrollBar == 1) scrollBar = 'yes';
    else scrollBar = 'no';

    popupStr += "scrollbars=" + scrollBar + ",";

    if (status == 1) scrollBar = 'yes';
    else status = 'no';

    popupStr += "status=" + status + ",";
    popupStr += "width=" + popupWidth + ",";
    popupStr += "height=" + popupHeight + ",";
    popupStr += "screenX=" + posX + ",left=" + posX + ",";
    popupStr += "screenY=" + posY + ",top=" + posY + "')";

    // Run the popup window command
    eval(popupStr);
}