﻿// Please Wait Javascript

function ShowPleaseWait(PleaseWaitDivID)
{
    //get the object 
    var PleaseWaitScreen = document.getElementById(PleaseWaitDivID);
    PleaseWaitScreen.style.display = "";
    var intPleaseWaitHeight = PleaseWaitScreen.clientHeight;
    var intPleaseWaitWidth = PleaseWaitScreen.clientWidth;
    
    //get the position of the screen
    var intClientHeight = 0
    var intClientWidth = 0    
    //get client height & width
    if(window.innerHeight)
        intClientHeight = window.innerHeight;
    else
        intClientHeight = document.body.parentNode.clientHeight;  
    if(window.innerWidth)
        intClientWidth = window.innerWidth;
    else
        intClientWidth = document.body.parentNode.clientWidth;  
        
    //get the scroll positions of the body
    var intScrollTop = 0
    var intScrollLeft = 0    
    
    if(document.documentElement)
    {
        intScrollTop = document.documentElement.scrollTop;
        intScrollLeft = document.documentElement.scrollLeft;
    }
    else
    {
        intScrollTop = document.body.scrollTop;
        intScrollLeft = document.body.scrollLeft;
    }    

    //Reposition the panel to center
    PleaseWaitScreen.style.position = "absolute";
    PleaseWaitScreen.style.zIndex = "3000";
    PleaseWaitScreen.style.top = (intScrollTop + ((intClientHeight - intPleaseWaitHeight) / 2)) + "px";
    PleaseWaitScreen.style.left = (intScrollLeft + ((intClientWidth - intPleaseWaitWidth) / 2)) + "px";
}


function HidePleaseWait(PleaseWaitID)
{
    var PleaseWaitScreen = document.getElementById(PleaseWaitID);
    PleaseWaitScreen.style.display = "none";
}


