﻿Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);

function beginReq(sender, args) {
    // shows the Popup
    try
    {
        var element = args.get_postBackElement();

        if (element.type == "checkbox" || element.type == "radio") {
            // for checkbox type, attribute is added to parent span and not the actual input control
            element = element.parentNode;
        }
        
        var attribute = $(element).attr("RegisterForModalProgress");

        if (attribute != null) {
            $find(ModalProgress).show();
        }
    }
    catch (ex) {
        // alert(ex);
        // swallow
    }
}

function endReq(sender, args) {
    //  shows the Popup 
    $find(ModalProgress).hide();
} 

