﻿// JScript File

/// Common code to have the popup load center to the current monitor & browser window
function CenterPopupPrivate(url,w,h,showScroller)
{
    var winl = window.screenLeft + (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    var popuplocal = null;

    var settings ='height='+h+',';
    settings +='width='+w+',';
    settings +='top='+wint+',';
    settings +='left='+winl+',';
    settings +='scrollbars='+scroll+',';
    settings +='resizable=yes';
    settings +='location=0';
    settings +=',status=0';
    settings +=',scrollbars='+showScroller;

    popuplocal = window.open(url, 'PopUp', settings+',menubar=yes');

    return popuplocal;
}

function CenterPopupWithScroller(url,w,h)
{
    CenterPopupPrivate(url,w,h,1);
}
function CenterPopup(url,w,h)
{
    CenterPopupPrivate(url,w,h,0);
}

function CenterModalPopup(url,w,h,dialogArguments)
{
    var winl = window.top.window.screenLeft + (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    var popuplocal = null;

    var settings ='dialogWidth:'+w+'px;';
    settings +='dialogHeight:'+h+'px;';
    settings +='top='+wint+';';
    settings +='left='+winl+';';
    settings +='scrollbars='+scroll+';';
    settings +='resizable=yes;';
    settings +='location=0;';
    settings +=',status=0;';
    settings +=',scrollbars=0;';

    window.showModalDialog (url, dialogArguments, settings+',menubar=yes');

}