// (c) 2010 CodePlex Foundation
(function(){function a(){var s="aria-hidden",k="status",j="submit",h="=",g="undefined",d=-1,f="",u="function",r="pageLoading",q="pageLoaded",p="initializeRequest",o="endRequest",n="beginRequest",m="script",l="error",t="readystatechange",i="load",a=null,c=true,b=false;Type._registerScript("MicrosoftAjaxWebForms.js",["MicrosoftAjaxCore.js","MicrosoftAjaxSerialization.js","MicrosoftAjaxNetwork.js","MicrosoftAjaxComponentModel.js"]);var e,v;Type.registerNamespace("Sys.WebForms");e=Sys.WebForms.BeginRequestEventArgs=function(d,c,b){var a=this;Sys.WebForms.BeginRequestEventArgs.initializeBase(a);a._request=d;a._postBackElement=c;a._updatePanelsToUpdate=b};e.prototype={get_postBackElement:function(){return this._postBackElement},get_request:function(){return this._request},get_updatePanelsToUpdate:function(){return this._updatePanelsToUpdate?Array.clone(this._updatePanelsToUpdate):[]}};e.registerClass("Sys.WebForms.BeginRequestEventArgs",Sys.EventArgs);e=Sys.WebForms.EndRequestEventArgs=function(e,c,d){var a=this;Sys.WebForms.EndRequestEventArgs.initializeBase(a);a._errorHandled=b;a._error=e;a._dataItems=c||{};a._response=d};e.prototype={get_dataItems:function(){return this._dataItems},get_error:function(){return this._error},get_errorHandled:function(){return this._errorHandled},set_errorHandled:function(a){this._errorHandled=a},get_response:function(){return this._response}};e.registerClass("Sys.WebForms.EndRequestEventArgs",Sys.EventArgs);e=Sys.WebForms.InitializeRequestEventArgs=function(d,c,b){var a=this;Sys.WebForms.InitializeRequestEventArgs.initializeBase(a);a._request=d;a._postBackElement=c;a._updatePanelsToUpdate=b};e.prototype={get_postBackElement:function(){return this._postBackElement},get_request:function(){return this._request},get_updatePanelsToUpdate:function(){return this._updatePanelsToUpdate?Array.clone(this._updatePanelsToUpdate):[]},set_updatePanelsToUpdate:function(a){this._updated=c;this._updatePanelsToUpdate=a}};e.registerClass("Sys.WebForms.InitializeRequestEventArgs",Sys.CancelEventArgs);e=Sys.WebForms.PageLoadedEventArgs=function(c,b,d){var a=this;Sys.WebForms.PageLoadedEventArgs.initializeBase(a);a._panelsUpdated=c;a._panelsCreated=b;a._dataItems=d||{}};e.prototype={get_dataItems:function(){return this._dataItems},get_panelsCreated:function(){return this._panelsCreated},get_panelsUpdated:function(){return this._panelsUpdated}};e.registerClass("Sys.WebForms.PageLoadedEventArgs",Sys.EventArgs);e=Sys.WebForms.PageLoadingEventArgs=function(c,b,d){var a=this;Sys.WebForms.PageLoadingEventArgs.initializeBase(a);a._panelsUpdating=c;a._panelsDeleting=b;a._dataItems=d||{}};e.prototype={get_dataItems:function(){return this._dataItems},get_panelsDeleting:function(){return this._panelsDeleting},get_panelsUpdating:function(){return this._panelsUpdating}};e.registerClass("Sys.WebForms.PageLoadingEventArgs",Sys.EventArgs);e=Sys._ScriptLoaderTask=function(b,a){this._scriptElement=b;this._completedCallback=a};e.prototype={get_scriptElement:function(){return this._scriptElement},dispose:function(){var b=this;if(b._disposed)return;b._disposed=c;b._removeScriptElementHandlers();Sys._ScriptLoaderTask._clearScript(b._scriptElement);b._scriptElement=a},execute:function(){this._addScriptElementHandlers();document.getElementsByTagName("head")[0].appendChild(this._scriptElement)},_addScriptElementHandlers:function(){var a=this;a._scriptLoadDelegate=Function.createDelegate(a,a._scriptLoadHandler);if(document.addEventListener){a._scriptElement.readyState="loaded";$addHandler(a._scriptElement,i,a._scriptLoadDelegate)}else $addHandler(a._scriptElement,t,a._scriptLoadDelegate);if(a._scriptElement.addEventListener){a._scriptErrorDelegate=Function.createDelegate(a,a._scriptErrorHandler);a._scriptElement.addEventListener(l,a._scriptErrorDelegate,b)}},_removeScriptElementHandlers:function(){var c=this;if(c._scriptLoadDelegate){var d=c.get_scriptElement();if(document.addEventListener)$removeHandler(d,i,c._scriptLoadDelegate);else $removeHandler(d,t,c._scriptLoadDelegate);if(c._scriptErrorDelegate){c._scriptElement.removeEventListener(l,c._scriptErrorDelegate,b);c._scriptErrorDelegate=a}c._scriptLoadDelegate=a}},_scriptErrorHandler:function(){if(this._disposed)return;this._completedCallback(this.get_scriptElement(),b)},_scriptLoadHandler:function(){if(this._disposed)return;var a=this.get_scriptElement();if(a.readyState!=="loaded"&&a.readyState!=="complete")return;this._completedCallback(a,c)}};e.registerClass("Sys._ScriptLoaderTask",a,Sys.IDisposable);e._clearScript=function(a){!Sys.Debug.isDebug&&a.parentNode.removeChild(a)};e=Sys._ScriptLoader=function(){var b=this;b._scriptsToLoad=a;b._sessions=[];b._scriptLoadedDelegate=Function.createDelegate(b,b._scriptLoadedHandler)};e.prototype={dispose:function(){var c=this;c._stopSession();c._loading=b;if(c._events)delete c._events;c._sessions=a;c._currentSession=a;c._scriptLoadedDelegate=a},loadScripts:function(f,d,e,c){var b=this,g={allScriptsLoadedCallback:d,scriptLoadFailedCallback:e,scriptLoadTimeoutCallback:c,scriptsToLoad:b._scriptsToLoad,scriptTimeout:f};b._scriptsToLoad=a;b._sessions.push(g);!b._loading&&b._nextSession()},queueCustomScriptTag:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,a)},queueScriptBlock:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{text:a})},queueScriptReference:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{src:a})},_createScriptElement:function(b){var a=document.createElement(m);a.type="text/javascript";for(var c in b)a[c]=b[c];return a},_loadScriptsInternal:function(){var a=this,c=a._currentSession;if(c.scriptsToLoad&&c.scriptsToLoad.length>0){var d=Array.dequeue(c.scriptsToLoad),b=a._createScriptElement(d);if(b.text&&Sys.Browser.agent===Sys.Browser.Safari){b.innerHTML=b.text;delete b.text}if(typeof d.src==="string"){a._currentTask=new Sys._ScriptLoaderTask(b,a._scriptLoadedDelegate);a._currentTask.execute()}else{document.getElementsByTagName("head")[0].appendChild(b);Sys._ScriptLoaderTask._clearScript(b);a._loadScriptsInternal()}}else{a._stopSession();var e=c.allScriptsLoadedCallback;e&&e(a);a._nextSession()}},_nextSession:function(){var d=this;if(d._sessions.length===0){d._loading=b;d._currentSession=a;return}d._loading=c;var e=Array.dequeue(d._sessions);d._currentSession=e;if(e.scriptTimeout>0)d._timeoutCookie=window.setTimeout(Function.createDelegate(d,d._scriptLoadTimeoutHandler),e.scriptTimeout*1e3);d._loadScriptsInternal()},_raiseError:function(){var a=this,d=a._currentSession.scriptLoadFailedCallback,c=a._currentTask.get_scriptElement();a._stopSession();if(d){d(a,c);a._nextSession()}else{a._loading=b;throw Sys._ScriptLoader._errorScriptLoadFailed(c.src);}},_scriptLoadedHandler:function(c,d){var b=this;if(d){Array.add(Sys._ScriptLoader._getLoadedScripts(),c.src);b._currentTask.dispose();b._currentTask=a;b._loadScriptsInternal()}else b._raiseError()},_scriptLoadTimeoutHandler:function(){var a=this,b=a._currentSession.scriptLoadTimeoutCallback;a._stopSession();b&&b(a);a._nextSession()},_stopSession:function(){var b=this;if(b._timeoutCookie){window.clearTimeout(b._timeoutCookie);b._timeoutCookie=a}if(b._currentTask){b._currentTask.dispose();b._currentTask=a}}};e.registerClass("Sys._ScriptLoader",a,Sys.IDisposable);e.getInstance=function(){var a=Sys._ScriptLoader._activeInstance;if(!a)a=Sys._ScriptLoader._activeInstance=new Sys._ScriptLoader;return a};e.isScriptLoaded=function(b){var a=document.createElement(m);a.src=b;return Array.contains(Sys._ScriptLoader._getLoadedScripts(),a.src)};e.readLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts)for(var c=Sys._ScriptLoader._referencedScripts=[],d=document.getElementsByTagName(m),b=d.length-1;b>=0;b--){var e=d[b],a=e.src;if(a.length)!Array.contains(c,a)&&Array.add(c,a)}};e._errorScriptLoadFailed=function(b){var a;a=Sys.Res.scriptLoadFailed;var d="Sys.ScriptLoadFailedException: "+String.format(a,b),c=Error.create(d,{name:"Sys.ScriptLoadFailedException",scriptUrl:b});c.popStackFrame();return c};e._getLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){Sys._ScriptLoader._referencedScripts=[];Sys._ScriptLoader.readLoadedScripts()}return Sys._ScriptLoader._referencedScripts};e=Sys.WebForms.PageRequestManager=function(){var c=this;c._form=a;c._activeDefaultButton=a;c._activeDefaultButtonClicked=b;c._updatePanelIDs=a;c._updatePanelClientIDs=a;c._updatePanelHasChildrenAsTriggers=a;c._asyncPostBackControlIDs=a;c._asyncPostBackControlClientIDs=a;c._postBackControlIDs=a;c._postBackControlClientIDs=a;c._scriptManagerID=a;c._pageLoadedHandler=a;c._additionalInput=a;c._onsubmit=a;c._onSubmitStatements=[];c._originalDoPostBack=a;c._originalDoPostBackWithOptions=a;c._originalFireDefaultButton=a;c._originalDoCallback=a;c._isCrossPost=b;c._postBackSettings=a;c._request=a;c._onFormSubmitHandler=a;c._onFormElementClickHandler=a;c._onWindowUnloadHandler=a;c._asyncPostBackTimeout=a;c._controlIDToFocus=a;c._scrollPosition=a;c._processingRequest=b;c._scriptDisposes={};c._transientFields=["__VIEWSTATEENCRYPTED","__VIEWSTATEFIELDCOUNT"]};e.prototype={get_isInAsyncPostBack:function(){return this._request!==a},add_beginRequest:function(a){Sys.Observer.addEventHandler(this,n,a)},remove_beginRequest:function(a){Sys.Observer.removeEventHandler(this,n,a)},add_endRequest:function(a){Sys.Observer.addEventHandler(this,o,a)},remove_endRequest:function(a){Sys.Observer.removeEventHandler(this,o,a)},add_initializeRequest:function(a){Sys.Observer.addEventHandler(this,p,a)},remove_initializeRequest:function(a){Sys.Observer.removeEventHandler(this,p,a)},add_pageLoaded:function(a){Sys.Observer.addEventHandler(this,q,a)},remove_pageLoaded:function(a){Sys.Observer.removeEventHandler(this,q,a)},add_pageLoading:function(a){Sys.Observer.addEventHandler(this,r,a)},remove_pageLoading:function(a){Sys.Observer.removeEventHandler(this,r,a)},abortPostBack:function(){var b=this;if(!b._processingRequest&&b._request){b._request.get_executor().abort();b._request=a}},beginAsyncPostBack:function(h,e,k,i,j){var d=this;if(i&&typeof Page_ClientValidate===u&&!Page_ClientValidate(j||a))return;d._postBackSettings=d._createPostBackSettings(c,h,e);var g=d._form;g.__EVENTTARGET.value=e||f;g.__EVENTARGUMENT.value=k||f;d._isCrossPost=b;d._additionalInput=a;d._onFormSubmit()},_cancelPendingCallbacks:function(){for(var b=0,g=window.__pendingCallbacks.length;b";a=b.childNodes[0];a._isContained=c;a.id=a.name=d;a.value=e},_createPageRequestManagerTimeoutError:function(){var b="Sys.WebForms.PageRequestManagerTimeoutException: "+Sys.WebForms.Res.PRM_TimeoutError,a=Error.create(b,{name:"Sys.WebForms.PageRequestManagerTimeoutException"});a.popStackFrame();return a},_createPageRequestManagerServerError:function(a,d){var c="Sys.WebForms.PageRequestManagerServerErrorException: "+(d||String.format(Sys.WebForms.Res.PRM_ServerError,a)),b=Error.create(c,{name:"Sys.WebForms.PageRequestManagerServerErrorException",httpStatusCode:a});b.popStackFrame();return b},_createPageRequestManagerParserError:function(b){var c="Sys.WebForms.PageRequestManagerParserErrorException: "+String.format(Sys.WebForms.Res.PRM_ParserError,b),a=Error.create(c,{name:"Sys.WebForms.PageRequestManagerParserErrorException"});a.popStackFrame();return a},_createPanelID:function(e,b){var c=b.asyncTarget,a=this._ensureUniqueIds(e||b.panelsToUpdate),d=a instanceof Array?a.join(","):a||this._scriptManagerID;if(c)d+="|"+c;return encodeURIComponent(this._scriptManagerID)+h+encodeURIComponent(d)+"&"},_createPostBackSettings:function(d,a,c,b){return{async:d,asyncTarget:c,panelsToUpdate:a,sourceElement:b}},_convertToClientIDs:function(a,g,e,d){if(a)for(var b=0,i=a.length;bd?this._updatePanelIDs[e]:f)}return c},_findNearestElement:function(b){while(b.length>0){var f=this._uniqueIDToClientID(b),e=document.getElementById(f);if(e)return e;var c=b.lastIndexOf("$");if(c===d)return a;b=b.substring(0,c)}return a},_findText:function(b,a){var c=Math.max(0,a-20),d=Math.min(b.length,a+20);return b.substring(c,d)},_fireDefaultButton:function(d,h){if(d.keyCode===13){var f=d.srcElement||d.target;if(!f||f.tagName.toLowerCase()!=="textarea"){var e=document.getElementById(h);if(e&&typeof e.click!==g){this._activeDefaultButton=e;this._activeDefaultButtonClicked=b;try{e.click()}finally{this._activeDefaultButton=a}d.cancelBubble=c;typeof d.stopPropagation===u&&d.stopPropagation();return b}}}return c},_getPageLoadedEventArgs:function(r,g){var q=[],p=[],o=g?g.version4:b,h=g?g.updatePanelData:a,i,k,l,e;if(!h){i=this._updatePanelIDs;k=this._updatePanelClientIDs;l=a;e=a}else{i=h.updatePanelIDs;k=h.updatePanelClientIDs;l=h.childUpdatePanelIDs;e=h.panelsToRefreshIDs}var c,j,n,m;if(e)for(c=0,j=e.length;cd)&&Array.add(k,document.getElementById(n[a]))}return new Sys.WebForms.PageLoadingEventArgs(l,k,h.dataItems)},_getPostBackSettings:function(f,h){var e=this,i=f,g=a;while(f){if(f.id){if(!g&&Array.contains(e._asyncPostBackControlClientIDs,f.id))g=e._createPostBackSettings(c,a,h,i);else if(!g&&Array.contains(e._postBackControlClientIDs,f.id))return e._createPostBackSettings(b);else{var j=Array.indexOf(e._updatePanelClientIDs,f.id);if(j!==d)return e._updatePanelHasChildrenAsTriggers[j]?e._createPostBackSettings(c,[e._updatePanelIDs[j]],h,i):e._createPostBackSettings(c,a,h,i)}if(!g&&e._matchesParentIDInList(f.id,e._asyncPostBackControlClientIDs))g=e._createPostBackSettings(c,a,h,i);else if(!g&&e._matchesParentIDInList(f.id,e._postBackControlClientIDs))return e._createPostBackSettings(b)}f=f.parentNode}return!g?e._createPostBackSettings(b):g},_getScrollPosition:function(){var b=this,a=document.documentElement;if(a&&(b._validPosition(a.scrollLeft)||b._validPosition(a.scrollTop)))return{x:a.scrollLeft,y:a.scrollTop};else{a=document.body;return a&&(b._validPosition(a.scrollLeft)||b._validPosition(a.scrollTop))?{x:a.scrollLeft,y:a.scrollTop}:b._validPosition(window.pageXOffset)||b._validPosition(window.pageYOffset)?{x:window.pageXOffset,y:window.pageYOffset}:{x:0,y:0}}},_initializeInternal:function(k,l,d,e,h,f,g){var b=this;if(b._prmInitialized)throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice);b._prmInitialized=c;b._masterPageUniqueID=g;b._scriptManagerID=k;b._form=Sys.UI.DomElement.resolveElement(l);b._onsubmit=b._form.onsubmit;b._form.onsubmit=a;b._onFormSubmitHandler=Function.createDelegate(b,b._onFormSubmit);b._onFormElementClickHandler=Function.createDelegate(b,b._onFormElementClick);b._onWindowUnloadHandler=Function.createDelegate(b,b._onWindowUnload);Sys.UI.DomEvent.addHandler(b._form,j,b._onFormSubmitHandler);Sys.UI.DomEvent.addHandler(b._form,"click",b._onFormElementClickHandler);Sys.UI.DomEvent.addHandler(window,"unload",b._onWindowUnloadHandler);b._originalDoPostBack=window.__doPostBack;if(b._originalDoPostBack)window.__doPostBack=Function.createDelegate(b,b._doPostBack);b._originalDoPostBackWithOptions=window.WebForm_DoPostBackWithOptions;if(b._originalDoPostBackWithOptions)window.WebForm_DoPostBackWithOptions=Function.createDelegate(b,b._doPostBackWithOptions);b._originalFireDefaultButton=window.WebForm_FireDefaultButton;if(b._originalFireDefaultButton)window.WebForm_FireDefaultButton=Function.createDelegate(b,b._fireDefaultButton);b._originalDoCallback=window.WebForm_DoCallback;if(b._originalDoCallback)window.WebForm_DoCallback=Function.createDelegate(b,b._doCallback);b._pageLoadedHandler=Function.createDelegate(b,b._pageLoadedInitialLoad);Sys.UI.DomEvent.addHandler(window,i,b._pageLoadedHandler);d&&b._updateControls(d,e,h,f,c)},_matchesParentIDInList:function(e,d){for(var a=0,f=d.length;a=g.length){j=h._findText(g,g.length);break}J=g.substr(f,o);f+=o;if(g.charAt(f)!=="|"){j=h._findText(g,f);break}f++;Array.add(p,{type:K,id:L,content:J})}if(j){h._endPostBack(h._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails,j)),n,a);return a}for(var D=[],B=[],v=[],C=[],y=[],I=[],G=[],F=[],A=[],x=[],r,u,z,s,t,w,E,m,q=0,M=p.length;q=4)e.content=unescape(e.content);if(Sys.Browser.agent===Sys.Browser.InternetExplorer){var k=document.createElement("a");k.style.display="none";k.attachEvent("onclick",H);k.href=e.content;h._form.parentNode.insertBefore(k,h._form);k.click();k.detachEvent("onclick",H);h._form.parentNode.removeChild(k);function H(a){a.cancelBubble=c}}else window.location.href=e.content;return a;case l:h._endPostBack(h._createPageRequestManagerServerError(Number.parseInvariant(e.id),e.content),n,a);return a;case"pageTitle":document.title=e.content;break;case"focus":h._controlIDToFocus=e.content;break;default:h._endPostBack(h._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_UnknownToken,e.type)),n,a);return a}}return{version4:m?parseFloat(m.content)>=4:b,executor:n,updatePanelNodes:D,hiddenFieldNodes:B,arrayDeclarationNodes:v,scriptBlockNodes:C,scriptStartupNodes:y,expandoNodes:I,onSubmitNodes:G,dataItemNodes:F,dataItemJsonNodes:A,scriptDisposeNodes:x,asyncPostBackControlIDsNode:r,postBackControlIDsNode:u,updatePanelIDsNode:z,asyncPostBackTimeoutNode:s,childUpdatePanelIDsNode:t,panelsToRefreshNode:w,formActionNode:E}},_processUpdatePanelArrays:function(e,r,s,g){var d,c,b;if(e){var j=e.length,k=g?2:1;d=new Array(j/k);c=new Array(j/k);b=new Array(j/k);for(var h=0,i=0;h