﻿var confirmdialogreturn=false;
var confirmdialogokformobj=null;

function showDialog(vis)
{
    if(vis == "block")
    { 
        //document.body.scroll= "no";
        document.body.style.overflow="hidden"
    }
    else
    {
        //document.body.scroll= "yes";
        document.body.style.overflow=""
    }

    // Retrieve width and height of client browser.
    var cw = document.body.clientWidth;
    var ch = document.body.clientHeight;

    // Disable background
    var bg = document.getElementById("bgDisable");
    bg.style.width = cw;
    bg.style.height = ch;
    bg.style.display = vis;

    //Show dialog at the center of screen.
    dialog.style.top = (ch - dialog.style.height.replace(/px/,""))/2;
    dialog.style.left = (cw - dialog.style.width.replace(/px/,""))/2;
    dialog.style.display = vis;
}

function confirmDialog(confirmtext,bShow)
{
    if(bShow)
    { 
        //document.body.scroll= "no";
        document.body.style.overflow="hidden"
        
        // Retrieve width and height of client browser.
        var cw = document.body.clientWidth;
        var ch = document.body.clientHeight;
        
        var div = document.getElementById("bgDisable");
        div.style.width=cw;
        div.style.height=ch;
        div.style.top='0px';
        div.style.left='0px';
        div.style.position='absolute';
        div.style.display = 'block';
        
        var div1 = document.getElementById("confirmdialog");
        div1.style.width = '400px';
        div1.style.height = '130px';
        div1.style.top=(ch - div1.style.height.replace(/px/,""))/2;
        div1.style.left=(cw - div1.style.width.replace(/px/,""))/2;
        div1.style.display = '';
    }
    else
    {
        //document.body.scroll= "yes";
        document.body.style.overflow=""
        
        // Disable background
        var bg = document.getElementById("bgDisable");
        bg.style.display = 'none';
        
        var div1 = document.getElementById("confirmdialog");
        div1.style.display = 'none';
        if(confirmdialogreturn)
        {
            confirmdialogokformobj.submit();
        }
    }
}