﻿// JScript File

var ModalPopUpPanel;
function SetModalPopUp()
{
        var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
        var clientWidth;
        if (window.innerWidth) {
            clientWidth = ((Sys.Browser.agent === Sys.Browser.Safari) ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
        } else {
            clientWidth = document.documentElement.clientWidth;
        }
        var clientHeight;
        if (window.innerHeight) {
            clientHeight = ((Sys.Browser.agent === Sys.Browser.Safari) ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
        } else {
            clientHeight = document.documentElement.clientHeight;
        }
        var bo = $get('BackGround');
        bo.style.left = scrollLeft+'px';
        bo.style.top = scrollTop+'px';
        bo.style.width = clientWidth+'px';
        bo.style.height = clientHeight+'px';
        bo.style.display = 'block';
        var a = $get(ModalPopUpPanel);
        a.style.position = 'absolute';
        a.style.zIndex=999;
        a.style.display='block';
        a.style.left = scrollLeft+((clientWidth-a.offsetWidth)/2)+'px';
        a.style.top = scrollTop+((clientHeight-a.offsetHeight)/2)+'px';
        
//        var frm = document.createElement("iframe");   
//        bo.appendChild(frm);
//        frm.style.position = 'absolute';
//        frm.style.left = a.style.left;
//        frm.style.top = a.style.top;
//        frm.style.width = a.style.width;
//        frm.style.height = a.style.height;
}
//window.onload=SetUpdateProgress;
function ShowModalPopUp(Panel)
{
    ModalPopUpPanel = Panel;
    SetModalPopUp();
    window.onscroll=SetModalPopUp;
    window.onresize=SetModalPopUp;
}
function HideModalPopUp(Panel)
{
    ModalPopUpPanel = Panel;
    var bo = $get('BackGround');
    var a = $get(ModalPopUpPanel);
    bo.style.display = 'none';
    a.style.left = '-1000px';
    a.style.top = '-1000px';
    window.onscroll=function(){};
    window.onresize=function(){};
}
