PageSourceSearch

http://www.hagaramarlaw.co.il/ScriptResource.axd?d=DT3YJR8QaqV61-t…Iay9XooIJcGQWJdlK4fwKgA2&t=ffffffffda74082d

js hagaramarlaw.co.il collected 2026-10-07 08:44:31 UTC 95,696 bytes, 2,148 lines download raw bytes

1// Name:        MicrosoftAjaxWebForms.debug.js
2// Assembly:    AjaxControlToolkit
3// Version:     4.5.7.1213
4// FileVersion: 4.5.7.1213
5// (c) 2010 CodePlex Foundation
6(function() {
7
8function execute() {
9
10Type._registerScript("MicrosoftAjaxWebForms.js", [
11	"MicrosoftAjaxCore.js",
12	"MicrosoftAjaxSerialization.js",
13	"MicrosoftAjaxNetwork.js",
14	"MicrosoftAjaxComponentModel.js"]);
15var $type, $prototype;
16Type.registerNamespace('Sys.WebForms');
17
18$type = Sys.WebForms.BeginRequestEventArgs = function BeginRequestEventArgs(request, postBackElement, updatePanelsToUpdate) {
19    /// <summary locid="M:J#Sys.WebForms.BeginRequestEventArgs.#ctor">The arguments for the PageRequestManager's beginRequest event. The beginRequest event is raised when a request is about to be made.</summary>
20    /// <param name="request" type="Sys.Net.WebRequest">The web request for the EventArgs.</param>
21    /// <param name="postBackElement" domElement="true" mayBeNull="true">The postback element that initiated the async postback.</param>
22    /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs for UpdatePanel controls that are requested to update their rendering by the client. Server-side processing may update additional UpdatePanels.</param>
23    var e = Function._validateParams(arguments, [
24        {name: "request", type: Sys.Net.WebRequest},
25        {name: "postBackElement", mayBeNull: true, domElement: true},
26        {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String}
27    ]);
28    if (e) throw e;
29    Sys.WebForms.BeginRequestEventArgs.initializeBase(this);
30    this._request = request;
31    this._postBackElement = postBackElement;
32    this._updatePanelsToUpdate = updatePanelsToUpdate;
33}
34
35$type.prototype = {
36    get_postBackElement: function BeginRequestEventArgs$get_postBackElement() {
37        /// <value domElement="true" mayBeNull="true" locid="P:J#Sys.WebForms.BeginRequestEventArgs.postBackElement"></value>
38        if (arguments.length !== 0) throw Error.parameterCount();
39        return this._postBackElement;
40    },
41    get_request: function BeginRequestEventArgs$get_request() {
42        /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.WebForms.BeginRequestEventArgs.request"></value>
43        if (arguments.length !== 0) throw Error.parameterCount();
44        return this._request;
45    },
46    get_updatePanelsToUpdate: function BeginRequestEventArgs$get_updatePanelsToUpdate() {
47        /// <value type="Array" elementType="String" locid="P:J#Sys.WebForms.BeginRequestEventArgs.updatePanelsToUpdate"></value>
48        if (arguments.length !== 0) throw Error.parameterCount();
49        return this._updatePanelsToUpdate ? Array.clone(this._updatePanelsToUpdate) : [];
50    }
51}
52
53$type.registerClass('Sys.WebForms.BeginRequestEventArgs', Sys.EventArgs);
54$type = Sys.WebForms.EndRequestEventArgs = function EndRequestEventArgs(error, dataItems, response) {
55    /// <summary locid="M:J#Sys.WebForms.EndRequestEventArgs.#ctor">The arguments for the PageRequestManager's endRequest event. The endRequest event is raised when a response has finished processing.</summary>
56    /// <param name="error" type="Error" mayBeNull="true"></param>
57    /// <param name="dataItems" type="Object" mayBeNull="true"></param>
58    /// <param name="response" type="Sys.Net.WebRequestExecutor"></param>
59    var e = Function._validateParams(arguments, [
60        {name: "error", type: Error, mayBeNull: true},
61        {name: "dataItems", type: Object, mayBeNull: true},
62        {name: "response", type: Sys.Net.WebRequestExecutor}
63    ]);
64    if (e) throw e;
65
66    Sys.WebForms.EndRequestEventArgs.initializeBase(this);
67    this._errorHandled = false;
68    this._error = error;
69    this._dataItems = dataItems || new Object();
70    this._response = response;
71}
72
73$type.prototype = {
74    get_dataItems: function EndRequestEventArgs$get_dataItems() {
75        /// <value type="Object" locid="P:J#Sys.WebForms.EndRequestEventArgs.dataItems"></value>
76        if (arguments.length !== 0) throw Error.parameterCount();
77        return this._dataItems;
78    },
79
80    get_error: function EndRequestEventArgs$get_error() {
81        /// <value type="Error" locid="P:J#Sys.WebForms.EndRequestEventArgs.error"></value>
82        if (arguments.length !== 0) throw Error.parameterCount();
83        return this._error;
84    },
85
86    get_errorHandled: function EndRequestEventArgs$get_errorHandled() {
87        /// <value type="Boolean" locid="P:J#Sys.WebForms.EndRequestEventArgs.errorHandled"></value>
88        if (arguments.length !== 0) throw Error.parameterCount();
89        return this._errorHandled;
90    },
91    set_errorHandled: function EndRequestEventArgs$set_errorHandled(value) {
92        var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
93        if (e) throw e;
94        this._errorHandled = value;
95    },
96
97    get_response: function EndRequestEventArgs$get_response() {
98        /// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.WebForms.EndRequestEventArgs.response"></value>
99        if (arguments.length !== 0) throw Error.parameterCount();
100        return this._response;
101    }
102}
103
104$type.registerClass('Sys.WebForms.EndRequestEventArgs', Sys.EventArgs);
105$type = Sys.WebForms.InitializeRequestEventArgs = function InitializeRequestEventArgs(request, postBackElement, updatePanelsToUp
105date) {
106    /// <summary locid="M:J#Sys.WebForms.InitializeRequestEventArgs.#ctor">The arguments for the PageRequestManager's initializeRequest event. The initializeRequest event is raised when a request is being prepared and can be cancelled.</summary>
107    /// <param name="request" type="Sys.Net.WebRequest">The web request to be packaged in this EventArgs.</param>
108    /// <param name="postBackElement" domElement="true" mayBeNull="true">The postback element that initiated the async postback.</param>
109    /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs for UpdatePanel controls that are requested to update their rendering by the client. Server-side processing may update additional UpdatePanels.</param>
110    var e = Function._validateParams(arguments, [
111        {name: "request", type: Sys.Net.WebRequest},
112        {name: "postBackElement", mayBeNull: true, domElement: true},
113        {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String}
114    ]);
115    if (e) throw e;
116    Sys.WebForms.InitializeRequestEventArgs.initializeBase(this);
117    this._request = request;
118    this._postBackElement = postBackElement;
119    this._updatePanelsToUpdate = updatePanelsToUpdate;
120}
121
122$type.prototype = {
123    get_postBackElement: function InitializeRequestEventArgs$get_postBackElement() {
124        /// <value domElement="true" mayBeNull="true" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.postBackElement"></value>
125        if (arguments.length !== 0) throw Error.parameterCount();
126        return this._postBackElement;
127    },
128    get_request: function InitializeRequestEventArgs$get_request() {
129        /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.request"></value>
130        if (arguments.length !== 0) throw Error.parameterCount();
131        return this._request;
132    },
133    get_updatePanelsToUpdate: function InitializeRequestEventArgs$get_updatePanelsToUpdate() {
134        /// <value type="Array" elementType="String" locid="P:J#Sys.WebForms.InitializeRequestEventArgs.updatePanelsToUpdate"></value>
135        if (arguments.length !== 0) throw Error.parameterCount();
136        return this._updatePanelsToUpdate ? Array.clone(this._updatePanelsToUpdate) : [];
137    },
138    set_updatePanelsToUpdate: function InitializeRequestEventArgs$set_updatePanelsToUpdate(value) {
139        var e = Function._validateParams(arguments, [{name: "value", type: Array, elementType: String}]);
140        if (e) throw e;
141        this._updated = true;
142        this._updatePanelsToUpdate = value;
143    }
144}
145
146$type.registerClass('Sys.WebForms.InitializeRequestEventArgs', Sys.CancelEventArgs);
147$type = Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems) {
148    /// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary>
149    /// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param>
150    /// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param>
151    /// <param name="dataItems" type="Object" mayBeNull="true"></param>
152    var e = Function._validateParams(arguments, [
153        {name: "panelsUpdated", type: Array},
154        {name: "panelsCreated", type: Array},
155        {name: "dataItems", type: Object, mayBeNull: true}
156    ]);
157    if (e) throw e;
158    Sys.WebForms.PageLoadedEventArgs.initializeBase(this);
159
160    this._panelsUpdated = panelsUpdated;
161    this._panelsCreated = panelsCreated;
162    this._dataItems = dataItems || new Object();
163}
164
165$type.prototype = {
166    get_dataItems: function PageLoadedEventArgs$get_dataItems() {
167        /// <value type="Object" locid="P:J#Sys.WebForms.PageLoadedEventArgs.dataItems"></value>
168        if (arguments.length !== 0) throw Error.parameterCount();
169        return this._dataItems;
170    },
171
172    get_panelsCreated: function PageLoadedEventArgs$get_panelsCreated() {
173        /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadedEventArgs.panelsCreated"></value>
174        if (arguments.length !== 0) throw Error.parameterCount();
175        return this._panelsCreated;
176    },
177
178    get_panelsUpdated: function PageLoadedEventArgs$get_panelsUpdated() {
179        /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadedEventArgs.panelsUpdated"></value>
180        if (arguments.length !== 0) throw Error.parameterCount();
181        return this._panelsUpdated;
182    }
183}
184
185$type.registerClass('Sys.WebForms.PageLoadedEventArgs', Sys.EventArgs);
186$type = Sys.WebForms.PageLoadingEventArgs = function PageLoadingEventArgs(panelsUpdating, panelsDeleting, dataItems) {
187    /// <summary locid="M:J#Sys.WebForms.PageLoadingEventArgs.#ctor">The arguments for the PageRequestManager's pageLoading event. The pageLoading event is raised before the DOM has been updated.</summary>
188    /// <param name="panelsUpdating" type="Array">An array of UpdatePanels that are going to be updated.</param>
189    /// <param name="panelsDeleting" type="Array">An array of UpdatePanels that are going to be deleted.</param>
190    /// <param name="dataItems" type="Object" mayBeNull="true"></param>
191    var e = Function._validateParams(arguments, [
192        {name: "panelsUpdating", type: Array},
193        {name: "panelsDeleting", type: Array},
194        {name: "dataItems", type: Object, mayBeNull: true}
195    ]);
196    if (e) throw e;
197    Sys.WebForms.PageLoadingEventArgs.initializeBase(this);
198
199    this._panelsUpdating = panelsUpdating;
200    this._panelsDeleting = panelsDeleting;
201    this._dataItems = dataItems || new Object();
202}
203
204$type.prototype = {
205    get_dataItems: function PageLoadingEventArgs$get_dataItems() {
206        /// <value type="Object" locid="P:J#Sys.WebForms.PageLoadingEventArgs.dataItems"></value>
207        if (arguments.length !== 0) throw Error.parameterCount();
208        return this._dataItems;
209    },
210
211    get_panelsDeleting: function PageLoadingEventArgs$get_panelsDeleting() {
212        /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadingEventArgs.panelsDeleting"></value>
213        if (arguments.length !== 0) throw Error.parameterCount();
214        return this._panelsDeleting;
215    },
216
217    get_panelsUpdating: function PageLoadingEventArgs$get_panelsUpdating() {
218        /// <value type="Array" locid="P:J#Sys.WebForms.PageLoadingEventArgs.panelsUpdating"></value>
219        if (arguments.length !== 0) throw Error.parameterCount();
220        return this._panelsUpdating;
221    }
222}
223
224$type.registerClass('Sys.WebForms.PageLoadingEventArgs', Sys.EventArgs);
225
226$type = Sys._ScriptLoaderTask = function _ScriptLoaderTask(scriptElement, completedCallback) {
227    /// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor"></summary>
228    /// <param name="scriptElement" domElement="true">The script element to add to the DOM.</param>
229    /// <param name="completedCallback" type="Function">Callback to call when the script has loaded or failed to load.</param>
230    var e = Function._validateParams(arguments, [
231        { name: "scriptElement", domElement: true },
232        { name: "completedCallback", type: Function }
233    ]);
234    if (e) throw e;
235    this._scriptElement = scriptElement;
236    this._completedCallback = completedCallback;
237}
238$type.prototype = {
239    get_scriptElement: function _ScriptLoaderTask$get_scriptElement() {
240        /// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement">The script element.</value>
241        if (arguments.length !== 0) throw Error.parameterCount();
242        return this._scriptElement;
243    },
244
245    dispose: function _ScriptLoaderTask$dispose() {
246        if (this._disposed) {
247            return;
248        }
249        this._disposed = true;
250        this._removeScriptElementHandlers();
251        Sys._ScriptLoaderTask._clearScript(this._scriptElement);
252        this._scriptElement = null;
253    },
254
255    execute: function _ScriptLoaderTask$execute() {
256        /// <summary locid="M:J#Sys._ScriptLoaderTask.execute">
256Begins loading the given script element.</summary>
257        if (arguments.length !== 0) throw Error.parameterCount();
258        this._addScriptElementHandlers();
259        var headElements = document.getElementsByTagName('head');
260        if (headElements.length === 0) {
261            throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
262        }
263        else {
264            headElements[0].appendChild(this._scriptElement);
265        }
266    },
267
268    _addScriptElementHandlers: function _ScriptLoaderTask$_addScriptElementHandlers() {
269        this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler);
270
271        if (document.addEventListener) {
272            if (!this._scriptElement.readyState)
273                this._scriptElement.readyState = 'loaded';
274            $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate);
275        }
276        else {
277            $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate);
278        }
279        if (this._scriptElement.addEventListener) {
280            this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler);
281            this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false);
282        }
283    },
284
285    _removeScriptElementHandlers: function _ScriptLoaderTask$_removeScriptElementHandlers() {
286        if (this._scriptLoadDelegate) {
287            var scriptElement = this.get_scriptElement();
288            if (document.addEventListener) {
289                $removeHandler(scriptElement, 'load', this._scriptLoadDelegate);
290            }
291            else {
292                $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate);
293            }
294            if (this._scriptErrorDelegate) {
295                this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false);
296                this._scriptErrorDelegate = null;
297            }
298            this._scriptLoadDelegate = null;
299        }
300    },
301
302    _scriptErrorHandler: function _ScriptLoaderTask$_scriptErrorHandler() {
303        if (this._disposed) {
304            return;
305        }
306
307        this._completedCallback(this.get_scriptElement(), false);
308    },
309
310    _scriptLoadHandler: function _ScriptLoaderTask$_scriptLoadHandler() {
311        if (this._disposed) {
312            return;
313        }
314
315        var scriptElement = this.get_scriptElement();
316        if ((scriptElement.readyState !== 'loaded') &&
317            (scriptElement.readyState !== 'complete')) {
318            return;
319        }
320
321        this._completedCallback(scriptElement, true);
322    }
323}
324$type.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable);
325
326$type._clearScript = function _ScriptLoaderTask$_clearScript(scriptElement) {
327    if (!Sys.Debug.isDebug) {
328        scriptElement.parentNode.removeChild(scriptElement);
329    }
330}
331
332$type = Sys._ScriptLoader = function _ScriptLoader() {
333    this._scriptsToLoad = null;
334    this._sessions = [];
335    this._scriptLoadedDelegate = Function.createDelegate(this, this._scriptLoadedHandler);
336}
337$type.prototype = {
338    dispose: function _ScriptLoader$dispose() {
339        this._stopSession();
340        this._loading = false;
341        if(this._events) {
342            delete this._events;
343        }
344        this._sessions = null;
345        this._currentSession = null;
346        this._scriptLoadedDelegate = null;        
347    },
348    
349    loadScripts: function _ScriptLoader$loadScripts(scriptTimeout, allScriptsLoadedCallback, scriptLoadFailedCallback, scriptLoadTimeoutCallback) {
350        /// <summary locid="M:J#Sys._ScriptLoader.loadScripts">Begins loading scripts that have been queued.</summary>
351        /// <param name="scriptTimeout" type="Number" integer="true">Timeout in seconds for loading all scripts.</param>
352        /// <param name="allScriptsLoadedCallback" type="Function" mayBeNull="true">Callback for notification when all scripts have successfully loaded.</param>
353        /// <param name="scriptLoadFailedCallback" type="Function" mayBeNull="true">Callback for notification when a script fails to load.</param>
354        /// <param name="scriptLoadTimeoutCallback" type="Function" mayBeNull="true">Callback for notification when scripts have not finished loading within the given timeout.</param>
355        var e = Function._validateParams(arguments, [
356            {name: "scriptTimeout", type: Number, integer: true},
357            {name: "allScriptsLoadedCallback", type: Function, mayBeNull: true},
358            {name: "scriptLoadFailedCallback", type: Function, mayBeNull: true},
359            {name: "scriptLoadTimeoutCallback", type: Function, mayBeNull: true}
360        ]);
361        if (e) throw e;
362        var session = {
363            allScriptsLoadedCallback: allScriptsLoadedCallback,
364            scriptLoadFailedCallback: scriptLoadFailedCallback,
365            scriptLoadTimeoutCallback: scriptLoadTimeoutCallback,
366            scriptsToLoad: this._scriptsToLoad,
367            scriptTimeout: scriptTimeout };
368        this._scriptsToLoad = null;
369        this._sessions.push(session);
370        
371        if (!this._loading) {
372            this._nextSession();
373        }
374    },
375    
376    queueCustomScriptTag: function _ScriptLoader$queueCustomScriptTag(scriptAttributes) {
377        /// <summary locid="M:J#Sys._ScriptLoader.queueCustomScriptTag">Queues a script reference with the given set of custom script element attributes.</summary>
378        /// <param name="scriptAttributes" mayBeNull="false">A JSON object that describtes the attributes to apply to the script element.</param>
379        var e = Function._validateParams(arguments, [
380            {name: "scriptAttributes"}
381        ]);
382        if (e) throw e;
383        if(!this._scriptsToLoad) {
384            this._scriptsToLoad = [];
385        }
386        Array.add(this._scriptsToLoad, scriptAttributes);
387    },
388
389    queueScriptBlock: function _ScriptLoader$queueScriptBlock(scriptContent) {
390        /// <summary locid="M:J#Sys._ScriptLoader.queueScriptBlock">Queues a script reference with literal script.</summary>
391        /// <param name="scriptContent" type="String" mayBeNull="false">Literal script to execute.</param>
392        var e = Function._validateParams(arguments, [
393            {name: "scriptContent", type: String}
394        ]);
395        if (e) throw e;
396        if(!this._scriptsToLoad) {
397            this._scriptsToLoad = [];
398        }
399        Array.add(this._scriptsToLoad, {text: scriptContent});
400    },
401
402    queueScriptReference: function _ScriptLoader$queueScriptReference(scriptUrl) {
403        /// <summary locid="M:J#Sys._ScriptLoader.queueScriptReference">Queues a script reference to the given script URL.</summary>
404        /// <param name="scriptUrl" type="String" mayBeNull="false">URL to the script to reference.</param>
405        var e = Function._validateParams(arguments, [
406            {name: "scriptUrl", type: String}
407        ]);
408        if (e) throw e;
409        if(!this._scriptsToLoad) {
410            this._scriptsToLoad = [];
411        }
412        Array.add(this._scriptsToLoad, {src: scriptUrl});
413    },
414    
415    _createScriptElement: function _ScriptLoader$_createScriptElement(queuedScript) {
416        var scriptElement = document.createElement('script');
417
418        scriptElement.type = 'text/javascript';
419
420        for (var attr in queuedScript) {
421            scriptElement[attr] = queuedScript[attr];
422        }
423        
424        return scriptElement;
425    },
426    
427    _loadScriptsInternal: function _ScriptLoader$_loadScriptsInternal() {
428        var session = this._currentSession;
429        if (session.scriptsToLoad && session.scriptsToLoad.length > 0) {
430            var nextScript = Array.dequeue(session.scriptsToLoad);
431            var scriptElement = this._createScriptElement(nextScript);
432            
433            if (scriptElement.text && Sys.Browser.agent === Sys.Browser.Safari) {
434                scriptElement.innerHTML = scriptElement.text;
435                delete scriptElement.text;
436            }            
437
438            if (typeof(nextScript.src) === "string") {
439                this._currentTask = new Sys._ScriptLoaderTask(scriptElement, this._scriptLoadedDelegate);
440                this._currentTask.execute();
441            }
442            else {
443                var headElements = document.getElementsByTagName('head');
444                if (headElements.length === 0) {
445                     throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
446                }
447                else {
448                     headElements[0].appendChild(scriptElement);
449                }
450                
451                
452                Sys._ScriptLoaderTask._clearScript(scriptElement);
453                this._loadScriptsInternal();
454            }
455        }
456        else {
457            this._stopSession();
458            var callback = session.allScriptsLoadedCallback;
459            if(callback) {
460                callback(this);
461            }
462            this._nextSession();
463        }
464    },
465
466    _nextSession: function _ScriptLoader$_nextSession() {
467        if (this._sessions.length === 0) {
468            this._loading = false;
469            this._currentSession = null;
470            return;
471        }
472        this._loading = true;
473        
474        var session = Array.dequeue(this._sessions);
475        this._currentSession = session;
476        this._loadScriptsInternal();
477    },
478
479    _raiseError: function _ScriptLoader$_raiseError() {
480        var callback = this._currentSession.scriptLoadFailedCallback;
481        var scriptElement = this._currentTask.get_scriptElement();
482        this._stopSession();
483        
484        if(callback) {
485            callback(this, scriptElement);
486            this._nextSession();
487        }
488        else {
489            this._loading = false;
490            throw Sys._ScriptLoader._errorScriptLoadFailed(scriptElement.src);
491        }
492    },
493    
494    _scriptLoadedHandler: function _ScriptLoader$_scriptLoadedHandler(scriptElement, loaded) {
495        if (loaded) {
496            Array.add(Sys._ScriptLoader._getLoadedScripts(), scriptElement.src);
497            this._currentTask.dispose();
498            this._currentTask = null;
499            this._loadScriptsInternal();
500        }
501        else {
502            this._raiseError();
503        }
504    },
505    _stopSession: function _ScriptLoader$_stopSession() {
506        if(this._currentTask) {
507            this._currentTask.dispose();
508            this._currentTask = null;
509        }
510    }    
511}
512$type.registerClass('Sys._ScriptLoader', null, Sys.IDisposable);
513
514$type.getInstance = function _ScriptLoader$getInstance() {
515    var sl = Sys._ScriptLoader._activeInstance;
516    if(!sl) {
517        sl = Sys._ScriptLoader._activeInstance = new Sys._ScriptLoader();
518    }
519    return sl;
520}
521
522$type.isScriptLoaded = function _ScriptLoader$isScriptLoaded(scriptSrc) {
523    var dummyScript = document.createElement('script');
524    dummyScript.src = scriptSrc;
525    return Array.contains(Sys._ScriptLoader._getLoadedScripts(), dummyScript.src);
526}
527
528$type.readLoadedScripts = function _ScriptLoader$readLoadedScripts() {
529    if(!Sys._ScriptLoader._referencedScripts) {
530        var referencedScripts = Sys._ScriptLoader._referencedScripts = [];
531
532        var existingScripts = document.getElementsByTagName('script');
533        for (var i = existingScripts.length - 1; i >= 0; i--) {
534            var scriptNode = existingScripts[i];
535            var scriptSrc = scriptNode.src;
536            if (scriptSrc.length) {
537                if (!Array.contains(referencedScripts, scriptSrc)) {
538                    Array.add(referencedScripts, scriptSrc);
539                }
540            }
541        }
542    }
543}
544
545$type._errorScriptLoadFailed = function _ScriptLoader$_errorScriptLoadFailed(scriptUrl) {
546    var errorMessage;
547    errorMessage = Sys.Res.scriptLoadFailedDebug;
548
549    var displayMessage = "Sys.ScriptLoadFailedException: " + String.format(errorMessage, scriptUrl);
550    var e = Error.create(displayMessage, {name: 'Sys.ScriptLoadFailedException', 'scriptUrl': scriptUrl });
551    e.popStackFrame();
552    return e;
553}
554
555$type._getLoadedScripts = function _ScriptLoader$_getLoadedScripts() {
556    if(!Sys._ScriptLoader._referencedScripts) {
557        Sys._ScriptLoader._referencedScripts = [];
558        Sys._ScriptLoader.readLoadedScripts();
559    }
560    return Sys._ScriptLoader._referencedScripts;
561}
562$type = Sys.WebForms.PageRequestManager = function PageRequestManager() {
563    this._form = null;
564    this._activeDefaultButton = null;
565    this._activeDefaultButtonClicked = false;
566    this._updatePanelIDs = null;
567    this._updatePanelClientIDs = null;
568    this._updatePanelHasChildrenAsTriggers = null;
569    this._asyncPostBackControlIDs = null;
570    this._asyncPostBackControlClientIDs = null;
571    this._postBackControlIDs = null;
572    this._postBackControlClientIDs = null;
573    this._scriptManagerID = null;
574    this._pageLoadedHandler = null;
575
576    this._additionalInput = null;
577    this._onsubmit = null;
578    this._onSubmitStatements = [];
579    this._originalDoPostBack = null;
580    this._originalDoPostBackWithOptions = null;
581    this._originalFireDefaultButton = null;
582    this._originalDoCallback = null;
583    this._isCrossPost = false;
584    this._postBackSettings = null;
585    this._request = null;
586    this._onFormSubmitHandler = null;
587    this._onFormElementClickHandler = null;
588    this._onWindowUnloadHandler = null;
589    this._asyncPostBackTimeout = null;
590
591    this._controlIDToFocus = null;
592    this._scrollPosition = null;
593    this._processingRequest = false;
594    this._scriptDisposes = {};
595    
596    this._transientFields = ["__VIEWSTATEENCRYPTED", "__VIEWSTATEFIELDCOUNT"];
597    this._textTypes = /^(text|password|hidden|search|tel|url|email|number|range|c
597olor|datetime|date|month|week|time|datetime-local)$/i;
598}
599
600$type.prototype = {
601    get_isInAsyncPostBack: function PageRequestManager$get_isInAsyncPostBack() {
602        /// <value type="Boolean" locid="P:J#Sys.WebForms.PageRequestManager.isInAsyncPostBack"></value>
603        if (arguments.length !== 0) throw Error.parameterCount();
604        return this._request !== null;
605    },
606
607    add_beginRequest: function PageRequestManager$add_beginRequest(handler) {
608        /// <summary locid="E:J#Sys.WebForms.PageRequestManager.beginRequest">Adds a beginRequest event handler.</summary>
609        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
610        if (e) throw e;
611        Sys.Observer.addEventHandler(this, "beginRequest", handler);
612    },
613    remove_beginRequest: function PageRequestManager$remove_beginRequest(handler) {
614        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
615        if (e) throw e;
616        Sys.Observer.removeEventHandler(this, "beginRequest", handler);
617    },
618
619    add_endRequest: function PageRequestManager$add_endRequest(handler) {
620        /// <summary locid="E:J#Sys.WebForms.PageRequestManager.endRequest">Adds a endRequest event handler.</summary>
621        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
622        if (e) throw e;
623        Sys.Observer.addEventHandler(this, "endRequest", handler);
624    },
625    remove_endRequest: function PageRequestManager$remove_endRequest(handler) {
626        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
627        if (e) throw e;
628        Sys.Observer.removeEventHandler(this, "endRequest", handler);
629    },
630
631    add_initializeRequest: function PageRequestManager$add_initializeRequest(handler) {
632        /// <summary locid="E:J#Sys.WebForms.PageRequestManager.initializeRequest">Adds a initializeRequest event handler.</summary>
633        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
634        if (e) throw e;
635        Sys.Observer.addEventHandler(this, "initializeRequest", handler);
636    },
637    remove_initializeRequest: function PageRequestManager$remove_initializeRequest(handler) {
638        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
639        if (e) throw e;
640        Sys.Observer.removeEventHandler(this, "initializeRequest", handler);
641    },
642
643    add_pageLoaded: function PageRequestManager$add_pageLoaded(handler) {
644        /// <summary locid="E:J#Sys.WebForms.PageRequestManager.pageLoaded">Adds a pageLoaded event handler.</summary>
645        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
646        if (e) throw e;
647        Sys.Observer.addEventHandler(this, "pageLoaded", handler);
648    },
649    remove_pageLoaded: function PageRequestManager$remove_pageLoaded(handler) {
650        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
651        if (e) throw e;
652        Sys.Observer.removeEventHandler(this, "pageLoaded", handler);
653    },
654
655    add_pageLoading: function PageRequestManager$add_pageLoading(handler) {
656        /// <summary locid="E:J#Sys.WebForms.PageRequestManager.pageLoading">Adds a pageLoading event handler.</summary>
657        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
658        if (e) throw e;
659        Sys.Observer.addEventHandler(this, "pageLoading", handler);
660    },
661    remove_pageLoading: function PageRequestManager$remove_pageLoading(handler) {
662        var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
663        if (e) throw e;
664        Sys.Observer.removeEventHandler(this, "pageLoading", handler);
665    },
666
667    abortPostBack: function PageRequestManager$abortPostBack() {
668        if (!this._processingRequest && this._request) {
669            this._request.get_executor().abort();
670            this._request = null;
671        }
672    },
673
674    beginAsyncPostBack: function PageRequestManager$beginAsyncPostBack(updatePanelsToUp
674date, eventTarget, eventArgument, causesValidation, validationGroup) {
675        /// <summary locid="M:J#Sys.WebForms.PageRequestManager.beginAsyncPostBack">Begins an asynchronous postback.</summary>
676        /// <param name="updatePanelsToUpdate" type="Array" elementType="String" mayBeNull="true" optional="true">A list of UniqueIDs or ClientIDs of UpdatePanel controls that should have their rendering updated.</param>
677        /// <param name="eventTarget" type="String" mayBeNull="true" optional="true"></param>
678        /// <param name="eventArgument" type="String" mayBeNull="true" optional="true"></param>
679        /// <param name="causesValidation" type="Boolean" mayBeNull="true" optional="true"></param>
680        /// <param name="validationGroup" type="String" mayBeNull="true" optional="true"></param>
681        var e = Function._validateParams(arguments, [
682            {name: "updatePanelsToUpdate", type: Array, mayBeNull: true, optional: true, elementType: String},
683            {name: "eventTarget", type: String, mayBeNull: true, optional: true},
684            {name: "eventArgument", type: String, mayBeNull: true, optional: true},
685            {name: "causesValidation", type: Boolean, mayBeNull: true, optional: true},
686            {name: "validationGroup", type: String, mayBeNull: true, optional: true}
687        ]);
688        if (e) throw e;
689        if (causesValidation && (typeof(Page_ClientValidate) === 'function') && !Page_ClientValidate(validationGroup || null)) {
690            return;
691        }
692        this._postBackSettings = this._createPostBackSettings(true, updatePanelsToUpdate, eventTarget);
693        var form = this._form;
694        form.__EVENTTARGET.value = (eventTarget || "");
695        form.__EVENTARGUMENT.value = (eventArgument || "");
696        this._isCrossPost = false;
697        this._additionalInput = null;
698        this._onFormSubmit();
699    },
700    
701    _cancelPendingCallbacks: function PageRequestManager$_cancelPendingCallbacks() {
702        for (var i = 0, l = window.__pendingCallbacks.length; i < l; i++) {
703            var callback = window.__pendingCallbacks[i];
704            if (callback) {
705                if (!callback.async) {
706                    window.__synchronousCallBackIndex = -1;
707                }
708                window.__pendingCallbacks[i] = null;
709                var callbackFrameID = "__CALLBACKFRAME" + i;
710                var xmlRequestFrame = document.getElementById(callbackFrameID);
711                if (xmlRequestFrame) {
712                    xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
713                }
714            }
715        }
716    },
717    
718    _commitControls: function PageRequestManager$_commitControls(updatePanelData, asyncPostBackTimeout) {
719        if (updatePanelData) {
720            this._updatePanelIDs = updatePanelData.updatePanelIDs;
721            this._updatePanelClientIDs = updatePanelData.updatePanelClientIDs;
722            this._updatePanelHasChildrenAsTriggers = updatePanelData.updatePanelHasChildrenAsTriggers;
723            this._asyncPostBackControlIDs = updatePanelData.asyncPostBackControlIDs;
724            this._asyncPostBackControlClientIDs = updatePanelData.asyncPostBackControlClientIDs;
725            this._postBackControlIDs = updatePanelData.postBackControlIDs;
726            this._postBackControlClientIDs = updatePanelData.postBackControlClientIDs;
727        }
728        if (typeof(asyncPostBackTimeout) !== 'undefined' && asyncPostBackTimeout !== null) {
729            this._asyncPostBackTimeout = asyncPostBackTimeout * 1000;
730        }
731    },
732    
733    _createHiddenField: function PageRequestManager$_createHiddenField(id, value) {
734        var container, field = document.getElementById(id);
735
736        if (field) {
737            if (!field._isContained) {
738                field.parentNode.removeChild(field);
739            }
740            else {
741                container = field.parentNode;
742            }
743        }
744        if (!container) {
745            container = document.createElement('span');
746            container.style.cssText = "display:none !important";
747            this._form.appendChild(container);
748        }
749        container.innerHTML = "<input type='hidden' />";
750        field = container.childNodes[0];
751        field._isContained = true;
752        field.id = field.name = id;
753        field.value = value;
754    },
755
756    _createPageRequestManagerTimeoutError: function PageRequestManager$_createPageRequestManagerTimeoutError() {
757        var displayMessage = "Sys.WebForms.PageRequestManagerTimeoutException: " + Sys.WebForms.Res.PRM_TimeoutError;
758        var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerTimeoutException'});
759        e.popStackFrame();
760        return e;
761    },
762
763    _createPageRequestManagerServerError: function PageRequestManager$_createPageRequestManagerServerError(httpStatusCode, message) {
764        var displayMessage = "Sys.WebForms.PageRequestManagerServerErrorException: " +
765            (message || String.format(Sys.WebForms.Res.PRM_ServerError, httpStatusCode));
766        var e = Error.create(displayMessage, {
767            name: 'Sys.WebForms.PageRequestManagerServerErrorException',
768            httpStatusCode: httpStatusCode
769        });
770        e.popStackFrame();
771        return e;
772    },
773
774    _createPageRequestManagerParserError: function PageRequestManager$_createPageRequestManagerParserError(parserErrorMessage) {
775        var displayMessage = "Sys.WebForms.PageRequestManagerParserErrorException: " + String.format(Sys.WebForms.Res.PRM_ParserError, parserErrorMessage);
776        var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerParserErrorException'});
777        e.popStackFrame();
778        return e;
779    },
780
781    _createPanelID: function PageRequestManager$_createPanelID(panelsToUpdate, postBackSettings) {
782        var asyncTarget = postBackSettings.asyncTarget,
783            toUpdate = this._ensureUniqueIds(panelsToUpdate || postBackSettings.panelsToUpdate),
784            panelArg = (toUpdate instanceof Array)
785                ? toUpdate.join(',')
786                : (toUpdate || this._scriptManagerID);
787        if (asyncTarget) {
788            panelArg += "|" + asyncTarget;
789        }
790        return encodeURIComponent(this._scriptManagerID) + '=' + encodeURIComponent(panelArg) + '&';
791    },
792
793    _createPostBackSettings: function PageRequestManager$_createPostBackSettings(async, panelsToUpdate, asyncTarget, sourceElement) {
794        return { async:async, asyncTarget: asyncTarget, panelsToUpdate: panelsToUpdate, sourceElement: sourceElement };
795    },
796
797    _convertToClientIDs: function PageRequestManager$_convertToClientIDs(source, destinationIDs, destinationClientIDs, version4) {
798        if (source) {
799            for (var i = 0, l = source.length; i < l; i += (version4 ? 2 : 1)) {
800                var uniqueID = source[i],
801                    clientID = (version4 ? source[i+1] : "") || this._uniqueIDToClientID(uniqueID);
802                Array.add(destinationIDs, uniqueID);
803                Array.add(destinationClientIDs, clientID);
804            }
805        }
806    },
807
808    dispose: function PageRequestManager$dispose() {
809        Sys.Observer.clearEventHandlers(this);
810        if (this._form) {
811            Sys.UI.DomEvent.removeHandler(this._form, 'submit', this._onFormSubmitHandler);
812            Sys.UI.DomEvent.removeHandler(this._form, 'click', this._onFormElementClickHandler);
813            Sys.UI.DomEvent.removeHandler(window, 'unload', this._onWindowUnloadHandler);
814            Sys.UI.DomEvent.removeHandler(window, 'load', this._pageLoadedHandler);
815        }
816
817        if (this._originalDoPostBack) {
818            window.__doPostBack = this._originalDoPostBack;
819            this._originalDoPostBack = null;
820        }
821        if (this._originalDoPostBackWithOptions) {
822            window.WebForm_DoPostBackWithOptions = this._originalDoPostBackWithOptions;
823            this._originalDoPostBackWithOptions = null;
824        }
825        if (this._originalFireDefaultButton) {
826            window.WebForm_FireDefaultButton = this._originalFireDefaultButton;
827            this._originalFireDefaultButton = null;
828        }
829        if (this._originalDoCallback) {
830            window.WebForm_DoCallback = this._originalDoCallback;
831            this._originalDoCallback = null;
832        }
833
834        this._form = null;
835        this._updatePanelIDs = null;
836        this._updatePanelClientIDs = null;
837        this._asyncPostBackControlIDs = null;
838        this._asyncPostBackControlClientIDs = null;
839        this._postBackControlIDs = null;
840        this._postBackControlClientIDs = null;
841        this._asyncPostBackTimeout = null;
842        this._scrollPosition = null;
843    },
844    
845    _doCallback: function PageRequestManager$_doCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
846        if (!this.get_isInAsyncPostBack()) {
847            this._originalDoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync);
848        }
849    },
850
851    _doPostBack: function PageRequestManager$_doPostBack(eventTarget, eventArgument) {
852        this._additionalInput = null;
853
854        var form = this._form;
855        if ((eventTarget === null) || (typeof(eventTarget) === "undefined") || (this._isCrossPost)) {
856            this._postBackSettings = this._createPostBackSettings(false);
857            this._isCrossPost = false;
858        }
859        else {
860            var mpUniqueID = this._masterPageUniqueID;
861            var clientID = this._uniqueIDToClientID(eventTarget);
862            var postBackElement = document.getElementById(clientID);
863            if (!postBackElement && mpUniqueID) {
864                if (clientID.indexOf(mpUniqueID + "$") === 0) {
865                    postBackElement = document.getElementById(clientID.substr(mpUniqueID.length + 1));
866                }
867            }
868            if (!postBackElement) {
869                if (Array.contains(this._asyncPostBackControlIDs, eventTarget)) {
870                    this._postBackSettings = this._createPostBackSettings(true, null, eventTarget);
871                }
872                else {
873                    if (Array.contains(this._postBackControlIDs, eventTarget)) {
874                        this._postBackSettings = this._createPostBackSettings(false);
875                    }
876                    else {
877                        var nearestUniqueIDMatch = this._findNearestElement(eventTarget);
878                        if (nearestUniqueIDMatch) {
879                            this._postBackSettings = this._getPostBackSettings(nearestUniqueIDMatch, eventTarget);
880                        }
881                        else {
882                            if (mpUniqueID) {
883                                mpUniqueID += "$";
884                                if (eventTarget.indexOf(mpUniqueID) === 0) {
885                                    nearestUniqueIDMatch = this._findNearestElement(eventTarget.substr(mpUniqueID.length));
886                                }
887                            }
888                            if (nearestUniqueIDMatch) {
889                                this._postBackSettings = this._getPostBackSettings(nearestUniqueIDMatch, eventTarget);
890                            }
891                            else {
892                                this._postBackSettings = this._createPostBackSettings(false);
893                            }
894                        }
895                    }
896                }
897            }
898            else {
899                this._postBackSettings = this._getPostBackSettings(postBackElement, eventTarget);
900            }
901        }
902
903        if (!this._postBackSettings.async) {
904            form.onsubmit = this._onsubmit;
905            this._originalDoPostBack(eventTarget, eventArgument);
906            form.onsubmit = null;
907            return;
908        }
909
910        form.__EVENTTARGET.value = eventTarget;
911        form.__EVENTARGUMENT.value = eventArgument;
912        this._onFormSubmit();
913    },
914
915    _doPostBackWithOptions: function PageRequestManager$_doPostBackWithOptions(options) {
916        this._isCrossPost = options && options.actionUrl;
917        this._originalDoPostBackWithOptions(options);
918    },
919
920    _elementContains: function PageRequestManager$_elementContains(container, element) {
921        while (element) {
922            if (element === container) {
923                return true;
924            }
925            element = element.parentNode;
926        }
927        return false;
928    },
929
930    _endPostBack: function PageRequestManager$_endPostBack(error, executor, data) {
931        if (this._request === executor.get_webRequest()) {
932            this._processingRequest = false;
933            this._additionalInput = null;
934            this._request = null;
935        }
936
937        var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
938        Sys.Observer.raiseEvent(this, "endRequest", eventArgs);
939        if (error && !eventArgs.get_errorHandled()) {
940            throw error;
941        }
942    },
943
944    _ensureUniqueIds: function PageRequestManager$_ensureUniqueIds(ids) {
945        if (!ids) return ids;
946        ids = ids instanceof Array ? ids : [ids];
947        var uniqueIds = [];
948        for (var i = 0, l = ids.length; i < l; i++) {
949            var id = ids[i], index = Array.indexOf(this._updatePanelClientIDs, id);
950            uniqueIds.push(index > -1 ? this._updatePanelIDs[index] : id);
951        }
952        return uniqueIds;
953    },
954
955    _findNearestElement: function PageRequestManager$_findNearestElement(uniqueID) {
956        while (uniqueID.length > 0) {
957            var clientID = this._uniqueIDToClientID(uniqueID);
958            var element = document.getElementById(clientID);
959            if (element) {
960                return element;
961            }
962            var indexOfLastDollar = uniqueID.lastIndexOf('$');
963            if (indexOfLastDollar === -1) {
964                return null;
965            }
966            uniqueID = uniqueID.substring(0, indexOfLastDollar);
967        }
968        return null;
969    },
970
971    _findText: function PageRequestManager$_findText(text, location) {
972        var startIndex = Math.max(0, location - 20);
973        var endIndex = Math.min(text.length, location + 20);
974        return text.substring(startIndex, endIndex);
975    },
976    
977    _fireDefaultButton: function PageRequestManager$_fireDefaultButton(event, target) {
978        if (event.keyCode === 13) {
979            var src = event.srcElement || event.target;
980            if (!src || (src.tagName.toLowerCase() !== "textarea")) {
981                var defaultButton = document.getElementById(target);
982
983                if (defaultButton && (typeof(defaultButton.click) !== "undefined")) {
984                    
985                    
986                    this._activeDefaultButton = defaultButton;
987                    this._activeDefaultButtonClicked = false;
988                    try {
989                        defaultButton.click();
990                    }
991                    finally {
992                        this._activeDefaultButton = null;
993                    }
994                    
995                    
996                    event.cancelBubble = true;
997                    if (typeof(event.stopPropagation) === "function") {
998                        event.stopPropagation();
999                    }
1000                    return false;
1001                }
1002            }
1003        }
1004        return true;
1005    },
1006
1007    _getPageLoadedEventArgs: function PageRequestManager$_getPageLoadedEventArgs(initialLoad, data) {
1008
1009        var updated = [];
1010        var created = [];
1011        var version4 = data ? data.version4 : false;
1012        var upData = data ? data.updatePanelData : null;
1013
1014        var newIDs, newClientIDs, childIDs, refreshedIDs;
1015
1016        if (!upData) {
1017            newIDs = this._updatePanelIDs;
1018            newClientIDs = this._updatePanelClientIDs;
1019            childIDs = null;
1020            refreshedIDs = null;
1021        }
1022        else {
1023            newIDs = upData.updatePanelIDs;
1024            newClientIDs = upData.updatePanelClientIDs;
1025            childIDs = upData.childUpdatePanelIDs;
1026            refreshedIDs = upData.panelsToRefreshIDs;
1027        }
1028
1029        var i, l, uniqueID, clientID;
1030        if (refreshedIDs) {
1031            for (i = 0, l = refreshedIDs.length; i < l; i += (version4 ? 2 : 1)) {
1032                uniqueID = refreshedIDs[i];
1033                clientID = (version4 ? refreshedIDs[i+1] : "") || this._uniqueIDToClientID(uniqueID);
1034                Array.add(updated, document.getElementById(clientID));
1035            }
1036        }
1037
1038        for (i = 0, l = newIDs.length; i < l; i++) {
1039            if (initialLoad || Array.indexOf(childIDs, newIDs[i]) !== -1) {
1040                Array.add(created, document.getElementById(newClientIDs[i]));
1041            }
1042        }
1043
1044        return new Sys.WebForms.PageLoadedEventArgs(updated, created, data ? data.dataItems : {});
1045    },
1046
1047    _getPageLoadingEventArgs: function PageRequestManager$_getPageLoadingEventArgs(data) {
1048
1049        var updated = [],
1050            deleted = [],
1051            upData = data.updatePanelData,
1052            oldIDs = upData.oldUpdatePanelIDs,
1053            oldClientIDs = upData.oldUpdatePanelClientIDs,
1054            newIDs = upData.updatePanelIDs,
1055            childIDs = upData.childUpdatePanelIDs,
1056            refreshedIDs = upData.panelsToRefreshIDs,
1057            i, l, uniqueID, clientID,
1058            version4 = data.version4;
1059        for (i = 0, l = refreshedIDs.length; i < l; i += (version4 ? 2 : 1)) {
1060            uniqueID = refreshedIDs[i];
1061            clientID = (version4 ? refreshedIDs[i+1] : "") || this._uniqueIDToClientID(uniqueID);
1062            Array.add(updated, document.getElementById(clientID));
1063        }
1064
1065        for (i = 0, l = oldIDs.length; i < l; i++) {
1066            uniqueID = oldIDs[i];
1067            if (Array.indexOf(refreshedIDs, uniqueID) === -1 &&
1068                (Array.indexOf(newIDs, uniqueID) === -1 || Array.indexOf(childIDs, uniqueID) > -1)) {
1069                Array.add(deleted, document.getElementById(oldClientIDs[i]));
1070            }
1071        }
1072
1073        return new Sys.WebForms.PageLoadingEventArgs(updated, deleted, data.dataItems);
1074    },
1075
1076    _getPostBackSettings: function PageRequestManager$_getPostBackSettings(element, elementUniqueID) {
1077
1078        var originalElement = element;
1079
1080        var proposedSettings = null;
1081
1082        while (element) {
1083            if (element.id) {
1084                if (!proposedSettings && Array.contains(this._asyncPostBackControlClientIDs, element.id)) {
1085                    proposedSettings = this._createPostBackSettings(true, null, elementUniqueID, originalElement);
1086                }
1087                else {
1088                    if (!proposedSettings && Array.contains(this._postBackControlClientIDs, element.id)) {
1089                        return this._createPostBackSettings(false);
1090                    }
1091                    else {
1092                        var indexOfPanel = Array.indexOf(this._updatePanelClientIDs, element.id);
1093                        if (indexOfPanel !== -1) {
1094                            if (this._updatePanelHasChildrenAsTriggers[indexOfPanel]) {
1095
1096                                return this._createPostBackSettings(true, [this._updatePanelIDs[indexOfPanel]], elementUniqueID, originalElement);
1097                            }
1098                            else {
1099                                return this._createPostBackSettings(true, null, elementUniqueID, originalElement);
1100                            }
1101                        }
1102                    }
1103                }
1104
1105                if (!proposedSettings && this._matchesParentIDInList(element.id, this._asyncPostBackControlClientIDs)) {
1106                    proposedSettings = this._createPostBackSettings(true, null, elementUniqueID, originalElement);
1107                }
1108                else {
1109                    if (!proposedSettings && this._matchesParentIDInList(element.id, this._postBackControlClientIDs)) {
1110                        return this._createPostBackSettings(false);
1111                    }
1112                }
1113            }
1114
1115            element = element.parentNode;
1116        }
1117
1118        if (!proposedSettings) {
1119            return this._createPostBackSettings(false);
1120        }
1121        else {
1122            return proposedSettings;
1123        }
1124    },
1125
1126    _getScrollPosition: function PageRequestManager$_getScrollPosition() {
1127        var d = document.documentElement;
1128        if (d && (this._validPosition(d.scrollLeft) || this._validPosition(d.scrollTop))) {
1129            return {
1130                x: d.scrollLeft,
1131                y: d.scrollTop
1132            };
1133        }
1134        else {
1135            d = document.body;
1136            if (d && (this._validPosition(d.scrollLeft) || this._validPosition(d.scrollTop))) {
1137                return {
1138                    x: d.scrollLeft,
1139                    y: d.scrollTop
1140                };
1141            }
1142            else {
1143                if (this._validPosition(window.pageXOffset) || this._validPosition(window.pageYOffset)) {
1144                    return {
1145                        x: window.pageXOffset,
1146                        y: window.pageYOffset
1147                    };
1148                }
1149                else {
1150                    return {
1151                        x: 0,
1152                        y: 0
1153                    };
1154                }
1155            }
1156        }
1157    },
1158
1159    _initializeInternal: function PageRequestManager$_initializeInternal(scriptManagerID, formElement, updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, asyncPostBackTimeout, masterPageUniqueID) {
1160        if (this._prmInitialized) {
1161            throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice);
1162        }
1163        this._prmInitialized = true;
1164        this._masterPageUniqueID = masterPageUniqueID;
1165        this._scriptManagerID = scriptManagerID;
1166        this._form = Sys.UI.DomElement.resolveElement(formElement);
1167        this._onsubmit = this._form.onsubmit;
1168        this._form.onsubmit = null;
1169        this._onFormSubmitHandler = Function.createDelegate(this, this._onFormSubmit);
1170        this._onFormElementClickHandler = Function.createDelegate(this, this._onFormElementClick);
1171        this._onWindowUnloadHandler = Function.createDelegate(this, this._onWindowUnload);
1172        Sys.UI.DomEvent.addHandler(this._form, 'submit', this._onFormSubmitHandler);
1173        Sys.UI.DomEvent.addHandler(this._form, 'click', this._onFormElementClickHandler);
1174        Sys.UI.DomEvent.addHandler(window, 'unload', this._onWindowUnloadHandler);
1175
1176        this._originalDoPostBack = window.__doPostBack;
1177        if (this._originalDoPostBack) {
1178            window.__doPostBack = Function.createDelegate(this, this._doPostBack);
1179        }
1180        this._originalDoPostBackWithOptions = window.WebForm_DoPostBackWithOptions;
1181        if (this._originalDoPostBackWithOptions) {
1182            window.WebForm_DoPostBackWithOptions = Function.createDelegate(this, this._doPostBackWithOptions);
1183        }
1184        this._originalFireDefaultButton = window.WebForm_FireDefaultButton;
1185        if (this._originalFireDefaultButton) {
1186            window.WebForm_FireDefaultButton = Function.createDelegate(this, this._fireDefaultButton);
1187        }
1188        this._originalDoCallback = window.WebForm_DoCallback;
1189        if (this._originalDoCallback) {
1190            window.WebForm_DoCallback = Function.createDelegate(this, this._doCallback);
1191        }
1192
1193        this._pageLoadedHandler = Function.createDelegate(this, this._pageLoadedInitialLoad);
1194        Sys.UI.DomEvent.addHandler(window, 'load', this._pageLoadedHandler);
1195        if (updatePanelIDs) {
1196            this._updateControls(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, asyncPostBackTimeout, true);
1197        }
1198    },
1199
1200    _matchesParentIDInList: function PageRequestManager$_matchesParentIDInList(clientID, parentIDList) {
1201        for (var i = 0, l = parentIDList.length; i < l; i++) {
1202            if (clientID.startsWith(parentIDList[i] + "_")) {
1203                return true;
1204            }
1205        }
1206        return false;
1207    },
1208    
1209    _onFormElementActive: function PageRequestManager$_onFormElementActive(element, offsetX, offsetY) {
1210        if (element.disabled) {
1211            return;
1212        }
1213
1214        this._postBackSettings = this._getPostBackSettings(element, element.name);
1215
1216        if (element.name) {
1217            var tagName = element.tagName.toUpperCase();
1218            if (tagName === 'INPUT') {
1219                var type = element.type;
1220                if (type === 'submit') {
1221                    this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value);
1222                }
1223                else if (type === 'image') {
1224                    this._additionalInput = encodeURIComponent(element.name) + '.x=' + offsetX + '&' + encodeURIComponent(element.name) + '.y=' + offsetY;
1225                }
1226            }
1227            else if ((tagName === 'BUTTON') && (element.name.length !== 0) && (element.type === 'submit')) {
1228                this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value);
1229            }
1230        }
1231    },
1232
1233    _onFormElementClick: function PageRequestManager$_onFormElementClick(evt) {
1234        this._activeDefaultButtonClicked = (evt.target === this._activeDefaultButton);
1235        this._onFormElementActive(evt.target, evt.offsetX, evt.offsetY);
1236    },
1237
1238    _onFormSubmit: function PageRequestManager$_onFormSubmit(evt) {
1239        var i, l, continueSubmit = true,
1240            isCrossPost = this._isCrossPost;
1241        this._isCrossPost = false;
1242
1243        if (this._onsubmit) {
1244            continueSubmit = this._onsubmit();
1245        }
1246
1247        if (continueSubmit) {
1248            for (i = 0, l = this._onSubmitStatements.length; i < l; i++) {
1249                if (!this._onSubmitStatements[i]()) {
1250                    continueSubmit = false;
1251                    break;
1252                }
1253            }
1254        }
1255
1256        if (!continueSubmit) {
1257            if (evt) {
1258                evt.preventDefault();
1259            }
1260            return;
1261        }
1262
1263        var form = this._form;
1264        if (isCrossPost) {
1265            return;
1266        }
1267
1268        if (this._activeDefaultButton && !this._activeDefaultButtonClicked) {
1269            this._onFormElementActive(this._activeDefaultButton, 0, 0);
1270        }
1271
1272        if (!this._postBackSettings || !this._postBackSettings.async) {
1273            return;
1274        }
1275
1276        var formBody = new Sys.StringBuilder(),
1277            count = form.elements.length,
1278            panelID = this._createPanelID(null, this._postBackSettings);
1279        formBody.append(panelID);
1280
1281        for (i = 0; i < count; i++) {
1282            var element = form.elements[i];
1283            var name = element.name;
1284            if (typeof(name) === "undefined" || (name === null) || (name.length === 0) || (name === this._scriptManagerID)) {
1285                continue;
1286            }
1287
1288            var tagName = element.tagName.toUpperCase();
1289
1290            if (tagName === 'INPUT') {
1291                var type = element.type;
1292                if (this._textTypes.test(type) ||
1293                    (((type === 'checkbox') || (type === 'radio')) && element.checked)) {
1294                    formBody.append(encodeURIComponent(name));
1295                    formBody.append('=');
1296                    formBody.append(encodeURIComponent(element.value));
1297                    formBody.append('&');
1298                }
1299            }
1300            else if (tagName === 'SELECT') {
1301                var optionCount = element.options.length;
1302                for (var j = 0; j < optionCount; j++) {
1303                    var option = element.options[j];
1304                    if (option.selected) {
1305                        formBody.append(encodeURIComponent(name));
1306                        formBody.append('=');
1307                        formBody.append(encodeURIComponent(option.value));
1308                        formBody.append('&');
1309                    }
1310                }
1311            }
1312            else if (tagName === 'TEXTAREA') {
1313                formBody.append(encodeURIComponent(name));
1314                formBody.append('=');
1315                formBody.append(encodeURIComponent(element.value));
1316                formBody.append('&');
1317            }
1318        }
1319
1320        formBody.append("__ASYNCPOST=true&");
1321
1322        if (this._additionalInput) {
1323            formBody.append(this._additionalInput);
1324            this._additionalInput = null;
1325        }
1326        
1327        var request = new Sys.Net.WebRequest();
1328        var action = form.action;
1329        if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
1330            var fragmentIndex = action.indexOf('#');
1331            if (fragmentIndex !== -1) {
1332                action = action.substr(0, fragmentIndex);
1333            }
1334            var queryIndex = action.indexOf('?');
1335            if (queryIndex !== -1) {
1336                var path = action.substr(0, queryIndex);
1337                if (path.indexOf("%") === -1) {
1338                    action = encodeURI(path) + action.substr(queryIndex);
1339                }
1340            }
1341            else if (action.indexOf("%") === -1) {
1342                action = encodeURI(action);
1343            }
1344        }
1345        request.set_url(action);
1346        request.get_headers()['X-MicrosoftAjax'] = 'Delta=true';
1347        request.get_headers()['Cache-Control'] = 'no-cache';
1348        request.set_timeout(this._asyncPostBackTimeout);
1349        request.add_completed(Function.createDelegate(this, this._onFormSubmitCompleted));
1350        request.set_body(formBody.toString());
1351        var panelsToUpdate, eventArgs;
1352        panelsToUpdate = this._postBackSettings.panelsToUpdate;
1353        eventArgs = new Sys.WebForms.InitializeRequestEventArgs(request, this._postBackSettings.sourceElement, panelsToUpdate);
1354        Sys.Observer.raiseEvent(this, "initializeRequest", eventArgs);
1355        continueSubmit = !eventArgs.get_cancel();
1356
1357        if (!continueSubmit) {
1358            if (evt) {
1359                evt.preventDefault();
1360            }
1361            return;
1362        }
1363        
1364        if (eventArgs && eventArgs._updated) {
1365            panelsToUpdate = eventArgs.get_updatePanelsToUpdate();
1366            request.set_body(request.get_body().replace(panelID, this._createPanelID(panelsToUpdate, this._postBackSettings)));
1367        }
1368
1369        this._scrollPosition = this._getScrollPosition();
1370
1371
1372        this.abortPostBack();
1373
1374        eventArgs = new Sys.WebForms.BeginRequestEventArgs(request, this._postBackSettings.sourceElement,
1375            panelsToUpdate || this._postBackSettings.panelsToUpdate);
1376        Sys.Observer.raiseEvent(this, "beginRequest", eventArgs);
1377        
1378        if (this._originalDoCallback) {
1379            this._cancelPendingCallbacks();
1380        }
1381
1382        this._request = request;
1383        this._processingRequest = false;
1384        request.invoke();
1385
1386        if (evt) {
1387            evt.preventDefault();
1388        }
1389    },
1390
1391    _onFormSubmitCompleted: function PageRequestManager$_onFormSubmitCompleted(sender, eventArgs) {
1392        this._processingRequest = true;
1393
1394
1395        if (sender.get_timedOut()) {
1396            this._endPostBack(this._createPageRequestManagerTimeoutError(), sender, null);
1397            return;
1398        }
1399
1400        if (sender.get_aborted()) {
1401            this._endPostBack(null, sender, null);
1402            return;
1403        }
1404
1405        if (!this._request || (sender.get_webRequest() !== this._request)) {
1406            return;
1407        }
1408
1409        if (sender.get_statusCode() !== 200) {
1410            this._endPostBack(this._createPageRequestManagerServerError(sender.get_statusCode()), sender, null);
1411            return;
1412        }
1413
1414        var data = this._parseDelta(sender);
1415        if (!data) return;
1416        
1417        var i, l;
1418
1419        if (data.asyncPostBackControlIDsNode && data.postBackControlIDsNode &&
1420            data.updatePanelIDsNode && data.panelsToRefreshNode && data.childUpdatePanelIDsNode) {
1421            
1422            var oldUpdatePanelIDs = this._updatePanelIDs,
1423                oldUpdatePanelClientIDs = this._updatePanelClientIDs;
1424            var childUpdatePanelIDsString = data.childUpdatePanelIDsNode.content;
1425            var childUpdatePanelIDs = childUpdatePanelIDsString.length ? childUpdatePanelIDsString.split(',') : [];
1426
1427            var asyncPostBackControlIDsArray = this._splitNodeIntoArray(data.asyncPostBackControlIDsNode);
1428            var postBackControlIDsArray = this._splitNodeIntoArray(data.postBackControlIDsNode);
1429            var updatePanelIDsArray = this._splitNodeIntoArray(data.updatePanelIDsNode);
1430            var panelsToRefreshIDs = this._splitNodeIntoArray(data.panelsToRefreshNode);
1431
1432            var v4 = data.version4;
1433            for (i = 0, l = panelsToRefreshIDs.length; i < l; i+= (v4 ? 2 : 1)) {
1434                var panelClientID = (v4 ? panelsToRefreshIDs[i+1] : "") || this._uniqueIDToClientID(panelsToRefreshIDs[i]);
1435                if (!document.getElementById(panelClientID)) {
1436                    this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel, panelClientID)), sender, data);
1437                    return;
1438                }
1439            }
1440            
1441            var updatePanelData = this._processUpdatePanelArrays(
1442                updatePanelIDsArray,
1443                asyncPostBackControlIDsArray,
1444                postBackControlIDsArray, v4);
1445            updatePanelData.oldUpdatePanelIDs = oldUpdatePanelIDs;
1446            updatePanelData.oldUpdatePanelClientIDs = oldUpdatePanelClientIDs;
1447            updatePanelData.childUpdatePanelIDs = childUpdatePanelIDs;
1448            updatePanelData.panelsToRefreshIDs = panelsToRefreshIDs;
1449            data.updatePanelData = updatePanelData;
1450        }
1451
1452        data.dataItems = {};
1453        var node;
1454        for (i = 0, l = data.dataItemNodes.length; i < l; i++) {
1455            node = data.dataItemNodes[i];
1456            data.dataItems[node.id] = node.content;
1457        }
1458        for (i = 0, l = data.dataItemJsonNodes.length; i < l; i++) {
1459            node = data.dataItemJsonNodes[i];
1460            data.dataItems[node.id] = Sys.Serialization.JavaScriptSerializer.deserialize(node.content);
1461        }
1462
1463        var handler = Sys.Observer._getContext(this, true).events.getHandler("pageLoading");
1464        if (handler) {
1465            handler(this, this._getPageLoadingEventArgs(data));
1466        }
1467
1468
1469        
1470        Sys._ScriptLoader.readLoadedScripts();
1471
1472        Sys.Application.beginCreateComponents();
1473
1474        var scriptLoader = Sys._ScriptLoader.getInstance();
1475        this._queueScripts(scriptLoader, data.scriptBlockNodes, true, false);
1476        
1477        this._processingRequest = true;
1478
1479        scriptLoader.loadScripts(0,
1480            Function.createDelegate(this, Function.createCallback(this._scriptIncludesLoadComplete, data)),
1481            Function.createDelegate(this, Function.createCallback(this._scriptIncludesLoadFailed, data)),
1482            null);        
1483    },
1484    
1485    _onWindowUnload: function PageRequestManager$_onWindowUnload(evt) {
1486        this.dispose();
1487    },
1488
1489    _pageLoaded: function PageRequestManager$_pageLoaded(initialLoad, data) {
1490        Sys.Observer.raiseEvent(this, "pageLoaded", this._getPageLoadedEventArgs(initialLoad, data));
1491        if (!initialLoad) {
1492            Sys.Application.raiseLoad();
1493        }
1494    },
1495
1496    _pageLoadedInitialLoad: function PageRequestManager$_pageLoadedInitialLoad(evt) {
1497        this._pageLoaded(true, null);
1498    },
1499    
1500    _parseDelta: function PageRequestManager$_parseDelta(executor) {
1501        var reply = executor.get_responseData();
1502        var delimiterIndex, len, type, id, content;
1503        var replyIndex = 0;
1504        var parserErrorDetails = null;
1505        var delta = [];
1506
1507        while (replyIndex < reply.length) {
1508            delimiterIndex = reply.indexOf('|', replyIndex);
1509            if (delimiterIndex === -1) {
1510                parserErrorDetails = this._findText(reply, replyIndex);
1511                break;
1512            }
1513            len = parseInt(reply.substring(replyIndex, delimiterIndex), 10);
1514            if ((len % 1) !== 0) {
1515                parserErrorDetails = this._findText(reply, replyIndex);
1516                break;
1517            }
1518            replyIndex = delimiterIndex + 1;
1519
1520            delimiterIndex = reply.indexOf('|', replyIndex);
1521            if (delimiterIndex === -1) {
1522                parserErrorDetails = this._findText(reply, replyIndex);
1523                break;
1524            }
1525            type = reply.substring(replyIndex, delimiterIndex);
1526            replyIndex = delimiterIndex + 1;
1527
1528            delimiterIndex = reply.indexOf('|', replyIndex);
1529            if (delimiterIndex === -1) {
1530                parserErrorDetails = this._findText(reply, replyIndex);
1531                break;
1532            }
1533            id = reply.substring(replyIndex, delimiterIndex);
1534            replyIndex = delimiterIndex + 1;
1535
1536            if ((replyIndex + len) >= reply.length) {
1537                parserErrorDetails = this._findText(reply, reply.length);
1538                break;
1539            }
1540            content = reply.substr(replyIndex, len);
1541            replyIndex += len;
1542
1543            if (reply.charAt(replyIndex) !== '|') {
1544                parserErrorDetails = this._findText(reply, replyIndex);
1545                break;
1546            }
1547
1548            replyIndex++;
1549
1550            Array.add(delta, {type: type, id: id, content: content});
1551        }
1552
1553        if (parserErrorDetails) {
1554            this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails, parserErrorDetails)), executor, null);
1555            return null;
1556        }
1557
1558        var updatePanelNodes = [];
1559        var hiddenFieldNodes = [];
1560        var arrayDeclarationNodes = [];
1561        var scriptBlockNodes = [];
1562        var scriptStartupNodes = [];
1563        var expandoNodes = [];
1564        var onSubmitNodes = [];
1565        var dataItemNodes = [];
1566        var dataItemJsonNodes = [];
1567        var scriptDisposeNodes = [];
1568        var asyncPostBackControlIDsNode, postBackControlIDsNode,
1569            updatePanelIDsNode, asyncPostBackTimeoutNode,
1570            childUpdatePanelIDsNode, panelsToRefreshNode, formActionNode,
1571            versionNode;
1572
1573        for (var i = 0, l = delta.length; i < l; i++) {
1574            var deltaNode = delta[i];
1575            switch (deltaNode.type) {
1576                case "#":
1577                    versionNode = deltaNode;
1578                    break;
1579                case "updatePanel":
1580                    Array.add(updatePanelNodes, deltaNode);
1581                    break;
1582                case "hiddenField":
1583                    Array.add(hiddenFieldNodes, deltaNode);
1584                    break;
1585                case "arrayDeclaration":
1586                    Array.add(arrayDeclarationNodes, deltaNode);
1587                    break;
1588                case "scriptBlock":
1589                    Array.add(scriptBlockNodes, deltaNode);
1590                    break;
1591                case "scriptStartupBlock":
1592                    Array.add(scriptStartupNodes, deltaNode);
1593                    break;
1594                case "expando":
1595                    Array.add(expandoNodes, deltaNode);
1596                    break;
1597                case "onSubmit":
1598                    Array.add(onSubmitNodes, deltaNode);
1599                    break;
1600                case "asyncPostBackControlIDs":
1601                    asyncPostBackControlIDsNode = deltaNode;
1602                    break;
1603                case "postBackControlIDs":
1604                    postBackControlIDsNode = deltaNode;
1605                    break;
1606                case "updatePanelIDs":
1607                    updatePanelIDsNode = deltaNode;
1608                    break;
1609                case "asyncPostBackTimeout":
1610                    asyncPostBackTimeoutNode = deltaNode;
1611                    break;
1612                case "childUpdatePanelIDs":
1613                    childUpdatePanelIDsNode = deltaNode;
1614                    break;
1615                case "panelsToRefreshIDs":
1616                    panelsToRefreshNode = deltaNode;
1617                    break;
1618                case "formAction":
1619                    formActionNode = deltaNode;
1620                    break;
1621                case "dataItem":
1622                    Array.add(dataItemNodes, deltaNode);
1623                    break;
1624                case "dataItemJson":
1625                    Array.add(dataItemJsonNodes, deltaNode);
1626                    break;
1627                case "scriptDispose":
1628                    Array.add(scriptDisposeNodes, deltaNode);
1629                    break;
1630                case "pageRedirect":
1631                    if (versionNode && parseFloat(versionNode.content) >= 4) {
1632                        deltaNode.content = unescape(deltaNode.content);
1633                    }
1634                    if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
1635                        var anchor = document.createElement("a");
1636                        anchor.style.display = 'none';
1637                        anchor.attachEvent("onclick", cancelBubble);
1638                        anchor.href = deltaNode.content;
1639                        this._form.parentNode.insertBefore(anchor, this._form);
1640                        anchor.click();
1641                        anchor.detachEvent("onclick", cancelBubble);
1642                        this._form.parentNode.removeChild(anchor);
1643                        
1644                        function cancelBubble(e) {
1645                            e.cancelBubble = true;
1646                        }
1647                    }
1648                    else {
1649                        window.location.href = deltaNode.content;
1650                    }
1651                    return null;
1652                case "error":
1653                    this._endPostBack(this._createPageRequestManagerServerError(Number.parseInvariant(deltaNode.id), deltaNode.content), executor, null);
1654                    return null;
1655                case "pageTitle":
1656                    document.title = deltaNode.content;
1657                    break;
1658                case "focus":
1659                    this._controlIDToFocus = deltaNode.content;
1660                    break;
1661                default:
1662                    this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_UnknownToken, deltaNode.type)), executor, null);
1663                    return null;
1664            } // switch
1665        } // for (var i = 0, l = delta.length; i < l; i++)
1666        return {
1667            version4: versionNode ? (parseFloat(versionNode.content) >= 4) : false,
1668            executor: executor,
1669            updatePanelNodes: updatePanelNodes,
1670            hiddenFieldNodes: hiddenFieldNodes,
1671            arrayDeclarationNodes: arrayDeclarationNodes,
1672            scriptBlockNodes: scriptBlockNodes,
1673            scriptStartupNodes: scriptStartupNodes,
1674            expandoNodes: expandoNodes,
1675            onSubmitNodes: onSubmitNodes,
1676            dataItemNodes: dataItemNodes,
1677            dataItemJsonNodes: dataItemJsonNodes,
1678            scriptDisposeNodes: scriptDisposeNodes,
1679            asyncPostBackControlIDsNode: asyncPostBackControlIDsNode,
1680            postBackControlIDsNode: postBackControlIDsNode,
1681            updatePanelIDsNode: updatePanelIDsNode,
1682            asyncPostBackTimeoutNode: asyncPostBackTimeoutNode,
1683            childUpdatePanelIDsNode: childUpdatePanelIDsNode,
1684            panelsToRefreshNode: panelsToRefreshNode,
1685            formActionNode: formActionNode };
1686    },
1687    
1688    _processUpdatePanelArrays: function PageRequestManager$_processUpdatePanelArrays(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, version4) {
1689        var newUpdatePanelIDs, newUpdatePanelClientIDs, newUpdatePanelHasChildrenAsTriggers;
1690        
1691        if (updatePanelIDs) {
1692            var l = updatePanelIDs.length,
1693                m = version4 ? 2 : 1;
1694            newUpdatePanelIDs = new Array(l/m);
1695            newUpdatePanelClientIDs = new Array(l/m);
1696            newUpdatePanelHasChildrenAsTriggers = new Array(l/m);
1697            
1698            for (var i = 0, j = 0; i < l; i += m, j++) {
1699                var ct,
1700                    uniqueID = updatePanelIDs[i],
1701                    clientID = version4 ? updatePanelIDs[i+1] : "";
1702                ct = (uniqueID.charAt(0) === 't');
1703                uniqueID = uniqueID.substr(1);
1704                if (!clientID) {
1705                    clientID = this._uniqueIDToClientID(uniqueID);
1706                }
1707                newUpdatePanelHasChildrenAsTriggers[j] = ct;
1708                newUpdatePanelIDs[j] = uniqueID;
1709                newUpdatePanelClientIDs[j] = clientID;
1710            }
1711        }
1712        else {
1713            newUpdatePanelIDs = [];
1714            newUpdatePanelClientIDs = [];
1715            newUpdatePanelHasChildrenAsTriggers = [];
1716        }
1717
1718        var newAsyncPostBackControlIDs = [];
1719        var newAsyncPostBackControlClientIDs = [];
1720        this._convertToClientIDs(asyncPostBackControlIDs, newAsyncPostBackControlIDs, newAsyncPostBackControlClientIDs, version4);
1721
1722        var newPostBackControlIDs = [];
1723        var newPostBackControlClientIDs = [];
1724        this._convertToClientIDs(postBackControlIDs, newPostBackControlIDs, newPostBackControlClientIDs, version4);
1725        
1726        return {
1727            updatePanelIDs: newUpdatePanelIDs,
1728            updatePanelClientIDs: newUpdatePanelClientIDs,
1729            updatePanelHasChildrenAsTriggers: newUpdatePanelHasChildrenAsTriggers,
1730            asyncPostBackControlIDs: newAsyncPostBackControlIDs,
1731            asyncPostBackControlClientIDs: newAsyncPostBackControlClientIDs,
1732            postBackControlIDs: newPostBackControlIDs,
1733            postBackControlClientIDs: newPostBackControlClientIDs
1734        };
1735    },
1736    
1737    _queueScripts: function PageRequestManager$_queueScripts(scriptLoader, scriptBlockNodes, queueIncludes, queueBlocks) {
1738        for (var i = 0, l = scriptBlockNodes.length; i < l; i++) {
1739            var scriptBlockType = scriptBlockNodes[i].id;
1740            switch (scriptBlockType) {
1741                case "ScriptContentNoTags":
1742                    if (!queueBlocks) {
1743                        continue;
1744                    }
1745                    scriptLoader.queueScriptBlock(scriptBlockNodes[i].content);
1746                    break;
1747                case "ScriptContentWithTags":
1748                    var scriptTagAttributes = window.eval("(" + scriptBlockNodes[i].content + ")");
1749
1750                    if (scriptTagAttributes.src) {
1751                        if (!queueIncludes || Sys._ScriptLoader.isScriptLoaded(scriptTagAttributes.src)) {
1752                            continue;
1753                        }
1754                    }
1755                    else if (!queueBlocks) {
1756                        continue;
1757                    }
1758
1759                    scriptLoader.queueCustomScriptTag(scriptTagAttributes);
1760                    break;
1761                case "ScriptPath":
1762                    if (!queueIncludes || Sys._ScriptLoader.isScriptLoaded(scriptBlockNodes[i].content)) {
1763                        continue;
1764                    }
1765
1766                    scriptLoader.queueScriptReference(scriptBlockNodes[i].content);
1767                    break;
1768            }
1769        }        
1770    },
1771
1772    _registerDisposeScript: function PageRequestManager$_registerDisposeScript(panelID, disposeScript) {
1773        if (!this._scriptDisposes[panelID]) {
1774            this._scriptDisposes[panelID] = [disposeScript];
1775        }
1776        else {
1777            Array.add(this._scriptDisposes[panelID], disposeScript);
1778        }
1779    },
1780    
1781    _scriptIncludesLoadComplete: function PageRequestManager$_scriptIncludesLoadComplete(scriptLoader, data) {
1782        if (data.executor.get_webRequest() !== this._request) {
1783            return;
1784        }
1785        
1786        this._commitControls(data.updatePanelData,
1787            data.asyncPostBackTimeoutNode ? data.asyncPostBackTimeoutNode.content : null);
1788
1789        if (data.formActionNode) {
1790            this._form.action = data.formActionNode.content;
1791        }
1792        
1793        var i, l, node;
1794
1795        for (i = 0, l = data.updatePanelNodes.length; i < l; i++) {
1796            node = data.updatePanelNodes[i];
1797            var updatePanelElement = document.getElementById(node.id);
1798
1799            if (!updatePanelElement) {
1800                this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel, node.id)), data.executor, data);
1801                return;
1802            }
1803
1804            this._updatePanel(updatePanelElement, node.content);
1805        }
1806
1807        for (i = 0, l = data.scriptDisposeNodes.length; i < l; i++) {
1808            node = data.scriptDisposeNodes[i];
1809            this._registerDisposeScript(node.id, node.content);
1810        }
1811
1812        for (i = 0, l = this._transientFields.length; i < l; i++) {
1813            var field = document.getElementById(this._transientFields[i]);
1814            if (field) {
1815                var toRemove = field._isContained ? field.parentNode : field;
1816                toRemove.parentNode.removeChild(toRemove);
1817            }
1818        }
1819        for (i = 0, l = data.hiddenFieldNodes.length; i < l; i++) {
1820            node = data.hiddenFieldNodes[i];
1821            this._createHiddenField(node.id, node.content);
1822        }
1823        
1824        if (data.scriptsFailed) {
1825            throw Sys._ScriptLoader._errorScriptLoadFailed(data.scriptsFailed.src, data.scriptsFailed.multipleCallbacks);
1826        }
1827        
1828
1829        this._queueScripts(scriptLoader, data.scriptBlockNodes, false, true);
1830
1831        var arrayScript = '';
1832        for (i = 0, l = data.arrayDeclarationNodes.length; i < l; i++) {
1833            node = data.arrayDeclarationNodes[i];
1834            arrayScript += "Sys.WebForms.PageRequestManager._addArrayElement('" + node.id + "', " + node.content + ");\r\n";
1835        }
1836
1837        var expandoScript = '';
1838        for (i = 0, l = data.expandoNodes.length; i < l; i++) {
1839            node = data.expandoNodes[i];
1840            expandoScript += node.id + " = " + node.content + "\r\n";
1841        }
1842
1843        if (arrayScript.length) {
1844            scriptLoader.queueScriptBlock(arrayScript);
1845        }
1846        if (expandoScript.length) {
1847            scriptLoader.queueScriptBlock(expandoScript);
1848        }
1849        
1850        this._queueScripts(scriptLoader, data.scriptStartupNodes, true, true);
1851
1852        var onSubmitStatementScript = '';
1853        for (i = 0, l = data.onSubmitNodes.length; i < l; i++) {
1854            if (i === 0) {
1855                onSubmitStatementScript = 'Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, function() {\r\n';
1856            }
1857            onSubmitStatementScript += data.onSubmitNodes[i].content + "\r\n";
1858        }
1859        if (onSubmitStatementScript.length) {
1860            onSubmitStatementScript += "\r\nreturn true;\r\n});\r\n";
1861            scriptLoader.queueScriptBlock(onSubmitStatementScript);
1862        }
1863
1864        scriptLoader.loadScripts(0,
1865            Function.createDelegate(this, Function.createCallback(this._scriptsLoadComplete, data)), null, null);
1866
1867    },
1868    
1869    _scriptIncludesLoadFailed: function PageRequestManager$_scriptIncludesLoadFailed(scriptLoader, scriptElement, multipleCallbacks, data) {
1870        data.scriptsFailed = { src: scriptElement.src, multipleCallbacks: multipleCallbacks };
1871        this._scriptIncludesLoadComplete(scriptLoader, data);
1872    },
1873
1874    _scriptsLoadComplete: function PageRequestManager$_scriptsLoadComplete(scriptLoader, data) {
1875        var response = data.executor;
1876
1877        if (window.__theFormPostData) {
1878            window.__theFormPostData = "";
1879        }
1880        if (window.__theFormPostCollection) {
1881            window.__theFormPostCollection = [];
1882        }
1883        if (window.WebForm_InitCallback) {
1884            window.WebForm_InitCallback();
1885        }
1886
1887        if (this._scrollPosition) {
1888            if (window.scrollTo) {
1889                window.scrollTo(this._scrollPosition.x, this._scrollPosition.y);
1890            }
1891            this._scrollPosition = null;
1892        }
1893
1894        Sys.Application.endCreateComponents();
1895
1896        this._pageLoaded(false, data);
1897
1898        this._endPostBack(null, response, data);
1899
1900        if (this._controlIDToFocus) {
1901            var focusTarget;
1902            var oldContentEditableSetting;
1903            if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
1904                var targetControl = $get(this._controlIDToFocus);
1905
1906                focusTarget = targetControl;
1907                if (targetControl && (!WebForm_CanFocus(targetControl))) {
1908                    focusTarget = WebForm_FindFirstFocusableChild(targetControl);
1909                }
1910                if (focusTarget && (typeof(focusTarget.contentEditable) !== "undefined")) {
1911                    oldContentEditableSetting = focusTarget.contentEditable;
1912                    focusTarget.contentEditable = false;
1913                }
1914                else {
1915                    focusTarget = null;
1916                }
1917            }
1918            WebForm_AutoFocus(this._controlIDToFocus);
1919            if (focusTarget) {
1920                focusTarget.contentEditable = oldContentEditableSetting;
1921            }
1922            this._controlIDToFocus = null;
1923        }
1924    },
1925
1926    _splitNodeIntoArray: function PageRequestManager$_splitNodeIntoArray(node) {
1927        var str = node.content;
1928        var arr = str.length ? str.split(',') : [];
1929        return arr;
1930    },
1931
1932    _uniqueIDToClientID: function PageRequestManager$_uniqueIDToClientID(uniqueID) {
1933        return uniqueID.replace(/\$/g, '_');
1934    },
1935    
1936    _updateControls: function PageRequestManager$_updateControls(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, asyncPostBackTimeout, version4) {
1937        this._commitControls(
1938            this._processUpdatePanelArrays(updatePanelIDs, asyncPostBackControlIDs, postBackControlIDs, version4),
1939            asyncPostBackTimeout);
1940    },
1941    
1942    _updatePanel: function PageRequestManager$_updatePanel(updatePanelElement, rendering) {
1943        for (var updatePanelID in this._scriptDisposes) {
1944            if (this._elementContains(updatePanelElement, document.getElementById(updatePanelID))) {
1945                var disposeScripts = this._scriptDisposes[updatePanelID];
1946                for (var i = 0, l = disposeScripts.length; i < l; i++) {
1947                    window.eval(disposeScripts[i]);
1948                }
1949
1950                delete this._scriptDisposes[updatePanelID];
1951            }
1952        }
1953
1954        Sys.Application.disposeElement(updatePanelElement, true);
1955
1956        updatePanelElement.innerHTML = rendering;
1957    },
1958
1959    _validPosition: function PageRequestManager$_validPosition(position) {
1960        return (typeof(position) !== "undefined") && (position !== null) && (position !== 0);
1961    }
1962}
1963
1964$type.getInstance = function PageRequestManager$getInstance() {
1965    /// <summary locid="M:J#Sys.WebForms.PageRequestManager.getInstance">Gets the current instance of the PageRequestManager.</summary>
1966    /// <returns type="Sys.WebForms.PageRequestManager"></returns>
1967    if (arguments.length !== 0) throw Error.parameterCount();
1968    var prm = Sys.WebForms.PageRequestManager._instance;
1969    if (!prm) {
1970        prm = Sys.WebForms.PageRequestManager._instance = new Sys.WebForms.PageRequestManager();
1971    }
1972    return prm;
1973}
1974
1975$type._addArrayElement = function PageRequestManager$_addArrayElement(arrayName) {
1976    if (!window[arrayName]) {
1977        window[arrayName] = new Array();
1978    }
1979
1980    for (var i = 1, l = arguments.length; i < l; i++) {
1981        Array.add(window[arrayName], arguments[i]);
1982    }
1983}
1984
1985$type._initialize = function PageRequestManager$_initialize() {
1986    var prm = Sys.WebForms.PageRequestManager.getInstance();
1987    prm._initializeInternal.apply(prm, arguments);
1988}
1989
1990$type.registerClass('Sys.WebForms.PageRequestManager');
1991$type = Sys.UI._UpdateProgress = function _UpdateProgress(element) {
1992    Sys.UI._UpdateProgress.initializeBase(this,[element]);
1993    this._displayAfter = 500;
1994    this._dynamicLayout = true;
1995    this._associatedUpdatePanelId = null;
1996    this._beginRequestHandlerDelegate = null;
1997    this._startDelegate = null;
1998    this._endRequestHandlerDelegate = null;
1999    this._pageRequestManager = null;
2000    this._timerCookie = null;
2001}
2002$type.prototype = {
2003    get_displayAfter: function _UpdateProgress$get_displayAfter() {
2004        /// <value type="Number" locid="P:J#Sys.UI._UpdateProgress.displayAfter"></value>
2005        if (arguments.length !== 0) throw Error.parameterCount();
2006        return this._displayAfter;
2007    },
2008    set_displayAfter: function _UpdateProgress$set_displayAfter(value) {
2009        var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
2010        if (e) throw e;
2011        this._displayAfter = value;
2012    },
2013    get_dynamicLayout: function _UpdateProgress$get_dynamicLayout() {
2014        /// <value type="Boolean" locid="P:J#Sys.UI._UpdateProgress.dynamicLayout"></value>
2015        if (arguments.length !== 0) throw Error.parameterCount();
2016        return this._dynamicLayout;
2017    },
2018    set_dynamicLayout: function _UpdateProgress$set_dynamicLayout(value) {
2019        var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
2020        if (e) throw e;
2021        this._dynamicLayout = value;
2022    },
2023    get_associatedUpdatePanelId: function _UpdateProgress$get_associatedUpdatePanelId() {
2024        /// <value type="String" mayBeNull="true" locid="P:J#Sys.UI._UpdateProgress.associatedUpdatePanelId"></value>
2025        if (arguments.length !== 0) throw Error.parameterCount();
2026        return this._associatedUpdatePanelId;
2027    },
2028    set_associatedUpdatePanelId: function _UpdateProgress$set_associatedUpdatePanelId(value) {
2029        var e = Function._validateParams(arguments, [{name: "value", type: String, mayBeNull: true}]);
2030        if (e) throw e;
2031        this._associatedUpdatePanelId = value;
2032    },
2033    get_role: function _UpdateProgress$get_role() {
2034        /// <value type="String" locid="P:J#Sys.UI._UpdateProgress.role"></value>
2035        if (arguments.length !== 0) throw Error.parameterCount();
2036        return "status";
2037    },
2038    _clearTimeout: function _UpdateProgress$_clearTimeout() {
2039        if (this._timerCookie) {
2040            window.clearTimeout(this._timerCookie);
2041            this._timerCookie = null;
2042        }
2043    },
2044    _getUniqueID: function _UpdateProgress$_getUniqueID(clientID) {
2045        var i = Array.indexOf(this._pageRequestManager._updatePanelClientIDs, clientID);
2046        return i === -1 ? null : this._pageRequestManager._updatePanelIDs[i];
2047    },
2048    _handleBeginRequest: function _UpdateProgress$_handleBeginRequest(sender, arg) {
2049        var curElem = arg.get_postBackElement(),
2050            showProgress = true,
2051            upID = this._associatedUpdatePanelId;
2052        if (this._associatedUpdatePanelId) {
2053            var updating = arg.get_updatePanelsToUpdate();
2054            if (updating && updating.length) {
2055                showProgress = (Array.contains(updating, upID) || Array.contains(updating, this._getUniqueID(upID)))
2056            }
2057            else {
2058                showProgress = false;
2059            }
2060        }
2061        while (!showProgress && curElem) {
2062            if (curElem.id && this._associatedUpdatePanelId === curElem.id) {
2063                showProgress = true; 
2064            }
2065            curElem = curElem.parentNode; 
2066        } 
2067        if (showProgress) {
2068            this._timerCookie = window.setTimeout(this._startDelegate, this._displayAfter);
2069        }
2070    },
2071    _startRequest: function _UpdateProgress$_startRequest() {
2072        if (this._pageRequestManager.get_isInAsyncPostBack()) {
2073            var element = this.get_element();
2074            if (this._dynamicLayout) {
2075                element.style.display = 'block';
2076            }
2077            else {
2078                element.style.visibility = 'visible';
2079            }
2080            if (this.get_role() === "status") {
2081                element.setAttribute("aria-hidden", "false");
2082            }
2083        }
2084        this._timerCookie = null;
2085    },
2086    _handleEndRequest: function _UpdateProgress$_handleEndRequest(sender, arg) {
2087        var element = this.get_element();
2088        if (this._dynamicLayout) {
2089            element.style.display = 'none';
2090        }
2091        else {
2092            element.style.visibility = 'hidden';
2093        }
2094        if (this.get_role() === "status") {
2095            element.setAttribute("aria-hidden", "true");
2096        }
2097        this._clearTimeout();
2098    },
2099    dispose: function _UpdateProgress$dispose() {
2100        if (this._beginRequestHandlerDelegate !== null) {
2101            this._pageRequestManager.remove_beginRequest(this._beginRequestHandlerDelegate);
2102            this._pageRequestManager.remove_endRequest(this._endRequestHandlerDelegate);
2103            this._beginRequestHandlerDelegate = null;
2104            this._endRequestHandlerDelegate = null;
2105        }
2106        this._clearTimeout();
2107        Sys.UI._UpdateProgress.callBaseMethod(this,"dispose");
2108    },
2109    initialize: function _UpdateProgress$initialize() {
2110        Sys.UI._UpdateProgress.callBaseMethod(this, 'initialize');
2111        if (this.get_role() === "status") {
2112            this.get_element().setAttribute("aria-hidden", "true");
2113        }
2114    	this._beginRequestHandlerDelegate = Function.createDelegate(this, this._handleBeginRequest);
2115    	this._endRequestHandlerDelegate = Function.createDelegate(this, this._handleEndRequest);
2116    	this._startDelegate = Function.createDelegate(this, this._startRequest);
2117    	if (Sys.WebForms && Sys.WebForms.PageRequestManager) {
2118           this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
2119    	}
2120    	if (this._pageRequestManager !== null ) {
2121    	    this._pageRequestManager.add_beginRequest(this._beginRequestHandlerDelegate);
2122    	    this._pageRequestManager.add_endRequest(this._endRequestHandlerDelegate);
2123    	}
2124    }
2125}
2126$type.registerClass('Sys.UI._UpdateProgress', Sys.UI.Control);
2127
2128}
2129
2130if (window.Sys && Sys.loader) {
2131	Sys.loader.registerScript("WebForms", ["ComponentModel", "Serialization", "Network"], execute);
2132}
2133else {
2134	execute();
2135}
2136
2137})();
2138
2139Type.registerNamespace('Sys.WebForms');
2140Sys.WebForms.Res={
2141"PRM_UnknownToken":"Unknown token: \u0027{0}\u0027.",
2142"PRM_MissingPanel":"Could not find UpdatePanel with ID \u0027{0}\u0027. If it is being updated dynamically then it must be inside another UpdatePanel.",
2143"PRM_ServerError":"An unknown error occurred while processing the request on the server. The status code returned from the server was: {0}",
2144"PRM_ParserError":"The message received from the server could not be parsed.",
2145"PRM_TimeoutError":"The server request timed out.",
2146"PRM_ParserErrorDetails":"Error parsing near \u0027{0}\u0027.",
2147"PRM_CannotRegisterTwice":"The PageRequestManager cannot be initialized more than once."
2148};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.