﻿function failedCallback(error){
    var message = String.format(
        "Timeout: {0}\nMsg: {1}\nExceptionType: {2}\nStackTrace: {3}",
        error.get_timedOut(),
        error.get_message(),
        error.get_exceptionType(),
        error.get_stackTrace());
    //alert(message);
}
var loadingimg = "<img src='/images/ajax-loader.gif' alt='Loading'>";

function ShowMask(JObject) {
    var clientHeight;
    clientHeight = document.documentElement.clientHeight;
    if (clientHeight == 0) {
        clientHeight = document.body.clientHeight;
    }
    $('select').css('visibility', 'hidden');
    $('select', JObject).css('visibility', 'visible');
    $('.Mask').css({
        backgroundColor: '#887c62',
        opacity: 0.8,
        height: document.documentElement.clientHeight < document.body.scrollHeight ? document.body.scrollHeight : document.documentElement.clientHeight
    }).show();
    JObject.css({
        top: (document.documentElement.scrollTop + (clientHeight - JObject.height()) / 2)
    }).show();
}
function HideMask(JObject) {
    JObject.hide();
    $('.Mask').fadeOut(function () {
        $('.Mask').hide();
        $('select').css('visibility', 'visible');
    });
}
function HideOneShowAnother(JObject_Hide, JObject_Show) {
    var clientHeight;
    clientHeight = document.documentElement.clientHeight;
    if (clientHeight == 0) {
        clientHeight = document.body.clientHeight;
    }
    JObject_Hide.hide();
    JObject_Show.css({
        top: (document.documentElement.scrollTop + (clientHeight - JObject_Show.height()) / 2)
    }).show();
}
function HideOneShowMsg(JObject_Hide, Msg) {
    JObject_Hide.hide();
    ShowMsg(Msg);
}
function ConfirmInfoAndRedirect(Message, URL) {
    if (confirm(Message)) {
        window.location.href = URL;
    }
}
function ShowMsgAndRedirect(Msg, URL) {
    $("#p_panelmsgandredirect").html(Msg);
    ShowMask($("#MsgAndRedirectPanel"));
    $("#redirecturl").attr("href", URL);
    $("#redirecturl_close").attr("href", URL);
}
function ShowMsg(Msg) {
    $("#p_panelmsg").html(Msg);
    ShowMask($("#PanelMsg"));
}
