/**
 * Popup window function. 
 *
 * @param string The page to open in the popup. 
 * @param string The name for the new window. 
 */
function wmsImgPopup(url, window_name, width, height)
{
    var popup = null;
    var left = Math.round(screen.width / 2) - 300;
    var top = Math.round(screen.height / 2) - 260;
    var scrollbars = "no";
    if (left < 0) {
        left = 0;
    }
    if (top < 0) {
        top = 0;
    }
    scrollbars = "yes";
    if (width > 800) {
        width = 800;
    }
    if (height > 600) {
        height = 600;
    }
    popup = window.open(url, window_name, 'width=' + width + ', height=' 
        + height + ',scrollbars=' + scrollbars 
        + ', resizable=yes, toolbar=no, location=no, status=no, menubar=no, left=' 
        + left + ', top=' + top); 
    if (popup) {
        if (window.focus) {
            popup.focus();
        }
        return false;  
    }
    return true;
}

