﻿// JScript File
      // Get a reference to the PageRequestManager.
      var prm = Sys.WebForms.PageRequestManager.getInstance();
     
      // Using that prm reference, hook _initializeRequest
      // and _endRequest, to run our code at the begin and end
      // of any async postbacks that occur.
      prm.add_initializeRequest(InitializeRequest);
      prm.add_endRequest(EndRequest);  

      var postbackID = "";
      // Executed anytime an async postback occurs.
      function InitializeRequest(sender, args) 
      {
        // Change the Container div's CSS class to .Progress.
        $get('Container').className = 'Progress';
        $get('UpdateDiv').className = 'UpdateOn';
     
        // Get a reference to the element that raised the postback,
        //   and disables it.
        postbackID = args._postBackElement.id;
        $get(args._postBackElement.id).disabled = true;
      }
     
      // Executed when the async postback completes.
      function EndRequest(sender, args) 
      {
        // Change the Container div's class back to .Normal.
        $get('Container').className = 'Normal';
        $get('UpdateDiv').className = 'UpdateOff';
     
        // Get a reference to the element that raised the postback
        //   which is completing, and enable it.
        $get(postbackID).disabled = false;
      }

