﻿var DIALOG = null, OPACITY = null, LASTPT = null, UIBLOCKER = null, UIBLOCKERMSG = null, AUTH_OPACITY = null, AUTH_DIALOG = null, CLOSING = false;

function ShowOpacity() 
{
        CloseDialog();

        OPACITY = document.createElement("div");
        OPACITY.id = "dvAlertOp2";
        OPACITY.style.position = "absolute";
        OPACITY.style.left = "0px";
        OPACITY.style.top = "0px";
        OPACITY.style.backgroundColor = "#cccccc";
        OPACITY.style.zIndex = "1000";
        OPACITY.style.filter = "alpha(OPACITY=50)";
        OPACITY.style.opacity = "0.5";

        AddControl(OPACITY);
        StretchControl(OPACITY);
}
function CloseDialog() 
{
    if (OPACITY != null) {
        RemoveControl(OPACITY);
        OPACITY = null;
    }
    if (DIALOG != null) {
        RemoveControl(DIALOG);
        DIALOG = null;
    }
}
		
function StretchControl(ctrl) 
{
     ctrl.style.height = $(document).height()+ "px";
     ctrl.style.width = $(document).width()+ "px";
   
}

function RemoveControl(ctrl) 
{
    if (document.body.getElementsByTagName("div").length > 0)
        document.body.getElementsByTagName("div")[0].removeChild(ctrl);
    else
        document.body.removeChild(ctrl);
}
		
		
function AddControl(ctrl) 
{
    if (document.body.getElementsByTagName("div").length > 0)
        document.body.getElementsByTagName("div")[0].insertBefore(ctrl, null);
    else
        document.body.appendChild(ctrl);
}
