var popUp;


function getScreenAvailHeight(){
    if(!!window.screen)
        return screen.availHeight  //N4,N6,Moz,IE,共用
    else
        return null                //上記以外
}

function getScreenAvailWidth(){
    if(!!window.screen)
        return screen.availWidth   //N4,N6,Moz,IE,共用
    else
        return null                //上記以外
}


function SetControlValue(controlID, newDate, isPostBack)
{
    popUp.close();
    document.forms[0].elements[controlID].value=newDate;
    __doPostBack(controlID,'');
}

function ClosePopup()
{
    window.opener.location.reload(true);
    window.close();
}

function OpenPopup (w, h, pageUrl)
{
    var l, t;

    l = getScreenAvailWidth() / 2 - w / 2;
    t = getScreenAvailHeight() / 2 - h / 2;
    popUp=window.open(pageUrl, 
                      'popup', 
                      'width=' + w + ', height=' + h + ' left=' + l + ',top=250');
    popUp.focus();
}

function OpenPopup2 (pageUrl)
{
    popUp=window.open(pageUrl, 
                      '_blank',
                      'top=200');
    popUp.focus();
}
