﻿function ShowLoading() {
    var loadingpanel = jQuery('.LoadingPanel');
    if (loadingpanel == null) {
        return;
    }
    loadingpanel.css('left', 0);
    loadingpanel.css('top', 0);
    loadingpanel.css('height', jQuery('#Body').css('height'));
    loadingpanel.css('width', jQuery('#Body').css('width'));
    loadingpanel.delay(300).fadeTo(500, 0.8);
}

function HideLoading() {
    var loadingpanel = jQuery('.LoadingPanel');
    if (loadingpanel == null) {
        return;
    }
    loadingpanel.css('left', 0);
    loadingpanel.css('top', 0);
    loadingpanel.css('height', jQuery('#Body').css('height'));
    loadingpanel.css('width', jQuery('#Body').css('width'));
    loadingpanel.css('display', 'none');
}

var req = Sys.WebForms.PageRequestManager.getInstance();
req.add_beginRequest(ShowLoading);
req.add_endRequest(HideLoading);

window.onload = function() {
    jQuery('.LoadingPanel').css('display', 'none');
}
