1 function Sys$WebForms$PageRequestManager$_initializeInternal(scriptManagerID, formElement) {
2 if (this._prmInitialized) {
3 throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice);
4 }
5 this._prmInitialized = true;
6 this._scriptManagerID = scriptManagerID;
7 this._form = formElement;
8 this._onsubmit = this._form.onsubmit;
9 this._form.onsubmit = null;
10 this._onFormSubmitHandler = Function.createDelegate(this, this._onFormSubmit);
11 this._onFormElementClickHandler = Function.createDelegate(this, this._onFormElementClick);
12 this._onWindowUnloadHandler = Function.createDelegate(this, this._onWindowUnload);
13 Sys.UI.DomEvent.addHandler(this._form, 'submit', this._onFormSubmitHandler);
14 Sys.UI.DomEvent.addHandler(this._form, 'click', this._onFormElementClickHandler);
15 Sys.UI.DomEvent.addHandler(window, 'unload', this._onWindowUnloadHandler);
16 this._originalDoPostBack = window.__doPostBack;
17 if (this._originalDoPostBack) {
18 window.__doPostBack = Function.createDelegate(this, this._doPostBack);
19 }
20 this._originalDoPostBackWithOptions = window.WebForm_DoPostBackWithOptions;
21 if (this._originalDoPostBackWithOptions) {
22 window.WebForm_DoPostBackWithOptions = Function.createDelegate(this, this._doPostBackWithOptions);
23 }
24 this._originalFireDefaultButton = window.WebForm_FireDefaultButton;
25 if (this._originalFireDefaultButton) {
26 window.WebForm_FireDefaultButton = Function.createDelegate(this, this._fireDefaultButton);
27 }
28 this._originalDoCallback = window.WebForm_DoCallback;
29 if (this._originalDoCallback) {
30 window.WebForm_DoCallback = Function.createDelegate(this, this._doCallback);
31 }
32 this._pageLoadedHandler = Function.createDelegate(this, this._pageLoadedInitialLoad);
33 Sys.UI.DomEvent.addHandler(window, 'load', this._pageLoadedHandler);
34 }