﻿Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);

// ModalProgress - is a variable that is set up by ModalInactiveControl.ascx.cs - is a reference to the ModalPopupClientId
// AsyncBusyMessage - is a variable that is set up by ModalInactiveControl.ascx.cs - is a MetaTranslation Message.

function beginReq(sender, args) {
    // shows the invisible overlay Popup - to disable further form posting while busy with an async post
    if ($find(ModalProgress)) {
        window.status = AsyncBusyMessage; // "{CP Message : Window Status Async Busy Message}"; // Lets the user know the browser window is busy processing the request in the window status bar.
        $find(ModalProgress).show();
    }
}

function endReq(sender, args) {
    //  hides the Popup that disables further form posting while busy with an async post
    if ($find(ModalProgress)) {
        window.status = window.defaultStatus; // Reverts the window status to its default state.
        $find(ModalProgress).hide();
    }
}

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
