﻿var BasePath="";
function ShowMessageOnOverlay(m) {
    if ($("#Overlay").id == undefined) EnableOverlay();
    $("#Overlay").append($("<div></div>").css({
        position: "fixed",
        left: ($(document).width() - 357) / 2 + "px",
        top: ($(window).height() - 139 - 100) / 2 + "px",
        zIndex: "1000",
        backgroundColor: "Transparent",
        backgroundImage: "url(" + BasePath + "images/MsgBg.png)",
        backgroundRepeat: "no-repeat",
        width: "280px",
        height: "85px",
        fontSize: "25px",
        paddingTop: "55px",
        paddingLeft: "80px"
    }).html("<img src='" + BasePath + "images/loading.gif' align='absmiddle' hspace='10' />" + m));
};

function EnableOverlay() {
    $("body").prepend($("<div></div>").attr("id", "Overlay").css({
        position: "absolute",
        left: "0px",
        top: "0px",
        zIndex: "999",
        backgroundImage: "url(" + BasePath + "images/blank.png)",
        width: "100%",
        height: $(document).height() + "px"
    }));
}
function DisableOverlay() {
    $("#Overlay").remove();
}
function ShowResult(data) {
    try {
        data = eval('(' + data + ')');
        if (data.Msg) {
            DisableOverlay();
            alert(data.Msg);
        }
        if (data.RedirectURL) {
            document.location.href = data.RedirectURL;
        }
    } catch (e) {
        DisableOverlay();
        alert(data + "\n\n" + e);
    }
}
