1//---------------------------------------------------------- 2// Copyright (C) Microsoft Corporation. All rights reserved. 3//---------------------------------------------------------- 4// MicrosoftAjax.js 5Function.__typeName="Function";Function.__class=true;Function.createCallback=function(b,a){return function(){var e=arguments.length;if(e>0){var d=[];for(var c=0;c<e;c++)d[c]=arguments[c];d[e]=a;return b.apply(this,d)}return b.call(this,a)}};Function.createDelegate=function(a,b){return function(){return b.apply(a,arguments)}};Function.emptyFunction=Function.emptyMethod=function(){};Function.validateParameters=function(c,b,a){return Function._validateParams(c,b,a)};Function._validateParams=function(g,e,c){var a,d=e.length;c=c||typeof c==="undefined";a=Function._validateParameterCount(g,e,c);if(a){a.popStackFrame();return a}for(var b=0,i=g.length;b<i;b++){var f=e[Math.min(b,d-1)],h=f.name;if(f.parameterArray)h+="["+(b-d+1)+"]";else if(!c&&b>=d)break;a=Function._validateParameter(g[b],f,h);if(a){a.popStackFrame();return a}}return null};Function._validateParameterCount=function(j,d,i){var a,c,b=d.length,e=j.length;if(e<b){var f=b;for(a=0;a<b;a++){var g=d[a];if(g.optional||g.parameterArray)f--}if(e<f)c=true}else if(i&&e>b){c=true;for(a=0;a<b;a++)if(d[a].parameterArray){c=false;break}}if(c){var h=Error.parameterCount();h.popStackFrame();return h}return null};Function._validateParameter=function(c,a,h){var b,g=a.type,l=!!a.integer,k=!!a.domElement,m=!!a.mayBeNull;b=Function._validateParameterType(c,g,l,k,m,h);if(b){b.popStackFrame();return b}var e=a.elementType,f=!!a.elementMayBeNull;if(g===Array&&typeof c!=="undefined"&&c!==null&&(e||!f)){var j=!!a.elementInteger,i=!!a.elementDomElement;for(var d=0;d<c.length;d++){var n=c[d];b=Function._validateParameterType(n,e,j,i,f,h+"["+d+"]");if(b){b.popStackFrame();return b}}}return null};Function._validateParameterType=function(b,c,k,j,h,d){var a,g;if(typeof b==="undefined")if(h)return null;else{a=Error.argumentUndefined(d);a.popStackFrame();return a}if(b===null)if(h)return null;else{a=Error.argumentNull(d);a.popStackFrame();return a}if(c&&c.__enum){if(typeof b!=="number"){a=Error.argumentType(d,Object.getType(b),c);a.popStackFrame();return a}if(b%1===0){var e=c.prototype;if(!c.__flags||b===0){for(g in e)if(e[g]===b)return null}else{var i=b;for(g in e){var f=e[g];if(f===0)continue;if((f&b)===f)i-=f;if(i===0)return null}}}a=Error.argumentOutOfRange(d,b,String.format(Sys.Res.enumInvalidValue,b,c.getName()));a.popStackFrame();return a}if(j&&(!Sys._isDomElement(b)||b.nodeType===3)){a=Error.argument(d,Sys.Res.argumentDomElement);a.popStackFrame();return a}if(c&&!Sys._isInstanceOfType(c,b)){a=Error.argumentType(d,Object.getType(b),c);a.popStackFrame();return a}if(c===Number&&k)if(b%1!==0){a=Error.argumentOutOfRange(d,b,Sys.Res.argumentInteger);a.popStackFrame();return a}return null};Error.__typeName="Error";Error.__class=true;Error.create=function(d,b){var a=new Error(d);a.message=d;if(b)for(var c in b)a[c]=b[c];a.popStackFrame();return a};Error.argument=function(a,c){var b="Sys.ArgumentException: "+(c?c:Sys.Res.argument);if(a)b+="\n"+String.format(Sys.Res.paramName,a);var d=Error.create(b,{name:"Sys.ArgumentException",paramName:a});d.popStackFrame();return d};Error.argumentNull=function(a,c){var b="Sys.ArgumentNullException: "+(c?c:Sys.Res.argumentNull);if(a)b+="\n"+String.format(Sys.Res.paramName,a);var d=Error.create(b,{name:"Sys.ArgumentNullException",paramName:a});d.popStackFrame();return d};Error.argumentOutOfRange=function(c,a,d){var b="Sys.ArgumentOutOfRangeException: "+(d?d:Sys.Res.argumentOutOfRange);if(c)b+="\n"+String.format(Sys.Res.paramName,c);if(typeof a!=="undefined"&&a!==null)b+="\n"+String.format(Sys.Res.actualValue,a);var e=Error.create(b,{name:"Sys.ArgumentOutOfRangeException",paramName:c,actualValue:a});e.popStackFrame();return e};Error.argumentType=function(d,c,b,e){var a="Sys.ArgumentTypeException: ";if(e)a+=e;else if(c&&b)a+=String.format(Sys.Res.argumentTypeWithTypes,c.getName(),b.getName());else a+=Sys.Res.argumentType;if(d)a+="\n"+String.format(Sys.Res.paramName,d);var f=Error.create(a,{name:"Sys.ArgumentTypeException",paramName:d,actualType:c,expectedType:b});f.popStackFrame();return f};Error.argumentUndefined=function(a,c){var b="Sys.ArgumentUndefinedException: "+(c?c:Sys.Res.argumentUndefined);if(a)b+="\n"+String.format(Sys.Res.paramName,a);var d=Error.create(b,{name:"Sys.ArgumentUndefinedException",paramName:a});d.popStackFrame();return d};Error.format=function(a){var c="Sys.FormatException: "+(a?a:Sys.Res.format),b=Error.create(c,{name:"Sys.FormatException"});b.popStackFrame();return b};
5Error.invalidOperation=function(a){var c="Sys.InvalidOperationException: "+(a?a:Sys.Res.invalidOperation),b=Error.create(c,{name:"Sys.InvalidOperationException"});b.popStackFrame();return b};Error.notImplemented=function(a){var c="Sys.NotImplementedException: "+(a?a:Sys.Res.notImplemented),b=Error.create(c,{name:"Sys.NotImplementedException"});b.popStackFrame();return b};Error.parameterCount=function(a){var c="Sys.ParameterCountException: "+(a?a:Sys.Res.parameterCount),b=Error.create(c,{name:"Sys.ParameterCountException"});b.popStackFrame();return b};Error.prototype.popStackFrame=function(){if(typeof this.stack==="undefined"||this.stack===null||typeof this.fileName==="undefined"||this.fileName===null||typeof this.lineNumber==="undefined"||this.lineNumber===null)return;var a=this.stack.split("\n"),c=a[0],e=this.fileName+":"+this.lineNumber;while(typeof c!=="undefined"&&c!==null&&c.indexOf(e)===-1){a.shift();c=a[0]}var d=a[1];if(typeof d==="undefined"||d===null)return;var b=d.match(/@(.*):(\d+)$/);if(typeof b==="undefined"||b===null)return;this.fileName=b[1];this.lineNumber=parseInt(b[2]);a.shift();this.stack=a.join("\n")};Object.__typeName="Object";Object.__class=true;
5Object.getType=function(b){var a=b.constructor;if(!a||typeof a!=="function"||!a.__typeName||a.__typeName==="Object")return Object;return a};Object.getTypeName=function(a){return Object.getType(a).getName()};String.__typeName="String";String.__class=true;String.prototype.endsWith=function(a){return this.substr(this.length-a.length)===a};String.prototype.startsWith=function(a){return this.substr(0,a.length)===a};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.trimEnd=function(){return this.replace(/\s+$/,"")};String.prototype.trimStart=function(){return this.replace(/^\s+/,"")};String.format=function(){return String._toFormattedString(false,arguments)};String._toFormattedString=function(l,j){var c="",e=j[0];for(var a=0;true;){var f=e.indexOf("{",a),d=e.indexOf("}",a);if(f<0&&d<0){c+=e.slice(a);break}if(d>0&&(d<f||f<0)){c+=e.slice(a,d+1);a=d+2;continue}c+=e.slice(a,f);a=f+1;if(e.charAt(a)==="{"){c+="{";a++;continue}if(d<0)break;var h=e.substring(a,d),g=h.indexOf(":"),k=parseInt(g<0?h:h.substring(0,g),10)+1,i=g<0?"":h.substring(g+1),b=j[k];if(typeof b==="undefined"||b===null)b="";if(b.toFormattedString)c+=b.toFormattedString(i);else if(l&&b.localeFormat)c+=b.localeFormat(i);else if(b.format)c+=b.format(i);else c+=b.toString();a=d+1}return c};Boolean.__typeName="Boolean";Boolean.__class=true;Boolean.parse=function(b){var a=b.trim().toLowerCase();if(a==="false")return false;if(a==="true")return true};Date.__typeName="Date";Date.__class=true;Number.__typeName="Number";Number.__class=true;RegExp.__typeName="RegExp";RegExp.__class=true;if(!window)this.window=this;window.Type=Function;Type.prototype.callBaseMethod=function(a,d,b){var c=Sys._getBaseMethod(this,a,d);if(!b)return c.apply(a);else return c.apply(a,b)};Type.prototype.getBaseMethod=function(a,b){return Sys._getBaseMethod(this,a,b)};Type.prototype.getBaseType=function(){return typeof this.__baseType==="undefined"?null:this.__baseType};Type.prototype.getInterfaces=function(){var a=[],b=this;while(b){var c=b.__interfaces;if(c)for(var d=0,f=c.length;d<f;d++){var e=c[d];if(!Array.contains(a,e))a[a.length]=e}b=b.__baseType}return a};Type.prototype.getName=function(){return typeof this.__typeName==="undefined"?"":this.__typeName};Type.prototype.implementsInterface=function(d){this.resolveInheritance();var c=d.getName(),a=this.__interfaceCache;if(a){var e=a[c];if(typeof e!=="undefined")return e}else a=this.__interfaceCache={};var b=this;while(b){var f=b.__interfaces;if(f)if(Array.indexOf(f,d)!==-1)return a[c]=true;b=b.__baseType}return a[c]=false};Type.prototype.inheritsFrom=function(b){this.resolveInheritance();var a=this.__baseType;while(a){if(a===b)return true;a=a.__baseType}return false};Type.prototype.initializeBase=function(a,b){this.resolveInheritance();if(this.__baseType)if(!b)this.__baseType.apply(a);else this.__baseType.apply(a,b);return a};Type.prototype.isImplementedBy=function(a){if(typeof a==="undefined"||a===null)return false;var b=Object.getType(a);return !!(b.implementsInterface&&b.implementsInterface(this))};Type.prototype.isInstanceOfType=function(a){return Sys._isInstanceOfType(this,a)};Type.prototype.registerClass=function(c,b,d){this.prototype.constructor=this;this.__typeName=c;this.__class=true;if(b){this.__baseType=b;this.__basePrototypePending=true}Sys.__upperCaseTypes[c.toUpperCase()]=this;if(d){this.__interfaces=[];for(var a=2,f=arguments.length;a<f;a++){var e=arguments[a];this.__interfaces.push(e)}}return this};Type.prototype.registerInterface=function(a){Sys.__upperCaseTypes[a.toUpperCase()]=this;this.prototype.constructor=this;this.__typeName=a;this.__interface=true;return this};Type.prototype.resolveInheritance=function(){if(this.__basePrototypePending){var b=this.__baseType;b.resolveInheritance();for(var a in b.prototype){var c=b.prototype[a];if(!this.prototype[a])this.prototype[a]=c}delete this.__basePrototypePending}};Type.getRootNamespaces=function(){return Array.clone(Sys.__rootNamespaces)};Type.isClass=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__class};
5Type.isInterface=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__interface};Type.isNamespace=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__namespace};Type.parse=function(typeName,ns){var fn;if(ns){fn=Sys.__upperCaseTypes[ns.getName().toUpperCase()+"."+typeName.toUpperCase()];return fn||null}if(!typeName)return null;if(!Type.__htClasses)Type.__htClasses={};fn=Type.__htClasses[typeName];if(!fn){fn=eval(typeName);Type.__htClasses[typeName]=fn}return fn};Type.registerNamespace=function(e){var d=window,c=e.split(".");for(var b=0;b<c.length;b++){var f=c[b],a=d[f];if(!a)a=d[f]={};if(!a.__namespace){if(b===0&&e!=="Sys")Sys.__rootNamespaces[Sys.__rootNamespaces.length]=a;a.__namespace=true;a.__typeName=c.slice(0,b+1).join(".");a.getName=function(){return this.__typeName}}d=a}};Type._checkDependency=function(c,a){var d=Type._registerScript._scripts,b=d?!!d[c]:false;if(typeof a!=="undefined"&&!b)throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,a,c));return b};Type._registerScript=function(a,c){var b=Type._registerScript._scripts;if(!b)Type._registerScript._scripts=b={};if(b[a])throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded,a));b[a]=true;if(c)for(var d=0,f=c.length;d<f;d++){var e=c[d];if(!Type._checkDependency(e))throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound,a,e))}};Type.registerNamespace("Sys");Sys.__upperCaseTypes={};Sys.__rootNamespaces=[Sys];Sys._isInstanceOfType=function(c,b){if(typeof b==="undefined"||b===null)return false;if(b instanceof c)return true;var a=Object.getType(b);return !!(a===c)||a.inheritsFrom&&a.inheritsFrom(c)||a.implementsInterface&&a.implementsInterface(c)};Sys._getBaseMethod=function(d,e,c){var b=d.getBaseType();if(b){var a=b.prototype[c];return a instanceof Function?a:null}return null};Sys._isDomElement=function(a){var c=false;if(typeof a.nodeType!=="number"){var b=a.ownerDocument||a.document||a;if(b!=a){var d=b.defaultView||b.parentWindow;c=d!=a}else c=typeof b.body==="undefined"}return !c};Array.__typeName="Array";Array.__class=true;Array.add=Array.enqueue=function(a,b){a[a.length]=b};Array.addRange=function(a,b){a.push.apply(a,b)};Array.clear=function(a){a.length=0};Array.clone=function(a){if(a.length===1)return [a[0]];else return Array.apply(null,a)};Array.contains=function(a,b){return Sys._indexOf(a,b)>=0};Array.dequeue=function(a){return a.shift()};Array.forEach=function(b,e,d){for(var a=0,f=b.length;a<f;a++){var c=b[a];if(typeof c!=="undefined")e.call(d,c,a,b)}};Array.indexOf=function(a,c,b){return Sys._indexOf(a,c,b)};Array.insert=function(a,b,c){a.splice(b,0,c)};Array.parse=function(value){if(!value)return [];return eval(value)};Array.remove=function(b,c){var a=Sys._indexOf(b,c);if(a>=0)b.splice(a,1);return a>=0};Array.removeAt=function(a,b){a.splice(b,1)};Sys._indexOf=function(d,e,a){if(typeof e==="undefined")return -1;var c=d.length;if(c!==0){a=a-0;if(isNaN(a))a=0;else{if(isFinite(a))a=a-a%1;if(a<0)a=Math.max(0,c+a)}for(var b=a;b<c;b++)if(typeof d[b]!=="undefined"&&d[b]===e)return b}return -1};Type._registerScript._scripts={"MicrosoftAjaxCore.js":true,"MicrosoftAjaxGlobalization.js":true,"MicrosoftAjaxSerialization.js":true,"MicrosoftAjaxComponentModel.js":true,"MicrosoftAjaxHistory.js":true,"MicrosoftAjaxNetwork.js":true,"MicrosoftAjaxWebServices.js":true};Sys.IDisposable=function(){};Sys.IDisposable.prototype={};Sys.IDisposable.registerInterface("Sys.IDisposable");Sys.StringBuilder=function(a){this._parts=typeof a!=="undefined"&&a!==null&&a!==""?[a.toString()]:[];this._value={};this._len=0};Sys.StringBuilder.prototype={append:function(a){this._parts[this._parts.length]=a},appendLine:function(a){this._parts[this._parts.length]=typeof a==="undefined"||a===null||a===""?"\r\n":a+"\r\n"},clear:function(){this._parts=[];this._value={};this._len=0},isEmpty:function(){if(this._parts.length===0)return true;return this.toString()===""},toString:function(a){a=a||"";var b=this._parts;if(this._len!==b.length){this._value={};this._len=b.length}var d=this._value;if(typeof d[a]==="undefined"){if(a!=="")for(var c=0;c<b.length;)if(typeof b[c]==="undefined"||b[c]===""||b[c]===null)b.splice(c,1);else c++;d[a]=this._parts.join(a)}return d[a]}};Sys.StringBuilder.registerClass("Sys.StringBuilder");Sys.Browser={};Sys.Browser.InternetExplorer={};Sys.Browser.Firefox={};Sys.Browser.Safari={};Sys.Browser.Opera={};Sys.Browser.agent=null;Sys.Browser.hasDebuggerStatement=false;Sys.Browser.name=navigator.appName;Sys.Browser.version=parseFloat(navigator.appVersion);Sys.Browser.documentMode=0;if(navigator.userAgent.indexOf(" MSIE ")>-1){Sys.Browser.agent=Sys.Browser.InternetExplorer;Sys.Browser.version=parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);if(Sys.Browser.version>=8)if(document.documentMode>=7)Sys.Browser.documentMode=document.documentMode;Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" Firefox/")>-1){Sys.Browser.agent=Sys.Browser.Firefox;Sys.Browser.version=parseFloat(navigator.userAgent.match(/Firefox\/(\d+\.\d+)/)[1]);Sys.Browser.name="Firefox";Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" AppleWebKit/")>-1){Sys.Browser.agent=Sys.Browser.Safari;Sys.Browser.version=parseFloat(navigator.userAgent.match(/AppleWeb
5Kit\/(\d+(\.\d+)?)/)[1]);Sys.Browser.name="Safari"}else if(navigator.userAgent.indexOf("Opera/")>-1)Sys.Browser.agent=Sys.Browser.Opera;Sys.EventArgs=function(){};Sys.EventArgs.registerClass("Sys.EventArgs");Sys.EventArgs.Empty=new Sys.EventArgs;Sys.CancelEventArgs=function(){Sys.CancelEventArgs.initializeBase(this);this._cancel=false};Sys.CancelEventArgs.prototype={get_cancel:function(){return this._cancel},set_cancel:function(a){this._cancel=a}};Sys.CancelEventArgs.registerClass("Sys.CancelEventArgs",Sys.EventArgs);Type.registerNamespace("Sys.UI");Sys._Debug=function(){};Sys._Debug.prototype={_appendConsole:function(a){if(typeof Debug!=="undefined"&&Debug.writeln)Debug.writeln(a);if(window.console&&window.console.log)window.console.log(a);if(window.opera)window.opera.postError(a);if(window.debugService)window.debugService.trace(a)},_appendTrace:function(b){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value+=b+"\n"},assert:function(c,a,b){if(!c){a=b&&this.assert.caller?String.format(Sys.Res.assertFailedCaller,a,this.assert.caller):String.format(Sys.Res.assertFailed,a);if(confirm(String.format(Sys.Res.breakIntoDebugger,a)))this.fail(a)}},clearTrace:function(){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value=""},fail:function(message){this._appendConsole(message);if(Sys.Browser.hasDebuggerStatement)eval("debugger")},trace:function(a){this._appendConsole(a);this._appendTrace(a)},traceDump:function(a,b){var c=this._traceDump(a,b,true)},_traceDump:function(a,c,f,b,d){c=c?c:"traceDump";b=b?b:"";if(a===null){this.trace(b+c+": null");return}switch(typeof a){case "undefined":this.trace(b+c+": Undefined");break;case "number":case "string":case "boolean":this.trace(b+c+": "+a);break;default:if(Date.isInstanceOfType(a)||RegExp.isInstanceOfType(a)){this.trace(b+c+": "+a.toString());break}if(!d)d=[];else if(Array.contains(d,a)){this.trace(b+c+": ...");return}Array.add(d,a);if(a==window||a===document||window.HTMLElement&&a instanceof HTMLElement||typeof a.nodeName==="string"){var k=a.tagName?a.tagName:"DomElement";if(a.id)k+=" - "+a.id;this.trace(b+c+" {"+k+"}")}else{var i=Object.getTypeName(a);this.trace(b+c+(typeof i==="string"?" {"+i+"}":""));if(b===""||f){b+=" ";var e,j,l,g,h;if(Array.isInstanceOfType(a)){j=a.length;for(e=0;e<j;e++)this._traceDump(a[e],"["+e+"]",f,b,d)}else for(g in a){h=a[g];if(!Function.isInstanceOfType(h))this._traceDump(h,g,f,b,d)}}}Array.remove(d,a)}}};Sys._Debug.registerClass("Sys._Debug");Sys.Debug=new Sys._Debug;Sys.Debug.isDebug=false;function Sys$Enum$parse(c,e){var a,b,i;if(e){a=this.__lowerCaseValues;if(!a){this.__lowerCaseValues=a={};var g=this.prototype;for(var f in g)a[f.toLowerCase()]=g[f]}}else a=this.prototype;if(!this.__flags){i=e?c.toLowerCase():c;b=a[i.trim()];if(typeof b!=="number")throw Error.argument("value",String.format(Sys.Res.enumInvalidValue,c,this.__typeName));return b}else{var h=(e?c.toLowerCase():c).split(","),j=0;for(var d=h.length-1;d>=0;d--){var k=h[d].trim();b=a[k];if(typeof b!=="number")throw Error.argument("value",String.format(Sys.Res.enumInvalidValue,c.split(",")[d].trim(),this.__typeName));j|=b}return j}}function Sys$Enum$toString(c){if(typeof c==="undefined"||c===null)return this.__string;var d=this.prototype,a;if(!this.__flags||c===0){for(a in d)if(d[a]===c)return a}else{var b=this.__sortedValues;if(!b){b=[];for(a in d)b[b.length]={key:a,value:d[a]};b.sort(function(a,b){return a.value-b.value});this.__sortedValues=b}var e=[],g=c;for(a=b.length-1;a>=0;a--){var h=b[a],f=h.value;if(f===0)continue;if((f&c)===f){e[e.length]=h.key;g-=f;if(g===0)break}}if(e.length&&g===0)return e.reverse().join(", ")}return ""}Type.prototype.registerEnum=function(b,c){Sys.__upperCaseTypes[b.toUpperCase()]=this;for(var a in this.prototype)this[a]=this.prototype[a];this.__typeName=b;this.parse=Sys$Enum$parse;this.__string=this.toString();this.toString=Sys$Enum$toString;this.__flags=c;this.__enum=true};Type.isEnum=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__enum};
5Type.isFlags=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__flags};Sys.CollectionChange=function(e,a,c,b,d){this.action=e;if(a)if(!(a instanceof Array))a=[a];this.newItems=a||null;if(typeof c!=="number")c=-1;this.newStartingIndex=c;if(b)if(!(b instanceof Array))b=[b];this.oldItems=b||null;if(typeof d!=="number")d=-1;this.oldStartingIndex=d};Sys.CollectionChange.registerClass("Sys.CollectionChange");Sys.NotifyCollectionChangedAction=function(){throw Error.notImplemented()};Sys.NotifyCollectionChangedAction.prototype={add:0,remove:1,reset:2};Sys.NotifyCollectionChangedAction.registerEnum("Sys.NotifyCollectionChangedAction");Sys.NotifyCollectionChangedEventArgs=function(a){this._changes=a;Sys.NotifyCollectionChangedEventArgs.initializeBase(this)};Sys.NotifyCollectionChangedEventArgs.prototype={get_changes:function(){return this._changes||[]}};Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs",Sys.EventArgs);Sys.Observer=function(){};Sys.Observer.registerClass("Sys.Observer");Sys.Observer.makeObservable=function(a){var c=a instanceof Array,b=Sys.Observer;if(a.setValue===b._observeMethods.setValue)return a;b._addMethods(a,b._observeMethods);if(c)b._addMethods(a,b._arrayMethods);return a};Sys.Observer._addMethods=function(c,b){for(var a in b)c[a]=b[a]};Sys.Observer._addEventHandler=function(c,a,b){Sys.Observer._getContext(c,true).events._addHandler(a,b)};Sys.Observer.addEventHandler=function(c,a,b){Sys.Observer._addEventHandler(c,a,b)};Sys.Observer._removeEventHandler=function(c,a,b){Sys.Observer._getContext(c,true).events._removeHandler(a,b)};Sys.Observer.removeEventHandler=function(c,a,b){Sys.Observer._removeEventHandler(c,a,b)};Sys.Observer.raiseEvent=function(b,e,d){var c=Sys.Observer._getContext(b);if(!c)return;var a=c.events.getHandler(e);if(a)a(b,d)};Sys.Observer.addPropertyChanged=function(b,a){Sys.Observer._addEventHandler(b,"propertyChanged",a)};Sys.Observer.removePropertyChanged=function(b,a){Sys.Observer._removeEventHandler(b,"propertyChanged",a)};Sys.Observer.beginUpdate=function(a){Sys.Observer._getContext(a,true).updating=true};Sys.Observer.endUpdate=function(b){var a=Sys.Observer._getContext(b);if(!a||!a.updating)return;a.updating=false;var d=a.dirty;a.dirty=false;if(d){if(b instanceof Array){var c=a.changes;a.changes=null;Sys.Observer.raiseCollectionChanged(b,c)}Sys.Observer.raisePropertyChanged(b,"")}};Sys.Observer.isUpdating=function(b){var a=Sys.Observer._getContext(b);return a?a.updating:false};Sys.Observer._setValue=function(a,j,g){var b,f,k=a,d=j.split(".");for(var i=0,m=d.length-1;i<m;i++){var l=d[i];b=a["get_"+l];if(typeof b==="function")a=b.call(a);else a=a[l];var n=typeof a;if(a===null||n==="undefined")throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath,j))}var e,c=d[m];b=a["get_"+c];f=a["set_"+c];if(typeof b==="function")e=b.call(a);else e=a[c];if(typeof f==="function")f.call(a,g);else a[c]=g;if(e!==g){var h=Sys.Observer._getContext(k);if(h&&h.updating){h.dirty=true;return}Sys.Observer.raisePropertyChanged(k,d[0])}};Sys.Observer.setValue=function(b,a,c){Sys.Observer._setValue(b,a,c)};Sys.Observer.raisePropertyChanged=function(b,a){Sys.Observer.raiseEvent(b,"propertyChanged",new Sys.PropertyChangedEventArgs(a))};Sys.Observer.addCollectionChanged=function(b,a){Sys.Observer._addEventHandler(b,"collectionChanged",a)};Sys.Observer.removeCollectionChanged=function(b,a){Sys.Observer._removeEventHandler(b,"collectionChanged",a)};Sys.Observer._collectionChange=function(d,c){var a=Sys.Observer._getContext(d);if(a&&a.updating){a.dirty=true;var b=a.changes;if(!b)a.changes=b=[c];else b.push(c)}else{Sys.Observer.raiseCollectionChanged(d,[c]);Sys.Observer.raisePropertyChanged(d,"length")}};Sys.Observer.add=function(a,b){var c=new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add,[b],a.length);Array.add(a,b);Sys.Observer._collectionChange(a,c)};Sys.Observer.addRange=function(a,b){var c=new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add,b,a.length);Array.addRange(a,b);Sys.Observer._collectionChange(a,c)};Sys.Observer.clear=function(a){var b=Array.clone(a);Array.clear(a);Sys.Observer._collectionChange(a,new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset,null,-1,b,0))};Sys.Observer.insert=function(a,b,c){Array.insert(a,b,c);Sys.Observer._collectionChange(a,new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add,[c],b))};Sys.Observer.remove=function(a,b){var c=Array.indexOf(a,b);if(c!==-1){Array.remove(a,b);Sys.Observer._collectionChange(a,new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove,null,-1,[b],c));return true}return false};Sys.Observer.removeAt=function(b,a){if(a>-1&&a<b.length){var c=b[a];Array.removeAt(b,a);Sys.Observer._collectionChange(b,new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove,null,-1,[c],a))}};Sys.Observer.raiseCollectionChanged=function(b,a){Sys.Observer.raiseEvent(b,"collectionChanged",new Sys.NotifyCollectionChangedEventArgs(a))};Sys.Observer._observeMethods={add_propertyChanged:function(a){Sys.Observer._addEventHandler(this,"propertyChanged",a)},remove_propertyChanged:function(a){Sys.Observer._removeEventHandler(this,"propertyChanged",a)},addEventHandler:function(a,b){Sys.Observer._addEventHandler(this,a,b)},removeEventHandler:function(a,b){Sys.Observer._removeEventHandler(this,a,b)},get_isUpdating:function(){return Sys.Observer.isUpdating(this)},beginUpdate:function(){Sys.Observer.beginUpdate(this)},endUpdate:function(){Sys.Observer.endUpdate(this)},setValue:function(b,a){Sys.Observer._setValue(this,b,a)},raiseEvent:function(b,a){Sys.Observer.raiseEvent(this,b,a)},raisePropertyChanged:function(a){Sys.Observer.raiseEvent(this,"propertyChanged",new Sys.PropertyChangedEventArgs(a))}};Sys.Observer._arrayMethods={add_collectionChanged:function(a){Sys.Observer._addEventHandler(this,"collectionChanged",a)},remove_collectionChanged:function(a){Sys.Observer._removeEventHandler(this,"collectionChanged",a)},add:function(a){Sys.Observer.add(this,a)},addRange:function(a){Sys.Observer.addRange(this,a)},clear:function(){Sys.Observer.clear(this)},insert:function(a,b){Sys.Observer.insert(this,a,b)},remove:function(a){return Sys.Observer.remove(this,a)},removeAt:function(a){Sys.Observer.removeAt(this,a)},raiseCollectionChanged:function(a){Sys.Observer.raiseEvent(this,"collectionChanged",new Sys.NotifyCollectionChangedEventArgs(a))}};Sys.Observer._getContext=function(b,c){var a=b._observerContext;if(a)return a();if(c)return (b._observerContext=Sys.Observer._createContext())();return null};Sys.Observer._createContext=function(){var a={events:new Sys.EventHandlerList};return function(){return a}};Date._appendPreOrPostMatch=function(e,b){var d=0,a=false;for(var c=0,g=e.length;c<g;c++){var f=e.charAt(c);
5switch(f){case "'":if(a)b.append("'");else d++;a=false;break;case "\\":if(a)b.append("\\");a=!a;break;default:b.append(f);a=false}}return d};Date._expandFormat=function(a,b){if(!b)b="F";var c=b.length;if(c===1)switch(b){case "d":return a.ShortDatePattern;case "D":return a.LongDatePattern;case "t":return a.ShortTimePattern;case "T":return a.LongTimePattern;case "f":return a.LongDatePattern+" "+a.ShortTimePattern;case "F":return a.FullDateTimePattern;case "M":case "m":return a.MonthDayPattern;case "s":return a.SortableDateTimePattern;case "Y":case "y":return a.YearMonthPattern;default:throw Error.format(Sys.Res.formatInvalidString)}else if(c===2&&b.charAt(0)==="%")b=b.charAt(1);return b};Date._expandYear=function(c,a){var d=new Date,e=Date._getEra(d);if(a<100){var b=Date._getEraYear(d,c,e);a+=b-b%100;if(a>c.Calendar.TwoDigitYearMax)a-=100}return a};Date._getEra=function(e,c){if(!c)return 0;var b,d=e.getTime();for(var a=0,f=c.length;a<f;a+=4){b=c[a+2];if(b===null||d>=b)return a}return 0};Date._getEraYear=function(d,b,e,c){var a=d.getFullYear();if(!c&&b.eras)a-=b.eras[e+3];return a};Date._getParseRegExp=function(b,e){if(!b._parseRegExp)b._parseRegExp={};else if(b._parseRegExp[e])return b._parseRegExp[e];var c=Date._expandFormat(b,e);c=c.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1");var a=new Sys.StringBuilder("^"),j=[],f=0,i=0,h=Date._getTokenRegExp(),d;while((d=h.exec(c))!==null){var l=c.slice(f,d.index);f=h.lastIndex;i+=Date._appendPreOrPostMatch(l,a);if(i%2===1){a.append(d[0]);continue}switch(d[0]){case "dddd":case "ddd":case "MMMM":case "MMM":case "gg":case "g":a.append("(\\D+)");break;case "tt":case "t":a.append("(\\D*)");break;case "yyyy":a.append("(\\d{4})");break;case "fff":a.append("(\\d{3})");break;case "ff":a.append("(\\d{2})");break;case "f":a.append("(\\d)");break;case "dd":case "d":case "MM":case "M":case "yy":case "y":case "HH":case "H":case "hh":case "h":case "mm":case "m":case "ss":case "s":a.append("(\\d\\d?)");break;case "zzz":a.append("([+-]?\\d\\d?:\\d{2})");break;case "zz":case "z":a.append("([+-]?\\d\\d?)");break;case "/":a.append("(\\"+b.DateSeparator+")")}Array.add(j,d[0])}Date._appendPreOrPostMatch(c.slice(f),a);a.append("$");var k=a.toString().replace(/\s+/g,"\\s+"),g={"regExp":k,"groups":j};b._parseRegExp[e]=g;return g};Date._getTokenRegExp=function(){return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g};Date.parseLocale=function(a){return Date._parse(a,Sys.CultureInfo.CurrentCulture,arguments)};Date.parseInvariant=function(a){return Date._parse(a,Sys.CultureInfo.InvariantCulture,arguments)};Date._parse=function(h,d,i){var a,c,b,f,e,g=false;for(a=1,c=i.length;a<c;a++){f=i[a];if(f){g=true;b=Date._parseExact(h,f,d);if(b)return b}}if(!g){e=d._getDateTimeFormats();for(a=0,c=e.length;a<c;a++){b=Date._parseExact(h,e[a],d);if(b)return b}}return null};Date._parseExact=function(w,D,k){w=w.trim();var g=k.dateTimeFormat,A=Date._getParseRegExp(g,D),C=(new RegExp(A.regExp)).exec(w);if(C===null)return null;var B=A.groups,x=null,e=null,c=null,j=null,i=null,d=0,h,p=0,q=0,f=0,l=null,v=false;for(var s=0,E=B.length;s<E;s++){var a=C[s+1];if(a)switch(B[s]){case "dd":case "d":j=parseInt(a,10);if(j<1||j>31)return null;break;case "MMMM":c=k._getMonthIndex(a);if(c<0||c>11)return null;break;case "MMM":c=k._getAbbrMonthIndex(a);if(c<0||c>11)return null;break;case "M":case "MM":c=parseInt(a,10)-1;if(c<0||c>11)return null;break;case "y":case "yy":e=Date._expandYear(g,parseInt(a,10));if(e<0||e>9999)return null;break;case "yyyy":e=parseInt(a,10);if(e<0||e>9999)return null;break;case "h":case "hh":d=parseInt(a,10);if(d===12)d=0;if(d<0||d>11)return null;break;case "H":case "HH":d=parseInt(a,10);if(d<0||d>23)return null;break;case "m":case "mm":p=parseInt(a,10);if(p<0||p>59)return null;break;case "s":case "ss":q=parseInt(a,10);if(q<0||q>59)return null;break;case "tt":case "t":var z=a.toUpperCase();v=z===g.PMDesignator.toUpperCase();if(!v&&z!==g.AMDesignator.toUpperCase())return null;break;case "f":f=parseInt(a,10)*100;if(f<0||f>999)return null;break;case "ff":f=parseInt(a,10)*10;if(f<0||f>999)return null;break;case "fff":f=parseInt(a,10);if(f<0||f>999)return null;break;case "dddd":i=k._getDayIndex(a);if(i<0||i>6)return null;break;case "ddd":i=k._getAbbrDayIndex(a);if(i<0||i>6)return null;break;case "zzz":var u=a.split(/:/);if(u.length!==2)return null;h=parseInt(u[0],10);if(h<-12||h>13)return null;var m=parseInt(u[1],10);if(m<0||m>59)return null;l=h*60+(a.startsWith("-")?-m:m);break;case "z":case "zz":h=parseInt(a,10);if(h<-12||h>13)return null;l=h*60;break;case "g":case "gg":var o=a;if(!o||!g.eras)return null;o=o.toLowerCase().trim();for(var r=0,F=g.eras.length;r<F;r+=4)if(o===g.eras[r+1].toLowerCase()){x=r;break}if(x===null)return null}}var b=new Date,t,n=g.Calendar.convert;if(n)t=n.fromGregorian(b)[0];else t=b.getFullYear();if(e===null)e=t;else if(g.eras)e+=g.eras[(x||0)+3];if(c===null)c=0;if(j===null)j=1;
5if(n){b=n.toGregorian(e,c,j);if(b===null)return null}else{b.setFullYear(e,c,j);if(b.getDate()!==j)return null;if(i!==null&&b.getDay()!==i)return null}if(v&&d<12)d+=12;b.setHours(d,p,q,f);if(l!==null){var y=b.getMinutes()-(l+b.getTimezoneOffset());b.setHours(b.getHours()+parseInt(y/60,10),y%60)}return b};Date.prototype.format=function(a){return this._toFormattedString(a,Sys.CultureInfo.InvariantCulture)};Date.prototype.localeFormat=function(a){return this._toFormattedString(a,Sys.CultureInfo.CurrentCulture)};Date.prototype._toFormattedString=function(e,j){var b=j.dateTimeFormat,n=b.Calendar.convert;if(!e||!e.length||e==="i")if(j&&j.name.length)if(n)return this._toFormattedString(b.FullDateTimePattern,j);else{var r=new Date(this.getTime()),x=Date._getEra(this,b.eras);r.setFullYear(Date._getEraYear(this,b,x));return r.toLocaleString()}else return this.toString();var l=b.eras,k=e==="s";e=Date._expandFormat(b,e);var a=new Sys.StringBuilder,c;function d(a){if(a<10)return "0"+a;return a.toString()}function m(a){if(a<10)return "00"+a;if(a<100)return "0"+a;return a.toString()}function v(a){if(a<10)return "000"+a;else if(a<100)return "00"+a;else if(a<1000)return "0"+a;return a.toString()}var h,p,t=/([^d]|^)(d|dd)([^d]|$)/g;function s(){if(h||p)return h;h=t.test(e);p=true;return h}var q=0,o=Date._getTokenRegExp(),f;if(!k&&n)f=n.fromGregorian(this);for(;true;){var w=o.lastIndex,i=o.exec(e),u=e.slice(w,i?i.index:e.length);q+=Date._appendPreOrPostMatch(u,a);if(!i)break;if(q%2===1){a.append(i[0]);continue}function g(a,b){if(f)return f[b];switch(b){case 0:return a.getFullYear();case 1:return a.getMonth();case 2:return a.getDate()}}switch(i[0]){case "dddd":a.append(b.DayNames[this.getDay()]);break;case "ddd":a.append(b.AbbreviatedDayNames[this.getDay()]);break;case "dd":h=true;a.append(d(g(this,2)));break;case "d":h=true;a.append(g(this,2));break;case "MMMM":a.append(b.MonthGenitiveNames&&s()?b.MonthGenitiveNames[g(this,1)]:b.MonthNames[g(this,1)]);break;case "MMM":a.append(b.AbbreviatedMonthGenitiveNames&&s()?b.AbbreviatedMonthGenitiveNames[g(this,1)]:b.AbbreviatedMonthNames[g(this,1)]);break;case "MM":a.append(d(g(this,1)+1));break;case "M":a.append(g(this,1)+1);break;case "yyyy":a.append(v(f?f[0]:Date._getEraYear(this,b,Date._getEra(this,l),k)));break;case "yy":a.append(d((f?f[0]:Date._getEraYear(this,b,Date._getEra(this,l),k))%100));break;case "y":a.append((f?f[0]:Date._getEraYear(this,b,Date._getEra(this,l),k))%100);break;case "hh":c=this.getHours()%12;if(c===0)c=12;a.append(d(c));break;case "h":c=this.getHours()%12;if(c===0)c=12;a.append(c);break;case "HH":a.append(d(this.getHours()));break;case "H":a.append(this.getHours());break;case "mm":a.append(d(this.getMinutes()));break;case "m":a.append(this.getMinutes());break;case "ss":a.append(d(this.getSeconds()));break;case "s":a.append(this.getSeconds());break;case "tt":a.append(this.getHours()<12?b.AMDesignator:b.PMDesignator);break;case "t":a.append((this.getHours()<12?b.AMDesignator:b.PMDesignator).charAt(0));break;case "f":a.append(m(this.getMilliseconds()).charAt(0));break;case "ff":a.append(m(this.getMilliseconds()).substr(0,2));break;case "fff":a.append(m(this.getMilliseconds()));break;case "z":c=this.getTimezoneOffset()/60;a.append((c<=0?"+":"-")+Math.floor(Math.abs(c)));break;case "zz":c=this.getTimezoneOffset()/60;a.append((c<=0?"+":"-")+d(Math.floor(Math.abs(c))));break;case "zzz":c=this.getTimezoneOffset()/60;a.append((c<=0?"+":"-")+d(Math.floor(Math.abs(c)))+":"+d(Math.abs(this.getTimezoneOffset()%60)));break;case "g":case "gg":if(b.eras)a.append(b.eras[Date._getEra(this,l)+1]);break;case "/":a.append(b.DateSeparator)}}return a.toString()};String.localeFormat=function(){return String._toFormattedString(true,arguments)};Number.parseLocale=function(a){return Number._parse(a,Sys.CultureInfo.CurrentCulture)};Number.parseInvariant=function(a){return Number._parse(a,Sys.CultureInfo.InvariantCulture)};Number._parse=function(b,o){b=b.trim();if(b.match(/^[+-]?infinity$/i))return parseFloat(b);if(b.match(/^0x[a-f0-9]+$/i))return parseInt(b);var a=o.numberFormat,g=Number._parseNumberNegativePattern(b,a,a.NumberNegativePattern),h=g[0],e=g[1];if(h===""&&a.NumberNegativePattern!==1){g=Number._parseNumberNegativePattern(b,a,1);h=g[0];e=g[1]}if(h==="")h="+";var j,d,f=e.indexOf("e");if(f<0)f=e.indexOf("E");if(f<0){d=e;j=null}else{d=e.substr(0,f);j=e.substr(f+1)}var c,k,m=d.indexOf(a.NumberDecimalSeparator);if(m<0){c=d;k=null}else{c=d.substr(0,m);k=d.substr(m+a.NumberDecimalSeparator.length)}c=c.split(a.NumberGroupSeparator).join("");var n=a.NumberGroupSeparator.replace(/\u00A0/g," ");
5if(a.NumberGroupSeparator!==n)c=c.split(n).join("");var l=h+c;if(k!==null)l+="."+k;if(j!==null){var i=Number._parseNumberNegativePattern(j,a,1);if(i[0]==="")i[0]="+";l+="e"+i[0]+i[1]}if(l.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/))return parseFloat(l);return Number.NaN};Number._parseNumberNegativePattern=function(a,d,e){var b=d.NegativeSign,c=d.PositiveSign;switch(e){case 4:b=" "+b;c=" "+c;case 3:if(a.endsWith(b))return ["-",a.substr(0,a.length-b.length)];else if(a.endsWith(c))return ["+",a.substr(0,a.length-c.length)];break;case 2:b+=" ";c+=" ";case 1:if(a.startsWith(b))return ["-",a.substr(b.length)];else if(a.startsWith(c))return ["+",a.substr(c.length)];break;case 0:if(a.startsWith("(")&&a.endsWith(")"))return ["-",a.substr(1,a.length-2)]}return ["",a]};Number.prototype.format=function(a){return this._toFormattedString(a,Sys.CultureInfo.InvariantCulture)};Number.prototype.localeFormat=function(a){return this._toFormattedString(a,Sys.CultureInfo.CurrentCulture)};Number.prototype._toFormattedString=function(e,j){if(!e||e.length===0||e==="i")if(j&&j.name.length>0)return this.toLocaleString();else return this.toString();var o=["n %","n%","%n"],n=["-n %","-n%","-%n"],p=["(n)","-n","- n","n-","n -"],m=["$n","n$","$ n","n $"],l=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];function g(a,c,d){for(var b=a.length;b<c;b++)a=d?"0"+a:a+"0";return a}function i(j,i,l,n,p){var h=l[0],k=1,o=Math.pow(10,i),m=Math.round(j*o)/o;if(!isFinite(m))m=j;j=m;var b=j.toString(),a="",c,e=b.split(/e/i);b=e[0];c=e.length>1?parseInt(e[1]):0;e=b.split(".");b=e[0];a=e.length>1?e[1]:"";var q;if(c>0){a=g(a,c,false);b+=a.slice(0,c);a=a.substr(c)}else if(c<0){c=-c;b=g(b,c+1,true);a=b.slice(-c,b.length)+a;b=b.slice(0,-c)}if(i>0){if(a.length>i)a=a.slice(0,i);else a=g(a,i,false);a=p+a}else a="";var d=b.length-1,f="";while(d>=0){if(h===0||h>d)if(f.length>0)return b.slice(0,d+1)+n+f+a;else return b.slice(0,d+1)+a;if(f.length>0)f=b.slice(d-h+1,d+1)+n+f;else f=b.slice(d-h+1,d+1);d-=h;if(k<l.length){h=l[k];k++}}return b.slice(0,d+1)+n+f+a}var a=j.numberFormat,d=Math.abs(this);if(!e)e="D";var b=-1;if(e.length>1)b=parseInt(e.slice(1),10);var c;switch(e.charAt(0)){case "d":case "D":c="n";if(b!==-1)d=g(""+d,b,true);if(this<0)d=-d;break;case "c":case "C":if(this<0)c=l[a.CurrencyNegativePattern];else c=m[a.CurrencyPositivePattern];if(b===-1)b=a.CurrencyDecimalDigits;d=i(Math.abs(this),b,a.CurrencyGroupSizes,a.CurrencyGroupSeparator,a.CurrencyDecimalSeparator);break;case "n":case "N":if(this<0)c=p[a.NumberNegativePattern];else c="n";if(b===-1)b=a.NumberDecimalDigits;d=i(Math.abs(this),b,a.NumberGroupSizes,a.NumberGroupSeparator,a.NumberDecimalSeparator);break;case "p":case "P":if(this<0)c=n[a.PercentNegativePattern];else c=o[a.PercentPositivePattern];if(b===-1)b=a.PercentDecimalDigits;d=i(Math.abs(this)*100,b,a.PercentGroupSizes,a.PercentGroupSeparator,a.PercentDecimalSeparator);break;default:throw Error.format(Sys.Res.formatBadFormatSpecifier)}var k=/n|\$|-|%/g,f="";for(;true;){var q=k.lastIndex,h=k.exec(c);f+=c.slice(q,h?h.index:c.length);if(!h)break;switch(h[0]){case "n":f+=d;break;case "$":f+=a.CurrencySymbol;break;case "-":if(/[1-9]/.test(d))f+=a.NegativeSign;break;case "%":f+=a.PercentSymbol}}return f};Sys.CultureInfo=function(c,b,a){this.name=c;this.numberFormat=b;this.dateTimeFormat=a};Sys.CultureInfo.prototype={_getDateTimeFormats:function(){if(!this._dateTimeFormats){var a=this.dateTimeFormat;this._dateTimeFormats=[a.MonthDayPattern,a.YearMonthPattern,a.ShortDatePattern,a.ShortTimePattern,a.LongDatePattern,a.LongTimePattern,a.FullDateTimePattern,a.RFC1123Pattern,a.SortableDateTimePattern,a.UniversalSortableDateTimePattern]}return this._dateTimeFormats},_getIndex:function(c,d,e){var b=this._toUpper(c),a=Array.indexOf(d,b);if(a===-1)a=Array.indexOf(e,b);return a},_getMonthIndex:function(a){if(!this._upperMonths){this._upperMonths=this._toUpperArray(this.dateTimeFormat.MonthNames);this._upperMonthsGenitive=this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames)}return this._getIndex(a,this._upperMonths,this._upperMonthsGenitive)}
5,_getAbbrMonthIndex:function(a){if(!this._upperAbbrMonths){this._upperAbbrMonths=this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);this._upperAbbrMonthsGenitive=this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames)}return this._getIndex(a,this._upperAbbrMonths,this._upperAbbrMonthsGenitive)},_getDayIndex:function(a){if(!this._upperDays)this._upperDays=this._toUpperArray(this.dateTimeFormat.DayNames);return Array.indexOf(this._upperDays,this._toUpper(a))},_getAbbrDayIndex:function(a){if(!this._upperAbbrDays)this._upperAbbrDays=this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);return Array.indexOf(this._upperAbbrDays,this._toUpper(a))},_toUpperArray:function(c){var b=[];for(var a=0,d=c.length;a<d;a++)b[a]=this._toUpper(c[a]);return b},_toUpper:function(a){return a.split("\u00a0").join(" ").toUpperCase()}};Sys.CultureInfo.registerClass("Sys.CultureInfo");Sys.CultureInfo._parse=function(a){var b=a.dateTimeFormat;if(b&&!b.eras)b.eras=a.eras;return new Sys.CultureInfo(a.name,a.numberFormat,b)};Sys.CultureInfo.InvariantCulture=Sys.CultureInfo._parse({"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00a4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH':'mm':'ss 'GMT'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy'-'MM'-'dd'T'HH':'mm':'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy'-'MM'-'dd HH':'mm':'ss'Z'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});if(typeof __cultureInfo==="object"){Sys.CultureInfo.CurrentCulture=Sys.CultureInfo._parse(__cultureInfo);delete __cultureInfo}else Sys.CultureInfo.CurrentCulture=Sys.CultureInfo._parse({"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH':'mm':'ss 'GMT'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy'-'MM'-'dd'T'HH':'mm':'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy'-'MM'-'dd HH':'mm':'ss'Z'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
5ay","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});Type.registerNamespace("Sys.Serialization");Sys.Serialization.JavaScriptSerializer=function(){};Sys.Serialization.JavaScriptSerializer.registerClass("Sys.Serialization.JavaScriptSerializer");Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs=[];Sys.Serialization.JavaScriptSerializer._charsToEscape=[];Sys.Serialization.JavaScriptSerializer._dateRegEx=new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"',"g");Sys.Serialization.JavaScriptSerializer._escapeChars={};Sys.Serialization.JavaScriptSerializer._escapeRegEx=new RegExp('["\\\\\\x00-\\x1F]',"i");Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal=new RegExp('["\\\\\\x00-\\x1F]',"g");Sys.Serialization.JavaScriptSerializer._jsonRegEx=new RegExp("[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]","g");Sys.Serialization.JavaScriptSerializer._jsonStringRegEx=new RegExp('"(\\\\.|[^"\\\\])*"',"g");Sys.Serialization.JavaScriptSerializer._serverTypeFieldName="__type";Sys.Serialization.JavaScriptSerializer._init=function(){var c=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000b","\\f","\\r","\\u000e","\\u000f","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001a","\\u001b","\\u001c","\\u001d","\\u001e","\\u001f"];Sys.Serialization.JavaScriptSerializer._charsToEscape[0]="\\";Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs["\\"]=new RegExp("\\\\","g");Sys.Serialization.JavaScriptSerializer._escapeChars["\\"]="\\\\";Sys.Serialization.JavaScriptSerializer._charsToEscape[1]='"';Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"']=new RegExp('"',"g");Sys.Serialization.JavaScriptSerializer._escapeChars['"']='\\"';for(var a=0;a<32;a++){var b=String.fromCharCode(a);Sys.Serialization.JavaScriptSerializer._charsToEscape[a+2]=b;Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[b]=new RegExp(b,"g");Sys.Serialization.JavaScriptSerializer._escapeChars[b]=c[a]}};Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder=function(b,a){a.append(b.toString())};Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder=function(a,b){if(isFinite(a))b.append(String(a));else throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers)};Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder=function(a,c){c.append('"');if(Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(a)){if(Sys.Serialization.JavaScriptSerializer._charsToEscape.length===0)Sys.Serialization.JavaScriptSerializer._init();if(a.length<128)a=a.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal,function(a){return Sys.Serialization.JavaScriptSerializer._escapeChars[a]});else for(var d=0;d<34;d++){var b=Sys.Serialization.JavaScriptSerializer._charsToEscape[d];if(a.indexOf(b)!==-1)if(Sys.Browser.agent===Sys.Browser.Opera||Sys.Browser.agent===Sys.Browser.FireFox)a=a.split(b).join(Sys.Serialization.JavaScriptSerializer._escapeChars[b]);else a=a.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[b],Sys.Serialization.JavaScriptSerializer._escapeChars[b])}}c.append(a);c.append('"')};Sys.Serialization.JavaScriptSerializer._serializeWithBuilder=function(b,a,i,g){var c;switch(typeof b){case "object":if(b)if(Number.isInstanceOfType(b))Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(b,a);else if(Boolean.isInstanceOfType(b))Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(b,a);else if(String.isInstanceOfType(b))Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(b,a);else if(Array.isInstanceOfType(b)){a.append("[");for(c=0;c<b.length;++c){if(c>0)a.append(",");Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b[c],a,false,g)}a.append("]")}else{if(Date.isInstanceOfType(b)){a.append('"\\/Date(');a.append(b.getTime());a.append(')\\/"');break}var d=[],f=0;for(var e in b){if(e.startsWith("$"))continue;if(e===Sys.Serialization.JavaScriptSerializer._serverTypeFieldName&&f!==0){d[f++]=d[0];d[0]=e}else d[f++]=e}if(i)d.sort();a.append("{");var j=false;for(c=0;c<f;c++){var h=b[d[c]];if(typeof h!=="undefined"&&typeof h!=="function"){if(j)a.append(",");else j=true;Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(d[c],a,i,g);a.append(":");Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(h,a,i,g)}}a.append("}")}else a.append("null");break;case "number":Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(b,a);break;case "string":Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(b,a);break;case "boolean":Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(b,a);break;default:a.append("null")}};Sys.Serialization.JavaScriptSerializer.serialize=function(b){var a=new Sys.StringBuilder;Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b,a,false);return a.toString()};Sys.Serialization.JavaScriptSerializer.deserialize=function(data,secure){if(data.length===0)throw Error.argument("data",Sys.Res.cannotDeserializeEmptyString);try{var exp=data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx,"$1new Date($2)");if(secure&&Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx,"")))throw null;return eval("("+exp+")")}catch(a){throw Error.argument("data",Sys.Res.cannotDeserializeInvalidJson)}};Type.registerNamespace("Sys.UI");Sys.EventHandlerList=function(){this._list={}};Sys.EventHandlerList.prototype={_addHandler:function(b,a){Array.add(this._getEvent(b,true),a)},addHandler:function(b,a){this._addHandler(b,a)},_removeHandler:function(c,b){var a=this._getEvent(c);if(!a)return;Array.remove(a,b)},removeHandler:function(b,a){this._removeHandler(b,a)},getHandler:function(b){var a=this._getEvent(b);if(!a||a.length===0)return null;a=Array.clone(a);return function(c,d){for(var b=0,e=a.length;b<e;b++)a[b](c,d)}},_getEvent:function(a,b){if(!this._list[a]){if(!b)return null;this._list[a]=[]}return this._list[a]}};Sys.EventHandlerList.registerClass("Sys.EventHandlerList");Sys.CommandEventArgs=function(c,a,b){Sys.CommandEventArgs.initializeBase(this);this._commandName=c;this._commandArgument=a;this._commandSource=b};Sys.CommandEventArgs.prototype={_commandName:null,_commandArgument:null,_commandSource:null,get_commandName:function(){return this._commandName},get_commandArgument:function(){return this._commandArgument},get_commandSource:function(){return this._commandSource}};Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs",Sys.CancelEventArgs);Sys.INotifyPropertyChange=function(){};Sys.INotifyPropertyChange.prototype={};Sys.INotifyPropertyChange.registerInterface("Sys.INotifyPropertyChange");Sys.PropertyChangedEventArgs=function(a){Sys.PropertyChangedEventArgs.initializeBase(this);this._propertyName=a};Sys.PropertyChangedEventArgs.prototype={get_propertyName:function(){return this._propertyName}};Sys.PropertyChangedEventArgs.registerClass("Sys.PropertyChangedEventArgs",Sys.EventArgs);Sys.INotifyDisposing=function(){};Sys.INotifyDisposing.prototype={};Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");Sys.Component=function(){if(Sys.Application)Sys.Application.registerDisposableObject(this)};Sys.Component.prototype={_id:null,_initialized:false,_updating:false,get_events:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_id:function(){return this._id},set_id:function(a){this._id=a},get_isInitialized:function(){return this._initialized},get_isUpdating:function(){return this._updating},add_disposing:function(a){this.get_events().addHandler("disposing",a)},remove_disposing:function(a){this.get_events().removeHandler("disposing",a)},add_propertyChanged:function(a){this.get_events().addHandler("propertyChanged",a)},remove_propertyChanged:function(a){this.get_events().removeHandler("propertyChanged",a)},beginUpdate:function(){this._updating=true},dispose:function(){if(this._events){var a=this._events.getHandler("disposing");if(a)a(this,Sys.EventArgs.Empty)}delete this._events;Sys.Application.unregisterDisposableObject(this);Sys.Application.removeComponent(this)},endUpdate:function(){this._updating=false;if(!this._initialized)this.initialize();this.updated()},initialize:function(){this._initialized=true},raisePropertyChanged:function(b){if(!this._events)return;var a=this._events.getHandler("propertyChanged");if(a)a(this,new Sys.PropertyChangedEventArgs(b))},updated:function(){}};Sys.Component.registerClass("Sys.Component",null,Sys.IDisposable,Sys.INotifyPropertyChange,Sys.INotifyDisposing);function Sys$Component$_setProperties(a,i){var d,j=Object.getType(a),e=j===Object||j===Sys.UI.DomElement,h=Sys.Component.isInstanceOfType(a)&&!a.get_isUpdating();if(h)a.beginUpdate();for(var c in i){var b=i[c],f=e?null:a["get_"+c];if(e||typeof f!=="function"){var k=a[c];if(!b||typeof b!=="object"||e&&!k)a[c]=b;else Sys$Component$_setProperties(k,b)}else{var l=a["set_"+c];if(typeof l==="function")l.apply(a,[b]);else if(b instanceof Array){d=f.apply(a);for(var g=0,m=d.length,n=b.length;g<n;g++,m++)d[m]=b[g]}else if(typeof b==="object"&&Object.getType(b)===Object){d=f.apply(a);Sys$Component$_setProperties(d,b)}}}if(h)a.endUpdate()}function Sys$Component$_setReferences(c,b){for(var a in b){var e=c["set_"+a],d=$find(b[a]);e.apply(c,[d])}}var $create=Sys.Component.create=function(h,f,d,c,g){var a=g?new h(g):new h,b=Sys.Application,i=b.get_isCreatingComponents();a.beginUpdate();if(f)Sys$Component$_setProperties(a,f);if(d)for(var e in d)a["add_"+e](d[e]);if(a.get_id())b.addComponent(a);if(i){b._createdComponents[b._createdComponents.length]=a;if(c)b._addComponentToSecondPass(a,c);else a.endUpdate()}else{if(c)Sys$Component$_setReferences(a,c);a.endUpdate()}return a};Sys.UI.MouseButton=function(){throw Error.notImplemented()};Sys.UI.MouseButton.prototype={leftButton:0,middleButton:1,rightButton:2};Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");Sys.UI.Key=function(){throw Error.notImplemented()};Sys.UI.Key.prototype={backspace:8,tab:9,enter:13,esc:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,del:127};Sys.UI.Key.registerEnum("Sys.UI.Key");Sys.UI.Point=function(a,b){this.rawX=a;this.rawY=b;this.x=Math.round(a);this.y=Math.round(b)};Sys.UI.Point.registerClass("Sys.UI.Point");Sys.UI.Bounds=function(c,d,b,a){this.x=c;this.y=d;this.height=a;this.width=b};Sys.UI.Bounds.registerClass("Sys.UI.Bounds");
5Sys.UI.DomEvent=function(e){var a=e,b=this.type=a.type.toLowerCase();this.rawEvent=a;this.altKey=a.altKey;if(typeof a.button!=="undefined")this.button=typeof a.which!=="undefined"?a.button:a.button===4?Sys.UI.MouseButton.middleButton:a.button===2?Sys.UI.MouseButton.rightButton:Sys.UI.MouseButton.leftButton;if(b==="keypress")this.charCode=a.charCode||a.keyCode;else if(a.keyCode&&a.keyCode===46)this.keyCode=127;else this.keyCode=a.keyCode;this.clientX=a.clientX;this.clientY=a.clientY;this.ctrlKey=a.ctrlKey;this.target=a.target?a.target:a.srcElement;if(!b.startsWith("key"))if(typeof a.offsetX!=="undefined"&&typeof a.offsetY!=="undefined"){this.offsetX=a.offsetX;this.offsetY=a.offsetY}else if(this.target&&this.target.nodeType!==3&&typeof a.clientX==="number"){var c=Sys.UI.DomElement.getLocation(this.target),d=Sys.UI.DomElement._getWindow(this.target);this.offsetX=(d.pageXOffset||0)+a.clientX-c.x;this.offsetY=(d.pageYOffset||0)+a.clientY-c.y}this.screenX=a.screenX;this.screenY=a.screenY;this.shiftKey=a.shiftKey};Sys.UI.DomEvent.prototype={preventDefault:function(){if(this.rawEvent.preventDefault)this.rawEvent.preventDefault();else if(window.event)this.rawEvent.returnValue=false},stopPropagation:function(){if(this.rawEvent.stopPropagation)this.rawEvent.stopPropagation();else if(window.event)this.rawEvent.cancelBubble=true}};Sys.UI.DomEvent.registerClass("Sys.UI.DomEvent");var $addHandler=Sys.UI.DomEvent.addHandler=function(a,d,e,g){if(!a._events)a._events={};var c=a._events[d];if(!c)a._events[d]=c=[];var b;if(a.addEventListener){b=function(b){return e.call(a,new Sys.UI.DomEvent(b))};a.addEventListener(d,b,false)}else if(a.attachEvent){b=function(){var b={};try{b=Sys.UI.DomElement._getWindow(a).event}catch(c){}return e.call(a,new Sys.UI.DomEvent(b))};a.attachEvent("on"+d,b)}c[c.length]={handler:e,browserHandler:b,autoRemove:g};if(g){var f=a.dispose;if(f!==Sys.UI.DomEvent._disposeHandlers){a.dispose=Sys.UI.DomEvent._disposeHandlers;if(typeof f!=="undefined")a._chainDispose=f}}},$addHandlers=Sys.UI.DomEvent.addHandlers=function(f,d,c,e){for(var b in d){var a=d[b];if(c)a=Function.createDelegate(c,a);$addHandler(f,b,a,e||false)}},$clearHandlers=Sys.UI.DomEvent.clearHandlers=function(a){Sys.UI.DomEvent._clearHandlers(a,false)};Sys.UI.DomEvent._clearHandlers=function(a,g){if(a._events){var e=a._events;for(var b in e){var d=e[b];for(var c=d.length-1;c>=0;c--){var f=d[c];if(!g||f.autoRemove)$removeHandler(a,b,f.handler)}}a._events=null}};Sys.UI.DomEvent._disposeHandlers=function(){Sys.UI.DomEvent._clearHandlers(this,true);var b=this._chainDispose,a=typeof b;if(a!=="undefined"){this.dispose=b;this._chainDispose=null;if(a==="function")this.dispose()}};var $removeHandler=Sys.UI.DomEvent.removeHandler=function(b,a,c){Sys.UI.DomEvent._removeHandler(b,a,c)};Sys.UI.DomEvent._removeHandler=function(a,e,f){var d=null,c=a._events[e];for(var b=0,g=c.length;b<g;b++)if(c[b].handler===f){d=c[b].browserHandler;break}if(a.removeEventListener)a.removeEventListener(e,d,false);else if(a.detachEvent)a.detachEvent("on"+e,d);c.splice(b,1)};Sys.UI.DomElement=function(){};Sys.UI.DomElement.registerClass("Sys.UI.DomElement");Sys.UI.DomElement.addCssClass=function(a,b){if(!Sys.UI.DomElement.containsCssClass(a,b))if(a.className==="")a.className=b;else a.className+=" "+b};Sys.UI.DomElement.containsCssClass=function(b,a){return Array.contains(b.className.split(" "),a)};Sys.UI.DomElement.getBounds=function(a){var b=Sys.UI.DomElement.getLocation(a);return new Sys.UI.Bounds(b.x,b.y,a.offsetWidth||0,a.offsetHeight||0)};var $get=Sys.UI.DomElement.getElementById=function(f,e){if(!e)return document.getElementById(f);if(e.getElementById)return e.getElementById(f);var c=[],d=e.childNodes;for(var b=0;b<d.length;b++){var a=d[b];if(a.nodeType==1)c[c.length]=a}while(c.length){a=c.shift();if(a.id==f)return a;d=a.childNodes;for(b=0;b<d.length;b++){a=d[b];if(a.nodeType==1)c[c.length]=a}}return null};if(document.documentElement.getBoundingClientRect)Sys.UI.DomElement.getLocation=function(a){if(a.self||a.nodeType===9||a===document.documentElement||a.parentNode===a.ownerDocument.documentElement)return new Sys.UI.Point(0,0);var f=a.getBoundingClientRect();if(!f)return new Sys.UI.Point(0,0);var e=a.ownerDocument.documentElement,h=a.ownerDocument.body,l,c=Math.round(f.left)+(e.scrollLeft||h.scrollLeft),d=Math.round(f.top)+(e.scrollTop||h.scrollTop);if(Sys.Browser.agent===Sys.Browser.InternetExplorer){try{var g=a.ownerDocument.parentWindow.frameElement||null;if(g){var i=g.frameBorder==="0"||g.frameBorder==="no"?2:0;c+=i;d+=i}}catch(m){}if(Sys.Browser.version===7&&!document.documentMode){var j=document.body,k=j.getBoundingClientRect(),b=(k.right-k.left)/j.clientWidth;b=Math.round(b*100);b=(b-b%5)/100;if(!isNaN(b)&&b!==1){c=Math.round(c/b);d=Math.round(d/b)}}if((document.documentMode||0)<8){c-=e.clientLeft;d-=e.clientTop}}return new Sys.UI.Point(c,d)};else if(Sys.Browser.agent===Sys.Browser.Safari)Sys.UI.DomElement.getLocation=function(c){if(c.window&&c.window===c||c.nodeType===9)return new Sys.UI.Point(0,0);var d=0,e=0,a,j=null,g=null,b;for(a=c;a;j=a,(g=b,a=a.offsetParent)){b=Sys.UI.DomElement._getCurrentStyle(a);var f=a.tagName?a.tagName.toUpperCase():null;if((a.offsetLeft||a.offsetTop)&&(f!=="BODY"||(!g||g.position!=="absolute"))){d+=a.offsetLeft;e+=a.offsetTop}if(j&&Sys.Browser.version>=3){d+=parseInt(b.borderLeftWidth);e+=parseInt(b.borderTopWidth)}}b=Sys.UI.DomElement._getCurrentStyle(c);var h=b?b.position:null;if(!h||h!=="absolute")for(a=c.parentNode;a;a=a.parentNode){f=a.tagName?a.tagName.toUpperCase():null;if(f!=="BODY"&&f!=="HTML"&&(a.scrollLeft||a.scrollTop)){d-=a.scrollLeft||0;e-=a.scrollTop||0}b=Sys.UI.DomElement._getCurrentStyle(a);var i=b?b.position:null;if(i&&i==="absolute")break}return new Sys.UI.Point(d,e)};else Sys.UI.DomElement.getLocation=function(d){if(d.window&&d.window===d||d.nodeType===9)return new Sys.UI.Point(0,0);var e=0,f=0,a,i=null,g=null,b=null;for(a=d;a;i=a,(g=b,a=a.offsetParent)){var c=a.tagName?a.tagName.toUpperCase():null;b=Sys.UI.DomElement._getCurrentStyle(a);if((a.offsetLeft||a.offsetTop)&&!(c==="BODY"&&(!g||g.position!=="absolute"))){e+=a.offsetLeft;f+=a.offsetTop}if(i!==null&&b){if(c!=="TABLE"&&c!=="TD"&&c!=="HTML"){e+=parseInt(b.borderLeftWidth)||0;f+=parseInt(b.borderTopWidth)||0}if(c==="TABLE"&&(b.position==="relative"||b.position==="absolute")){e+=parseInt(b.marginLeft)||0;f+=parseInt(b.marginTop)||0}}}b=Sys.UI.DomElement._getCurrentStyle(d);var h=b?b.position:null;if(!h||h!=="absolute")for(a=d.parentNode;a;a=a.parentNode){c=a.tagName?a.tagName.toUpperCase():null;if(c!=="BODY"&&c!=="HTML"&&(a.scrollLeft||a.scrollTop)){e-=a.scrollLeft||0;f-=a.scrollTop||0;b=Sys.UI.DomElement._getCurrentStyle(a);if(b){e+=parseInt(b.borderLeftWidth)||0;f+=parseInt(b.borderTopWidth)||0}}}return new Sys.UI.Point(e,f)};Sys.UI.DomElement.isDomElement=function(a){return Sys._isDomElement(a)};Sys.UI.DomElement.removeCssClass=function(d,c){var a=" "+d.className+" ",b=a.indexOf(" "+c+" ");if(b>=0)d.className=(a.substr(0,b)+" "+a.substring(b+c.length+1,a.length)).trim()};Sys.UI.DomElement.resolveElement=function(b,c){var a=b;if(!a)return null;if(typeof a==="string")a=Sys.UI.DomElement.getElementById(a,c);return a};Sys.UI.DomElement.raiseBubbleEvent=function(c,d){var b=c;while(b){var a=b.control;if(a&&a.onBubbleEvent&&a.raiseBubbleEvent){Sys.UI.DomElement._raiseBubbleEventFromControl(a,c,d);return}b=b.parentNode}};Sys.UI.DomElement._raiseBubbleEventFromControl=function(a,b,c){if(!a.onBubbleEvent(b,c))a._raiseBubbleEvent(b,c)};Sys.UI.DomElement.setLocation=function(b,c,d){var a=b.style;a.position="absolute";
5a.left=c+"px";a.top=d+"px"};Sys.UI.DomElement.toggleCssClass=function(b,a){if(Sys.UI.DomElement.containsCssClass(b,a))Sys.UI.DomElement.removeCssClass(b,a);else Sys.UI.DomElement.addCssClass(b,a)};Sys.UI.DomElement.getVisibilityMode=function(a){return a._visibilityMode===Sys.UI.VisibilityMode.hide?Sys.UI.VisibilityMode.hide:Sys.UI.VisibilityMode.collapse};Sys.UI.DomElement.setVisibilityMode=function(a,b){Sys.UI.DomElement._ensureOldDisplayMode(a);if(a._visibilityMode!==b){a._visibilityMode=b;if(Sys.UI.DomElement.getVisible(a)===false)if(a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none";a._visibilityMode=b}};Sys.UI.DomElement.getVisible=function(b){var a=b.currentStyle||Sys.UI.DomElement._getCurrentStyle(b);if(!a)return true;return a.visibility!=="hidden"&&a.display!=="none"};Sys.UI.DomElement.setVisible=function(a,b){if(b!==Sys.UI.DomElement.getVisible(a)){Sys.UI.DomElement._ensureOldDisplayMode(a);a.style.visibility=b?"visible":"hidden";if(b||a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none"}};Sys.UI.DomElement._ensureOldDisplayMode=function(a){if(!a._oldDisplayMode){var b=a.currentStyle||Sys.UI.DomElement._getCurrentStyle(a);a._oldDisplayMode=b?b.display:null;if(!a._oldDisplayMode||a._oldDisplayMode==="none")switch(a.tagName.toUpperCase()){case "DIV":case "P":case "ADDRESS":case "BLOCKQUOTE":case "BODY":case "COL":case "COLGROUP":case "DD":case "DL":case "DT":case "FIELDSET":case "FORM":case "H1":case "H2":case "H3":case "H4":case "H5":case "H6":case "HR":case "IFRAME":case "LEGEND":case "OL":case "PRE":case "TABLE":case "TD":case "TH":case "TR":case "UL":a._oldDisplayMode="block";break;case "LI":a._oldDisplayMode="list-item";break;default:a._oldDisplayMode="inline"}}};Sys.UI.DomElement._getWindow=function(a){var b=a.ownerDocument||a.document||a;return b.defaultView||b.parentWindow};Sys.UI.DomElement._getCurrentStyle=function(a){if(a.nodeType===3)return null;var c=Sys.UI.DomElement._getWindow(a);if(a.documentElement)a=a.documentElement;var b=c&&a!==c&&c.getComputedStyle?c.getComputedStyle(a,null):a.currentStyle||a.style;if(!b&&Sys.Browser.agent===Sys.Browser.Safari&&a.style){var g=a.style.display,f=a.style.position;a.style.position="absolute";a.style.display="block";var e=c.getComputedStyle(a,null);a.style.display=g;a.style.position=f;b={};for(var d in e)b[d]=e[d];b.display="none"}return b};Sys.IContainer=function(){};Sys.IContainer.prototype={};Sys.IContainer.registerInterface("Sys.IContainer");Sys.ApplicationLoadEventArgs=function(b,a){Sys.ApplicationLoadEventArgs.initializeBase(this);this._components=b;this._isPartialLoad=a};Sys.ApplicationLoadEventArgs.prototype={get_components:function(){return this._components},get_isPartialLoad:function(){return this._isPartialLoad}};Sys.ApplicationLoadEventArgs.registerClass("Sys.ApplicationLoadEventArgs",Sys.EventArgs);Sys._Application=function(){Sys._Application.initializeBase(this);this._disposableObjects=[];this._components={};this._createdComponents=[];this._secondPassComponents=[];this._unloadHandlerDelegate=Function.createDelegate(this,this._unloadHandler);Sys.UI.DomEvent.addHandler(window,"unload",this._unloadHandlerDelegate);this._domReady()};Sys._Application.prototype={_creatingComponents:false,_disposing:false,_deleteCount:0,get_isCreatingComponents:function(){return this._creatingComponents},get_isDisposing:function(){return this._disposing},add_init:function(a){if(this._initialized)a(this,Sys.EventArgs.Empty);else this.get_events().addHandler("init",a)},remove_init:function(a){this.get_events().removeHandler("init",a)},add_load:function(a){this.get_events().addHandler("load",a)},remove_load:function(a){this.get_events().removeHandler("load",a)},add_unload:function(a){this.get_events().addHandler("unload",a)},remove_unload:function(a){this.get_events().removeHandler("unload",a)},addComponent:function(a){this._components[a.get_id()]=a},beginCreateComponents:function(){this._creatingComponents=true},dispose:function(){if(!this._disposing){this._disposing=true;if(this._timerCookie){window.clearTimeout(this._timerCookie);delete this._timerCookie}if(this._endRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);delete this._endRequestHandler}if(this._beginRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);delete this._beginRequestHandler}if(window.pageUnload)window.pageUnload(this,Sys.EventArgs.Empty);var c=this.get_events().getHandler("unload");if(c)c(this,Sys.EventArgs.Empty);var b=Array.clone(this._disposableObjects);for(var a=0,f=b.length;a<f;a++){var d=b[a];if(typeof d!=="undefined")d.dispose()}Array.clear(this._disposableObjects);Sys.UI.DomEvent.removeHandler(window,"unload",this._unloadHandlerDelegate);if(Sys._ScriptLoader){var e=Sys._ScriptLoader.getInstance();if(e)e.dispose()}Sys._Application.callBaseMethod(this,"dispose")}}
5,disposeElement:function(c,j){if(c.nodeType===1){var b,h=c.getElementsByTagName("*"),g=h.length,i=new Array(g);for(b=0;b<g;b++)i[b]=h[b];for(b=g-1;b>=0;b--){var d=i[b],f=d.dispose;if(f&&typeof f==="function")d.dispose();else{var e=d.control;if(e&&typeof e.dispose==="function")e.dispose()}var a=d._behaviors;if(a)this._disposeComponents(a);a=d._components;if(a){this._disposeComponents(a);d._components=null}}if(!j){var f=c.dispose;if(f&&typeof f==="function")c.dispose();else{var e=c.control;if(e&&typeof e.dispose==="function")e.dispose()}var a=c._behaviors;if(a)this._disposeComponents(a);a=c._components;if(a){this._disposeComponents(a);c._components=null}}}},endCreateComponents:function(){var b=this._secondPassComponents;for(var a=0,d=b.length;a<d;a++){var c=b[a].component;Sys$Component$_setReferences(c,b[a].references);c.endUpdate()}this._secondPassComponents=[];this._creatingComponents=false},findComponent:function(b,a){return a?Sys.IContainer.isInstanceOfType(a)?a.findComponent(b):a[b]||null:Sys.Application._components[b]||null},getComponents:function(){var a=[],b=this._components;for(var c in b)a[a.length]=b[c];return a},initialize:function(){if(!this.get_isInitialized()&&!this._disposing){Sys._Application.callBaseMethod(this,"initialize");this._raiseInit();if(this.get_stateString){if(Sys.WebForms&&Sys.WebForms.PageRequestManager){this._beginRequestHandler=Function.createDelegate(this,this._onPageRequestManagerBeginRequest);Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler);this._endRequestHandler=Function.createDelegate(this,this._onPageRequestManagerEndRequest);Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler)}var a=this.get_stateString();if(a!==this._currentEntry)this._navigate(a);else this._ensureHistory()}
5this.raiseLoad()}},notifyScriptLoaded:function(){},registerDisposableObject:function(b){if(!this._disposing){var a=this._disposableObjects,c=a.length;a[c]=b;b.__msdisposeindex=c}},raiseLoad:function(){var b=this.get_events().getHandler("load"),a=new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents),!!this._loaded);this._loaded=true;if(b)b(this,a);if(window.pageLoad)window.pageLoad(this,a);this._createdComponents=[]},removeComponent:function(b){var a=b.get_id();if(a)delete this._components[a]},unregisterDisposableObject:function(a){if(!this._disposing){var e=a.__msdisposeindex;if(typeof e==="number"){var b=this._disposableObjects;delete b[e];delete a.__msdisposeindex;if(++this._deleteCount>1000){var c=[];for(var d=0,f=b.length;d<f;d++){a=b[d];if(typeof a!=="undefined"){a.__msdisposeindex=c.length;c.push(a)}}this._disposableObjects=c;this._deleteCount=0}}}},_addComponentToSecondPass:function(b,a){this._secondPassComponents[this._secondPassComponents.length]={component:b,references:a}},_disposeComponents:function(a){if(a)for(var b=a.length-1;b>=0;b--){var c=a[b];if(typeof c.dispose==="function")c.dispose()}},_domReady:function(){var a,g,f=this;function b(){f.initialize()}var c=function(){Sys.UI.DomEvent.removeHandler(window,"load",c);b()};Sys.UI.DomEvent.addHandler(window,"load",c);if(document.addEventListener)try{document.addEventListener("DOMContentLoaded",a=function(){document.removeEventListener("DOMContentLoaded",a,false);b()},false)}catch(h){}else if(document.attachEvent)if(window==window.top&&document.documentElement.doScroll){var e,d=document.createElement("div");a=function(){try{d.doScroll("left")}catch(c){e=window.setTimeout(a,0);return}d=null;b()};a()}else document.attachEvent("onreadystatechange",a=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",a);b()}})},_raiseInit:function(){var a=this.get_events().getHandler("init");if(a){this.beginCreateComponents();a(this,Sys.EventArgs.Empty);this.endCreateComponents()}},_unloadHandler:function(){this.dispose()}};Sys._Application.registerClass("Sys._Application",Sys.Component,Sys.IContainer);Sys.Application=new Sys._Application;var $find=Sys.Application.findComponent;Sys.UI.Behavior=function(b){Sys.UI.Behavior.initializeBase(this);this._element=b;var a=b._behaviors;if(!a)b._behaviors=[this];else a[a.length]=this};Sys.UI.Behavior.prototype={_name:null,get_element:function(){return this._element},get_id:function(){var a=Sys.UI.Behavior.callBaseMethod(this,"get_id");if(a)return a;if(!this._element||!this._element.id)return "";return this._element.id+"$"+this.get_name()},get_name:function(){if(this._name)return this._name;var a=Object.getTypeName(this),b=a.lastIndexOf(".");if(b!==-1)a=a.substr(b+1);if(!this.get_isInitialized())this._name=a;return a},set_name:function(a){this._name=a},initialize:function(){Sys.UI.Behavior.callBaseMethod(this,"initialize");var a=this.get_name();if(a)this._element[a]=this},dispose:function(){Sys.UI.Behavior.callBaseMethod(this,"dispose");var a=this._element;if(a){var c=this.get_name();if(c)a[c]=null;var b=a._behaviors;Array.remove(b,this);if(b.length===0)a._behaviors=null;delete this._element}}};Sys.UI.Behavior.registerClass("Sys.UI.Behavior",Sys.Component);Sys.UI.Behavior.getBehaviorByName=function(b,c){var a=b[c];return a&&Sys.UI.Behavior.isInstanceOfType(a)?a:null};Sys.UI.Behavior.getBehaviors=function(a){if(!a._behaviors)return [];return Array.clone(a._behaviors)};Sys.UI.Behavior.getBehaviorsByType=function(d,e){var a=d._behaviors,c=[];if(a)for(var b=0,f=a.length;b<f;b++)if(e.isInstanceOfType(a[b]))c[c.length]=a[b];return c};Sys.UI.VisibilityMode=function(){throw Error.notImplemented()};Sys.UI.VisibilityMode.prototype={hide:0,collapse:1};Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");Sys.UI.Control=function(a){Sys.UI.Control.initializeBase(this);this._element=a;a.control=this;var b=this.get_role();if(b)a.setAttribute("role",b)};Sys.UI.Control.prototype={_parent:null,_visibilityMode:Sys.UI.VisibilityMode.hide,get_element:function(){return this._element},get_id:function(){if(!this._element)return "";
5return this._element.id},set_id:function(){throw Error.invalidOperation(Sys.Res.cantSetId)},get_parent:function(){if(this._parent)return this._parent;if(!this._element)return null;var a=this._element.parentNode;while(a){if(a.control)return a.control;a=a.parentNode}return null},set_parent:function(a){this._parent=a},get_role:function(){return null},get_visibilityMode:function(){return Sys.UI.DomElement.getVisibilityMode(this._element)},set_visibilityMode:function(a){Sys.UI.DomElement.setVisibilityMode(this._element,a)},get_visible:function(){return Sys.UI.DomElement.getVisible(this._element)},set_visible:function(a){Sys.UI.DomElement.setVisible(this._element,a)},addCssClass:function(a){Sys.UI.DomElement.addCssClass(this._element,a)},dispose:function(){Sys.UI.Control.callBaseMethod(this,"dispose");if(this._element){this._element.control=null;delete this._element}if(this._parent)delete this._parent},onBubbleEvent:function(){return false},raiseBubbleEvent:function(a,b){this._raiseBubbleEvent(a,b)},_raiseBubbleEvent:function(b,c){var a=this.get_parent();while(a){if(a.onBubbleEvent(b,c))return;a=a.get_parent()}},removeCssClass:function(a){Sys.UI.DomElement.removeCssClass(this._element,a)},toggleCssClass:function(a){Sys.UI.DomElement.toggleCssClass(this._element,a)}};Sys.UI.Control.registerClass("Sys.UI.Control",Sys.Component);Sys.HistoryEventArgs=function(a){Sys.HistoryEventArgs.initializeBase(this);this._state=a};Sys.HistoryEventArgs.prototype={get_state:function(){return this._state}};Sys.HistoryEventArgs.registerClass("Sys.HistoryEventArgs",Sys.EventArgs);Sys.Application._appLoadHandler=null;Sys.Application._beginRequestHandler=null;Sys.Application._clientId=null;Sys.Application._currentEntry="";Sys.Application._endRequestHandler=null;Sys.Application._history=null;Sys.Application._enableHistory=false;Sys.Application._historyFrame=null;Sys.Application._historyInitialized=false;Sys.Application._historyPointIsNew=false;Sys.Application._ignoreTimer=false;Sys.Application._initialState=null;Sys.Application._state={};Sys.Application._timerCookie=0;Sys.Application._timerHandler=null;Sys.Application._uniqueId=null;Sys._Application.prototype.get_stateString=function(){var a=null;if(Sys.Browser.agent===Sys.Browser.Firefox){var c=window.location.href,b=c.indexOf("#");if(b!==-1)a=c.substring(b+1);else a="";return a}else a=window.location.hash;if(a.length>0&&a.charAt(0)==="#")a=a.substring(1);return a};Sys._Application.prototype.get_enableHistory=function(){return this._enableHistory};Sys._Application.prototype.set_enableHistory=function(a){this._enableHistory=a};Sys._Application.prototype.add_navigate=function(a){this.get_events().addHandler("navigate",a)};Sys._Application.prototype.remove_navigate=function(a){this.get_events().removeHandler("navigate",a)};Sys._Application.prototype.addHistoryPoint=function(c,f){this._ensureHistory();var b=this._state;for(var a in c){var d=c[a];if(d===null){if(typeof b[a]!=="undefined")delete b[a]}else b[a]=d}var e=this._serializeState(b);this._historyPointIsNew=true;this._setState(e,f);this._raiseNavigate()};Sys._Application.prototype.setServerId=function(a,b){this._clientId=a;this._uniqueId=b};Sys._Application.prototype.setServerState=function(a){this._ensureHistory();this._state.__s=a;this._updateHiddenField(a)};Sys._Application.prototype._deserializeState=function(a){var e={};a=a||"";var b=a.indexOf("&&");if(b!==-1&&b+2<a.length){e.__s=a.substr(b+2);a=a.substr(0,b)}var g=a.split("&");for(var f=0,j=g.length;f<j;f++){var d=g[f],c=d.indexOf("=");if(c!==-1&&c+1<d.length){var i=d.substr(0,c),h=d.substr(c+1);e[i]=decodeURIComponent(h)}}return e};Sys._Application.prototype._enableHistoryInScriptManager=function(){this._enableHistory=true};Sys._Application.prototype._ensureHistory=function(){if(!this._historyInitialized&&this._enableHistory){if(Sys.Browser.agent===Sys.Browser.InternetExplorer&&(!document.documentMode||document.documentMode<8)){this._historyFrame=document.getElementById("__historyFrame");this._ignoreIFrame=true}this._timerHandler=Function.createDelegate(this,this._onIdle);this._timerCookie=window.setTimeout(this._timerHandler,100);try{this._initialState=this._deserializeState(this.get_stateString())}catch(a){}this._historyInitialized=true}};Sys._Application.prototype._navigate=function(c){this._ensureHistory();var b=this._deserializeState(c);if(this._uniqueId){var d=this._state.__s||"",a=b.__s||"";if(a!==d){this._updateHiddenField(a);__doPostBack(this._uniqueId,a);this._state=b;return}}this._setState(c);this._state=b;this._raiseNavigate()};Sys._Application.prototype._onIdle=function(){delete this._timerCookie;var a=this.get_stateString();if(a!==this._currentEntry){if(!this._ignoreTimer){this._historyPointIsNew=false;this._navigate(a)}}else this._ignoreTimer=false;this._timerCookie=window.setTimeout(this._timerHandler,100)};
5Sys._Application.prototype._onIFrameLoad=function(a){if(!document.documentMode||document.documentMode<8){this._ensureHistory();if(!this._ignoreIFrame){this._historyPointIsNew=false;this._navigate(a)}this._ignoreIFrame=false}};Sys._Application.prototype._onPageRequestManagerBeginRequest=function(){this._ignoreTimer=true;this._originalTitle=document.title};Sys._Application.prototype._onPageRequestManagerEndRequest=function(g,f){var d=f.get_dataItems()[this._clientId],c=this._originalTitle;this._originalTitle=null;var b=document.getElementById("__EVENTTARGET");if(b&&b.value===this._uniqueId)b.value="";if(typeof d!=="undefined"){this.setServerState(d);this._historyPointIsNew=true}else this._ignoreTimer=false;var a=this._serializeState(this._state);if(a!==this._currentEntry){this._ignoreTimer=true;if(typeof c==="string"){if(Sys.Browser.agent!==Sys.Browser.InternetExplorer||Sys.Browser.version>7){var e=document.title;document.title=c;this._setState(a);document.title=e}else this._setState(a);this._raiseNavigate()}else{this._setState(a);this._raiseNavigate()}}};Sys._Application.prototype._raiseNavigate=function(){var d=this._historyPointIsNew,c=this.get_events().getHandler("navigate"),b={};for(var a in this._state)if(a!=="__s")b[a]=this._state[a];var e=new Sys.HistoryEventArgs(b);if(c)c(this,e);if(!d){var f;try{if(Sys.Browser.agent===Sys.Browser.Firefox&&window.location.hash&&(!window.frameElement||window.top.location.hash))Sys.Browser.version<3.5?window.history.go(0):(location.hash=this.get_stateString())}catch(g){}}};Sys._Application.prototype._serializeState=function(d){var b=[];for(var a in d){var e=d[a];if(a==="__s")var c=e;else b[b.length]=a+"="+encodeURIComponent(e)}return b.join("&")+(c?"&&"+c:"")};Sys._Application.prototype._setState=function(a,b){if(this._enableHistory){a=a||"";if(a!==this._currentEntry){if(window.theForm){var d=window.theForm.action,e=d.indexOf("#");window.theForm.action=(e!==-1?d.substring(0,e):d)+"#"+a}if(this._historyFrame&&this._historyPointIsNew){var f=document.createElement("div");f.appendChild(document.createTextNode(b||document.title));var g=f.innerHTML;this._ignoreIFrame=true;var c=this._historyFrame.contentWindow.document;c.open("javascript:'<html></html>'");c.write("<html><head><title>"+g+"</title><scri"+'pt type="text/javascript">parent.Sys.Application._onIFrameLoad('+Sys.Serialization.JavaScriptSerializer.serialize(a)+");</scri"+"pt></head><body></body></html>");c.close()}this._ignoreTimer=false;this._currentEntry=a;if(this._historyFrame||this._historyPointIsNew){var h=this.get_stateString();if(a!==h){window.location.hash=a;this._currentEntry=this.get_stateString();if(typeof b!=="undefined"&&b!==null)document.title=b}}this._historyPointIsNew=false}}};Sys._Application.prototype._updateHiddenField=function(b){if(this._clientId){var a=document.getElementById(this._clientId);if(a)a.value=b}};if(!window.XMLHttpRequest)window.XMLHttpRequest=function(){var b=["Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP"];for(var a=0,c=b.length;a<c;a++)try{return new ActiveXObject(b[a])}catch(d){}return null};Type.registerNamespace("Sys.Net");Sys.Net.WebRequestExecutor=function(){this._webRequest=null;this._resultObject=null};Sys.Net.WebRequestExecutor.prototype={get_webRequest:function(){return this._webRequest},_set_webRequest:function(a){this._webRequest=a},get_started:function(){throw Error.notImplemented()},get_responseAvailable:function(){throw Error.notImplemented()},get_timedOut:function(){throw Error.notImplemented()},get_aborted:function(){throw Error.notImplemented()},get_responseData:function(){throw Error.notImplemented()},get_statusCode:function(){throw Error.notImplemented()},get_statusText:function(){throw Error.notImplemented()},get_xml:function(){throw Error.notImplemented()},get_object:function(){if(!this._resultObject)this._resultObject=Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());return this._resultObject},executeRequest:function(){throw Error.notImplemented()},abort:function(){throw Error.notImplemented()},getResponseHeader:function(){throw Error.notImplemented()},getAllResponseHeaders:function(){throw Error.notImplemented()}};Sys.Net.WebRequestExecutor.registerClass("Sys.Net.WebRequestExecutor");Sys.Net.XMLDOM=function(d){if(!window.DOMParser){var c=["Msxml2.DOMDocument.3.0","Msxml2.DOMDocument"];for(var b=0,f=c.length;b<f;b++)try{var a=new ActiveXObject(c[b]);a.async=false;a.loadXML(d);a.setProperty("SelectionLanguage","XPath");return a}catch(g){}}
5else try{var e=new window.DOMParser;return e.parseFromString(d,"text/xml")}catch(g){}return null};Sys.Net.XMLHttpExecutor=function(){Sys.Net.XMLHttpExecutor.initializeBase(this);var a=this;this._xmlHttpRequest=null;this._webRequest=null;this._responseAvailable=false;this._timedOut=false;this._timer=null;this._aborted=false;this._started=false;this._onReadyStateChange=function(){if(a._xmlHttpRequest.readyState===4){try{if(typeof a._xmlHttpRequest.status==="undefined"||a._xmlHttpRequest.status===0)return}catch(b){return}a._clearTimer();a._responseAvailable=true;try{a._webRequest.completed(Sys.EventArgs.Empty)}finally{if(a._xmlHttpRequest!=null){a._xmlHttpRequest.onreadystatechange=Function.emptyMethod;a._xmlHttpRequest=null}}}};this._clearTimer=function(){if(a._timer!=null){window.clearTimeout(a._timer);a._timer=null}};this._onTimeout=function(){if(!a._responseAvailable){a._clearTimer();a._timedOut=true;a._xmlHttpRequest.onreadystatechange=Function.emptyMethod;a._xmlHttpRequest.abort();a._webRequest.completed(Sys.EventArgs.Empty);a._xmlHttpRequest=null}}};Sys.Net.XMLHttpExecutor.prototype={get_timedOut:function(){return this._timedOut},get_started:function(){return this._started},get_responseAvailable:function(){return this._responseAvailable},get_aborted:function(){return this._aborted},executeRequest:function(){this._webRequest=this.get_webRequest();var c=this._webRequest.get_body(),a=this._webRequest.get_headers();this._xmlHttpRequest=new XMLHttpRequest;this._xmlHttpRequest.onreadystatechange=this._onReadyStateChange;var e=this._webRequest.get_httpVerb();this._xmlHttpRequest.open(e,this._webRequest.getResolvedUrl(),true);this._xmlHttpRequest.setRequestHeader("X-Requested-With","XMLHttpRequest");if(a)for(var b in a){var f=a[b];if(typeof f!=="function")this._xmlHttpRequest.setRequestHeader(b,f)}if(e.toLowerCase()==="post"){if(a===null||!a["Content-Type"])this._xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");if(!c)c=""}var d=this._webRequest.get_timeout();if(d>0)this._timer=window.setTimeout(Function.createDelegate(this,this._onTimeout),d);this._xmlHttpRequest.send(c);this._started=true},getResponseHeader:function(b){var a;try{a=this._xmlHttpRequest.getResponseHeader(b)}catch(c){}if(!a)a="";return a},getAllResponseHeaders:function(){return this._xmlHttpRequest.getAllResponseHeaders()},get_responseData:function(){return this._xmlHttpRequest.responseText},get_statusCode:function(){var a=0;try{a=this._xmlHttpRequest.status}catch(b){}return a},get_statusText:function(){return this._xmlHttpRequest.statusText},get_xml:function(){var a=this._xmlHttpRequest.responseXML;if(!a||!a.documentElement){a=Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);if(!a||!a.documentElement)return null}else if(navigator.userAgent.indexOf("MSIE")!==-1&&typeof a.setProperty!="undefined")a.setProperty("SelectionLanguage","XPath");if(a.documentElement.namespaceURI==="http://www.mozilla.org/newlayout/xml/parsererror.xml"&&a.documentElement.tagName==="parsererror")return null;if(a.documentElement.firstChild&&a.documentElement.firstChild.tagName==="parsererror")return null;return a},abort:function(){if(this._aborted||this._responseAvailable||this._timedOut)return;this._aborted=true;this._clearTimer();if(this._xmlHttpRequest&&!this._responseAvailable){this._xmlHttpRequest.onreadystatechange=Function.emptyMethod;this._xmlHttpRequest.abort();this._xmlHttpRequest=null;this._webRequest.completed(Sys.EventArgs.Empty)}}};Sys.Net.XMLHttpExecutor.registerClass("Sys.Net.XMLHttpExecutor",Sys.Net.WebRequestExecutor);Sys.Net._WebRequestManager=function(){this._defaultTimeout=0;this._defaultExecutorType="Sys.Net.XMLHttpExecutor"};Sys.Net._WebRequestManager.prototype={add_invokingRequest:function(a){this._get_eventHandlerList().addHandler("invokingRequest",a)},remove_invokingRequest:function(a){this._get_eventHandlerList().removeHandler("invokingRequest",a)},add_completedRequest:function(a){this._get_eventHandlerList().addHandler("completedRequest",a)},remove_completedRequest:function(a){this._get_eventHandlerList().removeHandler("completedRequest",a)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_defaultTimeout:function(){return this._defaultTimeout},set_defaultTimeout:function(a){this._defaultTimeout=a},get_defaultExecutorType:function(){return this._defaultExecutorType},set_defaultExecutorType:function(a){this._defaultExecutorType=a},executeRequest:function(webRequest){var executor=webRequest.get_executor();if(!executor){var failed=false;try{var executorType=eval(this._defaultExecutorType);executor=new executorType}catch(a){failed=true}webRequest.set_executor(executor)}if(executor.get_aborted())return;var evArgs=new Sys.Net.NetworkRequestEventArgs(webRequest),handler=this._get_eventHandlerList().getHandler("invokingRequest");
5if(handler)handler(this,evArgs);if(!evArgs.get_cancel())executor.executeRequest()}};Sys.Net._WebRequestManager.registerClass("Sys.Net._WebRequestManager");Sys.Net.WebRequestManager=new Sys.Net._WebRequestManager;Sys.Net.NetworkRequestEventArgs=function(a){Sys.Net.NetworkRequestEventArgs.initializeBase(this);this._webRequest=a};Sys.Net.NetworkRequestEventArgs.prototype={get_webRequest:function(){return this._webRequest}};Sys.Net.NetworkRequestEventArgs.registerClass("Sys.Net.NetworkRequestEventArgs",Sys.CancelEventArgs);Sys.Net.WebRequest=function(){this._url="";this._headers={};this._body=null;this._userContext=null;this._httpVerb=null;this._executor=null;this._invokeCalled=false;this._timeout=0};Sys.Net.WebRequest.prototype={add_completed:function(a){this._get_eventHandlerList().addHandler("completed",a)},remove_completed:function(a){this._get_eventHandlerList().removeHandler("completed",a)},completed:function(b){var a=Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");if(a)a(this._executor,b);a=this._get_eventHandlerList().getHandler("completed");if(a)a(this._executor,b)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_url:function(){return this._url},set_url:function(a){this._url=a},get_headers:function(){return this._headers},get_httpVerb:function(){if(this._httpVerb===null){if(this._body===null)return "GET";return "POST"}return this._httpVerb},set_httpVerb:function(a){this._httpVerb=a},get_body:function(){return this._body},set_body:function(a){this._body=a},get_userContext:function(){return this._userContext},set_userContext:function(a){this._userContext=a},get_executor:function(){return this._executor},set_executor:function(a){this._executor=a;this._executor._set_webRequest(this)},get_timeout:function(){if(this._timeout===0)return Sys.Net.WebRequestManager.get_defaultTimeout();return this._timeout},set_timeout:function(a){this._timeout=a},getResolvedUrl:function(){return Sys.Net.WebRequest._resolveUrl(this._url)},invoke:function(){Sys.Net.WebRequestManager.executeRequest(this);this._invokeCalled=true}};Sys.Net.WebRequest._resolveUrl=function(b,a){if(b&&b.indexOf("://")!==-1)return b;if(!a||a.length===0){var d=document.getElementsByTagName("base")[0];if(d&&d.href&&d.href.length>0)a=d.href;else a=document.URL}var c=a.indexOf("?");if(c!==-1)a=a.substr(0,c);c=a.indexOf("#");if(c!==-1)a=a.substr(0,c);a=a.substr(0,a.lastIndexOf("/")+1);if(!b||b.length===0)return a;if(b.charAt(0)==="/"){var e=a.indexOf("://"),g=a.indexOf("/",e+3);return a.substr(0,g)+b}else{var f=a.lastIndexOf("/");return a.substr(0,f+1)+b}};Sys.Net.WebRequest._createQueryString=function(c,b,f){b=b||encodeURIComponent;var h=0,e,g,d,a=new Sys.StringBuilder;if(c)for(d in c){e=c[d];if(typeof e==="function")continue;g=Sys.Serialization.JavaScriptSerializer.serialize(e);if(h++)a.append("&");a.append(d);a.append("=");a.append(b(g))}if(f){if(h)a.append("&");a.append(f)}return a.toString()};Sys.Net.WebRequest._createUrl=function(a,b,c){if(!b&&!c)return a;var d=Sys.Net.WebRequest._createQueryString(b,null,c);return d.length?a+(a&&a.indexOf("?")>=0?"&":"?")+d:a};Sys.Net.WebRequest.registerClass("Sys.Net.WebRequest");Sys._ScriptLoaderTask=function(b,a){this._scriptElement=b;this._completedCallback=a};Sys._ScriptLoaderTask.prototype={get_scriptElement:function(){return this._scriptElement},dispose:function(){if(this._disposed)return;this._disposed=true;this._removeScriptElementHandlers();Sys._ScriptLoaderTask._clearScript(this._scriptElement);this._scriptElement=null},execute:function(){if(this._ensureReadyStateLoaded())this._executeInternal()},_executeInternal:function(){this._addScriptElementHandlers();document.getElementsByTagName("head")[0].appendChild(this._scriptElement)},_ensureReadyStateLoaded:function(){if(this._useReadyState()&&this._scriptElement.readyState!=="loaded"&&this._scriptElement.readyState!=="complete"){this._scriptDownloadDelegate=Function.createDelegate(this,this._executeInternal);$addHandler(this._scriptElement,"readystatechange",this._scriptDownloadDelegate);return false}return true},_addScriptElementHandlers:function(){if(this._scriptDownloadDelegate){$removeHandler(this._scriptElement,"readystatechange",this._scriptDownloadDelegate);this._scriptDownloadDelegate=null}this._scriptLoadDelegate=Function.createDelegate(this,this._scriptLoadHandler);if(this._useReadyState())$addHandler(this._scriptElement,"readystatechange",this._scriptLoadDelegate);else $addHandler(this._scriptElement,"load",this._scriptLoadDelegate);if(this._scriptElement.addEventListener){this._scriptErrorDelegate=Function.createDelegate(this,this._scriptErrorHandler);this._scriptElement.addEventListener("error",this._scriptErrorDelegate,false)}},_removeScriptElementHandlers:function(){if(this._scriptLoadDelegate){var a=this.get_scriptElement();if(this._scriptDownloadDelegate){$removeHandler(this._scriptElement,"readystatechange",this._scriptDownloadDelegate);this._scriptDownloadDelegate=null}if(this._useReadyState()&&this._scriptLoadDelegate)$removeHandler(a,"readystatechange",this._scriptLoadDelegate);else $removeHandler(a,"load",this._scriptLoadDelegate);if(this._scriptErrorDelegate){this._scriptElement.removeEventListener("error",this._scriptErrorDelegate,false);this._scriptErrorDelegate=null}this._scriptLoadDelegate=null}},_scriptErrorHandler:function(){if(this._disposed)return;this._completedCallback(this.get_scriptElement(),false)},_scriptLoadHandler:function(){if(this._disposed)return;var a=this.get_scriptElement();if(this._useReadyState()&&a.readyState!=="complete")return;this._completedCallback(a,true)},_useReadyState:function(){return Sys.Browser.agent===Sys.Browser.InternetExplorer&&(Sys.Browser.version<9||(document.documentMode||0)<9)}};Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask",null,Sys.IDisposable);
5Sys._ScriptLoaderTask._clearScript=function(a){if(!Sys.Debug.isDebug&&a.parentNode)a.parentNode.removeChild(a)};Type.registerNamespace("Sys.Net");Sys.Net.WebServiceProxy=function(){};Sys.Net.WebServiceProxy.prototype={get_timeout:function(){return this._timeout||0},set_timeout:function(a){if(a<0)throw Error.argumentOutOfRange("value",a,Sys.Res.invalidTimeout);this._timeout=a},get_defaultUserContext:function(){return typeof this._userContext==="undefined"?null:this._userContext},set_defaultUserContext:function(a){this._userContext=a},get_defaultSucceededCallback:function(){return this._succeeded||null},set_defaultSucceededCallback:function(a){this._succeeded=a},get_defaultFailedCallback:function(){return this._failed||null},set_defaultFailedCallback:function(a){this._failed=a},get_enableJsonp:function(){return !!this._jsonp},set_enableJsonp:function(a){this._jsonp=a},get_path:function(){return this._path||null},set_path:function(a){this._path=a},get_jsonpCallbackParameter:function(){return this._callbackParameter||"callback"},set_jsonpCallbackParameter:function(a){this._callbackParameter=a},_invoke:function(d,e,g,f,c,b,a){c=c||this.get_defaultSucceededCallback();b=b||this.get_defaultFailedCallback();if(a===null||typeof a==="undefined")a=this.get_defaultUserContext();return Sys.Net.WebServiceProxy.invoke(d,e,g,f,c,b,a,this.get_timeout(),this.get_enableJsonp(),this.get_jsonpCallbackParameter())}};Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy");Sys.Net.WebServiceProxy.invoke=function(q,a,m,l,j,b,g,e,w,p){var i=w!==false?Sys.Net.WebServiceProxy._xdomain.exec(q):null,c,n=i&&i.length===3&&(i[1]!==location.protocol||i[2]!==location.host);m=n||m;if(n){p=p||"callback";c="_jsonp"+Sys._jsonp++}if(!l)l={};var r=l;if(!m||!r)r={};var s,h,f=null,k,o=null,u=Sys.Net.WebRequest._createUrl(a?q+"/"+encodeURIComponent(a):q,r,n?p+"=Sys."+c:null);if(n){s=document.createElement("script");s.src=u;k=new Sys._ScriptLoaderTask(s,function(d,b){if(!b||c)t({Message:String.format(Sys.Res.webServiceFailedNoMsg,a)},-1)});function v(){if(f===null)return;f=null;h=new Sys.Net.WebServiceError(true,String.format(Sys.Res.webServiceTimedOut,a));k.dispose();delete Sys[c];if(b)b(h,g,a)}function t(d,e){if(f!==null){window.clearTimeout(f);f=null}k.dispose();delete Sys[c];c=null;if(typeof e!=="undefined"&&e!==200){if(b){h=new Sys.Net.WebServiceError(false,d.Message||String.format(Sys.Res.webServiceFailedNoMsg,a),d.StackTrace||null,d.ExceptionType||null,d);h._statusCode=e;b(h,g,a)}}else if(j)j(d,g,a)}Sys[c]=t;e=e||Sys.Net.WebRequestManager.get_defaultTimeout();if(e>0)f=window.setTimeout(v,e);k.execute();return null}var d=new Sys.Net.WebRequest;d.set_url(u);d.get_headers()["Content-Type"]="application/json; charset=utf-8";if(!m){o=Sys.Serialization.JavaScriptSerializer.serialize(l);if(o==="{}")o=""}d.set_body(o);d.add_completed(x);if(e&&e>0)d.set_timeout(e);d.invoke();function x(d){if(d.get_responseAvailable()){var f=d.get_statusCode(),c=null;try{var e=d.getResponseHeader("Content-Type");if(e.startsWith("application/json"))c=d.get_object();else if(e.startsWith("text/xml"))c=d.get_xml();else c=d.get_responseData()}catch(m){}var k=d.getResponseHeader("jsonerror"),h=k==="true";if(h){if(c)c=new Sys.Net.WebServiceError(false,c.Message,c.StackTrace,c.ExceptionType,c)}else if(e.startsWith("application/json"))c=!c||typeof c.d==="undefined"?c:c.d;if(f<200||f>=300||h){if(b){if(!c||!h)c=new Sys.Net.WebServiceError(false,String.format(Sys.Res.webServiceFailedNoMsg,a));c._statusCode=f;b(c,g,a)}}else if(j)j(c,g,a)}else{var i;if(d.get_timedOut())i=String.format(Sys.Res.webServiceTimedOut,a);else i=String.format(Sys.Res.webServiceFailedNoMsg,a);if(b)b(new Sys.Net.WebServiceError(d.get_timedOut(),i,"",""),g,a)}}return d};Sys.Net.WebServiceProxy._generateTypedConstructor=function(a){return function(b){if(b)for(var c in b)this[c]=b[c];this.__type=a}};Sys._jsonp=0;Sys.Net.WebServiceProxy._xdomain=/^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;Sys.Net.WebServiceError=function(d,e,c,a,b){this._timedOut=d;this._message=e;this._stackTrace=c;this._exceptionType=a;this._errorObject=b;this._statusCode=-1};Sys.Net.WebServiceError.prototype={get_timedOut:function(){return this._timedOut},get_statusCode:function(){return this._statusCode},get_message:function(){return this._message},get_stackTrace:function(){return this._stackTrace||""},get_exceptionType:function(){return this._exceptionType||""},get_errorObject:function(){return this._errorObject||null}};Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError"); 6Type.registerNamespace('Sys');Sys.Res={"argumentInteger":"Value must be an integer.","invokeCalledTwice":"Cannot call invoke more than once.","webServiceFailed":"The server method \u0027{0}\u0027 failed with the following error: {1}","argumentType":"Object cannot be converted to the required type.","argumentNull":"Value cannot be null.","scriptAlreadyLoaded":"The script \u0027{0}\u0027 has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.","scriptDependencyNotFound":"The script \u0027{0}\u0027 failed to load because it is dependent on script \u0027{1}\u0027.","formatBadFormatSpecifier":"Format specifier was invali
6d.","requiredScriptReferenceNotIncluded":"\u0027{0}\u0027 requires that you have included a script reference to \u0027{1}\u0027.","webServiceFailedNoMsg":"The server method \u0027{0}\u0027 failed.","argumentDomElement":"Value must be a DOM element.","invalidExecutorType":"Could not create a valid Sys.Net.WebRequestExecutor from: {0}.","cannotCallBeforeResponse":"Cannot call {0} when responseAvailable is false.","actualValue":"Actual value was {0}.","enumInvalidValue":"\u0027{0}\u0027 is not a valid value for enum {1}.","scriptLoadFailed":"The script \u0027{0}\u0027 could not be loaded.","parameterCount":"Parameter count mismatch.","cannotDeserializeEmptyString":"Cannot deserialize empty string.","formatInvalidString":"Input string was not in a correct format.","invalidTimeout":"Value must be greater than or equal to zero.","cannotAbortBeforeStart":"Cannot abort when executor has not started.","argument":"Value does not fall within the expected range.","cannotDeserializeInvalidJson":"Cannot deserialize. The data does not correspond to valid JSON.","invalidHttpVerb":"httpVerb cannot be set to an empty or null string.","nullWebRequest":"Cannot call executeRequest with a null webRequest.","eventHandlerInvalid":"Handler was not added through the Sys.UI.DomEvent.addHandler method.","cannotSerializeNonFiniteNumbers":"Cannot serialize non finite numbers.","argumentUndefined":"Value cannot be undefined.","webServiceInvalidReturnType":"The server method \u0027{0}\u0027 returned an invalid type. Expected type: {1}","servicePathNotSet":"The path to the web service has not been set.","argumentTypeWithTypes":"Object of type \u0027{0}\u0027 cannot be converted to type \u0027{1}\u0027.","cannotCallOnceStarted":"Cannot call {0} once started.","badBaseUrl1":"Base URL does not contain ://.","badBaseUrl2":"Base URL does not contain another /.","badBaseUrl3":"Cannot find last / in base URL.","setExecutorAfterActive":"Cannot set executor after it has become active.","paramName":"Parameter name: {0}","nullReferenceInPath":"Null reference while evaluating data path: \u0027{0}\u0027.","cannotCallOutsideHandler":"Cannot call {0} outside of a completed event handler.","cannotSerializeObjectWithCycle":"Cannot serialize object with cyclic reference within child properties.","format":"One of the identified items was in an invalid format.","assertFailedCaller":"Assertion Failed: {0}\r\nat {1}","argumentOutOfRange":"Specified argument was out of the range of valid values.","webServiceTimedOut":"The server method \u0027{0}\u0027 timed out.","notImplemented":"The method or operation is not implemented.","assertFailed":"Assertion Failed: {0}","invalidOperation":"Operation is not valid due to the current state of the object.","breakIntoDebugger":"{0}\r\n\r\nBreak into debugger?"}; 7//---------------------------------------------------------- 8// Copyright (C) Microsoft Corporation. All rights reserved. 9//---------------------------------------------------------- 10// MicrosoftAjaxWebForms.js 11Type._registerScript("MicrosoftAjaxWebForms.js",["MicrosoftAjaxCore.js","MicrosoftAjaxSerialization.js","MicrosoftAjaxNetwork.js","MicrosoftAjaxComponentModel.js"]);Type.registerNamespace("Sys.WebForms");Sys.WebForms.BeginRequestEventArgs=function(c,b,a){Sys.WebForms.BeginRequestEventArgs.initializeBase(this);this._request=c;this._postBackElement=b;this._updatePanelsToUpdate=a};Sys.WebForms.BeginRequestEventArgs.prototype={get_postBackElement:function(){return this._postBackElement},get_request:function(){return this._request},get_updatePanelsToUpdate:function(){return this._updatePanelsToUpdate?Array.clone(this._updatePanelsToUpdate):[]}};Sys.WebForms.BeginRequestEventArgs.registerClass("Sys.WebForms.BeginRequestEventArgs",Sys.EventArgs);Sys.WebForms.EndRequestEventArgs=function(c,a,b){Sys.WebForms.EndRequestEventArgs.initializeBase(this);this._errorHandled=false;this._error=c;this._dataItems=a||{};this._response=b};Sys.WebForms.EndRequestEventArgs.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}};Sys.WebForms.EndRequestEventArgs.registerClass("Sys.WebForms.EndRequestEventArgs",Sys.EventArgs);Sys.WebForms.InitializeRequestEventArgs=function(c,b,a){Sys.WebForms.InitializeRequestEventArgs.initializeBase(this);this._request=c;this._postBackElement=b;
11this._updatePanelsToUpdate=a};Sys.WebForms.InitializeRequestEventArgs.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=true;this._updatePanelsToUpdate=a}};Sys.WebForms.InitializeRequestEventArgs.registerClass("Sys.WebForms.InitializeRequestEventArgs",Sys.CancelEventArgs);Sys.WebForms.PageLoadedEventArgs=function(b,a,c){Sys.WebForms.PageLoadedEventArgs.initializeBase(this);this._panelsUpdated=b;this._panelsCreated=a;this._dataItems=c||{}};Sys.WebForms.PageLoadedEventArgs.prototype={get_dataItems:function(){return this._dataItems},get_panelsCreated:function(){return this._panelsCreated},get_panelsUpdated:function(){return this._panelsUpdated}};Sys.WebForms.PageLoadedEventArgs.registerClass("Sys.WebForms.PageLoadedEventArgs",Sys.EventArgs);Sys.WebForms.PageLoadingEventArgs=function(b,a,c){Sys.WebForms.PageLoadingEventArgs.initializeBase(this);this._panelsUpdating=b;this._panelsDeleting=a;this._dataItems=c||{}};Sys.WebForms.PageLoadingEventArgs.prototype={get_dataItems:function(){return this._dataItems},get_panelsDeleting:function(){return this._panelsDeleting},get_panelsUpdating:function(){return this._panelsUpdating}};Sys.WebForms.PageLoadingEventArgs.registerClass("Sys.WebForms.PageLoadingEventArgs",Sys.EventArgs);Sys._ScriptLoader=function(){this._scriptsToLoad=null;this._sessions=[];this._scriptLoadedDelegate=Function.createDelegate(this,this._scriptLoadedHandler)};Sys._ScriptLoader.prototype={dispose:function(){this._stopSession();this._loading=false;if(this._events)delete this._events;this._sessions=null;this._currentSession=null;this._scriptLoadedDelegate=null},loadScripts:function(d,b,c,a){var e={allScriptsLoadedCallback:b,scriptLoadFailedCallback:c,scriptLoadTimeoutCallback:a,scriptsToLoad:this._scriptsToLoad,scriptTimeout:d};this._scriptsToLoad=null;this._sessions[this._sessions.length]=e;if(!this._loading)this._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,b){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{src:a,fallback:b})},_createScriptElement:function(c){var a=document.createElement("script");a.type="text/javascript";for(var b in c)a[b]=c[b];return a},_loadScriptsInternal:function(){var c=this._currentSession;if(c.scriptsToLoad&&c.scriptsToLoad.length>0){var b=Array.dequeue(c.scriptsToLoad),f=this._scriptLoadedDelegate;if(b.fallback){var g=b.fallback;delete b.fallback;var d=this;f=function(b,a){a||function(){var a=d._createScriptElement({src:g});d._currentTask=new Sys._ScriptLoaderTask(a,d._scriptLoadedDelegate);d._currentTask.execute()}()}}var a=this._createScriptElement(b);if(a.text&&Sys.Browser.agent===Sys.Browser.Safari){a.innerHTML=a.text;delete a.text}if(typeof b.src==="string"){this._currentTask=new Sys._ScriptLoaderTask(a,f);this._currentTask.execute()}else{document.getElementsByTagName("head")[0].appendChild(a);Sys._ScriptLoaderTask._clearScript(a);this._loadScriptsInternal()}}else{this._stopSession();var e=c.allScriptsLoadedCallback;if(e)e(this);this._nextSession()}},_nextSession:function(){if(this._sessions.length===0){this._loading=false;this._currentSession=null;return}this._loading=true;var a=Array.dequeue(this._sessions);this._currentSession=a;if(a.scriptTimeout>0)this._timeoutCookie=window.setTimeout(Function.createDelegate(this,this._scriptLoadTimeoutHandler),a.scriptTimeout*1000);this._loadScriptsInternal()},_raiseError:function(){var b=this._currentSession.scriptLoadFailedCallback,a=this._currentTask.get_scriptElement();this._stopSession();if(b){b(this,a);this._nextSession()}else{this._loading=false;throw Sys._ScriptLoader._errorScriptLoadFailed(a.src)}},_scriptLoadedHandler:function(a,b){if(b){Array.add(Sys._ScriptLoader._getLoadedScripts(),a.src);this._currentTask.dispose();this._currentTask=null;this._loadScriptsInternal()}else this._raiseError()},_scriptLoadTimeoutHandler:function(){var a=this._currentSession.scriptLoadTimeoutCallback;this._stopSession();if(a)a(this);this._nextSession()},_stopSession:function(){if(this._timeoutCookie){window.clearTimeout(this._timeoutCookie);this._timeoutCookie=null}if(this._currentTask){this._currentTask.dispose();this._currentTask=null}}};Sys._ScriptLoader.registerClass("Sys._ScriptLoader",null,Sys.IDisposable);Sys._ScriptLoader.getInstance=function(){var a=Sys._ScriptLoader._activeInstance;if(!a)a=Sys._ScriptLoader._activeInstance=new Sys._ScriptLoader;return a};Sys._ScriptLoader.isScriptLoaded=function(b){var a=document.createElement("script");a.src=b;return Array.contains(Sys._ScriptLoader._getLoadedScripts(),a.src)};Sys._ScriptLoader.readLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){var c=Sys._ScriptLoader._referencedScripts=[],d=document.getElementsByTagName("script");for(var b=d.length-1;b>=0;b--){var e=d[b],a=e.src;if(a.length)if(!Array.contains(c,a))Array.add(c,a)}}};Sys._ScriptLoader._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};Sys._ScriptLoader._getLoadedScripts=function(){if(!Sys._ScriptLoader._referencedScripts){Sys._ScriptLoader._referencedScripts=[];Sys._ScriptLoader.readLoadedScripts()}return Sys._ScriptLoader._referencedScripts};Sys.WebForms.PageRequestManager=function(){this._form=null;this._activeDefaultButton=null;this._activeDefaultButtonClicked=false;this._updatePanelIDs=null;this._updatePanelClientIDs=null;this._updatePanelHasChildrenAsTriggers=null;this._asyncPostBackControlIDs=null;this._asyncPostBackControlClientIDs=null;this._postBackControlIDs=null;this._postBackControlClientIDs=null;this._scriptManagerID=null;this._pageLoadedHandler=null;this._additionalInput=null;this._onsubmit=null;this._onSubmitStatements=[];this._originalDoPostBack=null;this._originalDoPostBackWithOptions=null;this._originalFireDefaultButton=null;this._originalDoCallback=null;this._isCrossPost=false;this._postBackSettings=null;this._request=null;this._onFormSubmitHandler=null;this._onFormElementClickHandler=null;this._onWindowUnloadHandler=null;this._asyncPostBackTimeout=null;this._controlIDToFocus=null;this._scrollPosition=null;this._processingRequest=false;this._scriptDisposes={};this._transientFields=["__VIEWSTATEENCRYPTED","__VIEWSTATEFIELDCOUNT"];this._textTypes=/^(text|password|hidden|search|tel|url|email|number|range|c
11olor|datetime|date|month|week|time|datetime-local)$/i};Sys.WebForms.PageRequestManager.prototype={_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_isInAsyncPostBack:function(){return this._request!==null},add_beginRequest:function(a){this._get_eventHandlerList().addHandler("beginRequest",a)},remove_beginRequest:function(a){this._get_eventHandlerList().removeHandler("beginRequest",a)},add_endRequest:function(a){this._get_eventHandlerList().addHandler("endRequest",a)},remove_endRequest:function(a){this._get_eventHandlerList().removeHandler("endRequest",a)},add_initializeRequest:function(a){this._get_eventHandlerList().addHandler("initializeRequest",a)},remove_initializeRequest:function(a){this._get_eventHandlerList().removeHandler("initializeRequest",a)},add_pageLoaded:function(a){this._get_eventHandlerList().addHandler("pageLoaded",a)},remove_pageLoaded:function(a){this._get_eventHandlerList().removeHandler("pageLoaded",a)},add_pageLoading:function(a){this._get_eventHandlerList().addHandler("pageLoading",a)},remove_pageLoading:function(a){this._get_eventHandlerList().removeHandler("pageLoading",a)},abortPostBack:function(){if(!this._processingRequest&&this._request){this._request.get_executor().abort();this._request=null}},beginAsyncPostBack:function(c,a,f,d,e){if(d&&typeof Page_ClientValidate==="function"&&!Page_ClientValidate(e||null))return;this._postBackSettings=this._createPostBackSettings(true,c,a);var b=this._form;b.__EVENTTARGET.value=a||"";b.__EVENTARGUMENT.value=f||"";this._isCrossPost=false;this._additionalInput=null;this._onFormSubmit()},_cancelPendingCallbacks:function(){for(var a=0,e=window.__pendingCallbacks.length;a<e;a++){var c=window.__pendingCallbacks[a];if(c){if(!c.async)window.__synchronousCallBackIndex=-1;window.__pendingCallbacks[a]=null;var d="__CALLBACKFRAME"+a,b=document.getElementById(d);if(b)b.parentNode.removeChild(b)}}},_commitControls:function(a,b){if(a){this._updatePanelIDs=a.updatePanelIDs;this._updatePanelClientIDs=a.updatePanelClientIDs;this._updatePanelHasChildrenAsTriggers=a.updatePanelHasChildrenAsTriggers;this._asyncPostBackControlIDs=a.asyncPostBackControlIDs;this._asyncPostBackControlClientIDs=a.asyncPostBackControlClientIDs;this._postBackControlIDs=a.postBackControlIDs;this._postBackControlClientIDs=a.postBackControlClientIDs}if(typeof b!=="undefined"&&b!==null)this._asyncPostBackTimeout=b*1000},_createHiddenField:function(c,d){var b,a=document.getElementById(c);if(a)if(!a._isContained)a.parentNode.removeChild(a);else b=a.parentNode;if(!b){b=document.createElement("span");b.style.cssText="display:none !important";this._form.appendChild(b)}b.innerHTML="<input type='hidden' />";a=b.childNodes[0];a._isContained=true;a.id=a.name=c;a.value=d},_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)+"="+encodeURIComponent(d)+"&"},_createPostBackSettings:function(d,a,c,b){return {async:d,asyncTarget:c,panelsToUpdate:a,sourceElement:b}},_convertToClientIDs:function(a,f,e,d){if(a)for(var b=0,h=a.length;b<h;b+=d?2:1){var c=a[b],g=(d?a[b+1]:"")||this._uniqueIDToClientID(c);Array.add(f,c);Array.add(e,g)}},dispose:function(){if(this._form){Sys.UI.DomEvent.removeHandler(this._form,"submit",this._onFormSubmitHandler);Sys.UI.DomEvent.removeHandler(this._form,"click",this._onFormElementClickHandler);Sys.UI.DomEvent.removeHandler(window,"unload",this._onWindowUnloadHandler);Sys.UI.DomEvent.removeHandler(window,"load",this._pageLoadedHandler)}if(this._originalDoPostBack){window.__doPostBack=this._originalDoPostBack;this._originalDoPostBack=null}if(this._originalDoPostBackWithOptions){window.WebForm_DoPostBackWithOptions=this._originalDoPostBackWithOptions;this._originalDoPostBackWithOptions=null}if(this._originalFireDefaultButton){window.WebForm_FireDefaultButton=this._originalFireDefaultButton;this._originalFireDefaultButton=null}if(this._originalDoCallback){window.WebForm_DoCallback=this._originalDoCallback;this._originalDoCallback=null}this._form=null;this._updatePanelIDs=null;this._updatePanelClientIDs=null;this._asyncPostBackControlIDs=null;this._asyncPostBackControlClientIDs=null;this._postBackControlIDs=null;this._postBackControlClientIDs=null;this._asyncPostBackTimeout=null;this._scrollPosition=null;this._activeElement=null},_doCallback:function(d,b,c,f,a,e){if(!this.get_isInAsyncPostBack())this._originalDoCallback(d,b,c,f,a,e)},_doPostBack:function(a,k){var f=window.event;if(!f){var d=arguments.callee?arguments.callee.caller:null;if(d){var j=30;while(d.arguments.callee.caller&&--j)d=d.arguments.callee.caller;f=j&&d.arguments.length?d.arguments[0]:null}}this._additionalInput=null;var h=this._form;if(a===null||typeof a==="undefined"||this._isCrossPost){this._postBackSettings=this._createPostBackSettings(false);this._isCrossPost=false}else{var c=this._masterPageUniqueID,l=this._uniqueIDToClientID(a),g=document.getElementById(l);if(!g&&c)if(a.indexOf(c+"$")===0)g=document.getElementById(l.substr(c.length+1));if(!g)if(Array.contains(this._asyncPostBackControlIDs,a))this._postBackSettings=this._createPostBackSettings(true,null,a);else if(Array.contains(this._postBackControlIDs,a))this._postBackSettings=this._createPostBackSettings(false);else{var e=this._findNearestElement(a);if(e)this._postBackSettings=this._getPostBackSettings(e,a);else{if(c){c+="$";if(a.indexOf(c)===0)e=this._findNearestElement(a.substr(c.length))}if(e)this._postBackSettings=this._getPostBackSettings(e,a);else{var b;try{b=f?f.target||f.srcElement:null}catch(n){}b=b||this._activeElement;
11var m=/__doPostBack\(|WebForm_DoPostBackWithOptions\(/;function i(b){b=b?b.toString():"";return m.test(b)&&b.indexOf("'"+a+"'")!==-1||b.indexOf('"'+a+'"')!==-1}if(b&&(b.name===a||i(b.href)||i(b.onclick)||i(b.onchange)))this._postBackSettings=this._getPostBackSettings(b,a);else this._postBackSettings=this._createPostBackSettings(false)}}}else this._postBackSettings=this._getPostBackSettings(g,a)}if(!this._postBackSettings.async){h.onsubmit=this._onsubmit;this._originalDoPostBack(a,k);h.onsubmit=null;return}h.__EVENTTARGET.value=a;h.__EVENTARGUMENT.value=k;this._onFormSubmit()},_doPostBackWithOptions:function(a){this._isCrossPost=a&&a.actionUrl;var d=true;if(a.validation)if(typeof Page_ClientValidate=="function")d=Page_ClientValidate(a.validationGroup);if(d){if(typeof a.actionUrl!="undefined"&&a.actionUrl!=null&&a.actionUrl.length>0)theForm.action=a.actionUrl;if(a.trackFocus){var c=theForm.elements["__LASTFOCUS"];if(typeof c!="undefined"&&c!=null)if(typeof document.activeElement=="undefined")c.value=a.eventTarget;else{var b=document.activeElement;if(typeof b!="undefined"&&b!=null)if(typeof b.id!="undefined"&&b.id!=null&&b.id.length>0)c.value=b.id;else if(typeof b.name!="undefined")c.value=b.name}}}if(a.clientSubmit)this._doPostBack(a.eventTarget,a.eventArgument)},_elementContains:function(b,a){while(a){if(a===b)return true;a=a.parentNode}return false},_endPostBack:function(a,d,f){if(this._request===d.get_webRequest()){this._processingRequest=false;this._additionalInput=null;this._request=null}var e=this._get_eventHandlerList().getHandler("endRequest"),b=false;if(e){var c=new Sys.WebForms.EndRequestEventArgs(a,f?f.dataItems:{},d);e(this,c);b=c.get_errorHandled()}if(a&&!b)throw a},_ensureUniqueIds:function(a){if(!a)return a;a=a instanceof Array?a:[a];var c=[];for(var b=0,f=a.length;b<f;b++){var e=a[b],d=Array.indexOf(this._updatePanelClientIDs,e);c.push(d>-1?this._updatePanelIDs[d]:e)}return c},_findNearestElement:function(a){while(a.length>0){var d=this._uniqueIDToClientID(a),c=document.getElementById(d);if(c)return c;var b=a.lastIndexOf("$");if(b===-1)return null;a=a.substring(0,b)}return null},_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(a,d){if(a.keyCode===13){var c=a.srcElement||a.target;if(!c||c.tagName.toLowerCase()!=="textarea"){var b=document.getElementById(d);if(b&&typeof b.click!=="undefined"){this._activeDefaultButton=b;this._activeDefaultButtonClicked=false;try{b.click()}finally{this._activeDefaultButton=null}a.cancelBubble=true;if(typeof a.stopPropagation==="function")a.stopPropagation();return false}}}return true},_getPageLoadedEventArgs:function(n,c){var m=[],l=[],k=c?c.version4:false,d=c?c.updatePanelData:null,e,g,h,b;if(!d){e=this._updatePanelIDs;g=this._updatePanelClientIDs;h=null;b=null}else{e=d.updatePanelIDs;g=d.updatePanelClientIDs;h=d.childUpdatePanelIDs;b=d.panelsToRefreshIDs}var a,f,j,i;if(b)for(a=0,f=b.length;a<f;a+=k?2:1){j=b[a];i=(k?b[a+1]:"")||this._uniqueIDToClientID(j);Array.add(m,document.getElementById(i))}for(a=0,f=e.length;a<f;a++)if(n||Array.indexOf(h,e[a])!==-1)Array.add(l,document.getElementById(g[a]));return new Sys.WebForms.PageLoadedEventArgs(m,l,c?c.dataItems:{})},_getPageLoadingEventArgs:function(f){var j=[],i=[],c=f.updatePanelData,k=c.oldUpdatePanelIDs,l=c.oldUpdatePanelClientIDs,n=c.updatePanelIDs,m=c.childUpdatePanelIDs,d=c.panelsToRefreshIDs,a,e,b,g,h=f.version4;for(a=0,e=d.length;a<e;a+=h?2:1){b=d[a];g=(h?d[a+1]:"")||this._uniqueIDToClientID(b);Array.add(j,document.getElementById(g))}for(a=0,e=k.length;a<e;a++){b=k[a];if(Array.indexOf(d,b)===-1&&(Array.indexOf(n,b)===-1||Array.indexOf(m,b)>-1))Array.add(i,document.getElementById(l[a]))}return new Sys.WebForms.PageLoadingEventArgs(j,i,f.dataItems)},_getPostBackSettings:function(a,c){var d=a,b=null;while(a){if(a.id){if(!b&&Array.contains(this._asyncPostBackControlClientIDs,a.id))b=this._createPostBackSettings(true,null,c,d);else if(!b&&Array.contains(this._postBackControlClientIDs,a.id))return this._createPostBackSettings(false);else{var e=Array.indexOf(this._updatePanelClientIDs,a.id);if(e!==-1)if(this._updatePanelHasChildrenAsTriggers[e])return this._createPostBackSettings(true,[this._updatePanelIDs[e]],c,d);else return this._createPostBackSettings(true,null,c,d)}if(!b&&this._matchesParentIDInList(a.id,this._asyncPostBackControlClientIDs))b=this._createPostBackSettings(true,null,c,d);else if(!b&&this._matchesParentIDInList(a.id,this._postBackControlClientIDs))return this._createPostBackSettings(false)}a=a.parentNode}if(!b)return this._createPostBackSettings(false);else return b},_getScrollPosition:function(){var a=document.documentElement;
11if(a&&(this._validPosition(a.scrollLeft)||this._validPosition(a.scrollTop)))return {x:a.scrollLeft,y:a.scrollTop};else{a=document.body;if(a&&(this._validPosition(a.scrollLeft)||this._validPosition(a.scrollTop)))return {x:a.scrollLeft,y:a.scrollTop};else if(this._validPosition(window.pageXOffset)||this._validPosition(window.pageYOffset))return {x:window.pageXOffset,y:window.pageYOffset};else return {x:0,y:0}}},_initializeInternal:function(f,g,a,b,e,c,d){if(this._prmInitialized)throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice);this._prmInitialized=true;this._masterPageUniqueID=d;this._scriptManagerID=f;this._form=Sys.UI.DomElement.resolveElement(g);this._onsubmit=this._form.onsubmit;this._form.onsubmit=null;this._onFormSubmitHandler=Function.createDelegate(this,this._onFormSubmit);this._onFormElementClickHandler=Function.createDelegate(this,this._onFormElementClick);this._onWindowUnloadHandler=Function.createDelegate(this,this._onWindowUnload);Sys.UI.DomEvent.addHandler(this._form,"submit",this._onFormSubmitHandler);Sys.UI.DomEvent.addHandler(this._form,"click",this._onFormElementClickHandler);Sys.UI.DomEvent.addHandler(window,"unload",this._onWindowUnloadHandler);this._originalDoPostBack=window.__doPostBack;if(this._originalDoPostBack)window.__doPostBack=Function.createDelegate(this,this._doPostBack);this._originalDoPostBackWithOptions=window.WebForm_DoPostBackWithOptions;if(this._originalDoPostBackWithOptions)window.WebForm_DoPostBackWithOptions=Function.createDelegate(this,this._doPostBackWithOptions);this._originalFireDefaultButton=window.WebForm_FireDefaultButton;if(this._originalFireDefaultButton)window.WebForm_FireDefaultButton=Function.createDelegate(this,this._fireDefaultButton);this._originalDoCallback=window.WebForm_DoCallback;if(this._originalDoCallback)window.WebForm_DoCallback=Function.createDelegate(this,this._doCallback);this._pageLoadedHandler=Function.createDelegate(this,this._pageLoadedInitialLoad);Sys.UI.DomEvent.addHandler(window,"load",this._pageLoadedHandler);if(a)this._updateControls(a,b,e,c,true)},_matchesParentIDInList:function(c,b){for(var a=0,d=b.length;a<d;a++)if(c.startsWith(b[a]+"_"))return true;return false},_onFormElementActive:function(a,d,e){if(a.disabled)return;this._activeElement=a;this._postBackSettings=this._getPostBackSettings(a,a.name);if(a.name){var b=a.tagName.toUpperCase();if(b==="INPUT"){var c=a.type;if(c==="submit")this._additionalInput=encodeURIComponent(a.name)+"="+encodeURIComponent(a.value);else if(c==="image")this._additionalInput=encodeURIComponent(a.name)+".x="+d+"&"+encodeURIComponent(a.name)+".y="+e}else if(b==="BUTTON"&&a.name.length!==0&&a.type==="submit")this._additionalInput=encodeURIComponent(a.name)+"="+encodeURIComponent(a.value)}},_onFormElementClick:function(a){this._activeDefaultButtonClicked=a.target===this._activeDefaultButton;this._onFormElementActive(a.target,a.offsetX,a.offsetY)},_onFormSubmit:function(i){var f,x,h=true,z=this._isCrossPost;this._isCrossPost=false;if(this._onsubmit)h=this._onsubmit();if(h)for(f=0,x=this._onSubmitStatements.length;f<x;f++)if(!this._onSubmitStatements[f]()){h=false;break}if(!h){if(i)i.preventDefault();return}var w=this._form;if(z)return;if(this._activeDefaultButton&&!this._activeDefaultButtonClicked)this._onFormElementActive(this._activeDefaultButton,0,0);if(!this._postBackSettings||!this._postBackSettings.async)return;var b=new Sys.StringBuilder,s=w.elements,B=s.length,t=this._createPanelID(null,this._postBackSettings);b.append(t);for(f=0;f<B;f++){var e=s[f],g=e.name;if(typeof g==="undefined"||g===null||g.length===0||g===this._scriptManagerID)continue;var n=e.tagName.toUpperCase();if(n==="INPUT"){var p=e.type;if(this._textTypes.test(p)||(p==="checkbox"||p==="radio")&&e.checked){b.append(encodeURIComponent(g));b.append("=");b.append(encodeURIComponent(e.value));b.append("&")}}else if(n==="SELECT"){var A=e.options.length;for(var q=0;q<A;q++){var u=e.options[q];if(u.selected){b.append(encodeURIComponent(g));b.append("=");b.append(encodeURIComponent(u.value));b.append("&")}}}else if(n==="TEXTAREA"){b.append(encodeURIComponent(g));b.append("=");b.append(encodeURIComponent(e.value));b.append("&")}}b.append("__ASYNCPOST=true&");if(this._additionalInput){b.append(this._additionalInput);this._additionalInput=null}var c=new Sys.Net.WebRequest,a=w.action;if(Sys.Browser.agent===Sys.Browser.InternetExplorer){var r=a.indexOf("#");if(r!==-1)a=a.substr(0,r);var o="",v="",m=a.indexOf("?");if(m!==-1){v=a.substr(m);a=a.substr(0,m)}if(/^https?\:\/\/.*$/gi.test(a)){var y=a.indexOf("//")+2,l=a.indexOf("/",y);if(l===-1){o=a;a=""}else{o=a.substr(0,l);a=a.substr(l)}}a=o+encodeURI(decodeURI(a))+v}c.set_url(a);c.get_headers()["X-MicrosoftAjax"]="Delta=true";c.get_headers()["Cache-Control"]="no-cache";c.set_timeout(this._asyncPostBackTimeout);
11c.add_completed(Function.createDelegate(this,this._onFormSubmitCompleted));c.set_body(b.toString());var j,d,k=this._get_eventHandlerList().getHandler("initializeRequest");if(k){j=this._postBackSettings.panelsToUpdate;d=new Sys.WebForms.InitializeRequestEventArgs(c,this._postBackSettings.sourceElement,j);k(this,d);h=!d.get_cancel()}if(!h){if(i)i.preventDefault();return}if(d&&d._updated){j=d.get_updatePanelsToUpdate();c.set_body(c.get_body().replace(t,this._createPanelID(j,this._postBackSettings)))}this._scrollPosition=this._getScrollPosition();this.abortPostBack();k=this._get_eventHandlerList().getHandler("beginRequest");if(k){d=new Sys.WebForms.BeginRequestEventArgs(c,this._postBackSettings.sourceElement,j||this._postBackSettings.panelsToUpdate);k(this,d)}if(this._originalDoCallback)this._cancelPendingCallbacks();this._request=c;this._processingRequest=false;c.invoke();if(i)i.preventDefault()},_onFormSubmitCompleted:function(c){this._processingRequest=true;if(c.get_timedOut()){this._endPostBack(this._createPageRequestManagerTimeoutError(),c,null);return}if(c.get_aborted()){this._endPostBack(null,c,null);return}if(!this._request||c.get_webRequest()!==this._request)return;if(c.get_statusCode()!==200){this._endPostBack(this._createPageRequestManagerServerError(c.get_statusCode()),c,null);return}var a=this._parseDelta(c);if(!a)return;var b,e;if(a.asyncPostBackControlIDsNode&&a.postBackControlIDsNode&&a.updatePanelIDsNode&&a.panelsToRefreshNode&&a.childUpdatePanelIDsNode){var r=this._updatePanelIDs,n=this._updatePanelClientIDs,i=a.childUpdatePanelIDsNode.content,p=i.length?i.split(","):[],m=this._splitNodeIntoArray(a.asyncPostBackControlIDsNode),o=this._splitNodeIntoArray(a.postBackControlIDsNode),q=this._splitNodeIntoArray(a.updatePanelIDsNode),g=this._splitNodeIntoArray(a.panelsToRefreshNode),h=a.version4;for(b=0,e=g.length;b<e;b+=h?2:1){var j=(h?g[b+1]:"")||this._uniqueIDToClientID(g[b]);if(!document.getElementById(j)){this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel,j)),c,a);return}}var f=this._processUpdatePanelArrays(q,m,o,h);f.oldUpdatePanelIDs=r;f.oldUpdatePanelClientIDs=n;f.childUpdatePanelIDs=p;f.panelsToRefreshIDs=g;a.updatePanelData=f}a.dataItems={};var d;for(b=0,e=a.dataItemNodes.length;b<e;b++){d=a.dataItemNodes[b];a.dataItems[d.id]=d.content}for(b=0,e=a.dataItemJsonNodes.length;b<e;b++){d=a.dataItemJsonNodes[b];a.dataItems[d.id]=Sys.Serialization.JavaScriptSerializer.deserialize(d.content)}var l=this._get_eventHandlerList().getHandler("pageLoading");if(l)l(this,this._getPageLoadingEventArgs(a));Sys._ScriptLoader.readLoadedScripts();Sys.Application.beginCreateComponents();var k=Sys._ScriptLoader.getInstance();this._queueScripts(k,a.scriptBlockNodes,true,false);this._processingRequest=true;k.loadScripts(0,Function.createDelegate(this,Function.createCallback(this._scriptIncludesLoadComplete,a)),Function.createDelegate(this,Function.createCallback(this._scriptIncludesLoadFailed,a)),null)},_onWindowUnload:function(){this.dispose()},_pageLoaded:function(a,c){var b=this._get_eventHandlerList().getHandler("pageLoaded");
11if(b)b(this,this._getPageLoadedEventArgs(a,c));if(!a)Sys.Application.raiseLoad()},_pageLoadedInitialLoad:function(){this._pageLoaded(true,null)},_parseDelta:function(h){var c=h.get_responseData(),d,i,E,F,D,b=0,e=null,k=[];while(b<c.length){d=c.indexOf("|",b);if(d===-1){e=this._findText(c,b);break}i=parseInt(c.substring(b,d),10);if(i%1!==0){e=this._findText(c,b);break}b=d+1;d=c.indexOf("|",b);if(d===-1){e=this._findText(c,b);break}E=c.substring(b,d);b=d+1;d=c.indexOf("|",b);if(d===-1){e=this._findText(c,b);break}F=c.substring(b,d);b=d+1;if(b+i>=c.length){e=this._findText(c,c.length);break}D=c.substr(b,i);b+=i;if(c.charAt(b)!=="|"){e=this._findText(c,b);break}b++;Array.add(k,{type:E,id:F,content:D})}if(e){this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails,e)),h,null);return null}var x=[],w=[],q=[],j=[],t=[],C=[],A=[],z=[],v=[],s=[],m,p,u,n,o,r,y,g;for(var l=0,G=k.length;l<G;l++){var a=k[l];switch(a.type){case "#":g=a;break;case "updatePanel":Array.add(x,a);break;case "hiddenField":Array.add(w,a);break;case "arrayDeclaration":Array.add(q,a);break;case "scriptBlock":Array.add(j,a);break;case "fallbackScript":j[j.length-1].fallback=a.id;case "scriptStartupBlock":Array.add(t,a);break;case "expando":Array.add(C,a);break;case "onSubmit":Array.add(A,a);break;case "asyncPostBackControlIDs":m=a;break;case "postBackControlIDs":p=a;break;case "updatePanelIDs":u=a;break;case "asyncPostBackTimeout":n=a;break;case "childUpdatePanelIDs":o=a;break;case "panelsToRefreshIDs":r=a;break;case "formAction":y=a;break;case "dataItem":Array.add(z,a);break;case "dataItemJson":Array.add(v,a);break;case "scriptDispose":Array.add(s,a);break;case "pageRedirect":if(g&&parseFloat(g.content)>=4)a.content=unescape(a.content);if(Sys.Browser.agent===Sys.Browser.InternetExplorer){var f=document.createElement("a");f.style.display="none";f.attachEvent("onclick",B);f.href=a.content;this._form.parentNode.insertBefore(f,this._form);f.click();f.detachEvent("onclick",B);this._form.parentNode.removeChild(f);function B(a){a.cancelBubble=true}}else window.location.href=a.content;return null;case "error":this._endPostBack(this._createPageRequestManagerServerError(Number.parseInvariant(a.id),a.content),h,null);return null;case "pageTitle":document.title=a.content;break;case "focus":this._controlIDToFocus=a.content;break;default:this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_UnknownToken,a.type)),h,null);return null}}return {version4:g?parseFloat(g.content)>=4:false,executor:h,updatePanelNodes:x,hiddenFieldNodes:w,arrayDeclarationNodes:q,scriptBlockNodes:j,scriptStartupNodes:t,expandoNodes:C,onSubmitNodes:A,dataItemNodes:z,dataItemJsonNodes:v,scriptDisposeNodes:s,asyncPostBackControlIDsNode:m,postBackControlIDsNode:p,updatePanelIDsNode:u,asyncPostBackTimeoutNode:n,childUpdatePanelIDsNode:o,panelsToRefreshNode:r,formActionNode:y}},_processUpdatePanelArrays:function(e,q,r,f){var d,c,b;if(e){var i=e.length,j=f?2:1;d=new Array(i/j);c=new Array(i/j);b=new Array(i/j);for(var g=0,h=0;g<i;g+=j,h++){var p,a=e[g],k=f?e[g+1]:"";p=a.charAt(0)==="t";a=a.substr(1);if(!k)k=this._uniqueIDToClientID(a);b[h]=p;d[h]=a;c[h]=k}}else{d=[];c=[];b=[]}var n=[],l=[];this._convertToClientIDs(q,n,l,f);var o=[],m=[];this._convertToClientIDs(r,o,m,f);return {updatePanelIDs:d,updatePanelClientIDs:c,updatePanelHasChildrenAsTriggers:b,asyncPostBackControlIDs:n,asyncPostBackControlClientIDs:l,postBackControlIDs:o,postBackControlClientIDs:m}},_queueScripts:function(scriptLoader,scriptBlockNodes,queueIncludes,queueBlocks){for(var i=0,l=scriptBlockNodes.length;i<l;i++){var scriptBlockType=scriptBlockNodes[i].id;switch(scriptBlockType){case "ScriptContentNoTags":if(!queueBlocks)continue;scriptLoader.queueScriptBlock(scriptBlockNodes[i].content);break;case "ScriptContentWithTags":var scriptTagAttributes;eval("scriptTagAttributes = "+scriptBlockNodes[i].content);if(scriptTagAttributes.src){if(!queueIncludes||Sys._ScriptLoader.isScriptLoaded(scriptTagAttributes.src))continue}else if(!queueBlocks)continue;scriptLoader.queueCustomScriptTag(scriptTagAttributes);break;case "ScriptPath":var script=scriptBlockNodes[i];if(!queueIncludes||Sys._ScriptLoader.isScriptLoaded(script.content))continue;scriptLoader.queueScriptReference(script.content,script.fallback)}}},_registerDisposeScript:function(a,b){if(!this._scriptDisposes[a])this._scriptDisposes[a]=[b];else Array.add(this._scriptDisposes[a],b)},_scriptIncludesLoadComplete:function(e,b){if(b.executor.get_webRequest
11()!==this._request)return;this._commitControls(b.updatePanelData,b.asyncPostBackTimeoutNode?b.asyncPostBackTimeoutNode.content:null);if(b.formActionNode)this._form.action=b.formActionNode.content;var a,d,c;for(a=0,d=b.updatePanelNodes.length;a<d;a++){c=b.updatePanelNodes[a];var j=document.getElementById(c.id);if(!j){this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel,c.id)),b.executor,b);return}this._updatePanel(j,c.content)}for(a=0,d=b.scriptDisposeNodes.length;a<d;a++){c=b.scriptDisposeNodes[a];this._registerDisposeScript(c.id,c.content)}for(a=0,d=this._transientFields.length;a<d;a++){var g=document.getElementById(this._transientFields[a]);if(g){var k=g._isContained?g.parentNode:g;k.parentNode.removeChild(k)}}for(a=0,d=b.hiddenFieldNodes.length;a<d;a++){c=b.hiddenFieldNodes[a];this._createHiddenField(c.id,c.content)}if(b.scriptsFailed)throw Sys._ScriptLoader._errorScriptLoadFailed(b.scriptsFailed.src,b.scriptsFailed.multipleCallbacks);this._queueScripts(e,b.scriptBlockNodes,false,true);var i="";for(a=0,d=b.arrayDeclarationNodes.length;a<d;a++){c=b.arrayDeclarationNodes[a];i+="Sys.WebForms.PageRequestManager._addArrayElement('"+c.id+"', "+c.content+");\r\n"}var h="";for(a=0,d=b.expandoNodes.length;a<d;a++){c=b.expandoNodes[a];h+=c.id+" = "+c.content+"\r\n"}if(i.length)e.queueScriptBlock(i);if(h.length)e.queueScriptBlock(h);this._queueScripts(e,b.scriptStartupNodes,true,true);var f="";for(a=0,d=b.onSubmitNodes.length;a<d;a++){if(a===0)f="Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, function() {\r\n";f+=b.onSubmitNodes[a].content+"\r\n"}if(f.length){f+="\r\nreturn true;\r\n});\r\n";e.queueScriptBlock(f)}e.loadScripts(0,Function.createDelegate(this,Function.createCallback(this._scriptsLoadComplete,b)),null,null)},_scriptIncludesLoadFailed:function(d,c,b,a){a.scriptsFailed={src:c.src,multipleCallbacks:b};this._scriptIncludesLoadComplete(d,a)},_scriptsLoadComplete:function(f,c){var e=c.executor;if(window.__theFormPostData)window.__theFormPostData="";if(window.__theFormPostCollection)window.__theFormPostCollection=[];if(window.WebForm_InitCallback)window.WebForm_InitCallback();if(this._scrollPosition){if(window.scrollTo)window.scrollTo(this._scrollPosition.x,this._scrollPosition.y);this._scrollPosition=null}Sys.Application.endCreateComponents();this._pageLoaded(false,c);this._endPostBack(null,e,c);if(this._controlIDToFocus){var a,d;if(Sys.Browser.agent===Sys.Browser.InternetExplorer){var b=$get(this._controlIDToFocus);a=b;if(b&&!WebForm_CanFocus(b))a=WebForm_FindFirstFocusableChild(b);if(a&&typeof a.contentEditable!=="undefined"){d=a.contentEditable;a.contentEditable=false}else a=null}WebForm_AutoFocus(this._controlIDToFocus);if(a)a.contentEditable=d;this._controlIDToFocus=null}},_splitNodeIntoArray:function(b){var a=b.content,c=a.length?a.split(","):[];return c},_uniqueIDToClientID:function(a){return a.replace(/\$/g,"_")},_updateControls:function(d,a,c,b,e){this._commitControls(this._processUpdatePanelArrays(d,a,c,e),b)},_updatePanel:function(updatePanelElement,rendering){for(var updatePanelID in this._scriptDisposes)if(this._elementContains(updatePanelElement,document.getElementById(updatePanelID))){var disposeScripts=this._scriptDisposes[updatePanelID];for(var i=0,l=disposeScripts.length;i<l;i++)eval(disposeScripts[i]);delete this._scriptDisposes[updatePanelID]}Sys.Application.disposeElement(updatePanelElement,true);updatePanelElement.innerHTML=rendering},_validPosition:function(a){return typeof a!=="undefined"&&a!==null&&a!==0}};Sys.WebForms.PageRequestManager.getInstance=function(){var a=Sys.WebForms.PageRequestManager._instance;if(!a)a=Sys.WebForms.PageRequestManager._instance=new Sys.WebForms.PageRequestManager;return a};Sys.WebForms.PageRequestManager._addArrayElement=function(a){if(!window[a])window[a]=[];for(var b=1,c=arguments.length;b<c;b++)Array.add(window[a],arguments[b])};Sys.WebForms.PageRequestManager._initialize=function(){var a=Sys.WebForms.PageRequestManager.getInstance();a._initializeInternal.apply(a,arguments)};Sys.WebForms.PageRequestManager.registerClass("Sys.WebForms.PageRequestManager");Sys.UI._UpdateProgress=function(a){Sys.UI._UpdateProgress.initializeBase(this,[a]);this._displayAfter=500;this._dynamicLayout=true;this._associatedUpdatePanelId=null;this._beginRequestHandlerDelegate=null;this._startDelegate=null;this._endRequestHandlerDelegate=null;this._pageRequestManager=null;this._timerCookie=null};Sys.UI._UpdateProgress.prototype={get_displayAfter:function(){return this._displayAfter},set_displayAfter:function(a){this._displayAfter=a},get_dynamicLayout:function(){return this._dynamicLayout},set_dynamicLayout:function(a){this._dynamicLayout=a},get_associatedUpdatePanelId:function(){return this._associatedUpdatePanelId},set_associatedUpdatePanelId:function(a){this._associatedUpdatePanelId=a},get_role:function(){return "status"},_clearTimeout:function(){if(this._timerCookie){window.clearTimeout(this._timerCookie);this._timerCookie=null}},_getUniqueID:function(b){var a=Array.indexOf(this._pageRequestManager._updatePanelClientIDs,b);return a===-1?null:this._pageRequestManager._updatePanelIDs[a]},_handleBeginRequest:function(f,e){var b=e.get_postBackElement(),a=true,d=this._associatedUpdatePanelId;
11if(this._associatedUpdatePanelId){var c=e.get_updatePanelsToUpdate();if(c&&c.length)a=Array.contains(c,d)||Array.contains(c,this._getUniqueID(d));else a=false}while(!a&&b){if(b.id&&this._associatedUpdatePanelId===b.id)a=true;b=b.parentNode}if(a)this._timerCookie=window.setTimeout(this._startDelegate,this._displayAfter)},_startRequest:function(){if(this._pageRequestManager.get_isInAsyncPostBack()){var a=this.get_element();if(this._dynamicLayout)a.style.display="block";else a.style.visibility="visible";if(this.get_role()==="status")a.setAttribute("aria-hidden","false")}this._timerCookie=null},_handleEndRequest:function(){var a=this.get_element();if(this._dynamicLayout)a.style.display="none";else a.style.visibility="hidden";if(this.get_role()==="status")a.setAttribute("aria-hidden","true");this._clearTimeout()},dispose:function(){if(this._beginRequestHandlerDelegate!==null){this._pageRequestManager.remove_beginRequest(this._beginRequestHandlerDelegate);this._pageRequestManager.remove_endRequest(this._endRequestHandlerDelegate);this._beginRequestHandlerDelegate=null;this._endRequestHandlerDelegate=null}this._clearTimeout();Sys.UI._UpdateProgress.callBaseMethod(this,"dispose")},initialize:function(){Sys.UI._UpdateProgress.callBaseMethod(this,"initialize");if(this.get_role()==="status")this.get_element().setAttribute("aria-hidden","true");this._beginRequestHandlerDelegate=Function.createDelegate(this,this._handleBeginRequest);this._endRequestHandlerDelegate=Function.createDelegate(this,this._handleEndRequest);this._startDelegate=Function.createDelegate(this,this._startRequest);if(Sys.WebForms&&Sys.WebForms.PageRequestManager)this._pageRequestManager=Sys.WebForms.PageRequestManager.getInstance();if(this._pageRequestManager!==null){this._pageRequestManager.add_beginRequest(this._beginRequestHandlerDelegate);this._pageRequestManager.add_endRequest(this._endRequestHandlerDelegate)}}};Sys.UI._UpdateProgress.registerClass("Sys.UI._UpdateProgress",Sys.UI.Control); 12Type.registerNamespace('Sys.WebForms');Sys.WebForms.Res={"PRM_UnknownToken":"Unknown token: \u0027{0}\u0027.","PRM_MissingPanel":"Could not find UpdatePanel with ID \u0027{0}\u0027. If it is being updated dynamically then it must be inside another UpdatePanel.","PRM_ServerError":"An unknown error occurred while processing the request on the server. The status code returned from the server was: {0}","PRM_ParserError":"The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.\r\nDetails: {0}","PRM_TimeoutError":"The server request timed out.","PRM_ParserErrorDetails":"Error parsing near \u0027{0}\u0027.","PRM_CannotRegisterTwice":"The PageRequestManager cannot be initialized more than once."}; 13// (c) Copyright Microsoft Corporation. 14// This source is subject to the Microsoft Permissive License. 15// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 16// All other rights reserved. 17 18 19/// <reference name="MicrosoftAjax.debug.js" /> 20/// <reference name="MicrosoftAjaxTimer.debug.js" /> 21/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 22 23 24// Add common toolkit scripts here. To consume the scripts on a control add 25// 26// [RequiredScript(typeof(CommonToolkitScripts))] 27// public class SomeExtender : ... 28// 29// to the controls extender class declaration. 30 31 32Type.registerNamespace('AjaxControlToolkit'); 33 34 35AjaxControlToolkit.BoxSide = function() { 36 /// <summary> 37 /// The BoxSide enumeration describes the sides of a DOM element 38 /// </summary> 39 /// <field name="Top" type="Number" integer="true" static="true" /> 40 /// <field name="Right" type="Number" integer="true" static="true" /> 41 /// <field name="Bottom" type="Number" integer="true" static="true" /> 42 /// <field name="Left" type="Number" integer="true" static="true" /> 43} 44AjaxControlToolkit.BoxSide.prototype = { 45 Top : 0, 46 Right : 1, 47 Bottom : 2, 48 Left : 3 49} 50AjaxControlToolkit.BoxSide.registerEnum("AjaxControlToolkit.BoxSide", false); 51 52 53AjaxControlToolkit._CommonToolkitScripts = function() { 54 /// <summary> 55 /// The _CommonToolkitScripts class contains functionality utilized across a number 56 /// of controls (but not universally) 57 /// </summary> 58 /// <remarks> 59 /// You should not create new instances of _CommonToolkitScripts. Instead you should use the shared instance CommonToolkitScripts (or AjaxControlToolkit.CommonToolkitScripts). 60 /// </remarks> 61}
62AjaxControlToolkit._CommonToolkitScripts.prototype = { 63 // The order of these lookup tables is directly linked to the BoxSide enum defined above 64 _borderStyleNames : ["borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"], 65 _borderWidthNames : ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"], 66 _paddingWidthNames : ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"], 67 _marginWidthNames : ["marginTop", "marginRight", "marginBottom", "marginLeft"], 68 69 getCurrentStyle : function(element, attribute, defaultValue) { 70 /// <summary> 71 /// CommonToolkitScripts.getCurrentStyle is used to compute the value of a style attribute on an 72 /// element that is currently being displayed. This is especially useful for scenarios where 73 /// several CSS classes and style attributes are merged, or when you need information about the 74 /// size of an element (such as its padding or margins) that is not exposed in any other fashion. 75 /// </summary> 76 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 77 /// Live DOM element to check style of 78 /// </param> 79 /// <param name="attribute" type="String"> 80 /// The style attribute's name is expected to be in a camel-cased form that you would use when 81 /// accessing a JavaScript property instead of the hyphenated form you would use in a CSS 82 /// stylesheet (i.e. it should be "backgroundColor" and not "background-color"). 83 /// </param> 84 /// <param name="defaultValue" type="Object" mayBeNull="true" optional="true"> 85 /// In the event of a problem (i.e. a null element or an attribute that cannot be found) we 86 /// return this object (or null if none if not specified). 87 /// </param> 88 /// <returns type="Object"> 89 /// Current style of the element's attribute 90 /// </returns> 91 92 var currentValue = null; 93 if (element) { 94 if (element.currentStyle) { 95 currentValue = element.currentStyle[attribute]; 96 } else if (document.defaultView && document.defaultView.getComputedStyle) { 97 var style = document.defaultView.getComputedStyle(element, null); 98 if (style) { 99 currentValue = style[attribute]; 100 } 101 } 102 103 if (!currentValue && element.style.getPropertyValue) { 104 currentValue = element.style.getPropertyValue(attribute); 105 } 106 else if (!currentValue && element.style.getAttribute) { 107 currentValue = element.style.getAttribute(attribute); 108 } 109 } 110 111 if ((!currentValue || currentValue == "" || typeof(currentValue) === 'undefined')) { 112 if (typeof(defaultValue) != 'undefined') { 113 currentValue = defaultValue; 114 } 115 else { 116 currentValue = null; 117 } 118 } 119 return currentValue; 120 }, 121 122 getInheritedBackgroundColor : function(element) { 123 /// <summary> 124 /// CommonToolkitScripts.getInheritedBackgroundColor provides the ability to get the displayed 125 /// background-color of an element. In most cases calling CommonToolkitScripts.getCurrentStyle 126 /// won't do the job because it will return "transparent" unless the element has been given a 127 /// specific background color. This function will walk up the element's parents until it finds 128 /// a non-transparent color. If we get all the way to the top of the document or have any other 129 /// problem finding a color, we will return the default value '#FFFFFF'. This function is 130 /// especially important when we're using opacity in IE (because ClearType will make text look 131 /// horrendous if you fade it with a transparent background color). 132 /// </summary> 133 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 134 /// Live DOM element to get the background color of 135 /// </param> 136 /// <returns type="String">
137 /// Background color of the element 138 /// </returns> 139 140 if (!element) return '#FFFFFF'; 141 var background = this.getCurrentStyle(element, 'backgroundColor'); 142 try { 143 while (!background || background == '' || background == 'transparent' || background == 'rgba(0, 0, 0, 0)') { 144 element = element.parentNode; 145 if (!element) { 146 background = '#FFFFFF'; 147 } else { 148 background = this.getCurrentStyle(element, 'backgroundColor'); 149 } 150 } 151 } catch(ex) { 152 background = '#FFFFFF'; 153 } 154 return background; 155 }, 156 157 getLocation : function(element) { 158 /// <summary>Gets the coordinates of a DOM element.</summary> 159 /// <param name="element" domElement="true"/> 160 /// <returns type="Sys.UI.Point"> 161 /// A Point object with two fields, x and y, which contain the pixel coordinates of the element. 162 /// </returns> 163 164 // workaround for an issue in getLocation where it will compute the location of the document element. 165 // this will return an offset if scrolled. 166 // 167 if (element === document.documentElement) { 168 return new Sys.UI.Point(0,0); 169 } 170 171 // Workaround for IE6 bug in getLocation (also required patching getBounds - remove that fix when this is removed) 172 if (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7) { 173 if (element.window === element || element.nodeType === 9 || !element.getClientRects || !element.getBoundingClientRect) return new Sys.UI.Point(0,0); 174 175 // Get the first bounding rectangle in screen coordinates 176 var screenRects = element.getClientRects(); 177 if (!screenRects || !screenRects.length) { 178 return new Sys.UI.Point(0,0); 179 } 180 var first = screenRects[0]; 181 182 // Delta between client coords and screen coords 183 var dLeft = 0; 184 var dTop = 0; 185 186 var inFrame = false; 187 try { 188 inFrame = element.ownerDocument.parentWindow.frameElement; 189 } catch(ex) { 190 // If accessing the frameElement fails, a frame is probably in a different 191 // domain than its parent - and we still want to do the calculation below 192 inFrame = true; 193 } 194 195 // If we're in a frame, get client coordinates too so we can compute the delta 196 if (inFrame) { 197 // Get the bounding rectangle in client coords 198 var clientRect = element.getBoundingClientRect(); 199 if (!clientRect) { 200 return new Sys.UI.Point(0,0); 201 } 202 203 // Find the minima in screen coords 204 var minLeft = first.left; 205 var minTop = first.top; 206 for (var i = 1; i < screenRects.length; i++) { 207 var r = screenRects[i]; 208 if (r.left < minLeft) { 209 minLeft = r.left; 210 } 211 if (r.top < minTop) { 212 minTop = r.top; 213 } 214 } 215 216 // Compute the delta between screen and client coords 217 dLeft = minLeft - clientRect.left; 218 dTop = minTop - clientRect.top; 219 } 220 221 // Subtract 2px, the border of the viewport (It can be changed in IE6 by applying a border style to the HTML element, 222 // but this is not supported by ASP.NET AJAX, and it cannot be changed in IE7.), and also subtract the delta between 223 // screen coords and client coords 224 var ownerDocument = element.document.documentElement; 225 return new Sys.UI.Point(first.left - 2 - dLeft + ownerDocument.scrollLeft, first.top - 2 - dTop + ownerDocument.scrollTop); 226 } 227 228 return Sys.UI.DomElement.getLocation(element); 229}, 230 231 setLocation : function(element, point) { 232 /// <summary> 233 /// Sets the current location for an element. 234 /// </summary> 235 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 236 /// DOM element 237 /// </param> 238 /// <param name="point" type="Object"> 239 /// Point object (of the form {x,y}) 240 /// </param> 241 /// <remarks> 242 /// This method does not attempt to set the positioning mode of an element. 243 /// The position is relative from the elements nearest position:relative or 244 /// position:absolute element. 245 /// </remarks> 246 Sys.UI.DomElement.setLocation(element, point.x, point.y); 247 }, 248 249 getContentSize : function(element) { 250 /// <summary> 251 /// Gets the "content-box" size of an element. 252 /// </summary> 253 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 254 /// DOM element 255 /// </param> 256 /// <returns type="Object"> 257 /// Size of the element (in the form {width,height}) 258 /// </returns> 259 /// <remarks> 260 /// The "content-box" is the size of the content area *inside* of the borders and 261 /// padding of an element. The "content-box" size does not include the margins around 262 /// the element. 263 /// </remarks> 264 265 if (!element) { 266 throw Error.argumentNull('element'); 267 }
268 var size = this.getSize(element); 269 var borderBox = this.getBorderBox(element); 270 var paddingBox = this.getPaddingBox(element); 271 return { 272 width : size.width - borderBox.horizontal - paddingBox.horizontal, 273 height : size.height - borderBox.vertical - paddingBox.vertical 274 } 275 }, 276 277 getSize : function(element) { 278 /// <summary> 279 /// Gets the "border-box" size of an element. 280 /// </summary> 281 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 282 /// DOM element 283 /// </param> 284 /// <returns type="Object"> 285 /// Size of the element (in the form {width,height}) 286 /// </returns> 287 /// <remarks> 288 /// The "border-box" is the size of the content area *outside* of the borders and 289 /// padding of an element. The "border-box" size does not include the margins around 290 /// the element. 291 /// </remarks> 292 293 if (!element) { 294 throw Error.argumentNull('element'); 295 } 296 return { 297 width: element.offsetWidth, 298 height: element.offsetHeight 299 }; 300 }, 301 302 setContentSize : function(element, size) { 303 /// <summary> 304 /// Sets the "content-box" size of an element. 305 /// </summary> 306 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 307 /// DOM element 308 /// </param> 309 /// <param name="size" type="Object"> 310 /// Size of the element (in the form {width,height}) 311 /// </param> 312 /// <remarks> 313 /// The "content-box" is the size of the content area *inside* of the borders and 314 /// padding of an element. The "content-box" size does not include the margins around 315 /// the element. 316 /// </remarks> 317 318 if (!element) { 319 throw Error.argumentNull('element'); 320 } 321 if (!size) { 322 throw Error.argumentNull('size'); 323 } 324 // FF respects -moz-box-sizing css extension, so adjust the box size for the border-box 325 if(this.getCurrentStyle(element, 'MozBoxSizing') == 'border-box' || this.getCurrentStyle(element, 'BoxSizing') == 'border-box') { 326 var borderBox = this.getBorderBox(element); 327 var paddingBox = this.getPaddingBox(element); 328 size = { 329 width: size.width + borderBox.horizontal + paddingBox.horizontal, 330 height: size.height + borderBox.vertical + paddingBox.vertical 331 }; 332 } 333 element.style.width = size.width.toString() + 'px'; 334 element.style.height = size.height.toString() + 'px'; 335 }, 336 337 setSize : function(element, size) { 338 /// <summary> 339 /// Sets the "border-box" size of an element. 340 /// </summary> 341 /// <remarks> 342 /// The "border-box" is the size of the content area *outside* of the borders and 343 /// padding of an element. The "border-box" size does not include the margins around 344 /// the element. 345 /// </remarks> 346 /// <param name="element" type="Sys.UI.DomElement">DOM element</param> 347 /// <param name="size" type="Object">Size of the element (in the form {width,height})</param> 348 /// <returns /> 349 350 if (!element) { 351 throw Error.argumentNull('element'); 352 } 353 if (!size) { 354 throw Error.argumentNull('size'); 355 } 356 var borderBox = this.getBorderBox(element); 357 var paddingBox = this.getPaddingBox(element); 358 var contentSize = { 359 width: size.width - borderBox.horizontal - paddingBox.horizontal, 360 height: size.height - borderBox.vertical - paddingBox.vertical 361 }; 362 this.setContentSize(element, contentSize); 363 }, 364 365 getBounds : function(element) { 366 /// <summary>Gets the coordinates, width and height of an element.</summary> 367 /// <param name="element" domElement="true"/> 368 /// <returns type="Sys.UI.Bounds"> 369 /// A Bounds object with four fields, x, y, width and height, which contain the pixel coordinates, 370 /// width and height of the element. 371 /// </returns> 372 /// <remarks> 373 /// Use the CommonToolkitScripts version of getLocation to handle the workaround for IE6. We can 374 /// remove the below implementation and just call Sys.UI.DomElement.getBounds when the other bug 375 /// is fixed. 376 /// </remarks> 377 378 var offset = $common.getLocation(element); 379 return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0
379); 380 }, 381 382 setBounds : function(element, bounds) { 383 /// <summary> 384 /// Sets the "border-box" bounds of an element 385 /// </summary> 386 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 387 /// DOM element 388 /// </param> 389 /// <param name="bounds" type="Object"> 390 /// Bounds of the element (of the form {x,y,width,height}) 391 /// </param> 392 /// <remarks> 393 /// The "border-box" is the size of the content area *outside* of the borders and 394 /// padding of an element. The "border-box" size does not include the margins around 395 /// the element. 396 /// </remarks> 397 398 if (!element) { 399 throw Error.argumentNull('element'); 400 } 401 if (!bounds) { 402 throw Error.argumentNull('bounds'); 403 } 404 this.setSize(element, bounds); 405 $common.setLocation(element, bounds); 406 }, 407 408 getClientBounds : function() { 409 /// <summary> 410 /// Gets the width and height of the browser client window (excluding scrollbars) 411 /// </summary> 412 /// <returns type="Sys.UI.Bounds"> 413 /// Browser's client width and height 414 /// </returns> 415 416 var clientWidth; 417 var clientHeight; 418 switch(Sys.Browser.agent) { 419 case Sys.Browser.InternetExplorer: 420 clientWidth = document.documentElement.clientWidth; 421 clientHeight = document.documentElement.clientHeight; 422 break; 423 case Sys.Browser.Safari: 424 clientWidth = window.innerWidth; 425 clientHeight = window.innerHeight; 426 break; 427 case Sys.Browser.Opera: 428 clientWidth = Math.min(window.innerWidth, document.body.clientWidth); 429 clientHeight = Math.min(window.innerHeight, document.body.clientHeight); 430 break; 431 default: // Sys.Browser.Firefox, etc. 432 clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth); 433 clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight); 434 break; 435 } 436 return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight); 437 }, 438 439 getMarginBox : function(element) { 440 /// <summary> 441 /// Gets the entire margin box sizes. 442 /// </summary> 443 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 444 /// DOM element 445 /// </param> 446 /// <returns type="Object"> 447 /// Element's margin box sizes (of the form {top,left,bottom,right,horizontal,vertical}) 448 /// </returns> 449 450 if (!element) { 451 throw Error.argumentNull('element'); 452 } 453 var box = { 454 top: this.getMargin(element, AjaxControlToolkit.BoxSide.Top), 455 right: this.getMargin(element, AjaxControlToolkit.BoxSide.Right), 456 bottom: this.getMargin(element, AjaxControlToolkit.BoxSide.Bottom), 457 left: this.getMargin(element, AjaxControlToolkit.BoxSide.Left) 458 }; 459 box.horizontal = box.left + box.right; 460 box.vertical = box.top + box.bottom; 461 return box; 462 }, 463 464 getBorderBox : function(element) { 465 /// <summary> 466 /// Gets the entire border box sizes. 467 /// </summary> 468 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 469 /// DOM element 470 /// </param> 471 /// <returns type="Object"> 472 /// Element's border box sizes (of the form {top,left,bottom,right,horizontal,vertical}) 473 /// </returns> 474 475 if (!element) { 476 throw Error.argumentNull('element'); 477 } 478 var box = { 479 top: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Top), 480 right: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Right), 481 bottom: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Bottom), 482 left: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Left) 483 }; 484 box.horizontal = box.left + box.right; 485 box.vertical = box.top + box.bottom; 486 return box; 487 }, 488 489 getPaddingBox : function(element) { 490 /// <summary> 491 /// Gets the entire padding box sizes. 492 /// </summary> 493 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 494 /// DOM element 495 /// </param> 496 /// <returns type="Object"> 497 /// Element's padding box sizes (of the form {top,left,bottom,right,horizontal,vertical}) 498 /// </returns> 499 500 if (!element) { 501 throw Error.argumentNull('element'); 502 } 503 var box = { 504 top: this.getPadding(element, AjaxControlToolkit.BoxSide.Top), 505 right: this.getPadding(element, AjaxControlToolkit.BoxSide.Right), 506 bottom: this.getPadding(element, AjaxControlToolkit.BoxSide.Bottom), 507 left: this.getPadding(element, AjaxControlToolkit.BoxSide.Left) 508 }; 509 box.horizontal = box.left + box.right; 510 box.vertical = box.top + box.bottom; 511 return box; 512 }, 513 514 isBorderVisible : function(element, boxSide) { 515 /// <summary> 516 /// Gets whether the current border style for an element on a specific boxSide is not 'none'. 517 /// </summary> 518 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 519 /// DOM element 520 /// </param> 521 /// <param name="boxSide" type="AjaxControlToolkit.BoxSide"> 522 /// Side of the element 523 /// </param> 524 /// <returns type="Boolean"> 525 /// Whether the current border style for an element on a specific boxSide is not 'none'. 526 /// </returns> 527 528 if (!element) { 529 throw Error.argumentNull('element'); 530 } 531 if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) { 532 throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide')); 533 } 534 var styleName = this._borderStyleNames[boxSide]; 535 var styleValue = this.getCurrentStyle(element, styleName); 536 return styleValue != "none"; 537 }, 538 539 getMargin : function(element, boxSide) { 540 /// <summary> 541 /// Gets the margin thickness of an element on a specific boxSide. 542 /// </summary> 543 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 544 /// DOM element 545 /// </param> 546 /// <param name="boxSide" type="AjaxControlToolkit.BoxSide"> 547 /// Side of the element 548 /// </param> 549 /// <returns type="Number" integer="true"> 550 /// Margin thickness on the element's specified side 551 /// </returns> 552 553 if (!element) { 554 throw Error.argumentNull('element'); 555 } 556 if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) { 557 throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide')); 558 } 559 var styleName = this._marginWidthNames[boxSide]; 560 var styleValue = this.getCurrentStyle(element, styleName); 561 try { return this.parsePadding(styleValue); } catch(ex) { return 0; } 562 }, 563 564 getBorderWidth : function(element, boxSide) { 565 /// <summary> 566 /// Gets the border thickness of an element on a specific boxSide. 567 /// </summary> 568 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 569 /// DOM element 570 /// </param> 571 /// <param name="boxSide" type="AjaxControlToolkit.BoxSide"> 572 /// Side of the element 573 /// </param> 574 /// <returns type="Number" integer="true"> 575 /// Border thickness on the element's specified side 576 /// </returns> 577 578 if (!element) { 579 throw Error.argumentNull('element'); 580 } 581 if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) { 582 throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide')); 583 } 584 if(!this.isBorderVisible(element, boxSide)) { 585 return 0; 586 } 587 var styleName = this._borderWidthNames[boxSide]; 588 var styleValue = this.getCurrentStyle(element, styleName); 589 return this.parseBorderWidth(styleValue); 590 }, 591 592 getPadding : function(element, boxSide) { 593 /// <summary> 594 /// Gets the padding thickness of an element on a specific boxSide. 595 /// </summary> 596 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 597 /// DOM element 598 /// </param> 599 /// <param name="boxSide" type="AjaxControlToolkit.BoxSide"> 600 /// Side of the element 601 /// </param> 602 /// <returns type="Number" integer="true"> 603 /// Padding on the element's specified side 604 /// </returns> 605 606 if (!element) { 607 throw Error.argumentNull('element'); 608 } 609 if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) { 610 throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide')); 611 } 612 var styleName = this._paddingWidthNames[boxSide]; 613 var styleValue = this.getCurrentStyle(element, styleName); 614 return this.parsePadding(styleValue); 615 }, 616 617 parseBorderWidth : function(borderWidth) { 618 /// <summary> 619 /// Parses a border-width string into a pixel size 620 /// </summary> 621 /// <param name="borderWidth" type="String" mayBeNull="true"> 622 /// Type of border ('thin','medium','thick','inherit',px unit,null,'') 623 /// </param> 624 /// <returns type="Number" integer="true"> 625 /// Number of pixels in the border-width 626 /// </returns> 627 if (!this._borderThicknesses) { 628 629 // Populate the borderThicknesses lookup table 630 var borderThicknesses = { }; 631 var div0 = document.createElement('div'); 632 div0.style.visibility = 'hidden'; 633 div0.style.position = 'absolute'; 634 div0.style.fontSize = '1px'; 635 document.body.appendChild(div0) 636 var div1 = document.createElement('div'); 637 div1.style.height = '0px'; 638 div1.style.overflow = 'hidden'; 639 div0.appendChild(div1); 640 var base = div0.offsetHeight; 641 div1.style.borderTop = 'solid black'; 642 div1.style.borderTopWidth = 'thin'; 643 borderThicknesses['thin'] = div0.offsetHeight - base; 644 div1.style.borderTopWidth = 'medium'; 645 borderThicknesses['medium'] = div0.offsetHeight - base; 646 div1.style.borderTopWidth = 'thick'; 647 borderThicknesses['thick'] = div0.offsetHeight - base; 648 div0.removeChild(div1); 649 document.body.removeChild(div0); 650 this._borderThicknesses = borderThicknesses; 651 } 652 653 if (borderWidth) { 654 switch(borderWidth) { 655 case 'thin': 656 case 'medium': 657 case 'thick': 658 return this._borderThicknesses[borderWidth]; 659 case 'inherit': 660 return 0; 661 } 662 var unit = this.parseUnit(borderWidth);
663 Sys.Debug.assert(unit.type == 'px', String.format(AjaxControlToolkit.Resources.Common_InvalidBorderWidthUnit, unit.type)); 664 return unit.size; 665 } 666 return 0; 667 }, 668 669 parsePadding : function(padding) { 670 /// <summary> 671 /// Parses a padding string into a pixel size 672 /// </summary> 673 /// <param name="padding" type="String" mayBeNull="true"> 674 /// Padding to parse ('inherit',px unit,null,'') 675 /// </param> 676 /// <returns type="Number" integer="true"> 677 /// Number of pixels in the padding 678 /// </returns> 679 680 if(padding) { 681 if(padding == 'inherit') { 682 return 0; 683 } 684 var unit = this.parseUnit(padding); 685 Sys.Debug.assert(unit.type == 'px', String.format(AjaxControlToolkit.Resources.Common_InvalidPaddingUnit, unit.type)); 686 return unit.size; 687 } 688 return 0; 689 }, 690 691 parseUnit : function(value) { 692 /// <summary> 693 /// Parses a unit string into a unit object 694 /// </summary> 695 /// <param name="value" type="String" mayBeNull="true"> 696 /// Value to parse (of the form px unit,% unit,em unit,...) 697 /// </param> 698 /// <returns type="Object"> 699 /// Parsed unit (of the form {size,type}) 700 /// </returns> 701 702 if (!value) { 703 throw Error.argumentNull('value'); 704 } 705 706 value = value.trim().toLowerCase(); 707 var l = value.length; 708 var s = -1; 709 for(var i = 0; i < l; i++) { 710 var ch = value.substr(i, 1); 711 if((ch < '0' || ch > '9') && ch != '-' && ch != '.' && ch != ',') { 712 break; 713 } 714 s = i; 715 } 716 if(s == -1) { 717 throw Error.create(AjaxControlToolkit.Resources.Common_UnitHasNoDigits); 718 } 719 var type; 720 var size; 721 if(s < (l - 1)) { 722 type = value.substring(s + 1).trim(); 723 } else { 724 type = 'px'; 725 } 726 size = parseFloat(value.substr(0, s + 1)); 727 if(type == 'px') { 728 size = Math.floor(size); 729 } 730 return { 731 size: size, 732 type: type 733 }; 734 }, 735 736 getElementOpacity : function(element) { 737 /// <summary> 738 /// Get the element's opacity 739 /// </summary> 740 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 741 /// Element 742 /// </param> 743 /// <returns type="Number"> 744 /// Opacity of the element 745 /// </returns> 746 747 if (!element) { 748 throw Error.argumentNull('element'); 749 } 750 751 var hasOpacity = false; 752 var opacity; 753 754 if (element.filters) { 755 var filters = element.filters; 756 if (filters.length !== 0) { 757 var alphaFilter = filters['DXImageTransform.Microsoft.Alpha']; 758 if (alphaFilter) { 759 opacity = alphaFilter.opacity / 100.0; 760 hasOpacity = true; 761 } 762 } 763 } 764 else { 765 opacity = this.getCurrentStyle(element, 'opacity', 1); 766 hasOpacity = true; 767 } 768 769 if (hasOpacity === false) { 770 return 1.0; 771 } 772 return parseFloat(opacity); 773 }, 774 775 setElementOpacity : function(element, value) { 776 /// <summary> 777 /// Set the element's opacity 778 /// </summary> 779 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 780 /// Element 781 /// </param> 782 /// <param name="value" type="Number"> 783 /// Opacity of the element 784 /// </param> 785 786 if (!element) { 787 throw Error.argumentNull('element'); 788 } 789 790 if (element.filters) { 791 var filters = element.filters; 792 var createFilter = true; 793 if (filters.length !== 0) {
794 var alphaFilter = filters['DXImageTransform.Microsoft.Alpha']; 795 if (alphaFilter) { 796 createFilter = false; 797 alphaFilter.opacity = value * 100; 798 } 799 } 800 if (createFilter) { 801 element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (value * 100) + ')'; 802 } 803 } 804 else { 805 element.style.opacity = value; 806 } 807 }, 808 809 getVisible : function(element) { 810 /// <summary> 811 /// Check if an element is visible 812 /// </summary> 813 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 814 /// Element 815 /// </param> 816 /// <returns type="Boolean" mayBeNull="false"> 817 /// True if the element is visible, false otherwise 818 /// </returns> 819 820 // Note: reference to CommonToolkitScripts must be left intact (i.e. don't 821 // replace with 'this') because this function will be aliased 822 823 return (element && 824 ("none" != $common.getCurrentStyle(element, "display")) && 825 ("hidden" != $common.getCurrentStyle(element, "visibility"))); 826 }, 827 828 setVisible : function(element, value) { 829 /// <summary> 830 /// Check if an element is visible 831 /// </summary> 832 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 833 /// Element 834 /// </param> 835 /// <param name="value" type="Boolean" mayBeNull="false"> 836 /// True to make the element visible, false to hide it 837 /// </param> 838 839 // Note: reference to CommonToolkitScripts must be left intact (i.e. don't 840 // replace with 'this') because this function will be aliased 841 842 if (element && value != $common.getVisible(element)) { 843 if (value) { 844 if (element.style.removeAttribute) { 845 element.style.removeAttribute("display"); 846 } else { 847 element.style.removeProperty("display"); 848 } 849 } else { 850 element.style.display = 'none'; 851 } 852 element.style.visibility = value ? 'visible' : 'hidden'; 853 } 854 }, 855 856 resolveFunction : function(value) { 857 /// <summary> 858 /// Returns a function reference that corresponds to the provided value 859 /// </summary> 860 /// <param name="value" type="Object"> 861 /// The value can either be a Function, the name of a function (that can be found using window['name']), 862 /// or an expression that evaluates to a function. 863 /// </param> 864 /// <returns type="Function"> 865 /// Reference to the function, or null if not found 866 /// </returns> 867 868 if (value) { 869 if (value instanceof Function) { 870 return value; 871 } else if (String.isInstanceOfType(value) && value.length > 0) { 872 var func; 873 if ((func = window[value]) instanceof Function) { 874 return func; 875 } else if ((func = eval(value)) instanceof Function) { 876 return func; 877 } 878 } 879 } 880 return null; 881 }, 882 883 addCssClasses : function(element, classNames) { 884 /// <summary> 885 /// Adds multiple css classes to a DomElement 886 /// </summary> 887 /// <param name="element" type="Sys.UI.DomElement">The element to modify</param> 888 /// <param name="classNames" type="Array">The class names to add</param> 889 890 for(var i = 0; i < classNames.length; i++) { 891 Sys.UI.DomElement.addCssClass(element, classNames[i]); 892 } 893 },
894 removeCssClasses : function(element, classNames) { 895 /// <summary> 896 /// Removes multiple css classes to a DomElement 897 /// </summary> 898 /// <param name="element" type="Sys.UI.DomElement">The element to modify</param> 899 /// <param name="classNames" type="Array">The class names to remove</param> 900 901 for(var i = 0; i < classNames.length; i++) { 902 Sys.UI.DomElement.removeCssClass(element, classNames[i]); 903 } 904 }, 905 setStyle : function(element, style) { 906 /// <summary> 907 /// Sets the style of the element using the supplied style template object 908 /// </summary> 909 /// <param name="element" type="Sys.UI.DomElement">The element to modify</param> 910 /// <param name="style" type="Object">The template</param> 911 912 $common.applyProperties(element.style, style); 913 }, 914 removeHandlers : function(element, events) { 915 /// <summary> 916 /// Removes a set of event handlers from an element 917 /// </summary> 918 /// <param name="element" type="Sys.UI.DomElement">The element to modify</param> 919 /// <param name="events" type="Object">The template object that contains event names and delegates</param> 920 /// <remarks> 921 /// This is NOT the same as $clearHandlers which removes all delegates from a DomElement. This rather removes select delegates 922 /// from a specified element and has a matching signature as $addHandlers 923 /// </remarks> 924 for (var name in events) { 925 $removeHandler(element, name, events[name]); 926 } 927 }, 928 929 overlaps : function(r1, r2) { 930 /// <summary> 931 /// Determine if two rectangles overlap 932 /// </summary> 933 /// <param name="r1" type="Object"> 934 /// Rectangle 935 /// </param> 936 /// <param name="r2" type="Object"> 937 /// Rectangle 938 /// </param> 939 /// <returns type="Boolean"> 940 /// True if the rectangles overlap, false otherwise 941 /// </returns> 942 943 return r1.x < (r2.x + r2.width) 944 && r2.x < (r1.x + r1.width) 945 && r1.y < (r2.y + r2.height) 946 && r2.y < (r1.y + r1.height); 947 }, 948 949 containsPoint : function(rect, x, y) { 950 /// <summary> 951 /// Tests whether a point (x,y) is contained within a rectangle 952 /// </summary> 953 /// <param name="rect" type="Object">The rectangle</param> 954 /// <param name="x" type="Number">The x coordinate of the point</param> 955 /// <param name="y" type="Number">The y coordinate of the point</param> 956 957 return x >= rect.x && x < (rect.x + rect.width) && y >= rect.y && y < (rect.y + rect.height); 958 }, 959 960 isKeyDigit : function(keyCode) { 961 /// <summary> 962 /// Gets whether the supplied key-code is a digit 963 /// </summary> 964 /// <param name="keyCode" type="Number" integer="true">The key code of the event (from Sys.UI.DomEvent)</param> 965 /// <returns type="Boolean" /> 966 967 return (0x30 <= keyCode && keyCode <= 0x39); 968 }, 969 970 isKeyNavigation : function(keyCode) { 971 /// <summary> 972 /// Gets whether the supplied key-code is a navigation key 973 /// </summary> 974 /// <param name="keyCode" type="Number" integer="true">The key code of the event (from Sys.UI.DomEvent)</param> 975 /// <returns type="Boolean" /> 976 977 return (Sys.UI.Key.left <= keyCode && keyCode <= Sys.UI.Key.down); 978 }, 979 980 padLeft : function(text, size, ch, truncate) { 981 /// <summary> 982 /// Pads the left hand side of the supplied text with the specified pad character up to the requested size 983 /// </summary> 984 /// <param name="text" type="String">The text to pad</param> 985 /// <param name="size" type="Number" integer="true" optional="true">The size to pad the text (default is 2)</param> 986 /// <param name="ch" type="String" optional="true">The single character to use as the pad character (default is ' ')</param> 987 /// <param name="truncate" type="Boolean" optional="true">Whether to truncate the text to size (default is false)</param> 988 989 return $common._pad(text, size || 2, ch || ' ', 'l', truncate || false); 990 }, 991 992 padRight : function(text, size, ch, truncate) { 993 /// <summary> 994 /// Pads the right hand side of the supplied text with the specified pad character up to the requested size 995 /// </summary>
996 /// <param name="text" type="String">The text to pad</param> 997 /// <param name="size" type="Number" integer="true" optional="true">The size to pad the text (default is 2)</param> 998 /// <param name="ch" type="String" optional="true">The single character to use as the pad character (default is ' ')</param> 999 /// <param name="truncate" type="Boolean" optional="true">Whether to truncate the text to size (default is false)</param> 1000 1001 return $common._pad(text, size || 2, ch || ' ', 'r', truncate || false); 1002 }, 1003 1004 _pad : function(text, size, ch, side, truncate) { 1005 /// <summary> 1006 /// Pads supplied text with the specified pad character up to the requested size 1007 /// </summary> 1008 /// <param name="text" type="String">The text to pad</param> 1009 /// <param name="size" type="Number" integer="true">The size to pad the text</param> 1010 /// <param name="ch" type="String">The single character to use as the pad character</param> 1011 /// <param name="side" type="String">Either 'l' or 'r' to siginfy whether to pad the Left or Right side respectively</param> 1012 /// <param name="truncate" type="Boolean">Whether to truncate the text to size</param> 1013 1014 text = text.toString(); 1015 var length = text.length; 1016 var builder = new Sys.StringBuilder(); 1017 if (side == 'r') { 1018 builder.append(text); 1019 } 1020 while (length < size) { 1021 builder.append(ch); 1022 length++; 1023 } 1024 if (side == 'l') { 1025 builder.append(text); 1026 } 1027 var result = builder.toString(); 1028 if (truncate && result.length > size) { 1029 if (side == 'l') { 1030 result = result.substr(result.length - size, size); 1031 } else { 1032 result = result.substr(0, size); 1033 } 1034 } 1035 return result; 1036 }, 1037 1038 __DOMEvents : { 1039 focusin : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focusin", true, false, window, 1); } }, 1040 focusout : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focusout", true, false, window, 1); } }, 1041 activate : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("activate", true, true, window, 1); } }, 1042 focus : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focus", false, false, window, 1); } }, 1043 blur : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("blur", false, false, window, 1); } }, 1044 click : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("click", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1045 dblclick : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("click", true, true, window, 2, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1046 mousedown : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousedown", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1047 mouseup : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mouseup", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1048 mouseover : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mouseover", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1049 mousemove : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousemove", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1050 mouseout : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousemove", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null); } }, 1051 load : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("load", false, false); } }, 1052 unload : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("unload", false, false); } }, 1053 select : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("select", true, false); } }, 1054 change : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("change", true, false); } }, 1055 submit : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("submit", true, true); } }, 1056 reset : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("reset", true, false); } }, 1057 resize : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("resize", true, false); } }, 1058 scroll : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("scroll", true, false); } } 1059 }, 1060 1061 tryFireRawEvent : function(element, rawEvent) { 1062 /// <summary> 1063 /// Attempts to fire a raw DOM event on an element 1064 /// </summary> 1065 /// <param name="element" type="Sys.UI.DomElement">The element to fire the event</param> 1066 /// <param name="rawEvent" type="Object">The raw DOM event object to fire. Must not be Sys.UI.DomEvent</param> 1067 /// <returns type="Boolean">True if the event was successfully fired, otherwise false</returns> 1068 1069 try { 1070 if (element.fireEvent) { 1071 element.fireEvent("on" + rawEvent.type, rawEvent); 1072 return true; 1073 } else if (element.dispatchEvent) { 1074 element.dispatchEvent(rawEvent); 1075 return true; 1076 } 1077 } catch (e) { 1078 } 1079 return false; 1080 }, 1081 1082 tryFireEvent : function(element, eventName, properties) { 1083 /// <summary> 1084 /// Attempts to fire a DOM event on an element 1085 /// </summary> 1086 /// <param name="element" type="Sys.UI.DomElement">The element to fire the event</param> 1087 /// <param name="eventName" type="String">The name of the event to fire (without an 'on' prefix)</param> 1088 /// <param name="properties" type="Object">Properties to add to the event</param> 1089 /// <returns type="Boolean">True if the event was successfully fired, otherwise false</returns> 1090 1091 try { 1092 if (document.createEventObject) { 1093 var e = document.createEventObject(); 1094 $common.applyProperties(e, properties || {}); 1095 element.fireEvent("on" + eventName, e); 1096 return true; 1097 } else if (document.createEvent) { 1098 var def = $common.__DOMEvents[eventName]; 1099 if (def) { 1100 var e = document.createEvent(def.eventGroup); 1101 def.init(e, properties || {}); 1102 element.dispatchEvent(e); 1103 return true; 1104 } 1105 } 1106 } catch (e) { 1107 } 1108 return false; 1109 }, 1110 1111 wrapElement : function(innerElement, newOuterElement, newInnerParentElement) { 1112 /// <summary> 1113 /// Wraps an inner element with a new outer element at the same DOM location as the inner element 1114 /// </summary> 1115 /// <param name="innerElement" type="Sys.UI.DomElement">The element to be wrapped</param> 1116 /// <param name="newOuterElement" type="Sys.UI.DomElement">The new parent for the element</param> 1117 /// <returns /> 1118 1119 var parent = innerElement.parentNode; 1120 parent.replaceChild(newOuterElement, innerElement); 1121 (newInnerParentElement || newOuterElement).appendChild(innerElement); 1122 }, 1123 1124 unwrapElement : function(innerElement, oldOuterElement) { 1125 /// <summary> 1126 /// Unwraps an inner element from an outer element at the same DOM location as the outer element 1127 /// </summary> 1128 /// <param name="innerElement" type="Sys.UI.DomElement">The element to be wrapped</param> 1129 /// <param name="newOuterElement" type="Sys.UI.DomElement">The new parent for the element</param> 1130 /// <returns /> 1131 1132 var parent = oldOuterElement.parentNode; 1133 if (parent != null) { 1134 $common.removeElement(innerElement); 1135 parent.replaceChild(innerElement, oldOuterElement); 1136 } 1137 }, 1138 1139 removeElement : function(element) { 1140 /// <summary> 1141 /// Removes an element from the DOM tree 1142 /// </summary> 1143 /// <param name="element" type="Sys.UI.DomElement">The element to be removed</param> 1144 /// <returns /> 1145 1146 var parent = element.parentNode; 1147 if (parent != null) { 1148 parent.removeChild(element); 1149 } 1150 }, 1151 1152 applyProperties : function(target, properties) { 1153 /// <summary> 1154 /// Quick utility method to copy properties from a template object to a target object 1155 /// </summary> 1156 /// <param name="target" type="Object">The object to apply to</param> 1157 /// <param name="properties" type="Object">The template to copy values from</param> 1158 1159 for (var p in properties) { 1160 var pv = properties[p]; 1161 if (pv != null && Object.getType(pv)===Object) { 1162 var tv = target[p]; 1163 $common.applyProperties(tv, pv); 1164 } else { 1165 target[p] = pv; 1166 } 1167 } 1168 }, 1169 1170 createElementFromTemplate : function(template, appendToParent, nameTable) { 1171 /// <summary> 1172 /// Creates an element for the current document based on a template object 1173 /// </summary> 1174 /// <param name="template" type="Object">The template from which to create the element</param> 1175 /// <param name="appendToParent" type="Sys.UI.DomElement" optional="true" mayBeNull="true">A DomElement under which to append this element</param> 1176 /// <param name="nameTable" type="Object" optional="true" mayBeNull="true">An object to use as the storage for the element using template.name as the key</param> 1177 /// <returns type="Sys.UI.DomElement" /> 1178 /// <remarks> 1179 /// This method is useful if you find yourself using the same or similar DomElement constructions throughout a class. You can even set the templates 1180 /// as static properties for a type to cut down on overhead. This method is often called with a JSON style template: 1181 /// <code> 1182 /// var elt = $common.createElementFromTemplate({ 1183 /// nodeName : "div", 1184 /// properties : { 1185 /// style : { 1186 /// height : "100px", 1187 /// width : "100px", 1188 /// backgroundColor : "white" 1189 /// }, 1190 /// expandoAttribute : "foo" 1191 /// }, 1192 /// events : { 1193 /// click : function() { alert("foo"); }, 1194 /// mouseover : function() { elt.backgroundColor = "silver"; }, 1195 /// mouseout : function() { elt.backgroundColor = "white"; } 1196 /// },
1197 /// cssClasses : [ "class0", "class1" ], 1198 /// visible : true, 1199 /// opacity : .5 1200 /// }, someParent); 1201 /// </code> 1202 /// </remarks> 1203 1204 // if we wish to override the name table we do so here 1205 if (typeof(template.nameTable)!='undefined') { 1206 var newNameTable = template.nameTable; 1207 if (String.isInstanceOfType(newNameTable)) { 1208 newNameTable = nameTable[newNameTable]; 1209 } 1210 if (newNameTable != null) { 1211 nameTable = newNameTable; 1212 } 1213 } 1214 1215 // get a name for the element in the nameTable 1216 var elementName = null; 1217 if (typeof(template.name)!=='undefined') { 1218 elementName = template.name; 1219 } 1220 1221 // create or acquire the element 1222 var elt = document.createElement(template.nodeName); 1223 1224 // if our element is named, add it to the name table 1225 if (typeof(template.name)!=='undefined' && nameTable) { 1226 nameTable[template.name] = elt; 1227 } 1228 1229 // if we wish to supply a default parent we do so here 1230 if (typeof(template.parent)!=='undefined' && appendToParent == null) { 1231 var newParent = template.parent; 1232 if (String.isInstanceOfType(newParent)) { 1233 newParent = nameTable[newParent]; 1234 } 1235 if (newParent != null) { 1236 appendToParent = newParent; 1237 } 1238 } 1239 1240 // properties are applied as expando values to the element 1241 if (typeof(template.properties)!=='undefined' && template.properties != null) { 1242 $common.applyProperties(elt, template.properties); 1243 } 1244 1245 // css classes are added to the element's className property 1246 if (typeof(template.cssClasses)!=='undefined' && template.cssClasses != null) { 1247 $common.addCssClasses(elt, template.cssClasses); 1248 } 1249 1250 // events are added to the dom element using $addHandlers 1251 if (typeof(template.events)!=='undefined' && template.events != null) { 1252 $addHandlers(elt, template.events); 1253 } 1254 1255 // if the element is visible or not its visibility is set 1256 if (typeof(template.visible)!=='undefined' && template.visible != null) { 1257 this.setVisible(elt, template.visible); 1258 } 1259 1260 // if we have an appendToParent we will now append to it 1261 if (appendToParent) { 1262 appendToParent.appendChild(elt); 1263 } 1264 1265 // if we have opacity, apply it 1266 if (typeof(template.opacity)!=='undefined' && template.opacity != null) { 1267 $common.setElementOpacity(elt, template.opacity); 1268 } 1269 1270 // if we have child templates, process them 1271 if (typeof(template.children)!=='undefined' && template.children != null) { 1272 for (var i = 0; i < template.children.length; i++) { 1273 var subtemplate = template.children[i]; 1274 $common.createElementFromTemplate(subtemplate, elt, nameTable); 1275 } 1276 } 1277 1278 // if we have a content presenter for the element get it (the element itself is the default presenter for content) 1279 var contentPresenter = elt; 1280 if (typeof(template.contentPresenter)!=='undefined' && template.contentPresenter != null) { 1281 contentPresenter = nameTable[contentPresenter]; 1282 } 1283 1284 // if we have content, add it 1285 if (typeof(template.content)!=='undefined' && template.content != null) { 1286 var content = template.content; 1287 if (String.isInstanceOfType(content)) { 1288 content = nameTable[content]; 1289 } 1290 if (content.parentNode) { 1291 $common.wrapElement(content, elt, contentPresenter); 1292 } else { 1293 contentPresenter.appendChild(content); 1294 } 1295 } 1296 1297 // return the created element 1298 return elt; 1299 }, 1300 1301 prepareHiddenElementForATDeviceUpdate : function () { 1302 /// <summary> 1303 /// JAWS, an Assistive Technology device responds to updates to form elements 1304 /// and refreshes its document buffer to what is showing live 1305 /// in the browser. To ensure that Toolkit controls that make XmlHttpRequests to 1306 /// retrieve content are useful to users with visual disabilities, we update a 1307 /// hidden form element to ensure that JAWS conveys what is in 1308 /// the browser. See this article for more details: 1309 /// http://juicystudio.com/article/improving-ajax-applications-for-jaws-users.php 1310 /// This method creates a hidden input on the screen for any page that uses a Toolkit 1311 /// control that will perform an XmlHttpRequest. 1312 /// </summary> 1313 var objHidden = document.getElementById('hiddenInputToUpdateATBuffer_C
1313ommonToolkitScripts'); 1314 if (!objHidden) { 1315 var objHidden = document.createElement('input'); 1316 objHidden.setAttribute('type', 'hidden'); 1317 objHidden.setAttribute('value', '1'); 1318 objHidden.setAttribute('id', 'hiddenInputToUpdateATBuffer_CommonToolkitScripts'); 1319 objHidden.setAttribute('name', 'hiddenInputToUpdateATBuffer_CommonToolkitScripts'); 1320 if ( document.forms[0] ) { 1321 document.forms[0].appendChild(objHidden); 1322 } 1323 } 1324 }, 1325 1326 updateFormToRefreshATDeviceBuffer : function () { 1327 /// <summary> 1328 /// Updates the hidden buffer to ensure that the latest document stream is picked up 1329 /// by the screen reader. 1330 /// </summary> 1331 var objHidden = document.getElementById('hiddenInputToUpdateATBuffer_CommonToolkitScripts'); 1332 1333 if (objHidden) { 1334 if (objHidden.getAttribute('value') == '1') { 1335 objHidden.setAttribute('value', '0'); 1336 } else { 1337 objHidden.setAttribute('value', '1'); 1338 } 1339 } 1340 } 1341} 1342 1343// Create the singleton instance of the CommonToolkitScripts 1344var CommonToolkitScripts = AjaxControlToolkit.CommonToolkitScripts = new AjaxControlToolkit._CommonToolkitScripts(); 1345var $common = CommonToolkitScripts; 1346 1347// Alias functions that were moved from BlockingScripts into Common 1348Sys.UI.DomElement.getVisible = $common.getVisible; 1349Sys.UI.DomElement.setVisible = $common.setVisible; 1350Sys.UI.Control.overlaps = $common.overlaps; 1351 1352AjaxControlToolkit._DomUtility = function() { 1353 /// <summary> 1354 /// Utility functions for manipulating the DOM 1355 /// </summary> 1356} 1357AjaxControlToolkit._DomUtility.prototype = { 1358 isDescendant : function(ancestor, descendant) { 1359 /// <summary> 1360 /// Whether the specified element is a descendant of the ancestor 1361 /// </summary> 1362 /// <param name="ancestor" type="Sys.UI.DomElement">Ancestor node</param> 1363 /// <param name="descendant" type="Sys.UI.DomElement">Possible descendant node</param> 1364 /// <returns type="Boolean" /> 1365 1366 for (var n = descendant.parentNode; n != null; n = n.parentNode) { 1367 if (n == ancestor) return true; 1368 } 1369 return false; 1370 }, 1371 isDescendantOrSelf : function(ancestor, descendant) { 1372 /// <summary> 1373 /// Whether the specified element is a descendant of the ancestor or the same as the ancestor 1374 /// </summary> 1375 /// <param name="ancestor" type="Sys.UI.DomElement">Ancestor node</param> 1376 /// <param name="descendant" type="Sys.UI.DomElement">Possible descendant node</param> 1377 /// <returns type="Boolean" /> 1378 1379 if (ancestor === descendant) 1380 return true; 1381 return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant); 1382 }, 1383 isAncestor : function(descendant, ancestor) { 1384 /// <summary> 1385 /// Whether the specified element is an ancestor of the descendant 1386 /// </summary> 1387 /// <param name="descendant" type="Sys.UI.DomElement">Descendant node</param> 1388 /// <param name="ancestor" type="Sys.UI.DomElement">Possible ancestor node</param> 1389 /// <returns type="Boolean" /> 1390 1391 return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant); 1392 }, 1393 isAncestorOrSelf : function(descendant, ancestor) { 1394 /// <summary> 1395 /// Whether the specified element is an ancestor of the descendant or the same as the descendant 1396 /// </summary> 1397 /// <param name="descendant" type="Sys.UI.DomElement">Descendant node</param> 1398 /// <param name="ancestor" type="Sys.UI.DomElement">Possible ancestor node</param> 1399 /// <returns type="Boolean" /> 1400 1401 if (descendant === ancestor) 1402 return true; 1403 1404 return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant); 1405 }, 1406 isSibling : function(self, sibling) { 1407 /// <summary> 1408 /// Whether the specified element is a sibling of the self element 1409 /// </summary> 1410 /// <param name="self" type="Sys.UI.DomElement">Self node</param> 1411 /// <param name="sibling" type="Sys.UI.DomElement">Possible sibling node</param> 1412 /// <returns type="Boolean" /> 1413 1414 var parent = self.parentNode; 1415 for (var i = 0; i < parent.childNodes.length; i++) { 1416 if (parent.childNodes[i] == sibling) return true; 1417 } 1418 return false; 1419 } 1420} 1421AjaxControlToolkit._DomUtility.registerClass("AjaxControlToolkit._DomUtility"); 1422AjaxControlToolkit.DomUtility = new AjaxControlToolkit._DomUtility(); 1423 1424 1425AjaxControlToolkit.TextBoxWrapper = function(element) { 1426 /// <summary> 1427 /// Class that wraps a TextBox (INPUT type="text") to abstract-out the 1428 /// presence of a watermark (which may be visible to the user but which 1429 /// should never be read by script. 1430 /// </summary> 1431 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 1432 /// The DOM element the behavior is associated with 1433 /// </param> 1434 AjaxControlToolkit.TextBoxWrapper.initializeBase(this, [element]);
1435 this._current = element.value; 1436 this._watermark = null; 1437 this._isWatermarked = false; 1438} 1439 1440AjaxControlToolkit.TextBoxWrapper.prototype = { 1441 1442 dispose : function() { 1443 /// <summary> 1444 /// Dispose the behavior 1445 /// </summary> 1446 this.get_element().AjaxControlToolkitTextBoxWrapper = null; 1447 AjaxControlToolkit.TextBoxWrapper.callBaseMethod(this, 'dispose'); 1448 }, 1449 1450 get_Current : function() { 1451 /// <value type="String"> 1452 /// Current value actually in the TextBox (i.e., TextBox.value) 1453 /// </value> 1454 this._current = this.get_element().value; 1455 return this._current; 1456 }, 1457 set_Current : function(value) { 1458 this._current = value; 1459 this._updateElement(); 1460 }, 1461 1462 get_Value : function() { 1463 /// <value type="String"> 1464 /// Conceptual "value" of the TextBox - its contents if no watermark is present 1465 /// or "" if one is 1466 /// </value> 1467 if (this.get_IsWatermarked()) { 1468 return ""; 1469 } else { 1470 return this.get_Current(); 1471 } 1472 }, 1473 set_Value : function(text) { 1474 this.set_Current(text); 1475 if (!text || (0 == text.length)) { 1476 if (null != this._watermark) { 1477 this.set_IsWatermarked(true); 1478 } 1479 } else { 1480 this.set_IsWatermarked(false); 1481 } 1482 }, 1483 1484 get_Watermark : function() { 1485 /// <value type="String"> 1486 /// Text of the watermark for the TextBox 1487 /// </value> 1488 return this._watermark; 1489 }, 1490 set_Watermark : function(value) { 1491 this._watermark = value; 1492 this._updateElement(); 1493 }, 1494 1495 get_IsWatermarked : function() { 1496 /// <value type="Boolean"> 1497 /// true iff the TextBox is watermarked 1498 /// </value> 1499 return this._isWatermarked; 1500 }, 1501 set_IsWatermarked : function(isWatermarked) { 1502 if (this._isWatermarked != isWatermarked) { 1503 this._isWatermarked = isWatermarked; 1504 this._updateElement(); 1505 this._raiseWatermarkChanged(); 1506 } 1507 }, 1508 1509 _updateElement : function() { 1510 /// <summary> 1511 /// Updates the actual contents of the TextBox according to what should be there 1512 /// </summary> 1513 var element = this.get_element(); 1514 if (this._isWatermarked) { 1515 if (element.value != this._watermark) { 1516 element.value = this._watermark; 1517 } 1518 } else { 1519 if (element.value != this._current) { 1520 element.value = this._current; 1521 } 1522 } 1523 }, 1524 1525 add_WatermarkChanged : function(handler) { 1526 /// <summary> 1527 /// Adds a handler for the WatermarkChanged event 1528 /// </summary> 1529 /// <param name="handler" type="Function"> 1530 /// Handler 1531 /// </param> 1532 this.get_events().addHandler("WatermarkChanged", handler); 1533 }, 1534 remove_WatermarkChanged : function(handler) { 1535 /// <summary> 1536 /// Removes a handler for the WatermarkChanged event 1537 /// </summary> 1538 /// <param name="handler" type="Function"> 1539 /// Handler 1540 /// </param> 1541 this.get_events().removeHandler("WatermarkChanged", handler); 1542 }, 1543 _raiseWatermarkChanged : function() { 1544 /// <summary> 1545 /// Raises the WatermarkChanged event 1546 /// </summary> 1547 var onWatermarkChangedHandler = this.get_events().getHandler("WatermarkChanged"); 1548 if (onWatermarkChangedHandler) { 1549 onWatermarkChangedHandler(this, Sys.EventArgs.Empty); 1550 } 1551 } 1552} 1553AjaxControlToolkit.TextBoxWrapper.get_Wrapper = function(element) { 1554 /// <summary> 1555 /// Gets (creating one if necessary) the TextBoxWrapper for the specified TextBox 1556 /// </summary> 1557 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 1558 /// TextBox for which to get the wrapper 1559 /// </param> 1560 /// <returns type="AjaxControlToolkit.TextBoxWrapper"> 1561 /// TextBoxWrapper instance 1562 /// </returns> 1563 if (null == element.AjaxControlToolkitTextBoxWrapper) { 1564 element.AjaxControlToolkitTextBoxWrapper = new AjaxControlToolkit.TextBoxWrapper(element); 1565 } 1566 return element.AjaxControlToolkitTextBoxWrapper; 1567} 1568AjaxControlToolkit.TextBoxWrapper.registerClass('AjaxControlToolkit.TextBoxWrapper', Sys.UI.Behavior); 1569 1570AjaxControlToolkit.TextBoxWrapper.validatorGetValue = function(id) { 1571 /// <summary> 1572 /// Wrapper for ASP.NET's validatorGetValue to return the value from the wrapper if present 1573 /// </summary> 1574 /// <param name="id" type="String"> 1575 /// id of the element 1576 /// </param> 1577 /// <returns type="Object"> 1578 /// Value from the wrapper or result of original ValidatorGetValue 1579 /// </returns> 1580 var control = $get(id); 1581 if (control && control.AjaxControlToolkitTextBoxWrapper) { 1582 return control.AjaxControlToolkitTextBoxWrapper.get_Value(); 1583 } 1584 return AjaxControlToolkit.TextBoxWrapper._originalValidatorGetValue(id); 1585} 1586 1587// Wrap ASP.NET's ValidatorGetValue with AjaxControlToolkit.TextBoxWrapper.validatorGetValue 1588// to make validators work properly with watermarked TextBoxes 1589if (typeof(ValidatorGetValue) == 'function') { 1590 AjaxControlToolkit.TextBoxWrapper._originalValidatorGetValue = ValidatorGetValue; 1591 ValidatorGetValue = AjaxControlToolkit.TextBoxWrapper.validatorGetValue; 1592} 1593 1594 1595// Temporary fix null reference bug in Sys.CultureInfo._getAbbrMonthIndex 1596if (Sys.CultureInfo.prototype._getAbbrMonthIndex) { 1597 try { 1598 Sys.CultureInfo.prototype._getAbbrMonthIndex(''); 1599 } catch(ex) { 1600 Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) { 1601 if (!this._upperAbbrMonths) { 1602 this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames); 1603 } 1604 return Array.indexOf(this._upperAbbrMonths, this._toUpper(value)); 1605 } 1606 Sys.CultureInfo.CurrentCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex; 1607 Sys.CultureInfo.InvariantCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex; 1608 } 1609} 1610 1611// (c) Copyright Microsoft Corporation. 1612// This source is subject to the Microsoft Permissive License. 1613// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 1614// All other rights reserved. 1615 1616 1617/// <reference name="MicrosoftAjax.debug.js" /> 1618/// <reference name="MicrosoftAjaxTimer.debug.js" /> 1619/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 1620 1621 1622Type.registerNamespace('AjaxControlToolkit'); 1623 1624// This is the base behavior for all extender behaviors 1625AjaxControlToolkit.BehaviorBase = function(element) { 1626 /// <summary> 1627 /// Base behavior for all extender behaviors 1628 /// </summary> 1629 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 1630 /// Element the behavior is associated with 1631 /// </param> 1632 AjaxControlToolkit.BehaviorBase.initializeBase(this,[element]);
1633 1634 this._clientStateFieldID = null; 1635 this._pageRequestManager = null; 1636 this._partialUpdateBeginRequestHandler = null; 1637 this._partialUpdateEndRequestHandler = null; 1638} 1639AjaxControlToolkit.BehaviorBase.prototype = { 1640 initialize : function() { 1641 /// <summary> 1642 /// Initialize the behavior 1643 /// </summary> 1644 1645 // TODO: Evaluate necessity 1646 AjaxControlToolkit.BehaviorBase.callBaseMethod(this, 'initialize'); 1647 }, 1648 1649 dispose : function() { 1650 /// <summary> 1651 /// Dispose the behavior 1652 /// </summary> 1653 AjaxControlToolkit.BehaviorBase.callBaseMethod(this, 'dispose'); 1654 1655 if (this._pageRequestManager) { 1656 if (this._partialUpdateBeginRequestHandler) { 1657 this._pageRequestManager.remove_beginRequest(this._partialUpdateBeginRequestHandler); 1658 this._partialUpdateBeginRequestHandler = null; 1659 } 1660 if (this._partialUpdateEndRequestHandler) { 1661 this._pageRequestManager.remove_endRequest(this._partialUpdateEndRequestHandler); 1662 this._partialUpdateEndRequestHandler = null; 1663 } 1664 this._pageRequestManager = null; 1665 } 1666 }, 1667 1668 get_ClientStateFieldID : function() { 1669 /// <value type="String"> 1670 /// ID of the hidden field used to store client state 1671 /// </value> 1672 return this._clientStateFieldID; 1673 }, 1674 set_ClientStateFieldID : function(value) { 1675 if (this._clientStateFieldID != value) { 1676 this._clientStateFieldID = value; 1677 this.raisePropertyChanged('ClientStateFieldID'); 1678 } 1679 }, 1680 1681 get_ClientState : function() { 1682 /// <value type="String"> 1683 /// Client state 1684 /// </value> 1685 if (this._clientStateFieldID) { 1686 var input = document.getElementById(this._clientStateFieldID); 1687 if (input) { 1688 return input.value; 1689 } 1690 } 1691 return null; 1692 }, 1693 set_ClientState : function(value) { 1694 if (this._clientStateFieldID) { 1695 var input = document.getElementById(this._clientStateFieldID); 1696 if (input) { 1697 input.value = value; 1698 } 1699 } 1700 }, 1701 1702 registerPartialUpdateEvents : function() { 1703 /// <summary> 1704 /// Register for beginRequest and endRequest events on the PageRequestManager, 1705 /// (which cause _partialUpdateBeginRequest and _partialUpdateEndRequest to be 1706 /// called when an UpdatePanel refreshes) 1707 /// </summary> 1708 1709 if (Sys && Sys.WebForms && Sys.WebForms.PageRequestManager){ 1710 this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance(); 1711 if (this._pageRequestManager) { 1712 this._partialUpdateBeginRequestHandler = Function.createDelegate(this, this._partialUpdateBeginRequest); 1713 this._pageRequestManager.add_beginRequest(this._partialUpdateBeginRequestHandler); 1714 this._partialUpdateEndRequestHandler = Function.createDelegate(this, this._partialUpdateEndRequest); 1715 this._pageRequestManager.add_endRequest(this._partialUpdateEndRequestHandler); 1716 } 1717 } 1718 }, 1719 1720 _partialUpdateBeginRequest : function(sender, beginRequestEventArgs) { 1721 /// <summary> 1722 /// Method that will be called when a partial update (via an UpdatePanel) begins, 1723 /// if registerPartialUpdateEvents() has been called. 1724 /// </summary> 1725 /// <param name="sender" type="Object"> 1726 /// Sender 1727 /// </param> 1728 /// <param name="beginRequestEventArgs" type="Sys.WebForms.BeginRequestEventArgs"> 1729 /// Event arguments 1730 /// </param> 1731 1732 // Nothing done here; override this method in a child class 1733 }, 1734 1735 _partialUpdateEndRequest : function(sender, endRequestEventArgs) { 1736 /// <summary> 1737 /// Method that will be called when a partial update (via an UpdatePanel) finishes, 1738 /// if registerPartialUpdateEvents() has been called. 1739 /// </summary> 1740 /// <param name="sender" type="Object"> 1741 /// Sender 1742 /// </param> 1743 /// <param name="endRequestEventArgs" type="Sys.WebForms.EndRequestEventArgs"> 1744 /// Event arguments 1745 /// </param> 1746 1747 // Nothing done here; override this method in a child class 1748 } 1749} 1750AjaxControlToolkit.BehaviorBase.registerClass('AjaxControlToolkit.BehaviorBase', Sys.UI.Behavior); 1751 1752 1753// Dynamically populates content when the populate method is called 1754AjaxControlToolkit.DynamicPopulateBehaviorBase = function(element) { 1755 /// <summary> 1756 /// DynamicPopulateBehaviorBase is used to add DynamicPopulateBehavior funcitonality 1757 /// to other extenders. It will dynamically populate the contents of the target element 1758 /// when its populate method is called. 1759 /// </summary> 1760 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 1761 /// DOM Element the behavior is associated with 1762 /// </param> 1763 AjaxControlToolkit.DynamicPopulateBehaviorBase.initializeBase(this, [element]);
1764 1765 this._DynamicControlID = null; 1766 this._DynamicContextKey = null; 1767 this._DynamicServicePath = null; 1768 this._DynamicServiceMethod = null; 1769 this._cacheDynamicResults = false; 1770 this._dynamicPopulateBehavior = null; 1771 this._populatingHandler = null; 1772 this._populatedHandler = null; 1773} 1774AjaxControlToolkit.DynamicPopulateBehaviorBase.prototype = { 1775 initialize : function() { 1776 /// <summary> 1777 /// Initialize the behavior 1778 /// </summary> 1779 1780 AjaxControlToolkit.DynamicPopulateBehaviorBase.callBaseMethod(this, 'initialize'); 1781 1782 // Create event handlers 1783 this._populatingHandler = Function.createDelegate(this, this._onPopulating); 1784 this._populatedHandler = Function.createDelegate(this, this._onPopulated); 1785 }, 1786 1787 dispose : function() { 1788 /// <summary> 1789 /// Dispose the behavior 1790 /// </summary> 1791 1792 // Dispose of event handlers 1793 if (this._populatedHandler) { 1794 if (this._dynamicPopulateBehavior) { 1795 this._dynamicPopulateBehavior.remove_populated(this._populatedHandler); 1796 } 1797 this._populatedHandler = null; 1798 } 1799 if (this._populatingHandler) { 1800 if (this._dynamicPopulateBehavior) { 1801 this._dynamicPopulateBehavior.remove_populating(this._populatingHandler); 1802 } 1803 this._populatingHandler = null; 1804 } 1805 1806 // Dispose of the placeholder control and behavior 1807 if (this._dynamicPopulateBehavior) { 1808 this._dynamicPopulateBehavior.dispose(); 1809 this._dynamicPopulateBehavior = null; 1810 } 1811 AjaxControlToolkit.DynamicPopulateBehaviorBase.callBaseMethod(this, 'dispose'); 1812 }, 1813 1814 populate : function(contextKeyOverride) { 1815 /// <summary> 1816 /// Demand-create the DynamicPopulateBehavior and use it to populate the target element 1817 /// </summary> 1818 /// <param name="contextKeyOverride" type="String" mayBeNull="true" optional="true"> 1819 /// An arbitrary string value to be passed to the web method. For example, if the element to be populated is within a data-bound repeater, this could be the ID of the current row. 1820 /// </param> 1821 1822 // If the DynamicPopulateBehavior's element is out of date, dispose of it 1823 if (this._dynamicPopulateBehavior && (this._dynamicPopulateBehavior.get_element() != $get(this._DynamicControlID))) { 1824 this._dynamicPopulateBehavior.dispose(); 1825 this._dynamicPopulateBehavior = null; 1826 } 1827 1828 // If a DynamicPopulateBehavior is not available and the necessary information is, create one 1829 if (!this._dynamicPopulateBehavior && this._DynamicControlID && this._DynamicServiceMethod) { 1830 this._dynamicPopulateBehavior = $create(AjaxControlToolkit.DynamicPopulateBehavior, 1831 { 1832 "id" : this.get_id() + "_DynamicPopulateBehavior", 1833 "ContextKey" : this._DynamicContextKey, 1834 "ServicePath" : this._DynamicServicePath, 1835 "ServiceMethod" : this._DynamicServiceMethod, 1836 "cacheDynamicResults" : this._cacheDynamicResults 1837 }, null, null, $get(this._DynamicControlID)); 1838 1839 // Attach event handlers 1840 this._dynamicPopulateBehavior.add_populating(this._populatingHandler); 1841 this._dynamicPopulateBehavior.add_populated(this._populatedHandler); 1842 } 1843 1844 // If a DynamicPopulateBehavior is available, use it to populate the dynamic content 1845 if (this._dynamicPopulateBehavior) { 1846 this._dynamicPopulateBehavior.populate(contextKeyOverride ? contextKeyOverride : this._DynamicContextKey); 1847 } 1848 }, 1849 1850 _onPopulating : function(sender, eventArgs) { 1851 /// <summary> 1852 /// Handler for DynamicPopulate behavior's Populating event 1853 /// </summary> 1854 /// <param name="sender" type="Object"> 1855 /// DynamicPopulate behavior 1856 /// </param> 1857 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 1858 /// Event args 1859 /// </param>
1860 this.raisePopulating(eventArgs); 1861 }, 1862 1863 _onPopulated : function(sender, eventArgs) { 1864 /// <summary> 1865 /// Handler for DynamicPopulate behavior's Populated event 1866 /// </summary> 1867 /// <param name="sender" type="Object"> 1868 /// DynamicPopulate behavior 1869 /// </param> 1870 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false"> 1871 /// Event args 1872 /// </param> 1873 this.raisePopulated(eventArgs); 1874 }, 1875 1876 get_dynamicControlID : function() { 1877 /// <value type="String"> 1878 /// ID of the element to populate with dynamic content 1879 /// </value> 1880 return this._DynamicControlID; 1881 }, 1882 get_DynamicControlID : this.get_dynamicControlID, 1883 set_dynamicControlID : function(value) { 1884 if (this._DynamicControlID != value) { 1885 this._DynamicControlID = value; 1886 this.raisePropertyChanged('dynamicControlID'); 1887 this.raisePropertyChanged('DynamicControlID'); 1888 } 1889 }, 1890 set_DynamicControlID : this.set_dynamicControlID, 1891 1892 get_dynamicContextKey : function() { 1893 /// <value type="String"> 1894 /// An arbitrary string value to be passed to the web method. 1895 /// For example, if the element to be populated is within a 1896 /// data-bound repeater, this could be the ID of the current row. 1897 /// </value> 1898 return this._DynamicContextKey; 1899 }, 1900 get_DynamicContextKey : this.get_dynamicContextKey, 1901 set_dynamicContextKey : function(value) { 1902 if (this._DynamicContextKey != value) { 1903 this._DynamicContextKey = value; 1904 this.raisePropertyChanged('dynamicContextKey'); 1905 this.raisePropertyChanged('DynamicContextKey'); 1906 } 1907 }, 1908 set_DynamicContextKey : this.set_dynamicContextKey, 1909 1910 get_dynamicServicePath : function() { 1911 /// <value type="String" mayBeNull="true" optional="true"> 1912 /// The URL of the web service to call. If the ServicePath is not defined, then we will invoke a PageMethod instead of a web service. 1913 /// </value> 1914 return this._DynamicServicePath; 1915 }, 1916 get_DynamicServicePath : this.get_dynamicServicePath, 1917 set_dynamicServicePath : function(value) { 1918 if (this._DynamicServicePath != value) { 1919 this._DynamicServicePath = value; 1920 this.raisePropertyChanged('dynamicServicePath'); 1921 this.raisePropertyChanged('DynamicServicePath'); 1922 } 1923 }, 1924 set_DynamicServicePath : this.set_dynamicServicePath, 1925 1926 get_dynamicServiceMethod : function() { 1927 /// <value type="String"> 1928 /// The name of the method to call on the page or web service 1929 /// </value> 1930 /// <remarks> 1931 /// The signature of the method must exactly match the following: 1932 /// [WebMethod] 1933 /// string DynamicPopulateMethod(string contextKey) 1934 /// { 1935 /// ... 1936 /// } 1937 /// </remarks> 1938 return this._DynamicServiceMethod; 1939 }, 1940 get_DynamicServiceMethod : this.get_dynamicServiceMethod, 1941 set_dynamicServiceMethod : function(value) { 1942 if (this._DynamicServiceMethod != value) { 1943 this._DynamicServiceMethod = value; 1944 this.raisePropertyChanged('dynamicServiceMethod'); 1945 this.raisePropertyChanged('DynamicServiceMethod'); 1946 } 1947 }, 1948 set_DynamicServiceMethod : this.set_dynamicServiceMethod, 1949 1950 get_cacheDynamicResults : function() { 1951 /// <value type="Boolean" mayBeNull="false"> 1952 /// Whether the results of the dynamic population should be cached and 1953 /// not fetched again after the first load 1954 /// </value> 1955 return this._cacheDynamicResults; 1956 }, 1957 set_cacheDynamicResults : function(value) { 1958 if (this._cacheDynamicResults != value) { 1959 this._cacheDynamicResults = value; 1960 this.raisePropertyChanged('cacheDynamicResults'); 1961 } 1962 }, 1963 1964 add_populated : function(handler) { 1965 /// <summary> 1966 /// Add a handler on the populated event 1967 /// </summary> 1968 /// <param name="handler" type="Function"> 1969 /// Handler 1970 /// </param> 1971 this.get_events().addHandler("populated", handler); 1972 }, 1973 remove_populated : function(handler) { 1974 /// <summary> 1975 /// Remove a handler from the populated event 1976 /// </summary> 1977 /// <param name="handler" type="Function"> 1978 /// Handler 1979 /// </param> 1980 this.get_events().removeHandler("populated", handler); 1981 },
1982 raisePopulated : function(arg) { 1983 /// <summary> 1984 /// Raise the populated event 1985 /// </summary> 1986 /// <param name="arg" type="Sys.EventArgs"> 1987 /// Event arguments 1988 /// </param> 1989 var handler = this.get_events().getHandler("populated"); 1990 if (handler) handler(this, arg); 1991 }, 1992 1993 add_populating : function(handler) { 1994 /// <summary> 1995 /// Add an event handler for the populating event 1996 /// </summary> 1997 /// <param name="handler" type="Function" mayBeNull="false"> 1998 /// Event handler 1999 /// </param> 2000 /// <returns /> 2001 this.get_events().addHandler('populating', handler); 2002 }, 2003 remove_populating : function(handler) { 2004 /// <summary> 2005 /// Remove an event handler from the populating event 2006 /// </summary> 2007 /// <param name="handler" type="Function" mayBeNull="false"> 2008 /// Event handler 2009 /// </param> 2010 /// <returns /> 2011 this.get_events().removeHandler('populating', handler); 2012 }, 2013 raisePopulating : function(eventArgs) { 2014 /// <summary> 2015 /// Raise the populating event 2016 /// </summary> 2017 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 2018 /// Event arguments for the populating event 2019 /// </param> 2020 /// <returns /> 2021 2022 var handler = this.get_events().getHandler('populating'); 2023 if (handler) { 2024 handler(this, eventArgs); 2025 } 2026 } 2027} 2028AjaxControlToolkit.DynamicPopulateBehaviorBase.registerClass('AjaxControlToolkit.DynamicPopulateBehaviorBase', AjaxControlToolkit.BehaviorBase); 2029 2030 2031AjaxControlToolkit.ControlBase = function(element) { 2032 AjaxControlToolkit.ControlBase.initializeBase(this, [element]); 2033 this._clientStateField = null; 2034 this._callbackTarget = null; 2035 this._onsubmit$delegate = Function.createDelegate(this, this._onsubmit); 2036 this._oncomplete$delegate = Function.createDelegate(this, this._oncomplete); 2037 this._onerror$delegate = Function.createDelegate(this, this._onerror); 2038} 2039AjaxControlToolkit.ControlBase.prototype = { 2040 initialize : function() { 2041 AjaxControlToolkit.ControlBase.callBaseMethod(this, "initialize"); 2042 // load the client state if possible 2043 if (this._clientStateField) { 2044 this.loadClientState(this._clientStateField.value); 2045 } 2046 // attach an event to save the client state before a postback or updatepanel partial postback 2047 if (typeof(Sys.WebForms)!=="undefined" && typeof(Sys.WebForms.PageRequestManager)!=="undefined") { 2048 Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate); 2049 } else { 2050 $addHandler(document.forms[0], "submit", this._onsubmit$delegate); 2051 } 2052 }, 2053 dispose : function() { 2054 if (typeof(Sys.WebForms)!=="undefined" && typeof(Sys.WebForms.PageRequestManager)!=="undefined") { 2055 Array.remove(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate); 2056 } else { 2057 $removeHandler(document.forms[0], "submit", this._onsubmit$delegate); 2058 } 2059 AjaxControlToolkit.ControlBase.callBaseMethod(this, "dispose"); 2060 }, 2061 findElement : function(id) { 2062 // <summary>Finds an element within this control (ScriptControl/ScriptUserControl are NamingContainers); 2063 return $get(this.get_id() + '_' + id.split(':').join('_')); 2064 }, 2065 get_clientStateField : function() { 2066 return this._clientStateField; 2067 }, 2068 set_clientStateField : function(value) { 2069 if (this.get_isInitialized()) throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_CannotSetClientStateField); 2070 if (this._clientStateField != value) { 2071 this._clientStateField = value; 2072 this.raisePropertyChanged('clientStateField'); 2073 } 2074 }, 2075 loadClientState : function(value) { 2076 /// <remarks>override this method to intercept client state loading after a callback</remarks> 2077 }, 2078 saveClientState : function() { 2079 /// <remarks>override this method to intercept client state acquisition before a callback</remarks> 2080 return null; 2081 }, 2082 _invoke : function(name, args, cb) { 2083 /// <summary>invokes a callback method on the server control</summary> 2084 if (!this._callbackTarget) {
2085 throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_ControlNotRegisteredForCallbacks); 2086 } 2087 if (typeof(WebForm_DoCallback)==="undefined") { 2088 throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_PageNotRegisteredForCallbacks); 2089 } 2090 var ar = []; 2091 for (var i = 0; i < args.length; i++) 2092 ar[i] = args[i]; 2093 var clientState = this.saveClientState(); 2094 if (clientState != null && !String.isInstanceOfType(clientState)) { 2095 throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_InvalidClientStateType); 2096 } 2097 var payload = Sys.Serialization.JavaScriptSerializer.serialize({name:name,args:ar,state:this.saveClientState()}); 2098 WebForm_DoCallback(this._callbackTarget, payload, this._oncomplete$delegate, cb, this._onerror$delegate, true); 2099 }, 2100 _oncomplete : function(result, context) { 2101 result = Sys.Serialization.JavaScriptSerializer.deserialize(result); 2102 if (result.error) { 2103 throw Error.create(result.error); 2104 } 2105 this.loadClientState(result.state); 2106 context(result.result); 2107 }, 2108 _onerror : function(message, context) { 2109 throw Error.create(message); 2110 }, 2111 _onsubmit : function() { 2112 if (this._clientStateField) { 2113 this._clientStateField.value = this.saveClientState(); 2114 } 2115 return true; 2116 } 2117 2118} 2119AjaxControlToolkit.ControlBase.registerClass("AjaxControlToolkit.ControlBase", Sys.UI.Control); 2120 2121Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.Resources={"PasswordStrength_InvalidWeightingRatios":"Strength Weighting ratios must have 4 elements","Animation_ChildrenNotAllowed":"AjaxControlToolkit.Animation.createAnimation cannot add child animations to type \"{0}\" that does not derive from AjaxControlToolkit.Animation.ParentAnimation","PasswordStrength_RemainingSymbols":"{0} symbol characters","ExtenderBase_CannotSetClientStateField":"clientStateField can only be set before initialization","RTE_PreviewHTML":"Preview HTML","RTE_JustifyCenter":"Justify Center","PasswordStrength_RemainingUpperCase":"{0} more upper case characters","Animation_TargetNotFound":"AjaxControlToolkit.Animation.Animation.set_animationTarget requires the ID of a Sys.UI.DomElement or Sys.UI.Control. No element or control could be found corresponding to \"{0}\"","RTE_FontColor":"Font Color","RTE_LabelColor":"Label Color","Common_InvalidBorderWidthUnit":"A unit type of \"{0}\"\u0027 is invalid for parseBorderWidth","RTE_Heading":"Heading","Tabs_PropertySetBeforeInitialization":"{0} cannot be changed before initialization","RTE_OrderedList":"Ordered List","ReorderList_DropWatcherBehavior_NoChild":"Could not find child of list with id \"{0}\"","CascadingDropDown_MethodTimeout":"[Method timeout]","RTE_Columns":"Columns","RTE_InsertImage":"Insert Image","RTE_InsertTable":"Insert Table","RTE_Values":"Values","RTE_OK":"OK","ExtenderBase_PageNotRegisteredForCallbacks":"This Page has not been registered for callbacks","Animation_NoDynamicPropertyFound":"AjaxControlToolkit.Animation.createAnimation found no property corresponding to \"{0}\" or \"{1}\"","Animation_InvalidBaseType":"AjaxControlToolkit.Animation.registerAnimation can only register types that inherit from AjaxControlToolkit.Animation.Animation","RTE_UnorderedList":"Unordered List","ResizableControlBehavior_InvalidHandler":"{0} handler not a function, function name, or function text","Animation_InvalidColor":"Color must be a 7-character hex representation (e.g. #246ACF), not \"{0}\"","RTE_CellColor":"Cell Color","PasswordStrength_RemainingMixedCase":"Mixed case characters","RTE_Italic":"Italic","CascadingDropDown_NoParentElement":"Failed to find parent element \"{0}\"","ValidatorCallout_DefaultErrorMessage":"This control is invalid","RTE_Indent":"Indent","ReorderList_DropWatcherBehavior_CallbackError":"Reorder failed, see details below.\\r\\n\\r\\n{0}","PopupControl_NoDefaultProperty":"No default property supported for control \"{0}\" of type \"{1}\"","RTE_Normal":"Normal","PopupExtender_NoParentElement":"Couldn\u0027t find parent element \"{0}\"","RTE_ViewValues":"View Values","RTE_Legend":"Legend","RTE_Labels":"Labels","RTE_CellSpacing":"Cell Spacing","PasswordStrength_RemainingNumbers":"{0} more numbers","RTE_Border":"Border","RTE_Create":"Create","RTE_Backgroun
2121dColor":"Background Color","RTE_Cancel":"Cancel","RTE_JustifyFull":"Justify Full","RTE_JustifyLeft":"Justify Left","RTE_Cut":"Cut","ResizableControlBehavior_CannotChangeProperty":"Changes to {0} not supported","RTE_ViewSource":"View Source","Common_InvalidPaddingUnit":"A unit type of \"{0}\" is invalid for parsePadding","RTE_Paste":"Paste","ExtenderBase_ControlNotRegisteredForCallbacks":"This Control has not been registered for callbacks","Calendar_Today":"Today: {0}","MultiHandleSlider_CssHeightWidthRequired":"You must specify a CSS width and height for all handle styles as well as the rail.","Common_DateTime_InvalidFormat":"Invalid format","ListSearch_DefaultPrompt":"Type to search","CollapsiblePanel_NoControlID":"Failed to find element \"{0}\"","RTE_ViewEditor":"View Editor","RTE_BarColor":"Bar Color","PasswordStrength_DefaultStrengthDescriptions":"NonExistent;Very Weak;Weak;Poor;Almost OK;Barely Acceptable;Average;Good;Strong;Excellent;Unbreakable!","RTE_Inserttexthere":"Insert text here","Animation_UknownAnimationName":"AjaxControlToolkit.Animation.createAnimation could not find an Animation corresponding to the name \"{0}\"","ExtenderBase_InvalidClientStateType":"saveClientState must return a value of type String","Rating_CallbackError":"An unhandled exception has occurred:\\r\\n{0}","Tabs_OwnerExpected":"owner must be set before initialize","DynamicPopulate_WebServiceTimeout":"Web service call timed out","PasswordStrength_RemainingLowerCase":"{0} more lower case characters","Animation_MissingAnimationName":"AjaxControlToolkit.Animation.createAnimation requires an object with an AnimationName property","RTE_JustifyRight":"Justify Right","Tabs_ActiveTabArgumentOutOfRange":"Argument is not a member of the tabs collection","RTE_CellPadding":"Cell Padding","RTE_ClearFormatting":"Clear Formatting","AlwaysVisible_ElementRequired":"AjaxControlToolkit.AlwaysVisibleControlBehavior must have an element","Slider_NoSizeProvided":"Please set valid values for the height and width attributes in the slider\u0027s CSS classes","DynamicPopulate_WebServiceError":"Web Service call failed: {0}","PasswordStrength_StrengthPrompt":"Strength: ","PasswordStrength_RemainingCharacters":"{0} more characters","PasswordStrength_Satisfied":"Nothing more required","RTE_Hyperlink":"Hyperlink","Animation_NoPropertyFound":"AjaxControlToolkit.Animation.createAnimation found no property corresponding to \"{0}\"","PasswordStrength_InvalidStrengthDescriptionStyles":"Text Strength description style classes must match the number of text descriptions.","PasswordStrength_GetHelpRequirements":"Get help on password requirements","PasswordStrength_InvalidStrengthDescriptions":"Invalid number of text strength descriptions specified","RTE_Underline":"Underline","Tabs_PropertySetAfterInitialization":"{0} cannot be changed after initialization","RTE_Rows":"Rows","RTE_Redo":"Redo","RTE_Size":"Size","RTE_Undo":"Undo","RTE_Bold":"Bold","RTE_Copy":"Copy","RTE_Font":"Font","CascadingDropDown_MethodError":"[Method error {0}]","RTE_BorderColor":"Border Color","RTE_Paragraph":"Paragraph","RTE_InsertHorizontalRule":"Insert Horizontal Rule","Common_UnitHasNoDigits":"No digits","RTE_Outdent":"Outdent","Common_DateTime_InvalidTimeSpan":"\"{0}\" is not a valid TimeSpan format","Animation_CannotNestSequence":"AjaxControlToolkit.Animation.SequenceAnimation cannot be nested inside AjaxControlToolkit.Animation.ParallelAnimation","Shared_BrowserSecurityPreventsPaste":"Your browser security settings don\u0027t permit the automatic execution of paste operations. Please use the keyboard shortcut Ctrl+V instead."}; 2122// (c) Copyright Microsoft Corporation. 2123// This source is subject to the Microsoft Permissive License. 2124// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 2125// All other rights reserved. 2126 2127 2128/// <reference name="MicrosoftAjax.debug.js" /> 2129/// <reference name="MicrosoftAjaxTimer.debug.js" /> 2130/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 2131/// <reference path="../ExtenderBase/BaseScripts.js" /> 2132/// <reference path="../Common/Common.js" /> 2133 2134 2135Type.registerNamespace('AjaxControlToolkit'); 2136 2137AjaxControlToolkit.DynamicPopulateBehavior = function(element) { 2138 /// <summary> 2139 /// The DynamicPopulateBehavior replaces the contents of an element with the result of a web service or page method call. The method call returns a string of HTML that is inserted as the children of the target element. 2140 /// </summary> 2141 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 2142 /// DOM Element the behavior is associated with 2143 /// </param> 2144 AjaxControlToolkit.DynamicPopulateBehavior.initializeBase(this, [element]);
2145 2146 this._servicePath = null; 2147 this._serviceMethod = null; 2148 this._contextKey = null; 2149 this._cacheDynamicResults = false; 2150 this._populateTriggerID = null; 2151 this._setUpdatingCssClass = null; 2152 this._clearDuringUpdate = true; 2153 this._customScript = null; 2154 2155 this._clickHandler = null; 2156 2157 this._callID = 0; 2158 this._currentCallID = -1; 2159 2160 // Whether or not we've already populated (used for cacheDynamicResults) 2161 this._populated = false; 2162} 2163AjaxControlToolkit.DynamicPopulateBehavior.prototype = { 2164 initialize : function() { 2165 /// <summary> 2166 /// Initialize the behavior 2167 /// </summary> 2168 AjaxControlToolkit.DynamicPopulateBehavior.callBaseMethod(this, 'initialize'); 2169 $common.prepareHiddenElementForATDeviceUpdate(); 2170 2171 // hook up the trigger if we have one. 2172 if (this._populateTriggerID) { 2173 var populateTrigger = $get(this._populateTriggerID); 2174 if (populateTrigger) { 2175 this._clickHandler = Function.createDelegate(this, this._onPopulateTriggerClick); 2176 $addHandler(populateTrigger, "click", this._clickHandler); 2177 } 2178 } 2179 }, 2180 2181 dispose : function() { 2182 /// <summary> 2183 /// Dispose the behavior 2184 /// </summary> 2185 2186 // clean up the trigger event. 2187 if (this._populateTriggerID && this._clickHandler) { 2188 var populateTrigger = $get(this._populateTriggerID); 2189 if (populateTrigger) { 2190 $removeHandler(populateTrigger, "click", this._clickHandler); 2191 } 2192 this._populateTriggerID = null; 2193 this._clickHandler = null; 2194 } 2195 2196 AjaxControlToolkit.DynamicPopulateBehavior.callBaseMethod(this, 'dispose'); 2197 }, 2198 2199 populate : function(contextKey) { 2200 /// <summary> 2201 /// Get the dymanic content and use it to populate the target element 2202 /// </summary> 2203 /// <param name="contextKey" type="String" mayBeNull="true" optional="true"> 2204 /// An arbitrary string value to be passed to the web method. For example, if the element to be 2205 /// populated is within a data-bound repeater, this could be the ID of the current row. 2206 /// </param> 2207 2208 // Don't populate if we already cached the results 2209 if (this._populated && this._cacheDynamicResults) { 2210 return; 2211 } 2212 2213 // Initialize the population if this is the very first call 2214 if (this._currentCallID == -1) { 2215 var eventArgs = new Sys.CancelEventArgs(); 2216 this.raisePopulating(eventArgs); 2217 if (eventArgs.get_cancel()) { 2218 return; 2219 } 2220 this._setUpdating(true); 2221 } 2222 2223 // Either run the custom population script or invoke the web service 2224 if (this._customScript) { 2225 // Call custom javascript call to populate control 2226 var scriptResult = eval(this._customScript); 2227 this._setTargetHtml(scriptResult); 2228 this._setUpdating(false); 2229 } else { 2230 this._currentCallID = ++this._callID; 2231 if (this._servicePath && this._serviceMethod) { 2232 Sys.Net.WebServiceProxy.invoke(this._servicePath, this._serviceMethod, false, 2233 { contextKey:(contextKey ? contextKey : this._contextKey) }, 2234 Function.createDelegate(this, this._onMethodComplete), Function.createDelegate(this, this._onMethodError), 2235 this._currentCallID); 2236 $common.updateFormToRefreshATDeviceBuffer(); 2237 } 2238 } 2239 }, 2240 2241 _onMethodComplete : function (result, userContext, methodName) { 2242 /// <summary> 2243 /// Callback used when the populating service returns successfully 2244 /// </summary> 2245 /// <param name="result" type="Object" mayBeNull=""> 2246 /// The data returned from the Web service method call 2247 /// </param> 2248 /// <param name="userContext" type="Object"> 2249 /// The context information that was passed when the Web service method was invoked 2250 /// </param> 2251 /// <param name="methodName" type="String"> 2252 /// The Web service method that was invoked 2253 /// </param> 2254 2255 // ignore if it's not the current call. 2256 if (userContext != this._currentCallID) return; 2257 2258 this._setTargetHtml(result); 2259 2260 this._setUpdating(false); 2261 }, 2262 2263 _onMethodError : function(webServiceError, userContext, methodName) { 2264 /// <summary> 2265 /// Callback used when the populating service fails 2266 /// </summary> 2267 /// <param name="webServiceError" type="Sys.Net.WebServiceError"> 2268 /// Web service error 2269 /// </param> 2270 /// <param name="userContext" type="Object"> 2271 /// The context information that was passed when the Web service method was invoked 2272 /// </param> 2273 /// <param name="methodName" type="String"> 2274 /// The Web service method that was invoked 2275 /// </param> 2276 2277 // ignore if it's not the current call. 2278 if (userContext != this._currentCallID) return; 2279 2280 if (webServiceError.get_timedOut()) { 2281 this._setTargetHtml(AjaxControlToolkit.Resources.DynamicPopulate_WebServiceTimeout); 2282 } else { 2283 this._setTargetHtml(String.format(AjaxControlToolkit.Resources.DynamicPopulate_WebServiceError, webServiceError.get_statusCode())); 2284 } 2285 2286 this._setUpdating(false); 2287 }, 2288 2289 _onPopulateTriggerClick : function() { 2290 /// <summary> 2291 /// Handler for the element described by PopulateTriggerID's click event 2292 /// </summary> 2293 2294 // just call through to the trigger. 2295 this.populate(this._contextKey); 2296 }, 2297 2298 _setUpdating : function(updating) { 2299 /// <summary> 2300 /// Toggle the display elements to indicate if they are being updated or not 2301 /// </summary> 2302 /// <param name="updating" type="Boolean"> 2303 /// Whether or not the display should indicated it is being updated 2304 /// </param> 2305 2306 this.setStyle(updating); 2307 2308 if (!updating) { 2309 this._currentCallID = -1; 2310 this._populated = true;
2311 this.raisePopulated(this, Sys.EventArgs.Empty); 2312 } 2313 }, 2314 2315 _setTargetHtml : function(value) { 2316 /// <summary> 2317 /// Populate the target element with the given value 2318 /// </summary> 2319 /// <param name="value" type="String"> 2320 /// The data to populate the target element. 2321 /// </param> 2322 2323 // Make sure the element is still accessible 2324 var e = this.get_element() 2325 if (e) { 2326 // Use value for input elements; otherwise innerHTML 2327 if (e.tagName == "INPUT") { 2328 e.value = value; 2329 } else { 2330 e.innerHTML = value; 2331 } 2332 } 2333 }, 2334 2335 setStyle : function(updating) { 2336 /// <summary> 2337 /// Set the style of the display 2338 /// </summary> 2339 /// <param name="updating" type="Boolean"> 2340 /// Whether or not the display is being updated 2341 /// </param> 2342 2343 var e = this.get_element(); 2344 if (this._setUpdatingCssClass) { 2345 if (!updating) { 2346 e.className = this._oldCss; 2347 this._oldCss = null; 2348 } else { 2349 this._oldCss = e.className; 2350 e.className = this._setUpdatingCssClass; 2351 } 2352 } 2353 2354 if (updating && this._clearDuringUpdate) { 2355 this._setTargetHtml(""); 2356 } 2357 }, 2358 2359 get_ClearContentsDuringUpdate : function() { 2360 /// <value type="Boolean"> 2361 /// Whether the contents of the target should be cleared when an update begins 2362 /// </value> 2363 return this._clearDuringUpdate; 2364 }, 2365 set_ClearContentsDuringUpdate : function(value) { 2366 if (this._clearDuringUpdate != value) { 2367 this._clearDuringUpdate = value; 2368 this.raisePropertyChanged('ClearContentsDuringUpdate'); 2369 } 2370 }, 2371 2372 get_ContextKey : function() { 2373 /// <value type="String"> 2374 /// An arbitrary string value to be passed to the web method. 2375 /// For example, if the element to be populated is within a 2376 /// data-bound repeater, this could be the ID of the current row. 2377 /// </value> 2378 return this._contextKey; 2379 }, 2380 set_ContextKey : function(value) { 2381 if (this._contextKey != value) { 2382 this._contextKey = value; 2383 this.raisePropertyChanged('ContextKey'); 2384 } 2385 }, 2386 2387 get_PopulateTriggerID : function() { 2388 /// <value type="String" mayBeNull="true" optional="true"> 2389 /// Name of an element that triggers the population of the target when clicked 2390 /// </value> 2391 return this._populateTriggerID; 2392 }, 2393 set_PopulateTriggerID : function(value) { 2394 if (this._populateTriggerID != value) { 2395 this._populateTriggerID = value; 2396 this.raisePropertyChanged('PopulateTriggerID'); 2397 } 2398 }, 2399 2400 get_ServicePath : function() { 2401 /// <value type="String" mayBeNull="true" optional="true"> 2402 /// The URL of the web service to call. If the ServicePath is not defined, then we will invoke a PageMethod instead of a web service. 2403 /// </value> 2404 return this._servicePath; 2405 }, 2406 set_ServicePath : function(value) { 2407 if (this._servicePath != value) { 2408 this._servicePath = value; 2409 this.raisePropertyChanged('ServicePath'); 2410 } 2411 }, 2412 2413 get_ServiceMethod : function() { 2414 /// <value type="String"> 2415 /// The name of the method to call on the page or web service 2416 /// </value> 2417 /// <remarks> 2418 /// The signature of the method must exactly match the following: 2419 /// [WebMethod] 2420 /// string DynamicPopulateMethod(string contextKey) 2421 /// { 2422 /// ... 2423 /// } 2424 /// </remarks> 2425 return this._serviceMethod; 2426 }, 2427 set_ServiceMethod : function(value) { 2428 if (this._serviceMethod != value) { 2429 this._serviceMethod = value; 2430 this.raisePropertyChanged('ServiceMethod'); 2431 } 2432 }, 2433 2434 get_cacheDynamicResults : function() { 2435 /// <value type="Boolean" mayBeNull="false"> 2436 /// Whether the results of the dynamic population should be cached and 2437 /// not fetched again after the first load 2438 /// </value> 2439 return this._cacheDynamicResults; 2440 }, 2441 set_cacheDynamicResults : function(value) { 2442 if (this._cacheDynamicResults != value) { 2443 this._cacheDynamicResults = value; 2444 this.raisePropertyChanged('cacheDynamicResults'); 2445 } 2446 }, 2447 2448 get_UpdatingCssClass : function() { 2449 /// <value type="String"> 2450 /// The CSS class to apply to the target during asynchronous calls 2451 /// </value> 2452 return this._setUpdatingCssClass; 2453 }, 2454 set_UpdatingCssClass : function(value) { 2455 if (this._setUpdatingCssClass != value) { 2456 this._setUpdatingCssClass = value; 2457 this.raisePropertyChanged('UpdatingCssClass'); 2458 } 2459 }, 2460 2461 get_CustomScript : function() { 2462 /// <value type="String"> 2463 /// The script to invoke instead of calling a Web or Page method. This script must evaluate to a string value. 2464 /// </value> 2465 return this._customScript; 2466 }, 2467 set_CustomScript : function(value) { 2468 if (this._customScript != value) { 2469 this._customScript = value; 2470 this.raisePropertyChanged('CustomScript'); 2471 } 2472 }, 2473 2474 add_populating : function(handler) { 2475 /// <summary> 2476 /// Add an event handler for the populating event 2477 /// </summary> 2478 /// <param name="handler" type="Function" mayBeNull="false"> 2479 /// Event handler 2480 /// </param> 2481 /// <returns /> 2482 this.get_events().addHandler('populating', handler); 2483 }, 2484 remove_populating : function(handler) { 2485 /// <summary> 2486 /// Remove an event handler from the populating event 2487 /// </summary> 2488 /// <param name="handler" type="Function" mayBeNull="false"> 2489 /// Event handler 2490 /// </param> 2491 /// <returns /> 2492 this.get_events().removeHandler('populating', handler); 2493 },
2494 raisePopulating : function(eventArgs) { 2495 /// <summary> 2496 /// Raise the populating event 2497 /// </summary> 2498 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 2499 /// Event arguments for the populating event 2500 /// </param> 2501 /// <returns /> 2502 2503 var handler = this.get_events().getHandler('populating'); 2504 if (handler) { 2505 handler(this, eventArgs); 2506 } 2507 }, 2508 2509 add_populated : function(handler) { 2510 /// <summary> 2511 /// Add an event handler for the populated event 2512 /// </summary> 2513 /// <param name="handler" type="Function" mayBeNull="false"> 2514 /// Event handler 2515 /// </param> 2516 /// <returns /> 2517 this.get_events().addHandler('populated', handler); 2518 }, 2519 remove_populated : function(handler) { 2520 /// <summary> 2521 /// Remove an event handler from the populated event 2522 /// </summary> 2523 /// <param name="handler" type="Function" mayBeNull="false"> 2524 /// Event handler 2525 /// </param> 2526 /// <returns /> 2527 this.get_events().removeHandler('populated', handler); 2528 }, 2529 raisePopulated : function(eventArgs) { 2530 /// <summary> 2531 /// Raise the populated event 2532 /// </summary> 2533 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false"> 2534 /// Event arguments for the populated event 2535 /// </param> 2536 /// <returns /> 2537 2538 var handler = this.get_events().getHandler('populated'); 2539 if (handler) { 2540 handler(this, eventArgs); 2541 } 2542 } 2543} 2544AjaxControlToolkit.DynamicPopulateBehavior.registerClass('AjaxControlToolkit.DynamicPopulateBehavior', AjaxControlToolkit.BehaviorBase); 2545 2546// (c) Copyright Microsoft Corporation. 2547// This source is subject to the Microsoft Permissive License. 2548// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 2549// All other rights reserved. 2550 2551 2552/// <reference name="MicrosoftAjax.debug.js" /> 2553/// <reference name="MicrosoftAjaxTimer.debug.js" /> 2554/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 2555 2556 2557/////////////////////////////////////////////////////////////////////////////// 2558// Sys.Timer 2559 2560Sys.Timer = function() { 2561 Sys.Timer.initializeBase(this); 2562 2563 this._interval = 1000; 2564 this._enabled = false; 2565 this._timer = null; 2566} 2567 2568Sys.Timer.prototype = { 2569 get_interval: function() { 2570 2571 return this._interval; 2572 }, 2573 set_interval: function(value) { 2574 2575 if (this._interval !== value) { 2576 this._interval = value; 2577 this.raisePropertyChanged('interval'); 2578 2579 if (!this.get_isUpdating() && (this._timer !== null)) { 2580 this._stopTimer(); 2581 this._startTimer(); 2582 } 2583 } 2584 }, 2585 2586 get_enabled: function() { 2587 2588 return this._enabled; 2589 }, 2590 set_enabled: function(value) { 2591 2592 if (value !== this.get_enabled()) { 2593 this._enabled = value; 2594 this.raisePropertyChanged('enabled'); 2595 if (!this.get_isUpdating()) { 2596 if (value) { 2597 this._startTimer(); 2598 } 2599 else { 2600 this._stopTimer(); 2601 } 2602 } 2603 } 2604 }, 2605 2606 2607 add_tick: function(handler) { 2608 2609 2610 this.get_events().addHandler("tick", handler); 2611 }, 2612 2613 remove_tick: function(handler) { 2614 2615 2616 this.get_events().removeHandler("tick", handler); 2617 }, 2618 2619 dispose: function() { 2620 this.set_enabled(false); 2621 this._stopTimer(); 2622 2623 Sys.Timer.callBaseMethod(this, 'dispose'); 2624 }, 2625 2626 updated: function() { 2627 Sys.Timer.callBaseMethod(this, 'updated'); 2628 2629 if (this._enabled) { 2630 this._stopTimer(); 2631 this._startTimer(); 2632 } 2633 }, 2634 2635 _timerCallback: function() { 2636 var handler = this.get_events().getHandler("tick"); 2637 if (handler) { 2638 handler(this, Sys.EventArgs.Empty); 2639 } 2640 }, 2641 2642 _startTimer: function() { 2643 this._timer = window.setInterval(Function.createDelegate(this, this._timerCallback), this._interval); 2644 }, 2645 2646 _stopTimer: function() { 2647 window.clearInterval(this._timer); 2648 this._timer = null; 2649 } 2650} 2651 2652Sys.Timer.descriptor = { 2653 properties: [ {name: 'interval', type: Number}, 2654 {name: 'enabled', type: Boolean} ], 2655 events: [ {name: 'tick'} ] 2656} 2657 2658Sys.Timer.registerClass('Sys.Timer', Sys.Component); 2659 2660// (c) Copyright Microsoft Corporation. 2661// This source is subject to the Microsoft Permissive License. 2662// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 2663// All other rights reserved. 2664 2665 2666/// <reference name="MicrosoftAjax.debug.js" /> 2667/// <reference name="MicrosoftAjaxTimer.debug.js" /> 2668/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 2669/// <reference path="../../Common/Common.js" /> 2670/// <reference path="../Timer/Timer.js" /> 2671 2672 2673/////////////////////////////////////////////////////////////////////////////// 2674// IDropSource 2675 2676Type.registerNamespace('AjaxControlToolkit'); 2677 2678AjaxControlToolkit.IDragSource = function() { 2679} 2680AjaxControlToolkit.IDragSource.prototype = { 2681 // Type get_dragDataType() 2682 get_dragDataType: function() { throw Error.notImplemented(); }, 2683 // Object getDragData(Context) 2684 getDragData: function() { throw Error.notImplemented(); }, 2685 // DragMode get_dragMode() 2686 get_dragMode: function() { throw Error.notImplemented(); }, 2687 // void onDragStart() 2688 onDragStart: function() { throw Error.notImplemented(); }, 2689 // void onDrag() 2690 onDrag: function() { throw Error.notImplemented(); }, 2691 // void onDragEnd(Cancelled) 2692 onDragEnd: function() { throw Error.notImplemented(); } 2693} 2694AjaxControlToolkit.IDragSource.registerInterface('AjaxControlToolkit.IDragSource'); 2695
2696/////////////////////////////////////////////////////////////////////////////// 2697// IDropTarget 2698AjaxControlToolkit.IDropTarget = function() { 2699} 2700AjaxControlToolkit.IDropTarget.prototype = { 2701 get_dropTargetElement: function() { throw Error.notImplemented(); }, 2702 // bool canDrop(DragMode, DataType, Data) 2703 canDrop: function() { throw Error.notImplemented(); }, 2704 // void drop(DragMode, DataType, Data) 2705 drop: function() { throw Error.notImplemented(); }, 2706 // void onDragEnterTarget(DragMode, DataType, Data) 2707 onDragEnterTarget: function() { throw Error.notImplemented(); }, 2708 // void onDragLeaveTarget(DragMode, DataType, Data) 2709 onDragLeaveTarget: function() { throw Error.notImplemented(); }, 2710 // void onDragInTarget(DragMode, DataType, Data) 2711 onDragInTarget: function() { throw Error.notImplemented(); } 2712} 2713AjaxControlToolkit.IDropTarget.registerInterface('AjaxControlToolkit.IDropTarget'); 2714 2715/////////////////////////////////////////////// 2716// DragMode 2717// 2718 2719AjaxControlToolkit.DragMode = function() { 2720 throw Error.invalidOperation(); 2721} 2722AjaxControlToolkit.DragMode.prototype = { 2723 Copy: 0, 2724 Move: 1 2725} 2726AjaxControlToolkit.DragMode.registerEnum('AjaxControlToolkit.DragMode'); 2727 2728//////////////////////////////////////////////////////////////////// 2729// DragDropEventArgs 2730// 2731 2732AjaxControlToolkit.DragDropEventArgs = function(dragMode, dragDataType, dragData) { 2733 this._dragMode = dragMode; 2734 this._dataType = dragDataType; 2735 this._data = dragData; 2736} 2737AjaxControlToolkit.DragDropEventArgs.prototype = { 2738 get_dragMode: function() { 2739 return this._dragMode || null; 2740 }, 2741 get_dragDataType: function() { 2742 return this._dataType || null; 2743 }, 2744 get_dragData: function() { 2745 return this._data || null; 2746 } 2747} 2748AjaxControlToolkit.DragDropEventArgs.registerClass('AjaxControlToolkit.DragDropEventArgs'); 2749 2750 2751AjaxControlToolkit._DragDropManager = function() { 2752 this._instance = null; 2753 this._events = null; 2754} 2755AjaxControlToolkit._DragDropManager.prototype = { 2756 2757 add_dragStart: function(handler) { 2758 this.get_events().addHandler('dragStart', handler); 2759 }, 2760 remove_dragStart: function(handler) { 2761 this.get_events().removeHandler('dragStart', handler); 2762 }, 2763 2764 get_events: function() { 2765 // todo: doc comments. this one is commented out (two //) due to a bug with the preprocessor. 2766 // <value type="Sys.EventHandlerList"> 2767 // </value> 2768 if (!this._events) { 2769 this._events = new Sys.EventHandlerList(); 2770 } 2771 return this._events; 2772 }, 2773 2774 add_dragStop: function(handler) { 2775 this.get_events().addHandler('dragStop', handler); 2776 }, 2777 remove_dragStop: function(handler) { 2778 this.get_events().removeHandler('dragStop', handler); 2779 }, 2780 2781 _getInstance: function() { 2782 if (!this._instance) { 2783 if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { 2784 this._instance = new AjaxControlToolkit.IEDragDropManager(); 2785 } 2786 else { 2787 this._instance = new AjaxControlToolkit.GenericDragDropManager(); 2788 } 2789 this._instance.initialize(); 2790 this._instance.add_dragStart(Function.createDelegate(this, this._raiseDragStart)); 2791 this._instance.add_dragStop(Function.createDelegate(this, this._raiseDragStop)); 2792 } 2793 return this._instance; 2794 }, 2795 2796 startDragDrop: function(dragSource, dragVisual, context) { 2797 this._getInstance().startDragDrop(dragSource, dragVisual, context); 2798 }, 2799 2800 registerDropTarget: function(target) { 2801 this._getInstance().registerDropTarget(target); 2802 }, 2803 2804 unregisterDropTarget: function(target) { 2805 this._getInstance().unregisterDropTarget(target); 2806 }, 2807 2808 dispose: function() { 2809 delete this._events; 2810 Sys.Application.unregisterDisposableObject(this); 2811 Sys.Application.removeComponent(this); 2812 }, 2813 2814 _raiseDragStart: function(sender, eventArgs) { 2815 var handler = this.get_events().getHandler('dragStart'); 2816 if(handler) { 2817 handler(this, eventArgs); 2818 } 2819 }, 2820 2821 _raiseDragStop: function(sender, eventArgs) { 2822 var handler = this.get_events().getHandler('dragStop'); 2823 if(handler) { 2824 handler(this, eventArgs); 2825 } 2826 } 2827} 2828AjaxControlToolkit._DragDropManager.registerClass('AjaxControlToolkit._DragDropManager'); 2829AjaxControlToolkit.DragDropManager = new AjaxControlToolkit._DragDropManager(); 2830 2831 2832AjaxControlToolkit.IEDragDropManager = function() { 2833 AjaxControlToolkit.IEDragDropManager.initializeBase(this); 2834 2835 this._dropTargets = null; 2836 // Radius of the cursor used to determine what drop target we 2837 // are hovering. Anything below the cursor's zone may be a 2838 // potential drop target. 2839 this._radius = 10; 2840 this._activeDragVisual = null; 2841 this._activeContext = null; 2842 this._activeDragSource = null; 2843 this._underlyingTarget = null; 2844 this._oldOffset = null; 2845 this._potentialTarget = null; 2846 this._isDragging = false; 2847 this._mouseUpHandler = null; 2848 this._documentMouseMoveHandler = null; 2849 this._documentDragOverHandler = null; 2850 this._dragStartHandler = null; 2851 this._mouseMoveHandler = null; 2852 this._dragEnterHandler = null; 2853 this._dragLeaveHandler = null; 2854 this._dragOverHandler = null; 2855 this._dropHandler = null; 2856} 2857AjaxControlToolkit.IEDragDropManager.prototype = { 2858 2859 add_dragStart : function(handler) { 2860 this.get_events().addHandler("dragStart", handler); 2861 }, 2862 2863 remove_dragStart : function(handler) { 2864 this.get_events().removeHandler("dragStart", handler); 2865 }, 2866 2867 add_dragStop : function(handler) { 2868 this.get_events().addHandler("dragStop", handler); 2869 }, 2870 2871 remove_dragStop : function(handler) { 2872 this.get_events().removeHandler("dragStop", handler); 2873 }, 2874 2875 initialize : function() { 2876 AjaxControlToolkit.IEDragDropManager.callBaseMethod(this, 'initialize'); 2877 this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp); 2878 this._documentMouseMoveHandler = Function.createDelegate(this, this._onDocumentMouseMove); 2879 this._documentDragOverHandler = Function.createDelegate(this, this._onDocumentDragOver); 2880 this._dragStartHandler = Function.createDelegate(this, this._onDragStart); 2881 this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove); 2882 this._dragEnterHandler = Function.createDelegate(this, this._onDragEnter); 2883 this._dragLeaveHandler = Function.createDelegate(this, this._onDragLeave); 2884 this._dragOverHandler = Function.createDelegate(this, this._onDragOver); 2885 this._dropHandler = Function.createDelegate(this, this._onDrop); 2886 }, 2887 2888 2889 dispose : function() { 2890 if(this._dropTargets) { 2891 for (var i = 0; i < this._dropTargets; i++) { 2892 this.unregisterDropTarget(this._dropTargets[i]); 2893 } 2894 this._dropTargets = null; 2895 } 2896 2897 AjaxControlToolkit.IEDragDropManager.callBaseMethod(this, 'dispose'); 2898 }, 2899 2900 2901 startDragDrop : function(dragSource, dragVisual, context) { 2902 var ev = window._event; 2903 2904 // Don't allow drag and drop if there is another active drag operation going on. 2905 if (this._isDragging) { 2906 return; 2907 } 2908 2909 this._underlyingTarget = null; 2910 this._activeDragSource = dragSource; 2911 this._activeDragVisual = dragVisual; 2912 this._activeContext = context; 2913 2914 var mousePosition = { x: ev.clientX, y: ev.clientY }; 2915 2916 // By default we use absolute positioning, unless a different type 2917 // of positioning is set explicitly. 2918 dragVisual.originalPosition = dragVisual.style.position; 2919 dragVisual.style.position = "absolute"; 2920 2921 document._lastPosition = mousePosition; 2922 dragVisual.startingPoint = mousePosition;
2923 var scrollOffset = this.getScrollOffset(dragVisual, /* recursive */ true); 2924 2925 dragVisual.startingPoint = this.addPoints(dragVisual.startingPoint, scrollOffset); 2926 2927 if (dragVisual.style.position == "absolute") { 2928 dragVisual.startingPoint = this.subtractPoints(dragVisual.startingPoint, $common.getLocation(dragVisual)); 2929 } 2930 else { 2931 var left = parseInt(dragVisual.style.left); 2932 var top = parseInt(dragVisual.style.top); 2933 if (isNaN(left)) left = "0"; 2934 if (isNaN(top)) top = "0"; 2935 2936 dragVisual.startingPoint = this.subtractPoints(dragVisual.startingPoint, { x: left, y: top }); 2937 } 2938 2939 // Monitor DOM changes. 2940 this._prepareForDomChanges(); 2941 dragSource.onDragStart(); 2942 var eventArgs = new AjaxControlToolkit.DragDropEventArgs( 2943 dragSource.get_dragMode(), 2944 dragSource.get_dragDataType(), 2945 dragSource.getDragData(context)); 2946 var handler = this.get_events().getHandler('dragStart'); 2947 if(handler) handler(this,eventArgs); 2948 this._recoverFromDomChanges(); 2949 2950 this._wireEvents(); 2951 2952 this._drag(/* isInitialDrag */ true); 2953 }, 2954 2955 2956 _stopDragDrop : function(cancelled) { 2957 var ev = window._event; 2958 if (this._activeDragSource != null) { 2959 this._unwireEvents(); 2960 2961 if (!cancelled) { 2962 // The drag operation is cancelled if there 2963 // is no drop target. 2964 cancelled = (this._underlyingTarget == null); 2965 } 2966 2967 if (!cancelled && this._underlyingTarget != null) { 2968 this._underlyingTarget.drop(this._activeDragSource.get_dragMode(), this._activeDragSource.get_dragDataType(), 2969 this._activeDragSource.getDragData(this._activeContext)); 2970 } 2971 2972 this._activeDragSource.onDragEnd(cancelled); 2973 var handler = this.get_events().getHandler('dragStop'); 2974 if(handler) handler(this,Sys.EventArgs.Empty); 2975 2976 this._activeDragVisual.style.position = this._activeDragVisual.originalPosition; 2977 2978 this._activeDragSource = null; 2979 this._activeContext = null; 2980 this._activeDragVisual = null; 2981 this._isDragging = false; 2982 this._potentialTarget = null; 2983 ev.preventDefault(); 2984 } 2985 }, 2986 2987 _drag : function(isInitialDrag) { 2988 var ev = window._event; 2989 var mousePosition = { x: ev.clientX, y: ev.clientY }; 2990 2991 // NOTE: We store the event object to be able to determine the current 2992 // mouse position in Mozilla in other event handlers such as keydown. 2993 document._lastPosition = mousePosition; 2994 2995 var scrollOffset = this.getScrollOffset(this._activeDragVisual, /* recursive */ true); 2996 var position = this.addPoints(this.subtractPoints(mousePosition, this._activeDragVisual.startingPoint), scrollOffset); 2997 2998 // Check if the visual moved at all. 2999 if (!isInitialDrag && parseInt(this._activeDragVisual.style.left) == position.x && parseInt(this._activeDragVisual.style.top) == position.y) { 3000 return; 3001 } 3002 3003 $common.setLocation(this._activeDragVisual, position); 3004 3005 // Monitor DOM changes. 3006 this._prepareForDomChanges(); 3007 this._activeDragSource.onDrag(); 3008 this._recoverFromDomChanges(); 3009 3010 // Find a potential target. 3011 this._potentialTarget = this._findPotentialTarget(this._activeDragSource, this._activeDragVisual); 3012 3013 var movedToOtherTarget = (this._potentialTarget != this._underlyingTarget || this._potentialTarget == null); 3014 // Check if we are leaving an underlying target. 3015 if (movedToOtherTarget && this._underlyingTarget != null) { 3016 this._leaveTarget(this._activeDragSource, this._underlyingTarget); 3017 } 3018 3019 if (this._potentialTarget != null) { 3020 // Check if we are entering a new target. 3021 if (movedToOtherTarget) { 3022 this._underlyingTarget = this._potentialTarget; 3023 3024 // Enter the new target. 3025 this._enterTarget(this._activeDragSource, this._underlyingTarget); 3026 } 3027 else { 3028 this._moveInTarget(this._activeDragSource, this._underlyingTarget); 3029 } 3030 } 3031 else { 3032 this._underlyingTarget = null; 3033 } 3034 }, 3035 3036 3037 _wireEvents : function() { 3038 $addHandler(document, "mouseup", this._mouseUpHandler); 3039 $addHandler(document, "mousemove", this._documentMouseMoveHandler); 3040 $addHandler(document.body, "dragover", this._documentDragOverHandler); 3041 3042 $addHandler(this._activeDragVisual, "dragstart", this._dragStartHandler); 3043 $addHandler(this._activeDragVisual, "dragend", this._mouseUpHandler); 3044 $addHandler(this._activeDragVisual, "drag", this._mouseMoveHandler); 3045 }, 3046 3047 3048 _unwireEvents : function() { 3049 $removeHandler(this._activeDragVisual, "drag", this._mouseMoveHandler); 3050 $removeHandler(this._activeDragVisual, "dragend", this._mouseUpHandler); 3051 $removeHandler(this._activeDragVisual, "dragstart", this._dragStartHandler); 3052 3053 $removeHandler(document.body, "dragover", this._documentDragOverHandler); 3054 $removeHandler(document, "mousemove", this._documentMouseMoveHandler); 3055 $removeHandler(document, "mouseup", this._mouseUpHandler); 3056 }, 3057 3058 3059 registerDropTarget : function(dropTarget) { 3060 if (this._dropTargets == null) { 3061 this._dropTargets = []; 3062 } 3063 Array.add(this._dropTargets, dropTarget); 3064 3065 this._wireDropTargetEvents(dropTarget); 3066 }, 3067 3068 3069 unregisterDropTarget : function(dropTarget) { 3070 this._unwireDropTargetEvents(dropTarget); 3071 if (this._dropTargets) { 3072 Array.remove(this._dropTargets, dropTarget); 3073 } 3074 }, 3075 3076 3077 _wireDropTargetEvents : function(dropTarget) { 3078 var associatedElement = dropTarget.get_dropTargetElement(); 3079 associatedElement._dropTarget = dropTarget; 3080 $addHandler(associatedElement, "dragenter", this._dragEnterHandler); 3081 $addHandler(associatedElement, "dragleave", this._dragLeaveHandler); 3082 $addHandler(associatedElement, "dragover", this._dragOverHandler); 3083 $addHandler(associatedElement, "drop", this._dropHandler); 3084 }, 3085 3086 3087 _unwireDropTargetEvents : function(dropTarget) { 3088 var associatedElement = dropTarget.get_dropTargetElement(); 3089 // make sure that the handlers are not removed twice 3090 if(associatedElement._dropTarget) 3091 { 3092 associatedElement._dropTarget = null; 3093 $removeHandler(associatedElement, "dragenter", this._dragEnterHandler); 3094 $removeHandler(associatedElement, "dragleave", this._dragLeaveHandler); 3095 $removeHandler(associatedElement, "dragover", this._dragOverHandler); 3096 $removeHandler(associatedElement, "drop", this._dropHandler); 3097 } 3098 }, 3099 3100 3101 _onDragStart : function(ev) { 3102 window._event = ev; 3103 document.selection.empty(); 3104 3105 var dt = ev.dataTransfer; 3106 if(!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer; 3107 3108 var dataType = this._activeDragSource.get_dragDataType().toLowerCase(); 3109 var data = this._activeDragSource.getDragData(this._activeContext); 3110 3111 if (data) { 3112 // TODO: How do we want to deal with 'non-compatible types'? 3113 if (dataType != "text" && dataType != "url") { 3114 dataType = "text"; 3115 3116 if (data.innerHTML != null) { 3117 data = data.innerHTML; 3118 } 3119 } 3120 3121 dt.effectAllowed = "move"; 3122 dt.setData(dataType, data.toString()); 3123 } 3124 }, 3125 3126 _onMouseUp : function(ev) { 3127 window._event = ev; 3128 this._stopDragDrop(false); 3129 }, 3130 3131 _onDocumentMouseMove : function(ev) { 3132 window._event = ev; 3133 this._dragDrop(); 3134 }, 3135 3136 _onDocumentDragOver : function(ev) { 3137 window._event = ev; 3138 if(this._potentialTarget) ev.preventDefault(); 3139 //ev.returnValue = (_potentialTarget == null); 3140 }, 3141 3142 _onMouseMove : function(ev) { 3143 window._event = ev; 3144 this._drag(); 3145 }, 3146 3147 _onDragEnter : function(ev) { 3148 window._event = ev; 3149 if (this._isDragging) { 3150 ev.preventDefault(); 3151 //ev.returnValue = false; 3152 } 3153 else { 3154 // An external object is dragged to the drop target. 3155 var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target)); 3156 for (var i = 0; i < dataObjects.length; i++) { 3157 this._dropTarget.onDragEnterTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value); 3158 } 3159 } 3160 }, 3161 3162 _onDragLeave : function(ev) { 3163 window._event = ev; 3164 if (this._isDragging) { 3165 ev.preventDefault(); 3166 //ev.returnValue = false; 3167 } 3168 else { 3169 // An external object is dragged to the drop target. 3170 var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target)); 3171 for (var i = 0; i < dataObjects.length; i++) { 3172 this._dropTarget.onDragLeaveTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value); 3173 } 3174 } 3175 }, 3176 3177 _onDragOver : function(ev) { 3178 window._event = ev; 3179 if (this._isDragging) { 3180 ev.preventDefault(); 3181 //ev.returnValue = false; 3182 } 3183 else { 3184 // An external object is dragged over the drop target. 3185 var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target)); 3186 for (var i = 0; i < dataObjects.length; i++) { 3187 this._dropTarget.onDragInTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value); 3188 } 3189 } 3190 }, 3191 3192 _onDrop : function(ev) { 3193 window._event = ev; 3194 if (!this._isDragging) { 3195 // An external object is dropped on the drop target. 3196 var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target)); 3197 for (var i = 0; i < dataObjects.length; i++) { 3198 this._dropTarget.drop(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value); 3199 } 3200 } 3201 ev.preventDefault(); 3202 //ev.returnValue = false; 3203 }, 3204 3205 _getDropTarget : function(element) { 3206 while (element) { 3207 if (element._dropTarget != null) { 3208 return element._dropTarget; 3209 } 3210 element = element.parentNode; 3211 } 3212 return null; 3213 }, 3214 3215 _dragDrop : function() { 3216 if (this._isDragging) { 3217 return; 3218 } 3219 3220 this._isDragging = true; 3221 this._activeDragVisual.dragDrop(); 3222 document.selection.empty(); 3223 }, 3224 3225 _moveInTarget : function(dragSource, dropTarget) { 3226 // Monitor DOM changes. 3227 this._prepareForDomChanges(); 3228 dropTarget.onDragInTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext)); 3229 this._recoverFromDomChanges(); 3230 }, 3231 3232 _enterTarget : function(dragSource, dropTarget) { 3233 // Monitor DOM changes. 3234 this._prepareForDomChanges(); 3235 dropTarget.onDragEnterTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext)); 3236 this._recoverFromDomChanges(); 3237 }, 3238 3239 _leaveTarget : function(dragSource, dropTarget) { 3240 // Monitor DOM changes. 3241 this._prepareForDomChanges(); 3242 dropTarget.onDragLeaveTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext)); 3243 this._recoverFromDomChanges(); 3244 }, 3245 3246 _findPotentialTarget : function(dragSource, dragVisual) { 3247 var ev = window._event; 3248 3249 if (this._dropTargets == null) { 3250 return null; 3251 } 3252 3253 var type = dragSource.get_dragDataType(); 3254 var mode = dragSource.get_dragMode(); 3255 var data = dragSource.getDragData(this._activeContext); 3256 3257 // Get the current cursor location.
3258 var scrollOffset = this.getScrollOffset(document.body, /* recursive */ true); 3259 var x = ev.clientX + scrollOffset.x; 3260 var y = ev.clientY + scrollOffset.y; 3261 var cursorRect = { x: x - this._radius, y: y - this._radius, width: this._radius * 2, height: this._radius * 2 }; 3262 3263 // Find any targets near the current cursor location. 3264 var targetRect; 3265 for (var i = 0; i < this._dropTargets.length; i++) { 3266 targetRect = $common.getBounds(this._dropTargets[i].get_dropTargetElement()); 3267 if ($common.overlaps(cursorRect, targetRect) && this._dropTargets[i].canDrop(mode, type, data)) { 3268 return this._dropTargets[i]; 3269 } 3270 } 3271 3272 return null; 3273 }, 3274 3275 _prepareForDomChanges : function() { 3276 this._oldOffset = $common.getLocation(this._activeDragVisual); 3277 }, 3278 3279 _recoverFromDomChanges : function() { 3280 var newOffset = $common.getLocation(this._activeDragVisual); 3281 if (this._oldOffset.x != newOffset.x || this._oldOffset.y != newOffset.y) { 3282 this._activeDragVisual.startingPoint = this.subtractPoints(this._activeDragVisual.startingPoint, this.subtractPoints(this._oldOffset, newOffset)); 3283 scrollOffset = this.getScrollOffset(this._activeDragVisual, /* recursive */ true); 3284 var position = this.addPoints(this.subtractPoints(document._lastPosition, this._activeDragVisual.startingPoint), scrollOffset); 3285 $common.setLocation(this._activeDragVisual, position); 3286 } 3287 }, 3288 3289 addPoints : function(p1, p2) { 3290 return { x: p1.x + p2.x, y: p1.y + p2.y }; 3291 }, 3292 3293 subtractPoints : function(p1, p2) { 3294 return { x: p1.x - p2.x, y: p1.y - p2.y }; 3295 }, 3296 3297 // -- Drag and drop helper methods. 3298 getScrollOffset : function(element, recursive) { 3299 var left = element.scrollLeft; 3300 var top = element.scrollTop; 3301 if (recursive) { 3302 var parent = element.parentNode; 3303 while (parent != null && parent.scrollLeft != null) { 3304 left += parent.scrollLeft; 3305 top += parent.scrollTop; 3306 // Don't include anything below the body. 3307 if (parent == document.body && (left != 0 && top != 0)) 3308 break; 3309 parent = parent.parentNode; 3310 } 3311 } 3312 return { x: left, y: top }; 3313 }, 3314 3315 getBrowserRectangle : function() { 3316 var width = window.innerWidth; 3317 var height = window.innerHeight; 3318 if (width == null) { 3319 width = document.body.clientWidth; 3320 } 3321 if (height == null) { 3322 height = document.body.clientHeight; 3323 } 3324 3325 return { x: 0, y: 0, width: width, height: height }; 3326 }, 3327 3328 getNextSibling : function(item) { 3329 for (item = item.nextSibling; item != null; item = item.nextSibling) { 3330 if (item.innerHTML != null) { 3331 return item; 3332 } 3333 } 3334 return null; 3335 }, 3336 3337 hasParent : function(element) { 3338 return (element.parentNode != null && element.parentNode.tagName != null); 3339 } 3340} 3341AjaxControlToolkit.IEDragDropManager.registerClass('AjaxControlToolkit.IEDragDropManager', Sys.Component); 3342 3343AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget = function(dropTarget) { 3344 if (dropTarget == null) { 3345 return []; 3346 } 3347 var ev = window._event; 3348 var dataObjects = []; 3349 var dataTypes = [ "URL", "Text" ]; 3350 var data; 3351 for (var i = 0; i < dataTypes.length; i++) { 3352 var dt = ev.dataTransfer; 3353 if(!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer; 3354 data = dt.getData(dataTypes[i]); 3355 if (dropTarget.canDrop(AjaxControlToolkit.DragMode.Copy, dataTypes[i], data)) { 3356 if (data) { 3357 Array.add(dataObjects, { type : dataTypes[i], value : data }); 3358 } 3359 } 3360 } 3361 3362 return dataObjects; 3363} 3364 3365 3366AjaxControlToolkit.GenericDragDropManager = function() { 3367 AjaxControlToolkit.GenericDragDropManager.initializeBase(this); 3368 3369 this._dropTargets = null; 3370 // Radius of the cursor used to determine what drop target we 3371 // are hovering. Anything below the cursor's zone may be a 3372 // potential drop target. 3373 this._scrollEdgeConst = 40; 3374 this._scrollByConst = 10; 3375 this._scroller = null; 3376 this._scrollDeltaX = 0; 3377 this._scrollDeltaY = 0; 3378 this._activeDragVisual = null; 3379 this._activeContext = null; 3380 this._activeDragSource = null; 3381 this._oldOffset = null; 3382 this._potentialTarget = null; 3383 this._mouseUpHandler = null; 3384 this._mouseMoveHandler = null; 3385 this._keyPressHandler = null; 3386 this._scrollerTickHandler = null; 3387} 3388AjaxControlToolkit.GenericDragDropManager.prototype = { 3389 3390 initialize : function() { 3391 AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "initialize"); 3392 this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp); 3393 this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove); 3394 this._keyPressHandler = Function.createDelegate(this, this._onKeyPress); 3395 this._scrollerTickHandler = Function.createDelegate(this, this._onScrollerTick); 3396 if (Sys.Browser.agent === Sys.Browser.Safari) { 3397 AjaxControlToolkit.GenericDragDropManager.__loadSafariCompatLayer(this); 3398 } 3399 this._scroller = new Sys.Timer(); 3400 this._scroller.set_interval(10); 3401 this._scroller.add_tick(this._scrollerTickHandler); 3402 }, 3403 3404 startDragDrop : function(dragSource, dragVisual, context) { 3405 this._activeDragSource = dragSource; 3406 this._activeDragVisual = dragVisual; 3407 this._activeContext = context; 3408 3409 AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "startDragDrop", [dragSource, dragVisual, context]); 3410 }, 3411 3412 _stopDragDrop : function(cancelled) { 3413 this._scroller.set_enabled(false); 3414 3415 AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "_stopDragDrop", [cancelled]); 3416 }, 3417 3418 _drag : function(isInitialDrag) { 3419 AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "_drag", [isInitialDrag]); 3420 3421 this._autoScroll(); 3422 }, 3423 3424 _wireEvents : function() { 3425 $addHandler(document, "mouseup", this._mouseUpHandler); 3426 $addHandler(document, "mousemove", this._mouseMoveHandler); 3427 $addHandler(document, "keypress", this._keyPressHandler); 3428 }, 3429 3430 _unwireEvents : function() { 3431 $removeHandler(document, "keypress", this._keyPressHandler); 3432 $removeHandler(document, "mousemove", this._mouseMoveHandler); 3433 $removeHandler(document, "mouseup", this._mouseUpHandler); 3434 }, 3435 3436 _wireDropTargetEvents : function(dropTarget) { 3437 // 3438 }, 3439 3440 _unwireDropTargetEvents : function(dropTarget) { 3441 // 3442 }, 3443 3444 _onMouseUp : function(e) { 3445 window._event = e; 3446 this._stopDragDrop(false); 3447 }, 3448 3449 _onMouseMove : function(e) { 3450 window._event = e; 3451 this._drag(); 3452 }, 3453 3454 _onKeyPress : function(e) { 3455 window._event = e; 3456 // Escape. 3457 var k = e.keyCode ? e.keyCode : e.rawEvent.keyCode; 3458 if (k == 27) { 3459 this._stopDragDrop(/* cancel */ true); 3460 } 3461 }, 3462 3463 _autoScroll : function() { 3464 var ev = window._event; 3465 var browserRect = this.getBrowserRectangle(); 3466 if (browserRect.width > 0) { 3467 this._scrollDeltaX = this._scrollDeltaY = 0; 3468 if (ev.clientX < browserRect.x + this._scrollEdgeConst) this._scrollDeltaX = -this._scrollByConst; 3469 else if (ev.clientX > browserRect.width - this._scrollEdgeConst) this._scrollDeltaX = this._scrollByConst; 3470 if (ev.clientY < browserRect.y + this._scrollEdgeConst) this._scrollDeltaY = -this._scrollByConst; 3471 else if (ev.clientY > browserRect.height - this._scrollEdgeConst) this._scrollDeltaY = this._scrollByConst; 3472 if (this._scrollDeltaX != 0 || this._scrollDeltaY != 0) { 3473 this._scroller.set_enabled(true); 3474 } 3475 else { 3476 this._scroller.set_enabled(false); 3477 } 3478 } 3479 }, 3480 3481 _onScrollerTick : function() { 3482 var oldLeft = document.body.scrollLeft; 3483 var oldTop = document.body.scrollTop; 3484 window.scrollBy(this._scrollDeltaX, this._scrollDeltaY); 3485 var newLeft = document.body.scrollLeft; 3486 var newTop = document.body.scrollTop; 3487 3488 var dragVisual = this._activeDragVisual; 3489 var position = { x: parseInt(dragVisual.style.left) + (newLeft - oldLeft), y: parseInt(dragVisual.style.top) + (newTop - oldTop) }; 3490 $common.setLocation(dragVisual, position); 3491 } 3492} 3493AjaxControlToolkit.GenericDragDropManager.registerClass('AjaxControlToolkit.GenericDragDropManager', AjaxControlToolkit.IEDragDropManager); 3494 3495 3496if (Sys.Browser.agent === Sys.Browser.Safari) { 3497 AjaxControlToolkit.GenericDragDropManager.__loadSafariCompatLayer = function(ddm) { 3498 ddm._getScrollOffset = ddm.getScrollOffset; 3499 3500 ddm.getScrollOffset = function(element, recursive) { 3501 return { x: 0, y: 0 }; 3502 } 3503 3504 ddm._getBrowserRectangle = ddm.getBrowserRectangle; 3505 3506 ddm.getBrowserRectangle = function() { 3507 var browserRect = ddm._getBrowserRectangle(); 3508 3509 var offset = ddm._getScrollOffset(document.body, true); 3510 return { x: browserRect.x + offset.x, y: browserRect.y + offset.y, 3511 width: browserRect.width + offset.x, height: browserRect.height + offset.y }; 3512 } 3513 } 3514} 3515 3516// (c) Copyright Microsoft Corporation. 3517// This source is subject to the Microsoft Permissive License. 3518// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 3519// All other rights reserved. 3520 3521 3522/// <reference name="MicrosoftAjax.debug.js" /> 3523/// <reference name="MicrosoftAjaxTimer.debug.js" /> 3524/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 3525/// <reference path="../ExtenderBase/BaseScripts.js" /> 3526/// <reference path="../Common/Common.js" /> 3527/// <reference path="../Compat/Timer/Timer.js" /> 3528/// <reference path="../Compat/DragDrop/DragDropScripts.js" /> 3529 3530
3531AjaxControlToolkit.FloatingBehavior = function(element) { 3532 AjaxControlToolkit.FloatingBehavior.initializeBase(this,[element]); 3533 3534 var _handle; 3535 var _location; 3536 var _dragStartLocation; 3537 var _profileProperty; 3538 var _profileComponent; 3539 3540 var _mouseDownHandler = Function.createDelegate(this, mouseDownHandler); 3541 3542 this.add_move = function(handler) { 3543 this.get_events().addHandler('move', handler); 3544 } 3545 this.remove_move = function(handler) { 3546 this.get_events().removeHandler('move', handler); 3547 } 3548 3549 this.get_handle = function() { 3550 return _handle; 3551 } 3552 this.set_handle = function(value) { 3553 if (_handle != null) { 3554 $removeHandler(_handle, "mousedown", _mouseDownHandler); 3555 } 3556 3557 _handle = value; 3558 $addHandler(_handle, "mousedown", _mouseDownHandler); 3559 } 3560 3561 this.get_profileProperty = function() { 3562 return _profileProperty; 3563 } 3564 this.set_profileProperty = function(value) { 3565 //##DEBUG Sys.Debug.assert(!this.get_isInitialized() || _profileProperty === value, "You cannot change the profile property after initialization."); 3566 _profileProperty = value; 3567 } 3568 3569 this.get_profileComponent = function() { 3570 return _profileComponent; 3571 } 3572 this.set_profileComponent = function(value) { 3573 _profileComponent = value; 3574 } 3575 3576 this.get_location = function() { 3577 return _location; 3578 } 3579 this.set_location = function(value) { 3580 if (_location != value) { 3581 _location = value; 3582 if (this.get_isInitialized()) { 3583 $common.setLocation(this.get_element(), _location); 3584 } 3585 this.raisePropertyChanged('location'); 3586 } 3587 } 3588 3589 this.initialize = function() { 3590 AjaxControlToolkit.FloatingBehavior.callBaseMethod(this, 'initialize'); 3591 AjaxControlToolkit.DragDropManager.registerDropTarget(this); 3592 3593 var el = this.get_element(); 3594 3595 3596 if (!_location) { 3597 _location = $common.getLocation(el); 3598 } 3599 3600 el.style.position = "fixed"; 3601 $common.setLocation(el, _location); 3602 3603// var p = this.get_profileProperty(); 3604// if(p) { 3605// var b = new Sys.Preview.Binding(); 3606// b.beginUpdate(); 3607// b.set_target(this); 3608// b.set_property("location"); 3609// var profile = this.get_profileComponent(); 3610// if(!profile) profile = Sys.Preview.Services.Components.Profile.instance; 3611// b.set_dataContext(profile); 3612// b.set_dataPath(p); 3613// b.set_direction(Sys.Preview.BindingDirection.InOut); 3614// 3615// // we must hook into the loaded event since the profile may be loaded and the location property 3616// // will be different. But profile doesnt raise a change notificaiton for every property after a load 3617// var a = new Sys.Preview.InvokeMethodAction(); 3618// a.beginUpdate(); 3619// a.set_eventSource(profile); 3620// a.set_eventName("loadComplete"); 3621// a.set_target(b); 3622// a.set_method("evaluateIn"); 3623 3624// a.endUpdate(); 3625// b.endUpdate(); 3626 3627// this._binding = b; 3628// this._action = a; 3629// } 3630 } 3631 3632 this.dispose = function() { 3633 AjaxControlToolkit.DragDropManager.unregisterDropTarget(this); 3634 if (_handle && _mouseDownHandler) { 3635 $removeHandler(_handle, "mousedown", _mouseDownHandler); 3636 //_handle.detachEvent("onmousedown", _mouseDownHandler); 3637 } 3638 _mouseDownHandler = null; 3639 AjaxControlToolkit.FloatingBehavior.callBaseMethod(this, 'dispose'); 3640 } 3641 3642 this.checkCanDrag = function(element) { 3643 var undraggableTagNames = ["input", "button", "select", "textarea", "label"]; 3644 var tagName = element.tagName; 3645 3646 if ((tagName.toLowerCase() == "a") && (element.href != null) && (element.href.length > 0)) { 3647 return false; 3648 } 3649 if (Array.indexOf(undraggableTagNames, tagName.toLowerCase()) > -1) { 3650 return false; 3651 } 3652 return true; 3653 } 3654 3655 function mouseDownHandler(ev) { 3656 window._event = ev;
3657 var el = this.get_element(); 3658 3659 if (this.checkCanDrag(ev.target)) { 3660 _dragStartLocation = $common.getLocation(el); 3661 3662 ev.preventDefault(); 3663 3664 this.startDragDrop(el); 3665 } 3666 } 3667 3668 // Type get_dataType() 3669 this.get_dragDataType = function() { 3670 return "_floatingObject"; 3671 } 3672 3673 // Object get_data(Context) 3674 this.getDragData = function(context) { 3675 return null; 3676 } 3677 3678 // DragMode get_dragMode() 3679 this.get_dragMode = function() { 3680 return AjaxControlToolkit.DragMode.Move; 3681 } 3682 3683 // void onDragStart() 3684 this.onDragStart = function() { } 3685 3686 // void onDrag() 3687 this.onDrag = function() { } 3688 3689 // void onDragEnd(Canceled) 3690 this.onDragEnd = function(canceled) { 3691 if (!canceled) { 3692 var handler = this.get_events().getHandler('move'); 3693 if(handler) { 3694 var cancelArgs = new Sys.CancelEventArgs(); 3695 handler(this, cancelArgs); 3696 canceled = cancelArgs.get_cancel(); 3697 } 3698 } 3699 3700 var el = this.get_element(); 3701 if (canceled) { 3702 // Restore the position of the control. 3703 $common.setLocation(el, _dragStartLocation); 3704 } else { 3705 _location = $common.getLocation(el); 3706 this.raisePropertyChanged('location'); 3707 } 3708 } 3709 3710 this.startDragDrop = function(dragVisual) { 3711 AjaxControlToolkit.DragDropManager.startDragDrop(this, dragVisual, null); 3712 } 3713 3714 this.get_dropTargetElement = function() { 3715 return document.body; 3716 } 3717 3718 // bool canDrop(DragMode, DataType, Data) 3719 this.canDrop = function(dragMode, dataType, data) { 3720 return (dataType == "_floatingObject"); 3721 } 3722 3723 // void drop(DragMode, DataType, Data) 3724 this.drop = function(dragMode, dataType, data) {} 3725 3726 // void onDragEnterTarget(DragMode, DataType, Data) 3727 this.onDragEnterTarget = function(dragMode, dataType, data) {} 3728 3729 // void onDragLeaveTarget(DragMode, DataType, Data) 3730 this.onDragLeaveTarget = function(dragMode, dataType, data) {} 3731 3732 // void onDragInTarget(DragMode, DataType, Data) 3733 this.onDragInTarget = function(dragMode, dataType, data) {} 3734} 3735//AjaxControlToolkit.FloatingBehavior.descriptor = { 3736// properties: [ {name: "profileProperty", type: String}, 3737// {name: "profileComponent", type: Object}, 3738// {name: "dragData", type: Object, readOnly: true}, 3739// {name: "dragDataType", type: String, readOnly: true}, 3740// {name: "dragMode", type: AjaxControlToolkit.DragMode, readOnly: true}, 3741// {name: "dropTargetElement", type: Object, readOnly: true}, 3742// {name: "handle", type: Sys.UI.DomElement}, 3743// {name: "location", type: String} ], 3744// events: [ {name: "move"} ] 3745//} 3746AjaxControlToolkit.FloatingBehavior.registerClass('AjaxControlToolkit.FloatingBehavior', AjaxControlToolkit.BehaviorBase, AjaxControlToolkit.IDragSource, AjaxControlToolkit.IDropTarget, Sys.IDisposable); 3747 3748// (c) Copyright Microsoft Corporation. 3749// This source is subject to the Microsoft Permissive License. 3750// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 3751// All other rights reserved. 3752 3753 3754/// <reference name="MicrosoftAjax.debug.js" /> 3755/// <reference name="MicrosoftAjaxTimer.debug.js" /> 3756/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 3757/// <reference path="../ExtenderBase/BaseScripts.js" /> 3758/// <reference path="../Common/Common.js" /> 3759 3760 3761Type.registerNamespace('AjaxControlToolkit'); 3762 3763AjaxControlToolkit.BoxCorners = function() { 3764 /// <summary> 3765 /// Corners of an element 3766 /// </summary> 3767 /// <field name="None" type="Number" integer="true" /> 3768 /// <field name="TopLeft" type="Number" integer="true" /> 3769 /// <field name="TopRight" type="Number" integer="true" /> 3770 /// <field name="BottomRight" type="Number" integer="true" /> 3771 /// <field name="BottomLeft" type="Number" integer="true" /> 3772 /// <field name="Top" type="Number" integer="true" /> 3773 /// <field name="Right" type="Number" integer="true" /> 3774 /// <field name="Bottom" type="Number" integer="true" /> 3775 /// <field name="Left" type="Number" integer="true" /> 3776 /// <field name="All" type="Number" integer="true" />
3777 throw Error.invalidOperation(); 3778} 3779AjaxControlToolkit.BoxCorners.prototype = { 3780 None : 0x00, 3781 3782 TopLeft : 0x01, 3783 TopRight : 0x02, 3784 BottomRight : 0x04, 3785 BottomLeft : 0x08, 3786 3787 Top : 0x01 | 0x02, 3788 Right : 0x02 | 0x04, 3789 Bottom : 0x04 | 0x08, 3790 Left : 0x08 | 0x01, 3791 All : 0x01 | 0x02 | 0x04 | 0x08 3792} 3793AjaxControlToolkit.BoxCorners.registerEnum("AjaxControlToolkit.BoxCorners", true); 3794 3795 3796AjaxControlToolkit.RoundedCornersBehavior = function(element) { 3797 /// <summary> 3798 /// The RoundedCornersBehavior rounds the corners of its target element 3799 /// </summary> 3800 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 3801 /// DOM element associated with the behavior 3802 /// </param> 3803 AjaxControlToolkit.RoundedCornersBehavior.initializeBase(this, [element]); 3804 3805 this._corners = AjaxControlToolkit.BoxCorners.All; 3806 this._radius = 5; 3807 this._color = null; 3808 this._parentDiv = null; 3809 this._originalStyle = null; 3810 this._borderColor = null; 3811 this._isDirty = true; 3812} 3813AjaxControlToolkit.RoundedCornersBehavior.prototype = { 3814 initialize: function() { 3815 /// <summary> 3816 /// Initialize the behavior 3817 /// </summary> 3818 AjaxControlToolkit.RoundedCornersBehavior.callBaseMethod(this, 'initialize'); 3819 this.update(); 3820 }, 3821 3822 dispose: function() { 3823 /// <summary> 3824 /// Dispose the behavior 3825 /// </summary> 3826 3827 this.disposeParentDiv(); 3828 AjaxControlToolkit.RoundedCornersBehavior.callBaseMethod(this, 'dispose'); 3829 }, 3830 3831 update: function() { 3832 /// <summary> 3833 /// Create the surrounding div that will have rounded corners 3834 /// </summary> 3835 var e = this.get_element(); 3836 3837 if (!e || !this._isDirty || this.get_isUpdating()) return; 3838 3839 this.disposeParentDiv(); 3840 3841 var color = this.getBackgroundColor(); 3842 var originalWidth = e.offsetWidth; 3843 var newParent = e.cloneNode(false); 3844 3845 // move all children into the new div. 3846 this.moveChildren(e, newParent); 3847 3848 // modify the target element to be transparent 3849 // and set up the new parent 3850 this._originalStyle = e.style.cssText; 3851 e.style.backgroundColor = "transparent"; 3852 e.style.verticalAlign = "top"; 3853 e.style.padding = "0"; 3854 e.style.overflow = ""; 3855 e.style.className = ""; 3856 // Don't assume there is a numerical value for height. A height of "auto" is possible. 3857 if (e.style.height && e.style.height != "auto") { 3858 // Increase the height to account for the rounded corners 3859 e.style.height = parseInt($common.getCurrentStyle(e, 'height')) + (this._radius * 2) + "px"; 3860 } else { 3861 // Note: Do NOT use $common.getCurrentStyle in the check below 3862 // because that breaks the work-around 3863 if (!e.style.width && (0 < originalWidth)) { 3864 // The following line works around a problem where IE renders the first 3865 // rounded DIV about 6 pixels too high if e doesn't have a width or height 3866 e.style.width = originalWidth + "px"; 3867 } 3868 } 3869 3870 // these are properties we don't want cloned down to the new parent 3871 newParent.style.position = ""; 3872 newParent.style.border = ""; 3873 newParent.style.margin = ""; 3874 newParent.style.width = "100%"; 3875 newParent.id = ""; 3876 newParent.removeAttribute("control"); 3877 3878 if (this._borderColor) { 3879 newParent.style.borderTopStyle = "none"; 3880 newParent.style.borderBottomStyle = "none"; 3881 newParent.style.borderLeftStyle = "solid"; 3882 newParent.style.borderRightStyle = "solid"; 3883 newParent.style.borderLeftColor = this._borderColor; 3884 newParent.style.borderRightColor = this._borderColor; 3885 newParent.style.borderLeftWidth = "1px"; 3886 newParent.style.borderRightWidth = "1px"; 3887 if (this._radius == 0) { 3888 newParent.style.borderTopStyle = "solid"; 3889 newParent.style.borderBottomStyle = "solid"; 3890 newParent.style.borderTopColor = this._borderColor; 3891 newParent.style.borderBottomColor = this._borderColor; 3892 newParent.style.borderTopWidth = "1px"; 3893 newParent.style.borderBottomWidth = "1px"; 3894 } 3895 } else { 3896 newParent.style.borderTopStyle = "none"; 3897 newParent.style.borderBottomStyle = "none"; 3898 newParent.style.borderLeftStyle = "none"; 3899 newParent.style.borderRightStyle = "none"; 3900 } 3901 3902 // build a set of steps on each end to fake the corners. 3903 // ------- (step 0) 3904 // -------- (step n-1) 3905 // --------- (step n) 3906 // XXXXXXXXX (inner div) 3907 // XXXXXXXXX 3908 // --------- (bottom step n) 3909 // -------- (bottom step n-1) 3910 // ------ (bottom step 0) 3911 3912 var lastDiv = null; 3913 var radius = this._radius; 3914 var lines = this._radius; 3915 var lastDelta = 0; 3916 3917 for (var i = lines; i > 0; i--) { 3918 3919 // figure out how much we'll need to subtract from each item 3920 var angle = Math.acos(i / radius);
3921 var delta = radius - Math.round(Math.sin(angle) * radius); 3922 3923 // build a 1 pixel tall div 3924 // that's delta pixels shorter on each end. 3925 3926 // add the top one 3927 var newDiv = document.createElement("DIV"); 3928 newDiv.__roundedDiv = true; 3929 newDiv.style.backgroundColor = color; 3930 newDiv.style.marginLeft = delta + "px"; 3931 newDiv.style.marginRight = (delta - (this._borderColor ? 2 : 0)) + "px"; 3932 newDiv.style.height = "1px"; 3933 newDiv.style.fontSize = "1px"; // workaround for IE wierdness with 1px divs. 3934 newDiv.style.overflow = "hidden"; 3935 3936 if (this._borderColor) { 3937 newDiv.style.borderLeftStyle = "solid"; 3938 newDiv.style.borderRightStyle = "solid"; 3939 newDiv.style.borderLeftColor = this._borderColor; 3940 newDiv.style.borderRightColor = this._borderColor; 3941 3942 var offset = Math.max(0, lastDelta - delta - 1); 3943 newDiv.style.borderLeftWidth = (offset + 1) + "px"; 3944 newDiv.style.borderRightWidth = (offset + 1) + "px"; 3945 3946 if (i == lines) { 3947 newDiv.__roundedDivNoBorder = true; 3948 newDiv.style.backgroundColor = this._borderColor; 3949 } 3950 } 3951 3952 e.insertBefore(newDiv, lastDiv); 3953 3954 var topDiv = newDiv; 3955 3956 // add the bottom one one 3957 newDiv = newDiv.cloneNode(true); 3958 newDiv.__roundedDiv = true; 3959 3960 e.insertBefore(newDiv, lastDiv); 3961 3962 var bottomDiv = newDiv; 3963 3964 lastDiv = newDiv; 3965 lastDelta = delta; 3966 3967 if (!this.isCornerSet(AjaxControlToolkit.BoxCorners.TopLeft)) { 3968 topDiv.style.marginLeft = "0"; 3969 if (this._borderColor) { 3970 topDiv.style.borderLeftWidth = "1px"; 3971 } 3972 } 3973 if (!this.isCornerSet(AjaxControlToolkit.BoxCorners.TopRight)) { 3974 topDiv.style.marginRight = "0"; 3975 if (this._borderColor) { 3976 topDiv.style.borderRightWidth = "1px"; 3977 topDiv.style.marginRight = "-2px"; 3978 } 3979 } 3980 if (!this.isCornerSet(AjaxControlToolkit.BoxCorners.BottomLeft)) { 3981 bottomDiv.style.marginLeft = "0"; 3982 if (this._borderColor) { 3983 bottomDiv.style.borderLeftWidth = "1px"; 3984 } 3985 } 3986 if (!this.isCornerSet(AjaxControlToolkit.BoxCorners.BottomRight)) { 3987 bottomDiv.style.marginRight = "0"; 3988 if (this._borderColor) { 3989 bottomDiv.style.borderRightWidth = "1px"; 3990 bottomDiv.style.marginRight = "-2px"; 3991 } 3992 } 3993 } 3994 3995 // finally, add the newParent (which has all the original content) 3996 // into the div. 3997 e.insertBefore(newParent, lastDiv); 3998 this._parentDiv = newParent; 3999 this._isDirty = false; 4000 }, 4001 4002 disposeParentDiv: function() { 4003 /// <summary> 4004 /// Dispose the surrounding div with rounded corners 4005 /// </summary> 4006 4007 if (this._parentDiv) { 4008 // clean up the divs we added. 4009 var e = this.get_element(); 4010 var children = e.childNodes; 4011 for (var i = children.length - 1; i >= 0; i--) { 4012 var child = children[i]; 4013 if (child) { 4014 if (child == this._parentDiv) { 4015 this.moveChildren(child, e); 4016 } 4017 try { 4018 e.removeChild(child); 4019 } catch (e) { 4020 // Safari likes to throw NOT_FOUND_ERR (DOMException 8) 4021 // but it seems to work fine anyway. 4022 } 4023 } 4024 } 4025 4026 // restore the original style 4027 if (this._originalStyle) { 4028 e.style.cssText = this._originalStyle; 4029 this._originalStyle = null; 4030 } 4031 this._parentDiv = null; 4032 } 4033 }, 4034
4035 getBackgroundColor: function() { 4036 /// <summary> 4037 /// Get the background color of the target element 4038 /// </summary> 4039 if (this._color) { 4040 return this._color; 4041 } 4042 return $common.getCurrentStyle(this.get_element(), 'backgroundColor'); 4043 }, 4044 4045 moveChildren: function(src, dest) { 4046 /// <summary> 4047 /// Move the child nodes from one element to another 4048 /// </summary> 4049 /// <param name="src" type="Sys.UI.DomElement" domElement="true"> 4050 /// DOM Element 4051 /// </param> 4052 /// <param name="dest" type="Sys.UI.DomElement" domElement="true"> 4053 /// DOM Element 4054 /// </param> 4055 4056 var moveCount = 0; 4057 while (src.hasChildNodes()) { 4058 var child = src.childNodes[0]; 4059 child = src.removeChild(child); 4060 dest.appendChild(child); 4061 moveCount++; 4062 } 4063 return moveCount; 4064 }, 4065 4066 isCornerSet: function(corner) { 4067 /// <summary> 4068 /// Check whether the a flag for this corner has been set 4069 /// </summary> 4070 /// <param name="corner" type="AjaxControlTooolkit.BoxCorners"> 4071 /// Corner to check 4072 /// </param> 4073 /// <returns type="Boolean"> 4074 /// True if it is included in the flags, false otherwise 4075 /// </returns> 4076 return (this._corners & corner) != AjaxControlToolkit.BoxCorners.None; 4077 }, 4078 4079 setCorner: function(corner, value) { 4080 /// <summary> 4081 /// Set a corner as one that should be rounded 4082 /// </summary> 4083 /// <param name="corner" type="AjaxControlToolkit.BoxCorners"> 4084 /// Corner to set 4085 /// </param> 4086 /// <param name="value" type="Boolean"> 4087 /// True to set the value, False to clear it 4088 /// </param> 4089 if (value) { 4090 this.set_Corners(this._corners | corner); 4091 } else { 4092 this.set_Corners(this._corners & ~corner); 4093 } 4094 }, 4095 4096 get_Color: function() { 4097 /// <value type="String"> 4098 /// The background color of the rounded area an corners. By default this picks up the background color of the panel that it is attached to. 4099 /// </value> 4100 return this._color; 4101 }, 4102 set_Color: function(value) { 4103 if (value != this._color) { 4104 this._color = value; 4105 this._isDirty = true; 4106 this.update(); 4107 this.raisePropertyChanged('Color'); 4108 } 4109 }, 4110 4111 get_Radius: function() { 4112 /// <value type="Number" integer="true"> 4113 /// The radius of the corners (and height of the added area). Default is 5. 4114 /// </value> 4115 return this._radius; 4116 }, 4117 set_Radius: function(value) { 4118 if (value != this._radius) { 4119 this._radius = value; 4120 this._isDirty = true; 4121 this.update(); 4122 this.raisePropertyChanged('Radius'); 4123 } 4124 }, 4125 4126 get_Corners: function() { 4127 /// <value type="AjaxControlToolkit.BoxCorners"> 4128 /// Corners that should be rounded 4129 /// </value> 4130 return this._corners; 4131 }, 4132 set_Corners: function(value) { 4133 if (value != this._corners) { 4134 this._corners = value; 4135 this._isDirty = true; 4136 this.update(); 4137 this.raisePropertyChanged("Corners"); 4138 } 4139 }, 4140 4141 get_BorderColor: function() { 4142 /// <value type="String"> 4143 /// Color of the border (and hence the rounded corners) 4144 /// </value> 4145 return this._borderColor; 4146 }, 4147 set_BorderColor: function(value) { 4148 if (value != this._borderColor) { 4149 this._borderColor = value; 4150 this._isDirty = true; 4151 this.update(); 4152 this.raisePropertyChanged("BorderColor"); 4153 } 4154 } 4155} 4156AjaxControlToolkit.RoundedCornersBehavior.registerClass('AjaxControlToolkit.RoundedCornersBehavior', AjaxControlToolkit.BehaviorBase); 4157 4158// (c) Copyright Microsoft Corporation. 4159// This source is subject to the Microsoft Permissive License. 4160// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 4161// All other rights reserved. 4162 4163 4164/// <reference name="MicrosoftAjax.debug.js" /> 4165/// <reference name="MicrosoftAjaxTimer.debug.js" /> 4166/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 4167/// <reference path="../ExtenderBase/BaseScripts.js" /> 4168/// <reference path="../Common/Common.js" /> 4169/// <reference path="../RoundedCorners/RoundedCornersBehavior.js" /> 4170/// <reference path="../Compat/Timer/Timer.js" /> 4171 4172 4173Type.registerNamespace('AjaxControlToolkit'); 4174 4175AjaxControlToolkit.DropShadowBehavior = function(element) { 4176 /// <summary> 4177 /// The DropShadowBehavior is used to attach a drop shadow to the element 4178 /// </summary> 4179 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 4180 /// DOM Element the behavior is associated with 4181 /// </param> 4182 AjaxControlToolkit.DropShadowBehavior.initializeBase(this, [element]);
4183 4184 // our property values 4185 this._opacity = 1.0; 4186 this._width = 5; 4187 4188 // the div we create for the shadow. 4189 this._shadowDiv = null; 4190 4191 // our timer for tracking position 4192 this._trackPosition = null; 4193 this._trackPositionDelay = 50; 4194 this._timer = null; 4195 this._tickHandler = null; 4196 this._roundedBehavior = null; 4197 this._shadowRoundedBehavior = null; 4198 4199 this._rounded = false; 4200 this._radius = 5; 4201 4202 // our cache of our last size and position for tracking 4203 this._lastX = null; 4204 this._lastY = null; 4205 this._lastW = null; 4206 this._lastH = null; 4207} 4208AjaxControlToolkit.DropShadowBehavior.prototype = { 4209 initialize : function() { 4210 /// <summary> 4211 /// Initialize the behavior 4212 /// </summary> 4213 AjaxControlToolkit.DropShadowBehavior.callBaseMethod(this, 'initialize'); 4214 4215 var e = this.get_element(); 4216 4217 // flip the styles position to relative so that we z-order properly. 4218 if ($common.getCurrentStyle(e, 'position', e.style.position) != "absolute") { 4219 e.style.position = "relative"; 4220 } 4221 4222 // set up our initial state 4223 if (this._rounded) { 4224 this.setupRounded(); 4225 } 4226 if (this._trackPosition) { 4227 this.startTimer(); 4228 } 4229 this.setShadow(); 4230 }, 4231 4232 dispose : function() { 4233 /// <summary> 4234 /// Dispose the behavior 4235 /// </summary> 4236 this.stopTimer(); 4237 this.disposeShadowDiv(); 4238 AjaxControlToolkit.DropShadowBehavior.callBaseMethod(this, 'dispose'); 4239 }, 4240 4241 buildShadowDiv : function() { 4242 /// <summary> 4243 /// Create the div that we'll use as the shadow 4244 /// </summary> 4245 4246 var e = this.get_element(); 4247 4248 if (!this.get_isInitialized() || !e || !this._width) return; 4249 4250 var div = document.createElement("DIV"); 4251 div.style.backgroundColor = "black"; 4252 div.style.position= "absolute"; 4253 4254 if (e.id) { 4255 div.id = e.id + "_DropShadow"; 4256 } 4257 4258 // initialize a control around it, and 4259 // set up the opacity behavior and rounding 4260 this._shadowDiv = div; 4261 4262 e.parentNode.appendChild(div); 4263 4264 if (this._rounded ) { 4265 this._shadowDiv.style.height = Math.max(0, e.offsetHeight - (2*this._radius)) + "px"; 4266 if (!this._shadowRoundedBehavior) { 4267 this._shadowRoundedBehavior = $create(AjaxControlToolkit.RoundedCornersBehavior, {"Radius": this._radius}, null, null, this._shadowDiv); 4268 } else { 4269 this._shadowRoundedBehavior.set_Radius(this._radius); 4270 } 4271 } else if (this._shadowRoundedBehavior) { 4272 this._shadowRoundedBehavior.set_Radius(0); 4273 } 4274 4275 if (this._opacity != 1.0) { 4276 this.setupOpacity(); 4277 } 4278 4279 this.setShadow(false, true); 4280 this.updateZIndex(); 4281 }, 4282 4283 disposeShadowDiv : function() { 4284 /// <summary> 4285 /// Dispose of the div we use as the shadow 4286 /// </summary> 4287 4288 if (this._shadowDiv) { 4289 // on page teardown (or in an update panel, this may already 4290 // be gone) 4291 // 4292 if (this._shadowDiv.parentNode) { 4293 this._shadowDiv.parentNode.removeChild(this._shadowDiv); 4294 } 4295 this._shadowDiv = null; 4296 } 4297 4298 if (this._shadowRoundedBehavior) { 4299 this._shadowRoundedBehavior.dispose(); 4300 this._shadowRoundedBehavior = null; 4301 } 4302 }, 4303 4304 onTimerTick : function() { 4305 /// <summary> 4306 /// Timer's tick handler that is used to position the shadow when its target moves 4307 /// </summary> 4308 this.setShadow(); 4309 }, 4310 4311 startTimer : function() { 4312 /// <summary> 4313 /// Start the timer (and hence start tracking the bounds of the target element) 4314 /// </summary> 4315 4316 if (!this._timer) { 4317 if (!this._tickHandler) { 4318 this._tickHandler = Function.createDelegate(this, this.onTimerTick); 4319 } 4320 this._timer = new Sys.Timer(); 4321 this._timer.set_interval(this._trackPositionDelay); 4322 this._timer.add_tick(this._tickHandler); 4323 this._timer.set_enabled(true); 4324 } 4325 }, 4326 4327 stopTimer : function() { 4328 /// <summary> 4329 /// Stop the timer (and hence stop tracking the bounds of the target element) 4330 /// </summary> 4331 4332 // on stop, just clean the thing up completely 4333 if (this._timer) { 4334 this._timer.remove_tick(this._tickHandler); 4335 this._timer.set_enabled(false); 4336 this._timer.dispose(); 4337 this._timer = null; 4338 } 4339 }, 4340 4341 setShadow : function(force, norecurse) { 4342 /// <summary> 4343 /// This function does the heavy lifting of positioning and sizing the shadow. 4344 /// It caches values to avoid extra work - it's called on a timer so we need to 4345 /// keep it light weight. 4346 /// </summary> 4347 /// <param name="force" type="Boolean"> 4348 /// Whether to force the bounds change 4349 /// </param> 4350 /// <param name="norecurse" type="Boolean"> 4351 /// Whether to recurse if we need to recreate the shadow div 4352 /// </param> 4353
4354 var e = this.get_element(); 4355 if (!this.get_isInitialized() || !e || (!this._width && !force)) return; 4356 4357 var existingShadow = this._shadowDiv; 4358 if (!existingShadow) { 4359 this.buildShadowDiv(); 4360 } 4361 4362 // Consider calling offsetLeft first to avoid recursive math of location? 4363 var location = $common.getLocation(e); 4364 4365 if (force || this._lastX != location.x || this._lastY != location.y || !existingShadow) { 4366 this._lastX = location.x; 4367 this._lastY = location.y; 4368 4369 var w = this.get_Width(); 4370 4371 // to work around setlocation bug because elements embedded within fixed\absolute 4372 // elements are set relative to their parent instead of the window 4373 if((e.parentNode.style.position == "absolute") || (e.parentNode.style.position == "fixed") ) 4374 { 4375 location.x = w; 4376 location.y = w; 4377 } 4378 else if (e.parentNode.style.position == "relative") 4379 { 4380 location.x = w; 4381 var paddingTop = e.parentNode.style.paddingTop; 4382 paddingTop = paddingTop.replace("px", ""); 4383 4384 var intPaddingTop = 0; 4385 intPaddingTop = parseInt(paddingTop); 4386 4387 location.y = w + intPaddingTop; 4388 } 4389 else 4390 { 4391 location.x += w; 4392 location.y += w; 4393 } 4394 4395 $common.setLocation(this._shadowDiv, location); 4396 } 4397 4398 var h = e.offsetHeight; 4399 var w = e.offsetWidth; 4400 4401 if (force || h != this._lastH || w != this._lastW || !existingShadow) { 4402 this._lastW = w; 4403 this._lastH = h; 4404 if (!this._rounded || !existingShadow || norecurse) { 4405 this._shadowDiv.style.width = w + "px"; 4406 this._shadowDiv.style.height = h + "px"; 4407 } else { 4408 // recurse if we need to redo the div 4409 this.disposeShadowDiv(); 4410 this.setShadow(); 4411 } 4412 } 4413 4414 if (this._shadowDiv) { 4415 this._shadowDiv.style.visibility = $common.getCurrentStyle(e, 'visibility'); 4416 } 4417 }, 4418 4419 setupOpacity : function() { 4420 /// <summary> 4421 /// Set the opacity of the shadow div 4422 /// </summary> 4423 if (this.get_isInitialized() && this._shadowDiv) { 4424 $common.setElementOpacity(this._shadowDiv, this._opacity); 4425 } 4426 }, 4427 4428 setupRounded : function() { 4429 /// <summary> 4430 /// Demand create and initialize the RoundedCornersBehavior 4431 /// </summary> 4432 4433 if (!this._roundedBehavior && this._rounded) { 4434 this._roundedBehavior = $create(AjaxControlToolkit.RoundedCornersBehavior, null, null, null, this.get_element()); 4435 } 4436 if (this._roundedBehavior) { 4437 this._roundedBehavior.set_Radius(this._rounded ? this._radius : 0); 4438 } 4439 }, 4440 4441 updateZIndex : function() { 4442 /// <summary> 4443 /// Update the z-Index so the shadow div remains behind the target element 4444 /// </summary> 4445 4446 if (!this._shadowDiv) return; 4447 4448 var e = this.get_element(); 4449 var targetZIndex = e.style.zIndex; 4450 var shadowZIndex = this._shadowDiv.style.zIndex; 4451 4452 if (shadowZIndex && targetZIndex && targetZIndex > shadowZIndex) { 4453 return; 4454 } else { 4455 targetZIndex = Math.max(2, targetZIndex); 4456 shadowZIndex = targetZIndex - 1; 4457 } 4458 e.style.zIndex = targetZIndex; 4459 this._shadowDiv.style.zIndex = shadowZIndex; 4460 }, 4461 4462 updateRoundedCorners : function() { 4463 /// <summary> 4464 /// Update the RoundedCorndersBehavior and recreate the shadow div so its corners are rounded as well 4465 /// </summary> 4466 if (this.get_isInitialized()) { 4467 this.setupRounded(); 4468 this.disposeShadowDiv(); 4469 this.setShadow(); 4470 } 4471 }, 4472 4473 get_Opacity : function() { 4474 /// <value type="Number"> 4475 /// The opacity of the drop shadow, from 0 (fully transparent) to 1.0 (fully opaque). The default value is .5. 4476 /// </value> 4477 return this._opacity; 4478 }, 4479 set_Opacity : function(value) { 4480 if (this._opacity != value) { 4481 this._opacity = value; 4482 this.setupOpacity(); 4483 this.raisePropertyChanged('Opacity'); 4484 } 4485 }, 4486 4487 get_Rounded : function() { 4488 /// <value type="Boolean"> 4489 /// Whether or not the corners of the target and drop shadow should be roun
4489ded 4490 /// </value> 4491 return this._rounded; 4492 }, 4493 set_Rounded : function(value) { 4494 if (value != this._rounded) { 4495 this._rounded = value; 4496 this.updateRoundedCorners(); 4497 this.raisePropertyChanged('Rounded'); 4498 } 4499 }, 4500 4501 get_Radius : function() { 4502 /// <value type="Number" integer="true"> 4503 /// Radius, in pixels, of the rounded corners 4504 /// </value> 4505 return this._radius; 4506 }, 4507 set_Radius : function(value) { 4508 if (value != this._radius) { 4509 this._radius = value; 4510 this.updateRoundedCorners(); 4511 this.raisePropertyChanged('Radius'); 4512 } 4513 }, 4514 4515 get_Width : function() { 4516 /// <value type="Number" integer="true"> 4517 /// Width in pixels of the drop shadow. The default value is 5 pixels. 4518 /// </value> 4519 return this._width; 4520 }, 4521 set_Width : function(value) { 4522 if (value != this._width) { 4523 this._width = value; 4524 4525 if (this._shadowDiv) { 4526 $common.setVisible(this._shadowDiv, value > 0); 4527 } 4528 4529 this.setShadow(true); 4530 this.raisePropertyChanged('Width'); 4531 } 4532 }, 4533 4534 get_TrackPositionDelay : function() { 4535 /// <value type="Number"> 4536 /// Length of the timer interval used when tracking the position of the target 4537 /// </value> 4538 return this._trackPositionDelay; 4539 }, 4540 set_TrackPositionDelay : function(value) { 4541 if (value != this._trackPositionDelay) { 4542 this._trackPositionDelay = value; 4543 if (this._trackPosition) { 4544 this.stopTimer(); 4545 this.startTimer(); 4546 } 4547 this.raisePropertyChanged('TrackPositionDelay'); 4548 } 4549 }, 4550 4551 get_TrackPosition : function() { 4552 /// <value type="Boolean"> 4553 /// Whether the drop shadow should track the position of the panel it is attached to. Use this if the panel is absolutely positioned or will otherwise move. 4554 /// </value> 4555 return this._trackPosition; 4556 }, 4557 set_TrackPosition : function(value) { 4558 if (value != this._trackPosition) { 4559 this._trackPosition = value; 4560 if (this.get_element()) { 4561 if (value) { 4562 this.startTimer(); 4563 } else { 4564 this.stopTimer(); 4565 } 4566 } 4567 this.raisePropertyChanged('TrackPosition'); 4568 } 4569 } 4570} 4571AjaxControlToolkit.DropShadowBehavior.registerClass('AjaxControlToolkit.DropShadowBehavior', AjaxControlToolkit.BehaviorBase); 4572// getDescriptor : function() { 4573// var td = AjaxControlToolkit.DropShadowBehavior.callBaseMethod(this, 'getDescriptor'); 4574// td.addProperty('Opacity', Number); 4575// td.addProperty('Width', Number); 4576// td.addProperty('TrackPosition', Boolean); 4577// td.addProperty('TrackPositionDelay', Number); 4578// td.addProperty('Rounded', Boolean); 4579// td.addProperty('Radius', Number); 4580// return td; 4581// }, 4582 4583// (c) Copyright Microsoft Corporation. 4584// This source is subject to the Microsoft Permissive License. 4585// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 4586// All other rights reserved. 4587 4588 4589/// <reference name="MicrosoftAjax.debug.js" /> 4590/// <reference name="MicrosoftAjaxTimer.debug.js" /> 4591/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 4592/// <reference path="../ExtenderBase/BaseScripts.js" /> 4593/// <reference path="../Common/Common.js" /> 4594/// <reference path="../DynamicPopulate/DynamicPopulateBehavior.js" /> 4595/// <reference path="../RoundedCorners/RoundedCornersBehavior.js" /> 4596/// <reference path="../Compat/Timer/Timer.js" /> 4597/// <reference path="../DropShadow/DropShadowBehavior.js" /> 4598/// <reference path="../Compat/DragDrop/DragDropScripts.js" /> 4599/// <reference path="../DragPanel/FloatingBehavior.js" /> 4600 4601 4602Type.registerNamespace('AjaxControlToolkit'); 4603 4604AjaxControlToolkit.ModalPopupRepositionMode = function() { 4605 /// <summary> 4606 /// The ModalPopupRepositionMode enumeration describes how the modal popup repositions 4607 /// </summary> 4608 /// <field name="None" type="Number" integer="true" /> 4609 /// <field name="RepositionOnWindowResize" type="Number" integer="true" /> 4610 /// <field name="RepositionOnWindowScroll" type="Number" integer="true" /> 4611 /// <field name="RepositionOnWindowResizeAndScroll" type="Number" integer="true" />
4612 throw Error.invalidOperation(); 4613} 4614AjaxControlToolkit.ModalPopupRepositionMode.prototype = { 4615 None : 0, 4616 RepositionOnWindowResize : 1, 4617 RepositionOnWindowScroll : 2, 4618 RepositionOnWindowResizeAndScroll : 3 4619} 4620AjaxControlToolkit.ModalPopupRepositionMode.registerEnum('AjaxControlToolkit.ModalPopupRepositionMode'); 4621 4622 4623AjaxControlToolkit.ModalPopupBehavior = function(element) { 4624 /// <summary> 4625 /// The ModalPopupBehavior is used to display the target element as a modal dialog 4626 /// </summary> 4627 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 4628 /// DOM Element the behavior is associated with 4629 /// </param> 4630 AjaxControlToolkit.ModalPopupBehavior.initializeBase(this, [element]); 4631 4632 // Properties 4633 this._PopupControlID = null; 4634 this._PopupDragHandleControlID = null; 4635 this._BackgroundCssClass = null; 4636 this._DropShadow = false; 4637 this._Drag = false; 4638 this._OkControlID = null; 4639 this._CancelControlID = null; 4640 this._OnOkScript = null; 4641 this._OnCancelScript = null; 4642 this._xCoordinate = -1; 4643 this._yCoordinate = -1; 4644 this._repositionMode = AjaxControlToolkit.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll; 4645 4646 // Variables 4647 this._backgroundElement = null; 4648 this._foregroundElement = null; 4649 this._relativeOrAbsoluteParentElement = null; 4650 this._popupElement = null; 4651 this._dragHandleElement = null; 4652 this._showHandler = null; 4653 this._okHandler = null; 4654 this._cancelHandler = null; 4655 this._scrollHandler = null; 4656 this._resizeHandler = null; 4657 this._windowHandlersAttached = false; 4658 this._dropShadowBehavior = null; 4659 this._dragBehavior = null; 4660 this._isIE6 = false; 4661 4662 this._saveTabIndexes = new Array(); 4663 this._saveDesableSelect = new Array(); 4664 this._tagWithTabIndex = new Array('A','AREA','BUTTON','INPUT','OBJECT','SELECT','TEXTAREA','IFRAME'); 4665} 4666AjaxControlToolkit.ModalPopupBehavior.prototype = { 4667 initialize : function() { 4668 /// <summary> 4669 /// Initialize the behavior 4670 /// </summary> 4671 4672 /* 4673 <div superpopup - drag container resizable><div -- drag handle\dropshadow foreground></div></div> 4674 */ 4675 AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this, 'initialize'); 4676 this._isIE6 = (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7); 4677 if(this._PopupDragHandleControlID) 4678 this._dragHandleElement = $get(this._PopupDragHandleControlID); 4679 4680 this._popupElement = $get(this._PopupControlID); 4681 if(this._DropShadow) 4682 { 4683 this._foregroundElement = document.createElement('div'); 4684 this._foregroundElement.id = this.get_id() + '_foregroundElement'; 4685 this._popupElement.parentNode.appendChild(this._foregroundElement); 4686 this._foregroundElement.appendChild(this._popupElement); 4687 } 4688 else 4689 { 4690 this._foregroundElement = this._popupElement; 4691 } 4692 this._backgroundElement = document.createElement('div'); 4693 this._backgroundElement.id = this.get_id() + '_backgroundElement'; 4694 this._backgroundElement.style.display = 'none'; 4695 this._backgroundElement.style.position = 'fixed'; 4696 this._backgroundElement.style.left = '0px'; 4697 this._backgroundElement.style.top = '0px'; 4698 // Want zIndex to big enough that the background sits above everything else 4699 // CSS 2.1 defines no bounds for the <integer> type, so pick arbitrarily 4700 this._backgroundElement.style.zIndex = 10000;
4701 if (this._BackgroundCssClass) { 4702 this._backgroundElement.className = this._BackgroundCssClass; 4703 } 4704 this._foregroundElement.parentNode.appendChild(this._backgroundElement); 4705 4706 this._foregroundElement.style.display = 'none'; 4707 this._foregroundElement.style.position = 'fixed'; 4708 this._foregroundElement.style.zIndex = $common.getCurrentStyle(this._backgroundElement, 'zIndex', this._backgroundElement.style.zIndex) + 1; 4709 4710 this._showHandler = Function.createDelegate(this, this._onShow); 4711 $addHandler(this.get_element(), 'click', this._showHandler); 4712 4713 if (this._OkControlID) { 4714 this._okHandler = Function.createDelegate(this, this._onOk); 4715 $addHandler($get(this._OkControlID), 'click', this._okHandler); 4716 } 4717 4718 if (this._CancelControlID) { 4719 this._cancelHandler = Function.createDelegate(this, this._onCancel); 4720 $addHandler($get(this._CancelControlID), 'click', this._cancelHandler); 4721 } 4722 4723 this._scrollHandler = Function.createDelegate(this, this._onLayout); 4724 this._resizeHandler = Function.createDelegate(this, this._onLayout); 4725 4726 // Need to know when partial updates complete 4727 this.registerPartialUpdateEvents(); 4728 }, 4729 4730 dispose : function() { 4731 /// <summary> 4732 /// Dispose the behavior 4733 /// </summary> 4734 4735 // Going away; restore any changes to the page 4736 this._hideImplementation(); 4737 4738 if (this._foregroundElement && this._foregroundElement.parentNode) { 4739 // Remove background we added to the DOM 4740 this._foregroundElement.parentNode.removeChild(this._backgroundElement); 4741 4742 if(this._DropShadow) { 4743 // Remove DIV wrapper added in initialize 4744 this._foregroundElement.parentNode.appendChild(this._popupElement); 4745 this._foregroundElement.parentNode.removeChild(this._foregroundElement); 4746 } 4747 } 4748 4749 this._scrollHandler = null; 4750 this._resizeHandler = null; 4751 if (this._cancelHandler && $get(this._CancelControlID)) { 4752 $removeHandler($get(this._CancelControlID), 'click', this._cancelHandler); 4753 this._cancelHandler = null; 4754 } 4755 if (this._okHandler && $get(this._OkControlID)) { 4756 $removeHandler($get(this._OkControlID), 'click', this._okHandler); 4757 this._okHandler = null; 4758 } 4759 if (this._showHandler) { 4760 $removeHandler(this.get_element(), 'click', this._showHandler); 4761 this._showHandler = null; 4762 } 4763 4764 AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this, 'dispose'); 4765 }, 4766 4767 _attachPopup : function() { 4768 /// <summary> 4769 /// Attach the event handlers for the popup 4770 /// </summary> 4771 4772 if (this._DropShadow && !this._dropShadowBehavior) { 4773 this._dropShadowBehavior = $create(AjaxControlToolkit.DropShadowBehavior, {}, null, null, this._popupElement); 4774 } 4775 if (this._dragHandleElement && !this._dragBehavior) { 4776 this._dragBehavior = $create(AjaxControlToolkit.FloatingBehavior, {"handle" : this._dragHandleElement}, null, null, this._foregroundElement); 4777 } 4778 4779 $addHandler(window, 'resize', this._resizeHandler); 4780 $addHandler(window, 'scroll', this._scrollHandler); 4781 this._windowHandlersAttached = true; 4782 }, 4783 4784 _detachPopup : function() { 4785 /// <summary> 4786 /// Detach the event handlers for the popup 4787 /// </summary> 4788 4789 if (this._windowHandlersAttached) { 4790 if (this._scrollHandler) { 4791 $removeHandler(window, 'scroll', this._scrollHandler); 4792 } 4793 if (this._resizeHandler) { 4794 $removeHandler(window, 'resize', this._resizeHandler); 4795 } 4796 this._windowHandlersAttached = false; 4797 } 4798 4799 if (this._dragBehavior) { 4800 this._dragBehavior.dispose(); 4801 this._dragBehavior = null; 4802 } 4803 4804 if (this._dropShadowBehavior) { 4805 this._dropShadowBehavior.dispose(); 4806 this._dropShadowBehavior = null; 4807 } 4808 }, 4809 4810 _onShow : function(e) { 4811 /// <summary> 4812 /// Handler for the target's click event 4813 /// </summary> 4814 /// <param name="e" type="Sys.UI.DomEvent"> 4815 /// Event info 4816 /// </param> 4817
4818 if (!this.get_element().disabled) { 4819 this.show(); 4820 e.preventDefault(); 4821 return false; 4822 } 4823 }, 4824 4825 _onOk : function(e) { 4826 /// <summary> 4827 /// Handler for the modal dialog's OK button click 4828 /// </summary> 4829 /// <param name="e" type="Sys.UI.DomEvent"> 4830 /// Event info 4831 /// </param> 4832 4833 var element = $get(this._OkControlID); 4834 if (element && !element.disabled) { 4835 if (this.hide() && this._OnOkScript) { 4836 window.setTimeout(this._OnOkScript, 0); 4837 } 4838 e.preventDefault(); 4839 return false; 4840 } 4841 }, 4842 4843 _onCancel : function(e) { 4844 /// <summary> 4845 /// Handler for the modal dialog's Cancel button click 4846 /// </summary> 4847 /// <param name="e" type="Sys.UI.DomEvent"> 4848 /// Event info 4849 /// </param> 4850 4851 var element = $get(this._CancelControlID); 4852 if (element && !element.disabled) { 4853 if (this.hide() && this._OnCancelScript) { 4854 window.setTimeout(this._OnCancelScript, 0); 4855 } 4856 e.preventDefault(); 4857 return false; 4858 } 4859 }, 4860 4861 _onLayout : function(e) { 4862 /// <summary> 4863 /// Handler for scrolling and resizing events that would require a repositioning of the modal dialog 4864 /// </summary> 4865 /// <param name="e" type="Sys.UI.DomEvent"> 4866 /// Event info 4867 /// </param> 4868 var positioning = this.get_repositionMode(); 4869 if (((positioning === AjaxControlToolkit.ModalPopupRepositionMode.RepositionOnWindowScroll) || 4870 (positioning === AjaxControlToolkit.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)) && (e.type === 'scroll')) { 4871 this._layout(); 4872 } else if (((positioning === AjaxControlToolkit.ModalPopupRepositionMode.RepositionOnWindowResize) || 4873 (positioning === AjaxControlToolkit.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)) && (e.type === 'resize')) { 4874 this._layout(); 4875 } else { 4876 // Layout background element again to make sure it covers the whole background. 4877 // This needs to be called separately since _layout will not be always called 4878 // to reposition the popup depending on the RepositionMode but the background needs 4879 // to handle the resize/scroll every time. 4880 this._layoutBackgroundElement(); 4881 } 4882 }, 4883 4884 show : function() { 4885 /// <summary> 4886 /// Display the element referenced by PopupControlID as a modal dialog 4887 /// </summary> 4888 4889 var eventArgs = new Sys.CancelEventArgs(); 4890 this.raiseShowing(eventArgs); 4891 if (eventArgs.get_cancel()) { 4892 return; 4893 } 4894 4895 this.populate(); 4896 this._attachPopup(); 4897 4898 this._backgroundElement.style.display = ''; 4899 this._foregroundElement.style.display = ''; 4900 this._popupElement.style.display = ''; 4901 if (this._isIE6) { 4902 this._foregroundElement.style.position = 'absolute'; 4903 this._backgroundElement.style.position = 'absolute'; 4904 // find the relative or absolute parent 4905 var tempRelativeOrAbsoluteParent = this._foregroundElement.parentNode; 4906 while (tempRelativeOrAbsoluteParent && (tempRelativeOrAbsoluteParent != document.documentElement)) { 4907 if((tempRelativeOrAbsoluteParent.style.position != 'relative') && (tempRelativeOrAbsoluteParent.style.position != 'absolute')) { 4908 tempRelativeOrAbsoluteParent = tempRelativeOrAbsoluteParent.parentNode; 4909 } else { 4910 this._relativeOrAbsoluteParentElement = tempRelativeOrAbsoluteParent; 4911 break; 4912 } 4913 } 4914 } 4915 4916 4917 // Disable TAB 4918 this.disableTab(); 4919 4920 this._layout(); 4921 // On pages that don't need scrollbars, Firefox and Safari act like 4922 // one or both are present the first time the layout code runs which 4923 // obviously leads to display issues - run the layout code a second 4924 // time to work around this problem 4925 this._layout(); 4926 4927 this.raiseShown(Sys.EventArgs.Empty); 4928 }, 4929 4930 disableTab : function() { 4931 /// <summary> 4932 /// Change the tab indices so we only tab through the modal popup 4933 /// (and hide SELECT tags in IE6) 4934 /// </summary> 4935 4936 var i = 0; 4937 var tagElements; 4938 var tagElementsInPopUp = new Array(); 4939 Array.clear(this._saveTabIndexes); 4940 4941 //Save all popup's tag in tagElementsInPopUp 4942 for (var j = 0; j < this._tagWithTabIndex.length; j++) { 4943 tagElements = this._foregroundElement.getElementsByTagName(this._tagWithTabIndex[j]); 4944 for (var k = 0 ; k < tagElements.length; k++) { 4945 tagElementsInPopUp[i] = tagElements[k]; 4946 i++; 4947 } 4948 } 4949 4950 i = 0; 4951 for (var j = 0; j < this._tagWithTabIndex.length; j++) { 4952 tagElements = document.getElementsByTagName(this._tagWithTabIndex[j]); 4953 for (var k = 0 ; k < tagElements.length; k++) { 4954 if (Array.indexOf(tagElementsInPopUp, tagElements[k]) == -1) { 4955 this._saveTabIndexes[i] = {tag: tagElements[k], index: tagElements[k].tabIndex}; 4956 tagElements[k].tabIndex="-1"; 4957 i++; 4958 } 4959 } 4960 } 4961
4962 //IE6 Bug with SELECT element always showing up on top 4963 i = 0; 4964 if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.version < 7)) { 4965 //Save SELECT in PopUp 4966 var tagSelectInPopUp = new Array(); 4967 for (var j = 0; j < this._tagWithTabIndex.length; j++) { 4968 tagElements = this._foregroundElement.getElementsByTagName('SELECT'); 4969 for (var k = 0 ; k < tagElements.length; k++) { 4970 tagSelectInPopUp[i] = tagElements[k]; 4971 i++; 4972 } 4973 } 4974 4975 i = 0; 4976 Array.clear(this._saveDesableSelect); 4977 tagElements = document.getElementsByTagName('SELECT'); 4978 for (var k = 0 ; k < tagElements.length; k++) { 4979 if (Array.indexOf(tagSelectInPopUp, tagElements[k]) == -1) { 4980 this._saveDesableSelect[i] = {tag: tagElements[k], visib: $common.getCurrentStyle(tagElements[k], 'visibility')} ; 4981 tagElements[k].style.visibility = 'hidden'; 4982 i++; 4983 } 4984 } 4985 } 4986 }, 4987 4988 restoreTab : function() { 4989 /// <summary> 4990 /// Restore the tab indices so we tab through the page like normal 4991 /// (and restore SELECT tags in IE6) 4992 /// </summary> 4993 4994 for (var i = 0; i < this._saveTabIndexes.length; i++) { 4995 this._saveTabIndexes[i].tag.tabIndex = this._saveTabIndexes[i].index; 4996 } 4997 Array.clear(this._saveTabIndexes); 4998 4999 //IE6 Bug with SELECT element always showing up on top 5000 if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.version < 7)) { 5001 for (var k = 0 ; k < this._saveDesableSelect.length; k++) { 5002 this._saveDesableSelect[k].tag.style.visibility = this._saveDesableSelect[k].visib; 5003 } 5004 Array.clear(this._saveDesableSelect); 5005 } 5006 }, 5007 5008 hide : function() { 5009 /// <summary> 5010 /// Hide the modal dialog 5011 /// </summary> 5012 /// <returns type="Boolean" mayBeNull="false"> 5013 /// Whether or not the dialog was hidden 5014 /// </returns> 5015 5016 var eventArgs = new Sys.CancelEventArgs(); 5017 this.raiseHiding(eventArgs); 5018 if (eventArgs.get_cancel()) { 5019 return false; 5020 } 5021 5022 this._hideImplementation(); 5023 5024 this.raiseHidden(Sys.EventArgs.Empty); 5025 return true; 5026 }, 5027 5028 _hideImplementation : function() { 5029 /// <summary> 5030 /// Internal implementation to hide the modal dialog 5031 /// </summary> 5032 5033 this._backgroundElement.style.display = 'none'; 5034 this._foregroundElement.style.display = 'none'; 5035 5036 this.restoreTab(); 5037 5038 this._detachPopup(); 5039 }, 5040 5041 _layout : function() { 5042 /// <summary> 5043 /// Position the modal dialog 5044 /// </summary> 5045 var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); 5046 var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 5047 5048 var clientBounds = $common.getClientBounds(); 5049 var clientWidth = clientBounds.width; 5050 var clientHeight = clientBounds.height; 5051 5052 // Setup the location of the background element 5053 this._layoutBackgroundElement(); 5054 5055 var xCoord = 0; 5056 var yCoord = 0; 5057 if(this._xCoordinate < 0) { 5058 var foregroundelementwidth = this._foregroundElement.offsetWidth? this._foregroundElement.offsetWidth: this._foregroundElement.scrollWidth; 5059 xCoord = ((clientWidth-foregroundelementwidth)/2); 5060 // workaround for drag behavior which calls setlocation which in turn 5061 // changes the position of the panel to be absolute and requiring us 5062 // to add the scrollLeft so that it is positioned correctly. 5063 if (this._foregroundElement.style.position == 'absolute') { 5064 xCoord += scrollLeft; 5065 } 5066 this._foregroundElement.style.left = xCoord + 'px'; 5067 5068 } else { 5069 if(this._isIE6) { 5070 this._foregroundElement.style.left = (this._xCoordinate + scrollLeft) + 'px'; 5071 xCoord = this._xCoordinate + scrollLeft; 5072 } 5073 else { 5074 this._foregroundElement.style.left = this._xCoordinate + 'px'; 5075 xCoord = this._xCoordinate; 5076 } 5077 } 5078 if(this._yCoordinate < 0) { 5079 var foregroundelementheight = this._foregroundElement.offsetHeight? this._foregroundElement.offsetHeight: this._foregroundElement.scrollHeight; 5080 yCoord = ((clientHeight-foregroundelementheight)/2); 5081 // workaround for drag behavior which calls setlocation which in turn 5082 // changes the position of the panel to be absolute and requiring us 5083 // to add the scrollLeft so that it is positioned correctly. 5084 if (this._foregroundElement.style.position == 'absolute') { 5085 yCoord += scrollTop; 5086 } 5087 this._foregroundElement.style.top = yCoord + 'px'; 5088 5089 } else { 5090 if(this._isIE6) { 5091 this._foregroundElement.style.top = (this._yCoordinate + scrollTop) + 'px'; 5092 yCoord = this._yCoordinate + scrollTop; 5093 } 5094 else { 5095 this._foregroundElement.style.top = this._yCoordinate + 'px'; 5096 yCoord = this._yCoordinate; 5097 } 5098 } 5099 5100 // make sure get location agrees with the location of the foreground element 5101 this._layoutForegroundElement(xCoord, yCoord); 5102 5103 if (this._dropShadowBehavior) { 5104 this._dropShadowBehavior.setShadow(); 5105 window.setTimeout(Function.createDelegate(this, this._fixupDropShadowBehavior), 0); 5106 } 5107 5108 // layout background element again to make sure it covers the whole background 5109 // in case things moved around when laying out the foreground element
5110 this._layoutBackgroundElement(); 5111 }, 5112 5113 _layoutForegroundElement : function(xCoord, yCoord) { 5114 /// <summary> 5115 /// Set the correct location of the foreground element to ensure that it is absolutely 5116 /// positioned with respect to the browser. This is just a workaround for IE 6 since 5117 /// elements nested in relative parents cause modal popup positioning issues and 'fixed' 5118 /// is not supported by IE 6. Hence we manually compute the right location of the popup. 5119 /// </summary> 5120 /// <param name="xCoord" type="Number" integer="true" maybenull="false"> 5121 /// <param name="yCoord" type="Number" integer="true" maybenull="false"> 5122 /// </params> 5123 5124 if (this._isIE6 && this._relativeOrAbsoluteParentElement) { 5125 var foregroundLocation = $common.getLocation(this._foregroundElement); 5126 var relativeParentLocation = $common.getLocation(this._relativeOrAbsoluteParentElement); 5127 var getLocationXCoord = foregroundLocation.x; 5128 if (getLocationXCoord != xCoord) { 5129 // offset it by that amount 5130 this._foregroundElement.style.left = (xCoord - relativeParentLocation.x) + 'px'; 5131 } 5132 5133 var getLocationYCoord = foregroundLocation.y; 5134 if (getLocationYCoord != yCoord) { 5135 // offset it by that amount 5136 this._foregroundElement.style.top = (yCoord - relativeParentLocation.y) + 'px'; 5137 } 5138 } 5139 }, 5140 5141 _layoutBackgroundElement : function() { 5142 /// <summary> 5143 /// Set the correct location of the background element to ensure that it is absolutely 5144 /// positioned with respect to the browser. 5145 /// </summary> 5146 5147 // Background element needs to cover the visible client area completely hence its 5148 // top and left coordinates need to be 0, and if relatively positioned its getlocation 5149 // value needs to be 0. 5150 if(this._isIE6) { 5151 var backgroundLocation = $common.getLocation(this._backgroundElement); 5152 var backgroundXCoord = backgroundLocation.x; 5153 if (backgroundXCoord != 0) { 5154 // offset it by that amount. This is assuming only one level of nesting. If 5155 // multiple parents with absolute/relative positioning are setup this may not 5156 // cover the whole background. 5157 this._backgroundElement.style.left = (-backgroundXCoord) + 'px'; 5158 } 5159 5160 var backgroundYCoord = backgroundLocation.y; 5161 if (backgroundYCoord != 0) { 5162 // offset it by that amount. This is assuming only one level of nesting. If 5163 // multiple parents with absolute/relative positioning are setup this may not 5164 // cover the whole background. 5165 this._backgroundElement.style.top = (-backgroundYCoord) + 'px'; 5166 } 5167 } 5168 var clientBounds = $common.getClientBounds(); 5169 var clientWidth = clientBounds.width; 5170 var clientHeight = clientBounds.height; 5171 this._backgroundElement.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth)+'px'; 5172 this._backgroundElement.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight)+'px'; 5173 }, 5174 5175 _fixupDropShadowBehavior : function() { 5176 /// <summary> 5177 /// Some browsers don't update the location values immediately, so 5178 /// the location of the drop shadow would always be a step behind 5179 /// without this method 5180 /// </summary> 5181 5182 if (this._dropShadowBehavior) { 5183 this._dropShadowBehavior.setShadow(); 5184 } 5185 }, 5186 5187 _partialUpdateEndRequest : function(sender, endRequestEventArgs) { 5188 /// <summary> 5189 /// Show the popup if requested during a partial postback 5190 /// </summary> 5191 /// <param name="sender" type="Object"> 5192 /// Sender 5193 /// </param> 5194 /// <param name="endRequestEventArgs" type="Sys.WebForms.EndRequestEventArgs"> 5195 /// Event arguments 5196 /// </param> 5197 /// <returns /> 5198 AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this, '_partialUpdateEndRequest', [sender, endRequestEventArgs]); 5199
5200 if (this.get_element()) { 5201 // Look up result by element's ID 5202 var action = endRequestEventArgs.get_dataItems()[this.get_element().id]; 5203 if ("show" == action) { 5204 this.show(); 5205 } else if ("hide" == action) { 5206 this.hide(); 5207 } 5208 } 5209 5210 // Async postback may have added content; re-layout to accomodate it 5211 this._layout(); 5212 }, 5213 5214 _onPopulated : function(sender, eventArgs) { 5215 /// <summary> 5216 /// Re-layout the popup after we've dynamically populated 5217 /// </summary> 5218 /// <param name="sender" type="Object"> 5219 /// Sender 5220 /// </param> 5221 /// <param name="eventArgs" type="Sys.EventArgs"> 5222 /// Event arguments 5223 /// </param> 5224 /// <returns /> 5225 AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this, '_onPopulated', [sender, eventArgs]); 5226 5227 // Dynamic populate may have added content; re-layout to accomodate it 5228 this._layout(); 5229 }, 5230 5231 get_PopupControlID : function() { 5232 /// <value type="String"> 5233 /// The ID of the element to display as a modal popup 5234 /// </value> 5235 return this._PopupControlID; 5236 }, 5237 set_PopupControlID : function(value) { 5238 if (this._PopupControlID != value) { 5239 this._PopupControlID = value; 5240 this.raisePropertyChanged('PopupControlID'); 5241 } 5242 }, 5243 5244 get_X: function() { 5245 /// <value type="Number" integer="true"> 5246 /// The number of pixels from the left of the browser to position the modal popup. 5247 /// </value> 5248 return this._xCoordinate; 5249 }, 5250 set_X: function(value) { 5251 if (this._xCoordinate != value) { 5252 this._xCoordinate = value; 5253 this.raisePropertyChanged('X'); 5254 } 5255 }, 5256 5257 get_Y: function() { 5258 /// <value type="Number" integer="true"> 5259 /// The number of pixels from the top of the browser to position the modal popup. 5260 /// </value> 5261 return this._yCoordinate; 5262 }, 5263 set_Y: function(value) { 5264 if (this._yCoordinate != value) { 5265 this._yCoordinate = value; 5266 this.raisePropertyChanged('Y'); 5267 } 5268 }, 5269 5270 get_PopupDragHandleControlID : function() { 5271 /// <value type="String"> 5272 /// The ID of the element to display as the drag handle for the modal popup 5273 /// </value> 5274 return this._PopupDragHandleControlID; 5275 }, 5276 set_PopupDragHandleControlID : function(value) { 5277 if (this._PopupDragHandleControlID != value) { 5278 this._PopupDragHandleControlID = value; 5279 this.raisePropertyChanged('PopupDragHandleControlID'); 5280 } 5281 }, 5282 5283 get_BackgroundCssClass : function() { 5284 /// <value type="String"> 5285 /// The CSS class to apply to the background when the modal popup is displayed 5286 /// </value>
5287 return this._BackgroundCssClass; 5288 }, 5289 set_BackgroundCssClass : function(value) { 5290 if (this._BackgroundCssClass != value) { 5291 this._BackgroundCssClass = value; 5292 this.raisePropertyChanged('BackgroundCssClass'); 5293 } 5294 }, 5295 5296 get_DropShadow : function() { 5297 /// <value type="Boolean"> 5298 /// Whether or not a drop-shadow should be added to the modal popup 5299 /// </value> 5300 return this._DropShadow; 5301 }, 5302 set_DropShadow : function(value) { 5303 if (this._DropShadow != value) { 5304 this._DropShadow = value; 5305 this.raisePropertyChanged('DropShadow'); 5306 } 5307 }, 5308 5309 get_Drag : function() { 5310 /// <value type="Boolean"> 5311 /// Obsolete: Setting the _Drag property is a noop 5312 /// </value> 5313 return this._Drag; 5314 }, 5315 set_Drag : function(value) { 5316 if (this._Drag != value) { 5317 this._Drag = value; 5318 this.raisePropertyChanged('Drag'); 5319 } 5320 }, 5321 5322 get_OkControlID : function() { 5323 /// <value type="String"> 5324 /// The ID of the element that dismisses the modal popup 5325 /// </value> 5326 return this._OkControlID; 5327 }, 5328 set_OkControlID : function(value) { 5329 if (this._OkControlID != value) { 5330 this._OkControlID = value; 5331 this.raisePropertyChanged('OkControlID'); 5332 } 5333 }, 5334 5335 get_CancelControlID : function() { 5336 /// <value type="String"> 5337 /// The ID of the element that cancels the modal popup 5338 /// </value> 5339 return this._CancelControlID; 5340 }, 5341 set_CancelControlID : function(value) { 5342 if (this._CancelControlID != value) { 5343 this._CancelControlID = value; 5344 this.raisePropertyChanged('CancelControlID'); 5345 } 5346 }, 5347 5348 get_OnOkScript : function() { 5349 /// <value type="String"> 5350 /// Script to run when the modal popup is dismissed with the OkControlID 5351 /// </value> 5352 return this._OnOkScript; 5353 }, 5354 set_OnOkScript : function(value) { 5355 if (this._OnOkScript != value) { 5356 this._OnOkScript = value; 5357 this.raisePropertyChanged('OnOkScript'); 5358 } 5359 }, 5360 5361 get_OnCancelScript : function() { 5362 /// <value type="String"> 5363 /// Script to run when the modal popup is dismissed with the CancelControlID 5364 /// </value> 5365 return this._OnCancelScript; 5366 }, 5367 set_OnCancelScript : function(value) { 5368 if (this._OnCancelScript != value) { 5369 this._OnCancelScript = value; 5370 this.raisePropertyChanged('OnCancelScript'); 5371 } 5372 }, 5373 5374 get_repositionMode : function() { 5375 /// <value type="AjaxControlToolkit.ModalPopupRepositionMode"> 5376 /// Determines if the ModalPopup should be repositioned on window resize/scroll 5377 /// </value> 5378 return this._repositionMode; 5379 }, 5380 set_repositionMode : function(value) { 5381 if (this._repositionMode !== value) { 5382 this._repositionMode = value; 5383 this.raisePropertyChanged('RepositionMode'); 5384 } 5385 }, 5386 5387 add_showing : function(handler) { 5388 /// <summary> 5389 /// Add an event handler for the showing event 5390 /// </summary> 5391 /// <param name="handler" type="Function" mayBeNull="false"> 5392 /// Event handler 5393 /// </param> 5394 /// <returns /> 5395 this.get_events().addHandler('showing', handler); 5396 }, 5397 remove_showing : function(handler) { 5398 /// <summary> 5399 /// Remove an event handler from the showing event 5400 /// </summary> 5401 /// <param name="handler" type="Function" mayBeNull="false"> 5402 /// Event handler 5403 /// </param> 5404 /// <returns /> 5405 this.get_events().removeHandler('showing', handler); 5406 }, 5407 raiseShowing : function(eventArgs) { 5408 /// <summary> 5409 /// Raise the showing event 5410 /// </summary> 5411 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 5412 /// Event arguments for the showing event 5413 /// </param> 5414 /// <returns /> 5415 5416 var handler = this.get_events().getHandler('showing'); 5417 if (handler) { 5418 handler(this, eventArgs); 5419 } 5420 }, 5421 5422 add_shown : function(handler) { 5423 /// <summary> 5424 /// Add an event handler for the shown event 5425 /// </summary> 5426 /// <param name="handler" type="Function" mayBeNull="false"> 5427 /// Event handler 5428 /// </param> 5429 /// <returns /> 5430 this.get_events().addHandler('shown', handler); 5431 }, 5432 remove_shown : function(handler) { 5433 /// <summary> 5434 /// Remove an event handler from the shown event 5435 /// </summary> 5436 /// <param name="handler" type="Function" mayBeNull="false"> 5437 /// Event handler 5438 /// </param> 5439 /// <returns /> 5440 this.get_events().removeHandler('shown', handler); 5441 }, 5442 raiseShown : function(eventArgs) { 5443 /// <summary> 5444 /// Raise the shown event 5445 /// </summary> 5446 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false"> 5447 /// Event arguments for the shown event 5448 /// </param> 5449 /// <returns /> 5450 5451 var handler = this.get_events().getHandler('shown'); 5452 if (handler) { 5453 handler(this, eventArgs); 5454 } 5455 }, 5456 5457 add_hiding : function(handler) { 5458 /// <summary> 5459 /// Add an event handler for the hiding event 5460 /// </summary> 5461 /// <param name="handler" type="Function" mayBeNull="false"> 5462 /// Event handler 5463 /// </param> 5464 /// <returns /> 5465 this.get_events().addHandler('hiding', handler); 5466 }, 5467 remove_hiding : function(handler) { 5468 /// <summary> 5469 /// Remove an event handler from the hiding event 5470 /// </summary> 5471 /// <param name="handler" type="Function" mayBeNull="false"> 5472 /// Event handler 5473 /// </param> 5474 /// <returns /> 5475 this.get_events().removeHandler('hiding', handler); 5476 }, 5477 raiseHiding : function(eventArgs) { 5478 /// <summary> 5479 /// Raise the hiding event 5480 /// </summary> 5481 /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> 5482 /// Event arguments for the hiding event 5483 /// </param> 5484 /// <returns /> 5485 5486 var handler = this.get_events().getHandler('hiding'); 5487 if (handler) { 5488 handler(this, eventArgs); 5489 } 5490 }, 5491 5492 add_hidden : function(handler) { 5493 /// <summary> 5494 /// Add an event handler for the hidden event 5495 /// </summary> 5496 /// <param name="handler" type="Function" mayBeNull="false"> 5497 /// Event handler 5498 /// </param> 5499 /// <returns /> 5500 this.get_events().addHandler('hidden', handler); 5501 }, 5502 remove_hidden : function(handler) { 5503 /// <summary> 5504 /// Remove an event handler from the hidden event 5505 /// </summary> 5506 /// <param name="handler" type="Function" mayBeNull="false"> 5507 /// Event handler 5508 /// </param> 5509 /// <returns /> 5510 this.get_events().removeHandler('hidden', handler); 5511 }, 5512 raiseHidden : function(eventArgs) { 5513 /// <summary> 5514 /// Raise the hidden event 5515 /// </summary> 5516 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false"> 5517 /// Event arguments for the hidden event 5518 /// </param> 5519 /// <returns /> 5520 5521 var handler = this.get_events().getHandler('hidden'); 5522 if (handler) { 5523 handler(this, eventArgs); 5524 } 5525 } 5526} 5527AjaxControlToolkit.ModalPopupBehavior.registerClass('AjaxControlToolkit.ModalPopupBehavior', AjaxControlToolkit.DynamicPopulateBehaviorBase); 5528 5529AjaxControlToolkit.ModalPopupBehavior.invokeViaServer = function(behaviorID, show) { 5530 /// <summary> 5531 /// This static function (that is intended to be called from script emitted 5532 /// on the server) will show or hide the behavior associated with behaviorID 5533 /// (i.e. to use this, the ModalPopupExtender must have an ID or BehaviorID) and 5534 /// will either show or hide depending on the show parameter. 5535 /// </summary> 5536 /// <param name="behaviorID" type="String"> 5537 /// ID of the modal popup behavior 5538 /// </param> 5539 /// <param name="show" type="Boolean"> 5540 /// Whether to show or hide the modal popup 5541 /// </param> 5542 var behavior = $find(behaviorID); 5543 if (behavior) { 5544 if (show) { 5545 behavior.show(); 5546 } else { 5547 behavior.hide(); 5548 } 5549 } 5550}
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.