var IsModal=true;
//var SessionDialogBox='';

function ShowModal(IsIE)
{
    // Don't show modal when it is an ASP.NET ajax post
    if(typeof(Sys) != 'undefined' && typeof(Sys.WebForms) != 'undefined')
    {
        var prm = Sys.WebForms.PageRequestManager.getInstance();        
        
        if(prm._postBackSettings.async)
            return;
    }
    var bodyelem = document.getElementsByTagName('body');
    var modal_frame = document.getElementById('Modal_Div');
    var blur_frame = document.getElementById('Blur_Div');
    if(IsModal==true)
    {
        if(modal_frame != null && blur_frame != null)
        {
            document.getElementsByTagName('html')[0].style.overflow='hidden';
            if(String(IsIE).toLowerCase() == 'true' )
            {
                modal_frame.style.height = document.body.clientHeight;
                modal_frame.style.width = document.body.clientWidth;
                blur_frame.style.height = document.body.clientHeight;
                blur_frame.style.width = document.body.clientWidth;
            }
            else
            {
                modal_frame.style.width =  '100%';
                modal_frame.style.height = '100%';
                blur_frame.style.width =  '100%';
                blur_frame.style.height = '100%';
            }   
            modal_frame.style.display='';
            modal_frame.style.zIndex=1000;
            blur_frame.style.display='';
            blur_frame.style.zIndex=999; 
        }
    }
    else
    {
    }  
     
    IsModal=true;    
}

function HideModal()
{
    var modal_frame = document.getElementById('Modal_Div');
    var blur_frame = document.getElementById('Blur_Div');
    if(IsModal==true)
    {
        if(modal_frame != null && blur_frame != null)
        {
            modal_frame.style.display='none';
            blur_frame.style.display='none';
            document.getElementsByTagName('html')[0].style.overflow='auto';
        }
    }
   IsModal=false;    
}

function SetModalOff()
{
    IsModal=false;
}