/* START MicrosoftAjax.js */
//----------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------
// MicrosoftAjax.js
Function.__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._validateParams=function(e,c){var a;a=Function._validateParameterCount(e,c);if(a){a.popStackFrame();return a}for(var b=0;b<e.length;b++){var d=c[Math.min(b,c.length-1)],f=d.name;if(d.parameterArray)f+="["+(b-c.length+1)+"]";a=Function._validateParameter(e[b],d,f);if(a){a.popStackFrame();return a}}return null};Function._validateParameterCount=function(e,a){var c=a.length,d=0;for(var b=0;b<a.length;b++)if(a[b].parameterArray)c=Number.MAX_VALUE;else if(!a[b].optional)d++;if(e.length<d||e.length>c){var f=Error.parameterCount();f.popStackFrame();return f}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(a,c,n,m,k,d){var b;if(typeof a==="undefined")if(k)return null;else{b=Error.argumentUndefined(d);b.popStackFrame();return b}if(a===null)if(k)return null;else{b=Error.argumentNull(d);b.popStackFrame();return b}if(c&&c.__enum){if(typeof a!=="number"){b=Error.argumentType(d,Object.getType(a),c);b.popStackFrame();return b}if(a%1===0){var e=c.prototype;if(!c.__flags||a===0){for(var i in e)if(e[i]===a)return null}else{var l=a;for(var i in e){var f=e[i];if(f===0)continue;if((f&a)===f)l-=f;if(l===0)return null}}}b=Error.argumentOutOfRange(d,a,String.format(Sys.Res.enumInvalidValue,a,c.getName()));b.popStackFrame();return b}if(m){var h;if(typeof a.nodeType!=="number"){var g=a.ownerDocument||a.document||a;if(g!=a){var j=g.defaultView||g.parentWindow;h=j!=a&&!(j.document&&a.document&&j.document===a.document)}else h=typeof g.body==="undefined"}else h=a.nodeType===3;if(h){b=Error.argument(d,Sys.Res.argumentDomElement);b.popStackFrame();return b}}if(c&&!c.isInstanceOfType(a)){b=Error.argumentType(d,Object.getType(a),c);b.popStackFrame();return b}if(c===Number&&n)if(a%1!==0){b=Error.argumentOutOfRange(d,a,Sys.Res.argumentInteger);b.popStackFrame();return b}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};Error.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;Object.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.localeFormat=function(){return String._toFormattedString(true,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;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);switch(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";if(b.length===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.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)}return b};Date._expandYear=function(c,a){if(a<100){var b=(new Date).getFullYear();a+=b-b%100;if(a>c.Calendar.TwoDigitYearMax)return a-100}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":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?)")}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/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(g,c,h){var e=false;for(var a=1,i=h.length;a<i;a++){var f=h[a];if(f){e=true;var b=Date._parseExact(g,f,c);if(b)return b}}if(!e){var d=c._getDateTimeFormats();for(var a=0,i=d.length;a<i;a++){var b=Date._parseExact(g,d[a],c);if(b)return b}}return null};Date._parseExact=function(s,y,j){s=s.trim();var m=j.dateTimeFormat,v=Date._getParseRegExp(m,y),x=(new RegExp(v.regExp)).exec(s);if(x===null)return null;var w=v.groups,f=null,c=null,h=null,g=null,d=0,n=0,o=0,e=0,k=null,r=false;for(var p=0,z=w.length;p<z;p++){var a=x[p+1];if(a)switch(w[p]){case "dd":case "d":h=parseInt(a,10);if(h<1||h>31)return null;break;case "MMMM":c=j._getMonthIndex(a);if(c<0||c>11)return null;break;case "MMM":c=j._getAbbrMonthIndex(a);if(c<0||c>11)return null;break;case "M":case "MM":var c=parseInt(a,10)-1;if(c<0||c>11)return null;break;case "y":case "yy":f=Date._expandYear(m,parseInt(a,10));if(f<0||f>9999)return null;break;case "yyyy":f=parseInt(a,10);if(f<0||f>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":n=parseInt(a,10);if(n<0||n>59)return null;break;case "s":case "ss":o=parseInt(a,10);if(o<0||o>59)return null;break;case "tt":case "t":var u=a.toUpperCase();r=u===m.PMDesignator.toUpperCase();if(!r&&u!==m.AMDesignator.toUpperCase())return null;break;case "f":e=parseInt(a,10)*100;if(e<0||e>999)return null;break;case "ff":e=parseInt(a,10)*10;if(e<0||e>999)return null;break;case "fff":e=parseInt(a,10);if(e<0||e>999)return null;break;case "dddd":g=j._getDayIndex(a);if(g<0||g>6)return null;break;case "ddd":g=j._getAbbrDayIndex(a);if(g<0||g>6)return null;break;case "zzz":var q=a.split(/:/);if(q.length!==2)return null;var i=parseInt(q[0],10);if(i<-12||i>13)return null;var l=parseInt(q[1],10);if(l<0||l>59)return null;k=i*60+(a.startsWith("-")?-l:l);break;case "z":case "zz":var i=parseInt(a,10);if(i<-12||i>13)return null;k=i*60}}var b=new Date;if(f===null)f=b.getFullYear();if(c===null)c=b.getMonth();if(h===null)h=b.getDate();b.setFullYear(f,c,h);if(b.getDate()!==h)return null;if(g!==null&&b.getDay()!==g)return null;if(r&&d<12)d+=12;b.setHours(d,n,o,e);if(k!==null){var t=b.getMinutes()-(k+b.getTimezoneOffset());b.setHours(b.getHours()+parseInt(t/60,10),t%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,h){if(!e||e.length===0||e==="i")if(h&&h.name.length>0)return this.toLocaleString();else return this.toString();var d=h.dateTimeFormat;e=Date._expandFormat(d,e);var a=new Sys.StringBuilder,b;function c(a){if(a<10)return "0"+a;return a.toString()}function g(a){if(a<10)return "00"+a;if(a<100)return "0"+a;return a.toString()}var j=0,i=Date._getTokenRegExp();for(;true;){var l=i.lastIndex,f=i.exec(e),k=e.slice(l,f?f.index:e.length);j+=Date._appendPreOrPostMatch(k,a);if(!f)break;if(j%2===1){a.append(f[0]);continue}switch(f[0]){case "dddd":a.append(d.DayNames[this.getDay()]);break;case "ddd":a.append(d.AbbreviatedDayNames[this.getDay()]);break;case "dd":a.append(c(this.getDate()));break;case "d":a.append(this.getDate());break;case "MMMM":a.append(d.MonthNames[this.getMonth()]);break;case "MMM":a.append(d.AbbreviatedMonthNames[this.getMonth()]);break;case "MM":a.append(c(this.getMonth()+1));break;case "M":a.append(this.getMonth()+1);break;case "yyyy":a.append(this.getFullYear());break;case "yy":a.append(c(this.getFullYear()%100));break;case "y":a.append(this.getFullYear()%100);break;case "hh":b=this.getHours()%12;if(b===0)b=12;a.append(c(b));break;case "h":b=this.getHours()%12;if(b===0)b=12;a.append(b);break;case "HH":a.append(c(this.getHours()));break;case "H":a.append(this.getHours());break;case "mm":a.append(c(this.getMinutes()));break;case "m":a.append(this.getMinutes());break;case "ss":a.append(c(this.getSeconds()));break;case "s":a.append(this.getSeconds());break;case "tt":a.append(this.getHours()<12?d.AMDesignator:d.PMDesignator);break;case "t":a.append((this.getHours()<12?d.AMDesignator:d.PMDesignator).charAt(0));break;case "f":a.append(g(this.getMilliseconds()).charAt(0));break;case "ff":a.append(g(this.getMilliseconds()).substr(0,2));break;case "fff":a.append(g(this.getMilliseconds()));break;case "z":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+Math.floor(Math.abs(b)));break;case "zz":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+c(Math.floor(Math.abs(b))));break;case "zzz":b=this.getTimezoneOffset()/60;a.append((b<=0?"+":"-")+c(Math.floor(Math.abs(b)))+d.TimeSeparator+c(Math.abs(this.getTimezoneOffset()%60)))}}return a.toString()};Number.__typeName="Number";Number.__class=true;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," ");if(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(d,j){if(!d||d.length===0||d==="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,e=Math.abs(this);if(!d)d="D";var b=-1;if(d.length>1)b=parseInt(d.slice(1),10);var c;switch(d.charAt(0)){case "d":case "D":c="n";if(b!==-1)e=g(""+e,b,true);if(this<0)e=-e;break;case "c":case "C":if(this<0)c=l[a.CurrencyNegativePattern];else c=m[a.CurrencyPositivePattern];if(b===-1)b=a.CurrencyDecimalDigits;e=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;e=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;e=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+=e;break;case "$":f+=a.CurrencySymbol;break;case "-":f+=a.NegativeSign;break;case "%":f+=a.PercentSymbol}}return f};RegExp.__typeName="RegExp";RegExp.__class=true;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 Array.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(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};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=Array.indexOf(b,c);if(a>=0)b.splice(a,1);return a>=0};Array.removeAt=function(a,b){a.splice(b,1)};if(!window)this.window=this;window.Type=Function;Type.prototype.callBaseMethod=function(a,d,b){var c=this.getBaseMethod(a,d);if(!b)return c.apply(a);else return c.apply(a,b)};Type.prototype.getBaseMethod=function(d,c){var b=this.getBaseType();if(b){var a=b.prototype[c];return a instanceof Function?a:null}return null};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(b){if(typeof b==="undefined"||b===null)return false;if(b instanceof this)return true;var a=Object.getType(b);return !!(a===this)||a.inheritsFrom&&a.inheritsFrom(this)||a.implementsInterface&&a.implementsInterface(this)};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};Type.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(f){var d=window,c=f.split(".");for(var b=0;b<c.length;b++){var e=c[b],a=d[e];if(!a){a=d[e]={__namespace:true,__typeName:c.slice(0,b+1).join(".")};if(b===0)Sys.__rootNamespaces[Sys.__rootNamespaces.length]=a;a.getName=function(){return this.__typeName}}d=a}};window.Sys={__namespace:true,__typeName:"Sys",getName:function(){return "Sys"},__upperCaseTypes:{}};Sys.__rootNamespaces=[Sys];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");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};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(/AppleWebKit\/(\d+(\.\d+)?)/)[1]);Sys.Browser.name="Safari"}else if(navigator.userAgent.indexOf("Opera/")>-1)Sys.Browser.agent=Sys.Browser.Opera;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};Type.isFlags=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__flags};Sys.EventHandlerList=function(){this._list={}};Sys.EventHandlerList.prototype={addHandler:function(b,a){Array.add(this._getEvent(b,true),a)},removeHandler:function(c,b){var a=this._getEvent(c);if(!a)return;Array.remove(a,b)},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.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);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.x=a;this.y=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");Sys.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){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}},$addHandlers=Sys.UI.DomEvent.addHandlers=function(e,d,c){for(var b in d){var a=d[b];if(c)a=Function.createDelegate(c,a);$addHandler(e,b,a)}},$clearHandlers=Sys.UI.DomEvent.clearHandlers=function(a){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--)$removeHandler(a,b,d[c].handler)}a._events=null}},$removeHandler=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};switch(Sys.Browser.agent){case Sys.Browser.InternetExplorer:Sys.UI.DomElement.getLocation=function(a){if(a.self||a.nodeType===9)return new Sys.UI.Point(0,0);var b=a.getBoundingClientRect();if(!b)return new Sys.UI.Point(0,0);var d=a.ownerDocument.documentElement,e=b.left-2+d.scrollLeft,f=b.top-2+d.scrollTop;try{var c=a.ownerDocument.parentWindow.frameElement||null;if(c){var g=c.frameBorder==="0"||c.frameBorder==="no"?2:0;e+=g;f+=g}}catch(h){}return new Sys.UI.Point(e,f)};break;case 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 f=0,g=0,j=null,e=null,b;for(var a=c;a;j=a,(e=b,a=a.offsetParent)){b=Sys.UI.DomElement._getCurrentStyle(a);var d=a.tagName?a.tagName.toUpperCase():null;if((a.offsetLeft||a.offsetTop)&&(d!=="BODY"||(!e||e.position!=="absolute"))){f+=a.offsetLeft;g+=a.offsetTop}}b=Sys.UI.DomElement._getCurrentStyle(c);var h=b?b.position:null;if(!h||h!=="absolute")for(var a=c.parentNode;a;a=a.parentNode){d=a.tagName?a.tagName.toUpperCase():null;if(d!=="BODY"&&d!=="HTML"&&(a.scrollLeft||a.scrollTop)){f-=a.scrollLeft||0;g-=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(f,g)};break;case Sys.Browser.Opera:Sys.UI.DomElement.getLocation=function(b){if(b.window&&b.window===b||b.nodeType===9)return new Sys.UI.Point(0,0);var d=0,e=0,i=null;for(var a=b;a;i=a,a=a.offsetParent){var f=a.tagName;d+=a.offsetLeft||0;e+=a.offsetTop||0}var g=b.style.position,c=g&&g!=="static";for(var a=b.parentNode;a;a=a.parentNode){f=a.tagName?a.tagName.toUpperCase():null;if(f!=="BODY"&&f!=="HTML"&&(a.scrollLeft||a.scrollTop)&&(c&&(a.style.overflow==="scroll"||a.style.overflow==="auto"))){d-=a.scrollLeft||0;e-=a.scrollTop||0}var h=a&&a.style?a.style.position:null;c=c||h&&h!=="static"}return new Sys.UI.Point(d,e)};break;default: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,i=null,g=null,b=null;for(var 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(var 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.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.setLocation=function(b,c,d){var a=b.style;a.position="absolute";a.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._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()},notifyScriptLoaded:function(){if(!this._loading)return;this._currentTask._notified++;if(Sys.Browser.agent===Sys.Browser.Safari)if(this._currentTask._notified===1)window.setTimeout(Function.createDelegate(this,function(){this._scriptLoadedHandler(this._currentTask.get_scriptElement(),true)}),0)},queueCustomScriptTag:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,a)},queueScriptBlock:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{text:a})},queueScriptReference:function(a){if(!this._scriptsToLoad)this._scriptsToLoad=[];Array.add(this._scriptsToLoad,{src:a})},_createScriptElement:function(c){var a=document.createElement("script");a.type="text/javascript";for(var b in c)a[b]=c[b];return a},_loadScriptsInternal:function(){var b=this._currentSession;if(b.scriptsToLoad&&b.scriptsToLoad.length>0){var c=Array.dequeue(b.scriptsToLoad),a=this._createScriptElement(c);if(a.text&&Sys.Browser.agent===Sys.Browser.Safari){a.innerHTML=a.text;delete a.text}if(typeof c.src==="string"){this._currentTask=new Sys._ScriptLoaderTask(a,this._scriptLoadedDelegate);this._currentTask.execute()}else{document.getElementsByTagName("head")[0].appendChild(a);Sys._ScriptLoader._clearScript(a);this._loadScriptsInternal()}}else{this._stopSession();var d=b.allScriptsLoadedCallback;if(d)d(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(a){var c=this._currentSession.scriptLoadFailedCallback,b=this._currentTask.get_scriptElement();this._stopSession();if(c){c(this,b,a);this._nextSession()}else{this._loading=false;throw Sys._ScriptLoader._errorScriptLoadFailed(b.src,a)}},_scriptLoadedHandler:function(a,b){if(b&&this._currentTask._notified)if(this._currentTask._notified>1)this._raiseError(true);else{Array.add(Sys._ScriptLoader._getLoadedScripts(),a.src);this._currentTask.dispose();this._currentTask=null;this._loadScriptsInternal()}else this._raiseError(false)},_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 b=Sys._ScriptLoader._referencedScripts=[],c=document.getElementsByTagName("script");for(i=c.length-1;i>=0;i--){var d=c[i],a=d.src;if(a.length)if(!Array.contains(b,a))Array.add(b,a)}}};Sys._ScriptLoader._clearScript=function(a){if(!Sys.Debug.isDebug)a.parentNode.removeChild(a)};Sys._ScriptLoader._errorScriptLoadFailed=function(b,d){var a;if(d)a=Sys.Res.scriptLoadMultipleCallbacks;else a=Sys.Res.scriptLoadFailed;var e="Sys.ScriptLoadFailedException: "+String.format(a,b),c=Error.create(e,{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._ScriptLoaderTask=function(b,a){this._scriptElement=b;this._completedCallback=a;this._notified=0};Sys._ScriptLoaderTask.prototype={get_scriptElement:function(){return this._scriptElement},dispose:function(){if(this._disposed)return;this._disposed=true;this._removeScriptElementHandlers();Sys._ScriptLoader._clearScript(this._scriptElement);this._scriptElement=null},execute:function(){this._addScriptElementHandlers();document.getElementsByTagName("head")[0].appendChild(this._scriptElement)},_addScriptElementHandlers:function(){this._scriptLoadDelegate=Function.createDelegate(this,this._scriptLoadHandler);if(Sys.Browser.agent!==Sys.Browser.InternetExplorer){this._scriptElement.readyState="loaded";$addHandler(this._scriptElement,"load",this._scriptLoadDelegate)}else $addHandler(this._scriptElement,"readystatechange",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(Sys.Browser.agent!==Sys.Browser.InternetExplorer)$removeHandler(a,"load",this._scriptLoadDelegate);else $removeHandler(a,"readystatechange",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(a.readyState!=="loaded"&&a.readyState!=="complete")return;var b=this;window.setTimeout(function(){b._completedCallback(a,true)},0)}};Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask",null,Sys.IDisposable);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.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=function(){Sys._Application.initializeBase(this);this._disposableObjects=[];this._components={};this._createdComponents=[];this._secondPassComponents=[];this._appLoadHandler=null;this._beginRequestHandler=null;this._clientId=null;this._currentEntry="";this._endRequestHandler=null;this._history=null;this._enableHistory=false;this._historyFrame=null;this._historyInitialized=false;this._historyInitialLength=0;this._historyLength=0;this._historyPointIsNew=false;this._ignoreTimer=false;this._initialState=null;this._state={};this._timerCookie=0;this._timerHandler=null;this._uniqueId=null;this._unloadHandlerDelegate=Function.createDelegate(this,this._unloadHandler);this._loadHandlerDelegate=Function.createDelegate(this,this._loadHandler);Sys.UI.DomEvent.addHandler(window,"unload",this._unloadHandlerDelegate);Sys.UI.DomEvent.addHandler(window,"load",this._loadHandlerDelegate)};Sys._Application.prototype={_creatingComponents:false,_disposing:false,get_isCreatingComponents:function(){return this._creatingComponents},get_stateString:function(){var a=window.location.hash;if(this._isSafari2()){var b=this._getHistory();if(b)a=b[window.history.length-this._historyInitialLength]}if(a.length>0&&a.charAt(0)==="#")a=a.substring(1);if(Sys.Browser.agent===Sys.Browser.Firefox)a=this._serializeState(this._deserializeState(a,true));return a},get_enableHistory:function(){return this._enableHistory},set_enableHistory:function(a){this._enableHistory=a},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_navigate:function(a){this.get_events().addHandler("navigate",a)},remove_navigate:function(a){this.get_events().removeHandler("navigate",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},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()},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,e=b.length;a<e;a++)b[a].dispose();Array.clear(this._disposableObjects);Sys.UI.DomEvent.removeHandler(window,"unload",this._unloadHandlerDelegate);if(this._loadHandlerDelegate){Sys.UI.DomEvent.removeHandler(window,"load",this._loadHandlerDelegate);this._loadHandlerDelegate=null}var d=Sys._ScriptLoader.getInstance();if(d)d.dispose();Sys._Application.callBaseMethod(this,"dispose")}},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._initialized&&!this._initializing){this._initializing=true;window.setTimeout(Function.createDelegate(this,this._doInitialize),0)}},notifyScriptLoaded:function(){var a=Sys._ScriptLoader.getInstance();if(a)a.notifyScriptLoaded()},registerDisposableObject:function(a){if(!this._disposing)this._disposableObjects[this._disposableObjects.length]=a},raiseLoad:function(){var b=this.get_events().getHandler("load"),a=new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents),!this._initializing);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]},setServerId:function(a,b){this._clientId=a;this._uniqueId=b},setServerState:function(a){this._ensureHistory();this._state.__s=a;this._updateHiddenField(a)},unregisterDisposableObject:function(a){if(!this._disposing)Array.remove(this._disposableObjects,a)},_addComponentToSecondPass:function(b,a){this._secondPassComponents[this._secondPassComponents.length]={component:b,references:a}},_deserializeState:function(a,i){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,k=g.length;f<k;f++){var d=g[f],c=d.indexOf("=");if(c!==-1&&c+1<d.length){var j=d.substr(0,c),h=d.substr(c+1);e[j]=i?h:decodeURIComponent(h)}}return e},_doInitialize:function(){Sys._Application.callBaseMethod(this,"initialize");var b=this.get_events().getHandler("init");if(b){this.beginCreateComponents();b(this,Sys.EventArgs.Empty);this.endCreateComponents()}if(Sys.WebForms){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);this.raiseLoad();this._initializing=false},_enableHistoryInScriptManager:function(){this._enableHistory=true},_ensureHistory:function(){if(!this._historyInitialized&&this._enableHistory){if(Sys.Browser.agent===Sys.Browser.InternetExplorer&&Sys.Browser.documentMode<8){this._historyFrame=document.getElementById("__historyFrame");this._ignoreIFrame=true}if(this._isSafari2()){var a=document.getElementById("__history");this._setHistory([window.location.hash]);this._historyInitialLength=window.history.length}this._timerHandler=Function.createDelegate(this,this._onIdle);this._timerCookie=window.setTimeout(this._timerHandler,100);try{this._initialState=this._deserializeState(this.get_stateString())}catch(b){}this._historyInitialized=true}},_getHistory:function(){var a=document.getElementById("__history");if(!a)return "";var b=a.value;return b?Sys.Serialization.JavaScriptSerializer.deserialize(b,true):""},_isSafari2:function(){return Sys.Browser.agent===Sys.Browser.Safari&&Sys.Browser.version<=419.3},_loadHandler:function(){if(this._loadHandlerDelegate){Sys.UI.DomEvent.removeHandler(window,"load",this._loadHandlerDelegate);this._loadHandlerDelegate=null}this.initialize()},_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()},_onIdle:function(){delete this._timerCookie;var a=this.get_stateString();if(a!==this._currentEntry){if(!this._ignoreTimer){this._historyPointIsNew=false;this._navigate(a);this._historyLength=window.history.length}}else this._ignoreTimer=false;this._timerCookie=window.setTimeout(this._timerHandler,100)},_onIFrameLoad:function(a){this._ensureHistory();if(!this._ignoreIFrame){this._historyPointIsNew=false;this._navigate(a)}this._ignoreIFrame=false},_onPageRequestManagerBeginRequest:function(){this._ignoreTimer=true},_onPageRequestManagerEndRequest:function(e,d){var b=d.get_dataItems()[this._clientId],a=document.getElementById("__EVENTTARGET");if(a&&a.value===this._uniqueId)a.value="";if(typeof b!=="undefined"){this.setServerState(b);this._historyPointIsNew=true}else this._ignoreTimer=false;var c=this._serializeState(this._state);if(c!==this._currentEntry){this._ignoreTimer=true;this._setState(c);this._raiseNavigate()}},_raiseNavigate:function(){var c=this.get_events().getHandler("navigate"),b={};for(var a in this._state)if(a!=="__s")b[a]=this._state[a];var d=new Sys.HistoryEventArgs(b);if(c)c(this,d)},_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:"")},_setHistory:function(b){var a=document.getElementById("__history");if(a)a.value=Sys.Serialization.JavaScriptSerializer.serialize(b)},_setState:function(a,c){a=a||"";if(a!==this._currentEntry){if(window.theForm){var e=window.theForm.action,f=e.indexOf("#");window.theForm.action=(f!==-1?e.substring(0,f):e)+"#"+a}if(this._historyFrame&&this._historyPointIsNew){this._ignoreIFrame=true;this._historyPointIsNew=false;var d=this._historyFrame.contentWindow.document;d.open("javascript:'<html></html>'");d.write("<html><head><title>"+(c||document.title)+"</title><scri"+'pt type="text/javascript">parent.Sys.Application._onIFrameLoad(\''+a+"');</scri"+"pt></head><body></body></html>");d.close()}this._ignoreTimer=false;var h=this.get_stateString();this._currentEntry=a;if(a!==h){if(this._isSafari2()){var g=this._getHistory();g[window.history.length-this._historyInitialLength+1]=a;this._setHistory(g);this._historyLength=window.history.length+1;var b=document.createElement("form");b.method="get";b.action="#"+a;document.appendChild(b);b.submit();document.removeChild(b)}else window.location.hash=a;if(typeof c!=="undefined"&&c!==null)document.title=c}}},_unloadHandler:function(){this.dispose()},_updateHiddenField:function(b){if(this._clientId){var a=document.getElementById(this._clientId);if(a)a.value=b}}};Sys._Application.registerClass("Sys._Application",Sys.Component,Sys.IContainer);Sys.Application=new Sys._Application;var $find=Sys.Application.findComponent;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){}}else 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")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);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)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");if(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(d,b){if(!b)b=encodeURIComponent;var a=new Sys.StringBuilder,f=0;for(var c in d){var e=d[c];if(typeof e==="function")continue;var g=Sys.Serialization.JavaScriptSerializer.serialize(e);if(f!==0)a.append("&");a.append(c);a.append("=");a.append(b(g));f++}return a.toString()};Sys.Net.WebRequest._createUrl=function(a,b){if(!b)return a;var d=Sys.Net.WebRequest._createQueryString(b);if(d.length>0){var c="?";if(a&&a.indexOf("?")!==-1)c="&";return a+c+d}else return a};Sys.Net.WebRequest.registerClass("Sys.Net.WebRequest");Sys.Net.WebServiceProxy=function(){};Sys.Net.WebServiceProxy.prototype={get_timeout:function(){return this._timeout},set_timeout:function(a){if(a<0)throw Error.argumentOutOfRange("value",a,Sys.Res.invalidTimeout);this._timeout=a},get_defaultUserContext:function(){return this._userContext},set_defaultUserContext:function(a){this._userContext=a},get_defaultSucceededCallback:function(){return this._succeeded},set_defaultSucceededCallback:function(a){this._succeeded=a},get_defaultFailedCallback:function(){return this._failed},set_defaultFailedCallback:function(a){this._failed=a},get_path:function(){return this._path},set_path:function(a){this._path=a},_invoke:function(d,e,g,f,c,b,a){if(c===null||typeof c==="undefined")c=this.get_defaultSucceededCallback();if(b===null||typeof b==="undefined")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())}};Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy");Sys.Net.WebServiceProxy.invoke=function(k,a,j,d,i,c,f,h){var b=new Sys.Net.WebRequest;b.get_headers()["Content-Type"]="application/json; charset=utf-8";if(!d)d={};var g=d;if(!j||!g)g={};b.set_url(Sys.Net.WebRequest._createUrl(k+"/"+encodeURIComponent(a),g));var e=null;if(!j){e=Sys.Serialization.JavaScriptSerializer.serialize(d);if(e==="{}")e=""}b.set_body(e);b.add_completed(l);if(h&&h>0)b.set_timeout(h);b.invoke();function l(d){if(d.get_responseAvailable()){var g=d.get_statusCode(),b=null;try{var e=d.getResponseHeader("Content-Type");if(e.startsWith("application/json"))b=d.get_object();else if(e.startsWith("text/xml"))b=d.get_xml();else b=d.get_responseData()}catch(m){}var k=d.getResponseHeader("jsonerror"),h=k==="true";if(h){if(b)b=new Sys.Net.WebServiceError(false,b.Message,b.StackTrace,b.ExceptionType)}else if(e.startsWith("application/json"))b=b.d;if(g<200||g>=300||h){if(c){if(!b||!h)b=new Sys.Net.WebServiceError(false,String.format(Sys.Res.webServiceFailedNoMsg,a),"","");b._statusCode=g;c(b,f,a)}}else if(i)i(b,f,a)}else{var j;if(d.get_timedOut())j=String.format(Sys.Res.webServiceTimedOut,a);else j=String.format(Sys.Res.webServiceFailedNoMsg,a);if(c)c(new Sys.Net.WebServiceError(d.get_timedOut(),j,"",""),f,a)}}return b};Sys.Net.WebServiceProxy._generateTypedConstructor=function(a){return function(b){if(b)for(var c in b)this[c]=b[c];this.__type=a}};Sys.Net.WebServiceError=function(c,d,b,a){this._timedOut=c;this._message=d;this._stackTrace=b;this._exceptionType=a;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}};Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError");Type.registerNamespace("Sys.Services");Sys.Services._ProfileService=function(){Sys.Services._ProfileService.initializeBase(this);this.properties={}};Sys.Services._ProfileService.DefaultWebServicePath="";Sys.Services._ProfileService.prototype={_defaultLoadCompletedCallback:null,_defaultSaveCompletedCallback:null,_path:"",_timeout:0,get_defaultLoadCompletedCallback:function(){return this._defaultLoadCompletedCallback},set_defaultLoadCompletedCallback:function(a){this._defaultLoadCompletedCallback=a},get_defaultSaveCompletedCallback:function(){return this._defaultSaveCompletedCallback},set_defaultSaveCompletedCallback:function(a){this._defaultSaveCompletedCallback=a},get_path:function(){return this._path||""},load:function(c,d,e,f){var b,a;if(!c){a="GetAllPropertiesForCurrentUser";b={authenticatedUserOnly:false}}else{a="GetPropertiesForCurrentUser";b={properties:this._clonePropertyNames(c),authenticatedUserOnly:false}}this._invoke(this._get_path(),a,false,b,Function.createDelegate(this,this._onLoadComplete),Function.createDelegate(this,this._onLoadFailed),[d,e,f])},save:function(d,b,c,e){var a=this._flattenProperties(d,this.properties);this._invoke(this._get_path(),"SetPropertiesForCurrentUser",false,{values:a.value,authenticatedUserOnly:false},Function.createDelegate(this,this._onSaveComplete),Function.createDelegate(this,this._onSaveFailed),[b,c,e,a.count])},_clonePropertyNames:function(e){var c=[],d={};for(var b=0;b<e.length;b++){var a=e[b];if(!d[a]){Array.add(c,a);d[a]=true}}return c},_flattenProperties:function(a,i,j){var b={},e,d,g=0;if(a&&a.length===0)return {value:b,count:0};for(var c in i){e=i[c];d=j?j+"."+c:c;if(Sys.Services.ProfileGroup.isInstanceOfType(e)){var k=this._flattenProperties(a,e,d),h=k.value;g+=k.count;for(var f in h){var l=h[f];b[f]=l}}else if(!a||Array.indexOf(a,d)!==-1){b[d]=e;g++}}return {value:b,count:g}},_get_path:function(){var a=this.get_path();if(!a.length)a=Sys.Services._ProfileService.DefaultWebServicePath;if(!a||!a.length)throw Error.invalidOperation(Sys.Res.servicePathNotSet);return a},_onLoadComplete:function(a,e,g){if(typeof a!=="object")throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,g,"Object"));var c=this._unflattenProperties(a);for(var b in c)this.properties[b]=c[b];var d=e[0]||this.get_defaultLoadCompletedCallback()||this.get_defaultSucceededCallback();if(d){var f=e[2]||this.get_defaultUserContext();d(a.length,f,"Sys.Services.ProfileService.load")}},_onLoadFailed:function(d,b){var a=b[1]||this.get_defaultFailedCallback();if(a){var c=b[2]||this.get_defaultUserContext();a(d,c,"Sys.Services.ProfileService.load")}},_onSaveComplete:function(a,b,f){var c=b[3];if(a!==null)if(a instanceof Array)c-=a.length;else if(typeof a==="number")c=a;else throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,f,"Array"));var d=b[0]||this.get_defaultSaveCompletedCallback()||this.get_defaultSucceededCallback();if(d){var e=b[2]||this.get_defaultUserContext();d(c,e,"Sys.Services.ProfileService.save")}},_onSaveFailed:function(d,b){var a=b[1]||this.get_defaultFailedCallback();if(a){var c=b[2]||this.get_defaultUserContext();a(d,c,"Sys.Services.ProfileService.save")}},_unflattenProperties:function(e){var c={},d,f,h=0;for(var a in e){h++;f=e[a];d=a.indexOf(".");if(d!==-1){var g=a.substr(0,d);a=a.substr(d+1);var b=c[g];if(!b||!Sys.Services.ProfileGroup.isInstanceOfType(b)){b=new Sys.Services.ProfileGroup;c[g]=b}b[a]=f}else c[a]=f}e.length=h;return c}};Sys.Services._ProfileService.registerClass("Sys.Services._ProfileService",Sys.Net.WebServiceProxy);Sys.Services.ProfileService=new Sys.Services._ProfileService;Sys.Services.ProfileGroup=function(a){if(a)for(var b in a)this[b]=a[b]};Sys.Services.ProfileGroup.registerClass("Sys.Services.ProfileGroup");Sys.Services._AuthenticationService=function(){Sys.Services._AuthenticationService.initializeBase(this)};Sys.Services._AuthenticationService.DefaultWebServicePath="";Sys.Services._AuthenticationService.prototype={_defaultLoginCompletedCallback:null,_defaultLogoutCompletedCallback:null,_path:"",_timeout:0,_authenticated:false,get_defaultLoginCompletedCallback:function(){return this._defaultLoginCompletedCallback},set_defaultLoginCompletedCallback:function(a){this._defaultLoginCompletedCallback=a},get_defaultLogoutCompletedCallback:function(){return this._defaultLogoutCompletedCallback},set_defaultLogoutCompletedCallback:function(a){this._defaultLogoutCompletedCallback=a},get_isLoggedIn:function(){return this._authenticated},get_path:function(){return this._path||""},login:function(c,b,a,h,f,d,e,g){this._invoke(this._get_path(),"Login",false,{userName:c,password:b,createPersistentCookie:a},Function.createDelegate(this,this._onLoginComplete),Function.createDelegate(this,this._onLoginFailed),[c,b,a,h,f,d,e,g])},logout:function(c,a,b,d){this._invoke(this._get_path(),"Logout",false,{},Function.createDelegate(this,this._onLogoutComplete),Function.createDelegate(this,this._onLogoutFailed),[c,a,b,d])},_get_path:function(){var a=this.get_path();if(!a.length)a=Sys.Services._AuthenticationService.DefaultWebServicePath;if(!a||!a.length)throw Error.invalidOperation(Sys.Res.servicePathNotSet);return a},_onLoginComplete:function(e,c,f){if(typeof e!=="boolean")throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,f,"Boolean"));var b=c[4],d=c[7]||this.get_defaultUserContext(),a=c[5]||this.get_defaultLoginCompletedCallback()||this.get_defaultSucceededCallback();if(e){this._authenticated=true;if(a)a(true,d,"Sys.Services.AuthenticationService.login");if(typeof b!=="undefined"&&b!==null)window.location.href=b}else if(a)a(false,d,"Sys.Services.AuthenticationService.login")},_onLoginFailed:function(d,b){var a=b[6]||this.get_defaultFailedCallback();if(a){var c=b[7]||this.get_defaultUserContext();a(d,c,"Sys.Services.AuthenticationService.login")}},_onLogoutComplete:function(f,a,e){if(f!==null)throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,e,"null"));var b=a[0],d=a[3]||this.get_defaultUserContext(),c=a[1]||this.get_defaultLogoutCompletedCallback()||this.get_defaultSucceededCallback();this._authenticated=false;if(c)c(null,d,"Sys.Services.AuthenticationService.logout");if(!b)window.location.reload();else window.location.href=b},_onLogoutFailed:function(c,b){var a=b[2]||this.get_defaultFailedCallback();if(a)a(c,b[3],"Sys.Services.AuthenticationService.logout")},_setAuthenticated:function(a){this._authenticated=a}};Sys.Services._AuthenticationService.registerClass("Sys.Services._AuthenticationService",Sys.Net.WebServiceProxy);Sys.Services.AuthenticationService=new Sys.Services._AuthenticationService;Sys.Services._RoleService=function(){Sys.Services._RoleService.initializeBase(this);this._roles=[]};Sys.Services._RoleService.DefaultWebServicePath="";Sys.Services._RoleService.prototype={_defaultLoadCompletedCallback:null,_rolesIndex:null,_timeout:0,_path:"",get_defaultLoadCompletedCallback:function(){return this._defaultLoadCompletedCallback},set_defaultLoadCompletedCallback:function(a){this._defaultLoadCompletedCallback=a},get_path:function(){return this._path||""},get_roles:function(){return Array.clone(this._roles)},isUserInRole:function(a){var b=this._get_rolesIndex()[a.trim().toLowerCase()];return !!b},load:function(a,b,c){Sys.Net.WebServiceProxy.invoke(this._get_path(),"GetRolesForCurrentUser",false,{},Function.createDelegate(this,this._onLoadComplete),Function.createDelegate(this,this._onLoadFailed),[a,b,c],this.get_timeout())},_get_path:function(){var a=this.get_path();if(!a||!a.length)a=Sys.Services._RoleService.DefaultWebServicePath;if(!a||!a.length)throw Error.invalidOperation(Sys.Res.servicePathNotSet);return a},_get_rolesIndex:function(){if(!this._rolesIndex){var b={};for(var a=0;a<this._roles.length;a++)b[this._roles[a].toLowerCase()]=true;this._rolesIndex=b}return this._rolesIndex},_onLoadComplete:function(a,c,f){if(a&&!(a instanceof Array))throw Error.invalidOperation(String.format(Sys.Res.webServiceInvalidReturnType,f,"Array"));this._roles=a;this._rolesIndex=null;var b=c[0]||this.get_defaultLoadCompletedCallback()||this.get_defaultSucceededCallback();if(b){var e=c[2]||this.get_defaultUserContext(),d=Array.clone(a);b(d,e,"Sys.Services.RoleService.load")}},_onLoadFailed:function(d,b){var a=b[1]||this.get_defaultFailedCallback();if(a){var c=b[2]||this.get_defaultUserContext();a(d,c,"Sys.Services.RoleService.load")}}};Sys.Services._RoleService.registerClass("Sys.Services._RoleService",Sys.Net.WebServiceProxy);Sys.Services.RoleService=new Sys.Services._RoleService;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)}};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},_getMonthIndex:function(a){if(!this._upperMonths)this._upperMonths=this._toUpperArray(this.dateTimeFormat.MonthNames);return Array.indexOf(this._upperMonths,this._toUpper(a))},_getAbbrMonthIndex:function(a){if(!this._upperAbbrMonths)this._upperAbbrMonths=this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);return Array.indexOf(this._upperAbbrMonths,this._toUpper(a))},_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._parse=function(b){var a=Sys.Serialization.JavaScriptSerializer.deserialize(b);return new Sys.CultureInfo(a.name,a.numberFormat,a.dateTimeFormat)};Sys.CultureInfo.registerClass("Sys.CultureInfo");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",""]}}');if(typeof __cultureInfo==="undefined")var __cultureInfo='{"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","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":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",""]}}';Sys.CultureInfo.CurrentCulture=Sys.CultureInfo._parse(__cultureInfo);delete __cultureInfo;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");if(this._element){var a=this.get_name();if(a)this._element[a]=null;Array.remove(this._element._behaviors,this);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};Sys.UI.Control.prototype={_parent:null,_visibilityMode:Sys.UI.VisibilityMode.hide,get_element:function(){return this._element},get_id:function(){if(!this._element)return "";return 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_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=undefined;delete this._element}if(this._parent)delete this._parent},onBubbleEvent:function(){return false},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);
Type.registerNamespace('Sys');Sys.Res={
"argumentInteger":"Value must be an integer.","scriptLoadMultipleCallbacks":"The script \u0027{0}\u0027 contains multiple calls to Sys.Application.notifyScriptLoaded(). Only one is allowed.","invokeCalledTwice":"Cannot call invoke more than once.","webServiceFailed":"The server method \u0027{0}\u0027 failed with the following error: {1}","webServiceInvalidJsonWrapper":"The server method \u0027{0}\u0027 returned invalid data. The \u0027d\u0027 property is missing from the JSON wrapper.","argumentType":"Object cannot be converted to the required type.","argumentNull":"Value cannot be null.","controlCantSetId":"The id property can\u0027t be set on a control.","formatBadFormatSpecifier":"Format specifier was invalid.","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}","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?"};
/* END MicrosoftAjax.js */
/* START Telerik.Web.UI.Common.Core.js */
// Avoids the background image flickering in IE 6 (http://www.mister-pixel.com/)
try
{
	document.execCommand("BackgroundImageCache", false, true);
}
catch(err) {}

Type.registerNamespace("Telerik.Web.UI");

window.$telerik = window.TelerikCommonScripts = Telerik.Web.CommonScripts = {

    _rgbToHex : function(color)
    {
        //rgb(153, 0, 0);
        //becomes
        //#990000
        if (color.toLowerCase().indexOf("rgb") != -1)
        {
	        var hexValue = "#";
	        var colorReplace = function (val) {
		        var newVal = parseInt(val,10).toString(16);
		        hexValue = hexValue + (newVal.length == 1 ? "0"+newVal : newVal);
		        return val;
	        };
	        color=color.replace(/(\d+)/gi,colorReplace);
	        colorReplace = null;
	        return hexValue;
        }
        else
        {
	        return color;
        }
    },

    getOuterSize : function(element)
    {
        var size = $telerik.getBounds(element);
        var marginBox = $telerik.getMarginBox(element);

        return {
            width : size.width + marginBox.left + marginBox.right,
            height: size.height + marginBox.top + marginBox.bottom
        }
    },

    getOuterBounds : function(element)
    {
        var size = $telerik.getBounds(element);
        var marginBox = $telerik.getMarginBox(element);

        return {
            x :  size.x - marginBox.left,
            y : size.y -  marginBox.top,
            width : size.width + marginBox.left + marginBox.right,
            height: size.height + marginBox.top + marginBox.bottom
        }
    },

    getInvisibleParent : function(element)
	{
		while (element && element != document)
		{
			if ("none" == $telerik.getCurrentStyle(element, "display", ""))
			{
				return element;
			}
			element = element.parentNode;
		}
		return null;
	},

	addParentVisibilityChangeHandler : function(element, handler)
	{
		if (element)
		{
			if ($telerik.isIE)
			{
				$addHandler(element, "propertychange", handler);
			}
			else
			{
				element.addEventListener("DOMAttrModified", handler, false);
			}
		}
	},

	removeParentVisibilityChangeHandler : function(element, handler)
	{
	    if (element && handler)
		{
			if ($telerik.isIE)
			{
				$removeHandler(element, "propertychange", handler);
			}
			else
			{
				element.removeEventListener("DOMAttrModified", handler, false);
			}
		}
	},

	//browser-provided scrollIntoView produces nasty side effects - flickers and/or scrolls the whole page in both IE and FF
	//if the body has scroll and elemenet sis
	//Here is an alternative implementation
	scrollIntoView : function(element)
	{
		//Make sure the element exists and it is a part of some DOM hyerarchy
		if (!element || !element.parentNode) return;

		//Try to find a scrollable parent
		var scrollableParent = null;

		//Apply the scrolling
		var parentHeight = 0;

		var parent = element.parentNode;
		while (parent != null)
		{
			if (parent.tagName == "BODY")
			{
				//The method could be called to find a scrollable parent for an element in a different iframe.
				//In FF the body element does not have its
				var doc = parent.ownerDocument;
				if (!$telerik.isIE && doc.defaultView && doc.defaultView.frameElement)
				{
					//!Set the height to be equal to the height of the iframe, not the body element!
					parentHeight = doc.defaultView.frameElement.offsetHeight;
				}
				scrollableParent = parent;
				break;
			}

			var overflow = $telerik.getCurrentStyle(parent, 'overflowY');//We want to know the vertical overflow
			if (overflow == "scroll" || overflow == "auto")
			{
				scrollableParent = parent;
				break;
			}

			parent = parent.parentNode;
		}
		if (!scrollableParent) return;

		//If parent height was not set, set it here
		if (!parentHeight) parentHeight = scrollableParent.offsetHeight;

		//Do the actual magic with 'scrolling into view'
		if (parentHeight < element.offsetTop + element.offsetHeight)//element is below the parent viewport
		{
			scrollableParent.scrollTop = (element.offsetTop + element.offsetHeight) - parentHeight;
		}
		else if (element.offsetTop < scrollableParent.scrollTop) //element is above the parent viewport
		{
			scrollableParent.scrollTop = element.offsetTop;
		}
	},
	
	
    isRightToLeft : function (element)
	{
		while (element && element.nodeType !== 9)
		{
			if (element.dir == "rtl" || $telerik.getCurrentStyle(element, 'direction') == 'rtl')
				return true;

			element = element.parentNode;
		}
		return false;
	},

	getCorrectScrollLeft : function(element)
    {
        if($telerik.isRightToLeft(element))
        {
            return -(element.scrollWidth - element.offsetWidth - Math.abs(element.scrollLeft));
        }
        else
        {
            return element.scrollLeft;
        }
    },

    getNextHtmlNode : function(element)
    {
        if (!element || !element.previousSibling) return null;
        while (element.previousSibling)
        {
            if (element.previousSibling.nodeType == 1) return element.previousSibling;
            element = element.nextSibling;
        }
    },

    getPreviousHtmlNode : function(element)
    {
        if (!element || !element.nextSibling) return null;
        while (element.nextSibling)
        {
            if (element.nextSibling.nodeType == 1) return element.nextSibling;
            element = element.nextSibling;
        }
    },

    //Returns the text content of an element
    getTextContent : function(element)
    {
        if (!element) return null;
        if (element.innerText != null) return element.innerText;
        if (element.textContent != null)
        {
            var text = element.textContent;
		    text = text.replace(/<!--(.|\s)*?-->/gi,"");
		    return text;
        }
		return null;
    },

	_borderStyleNames : ['borderTopStyle','borderRightStyle','borderBottomStyle','borderLeftStyle'],
	_borderWidthNames : ['borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth'],
	_paddingWidthNames : ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
	_marginWidthNames : ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'],
	radControls : [],

	registerControl : function (control)
	{
		if (!Array.contains(this.radControls, control))
			Array.add(this.radControls, control);
	},

	unregisterControl : function (control)
	{
		Array.remove(this.radControls, control);
	},

	repaintChildren : function (parentControl)
	{
		var parentElement = parentControl.get_element();

		for (var i = 0, length = this.radControls.length; i < length; i ++)
		{
	        var control = this.radControls[i];

		    if (control.repaint && this.isDescendant(parentElement, control.get_element()))
				control.repaint();
		}
	},

	_borderThickness: function()
	{
		$telerik._borderThicknesses = { };

		var div0 = document.createElement('div');
		var div1 = document.createElement('div');

		div0.style.visibility = 'hidden';
		div0.style.position = 'absolute';
		div0.style.fontSize = '1px';

		div1.style.height = '0px';
		div1.style.overflow = 'hidden';

		document.body.appendChild(div0).appendChild(div1);

		var base = div0.offsetHeight;
		div1.style.borderTop = 'solid black';

		div1.style.borderTopWidth = 'thin';
		$telerik._borderThicknesses['thin'] = div0.offsetHeight - base;

		div1.style.borderTopWidth = 'medium';
		$telerik._borderThicknesses['medium'] = div0.offsetHeight - base;

		div1.style.borderTopWidth = 'thick';
		$telerik._borderThicknesses['thick'] = div0.offsetHeight - base;

		if (typeof(div0.removeChild) !== "undefined")
			div0.removeChild(div1);

		document.body.removeChild(div0);
		//Apparently, Safari does not like setting outerHTML on elements not in the document
		//throws NO_MODIFICATION_ALLOWED_ERR: DOM Exception 7
		if (!$telerik.isSafari)
			div1.outerHTML = null;
		if (!$telerik.isSafari)
			div0.outerHTML = null;
		div0 = null;
		div1 = null;
	},

	getCurrentStyle : function(element, attribute, defaultValue) {

        var currentValue = null;
        if (element) {
            if (element.currentStyle) {
                currentValue = element.currentStyle[attribute];
            } else if (document.defaultView && document.defaultView.getComputedStyle) {
                var style = document.defaultView.getComputedStyle(element, null);
                if (style) {
                    currentValue = style[attribute];
                }
            }

            if (!currentValue && element.style.getPropertyValue) {
                currentValue = element.style.getPropertyValue(attribute);
            }
            else if (!currentValue && element.style.getAttribute) {
                currentValue = element.style.getAttribute(attribute);
            }
        }

        if ((!currentValue || currentValue == "" || typeof(currentValue) === 'undefined')) {
            if (typeof(defaultValue) != 'undefined') {
                currentValue = defaultValue;
            }
            else {
                currentValue = null;
            }
        }
        return currentValue;
    },

    getInheritedBackgroundColor : function(element) {
        if (!element) return '#FFFFFF';
        var background = $telerik.getCurrentStyle(element, 'backgroundColor');
        try {
            while (!background || background == '' || background == 'transparent' || background == 'rgba(0, 0, 0, 0)') {
                element = element.parentNode;
                if (!element) {
                    background = '#FFFFFF';
                } else {
                    background = $telerik.getCurrentStyle(element, 'backgroundColor');
                }
            }
        } catch(ex) {
            background = '#FFFFFF';
        }
        return background;
    },

	getLocation : function(element) 
	{
		// workaround for an issue in getLocation where it will compute the location of the document element.
		// this will return an offset if scrolled.
		//
		if (element === document.documentElement) {
			return new Sys.UI.Point(0,0);
		}

		// Workaround for IE6 bug in getLocation (also required patching getBounds - remove that fix when this is removed)

		//TEKI: When in IE7 in a scenario when item is in a FRAMESET, the location value is wrong. However, using the IE6 code below it works fine
		if (Sys.Browser.agent == Sys.Browser.InternetExplorer /*&& Sys.Browser.version < 7*/) {
			if (element.window === element || element.nodeType === 9 || !element.getClientRects || !element.getBoundingClientRect) return new Sys.UI.Point(0,0);

			// Get the first bounding rectangle in screen coordinates
			var screenRects = element.getClientRects();
			if (!screenRects || !screenRects.length) {
				return new Sys.UI.Point(0,0);
			}
			var first = screenRects[0];

			// Delta between client coords and screen coords
			var dLeft = 0;
			var dTop = 0;

			var inFrame = false;
			try {
				inFrame = element.ownerDocument.parentWindow.frameElement;
			} catch(ex) {
				// If accessing the frameElement fails, a frame is probably in a different
				// domain than its parent - and we still want to do the calculation below
				inFrame = true;
			}

			// If we're in a frame, get client coordinates too so we can compute the delta
			if (inFrame) {
				// Get the bounding rectangle in client coords
				var clientRect = element.getBoundingClientRect();
				if (!clientRect) {
					return new Sys.UI.Point(0,0);
				}

				// Find the minima in screen coords
				var minLeft = first.left;
				var minTop = first.top;
				for (var i = 1; i < screenRects.length; i++) {
					var r = screenRects[i];
					if (r.left < minLeft) {
						minLeft = r.left;
					}
					if (r.top < minTop) {
						minTop = r.top;
					}
				}

				// Compute the delta between screen and client coords
				dLeft = minLeft - clientRect.left;
				dTop = minTop - clientRect.top;
			}

			// Subtract 2px, the border of the viewport in IE6 and IE7(It can be changed in IE6 by applying a border style to the HTML element,
			// but this is not supported by ASP.NET AJAX, and it cannot be changed in IE7.), and also subtract the delta between
			// screen coords and client coords
			var ownerDocument = element.document.documentElement;

            var viewportBorderIE = 0;
            if(Sys.Browser.version < 8)
            {                
                if(inFrame)
                {
                    // In case the element is in an iframe, we need to take the frameborder as border of the viewport.
                    if(inFrame.getAttribute)
                    {
                        var frameborder = inFrame.getAttribute("frameborder");
                        // The default frameborder value is 1.
                        viewportBorderIE = 2 * ((frameborder != null && frameborder != "") ? frameborder : 1);
                    }
                }
                else
                {
                    viewportBorderIE = 2;
                }
            }
            
			var position = new Sys.UI.Point(first.left - viewportBorderIE - dLeft + $telerik.getCorrectScrollLeft(ownerDocument), 
			                                first.top - viewportBorderIE - dTop + ownerDocument.scrollTop);

			if ($telerik.quirksMode)
			{
				position.x += $telerik.getCorrectScrollLeft(document.body);
				position.y += document.body.scrollTop;
			}

			return position;
		}

		var position = Sys.UI.DomElement.getLocation(element);

		if ($telerik.isOpera)
		{
			var parent = element.offsetParent;

			while (parent && parent.tagName.toUpperCase() != 'BODY'
				&& parent.tagName.toUpperCase() != 'HTML')
			{
				position.x -= $telerik.getCorrectScrollLeft(parent);
				position.y -= parent.scrollTop;
				parent = parent.offsetParent;
			}
		}

		if ($telerik.isSafari)
		{
			var parent = element.parentNode;

			var parentTD = null;
			var parentTABLE = null;

			// Workaround for a problem with parent TABLES - when you have a parent TABLE element with border,
			// Safari acts as if the TABLE/TD has no border and calculates X and Y incorrectly.
			// That is why we need to add the borders manually. In case this is fixed in a future verion of the browser
			// we will need to remove this code.
			if($telerik.isSafari3 || $telerik.isSafari2)
			{
			    while (parent && parent.tagName.toUpperCase() != 'BODY'
				    && parent.tagName.toUpperCase() != 'HTML')
			    {
				    if(parent.tagName.toUpperCase() == "TD")
			        {
			            parentTD = parent;
			        }
                    else if(parent.tagName.toUpperCase() == "TABLE")
                    {
                        parentTABLE = parent;
                    }
                    else
                    {
                        // In case we have a positioned parent, we need to add the border to the calculated location.
                        var parentPosition = $telerik.getCurrentStyle(parent, 'position');
                        if(parentPosition == 'absolute' || parentPosition == 'relative')
                        {
                            var borderTopWidth = $telerik.getCurrentStyle(parent, 'borderTopWidth', 0);
                            var borderLeftWidth = $telerik.getCurrentStyle(parent, 'borderLeftWidth', 0);

                            position.x += parseInt(borderTopWidth);
                            position.y += parseInt(borderLeftWidth);
                        }
                    }

                    //This works around a bug: the scroll position of a relatively/absolutely positioned parent
                    //is not taken into account by Sys.UI.DomElement.getLocation in Safari & Chrome.
                    var parentPosition = $telerik.getCurrentStyle(parent, 'position');

                    if(parentPosition == 'absolute' || parentPosition == 'relative')
                    {
                        position.x -= parent.scrollLeft;
                        position.y -= parent.scrollTop;
                    }

                    if(parentTD && parentTABLE)
                    {
                        position.x += parseInt($telerik.getCurrentStyle(parentTABLE, 'borderTopWidth'));
                        position.y += parseInt($telerik.getCurrentStyle(parentTABLE, 'borderLeftWidth'));

                        // In case the TABLE has borderCollapse:collapse, we need to take the borderWidth of either
                        // the TABLE or the TD.
                        if($telerik.getCurrentStyle(parentTABLE, 'borderCollapse') != 'collapse')
                        {
                            position.x += parseInt($telerik.getCurrentStyle(parentTD, 'borderTopWidth'));
                            position.y += parseInt($telerik.getCurrentStyle(parentTD, 'borderLeftWidth'));
                        }

                        parentTD = null;
                        parentTABLE = null;
                    }
                    // In case we use getLocation for a TD element, we need to calculate the borderWidth of its TABLE
                    // only in case that TABLE has no borderCollapse:collapse.
                    else if(parentTABLE)
                    {
                        if($telerik.getCurrentStyle(parentTABLE, 'borderCollapse') != 'collapse')
                        {
                            position.x += parseInt($telerik.getCurrentStyle(parentTABLE, 'borderTopWidth'));
                            position.y += parseInt($telerik.getCurrentStyle(parentTABLE, 'borderLeftWidth'));
                        }
                        parentTABLE = null;
                    }

				    parent = parent.parentNode;
                }
                // END of Workaround for a problem with parent TABLES
			}
		}

		if ($telerik.isIE && $telerik.quirksMode)
		{
			position.x += $telerik.getCorrectScrollLeft(document.body);
			position.y += document.body.scrollTop;
		}

		return position;
	},

    setLocation : function(element, point) {
        Sys.UI.DomElement.setLocation(element, point.x, point.y);
    },

    findControl : function(parent, id)
    {
        var children = parent.getElementsByTagName("*");
        for(var i = 0, l = children.length; i < l; i++)
        {
            var childID = children[i].id;
            if (childID && childID.endsWith(id))
                return $find(childID);
        }

        return null;
    },

    findElement : function(parent, id)
    {
        var children = parent.getElementsByTagName("*");
        for(var i = 0, l = children.length; i < l; i++)
        {
            var childID = children[i].id;
            if (childID && childID.endsWith(id))
                return $get(childID);
        }

        return null;
    },

    getContentSize : function(element) {
        /// <summary>
        /// Gets the "content-box" size of an element.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <returns type="Object">
        /// Size of the element (in the form {width,height})
        /// </returns>
        /// <remarks>
        /// The "content-box" is the size of the content area *inside* of the borders and
        /// padding of an element. The "content-box" size does not include the margins around
        /// the element.
        /// </remarks>

        if (!element) {
            throw Error.argumentNull('element');
        }
        var size = $telerik.getSize(element);
        var borderBox = $telerik.getBorderBox(element);
        var paddingBox = $telerik.getPaddingBox(element);
        return {
            width :  size.width - borderBox.horizontal - paddingBox.horizontal,
            height : size.height - borderBox.vertical - paddingBox.vertical
        }
    },

    getSize : function(element) {
        /// <summary>
        /// Gets the "border-box" size of an element.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <returns type="Object">
        /// Size of the element (in the form {width,height})
        /// </returns>
        /// <remarks>
        /// The "border-box" is the size of the content area *outside* of the borders and
        /// padding of an element.  The "border-box" size does not include the margins around
        /// the element.
        /// </remarks>

        if (!element) {
            throw Error.argumentNull('element');
        }
        return {
            width:  element.offsetWidth,
            height: element.offsetHeight
        };
    },

    setContentSize : function(element, size) {
        /// <summary>
        /// Sets the "content-box" size of an element.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <param name="size" type="Object">
        /// Size of the element (in the form {width,height})
        /// </param>
        /// <remarks>
        /// The "content-box" is the size of the content area *inside* of the borders and
        /// padding of an element. The "content-box" size does not include the margins around
        /// the element.
        /// </remarks>

        if (!element) {
            throw Error.argumentNull('element');
        }
        if (!size) {
            throw Error.argumentNull('size');
        }
        // FF respects -moz-box-sizing css extension, so adjust the box size for the border-box
        if($telerik.getCurrentStyle(element, 'MozBoxSizing') == 'border-box' || $telerik.getCurrentStyle(element, 'BoxSizing') == 'border-box') {
            var borderBox = $telerik.getBorderBox(element);
            var paddingBox = $telerik.getPaddingBox(element);
            size = {
                width: size.width + borderBox.horizontal + paddingBox.horizontal,
                height: size.height + borderBox.vertical + paddingBox.vertical
            };
        }
        element.style.width = size.width.toString() + 'px';
        element.style.height = size.height.toString() + 'px';
    },

    setSize : function(element, size) {
        /// <summary>
        /// Sets the "border-box" size of an element.
        /// </summary>
        /// <remarks>
        /// The "border-box" is the size of the content area *outside* of the borders and
        /// padding of an element.  The "border-box" size does not include the margins around
        /// the element.
        /// </remarks>
        /// <param name="element" type="Sys.UI.DomElement">DOM element</param>
        /// <param name="size" type="Object">Size of the element (in the form {width,height})</param>
        /// <returns />

        if (!element) {
            throw Error.argumentNull('element');
        }
        if (!size) {
            throw Error.argumentNull('size');
        }
        var borderBox = $telerik.getBorderBox(element);
        var paddingBox = $telerik.getPaddingBox(element);
        var contentSize = {
            width:  size.width - borderBox.horizontal - paddingBox.horizontal,
            height: size.height - borderBox.vertical - paddingBox.vertical
        };
        $telerik.setContentSize(element, contentSize);
    },

	getBounds : function(element) {
        /// <summary>Gets the coordinates, width and height of an element.</summary>
        /// <param name="element" domElement="true"/>
        /// <returns type="Sys.UI.Bounds">
        ///   A Bounds object with four fields, x, y, width and height, which contain the pixel coordinates,
        ///   width and height of the element.
        /// </returns>

        var offset = $telerik.getLocation(element);
        return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);
    },

	setBounds : function(element, bounds) {
        /// <summary>
        /// Sets the "border-box" bounds of an element
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <param name="bounds" type="Object">
        /// Bounds of the element (of the form {x,y,width,height})
        /// </param>
        /// <remarks>
        /// The "border-box" is the size of the content area *outside* of the borders and
        /// padding of an element.  The "border-box" size does not include the margins around
        /// the element.
        /// </remarks>

        if (!element) {
            throw Error.argumentNull('element');
        }
        if (!bounds) {
            throw Error.argumentNull('bounds');
        }
        $telerik.setSize(element, bounds);
        $telerik.setLocation(element, bounds);
    },

    getClientBounds : function() {
        /// <summary>
        /// Gets the width and height of the browser client window (excluding scrollbars)
        /// </summary>
        /// <returns type="Sys.UI.Bounds">
        /// Browser's client width and height
        /// </returns>

        var clientWidth;
        var clientHeight;
        switch(Sys.Browser.agent) {
            case Sys.Browser.InternetExplorer:
                clientWidth = document.documentElement.clientWidth;
                clientHeight = document.documentElement.clientHeight;
                if (clientWidth == 0 && clientHeight == 0)
                {
                    //no doctype. use the body settings
                    clientWidth = document.body.clientWidth;
                    clientHeight = document.body.clientHeight;
                }
                break;
            case Sys.Browser.Safari:
                clientWidth = window.innerWidth;
                clientHeight = window.innerHeight;
                break;
            case Sys.Browser.Opera:
                clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
                clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
                break;
            default:  // Sys.Browser.Firefox, etc.
                clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
                clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
                break;
        }
        return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);
    },

    getMarginBox : function(element) {
        /// <summary>
        /// Gets the entire margin box sizes.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <returns type="Object">
        /// Element's margin box sizes (of the form {top,left,bottom,right,horizontal,vertical})
        /// </returns>
        if (!element) {
            throw Error.argumentNull('element');
        }
        var box = {
            top: $telerik.getMargin(element, Telerik.Web.BoxSide.Top),
            right: $telerik.getMargin(element, Telerik.Web.BoxSide.Right),
            bottom: $telerik.getMargin(element, Telerik.Web.BoxSide.Bottom),
            left: $telerik.getMargin(element, Telerik.Web.BoxSide.Left)
        }

        box.horizontal = box.left + box.right;
        box.vertical = box.top + box.bottom;
        return box;
    },

    getPaddingBox : function(element) {
        /// <summary>
        /// Gets the entire padding box sizes.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <returns type="Object">
        /// Element's padding box sizes (of the form {top,left,bottom,right,horizontal,vertical})
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }
        var box = {
            top: $telerik.getPadding(element, Telerik.Web.BoxSide.Top),
            right: $telerik.getPadding(element, Telerik.Web.BoxSide.Right),
            bottom: $telerik.getPadding(element, Telerik.Web.BoxSide.Bottom),
            left: $telerik.getPadding(element, Telerik.Web.BoxSide.Left)
        }
        box.horizontal = box.left + box.right;
        box.vertical = box.top + box.bottom;
        return box;
    },

    getBorderBox : function(element) {
        /// <summary>
        /// Gets the entire border box sizes.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <returns type="Object">
        /// Element's border box sizes (of the form {top,left,bottom,right,horizontal,vertical})
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }
        var box = {
            top: $telerik.getBorderWidth(element, Telerik.Web.BoxSide.Top),
            right: $telerik.getBorderWidth(element, Telerik.Web.BoxSide.Right),
            bottom: $telerik.getBorderWidth(element, Telerik.Web.BoxSide.Bottom),
            left: $telerik.getBorderWidth(element, Telerik.Web.BoxSide.Left)
        }
        box.horizontal = box.left + box.right;
        box.vertical = box.top + box.bottom;
        return box;
    },

	isBorderVisible : function(element, boxSide) {
        /// <summary>
        /// Gets whether the current border style for an element on a specific boxSide is not 'none'.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <param name="boxSide" type="Telerik.Web.BoxSide">
        /// Side of the element
        /// </param>
        /// <returns type="Boolean">
        /// Whether the current border style for an element on a specific boxSide is not 'none'.
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }
        if(boxSide < Telerik.Web.BoxSide.Top || boxSide > Telerik.Web.BoxSide.Left) {
            throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'Telerik.Web.BoxSide'));
        }
        var styleName = $telerik._borderStyleNames[boxSide];
        var styleValue = $telerik.getCurrentStyle(element, styleName);
        return styleValue != "none";
    },
    getMargin : function(element, boxSide) {
        /// <summary>
        /// Gets the margin thickness of an element on a specific boxSide.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <param name="boxSide" type="Telerik.Web.BoxSide">
        /// Side of the element
        /// </param>
        /// <returns type="Number" integer="true">
        /// Margin thickness on the element's specified side
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }
        if(boxSide < Telerik.Web.BoxSide.Top || boxSide > Telerik.Web.BoxSide.Left) {
            throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'Telerik.Web.BoxSide'));
        }
        var styleName = $telerik._marginWidthNames[boxSide];
        var styleValue = $telerik.getCurrentStyle(element, styleName);

        try { return $telerik.parsePadding(styleValue); } catch(ex) { return 0; }
    },

    getBorderWidth : function(element, boxSide) {
        /// <summary>
        /// Gets the border thickness of an element on a specific boxSide.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <param name="boxSide" type="Telerik.Web.BoxSide">
        /// Side of the element
        /// </param>
        /// <returns type="Number" integer="true">
        /// Border thickness on the element's specified side
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }
        if(boxSide < Telerik.Web.BoxSide.Top || boxSide > Telerik.Web.BoxSide.Left) {
            throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'Telerik.Web.BoxSide'));
        }
        if(!$telerik.isBorderVisible(element, boxSide)) {
            return 0;
        }
        var styleName = $telerik._borderWidthNames[boxSide];
        var styleValue = $telerik.getCurrentStyle(element, styleName);
        return $telerik.parseBorderWidth(styleValue);
    },

    getPadding : function(element, boxSide) {
        /// <summary>
        /// Gets the padding thickness of an element on a specific boxSide.
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// DOM element
        /// </param>
        /// <param name="boxSide" type="Telerik.Web.BoxSide">
        /// Side of the element
        /// </param>
        /// <returns type="Number" integer="true">
        /// Padding on the element's specified side
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }
        if(boxSide < Telerik.Web.BoxSide.Top || boxSide > Telerik.Web.BoxSide.Left) {
            throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'Telerik.Web.BoxSide'));
        }
        var styleName = $telerik._paddingWidthNames[boxSide];
        var styleValue = $telerik.getCurrentStyle(element, styleName);
        return $telerik.parsePadding(styleValue);
    },

    parseBorderWidth : function(borderWidth) {
        /// <summary>
        /// Parses a border-width string into a pixel size
        /// </summary>
        /// <param name="borderWidth" type="String" mayBeNull="true">
        /// Type of border ('thin','medium','thick','inherit',px unit,null,'')
        /// </param>
        /// <returns type="Number" integer="true">
        /// Number of pixels in the border-width
        /// </returns>

        if(borderWidth) {
            switch(borderWidth) {
                case 'thin':
                case 'medium':
                case 'thick':
                    return $telerik._borderThicknesses[borderWidth];
                case 'inherit':
                    return 0;
            }
            var unit = $telerik.parseUnit(borderWidth);
            return unit.size;
        }
        return 0;
    },

    parsePadding : function(padding) {
        /// <summary>
        /// Parses a padding string into a pixel size
        /// </summary>
        /// <param name="padding" type="String" mayBeNull="true">
        /// Padding to parse ('inherit',px unit,null,'')
        /// </param>
        /// <returns type="Number" integer="true">
        /// Number of pixels in the padding
        /// </returns>

        if(padding) {
            if(padding == 'auto' || padding == 'inherit') {
                return 0;
            }
            var unit = $telerik.parseUnit(padding);
            return unit.size;
        }
        return 0;
    },

    parseUnit : function(value) {
        /// <summary>
        /// Parses a unit string into a unit object
        /// </summary>
        /// <param name="value" type="String" mayBeNull="true">
        /// Value to parse (of the form px unit,% unit,em unit,...)
        /// </param>
        /// <returns type="Object">
        /// Parsed unit (of the form {size,type})
        /// </returns>

        if (!value) {
            throw Error.argumentNull('value');
        }

        value = value.trim().toLowerCase();
        var l = value.length;
        var s = -1;
        for(var i = 0; i < l; i++) {
            var ch = value.substr(i, 1);
            if((ch < '0' || ch > '9') && ch != '-' && ch != '.' && ch != ',') {
                break;
            }
            s = i;
        }
        if(s == -1) {
            throw Error.create('No digits');
        }
        var type;
        var size;
        if(s < (l - 1)) {
            type = value.substring(s + 1).trim();
        } else {
            type = 'px';
        }
        size = parseFloat(value.substr(0, s + 1));
        if(type == 'px') {
            size = Math.floor(size);
        }
        return {
            size: size,
            type: type
        };
    },

    containsPoint : function(rect, x, y) {
        /// <summary>
        /// Tests whether a point (x,y) is contained within a rectangle
        /// </summary>
        /// <param name="rect" type="Object">The rectangle</param>
        /// <param name="x" type="Number">The x coordinate of the point</param>
        /// <param name="y" type="Number">The y coordinate of the point</param>

        //ORIGINAL TOOLKIT SCRIPT CHANGE: instead of rect.height it was written rect.width (!!!) Clearly a major bug!!!!
        return x >= rect.x && x <= (rect.x + rect.width) && y >= rect.y && y <= (rect.y + rect.height);
    },

    isDescendant : function(ancestor, descendant) {
        /// <summary>
        /// Whether the specified element is a descendant of the ancestor
        /// </summary>
        /// <param name="ancestor" type="Sys.UI.DomElement">Ancestor node</param>
        /// <param name="descendant" type="Sys.UI.DomElement">Possible descendant node</param>
        /// <returns type="Boolean" />

        for (var n = descendant.parentNode; n != null; n = n.parentNode) {
            if (n == ancestor) return true;
        }
        return false;
    },

	isDescendantOrSelf : function(ancestor, descendant) {
        /// <summary>
        /// Whether the specified element is a descendant of the ancestor or the same as the ancestor
        /// </summary>
        /// <param name="ancestor" type="Sys.UI.DomElement">Ancestor node</param>
        /// <param name="descendant" type="Sys.UI.DomElement">Possible descendant node</param>
        /// <returns type="Boolean" />

        if (ancestor === descendant)
            return true;
        return $telerik.isDescendant(ancestor, descendant);
    },

	setOuterHeight : function (element, height)
	{
		if (height <= 0 || height == "")
		{
			element.style.height = "";
		}
		else
		{
			element.style.height = height + "px";
			var diff = element.offsetHeight - height;
			var newHeight = height - diff;
			if (newHeight > 0) {
				element.style.height = newHeight + "px";
			} else {
				element.style.height = "";
			}
		}
	},

    setOpacity : function(element, value) {
        /// <summary>
        /// Set the element's opacity
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// Element
        /// </param>
        /// <param name="value" type="Number">
        /// Opacity of the element
        /// </param>

        if (!element) {
            throw Error.argumentNull('element');
        }
        try
        {
            if (element.filters) {
                var filters = element.filters;
                var createFilter = true;
                if (filters.length !== 0) {
                    var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];
                    if (alphaFilter) {
                        createFilter = false;
                        alphaFilter.opacity = value * 100;
                    }
                }
                if (createFilter) {
                    element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (value * 100) + ')';
                }
            }
            else {
                element.style.opacity = value;
            }
        }
        catch (ex) {}
    },

    getOpacity : function(element) {
        /// <summary>
        /// Get the element's opacity
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement" domElement="true">
        /// Element
        /// </param>
        /// <returns type="Number">
        /// Opacity of the element
        /// </returns>

        if (!element) {
            throw Error.argumentNull('element');
        }

        var hasOpacity = false;
        var opacity;

        try
        {
            if (element.filters) {
                var filters = element.filters;
                if (filters.length !== 0) {
                    var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];
                    if (alphaFilter) {
                        opacity = alphaFilter.opacity / 100.0;
                        hasOpacity = true;
                    }
                }
            }
            else {
                opacity = $telerik.getCurrentStyle(element, 'opacity', 1);
                hasOpacity = true;
            }
        }
        catch (ex) {}

        if (hasOpacity === false) {
            return 1.0;
        }
        return parseFloat(opacity);
    },

    addCssClasses : function(element, classNames) {
        /// <summary>
        /// Adds multiple css classes to a DomElement
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement">The element to modify</param>
        /// <param name="classNames" type="Array">The class names to add</param>

        for(var i = 0; i < classNames.length; i++) {
            Sys.UI.DomElement.addCssClass(element, classNames[i]);
        }
    },

    removeCssClasses : function(element, classNames) {
        /// <summary>
        /// Removes multiple css classes to a DomElement
        /// </summary>
        /// <param name="element" type="Sys.UI.DomElement">The element to modify</param>
        /// <param name="classNames" type="Array">The class names to remove</param>

        for(var i = 0; i < classNames.length; i++) {
            Sys.UI.DomElement.removeCssClass(element, classNames[i]);
        }
    },
	setOuterWidth : function (element, width)
	{
		if (width <= 0 || width == "")
		{
			element.style.width = "";
		}
		else
		{
			element.style.width = width + "px";
			var diff = element.offsetWidth - width;
			var newWidth = width - diff;
			if (newWidth > 0) {
				element.style.width = newWidth + "px";
			} else {
				element.style.width = "";
			}
		}
	},

	getScrollOffset : function(element, recursive)
	{
		var left = 0;
		var top = 0;
		var parent = element;

		while (parent != null && parent.scrollLeft != null) {
			left += $telerik.getCorrectScrollLeft(parent);
			top += parent.scrollTop;
			// Don't include anything below the body.
			if (!recursive || (parent == document.body && (parent.scrollLeft != 0 || parent.scrollTop != 0)))
				break;

			parent = parent.parentNode;
		}

		return { x: left, y: top };
	},

	getElementByClassName : function(element, className, tagName)
	{
		var children = null;
		if (tagName)
		{
			children = element.getElementsByTagName(tagName);
		}
		else
		{
			children = element.getElementsByTagName("*");
		}

		for (var i = 0, length = children.length; i < length; i++)
		{
			var child = children[i];

			if (Sys.UI.DomElement.containsCssClass(child, className))
			{
				return child;
			}
		}

		return null;
	},

	//The $addHandler and $removeHandler only work with DOM HTML elements.
	//In products that use iframes (RadWindow, RadEditor, EditorPopup) events need to be attached to the iframes' document and/or contentWindow.
	//In addition to this to construct an event object, the MS AJAX framework attempts to use the window.event - which is null in the main page, when the event originates from a child frame
	//Thus, the need to provide an alternative to the MS AJAX framework arises
	addExternalHandler : function(element, eventName, handler)
	{
		if (element.addEventListener)
		{
			element.addEventListener(eventName, handler, false);
		}
		else if (element.attachEvent)
		{
			element.attachEvent("on" + eventName, handler);
		}
	},
	removeExternalHandler : function(element, eventName, handler)
	{
		if (element.addEventListener)
		{
			element.removeEventListener(eventName, handler, false);
		}
		else if (element.detachEvent)
		{
			element.detachEvent("on" + eventName, handler);
		}
	},

	cancelRawEvent : function(e)
	{
		if (!e) return false;
		if (e.preventDefault) e.preventDefault();
		if (e.stopPropagation) e.stopPropagation();
		e.cancelBubble = true;
		e.returnValue = false;
		return false;
	},

	getOuterHtml : function(element)
	{
		if (element.outerHTML)
		{
			return element.outerHTML;
		}
		else
		{
			var elementCopy = element.cloneNode(true);
			var tmpDiv = element.ownerDocument.createElement("DIV");
			tmpDiv.appendChild(elementCopy);
			return tmpDiv.innerHTML;
		}
	},

	setVisible : function(e, value)
	{
		if (!e) return;

		if (value != $telerik.getVisible(e)) {

			if (value) {
				if (e.style.removeAttribute) {
					e.style.removeAttribute("display");
				} else {
				   e.style.removeProperty("display");
				}
			}
			else {
				e.style.display = 'none';
			}

			e.style.visibility = value ? 'visible' : 'hidden';
		}
	},

	getVisible : function(e)
	{
		if (!e) return false;

		return (("none" != $telerik.getCurrentStyle(e, "display")) &&
        ("hidden" != $telerik.getCurrentStyle(e, "visibility")));
	},

	getViewPortSize : function()
	{
		var width = 0;
		var height = 0;

		var canvas = document.body;

		if (!$telerik.quirksMode && !$telerik.isSafari)
		{
			canvas = document.documentElement;
		}

		if (window.innerWidth)
		{
			width = window.innerWidth;
			height = window.innerHeight;
		}
		else
		{
			width = canvas.clientWidth;
			height = canvas.clientHeight;
		}

		width += canvas.scrollLeft;
		height += canvas.scrollTop;

		return { width : width - 6, height : height - 6 };
	},

	elementOverflowsTop : function (element)
	{
		return $telerik.getLocation(element).y < 0;
	},

	elementOverflowsLeft : function (element)
	{
		return $telerik.getLocation(element).x < 0;
	},

	elementOverflowsBottom : function (screenSize, element)
	{
		var bottomEdge = $telerik.getLocation(element).y + element.offsetHeight;
		return bottomEdge > screenSize.height;
	},

	elementOverflowsRight : function (screenSize, element)
	{
		var rightEdge = $telerik.getLocation(element).x + element.offsetWidth;
		return rightEdge > screenSize.width;
	},

	getDocumentRelativeCursorPosition : function(e)
	{
		var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
		var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
		var left = e.clientX + scrollLeft;
		var top = e.clientY + scrollTop;
		return {left:left, top:top};
	},

	evalScriptCode: function(scriptCode)
	{
		//Code moved here from RadEditor - used to eval a script in a string
		var isSafari = $telerik.isSafari;
		if (isSafari)
		{
			scriptCode = scriptCode.replace(/^\s*<!--((.|\n)*)-->\s*$/mi, "$1");
		}

		var newScript = document.createElement("script");
		newScript.setAttribute("type", "text/javascript");
		if (isSafari)
		{
			newScript.appendChild(document.createTextNode(scriptCode));
		}
		else
		{
			newScript.text = scriptCode;
		}

		var scriptContainer = document.getElementsByTagName("head")[0];
		scriptContainer.appendChild(newScript);
		if (isSafari)
		{
			newScript.innerHTML = "";
		}
		else
		{
			newScript.parentNode.removeChild(newScript);
		}
	},

	isScriptRegistered: function(src)
	{
		//returns the number of times a script is registered on the page or 0 if it is not.
		var scriptElements = document.getElementsByTagName("script");
		var regCounter = 0;
		for (var i=0,len=scriptElements.length;i<len;i++)
		{
			var script = scriptElements[i];
			if (script.src && script.getAttribute("src", 2) == src)
			{
				regCounter++;
			}
		}
		return regCounter;
	},

	evalScripts: function(element)
	{
		//code that evals the scripts inside a DOM element
		var scriptElements = element.getElementsByTagName("script");
		for (var i=0,len=scriptElements.length;i<len;i++)
		{
			var script = scriptElements[i];
			if (script.src)
			{
				var src = script.getAttribute("src", 2);
				if ($telerik.isScriptRegistered(src) < 2)
				{
					var script = document.createElement("script");
					script.setAttribute("type", "text/javascript");
					script.setAttribute("src", src);
					document.getElementsByTagName("head")[0].appendChild(script);
				}
			}
			else
			{
				$telerik.evalScriptCode(script.innerHTML);
			}
		}
	},

	getFirstChildByTagName : function (element, tagName, index)
	{
		if (!element || !element.childNodes)
		{
			return null;
		}

		var currentNode = element.childNodes[index] || element.firstChild;

		while (currentNode)
		{
			if (currentNode.nodeType == 1 && currentNode.tagName.toLowerCase() == tagName)
				return currentNode;

			currentNode = currentNode.nextSibling;
		}

		return null;
	},

	getChildByClassName : function(element, className, index)
	{
		var currentNode = element.childNodes[index] || element.firstChild;
		while (currentNode)
		{
			if (currentNode.nodeType == 1 && currentNode.className.indexOf(className) > -1)
				return currentNode;
			currentNode = currentNode.nextSibling;
		}
		return null;
	},

	getChildrenByTagName : function (element, tagName)
	{
		var children = new Array();
		var childNodes = element.childNodes;
		if ($telerik.isIE)
			childNodes = element.children;

		for (var i = 0, length = childNodes.length; i < length; i++)
		{
			var child = childNodes[i];
			if (child.nodeType == 1 && child.tagName.toLowerCase() == tagName)
				Array.add(children, child);
		}
		return children;
	},

	getChildrenByClassName : function (element, className)
	{
		var children = new Array();
		var childNodes = element.childNodes;
		if ($telerik.isIE)
			childNodes = element.children;

		for (var i = 0, length = childNodes.length; i < length; i++)
		{
			var child = childNodes[i];
			if (child.nodeType == 1 && child.className.indexOf(className) > -1)
				Array.add(children, child);
		}
		return children;
	},

	isMouseOverElement : function(element, e)
	{
		var elementBounds = $telerik.getBounds(element);
		var cursor = $telerik.getDocumentRelativeCursorPosition(e);

		return $telerik.containsPoint(elementBounds, cursor.left, cursor.top);
	},
	
	isMouseOverElementEx : function(element, e)
	{
	    var rect = null;
        //Can throw exception if called by body onclick eventhandler after AJAX update
        try
        {
           rect = $telerik.getOuterBounds(element);        
        }
        catch(e)
        {
            return false;
        }
                
        if (e && e.target)
        {
            //BUG in IE6: If there is a select element in the dropdown [heavyweight object], clientX and clientY come with bad values, and the contains
            //Mozilla bug - option elements in a select cause the mouse to return incorrect mouse offsets    
            var tagName = e.target.tagName;                        
            if (tagName == "SELECT" || tagName == "OPTION") return true;
            if (e.clientX < 0 || e.clientY < 0) return true;            
        }
                                        
        //See if targetControl rect contains the mouse x,y
        var docElem = document.documentElement;
        var body = document.body;
        
        // For scrollLeft/scrollTop use the sum of the documentElement and body as there are case, which the following does not cover:
        // (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body
        // For example, in Safari and Chrome, even though (document.compatMode && document.compatMode!="BackCompat") is true, the BODY
        // element displays scrollbars.
        var x = e.clientX + ($telerik.getCorrectScrollLeft(docElem) + $telerik.getCorrectScrollLeft(body));
        var y = e.clientY + (docElem.scrollTop + body.scrollTop);                        
                
        //When mouse is taken out slowly  e.clientX and  e.clientY return values on the 'border' of the element - technically - still within it        
        rect.x += 2;
        rect.y += 2;
        rect.width -= 4;
        rect.height -= 4;
        var toKeep = $telerik.containsPoint(rect, x,y);        
        return toKeep;
	}
}

if (typeof(Sys.Browser.WebKit) == "undefined")
{
	Sys.Browser.WebKit = {}; //Safari 3 is considered WebKit
}
if (typeof(Sys.Browser.Chrome) == "undefined")
{
	Sys.Browser.Chrome = {};
}

if(navigator.userAgent.indexOf("Chrome") > -1)
{
	//Sys.Browser.version = navigator.userAgent.match(/Chrome\/(\d+(\.\d+(\.\d+))?)/)[1];
	Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
	Sys.Browser.agent = Sys.Browser.Chrome;
	Sys.Browser.name = "Chrome";
}
else if(navigator.userAgent.indexOf("WebKit/") > -1)
{
	Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
	if (Sys.Browser.version < 500)
	{
		Sys.Browser.agent = Sys.Browser.Safari;
		Sys.Browser.name = "Safari";
	}
	else
	{
		Sys.Browser.agent = Sys.Browser.WebKit;
		Sys.Browser.name = "WebKit";
	}
}

$telerik.isChrome = Sys.Browser.agent == Sys.Browser.Chrome;
$telerik.isSafari3 = Sys.Browser.agent == Sys.Browser.WebKit || Sys.Browser.agent == Sys.Browser.Chrome;
$telerik.isSafari2 = Sys.Browser.agent == Sys.Browser.Safari;
$telerik.isSafari = $telerik.isSafari2 || $telerik.isSafari3;
$telerik.isIE = Sys.Browser.agent == Sys.Browser.InternetExplorer;
$telerik.isIE6 = $telerik.isIE && Sys.Browser.version < 7;
$telerik.isIE7 = $telerik.isIE && (Sys.Browser.version == 7 || (document.documentMode && document.documentMode < 8));
$telerik.isIE8 = $telerik.isIE && Sys.Browser.version == 8 && document.documentMode && document.documentMode == 8;
$telerik.isOpera = Sys.Browser.agent == Sys.Browser.Opera;
$telerik.isFirefox = Sys.Browser.agent == Sys.Browser.Firefox;
$telerik.isFirefox2 = $telerik.isFirefox && Sys.Browser.version < 3;
$telerik.isFirefox3 = $telerik.isFirefox && Sys.Browser.version == 3;
$telerik.quirksMode = $telerik.isIE && document.compatMode != "CSS1Compat";
$telerik.standardsMode = !$telerik.quirksMode;

//Initialize the thickness of borders based on their style
try {
    $telerik._borderThickness();
} catch (err){}

Telerik.Web.UI.Orientation = function() {
    /// <summary>
    /// The Telerik.Web.UI.Orientation enumeration is used to specify
    /// the orientation of a given asset
    /// </summary>
    /// <field name="Horizontal" type="Number" integer="true"/>
    /// <field name="Vertical" type="Number" integer="true"/>
    throw Error.invalidOperation();
}
Telerik.Web.UI.Orientation.prototype = {
    Horizontal : 0,
    Vertical : 1
}
Telerik.Web.UI.Orientation.registerEnum('Telerik.Web.UI.Orientation', false);

Telerik.Web.UI.RadWebControl = function(element)
{
    Telerik.Web.UI.RadWebControl.initializeBase(this, [element]);

    this._clientStateFieldID = null;
}

Telerik.Web.UI.RadWebControl.prototype =
{
    initialize: function()
    {
        Telerik.Web.UI.RadWebControl.callBaseMethod(this, 'initialize');

        $telerik.registerControl(this);

        if(!this.get_clientStateFieldID()) return;

        var input = $get(this.get_clientStateFieldID());

        if(!input) return;

        input.setAttribute('autocomplete', 'off');
    },

    dispose: function()
    {
        $telerik.unregisterControl(this);

        var element = this.get_element();

        Telerik.Web.UI.RadWebControl.callBaseMethod(this, 'dispose');

        if (element)
        {
			element.control = null;

			var dispose = true;
            if (element._events) {
                for (var e in element._events) {
                    if (element._events[e].length > 0) {
                        dispose = false;
                        break;
                    }
                }

                if (dispose)
                    element._events = null;
            }
		}
    },

    raiseEvent : function(eventName, eventArgs) {
        /// <summary>
        /// Raise the event
        /// </summary>
        /// <param name="eventName" type="String" mayBeNull="false">
        /// Name of the event to be raised
        /// </param>
        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="true">
        /// Event arguments for the given event
        /// </param>
        /// <returns />

		var handler = this.get_events().getHandler(eventName);
		if (handler) {
			if (!eventArgs) {
				eventArgs = Sys.EventArgs.Empty;
			}
			handler(this, eventArgs);
        }
    },

    updateClientState: function()
    {
        /// <summary>
        /// Call this function to update the client state hidden field.
        /// Use this function with caution, because it is resource hungry.
        /// </summary>
		this.set_clientState(this.saveClientState());
    },

    saveClientState: function()
    {
        /// <summary>
        /// This function should return the serialized client state of the control.
        /// </summary>
        /// <example>
		/// saveClientState: function()
		/// {
		///		var state =
		///		{
		///			Collapsed	: this.get_collapsed(),
		///			Width		: this.get_width(),
		///			Height		: this.get_height()
		///		};
		///		return Sys.Serialization.JavaScriptSerializer.serialize(state);
		/// }
        /// </example>
         return null;
    },

    get_clientStateFieldID : function()
    {
        /// <value type="String">
        /// ID of the hidden field used to store the client state
        /// </value>
        return this._clientStateFieldID;
    },
    set_clientStateFieldID : function(value)
    {
        if (this._clientStateFieldID != value)
        {
            this._clientStateFieldID = value;
            this.raisePropertyChanged('ClientStateFieldID');
        }
    },

    get_clientState : function() {
        /// <value type="String">
        /// Client state
        /// </value>
        if (this._clientStateFieldID)
        {
            var input = document.getElementById(this._clientStateFieldID);
            if (input)
            {
                return input.value;
            }
        }
        return null;
    },
    set_clientState : function(value)
    {
        if (this._clientStateFieldID)
        {
            var input = document.getElementById(this._clientStateFieldID);
            if (input)
            {
                input.value = value;
            }
        }
    },

    _getChildElement : function(id)
	{
		return $get(this.get_id() + "_" + id);
	},

	_findChildControl : function(id)
	{
		return $find(this.get_id() + "_" + id);
	}
}

Telerik.Web.UI.RadWebControl.registerClass('Telerik.Web.UI.RadWebControl', Sys.UI.Control);

Telerik.Web.Timer = function() {
    Telerik.Web.Timer.initializeBase(this);

    this._interval = 1000;
    this._enabled = false;
    this._timer = null;

    this._timerCallbackDelegate = Function.createDelegate(this, this._timerCallback);
}

Telerik.Web.Timer.prototype = {
    get_interval: function() {

        return this._interval;
    },
    set_interval: function(value) {

        if (this._interval !== value) {
            this._interval = value;
            this.raisePropertyChanged('interval');

            if (!this.get_isUpdating() && (this._timer !== null)) {
                this._stopTimer();
                this._startTimer();
            }
        }
    },

    get_enabled: function() {

        return this._enabled;
    },
    set_enabled: function(value) {

        if (value !== this.get_enabled()) {
            this._enabled = value;
            this.raisePropertyChanged('enabled');
            if (!this.get_isUpdating()) {
                if (value) {
                    this._startTimer();
                }
                else {
                    this._stopTimer();
                }
            }
        }
    },


    add_tick: function(handler) {
        this.get_events().addHandler("tick", handler);
    },

    remove_tick: function(handler) {
        this.get_events().removeHandler("tick", handler);
    },

    dispose: function() {
        this.set_enabled(false);
        this._stopTimer();

        Telerik.Web.Timer.callBaseMethod(this, 'dispose');
    },

    updated: function() {
        Telerik.Web.Timer.callBaseMethod(this, 'updated');

        if (this._enabled) {
            this._stopTimer();
            this._startTimer();
        }
    },

    _timerCallback: function() {
        var handler = this.get_events().getHandler("tick");
        if (handler) {
            handler(this, Sys.EventArgs.Empty);
        }
    },

    _startTimer: function() {
        this._timer = window.setInterval(this._timerCallbackDelegate, this._interval);
    },

    _stopTimer: function() {
        window.clearInterval(this._timer);
        this._timer = null;
    }
}

Telerik.Web.Timer.registerClass('Telerik.Web.Timer', Sys.Component);

Telerik.Web.BoxSide = function() {
}
Telerik.Web.BoxSide.prototype = {
    Top : 0,
    Right : 1,
    Bottom : 2,
    Left : 3
}
Telerik.Web.BoxSide.registerEnum("Telerik.Web.BoxSide", false);

if (Sys.CultureInfo.prototype._getAbbrMonthIndex) {
    try {
        Sys.CultureInfo.prototype._getAbbrMonthIndex('');
    } catch(ex) {
        Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) {
            if (!this._upperAbbrMonths) {
                this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);
            }
            return Array.indexOf(this._upperAbbrMonths, this._toUpper(value));
        }
        Sys.CultureInfo.CurrentCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex;
        Sys.CultureInfo.InvariantCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex;
    }
}

Telerik.Web.UI.EditorCommandEventArgs = function(commandName, tool, value)
{
	Telerik.Web.UI.EditorCommandEventArgs.initializeBase(this);
	this._name = this._commandName = commandName;
	this._tool = tool;
	this._value = value;
	//Backwards compatibility
	this.value = value;

	//NEW: Callback function
	this._callbackFunction = null;
}

Telerik.Web.UI.EditorCommandEventArgs.prototype =
{
	get_name : function() { return this._name; },
	get_commandName : function() { return this._commandName; },
	get_tool : function() { return this._tool; },
	get_value : function() { return this._value; },
	set_value : function(val) { this.value = val; this._value = val; },

	//NEW: Allow for alternative callback function to be set to dialogs
	set_callbackFunction : function(val) { this._callbackFunction = val; }

}
Telerik.Web.UI.EditorCommandEventArgs.registerClass("Telerik.Web.UI.EditorCommandEventArgs", Sys.CancelEventArgs);


Telerik.Web.IParameterConsumer = function() {
}
Telerik.Web.IParameterConsumer.prototype = {
	clientInit: function(parameters) { throw Error.notImplemented(); }
}
Telerik.Web.IParameterConsumer.registerInterface('Telerik.Web.IParameterConsumer');

Type.registerNamespace("Telerik.Web.UI.Dialogs");

Telerik.Web.UI.Dialogs.CommonDialogScript = function()
{
}

Telerik.Web.UI.Dialogs.CommonDialogScript.get_windowReference = function()
{
	if (window.radWindow)
	{
		return window.radWindow;
	}
	if (window.frameElement && window.frameElement.radWindow)
	{
		return window.frameElement.radWindow;
	}
	//If using classic windows (window.open)
	//Cache the reference, as a window can open a second window and the reference would be replaced.
	if (!window.__localRadEditorRadWindowReference && window.opener.__getCurrentRadEditorRadWindowReference)
	{
		window.__localRadEditorRadWindowReference = window.opener.__getCurrentRadEditorRadWindowReference();
	}
	return window.__localRadEditorRadWindowReference;
};

Telerik.Web.UI.Dialogs.CommonDialogScript.registerClass('Telerik.Web.UI.Dialogs.CommonDialogScript', null);

Telerik.Web.UI.WebServiceLoaderEventArgs = function(context)
{
	Telerik.Web.UI.WebServiceLoaderEventArgs.initializeBase(this);
	this._context = context;
}

Telerik.Web.UI.WebServiceLoaderEventArgs.prototype =
{
	get_context : function ()
	{
		return this._context;
	}
}

Telerik.Web.UI.WebServiceLoaderEventArgs.registerClass('Telerik.Web.UI.WebServiceLoaderEventArgs', Sys.EventArgs);


// ---------- WebServiceLoaderSuccessEventArgs Class ----------
Telerik.Web.UI.WebServiceLoaderSuccessEventArgs = function(data, context)
{
	Telerik.Web.UI.WebServiceLoaderSuccessEventArgs.initializeBase(this, [context]);
	this._data = data;
}

Telerik.Web.UI.WebServiceLoaderSuccessEventArgs.prototype =
{
	get_data : function ()
	{
		return this._data;
	}
}

Telerik.Web.UI.WebServiceLoaderSuccessEventArgs.registerClass('Telerik.Web.UI.WebServiceLoaderSuccessEventArgs', Telerik.Web.UI.WebServiceLoaderEventArgs);


// ---------- WebServiceLoaderErrorEventArgs Class ----------
Telerik.Web.UI.WebServiceLoaderErrorEventArgs = function(message, context)
{
	Telerik.Web.UI.WebServiceLoaderErrorEventArgs.initializeBase(this, [context]);
	this._message = message;
}

Telerik.Web.UI.WebServiceLoaderErrorEventArgs.prototype =
{
	get_message : function ()
	{
		return this._message;
	}
}

Telerik.Web.UI.WebServiceLoaderErrorEventArgs.registerClass('Telerik.Web.UI.WebServiceLoaderErrorEventArgs', Telerik.Web.UI.WebServiceLoaderEventArgs);


// ---------- WebServiceLoader Class ----------
Telerik.Web.UI.WebServiceLoader = function(webServiceSettings)
{
	this._webServiceSettings = webServiceSettings;
	this._events = null;
	this._onWebServiceSuccessDelegate = Function.createDelegate(this, this._onWebServiceSuccess);
	this._onWebServiceErrorDelegate = Function.createDelegate(this, this._onWebServiceError);
	this._currentRequest = null;
}

Telerik.Web.UI.WebServiceLoader.prototype =
{
	// Public properties
	get_webServiceSettings : function ()
	{
		return this._webServiceSettings;
	},

	get_events: function ()
	{
		if (!this._events)
		{
			this._events = new Sys.EventHandlerList();
		}

		return this._events;
	},


	// Public methods
	loadData : function (params, context)
	{
		var webServiceSettings = this.get_webServiceSettings();
		this.invokeMethod(this._webServiceSettings.get_method(), params, context);
	},

	invokeMethod : function(webMethod, params, context)
	{
		var webServiceSettings = this.get_webServiceSettings();
		if (webServiceSettings.get_isEmpty())
		{
			alert("Please, specify valid web service and method.");
			return;
		}

		this._raiseEvent("loadingStarted", new Telerik.Web.UI.WebServiceLoaderEventArgs(context));

		var webServicePath = webServiceSettings.get_path();
		var useHttpGet = webServiceSettings.get_useHttpGet();
		this._currentRequest = Sys.Net.WebServiceProxy.invoke(webServicePath, webMethod, useHttpGet, params,
			this._onWebServiceSuccessDelegate, this._onWebServiceErrorDelegate, context);
	},


	// Events
	add_loadingStarted : function(handler)
	{
		this.get_events().addHandler("loadingStarted", handler);
	},

	add_loadingError : function(handler)
	{
		this.get_events().addHandler("loadingError", handler);
	},

	add_loadingSuccess : function(handler)
	{
		this.get_events().addHandler("loadingSuccess", handler);
	},


	// Private methods
	_serializeDictionaryAsKeyValuePairs : function (dictionary)
	{
		var result = [];
		
		for (var key in dictionary)
			result[result.length] = {Key : key, Value : dictionary[key]};
			
		return result;
	},
	
	_onWebServiceSuccess : function (data, context)
	{
		var successEventArgs = new Telerik.Web.UI.WebServiceLoaderSuccessEventArgs(data, context);
		this._raiseEvent("loadingSuccess", successEventArgs);
	},

	_onWebServiceError : function (error, context)
	{
		var errorEventArgs = new Telerik.Web.UI.WebServiceLoaderErrorEventArgs(error.get_message(), context);
		this._raiseEvent("loadingError", errorEventArgs);
	},

	_raiseEvent : function (eventName, eventArgs)
	{
		var handler = this.get_events().getHandler(eventName);

		if (handler)
		{
			if (!eventArgs)
			{
				eventArgs = Sys.EventArgs.Empty;
			}

			handler(this, eventArgs);
		}
	}
}

Telerik.Web.UI.WebServiceLoader.registerClass('Telerik.Web.UI.WebServiceLoader');

Telerik.Web.UI.WebServiceSettings = function(serializedWebServiceSettings)
{
	this._path = null;
	this._method = null;
	this._useHttpGet = false;

	//Add a check for the parameter existance
	if (!serializedWebServiceSettings) serializedWebServiceSettings = {};

	if (typeof(serializedWebServiceSettings.path) != "undefined")
	{
		this._path = serializedWebServiceSettings.path;
	}

	if (typeof(serializedWebServiceSettings.method) != "undefined")
	{
		this._method = serializedWebServiceSettings.method;
	}

	if (typeof(serializedWebServiceSettings.useHttpGet) != "undefined")
	{
		this._useHttpGet = serializedWebServiceSettings.useHttpGet;
	}
}

Telerik.Web.UI.WebServiceSettings.prototype =
{
	get_isWcf : function ()
	{
		return /\.svc$/.test(this._path);
	},
	
	get_path : function ()
	{
		return this._path;
	},

	set_path : function (value)
	{
		this._path = value;
	},

	get_method : function ()
	{
		return this._method;
	},

	set_method : function (value)
	{
		this._method = value;
	},

	get_useHttpGet : function ()
	{
		return this._useHttpGet;
	},

	set_useHttpGet : function (value)
	{
		this._useHttpGet = value;
	},

	get_isEmpty : function ()
	{
		/// <value type="Boolean">
		///		A value indicating wether the web service settings contain
		///		a non-null and non-empty service path and method.
		/// </value>
		var path = this.get_path();
		var method = this.get_method();

		return (!(path && method))
	}
}

Telerik.Web.UI.WebServiceSettings.registerClass('Telerik.Web.UI.WebServiceSettings');

// ---------- AnimationType Enum ----------
Telerik.Web.UI.AnimationType = function () { };

Telerik.Web.UI.AnimationType.toEasing = function (value)
{
		return "ease" + Telerik.Web.UI.AnimationType.toString(value);
}

Telerik.Web.UI.AnimationType.prototype =
{
	None: 0,
	Linear: 1,

	InQuad: 2,
	OutQuad: 3,
	InOutQuad: 4,

	InCubic: 5,
	OutCubic: 6,
	InOutCubic: 7,

	InQuart: 8,
	OutQuart: 9,
	InOutQuart: 10,

	InQuint: 11,
	OutQuint: 12,
	InOutQuint: 13,

	InSine: 14,
	OutSine: 15,
	InOutSine: 16,

	InExpo: 17,
	OutExpo: 18,
	InOutExpo: 19,

	InBack: 20,
	OutBack: 21,
	InOutBack: 22,

	InBounce: 23,
	OutBounce: 24,
	InOutBounce: 25,

	InElastic: 26,
	OutElastic: 27,
	InOutElastic: 28
}

Telerik.Web.UI.AnimationType.registerEnum("Telerik.Web.UI.AnimationType");

// ---------- AnimationSettings Class ----------
Telerik.Web.UI.AnimationSettings = function(serializedAnimationSettings)
{
	this._type = Telerik.Web.UI.AnimationType.OutQuart;
	this._duration = 300;

	if (typeof(serializedAnimationSettings.type) != "undefined")
	{
		this._type = serializedAnimationSettings.type;
	}

	if (typeof(serializedAnimationSettings.duration) != "undefined")
	{
		this._duration = serializedAnimationSettings.duration;
	}
}

Telerik.Web.UI.AnimationSettings.prototype =
{
	get_type : function ()
	{
		return this._type;
	},

	set_type : function(value)
	{
		this._type = value;
	},

	get_duration : function ()
	{
		return this._duration;
	},

	set_duration : function(value)
	{
		this._duration = value;
	}
}

Telerik.Web.UI.AnimationSettings.registerClass('Telerik.Web.UI.AnimationSettings');

/* ActionsManager - used by editor, spell, file explorer and other controls that need undo/redo functionality */
Telerik.Web.UI.ActionsManager = function(contentWindow)
{
	Telerik.Web.UI.ActionsManager.initializeBase(this);
	this._actions = [];
	this._currentActionIndex = -1; //index of the last (un)executed action
}

Telerik.Web.UI.ActionsManager.prototype =
{
	get_actions: function()
	{
		return this._actions;
	},

	shiftPointerLeft: function()
	{
		this._currentActionIndex--;
	},

	shiftPointerRight: function()
	{
		this._currentActionIndex++;
	},

	get_currentAction: function()
	{
		return this.get_actions()[this._currentActionIndex];
	},

	get_nextAction: function()
	{
		return this.get_actions()[this._currentActionIndex + 1];
	},

	addAction: function(action)
	{
		//debugger;
		if (action)
		{
			var args = new Telerik.Web.UI.ActionsManagerEventArgs(action);
			this.raiseEvent("executeAction", args);
			//If there are actions to redo - remove them
			this._clearActionsToRedo();
			Array.add(this._actions, action);
			this._currentActionIndex = this._actions.length - 1;
			return true;
		}
		return false;
	},

	undo: function(depth)
	{
		if (depth == null) depth = 1;
		if (depth > this._actions.length) depth = this._actions.length;

		var cmdCount = 0;
		var action = null;

		while (0 < depth--
				&& 0 <= this._currentActionIndex
				&& this._currentActionIndex < this._actions.length)
		{
			action = this._actions[this._currentActionIndex--];
			if (action)
			{
				var args = new Telerik.Web.UI.ActionsManagerEventArgs(action);
				this.raiseEvent("undoAction", args);
				cmdCount++;
			}
		}

	},

	redo: function(depth)
	{
		if (depth == null) depth = 1;
		if (depth > this._actions.length) depth = this._actions.length;

		var cmdCount = 0;
		var action = null;

		var actionIndex = this._currentActionIndex + 1;
		while (0 < depth--
				&& 0 <= actionIndex
				&& actionIndex < this._actions.length)
		{
			action = this._actions[actionIndex];
			if (action)
			{
				var args = new Telerik.Web.UI.ActionsManagerEventArgs(action);
				this.raiseEvent("redoAction", args);
				this._currentActionIndex = actionIndex;
				cmdCount++;
			}
			actionIndex++;
		}
	},

	//Called by the AJAX spellchecker
	removeActionAt: function(index)
	{
		this._actions.splice(index, 1);
		if (this._currentActionIndex >= index) this._currentActionIndex--;
	},

	canUndo: function()
	{
		return (-1 < this._currentActionIndex);
	},

	canRedo: function()
	{
		return (this._currentActionIndex < this._actions.length - 1);
	},

	//Called by the undo/redo dropdowns
	getActionsToUndo: function()
	{
		if (this.canUndo())
		{
			return (this._actions.slice(0, this._currentActionIndex + 1)).reverse();
		}
		return [];
	},

	//Called by the undo/redo dropdowns
	getActionsToRedo: function()
	{
		if (this.canRedo())
		{
			return this._actions.slice(this._currentActionIndex + 1);
		}
		return [];
	},

	_clearActionsToRedo: function()
	{
		if (this.canRedo())
		{
			this._actions.splice(this._currentActionIndex + 1, this._actions.length - this._currentActionIndex);
		}
	},

	//===========================================================================================================//
	add_undoAction: function(handler)
	{
		this.get_events().addHandler("undoAction", handler);
	},

	remove_undoAction: function(handler)
	{
		this.get_events().removeHandler("undoAction", handler);
	},

	add_redoAction: function(handler)
	{
		this.get_events().addHandler("redoAction", handler);
	},

	remove_redoAction: function(handler)
	{
		this.get_events().removeHandler("redoAction", handler);
	},

	add_executeAction: function(handler)
	{
		this.get_events().addHandler("executeAction", handler);
	},

	remove_executeAction: function(handler)
	{
		this.get_events().removeHandler("executeAction", handler);
	},

	raiseEvent: function(eventName, args)
	{
		var handler = this.get_events().getHandler(eventName);
		if (handler)
		{
			handler(this, args);
		}
	}
};

Telerik.Web.UI.ActionsManager.registerClass("Telerik.Web.UI.ActionsManager", Sys.Component);

Telerik.Web.UI.ActionsManagerEventArgs = function(action)
{
	Telerik.Web.UI.ActionsManagerEventArgs.initializeBase(this);
	this._action = action;
}

Telerik.Web.UI.ActionsManagerEventArgs.prototype =
{
	get_action: function()
	{
		return this._action;
	}
}

Telerik.Web.UI.ActionsManagerEventArgs.registerClass("Telerik.Web.UI.ActionsManagerEventArgs", Sys.CancelEventArgs);


Telerik.Web.StringBuilder = function ()
{
	this._buffer = [];
},

Telerik.Web.StringBuilder.prototype =
{
	append : function (value)
	{
		this._buffer[this._buffer.length] = value;
        return this;
	},

	toString : function ()
	{
		return this._buffer.join("");
	}
};

/* END Telerik.Web.UI.Common.Core.js */
/* START Telerik.Web.UI.Ajax.RadAjaxControl.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadAjaxControl = function(element) 
{
    Telerik.Web.UI.RadAjaxControl.initializeBase(this, [element]);
    
    this._clientEvents = {};
    this._uniqueID = "";
    this._enableHistory = false;
    this._enableAJAX = true;
   
    this._requestQueueSize = 0;
    this._requestQueue = [];

    this._loadingPanelsToHide = [];
    this._initializeRequestHandler = null;
    this._endRequestHandler = null;
    this._isRequestInProgress = false;

    this._links = [];
    this._styles = [];
    
    this.Type = "Telerik.Web.UI.RadAjaxControl";
    
    // OBSOLETE!
    this.UniqueID = this._uniqueID;
    this.EnableHistory = this._enableHistory;
    this.EnableAJAX = this._enableAJAX;
    this.Links = this._links;
    this.Styles = this._styles;
    
    this._updatePanels = "";
}

Telerik.Web.UI.RadAjaxControl.prototype = 
{
    initialize: function() 
    {
       Telerik.Web.UI.RadAjaxControl.callBaseMethod(this, 'initialize');

       for(var clientEvent in this._clientEvents)
       {
			if (typeof(this._clientEvents[clientEvent]) != "string")
				continue;
				
			if (this._clientEvents[clientEvent] != "")
			{
				var handlerString = this._clientEvents[clientEvent];

				if (handlerString.indexOf("(") != -1)
				{
					// function call
					this[clientEvent] = handlerString;
				}
				else
				{
					// function reference
					this[clientEvent] = eval(handlerString);
				}
			}
			else
			{
				this[clientEvent] = null;
			}
       }

       var requestManager = Sys.WebForms.PageRequestManager.getInstance();

       this._initializeRequestHandler = Function.createDelegate(this, this._initializeRequest);
       requestManager.add_initializeRequest(this._initializeRequestHandler);
    },
    
    _getResponseHeader : function(xmlHttpRequest, headerName)
    {
        try
	    {
		    return xmlHttpRequest.getResponseHeader(headerName);
	    }
	    catch(e)
	    {
		    return null;
	    }
    },
    
    _handleAsyncRedirect : function(xmlHttpRequestObject)
    {
        var redirectURL = this._getResponseHeader(xmlHttpRequestObject, "Location");

		if (redirectURL && redirectURL != "")
		{
		    var tmp = document.createElement("a");
		    tmp.style.display = "none";
		    tmp.href = redirectURL;
		    document.body.appendChild(tmp);
		    if(tmp.click)
		    {
		        try
		        {
		            tmp.click();
		        }
		        catch(e) { }
		    }
		    else
		    {
		        window.location.href = redirectURL;
		    }
		    document.body.removeChild(tmp);
		    
		    return true;
		}
		
		return false;
    },
    
    _onFormSubmitCompleted : function(sender, args)
    {
        if(sender._xmlHttpRequest != null)
        {
            if(this._handleAsyncRedirect(sender._xmlHttpRequest))
            {
                try
                {
                    sender._aborted = true;
                }
                catch(e)
                {
                    //
                }
                return;
            }
        }
        
        if(sender._xmlHttpRequest != null && !sender.get_timedOut())
        {
            var scriptBlocks = this.getResponseItems(sender.get_responseData(), "scriptBlock");
            for(var i = 0, length = scriptBlocks.length; i < length; i++)
            {
                var content = scriptBlocks[i].content;
                if(content.indexOf(Sys.WebForms.PageRequestManager.getInstance()._uniqueIDToClientID(this._uniqueID)) != -1)
                {
                   var linksString = content.substr(content.indexOf("\"links\":") + 10, content.indexOf("]", content.indexOf("\"links\":")) - (content.indexOf("\"links\":") + 10)).replace(/\"/g, '');
                   if(linksString != "")
                   {
                    this._links = linksString.split(",");
                    this.updateHeadLinks();
                   }
                }
                
                if(content.indexOf(".axd") == -1 && scriptBlocks[i].id == "ScriptPath")
                {
                    Telerik.Web.UI.RadAjaxControl.IncludeClientScript(content);
                }
            }

            var panels = this.getResponseItems(sender.get_responseData(), "updatePanel");

            Telerik.Web.UI.RadAjaxControl.panelsToClear = [];

            for(var i = 0, length = panels.length; i < length; i++)
            {
                var panel = panels[i];
                if(!$get(panel.id))
                {
					var newUpdatePanel = document.createElement("div");
                    newUpdatePanel.id = panel.id;
                    var element = $get(panel.id.replace("Panel", ""));

                    if(!element)
                        continue;

                    var parent = element.parentNode;
                    var nextSibling = element.nextSibling || Telerik.Web.UI.RadAjaxControl.GetNodeNextSibling(element);
                    
                    if (element.nodeType === 1) 
                    {
						if (element.dispose && typeof(element.dispose) === "function") 
						{
							element.dispose();
						}
						else if (element.control && typeof(element.control.dispose) === "function") 
						{
							element.control.dispose();
						}
						var behaviors = Sys.UI.Behavior.getBehaviors(element);
						for (var j = behaviors.length - 1; j >= 0; j--) 
						{
							behaviors[j].dispose();
						}
					}
					
                    Sys.WebForms.PageRequestManager.getInstance()._destroyTree(element);
                    parent.removeChild(element);

                    Telerik.Web.UI.RadAjaxControl.InsertAtLocation(newUpdatePanel, parent, nextSibling);
                    Telerik.Web.UI.RadAjaxControl.panelsToClear[Telerik.Web.UI.RadAjaxControl.panelsToClear.length] = panel;
                }
            }
        }

         sender.get_webRequest().remove_completed(this._onFormSubmitCompletedHandler);
    },
    
    dispose: function() 
    {
        this.hideLoadingPanels();

        var requestManager = Sys.WebForms.PageRequestManager.getInstance();
        requestManager.remove_initializeRequest(this._initializeRequestHandler);

        $clearHandlers(this.get_element());
        this._element.control = null;

        Telerik.Web.UI.RadAjaxControl.callBaseMethod(this, 'dispose');
    },
    
    get_enableAJAX: function() 
    {
        return this._enableAJAX;
    },
    set_enableAJAX : function(value) 
    {
        if (this._enableAJAX != value) 
        {
            this._enableAJAX = value;
        }
    },

    get_enableHistory: function() 
    {
        return this._enableHistory;
    },
    set_enableHistory : function(value) 
    {
        if (this._enableHistory != value) 
        {
            this._enableHistory = value;
        }
    },

    get_clientEvents: function() 
    {
        return this._clientEvents;
    },
    set_clientEvents : function(value) 
    {
        if (this._clientEvents != value) 
        {
            this._clientEvents = value;
        }
    },

    get_links : function() 
    {
        return this._links;
    },
    set_links : function(value) 
    {
        if (this._links != value) 
        {
            this._links = value;
            
            if (this._links.length > 0)
            {
                this.updateHeadLinks();
            }
        }
    },
    
    get_styles : function() 
    {
        return this._styles;
    },
    set_styles : function(value) 
    {
        if (this._styles != value) 
        {
            this._styles = value;
            
            if(this._styles.length > 0)
            {
                this.updateHeadStyles();
            }
        }
    },

    get_uniqueID : function() 
    {
        return this._uniqueID;
    },
    set_uniqueID : function(value) 
    {
        if (this._uniqueID != value) 
        {
            this._uniqueID = value;
            window[Sys.WebForms.PageRequestManager.getInstance()._uniqueIDToClientID(this._uniqueID)] = this;
        }
    },
    
    get_requestQueueSize : function()
    {
        return this._requestQueueSize;
    },
    
    set_requestQueueSize : function(value)
    {
        if (value > 0)
        {
            this._requestQueueSize = value;
            this.raisePropertyChanged("requestQueueSize");
        }
    },

    isChildOf : function(control, parent)
    {
        while(control != null)
        {
            if (control == parent)
                return true;
            
            control = control.parentNode;
        }
        
        return false;
    },

    _initializeRequest : function(sender, args)
    {
        var requestManager = Sys.WebForms.PageRequestManager.getInstance();
        if (requestManager.get_isInAsyncPostBack() && this._requestQueueSize > 0)
        {
            this._queueRequest(sender, args);
        }    

        if (this.Type == "Telerik.Web.UI.RadAjaxManager")
        {
            if (args.get_postBackElement() != this.get_element())
            { 
                var plainPanels = this._updatePanels.split(",");

                if(Array.contains(plainPanels, args.get_postBackElement().id))
                {
                    this._isRequestInProgress = true;
                    this._attachRequestHandlers(sender, args, false);
                    return false;
                }
                else
                {
                    var parentNode = args.get_postBackElement().parentNode;
                    var found = false;
                    while (parentNode != null)
                    {
                       if (parentNode.id && Array.contains(plainPanels, parentNode.id))
                       {
                          found = true;
                          break;
                       }
                       parentNode = parentNode.parentNode;
                    }
                    
                    if (found)
                    {
                        this._isRequestInProgress = true;
                        this._attachRequestHandlers(sender, args, false);
                        return false;
                    }
                }
               
                if (!this._initiators[args.get_postBackElement().id])
                {
                     var parentNode = args.get_postBackElement().parentNode;
                     var found = false;
                     while (parentNode != null)
                     {
                        if (parentNode.id && this._initiators[parentNode.id])
                        {
                           found = true;
                           break;
                        }
                        parentNode = parentNode.parentNode;
                     }

                    if (!found)
                    {
                        this._isRequestInProgress = true;
                        this._attachRequestHandlers(sender, args, false);
                        return false;
                    }
                }
            }
        }

        if (this.Type == "Telerik.Web.UI.RadAjaxPanel")
        {
            // cancel request for nested panels (avoid duplicate request)
            var parentAjaxPanel = this._getParentAjaxPanel(args.get_postBackElement());
            if (parentAjaxPanel && parentAjaxPanel.get_id() != this.get_id())
            {
                return false;
            }
            
            if (!this.isChildOf(args.get_postBackElement(), this.get_element()))
            {
		         //this._isRequestInProgress = true;
		         //this._attachRequestHandlers(sender, args);
                 return false;
            }
        }

        if (this._enableHistory)
        {
            if (Telerik.Web.UI.RadAjaxControl.History[""] == null)
            {
                Telerik.Web.UI.RadAjaxControl.HandleHistory(sender._uniqueIDToClientID(this._uniqueID), "");
            }

            Telerik.Web.UI.RadAjaxControl.HandleHistory(sender._uniqueIDToClientID(this._uniqueID), args.get_request().get_body());
        }

        if(sender._form["__EVENTTARGET"] && sender._form["__EVENTTARGET"].value)
        {
            this.__EVENTTARGET = sender._form["__EVENTTARGET"].value;
        }
        else
        {
            this.__EVENTTARGET = args.get_postBackElement().id;
        }

        if (args.get_postBackElement().name)
        {
            this.__EVENTTARGET = args.get_postBackElement().name;
        }
        
        
        this.__EVENTARGUMENT = sender._form["__EVENTARGUMENT"].value;
    	var evt = new Telerik.Web.UI.RadAjaxRequestEventArgs(this.__EVENTTARGET, sender._form["__EVENTARGUMENT"].value, this._enableAJAX);

        var result = this.fireEvent(this, "OnRequestStart", [evt]);
        if (evt.get_cancel() || (typeof(result) != "undefined" && !result))
        {
            args.set_cancel(true);
			return;
		}

	    if (!evt._enableAjax || !evt.EnableAjax)
        {
            args.set_cancel(true);
            sender._form["__EVENTTARGET"].value = this.__EVENTTARGET ;
            sender._form["__EVENTARGUMENT"].value = this.__EVENTARGUMENT ;
            sender._form.submit();
			return;
        }

		this._isRequestInProgress = true;
		
		this._attachRequestHandlers(sender, args, true);
    },
    
    _endRequest : function(sender, args)
    {
        sender.remove_endRequest(this._endRequestHandler);

        for(var i = 0, length = Telerik.Web.UI.RadAjaxControl.panelsToClear.length; i < length; i++)
        {
            var panel = Telerik.Web.UI.RadAjaxControl.panelsToClear[i];
            var panelHtmlElement = document.getElementById(panel.id);
            var element = $get(panel.id.replace("Panel", ""));
           
           if(!element)
                continue;

            var parent = panelHtmlElement.parentNode;
            var nextSibling = panelHtmlElement.nextSibling || Telerik.Web.UI.RadAjaxControl.GetNodeNextSibling(panelHtmlElement);

            Telerik.Web.UI.RadAjaxControl.InsertAtLocation(element, parent, nextSibling);

            panelHtmlElement.parentNode.removeChild(panelHtmlElement);
        }

        this._isRequestInProgress = false;
        
        this.hideLoadingPanels();

        if(typeof(this.__EVENTTARGET) != "undefined" && typeof(this.__EVENTARGUMENT) != "undefined")
        {
            var evt = new Telerik.Web.UI.RadAjaxRequestEventArgs(this.__EVENTTARGET, this.__EVENTARGUMENT, this._enableAJAX);
            this.fireEvent(this, "OnResponseEnd", [evt]);
        }
        
        if (this._requestQueue.length > 0)
        {
            this._executePendingRequest();
        }
    },
    
    _queueRequest : function(sender, args)
    {
        args.set_cancel(true);
        
        if (this._requestQueue.length >= this._requestQueueSize)
        {
            //queue is full -- ignore the request
            return;
        }
        
        var postBackElement = args.get_postBackElement();
        var eventTarget = postBackElement.id;
        if (postBackElement.name)
        {
            eventTarget = postBackElement.name;
        }

        if (sender._form["__EVENTTARGET"] && sender._form["__EVENTTARGET"].value)
        {
            eventTarget = sender._form["__EVENTTARGET"].value;
        }
        
        var eventArgument = sender._form["__EVENTARGUMENT"].value;
 
        Array.enqueue(this._requestQueue, [eventTarget, eventArgument]);
    },
    
    _executePendingRequest : function()
    {
        var pendingRequest = Array.dequeue(this._requestQueue);
        
        var eventTarget = pendingRequest[0];        
        var eventArgument = pendingRequest[1];
        
        var requestManager = Sys.WebForms.PageRequestManager.getInstance();
        requestManager._doPostBack(eventTarget, eventArgument);
    },    
    
    _attachRequestHandlers : function(sender, args, sendRadAJAXControlID)
    {
        this._endRequestHandler = Function.createDelegate(this, this._endRequest);
        sender.add_endRequest(this._endRequestHandler);

//        this.pageLoadingHandler = Function.createDelegate(this, this.pageLoading);
//        sender.add_pageLoading(this.pageLoadingHandler);

//        this.pageLoadedHandler = Function.createDelegate(this, this.pageLoaded);
//        sender.add_pageLoaded(this.pageLoadedHandler);

        this._onFormSubmitCompletedHandler = Function.createDelegate(this, this._onFormSubmitCompleted);
        args.get_request().add_completed(this._onFormSubmitCompletedHandler);
        args.get_request()._get_eventHandlerList()._list.completed.reverse();
        
        if(sendRadAJAXControlID)
        {
            var requestBody = args.get_request().get_body();
            var delimiter = (requestBody.lastIndexOf("&") != requestBody.length - 1)? "&" : "";
            requestBody +=  delimiter + "RadAJAXControlID=" + sender._uniqueIDToClientID(this._uniqueID);
            args.get_request().set_body(requestBody);
        }
    },

    _getParentAjaxPanel : function(control)
    {
        var ajaxPanel = null;
        while (control != null)
        {
            if (typeof(control.id) != "undefined" &&
                $find(control.id) &&
                $find(control.id).Type == "Telerik.Web.UI.RadAjaxPanel")
            {
                ajaxPanel = $find(control.id);
                break;
            }
            
            control = control.parentNode;
        }
        
        return ajaxPanel;
    },

    getResponseItems : function(responseText, itemType, itemId)
    {
        var requestManager = Sys.WebForms.PageRequestManager.getInstance();
        // Parse the message format
        // General format: length|type|id|content|
        var reply = responseText;
        var delimiterIndex, len, type, id, content;
        var replyIndex = 0;
        var parserErrorDetails = null;
        var delimitByLengthDelimiter = '|';
        var delta = [];

        while (replyIndex < reply.length) {
            // length| - from index to next delimiter
            delimiterIndex = reply.indexOf(delimitByLengthDelimiter, replyIndex);
            if (delimiterIndex === -1) {
                parserErrorDetails = requestManager._findText(reply, replyIndex);
                break;
            }
            len = parseInt(reply.substring(replyIndex, delimiterIndex), 10);
            if ((len % 1) !== 0) {
                parserErrorDetails = requestManager._findText(reply, replyIndex);
                break;
            }
            replyIndex = delimiterIndex + 1;

            // type| - from index to next delimiter
            delimiterIndex = reply.indexOf(delimitByLengthDelimiter, replyIndex);
            if (delimiterIndex === -1) {
                parserErrorDetails = requestManager._findText(reply, replyIndex);
                break;
            }
            type = reply.substring(replyIndex, delimiterIndex);
            replyIndex = delimiterIndex + 1;

            // id| - from index to next delimiter
            delimiterIndex = reply.indexOf(delimitByLengthDelimiter, replyIndex);
            if (delimiterIndex === -1) {
                parserErrorDetails = requestManager._findText(reply, replyIndex);
                break;
            }
            id = reply.substring(replyIndex, delimiterIndex);
            replyIndex = delimiterIndex + 1;

            // content - the next 'len' characters after index
            if ((replyIndex + len) >= reply.length) {
                parserErrorDetails = requestManager._findText(reply, reply.length);
                break;
            }
            
            if(typeof(requestManager._decodeString) != "undefined")
            {
                content = requestManager._decodeString(reply.substr(replyIndex, len));
            }
            else
            {
                content = reply.substr(replyIndex, len);
            }
            
            replyIndex += len;

            // terminating delimiter
            if (reply.charAt(replyIndex) !== delimitByLengthDelimiter) {
                parserErrorDetails = requestManager._findText(reply, replyIndex);
                break;
            }

            replyIndex++;

            if(itemType != undefined && itemType != type)
                continue;

            if(itemId != undefined && itemId != id)
                continue;

            Array.add(delta, {type: type, id: id, content: content});
        }
        
        return delta;
    },

    pageLoading : function(sender, args)
    {
        //sender.remove_pageLoading(this.pageLoadingHandler);
    },
    
    pageLoaded : function(sender, args)
    {
        //sender.remove_pageLoaded(this.pageLoadedHandler);
    },
    
    hideLoadingPanels : function()
    {
        for(var i = 0; i < this._loadingPanelsToHide.length; i++)
        {
            var panel = this._loadingPanelsToHide[i].Panel;
            var controlID = this._loadingPanelsToHide[i].ControlID;
            if(panel != null)
            {
                panel.hide(controlID);
                Array.remove(this._loadingPanelsToHide, this._loadingPanelsToHide[i]);
                i--;
            }
        }
    },

    fireEvent : function(sender, eventHandler, eventArguments)
    {
		var returnValue = true;
		if (typeof(sender[eventHandler]) == "string")
		{
			returnValue = eval(sender[eventHandler]);
		}
		else if (typeof(sender[eventHandler]) == "function")
		{
			if (eventArguments)
			{
			    if(typeof(eventArguments.unshift) != "undefined")
			    {
				    eventArguments.unshift(sender);
				    returnValue = sender[eventHandler].apply(sender, eventArguments);
				}
				else
				{
				    returnValue = sender[eventHandler].apply(sender, [eventArguments]);
				}
			}
			else
			{
				returnValue = sender[eventHandler]();
			}
		}

		if (typeof(returnValue) != "boolean")
		{
			return true;
		}
		else
		{
			return returnValue;
		}
    },
    
    updateHeadLinks : function()
    {
        var head = this.getHeadElement();
        var existingLinks = head.getElementsByTagName("link");
        
        var existingHrefs = []
        for (var j = 0, innerLength = existingLinks.length; j < innerLength; j++)
        {
            var existingHref = existingLinks[j].getAttribute("href");
            existingHrefs.push(existingHref);
        }

        for(var i = 0, length = this._links.length; i < length; i++)
        {
            var href = this._links[i];
            href = href.replace(/&amp;amp;t/g, "&t");
            href = href.replace(/&amp;t/g, "&t");
            var alreadyExists = Array.contains(existingHrefs, href);
            
            if(!alreadyExists)
            {
		        if(href == "")
		            continue;

                var link = document.createElement("link");
                link.setAttribute("rel", "stylesheet");
                link.setAttribute("href", href);
                
                head.appendChild(link);
            }
        }
    },
    
    updateHeadStyles : function()
    {
        if (document.createStyleSheet != null)
        {
            //IE
            for (var i = 0, length = this._styles.length; i < length; i++)
            {
			    var cssCode = this._styles[i];
   				
                var newStyle = null;
                try
                {
                    newStyle = document.createStyleSheet();
                }
                catch(e)
                {}
                
                if(newStyle == null)
                {
                    newStyle = document.createElement('style');
                }
    			
			    newStyle.cssText = cssCode;
            }
        }
        else
        {
            //SAFARI, Moz, Opera
            var targetStylesheet = null;
            if (document.styleSheets.length == 0)
            {
	            css = document.createElement('style');
	            css.media = 'all';
	            css.type  = 'text/css';
    	        
	            var oldHeader = this.getHeadElement();
	            oldHeader.appendChild(css);
	            targetStylesheet = css;
            }

            if (document.styleSheets[0])
            {   
                 targetStylesheet = document.styleSheets[0];
            }
            
            for (var i = 0; i < this._styles.length; i++)
            {
			    var cssCode = this._styles[i];
                
                var rules = cssCode.split("}");

                for (var j = 0; j < rules.length; j++)
                {
                    if (rules[j].replace(/\s*/, "") == "")
                        continue;
                    
                    targetStylesheet.insertRule(rules[j] + "}", j + 1);
                }
            }
         }
    },
    
    getHeadElement : function()
    {
	    var heads = document.getElementsByTagName("head");
        if (heads.length > 0)
		    return heads[0];

	    //DESHEV: I think all browsers have a head, even if the server does not render one
	    //Just in case...
	    var head = document.createElement("head");
	    document.documentElement.appendChild(head);
	    return head;
    },
    
    ajaxRequest : function(args)
    {
        __doPostBack(this._uniqueID, args);
    },
    
    ajaxRequestWithTarget : function(eventTarget, eventArgument)
    {
        __doPostBack(eventTarget, eventArgument);
    },
    
    __doPostBack : function(sender, args)
    {
        var form = Sys.WebForms.PageRequestManager.getInstance()._form;
        if(form != null)
        {
            if(form["__EVENTTARGET"] != null)
                form["__EVENTTARGET"].value = sender;

            if(form["__EVENTARGUMENT"] != null)
                form["__EVENTARGUMENT"].value = args;

            form.submit();
        }
    }
}

//$telerik.makeCompatible(Telerik.Web.UI.RadAjaxControl);
Telerik.Web.UI.RadAjaxControl.registerClass('Telerik.Web.UI.RadAjaxControl', Sys.UI.Control);

Telerik.Web.UI.RadAjaxRequestEventArgs = function(eventTarget, eventArgument, enableAjax)
{
    Telerik.Web.UI.RadAjaxRequestEventArgs.initializeBase(this);
    
    this._enableAjax = enableAjax;
    this._eventTarget = eventTarget;
    this._eventArgument = eventArgument;
    
    this._postbackControlClientID = eventTarget.replace(/(\$|:)/g, "_");
    this._eventTargetElement = $get(this._postbackControlClientID);
    
    // OBSOLETE! 
    this.EnableAjax = this._enableAjax;
    this.EventTarget = this._eventTarget;
    this.EventArgument = this._eventArgument;
    this.EventTargetElement = this._eventTargetElement;
}

Telerik.Web.UI.RadAjaxRequestEventArgs.prototype = 
{
    get_enableAjax : function()
    {
        return this._enableAjax;
    },
    
    set_enableAjax : function(value)
    {
        if (this._enableAjax != value)
        {
            this._enableAjax = value;
        }
    },
    
    get_eventTarget : function()
    {
        return this._eventTarget;
    },
    
    get_eventArgument : function()
    {
        return this._eventArgument;
    },
    
    get_eventTargetElement : function()
    {
        return this._eventTargetElement;
    }
};

Telerik.Web.UI.RadAjaxRequestEventArgs.registerClass('Telerik.Web.UI.RadAjaxRequestEventArgs', Sys.CancelEventArgs);


Telerik.Web.UI.RadAjaxControl.History = {};

Telerik.Web.UI.RadAjaxControl.HandleHistory = function(clientID, data)
{
    if(window.netscape) return;

    var historyFrame = $get(clientID + "_History");
    if(historyFrame == null)
    {
        historyFrame = document.createElement("iframe");
        historyFrame.id = clientID + "_History";
        historyFrame.name = clientID + "_History";
        historyFrame.style.width = "0px";
        historyFrame.style.height = "0px";
        historyFrame.src = "javascript:''";
        historyFrame.style.visibility = "hidden";        

        var loadHandler = function(e)
        {
            if(!Telerik.Web.UI.RadAjaxControl.ShouldLoadHistory)
            {
                Telerik.Web.UI.RadAjaxControl.ShouldLoadHistory = true;
                return;
            }
            
            //if(!AjaxNS.IsInRequest)
            {
                var target = "";
                var argument = "";

                var dataValueElement = historyFrame.contentWindow.document.getElementById("__DATA");

                if(!dataValueElement) return;

                var dataArray = dataValueElement.value.split("&");

                for (var i = 0, length = dataArray.length; i < length; i++)
                {
                    var keyValue = dataArray[i].split("=");

                    if(keyValue[0] == "__EVENTTARGET")
                    {
                        target = keyValue[1];
                    }
                    
                    if(keyValue[0] == "__EVENTARGUMENT")
                    {
                        argument = keyValue[1];
                    }

                    var element = document.getElementById(Sys.WebForms.PageRequestManager.getInstance()._uniqueIDToClientID(keyValue[0]));
                    if(element != null)
                    {
                        Telerik.Web.UI.RadAjaxControl.RestorePostData(element, Telerik.Web.UI.RadAjaxControl.DecodePostData(keyValue[1]));
                    }
                }

                if(target != "")
                {
                    __doPostBack(Telerik.Web.UI.RadAjaxControl.DecodePostData(target), Telerik.Web.UI.RadAjaxControl.DecodePostData(argument), clientID);
                }
            }
        };

        $addHandler(historyFrame, "load", loadHandler);
        document.body.appendChild(historyFrame);
    }
    
    if(Telerik.Web.UI.RadAjaxControl.History[data] == null)
    {
        Telerik.Web.UI.RadAjaxControl.History[data] = true;
        Telerik.Web.UI.RadAjaxControl.AddHistoryEntry(historyFrame, data);
    }
};

Telerik.Web.UI.RadAjaxControl.AddHistoryEntry = function(historyFrame, data)
{
    Telerik.Web.UI.RadAjaxControl.ShouldLoadHistory = false;

    historyFrame.contentWindow.document.open();
    historyFrame.contentWindow.document.write("<input id='__DATA' name='__DATA' type='hidden' value='" + data + "' />");
    historyFrame.contentWindow.document.close();

    if(window.netscape)
    {
        historyFrame.contentWindow.document.location.hash = "#'" + new Date() + "'";
    }
};

Telerik.Web.UI.RadAjaxControl.DecodePostData = function(value)
{
    if (decodeURIComponent)
    {
        return decodeURIComponent(value);
    }
    else
    {
        return unescape(value);
    }
};

Telerik.Web.UI.RadAjaxControl.RestorePostData = function(element, value)
{
    if(element.tagName.toLowerCase() == "select")
    {
        for (var i = 0, length = element.options.length; i < length; i++)
        {
            if (value.indexOf(element.options[i].value) != -1)
            {
                element.options[i].selected = true;
            }
        }
    }

    if(element.tagName.toLowerCase() == "input" && (element.type.toLowerCase() == "text" || element.type.toLowerCase() == "hidden"))
    {
        element.value = value;
    }
    
    if(element.tagName.toLowerCase() == "input" && (element.type.toLowerCase() == "checkbox" || element.type.toLowerCase() == "radio"))
    {
        element.checked = value;
    }
};

Telerik.Web.UI.RadAjaxControl.GetNodeNextSibling = function (node)
{
	if (node != null && node.nextSibling != null)
	{
		return node.nextSibling;
	}
	return null;
};

Telerik.Web.UI.RadAjaxControl.InsertAtLocation = function(element, parent, nextSibling)
{	
	if (nextSibling != null)
    {		
	    return parent.insertBefore(element, nextSibling);
    }
    else
    {		
	    return parent.appendChild(element);
    }
};

Telerik.Web.UI.RadAjaxControl.FocusElement = function(controlId)
{
    var controlToFocus = document.getElementById(controlId);
    if (controlToFocus)
    {
        var controlTagName = controlToFocus.tagName;
        var controlType = controlToFocus.type;
        
        if (controlTagName.toLowerCase()== "input" && (controlType.toLowerCase() == "checkbox" || controlType.toLowerCase() == "radio"))
        {
            window.setTimeout(
                function()
                {
                    try 
                    {
                        controlToFocus.focus();
                    }
                    catch(e)
                    {}
                }, 500);
        }
        else
        {
            try 
            {
                Telerik.Web.UI.RadAjaxControl.SetSelectionFocus(controlToFocus);
                controlToFocus.focus();
            }
            catch(e)
            {}
        }
    }
};

Telerik.Web.UI.RadAjaxControl.SetSelectionFocus = function(element)
{
    if (element.createTextRange == null)
    {
        return;
    }
        
	var range = null;
	try
	{
	    range = element.createTextRange();
	}
	catch(e){}
	
	if (range != null)
	{
	    range.moveStart('textedit', range.text.length);
	    range.collapse(false);
	    range.select();
	}
};

Telerik.Web.UI.RadAjaxControl.panelsToClear = [];

Telerik.Web.UI.RadAjaxControl.UpdateElement = function(id, html)
{
    var element = $get(id);
    if(element != null)
    {
        element.innerHTML =  html;

        var scripts = Telerik.Web.UI.RadAjaxControl.GetScriptsSrc(html);
        for(var i = 0, length = scripts.length; i < length; i++)
        {
            Telerik.Web.UI.RadAjaxControl.IncludeClientScript(scripts[i]);
        }
        
        scripts = Telerik.Web.UI.RadAjaxControl.GetTags(html, "script");
        for(var i = 0, length = scripts.length; i < length; i++)
        {
            var script = scripts[i];
            if(script.inner != "")
            {
                Telerik.Web.UI.RadAjaxControl.EvalScriptCode(script.inner);
             }
        }

        var head = document.getElementsByTagName("head")[0];
        var hrefs = Telerik.Web.UI.RadAjaxControl.GetLinkHrefs(html);
        for(var i = 0, length = hrefs.length; i < length; i++)
        {
            var href = hrefs[i];
            var link = document.createElement("link");
            link.setAttribute("rel", "stylesheet");
            link.setAttribute("href", href);
            head.appendChild(link);
        }

    }
};

Telerik.Web.UI.RadAjaxControl.IncludeClientScript = function(src)
{
    var request = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

	request.open("GET", src, false);
	request.send(null);
	
	if(request.status == 200)
	{
		var scriptCode = request.responseText;
		Telerik.Web.UI.RadAjaxControl.EvalScriptCode(scriptCode);
	}
};

Telerik.Web.UI.RadAjaxControl.EvalScriptCode = function(scriptCode)
{
	if (Telerik.Web.UI.RadAjaxControl.IsSafari())
	{
		scriptCode = scriptCode.replace(/^\s*<!--((.|\n)*)-->\s*$/mi, "$1");
	}
	
    var newScript = document.createElement("script");
    newScript.setAttribute("type", "text/javascript");    		
   
    if (Telerik.Web.UI.RadAjaxControl.IsSafari())
    {
        newScript.appendChild(document.createTextNode(scriptCode));
    }
    else
    {
        newScript.text = scriptCode;
    }
    
	var scriptContainer = document.getElementsByTagName("head")[0];
	
	scriptContainer.appendChild(newScript);
    
    if (Telerik.Web.UI.RadAjaxControl.IsSafari())
    {
        newScript.innerHTML = "";
    }
    else
    {
        newScript.parentNode.removeChild(newScript);
    }
};

Telerik.Web.UI.RadAjaxControl.GetTags = function(htmlString, tagName)
{
    var result = [];
    var html = htmlString;
    while(1)
    {
        var tagContent = Telerik.Web.UI.RadAjaxControl.GetTag(html, tagName);
        if (tagContent.index == -1)
            break;
            
        result[result.length] = tagContent;
        var lastIndex = tagContent.index + tagContent.outer.length;
        html = html.substring(lastIndex, html.length);
    }
    return result;
}

Telerik.Web.UI.RadAjaxControl.GetTag = function(htmlString, tagName, defaultValue)
{
    if (typeof(defaultValue) == "undefined")
        defaultValue = "";
        
    var tagMatcher = new RegExp("<" + tagName + "[^>]*>((.|\n|\r)*?)</" + tagName + ">", "i");
    var tagMatch = htmlString.match(tagMatcher);
    
    if (tagMatch != null && tagMatch.length >= 2)
    {
        return { outer: tagMatch[0], inner: tagMatch[1], index: tagMatch.index };
    }
    else
    {
        return { outer: defaultValue, inner: defaultValue, index: -1 };
    }
}

Telerik.Web.UI.RadAjaxControl.GetLinkHrefs = function(htmlString)
{
    var html = htmlString;
    var hrefs = [];
    while(1)
    {
        var match = html.match(/<link[^>]*href=('|")?([^'"]*)('|")?([^>]*)>.*?(<\/link>)?/i);
        if (match == null || match.length < 3)
            break;
            
        var value = match[2];
        hrefs[hrefs.length] = value;
        var lastIndex = match.index + value.length;
        html = html.substring(lastIndex, html.length);
    }
    return hrefs;
}

Telerik.Web.UI.RadAjaxControl.GetScriptsSrc = function(htmlString)
{
    var html = htmlString;
    var hrefs = [];
    while(1)
    {
        var match = html.match(/<script[^>]*src=('|")?([^'"]*)('|")?([^>]*)>.*?(<\/script>)?/i);
        if (match == null || match.length < 3)
            break;
            
        var value = match[2];
        hrefs[hrefs.length] = value;
        var lastIndex = match.index + value.length;
        html = html.substring(lastIndex, html.length);
    }
    return hrefs;
}

Telerik.Web.UI.RadAjaxControl.IsSafari = function()
{
	return (navigator.userAgent.match(/safari/i) != null);
};

/* END Telerik.Web.UI.Ajax.RadAjaxControl.js */
/* START Telerik.Web.UI.Ajax.RadAjaxPanel.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadAjaxPanel = function(element) 
{
    Telerik.Web.UI.RadAjaxPanel.initializeBase(this, [element]);
    
    this._loadingPanelID = "";
    this._loadingPanelsToHide = [];
    
    this.Type = "Telerik.Web.UI.RadAjaxPanel";
    
    // OBSOLETE!
    this.LoadingPanelID = this._loadingPanelID;
}

Telerik.Web.UI.RadAjaxPanel.prototype = 
{
    initialize: function() 
    {
       var parentNode = this.get_element().parentNode;
       
       if(this.get_element().style.height != "")
       {
            parentNode.style.height = this.get_element().style.height;
            this.get_element().style.height = "100%";
       }
       
       if(this.get_element().style.width != "")
       {
            parentNode.style.width = this.get_element().style.width;
            this.get_element().style.width = "";
       }
       
       Telerik.Web.UI.RadAjaxPanel.callBaseMethod(this, 'initialize');
    },
    
    dispose: function() 
    {
        Telerik.Web.UI.RadAjaxPanel.callBaseMethod(this, 'dispose');
    },

    _initializeRequest : function(sender, args)
    {
        Telerik.Web.UI.RadAjaxPanel.callBaseMethod(this, '_initializeRequest', [sender, args]);
        
        if (!this._isRequestInProgress)
            return;

        var postBackElement = args.get_postBackElement();
        if (postBackElement != null && (postBackElement == this.get_element() || this.isChildOf(postBackElement, this.get_element())))
        {
            var panel = $find(this._loadingPanelID);
            if (panel != null)
            {
                panel._manager = this;

                if (panel.show(this.get_element().id))
                {
                    var obj = { "Panel" : panel, "ControlID" : this.get_element().id }

                    if(!Array.contains(this._loadingPanelsToHide, obj))
                    {
                        this._loadingPanelsToHide[this._loadingPanelsToHide.length] = obj;
                    }
                }
            }
        } 
    },
    
    get_loadingPanelID : function()
    {
        return this._loadingPanelID;
    },
    
    set_loadingPanelID : function(value)
    {
        if (this._loadingPanelID != value)
        {
            this._loadingPanelID = value;
        }
    }
}

Telerik.Web.UI.RadAjaxPanel.registerClass('Telerik.Web.UI.RadAjaxPanel', Telerik.Web.UI.RadAjaxControl);
/* END Telerik.Web.UI.Ajax.RadAjaxPanel.js */
/* START Telerik.Web.UI.Common.Navigation.ChangeLog.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.JavaScriptSerializer = {
	_stringRegEx : new RegExp('["\b\f\n\r\t\\\\\x00-\x1F]', 'i'),
	
	serialize : function (object)
	{
		var stringBuilder = new Telerik.Web.StringBuilder();
		Telerik.Web.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder);
		return stringBuilder.toString();
	},
	
	_serializeWithBuilder : function (object, stringBuilder) 
	{
		var i;
		switch (typeof object) 
		{
		case 'object':
			if (object) 
			{
				if (object.constructor == Array) 
				{
					stringBuilder.append('[');
					for (i = 0; i < object.length; ++i) 
					{
						if (i > 0) 
						{
							stringBuilder.append(',');
						}
						this._serializeWithBuilder(object[i], stringBuilder);
					}
					stringBuilder.append(']');
				}
				else 
				{
					if (object.constructor == Date) 
					{
						stringBuilder.append('"\\/Date(');
						stringBuilder.append(object.getTime());
						stringBuilder.append(')\\/"');
						break;
					}

					var properties = [];
					var propertyCount = 0;
					for (var name in object) 
					{
						if (name.startsWith('$')) 
						{
							continue;
						}
						properties[propertyCount++] = name;
					}
					
					stringBuilder.append('{');
					var needComma = false;
					for (i=0; i<propertyCount; i++) 
					{
						var value = object[properties[i]];
						if (typeof value !== 'undefined' && typeof value !== 'function') 
						{
							if (needComma) 
							{
								stringBuilder.append(',');
							}
							else 
							{
								needComma = true;
							}

							this._serializeWithBuilder(properties[i], stringBuilder);
							stringBuilder.append(':');
							this._serializeWithBuilder(value, stringBuilder);
						}
					}
					stringBuilder.append('}');
				}
			}
			else 
			{
				stringBuilder.append('null');
			}
			break;

		case 'number':
			if (isFinite(object)) 
			{
				stringBuilder.append(String(object));
			}
			else 
			{
				throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
			}
			break;

		case 'string':
			stringBuilder.append('"');

			if (Sys.Browser.agent === Sys.Browser.Safari || Telerik.Web.JavaScriptSerializer._stringRegEx.test(object)) 
			{
				var length = object.length;
				for (i = 0; i < length; ++i) 
				{
					var curChar = object.charAt(i);
					if (curChar >= ' ') 
					{
						if (curChar === '\\' || curChar === '"') 
						{
							stringBuilder.append('\\');
						}
					stringBuilder.append(curChar);
					}
					else 
					{
						switch (curChar) 
						{
							case '\b':
								stringBuilder.append('\\b');
								break;
							case '\f':
								stringBuilder.append('\\f');
								break;
							case '\n':
								stringBuilder.append('\\n');
								break;
							case '\r':
								stringBuilder.append('\\r');
								break;
							case '\t':
								stringBuilder.append('\\t');
								break;
							default:
								stringBuilder.append('\\u00');
								if (curChar.charCodeAt() < 16) stringBuilder.append('0');
								stringBuilder.append(curChar.charCodeAt().toString(16));
						}
					}
				}
			} 
			else 
			{
				stringBuilder.append(object);
			}
			stringBuilder.append('"');
			break;

		case 'boolean':
			stringBuilder.append(object.toString());
			break;

		default:
			stringBuilder.append('null');
			break;
		}
	}
}

Telerik.Web.UI.ChangeLog = function ()
{
	this._opCodeInsert = 1;
	this._opCodeDelete = 2;
	this._opCodeClear = 3;
	this._opCodePropertyChanged = 4;
	
	this._logEntries = null;
}

Telerik.Web.UI.ChangeLog.prototype =
{
	initialize : function ()
	{
		this._logEntries = [];
		this._serializedEntries = null;
	},
	
	logInsert : function (item)
	{
		var logEntry = {};
		logEntry.Type = this._opCodeInsert;
		logEntry.Index = item._getHierarchicalIndex();
		logEntry.Data = item._getData();
		
		Array.add(this._logEntries, logEntry);
	},
	
	logDelete : function (item)
	{
		var logEntry = {};
		logEntry.Type = this._opCodeDelete;
		logEntry.Index = item._getHierarchicalIndex();
		
		Array.add(this._logEntries, logEntry);
	},
	
	logClear : function (item)
	{
		var logEntry = {};
		logEntry.Type = this._opCodeClear;
		
		if (item._getHierarchicalIndex)
		{
			logEntry.Index = item._getHierarchicalIndex();
		}
		
		Array.add(this._logEntries, logEntry);
	},
	
	logPropertyChanged : function (item, propertyName, propertyValue)
	{
		var logEntry = {};
		logEntry.Type = this._opCodePropertyChanged;
		logEntry.Index = item._getHierarchicalIndex();
		logEntry.Data = {};
		logEntry.Data[propertyName] = propertyValue;
		
		Array.add(this._logEntries, logEntry);
	},
	
	serialize : function ()
	{	
		if(this._logEntries.length == 0)
		{
			if(this._serializedEntries == null)
			{
				return "[]";
			}

			return this._serializedEntries;
		}
	
		var newEntries = Telerik.Web.JavaScriptSerializer.serialize(this._logEntries);
	
		if(this._serializedEntries == null)
		{
			this._serializedEntries = newEntries;
		}
		else
		{
			this._serializedEntries = this._serializedEntries.substring(0, this._serializedEntries.length - 1) + ',' + newEntries.substring(1);
		}
		
		this._logEntries = [];
		
		return this._serializedEntries;
	}	
}

Telerik.Web.UI.ChangeLog.registerClass("Telerik.Web.UI.ChangeLog");


/* END Telerik.Web.UI.Common.Navigation.ChangeLog.js */
/* START Telerik.Web.UI.Common.Navigation.EventMap.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.EventMap = function ()
{
	this._owner = null;
	this._element = null;
	this._eventMap = {};
	this._onDomEventDelegate = null;
	this._browserHandlers = {};
}

Telerik.Web.UI.EventMap.prototype = 
{	
	initialize : function (owner, element)
	{
		this._owner = owner;
		if (!element)
			element = this._owner.get_element();
		this._element = element;
	},

	skipElement : function (e, knownClassName)
	{
		var target = e.target;
		var tagName = target.tagName.toLowerCase();
		var className = target.className;
		
		if (tagName == "select")
			return true;
		
		if (tagName == "option")
			return true;
			
		if (tagName == "a" && (!knownClassName || className.indexOf(knownClassName) < 0) )
			return true;
		
		if (tagName == "input")
			return true;
		
		if (tagName == "textarea")
			return true;
		
		if (tagName == "button")
			return true;
		
		return false;
	},
	
	dispose : function ()
	{
		if (this._onDomEventDelegate)
		{
			for (var eventName in this._eventMap)
			{
				if (this._shouldUseEventCapture(eventName))
				{
					var browserHandler = this._browserHandlers[eventName];
					this._element.removeEventListener(eventName, browserHandler, true);
				}
				else
				{
					$removeHandler(this._element, eventName, this._onDomEventDelegate);
				}
			}
			
			this._onDomEventDelegate = null;   
			 
            var dispose = true;
            if (this._element._events) {
                for (var e in this._element._events) {
                    if (this._element._events[e].length > 0) {
                        dispose = false;
                        break;
                    }
                }
                
                if (dispose)
                    this._element._events = null;
            }
		}
	},
	
	// Public methods
	addHandlerForClassName : function (eventName, className, handler)
	{
		if (typeof(this._eventMap[eventName]) == "undefined")
		{
			this._eventMap[eventName] = {};
			
			if (this._shouldUseEventCapture(eventName))
			{
				var domEventHandler = this._getDomEventDelegate();
				var element = this._element;
				var browserHandler = function(e) { return domEventHandler.call(element, new Sys.UI.DomEvent(e)); }
				this._browserHandlers[eventName] = browserHandler;
				element.addEventListener(eventName, browserHandler, true);
			}
			else
			{
				$addHandler(this._element, eventName, this._getDomEventDelegate());
			}
		}
		
		var eventHandlers = this._eventMap[eventName];
		eventHandlers[className] = handler;
	},
	
	// Private methods
	_onDomEvent: function(e)
	{
		var dispatchees = this._eventMap[e.type];
		if (!dispatchees) 
			return;
		
		var target = e.target;
		while (target && target.nodeType !== 9) 
		{
			var className = target.className;
			if (!className)
			{
				target = target.parentNode;
				continue;
			}
			var subClasses = className.split(' ');
			
			var dispatchee = null;
			
			for (var i = 0; i < subClasses.length; i++)
			{
				dispatchee = dispatchees[subClasses[i]];
				if (dispatchee) break;
			}
			
			if (dispatchee) 
			{
				this._fillEventFields(e, target);
				if (dispatchee.call(this._owner, e) != true) 
				{
					if (!target.parentNode) 
					{
						// The target was removed from the DOM in the event handler.
						// Event propagation in this case causes "Unspecified error" in IE6.
						e.stopPropagation();
					}
					
					return;
				}
			}
			
			if (target == this._element) 
			{
				return;
			}
			
			target = target.parentNode;			
		}
	},
	
	_fillEventFields : function (e, currentTarget)
	{
		e.eventMapTarget = currentTarget;
		if (e.rawEvent.relatedTarget)
		{
			e.eventMapRelatedTarget = e.rawEvent.relatedTarget;
		}
		else
		{
			if (e.type == "mouseover")
			{
				e.eventMapRelatedTarget = e.rawEvent.fromElement;
			}
			else
			{	
				e.eventMapRelatedTarget = e.rawEvent.toElement;
			}
		}
		
		if (!e.eventMapRelatedTarget)
			return;
		
		try 
		{
			// Fix for FireFox "_moz_editor_bogus_node" problem.
			// Happens on mouseout and mouseover when the related target is an input element.
			// For some reason input elements have an "anonymous" div as a child:
			// <div class="anonymous-div" style="white-space: pre;" _moz_editor_bogus_node="TRUE" _moz_dirty="">
			// Accessing *any* attribute of such a node will throw "permission denied" error.
			var className = e.eventMapRelatedTarget.className;
		} 
		catch (ex) 
		{
			// Skip to the parent element.
			e.eventMapRelatedTarget = this._element;
		}		
	},
	
	_shouldUseEventCapture : function(eventName)
	{
		return (eventName == "blur" || eventName == "focus") && $telerik.isFirefox && Sys.Browser.version >= 3;
	},
	
	_getDomEventDelegate : function ()
	{
		if (!this._onDomEventDelegate)
		{
			this._onDomEventDelegate = Function.createDelegate(this, this._onDomEvent);
		}
		
		return this._onDomEventDelegate;
	}
}

Telerik.Web.UI.EventMap.registerClass('Telerik.Web.UI.EventMap');


/* END Telerik.Web.UI.Common.Navigation.EventMap.js */
/* START Telerik.Web.UI.Common.jQuery.js */
/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();

// Move jQuery to $telerik
$telerik.$ = jQuery.noConflict(true);

/* END Telerik.Web.UI.Common.jQuery.js */
/* START Telerik.Web.UI.Common.jQueryPlugins.js */
//Check for custom jquery and update $telerik.$ in that case
if (typeof $telerik.$ === "undefined")
	$telerik.$ = jQuery;

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Open source under the BSD License. 
 * 
 * Copyright � 2008 George McGinley Smith
 * All rights reserved.
*/

/*
 * EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright � 2001 Robert Penner
 * All rights reserved.
 */

(function(_1){
_1.easing["jswing"]=_1.easing["swing"];
_1.extend(_1.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){
return _1.easing[_1.easing.def](x,t,b,c,d);
},easeLinear:function(x,t,b,c,d){
return c*t/d+b;
},easeInQuad:function(x,t,b,c,d){
return c*(t/=d)*t+b;
},easeOutQuad:function(x,t,b,c,d){
return -c*(t/=d)*(t-2)+b;
},easeInOutQuad:function(x,t,b,c,d){
if((t/=d/2)<1){
return c/2*t*t+b;
}
return -c/2*((--t)*(t-2)-1)+b;
},easeInCubic:function(x,t,b,c,d){
return c*(t/=d)*t*t+b;
},easeOutCubic:function(x,t,b,c,d){
return c*((t=t/d-1)*t*t+1)+b;
},easeInOutCubic:function(x,t,b,c,d){
if((t/=d/2)<1){
return c/2*t*t*t+b;
}
return c/2*((t-=2)*t*t+2)+b;
},easeInQuart:function(x,t,b,c,d){
return c*(t/=d)*t*t*t+b;
},easeOutQuart:function(x,t,b,c,d){
return -c*((t=t/d-1)*t*t*t-1)+b;
},easeInOutQuart:function(x,t,b,c,d){
if((t/=d/2)<1){
return c/2*t*t*t*t+b;
}
return -c/2*((t-=2)*t*t*t-2)+b;
},easeInQuint:function(x,t,b,c,d){
return c*(t/=d)*t*t*t*t+b;
},easeOutQuint:function(x,t,b,c,d){
return c*((t=t/d-1)*t*t*t*t+1)+b;
},easeInOutQuint:function(x,t,b,c,d){
if((t/=d/2)<1){
return c/2*t*t*t*t*t+b;
}
return c/2*((t-=2)*t*t*t*t+2)+b;
},easeInSine:function(x,t,b,c,d){
return -c*Math.cos(t/d*(Math.PI/2))+c+b;
},easeOutSine:function(x,t,b,c,d){
return c*Math.sin(t/d*(Math.PI/2))+b;
},easeInOutSine:function(x,t,b,c,d){
return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
},easeInExpo:function(x,t,b,c,d){
return (t==0)?b:c*Math.pow(2,10*(t/d-1))+b;
},easeOutExpo:function(x,t,b,c,d){
return (t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;
},easeInOutExpo:function(x,t,b,c,d){
if(t==0){
return b;
}
if(t==d){
return b+c;
}
if((t/=d/2)<1){
return c/2*Math.pow(2,10*(t-1))+b;
}
return c/2*(-Math.pow(2,-10*--t)+2)+b;
},easeInCirc:function(x,t,b,c,d){
return -c*(Math.sqrt(1-(t/=d)*t)-1)+b;
},easeOutCirc:function(x,t,b,c,d){
return c*Math.sqrt(1-(t=t/d-1)*t)+b;
},easeInOutCirc:function(x,t,b,c,d){
if((t/=d/2)<1){
return -c/2*(Math.sqrt(1-t*t)-1)+b;
}
return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;
},easeInElastic:function(x,t,b,c,d){
var s=1.70158;
var p=0;
var a=c;
if(t==0){
return b;
}
if((t/=d)==1){
return b+c;
}
if(!p){
p=d*0.3;
}
if(a<Math.abs(c)){
a=c;
var s=p/4;
}else{
var s=p/(2*Math.PI)*Math.asin(c/a);
}
return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;
},easeOutElastic:function(x,t,b,c,d){
var s=1.70158;
var p=0;
var a=c;
if(t==0){
return b;
}
if((t/=d)==1){
return b+c;
}
if(!p){
p=d*0.3;
}
if(a<Math.abs(c)){
a=c;
var s=p/4;
}else{
var s=p/(2*Math.PI)*Math.asin(c/a);
}
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;
},easeInOutElastic:function(x,t,b,c,d){
var s=1.70158;
var p=0;
var a=c;
if(t==0){
return b;
}
if((t/=d/2)==2){
return b+c;
}
if(!p){
p=d*(0.3*1.5);
}
if(a<Math.abs(c)){
a=c;
var s=p/4;
}else{
var s=p/(2*Math.PI)*Math.asin(c/a);
}
if(t<1){
return -0.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;
}
return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*0.5+c+b;
},easeInBack:function(x,t,b,c,d,s){
if(s==undefined){
s=1.70158;
}
return c*(t/=d)*t*((s+1)*t-s)+b;
},easeOutBack:function(x,t,b,c,d,s){
if(s==undefined){
s=1.70158;
}
return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;
},easeInOutBack:function(x,t,b,c,d,s){
if(s==undefined){
s=1.70158;
}
if((t/=d/2)<1){
return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;
}
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;
},easeInBounce:function(x,t,b,c,d){
return c-_1.easing.easeOutBounce(x,d-t,0,c,d)+b;
},easeOutBounce:function(x,t,b,c,d){
if((t/=d)<(1/2.75)){
return c*(7.5625*t*t)+b;
}else{
if(t<(2/2.75)){
return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b;
}else{
if(t<(2.5/2.75)){
return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b;
}else{
return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b;
}
}
}
},easeInOutBounce:function(x,t,b,c,d){
if(t<d/2){
return _1.easing.easeInBounce(x,t*2,0,c,d)*0.5+b;
}
return _1.easing.easeOutBounce(x,t*2-d,0,c,d)*0.5+c*0.5+b;
}});
})($telerik.$);


(function(jQuery){
	jQuery.fx.step.height = function (fx){
		//Using "1" instead of "0" because of IE in quirks mode.
		var initialValue = $telerik.quirksMode ? 1 : 0;
		var value = fx.now > initialValue ? fx.now : initialValue;
		fx.elem.style[fx.prop]= Math.round(value) + fx.unit;
	}
})($telerik.$);

/* END Telerik.Web.UI.Common.jQueryPlugins.js */
/* START Telerik.Web.UI.Common.Navigation.AttributeCollection.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.AttributeCollection = function (owner)
{
	this._owner = owner;
	this._data = {};
	this._keys = [];
}

Telerik.Web.UI.AttributeCollection.prototype = 
{
	getAttribute : function (key)
	{
		return this._data[key];
	},
	
	setAttribute : function (key, value)
	{
		this._add(key, value);
		
		var attributeEntry = {};
		attributeEntry[key] = value;

		this._owner._notifyPropertyChanged("attributes", attributeEntry);
	},
	
	_add : function (key, value)
	{
		if (Array.indexOf(this._keys, key) < 0)
			Array.add(this._keys, key);
			
		this._data[key] = value;
	},
	
	removeAttribute : function (key)
	{
		Array.remove(this._keys, key);
		
		delete this._data[key];
	},
	
	_load : function (json, wcf)
	{
		if (wcf)
		{
			for (var i = 0, l = json.length; i < l; i++)
				this._add(json[i].Key, json[i].Value);
		}	
		else
		{
			for (var key in json)
				this._add(key, json[key]);
		}
	},
	
	get_count : function ()
	{
		return this._keys.length;
	}
}

Telerik.Web.UI.AttributeCollection.registerClass('Telerik.Web.UI.AttributeCollection');
/* END Telerik.Web.UI.Common.Navigation.AttributeCollection.js */
/* START Telerik.Web.UI.Common.Navigation.ControlItemContainer.js */
function WebForm_CallbackComplete() 
{  
    for (var i = 0; i < __pendingCallbacks.length; i++) {
  
        var callbackObject = __pendingCallbacks[i];
        if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
            __pendingCallbacks[i] = null;
            WebForm_ExecuteCallback(callbackObject);
            if (!callbackObject.async) {
                __synchronousCallBackIndex = -1;
            }
            
            var callbackFrameID = "__CALLBACKFRAME" + i;
            var xmlRequestFrame = document.getElementById(callbackFrameID);
            if (xmlRequestFrame) {
                xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
            }
        }
    }
}

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.ControlItemContainer = function (element)
{
	Telerik.Web.UI.ControlItemContainer.initializeBase(this, [element]);
	
	this._childControlsCreated = false;
	this._enabled = true;
	this._log = new Telerik.Web.UI.ChangeLog();
	this._enableClientStatePersistence = false;
	this._eventMap = new Telerik.Web.UI.EventMap();
	this._attributes = new Telerik.Web.UI.AttributeCollection(this);
	this._children = null;
}

Telerik.Web.UI.ControlItemContainer.prototype =
{
	initialize : function ()
	{
		Telerik.Web.UI.ControlItemContainer.callBaseMethod(this, 'initialize');

		this._ensureChildControls();
		this._log.initialize();
		this._initializeEventMap();
	},
	
	dispose : function ()
	{	
		this._eventMap.dispose();

        if(this._childControlsCreated)
        {
		    for (var i = 0; i < this._getChildren().get_count(); i++)
		    {
			    this._getChildren().getItem(i)._dispose();
		    }
		}

		Telerik.Web.UI.ControlItemContainer.callBaseMethod(this, 'dispose');
	},
	
	trackChanges : function ()
	{
		this._enableClientStatePersistence = true;
	},
	
	set_enabled: function(value)
	{
		this._enabled = value;
	},
	
	get_enabled: function()
	{
		return this._enabled;
	},
	
	commitChanges : function ()
	{
		this.updateClientState();
		this._enableClientStatePersistence = false;
	},
	
	get_attributes : function ()
	{
		return this._attributes;
	},
	
	set_attributes : function (value)
	{
		this._attributes._load(value);
	},
	
	
	/*------------- Private Methods -----------*/
	_initializeEventMap : function()
	{
		this._eventMap.initialize(this);
	},

	_getChildren : function ()
	{
		this._ensureChildControls();
		return this._children;
	},
	
	_extractErrorMessage : function (error)
	{
		if (error.get_message)
		{
			// AJAX Exception
			return error.get_message();
		}
		else
		{		
			// ASP.NET callback return error messages in the following form:
			// <exception message><eventValidationLength>|<eventValidationString> e.g.
			// Object reference not set to an instance of an object.56|/wEWAwLM2oLGBwLs0bLrBgLs0fbZDC3VMN/DL8xzHgo9Pw1ztfesraLy
			return error.replace(/(\d*\|.*)/,"");
		}
	},

	_notifyPropertyChanged : function (propertyName, propertyValue)
	{
		
	},
	
	_childInserting : function (index, item, parent)
	{
		
	},
	
	_childInserted : function (index, item, parent)
	{
		if (!parent._childControlsCreated) return;
		if (!parent.get_element()) return;
		
		var itemElement = item._createDomElement();
		var parentListElement = parent.get_childListElement();
		
		if (!parentListElement) 
			parentListElement = parent._createChildListElement();
		
		var nextItem = item.get_nextSibling();
		var nextItemElement = nextItem ? nextItem.get_element() : null;
		parent.get_childListElement().insertBefore(itemElement, nextItemElement);
		
		if (!item.get_element()) 
		{
			item.set_element(itemElement);
			item._initializeRenderedItem();
		}
		else 
		{
			item.set_element(itemElement);
		}
	},
	
	_childrenCleared : function (parent)
	{
		for(var i = 0; i < parent._getChildren().get_count(); i++)
		{
			parent._getChildren().getItem(i)._dispose();
		}
		
		var childListElement = parent.get_childListElement();
		if(childListElement)
			childListElement.innerHTML = "";
	},
	
	_childRemoving : function (child)
	{
		this._logRemoving(child);
	},
	
	_childRemoved : function (item, parent)
	{
		item._dispose();
	},

	_createChildListElement : function()
	{
		throw Error.notImplemented();
	},

	_createDomElement : function()
	{
		throw Error.notImplemented();
	},

	_getControl : function ()
	{
		return this;
	},
	
	_logInserted : function (item)
	{
		if (!item.get_parent()._childControlsCreated || !this._enableClientStatePersistence) return;
		
		this._log.logInsert(item);
		
		var children = item._getAllItems();
		for (var i = 0; i < children.length; i++)					
		{
			this._log.logInsert(children[i]);
		}
	},
	
	_logRemoving : function (item)
	{
		if (this._enableClientStatePersistence)
			this._log.logDelete(item);
	},
	
	_logClearing : function (item)
	{
		if (this._enableClientStatePersistence)
			this._log.logClear(item);
	},
	
	_itemPropertyChanged : function (item, property, value)
	{
		if (this._enableClientStatePersistence)
			this._log.logPropertyChanged(item, property, value);
	},
	
	_ensureChildControls : function ()
	{
		if (!this._childControlsCreated)
		{		
			this._createChildControls();
			this._childControlsCreated = true;
		}
	},
	
	_extractItemFromDomElement : function (element)
	{
        this._ensureChildControls();
		while (element && element.nodeType !== 9)
		{
			if (element._item && this._verifyChildType(element._itemTypeName))
				return element._item;
				
			element = element.parentNode;
		}
		return null;
	},
	
	_verifyChildType : function (targetTypeName)
	{
		return targetTypeName === this._childTypeName;
	},
	
	_getAllItems : function ()
	{
		var allItems = [];
		for (var i = 0; i < this._getChildren().get_count(); i++)
		{
			var item = this._getChildren().getItem(i);
			Array.add(allItems, item);
			Array.addRange(allItems, item._getAllItems());
		}
		
		return allItems;
	},
	
	_findItemByText : function (text)
	{
		var allItems = this._getAllItems();
		for (var i = 0; i < allItems.length; i++)
		{
			if (allItems[i].get_text() == text)
				return allItems[i];
		}
		return null;
	},
	
	_findItemByValue : function (value)
	{
		var allItems = this._getAllItems();
		for (var i = 0; i < allItems.length; i++)
		{
			if (allItems[i].get_value() == value)
				return allItems[i];
		}
		return null;
	},
	
	_findItemByAttribute : function(attributeName, value)
	{
		var allItems = this._getAllItems();
		for (var i = 0; i < allItems.length; i++)
		{
			if (allItems[i].get_attributes().getAttribute(attributeName) == value)
				return allItems[i];
		}
		return null;
	},
	
	_findItemByAbsoluteUrl: function (value)
	{
		var allItems = this._getAllItems();
		for (var i = 0; i < allItems.length; i++)
		{
			if (allItems[i].get_linkElement() && allItems[i].get_linkElement().href == value)
				return allItems[i];
		}
		return null;
	},
	
	_findItemByUrl: function (value)
	{
		var allItems = this._getAllItems();
		for (var i = 0; i < allItems.length; i++)
		{
			if (allItems[i].get_navigateUrl() == value)
				return allItems[i];
		}
		return null;
	},
	
	_findItemByHierarchicalIndex : function (index)
	{
		var currentItem = null;
		var container = this;
		var indexes = index.split(":");
		for (var i = 0; i < indexes.length; i++)
		{
			var currentIndex = parseInt(indexes[i]);
			if (container._getChildren().get_count() <= currentIndex)
				return null;

			currentItem = container._getChildren().getItem(currentIndex);
			container = currentItem;
		}

		return currentItem;
	}
}

Telerik.Web.UI.ControlItemContainer.registerClass("Telerik.Web.UI.ControlItemContainer", Telerik.Web.UI.RadWebControl);

/* END Telerik.Web.UI.Common.Navigation.ControlItemContainer.js */
/* START Telerik.Web.UI.Common.Navigation.ControlItemCollection.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.ControlItemCollection = function (parent)
{
	this._array = new Array();
	this._parent = parent;
	this._control = null;
}

Telerik.Web.UI.ControlItemCollection.prototype = 
{
	add : function (item)
	{	
		var index = this._array.length;
		this.insert(index, item);
	},
	
	insert : function (index, item)
	{
		var itemParent = item.get_parent();
		var control = this._parent._getControl();
		
		if(itemParent)
			itemParent._getChildren().remove(item);
		
		if (control)
			control._childInserting(index, item, this._parent);
			
		Array.insert(this._array, index, item);
		item.set_parent(this._parent);

		if (control)
		{
			control._childInserted(index, item, this._parent);
			control._logInserted(item);
		}
	},
	
	remove : function (item)
	{
		var control = this._parent._getControl();
		if (control)
			control._childRemoving(item);
		
		Array.remove(this._array, item);
		
		if (control)
			control._childRemoved(item, this._parent);
			
		item.set_parent(null);
		item._control = null;
	},
	
	removeAt : function (index)
	{
		var item = this.getItem(index);
		if (item)
			this.remove(item);
	},
	
	clear : function ()
	{
		var control = this._parent._getControl();
		if (control)
		{
			control._logClearing(this._parent);
			control._childrenCleared(this._parent);
		}
		
		this._array = new Array();
	},
	
	get_count : function ()
	{
		return this._array.length;
	},
	
	getItem : function(index)
	{
		return this._array[index];
	},
	
	indexOf : function (item)
	{
		for (var i = 0, l = this._array.length; i < l; i ++)
		{
		    if (this._array[i] === item)
		        return i;
		}
		return -1;
	},

	forEach : function (lambda)
	{
	    for (var i = 0, count = this.get_count(); i < count; i++)
	    {
	        lambda(this._array[i]);
	    }
	}
}

Telerik.Web.UI.ControlItemCollection.registerClass("Telerik.Web.UI.ControlItemCollection");

/* END Telerik.Web.UI.Common.Navigation.ControlItemCollection.js */
/* START Telerik.Web.UI.Common.Navigation.ControlItem.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.PropertyBag = function (owner)
{
    this._data = {};
    this._owner = owner;
}

Telerik.Web.UI.PropertyBag.prototype = {
  getValue : function (propertyName, defaultValue)
  {
    var value = this._data[propertyName];
    
    if (typeof(value) === "undefined")
        return defaultValue;
    
    return value;
  },
  
  setValue : function (propertyName, value, notify)
  {
    this._data[propertyName] = value;
    
    if (notify)
        this._owner._notifyPropertyChanged(propertyName, value);
  },
  
  load : function (data)
  {
    this._data = data;
  }
};

Telerik.Web.UI.ControlItem = function()
{
	this._element = null;
	this._parent = null;
	this._text = null;
	this._children = null;
	this._childControlsCreated = false;
	this._itemData = null;
	this._control = null;
	this._properties = new Telerik.Web.UI.PropertyBag(this);
}

Telerik.Web.UI.ControlItem.prototype = 
{
	_shouldNavigate: function()
	{
		var navigateUrl = this.get_navigateUrl();
		if (!navigateUrl) return false;
		
		return !navigateUrl.endsWith("#");
	},
	
	_getNavigateUrl : function ()
	{
		if (this.get_linkElement())
		    return this._properties.getValue("navigateUrl", this.get_linkElement().getAttribute("href", 2));
		
		return this._properties.getValue("navigateUrl", null);
	},
	
	_initialize: function(json, element)
	{
		this.set_element(element);
		this._properties.load(json);
		
		if (json["attributes"])
			this.get_attributes()._load(json["attributes"]);
			
		this._itemData = json["items"];
	},
		
	_dispose: function()
	{
		if (this._children) 
			this._children.forEach(function(child) { child._dispose(); } );
		
		if (this._element) 
		{
			this._element._item = null;
			this._element = null;
		}
		
		if (this._control) 
			this._control = null;
	},


	// Public methods

	_initializeRenderedItem: function()
	{
		var childItems = this._children;
		if (!childItems || childItems.get_count() < 1) 
			return;
		
		var childElements = this._getChildElements();
		
		for (var i = 0, length = childItems.get_count(); i < length; i++) 
		{
			var childItem = childItems.getItem(i);
			if (!childItem.get_element()) 
			{
				childItem.set_element(childElements[i]);
				if (this._shouldInitializeChild(childItem)) 
				{
					childItem._initializeRenderedItem();
				}
			}
		}
	},
	
	findControl : function (id)
	{
		return $telerik.findControl(this.get_element(), id);
	},
	
	get_attributes : function ()
	{
		if (!this._attributes)
		    this._attributes = new Telerik.Web.UI.AttributeCollection(this);
		return this._attributes;
	},
	
	// Public properties
	
	get_element: function()
	{
		return this._element;
	},
	
	set_element: function(value)
	{
		this._element = value;
		this._element._item = this;
        this._element._itemTypeName = Object.getTypeName(this);
	},
	
	get_parent: function()
	{
		return this._parent;
	},
	
	set_parent: function(value)
	{
		this._parent = value;
	},
	
	get_text : function ()
	{
		 if (this._text !== null) return this._text;

        if (this._text = this._properties.getValue("text", ""))
            return this._text;
		
		if (!this.get_element())
			return "";
		
		var textElement = this.get_textElement();
		if (!textElement)
			return "";

		if (typeof(textElement.innerText) != "undefined")
			this._text = textElement.innerText;
		else
			this._text = textElement.textContent;
			
		if($telerik.isSafari2)
		{
			this._text = textElement.innerHTML;
		}
		return this._text;
	},

	set_text : function (text)
	{ 
	    var textElement = this.get_textElement();
	    if (textElement)
			textElement.innerHTML = text;
	    
	    this._text = text;
	    this._properties.setValue("text", text, true);	    
	},
		
	get_value: function()
	{
		return this._properties.getValue("value", null);
	},
	
	set_value: function(value)
	{
		this._properties.setValue("value", value, true);
	},
	
	get_itemData: function()
	{
		return this._itemData;
	},
	
	get_index : function ()
	{
		if (!this.get_parent())
		    return -1;
			
		return this.get_parent()._getChildren().indexOf(this);
	},
	
	set_enabled: function(value)
	{
		this._properties.setValue("enabled", value, true);
	},
	
	get_enabled: function()
	{
		return this._properties.getValue("enabled", true) == true;
	},
	
	get_isEnabled : function()
	{
		var control = this._getControl();
		if (control)
			return control.get_enabled() && this.get_enabled();
		
		return this.get_enabled();
	},
	
	set_visible: function(value)
	{
		this._properties.setValue("visible", value);
	},
	
	get_visible: function()
	{
		return this._properties.getValue("visible", true);
	},
	
	get_level : function ()
	{
		var parent = this.get_parent();
		var level = 0;
			
		while (parent) 
		{
			
			if (Telerik.Web.UI.ControlItemContainer.isInstanceOfType(parent)) 
			{
				return level;
			}
			
			level++;
			parent = parent.get_parent();
		}
		
		return level;
	},
	
	get_isLast : function()
	{
		return this.get_index() == this.get_parent()._getChildren().get_count() - 1;
	},
	
	get_isFirst : function()
	{
		return this.get_index() == 0;
	},
	
	get_nextSibling : function ()
	{
		if (!this.get_parent())
			return null;
		return this.get_parent()._getChildren().getItem(this.get_index() + 1);
	},
	
	get_previousSibling : function ()
	{
		if (!this.get_parent())
			return null;
		
		return this.get_parent()._getChildren().getItem(this.get_index() - 1);
	},
	
	toJsonString : function () 
	{
		return Sys.Serialization.JavaScriptSerializer.serialize(this._getData());
	},
	
	// Private methods
	_getHierarchicalIndex : function () 
	{
		var indexes = [];
		var control = this._getControl();
		var current = this;

		while (current != control)
		{
			indexes[indexes.length] = current.get_index();
			current = current.get_parent();
		}
		
		return indexes.reverse().join(":");
	},
	
	_getChildren : function()
	{
		this._ensureChildControls();
		return this._children;
	},
	
	_ensureChildControls: function()
	{
		if (!this._childControlsCreated) 
		{
			this._createChildControls();
			this._childControlsCreated = true;
		}
	},

	_setCssClass : function(element, cssClass)
	{
		if (element.className != cssClass)
			element.className = cssClass;
	},

	_createChildControls: function()
	{
		this._children = this._createItemCollection();
	},
	
	_createItemCollection : function()
	{
	},
	
	_getControl: function()
	{
		if (!this._control) 
		{
			var parent = this.get_parent();
			
			if (parent) 
			{
				if (Telerik.Web.UI.ControlItemContainer.isInstanceOfType(parent)) 
				{
					this._control = parent;
				}
				else 
				{
					this._control = parent._getControl();
				}
			}
		}
		
		return this._control;
	},
	
	_getAllItems: function()
	{
		var items = [];
		this._getAllItemsRecursive(items, this);
		return items;
	},
	
	_getAllItemsRecursive: function(items, currentItem)
	{
		var children = currentItem._getChildren();
		for (var i = 0; i < children.get_count(); i++) 
		{
			var child = children.getItem(i);
			Array.add(items, child);
			this._getAllItemsRecursive(items, child);
		}
	},
	
	_getData: function()
	{
		var data = this._properties._data;
		
		//we don't need this - it comes from the initial JSON
		delete data.items;	
		
		data["text"] = this.get_text()
		
		if (this.get_attributes().get_count() > 0)
			data["attributes"] = this.get_attributes()._data;
		
		return data;
	},
	
	_notifyPropertyChanged: function(property, value)
	{
		var control = this._getControl();
		if (control) 
			control._itemPropertyChanged(this, property, value);
	},
	
	_loadFromDictionary : function (data, wcf)
	{
		if (typeof(data.Text) != "undefined")
			this.set_text(data.Text);

		if (typeof(data.Value) != "undefined" && data.Value !== "")
			this.set_value(data.Value);
		
		if (typeof(data.Enabled) != "undefined" && data.Enabled !== true)
			this.set_enabled(data.Enabled);

		if (data.Attributes)
			this.get_attributes()._load(data.Attributes, wcf);
	},
	
	_createDomElement: function()
	{
		var itemElementParent = document.createElement("ul");
		var html = [];
		
		this._render(html);
		
		itemElementParent.innerHTML = html.join("");
		return itemElementParent.firstChild;
	}
}

Telerik.Web.UI.ControlItem.registerClass('Telerik.Web.UI.ControlItem');


/* END Telerik.Web.UI.Common.Navigation.ControlItem.js */
/* START Telerik.Web.UI.PanelBar.RadPanelBar.js */
Type.registerNamespace("Telerik.Web.UI");

// ---------- Telerik.Web.UI.ExpandMode Enum ----------
Telerik.Web.UI.ExpandMode = function (){};
Telerik.Web.UI.ExpandMode.prototype = 
{
	MultipleExpandedItems:0,
	SingleExpandedItem :1,
	FullExpandedItem : 2
}
Telerik.Web.UI.RadPanelBar = function(element)
{
	Telerik.Web.UI.RadPanelBar.initializeBase(this, [element]);
	
	this._childTypeName = "Telerik.Web.UI.RadPanelItem";
	
	this._items = null;
	this._itemData = null;
	this._postBackReference = null;
	this._fullExpandedItem = false;
	this._singleExpandedItem = false;
	this._multipleExpandedItems = true;
	this._allowCollapseAllItems = false;
	this._expandedItem = null;
	this._selectedItem = null;
	this._skin = "";
	this._lastExpandedItem = null;
	this._focusedItem = null;
	this._expandedItemsJson = "[]";
	this._selectedItemsJson = "[]";
	this._logEntriesJson = "[]";
	this._clientState = {
		expandedItems:[],
		logEntries:[],
		selectedItems:[]
	};
	this._fireEvents = true;
	this._persistStateInCookie = false;
	this._cookieName = this.get_id();
	this._expandMode = Telerik.Web.UI.ExpandMode.MultipleExpandedItems;
	this._expandAnimation = new Telerik.Web.UI.AnimationSettings({});
	this._collapseAnimation = new Telerik.Web.UI.AnimationSettings({});
	
}

Telerik.Web.UI.RadPanelBar._createChildControls = function(parent, items)
{
	var itemData = parent.get_itemData();
	
	if (!itemData) 
		return;
	var  childListElement = parent.get_childListElement();
	
	if (!childListElement) return;
	var childElements = $telerik.getChildrenByTagName(childListElement, "li");
	Sys.Debug.assert(itemData.length == childElements.length, "Length of elements and json must be the same!");
	
	for (var i = 0; i < itemData.length; i++) 
	{	
	
		var item = new Telerik.Web.UI.RadPanelItem();
		items.add(item);
		item._initialize(itemData[i], childElements[i]);
	}
}

Telerik.Web.UI.RadPanelBar.prototype =
{	
	initialize : function ()
	{
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, 'initialize');
		this._eventMap.addHandlerForClassName("mouseover", "rpLink", this._onLinkMouseOver);
		this._eventMap.addHandlerForClassName("mouseout", "rpLink", this._onLinkMouseOut);
		this._eventMap.addHandlerForClassName("click", "rpLink", this._onLinkClick);
		this._eventMap.addHandlerForClassName("keydown", "rpLink", this._onLinkKeyDown);
		this._eventMap.addHandlerForClassName("blur", "rpLink", this._onLinkBlur);
		this._eventMap.addHandlerForClassName("deactivate", "rpLink", this._onLinkBlur);
		this._eventMap.addHandlerForClassName("focus", "rpLink", this._onLinkFocus);
		this._eventMap.addHandlerForClassName("activate", "rpLink", this._onLinkFocus);
		this._eventMap.addHandlerForClassName("contextmenu", "rpLink", this._contextMenuHandler);
		this._onWindowResizeDelegate = Function.createDelegate(this, this._windowResizeHandler);
		$addHandler(window, "resize", this._onWindowResizeDelegate);
		
		
		if (this.get_fullExpandedItem())
		{
			this.get_element().style.overflow = "hidden";
		}
		
		this._raiseEvent("load", null);
	},
	
	repaint : function ()
	{
		this._resizeHandler();
		this._repaintPanelBarItems();
	},
	
	_windowResizeHandler : function ()
	{
		this._resizeHandler();
		this._callRadResize();
	},
	
	_contextMenuHandler : function (e)
	{
		if (!e) e = event;
		var item = this._extractItemFromDomElement(e.eventMapTarget);
		var contextmenuArgs = new Telerik.Web.UI.RadPanelItemCancelEventArgs(item, e);
		this._raiseEvent("contextMenu", contextmenuArgs);
		if(contextmenuArgs.get_cancel())
		{
			e.preventDefault();
		}
	},
	
	_callRadResize : function ()
	{
		this._callRadShow();
	},
	
	_callRadShow : function ()
	{
		//Empty panelbar
		if (!this.get_childListElement())
			return;
		
		$telerik.repaintChildren(this);
		this._repaintPanelBarItems();
		
	},
	
	_repaintPanelBarItems: function ()
	{
		for (var i = 0; i < this.get_expandedItems().length; i++)
		{
			var expandedItem = this.get_expandedItems()[i];
			expandedItem._windowLoadHandler(false);
		}
	},
	
	_resizeHandler : function ()
	{
		if (this.disposed) return;
		
		if (this.get_expandedItem())
		{
			if (this.get_fullExpandedItem())// && !this.ExpandedItem.EaseInProgress)
			{
				var groupHeight = this._getGroupHeight();
				if (groupHeight > 0)
				{
					this.get_expandedItem()._setChildrenHeight(groupHeight);
				}
			}
		}
	},

	_renderInProgress : function()
	{
		//return this.get_element().offsetWidth == 0;
		
		return this.get_element() && this.get_element().setHeight == "true";
	},
	
	dispose : function ()
	{
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, 'dispose');
		
		$removeHandler(window, "resize", this._onWindowResizeDelegate);
		
		if (this._eventMap) 
		{
			this._eventMap.dispose();
			this._eventMap = null;
		}
	},
	
	_createChildControls: function()
	{
		this._children = new Telerik.Web.UI.RadPanelItemCollection(this);
		Telerik.Web.UI.RadPanelBar._createChildControls(this, this._children);
	},
		
		
	get_childListElement: function()
	{
		/// <exclude/>
		
		if (!this._childListElement) 
		{
			this._childListElement = $telerik.getFirstChildByTagName(this.get_element(), "ul", 0);
		}
		return this._childListElement;
	},
	
	// Public properties	
	disableEvents: function()
	{
		this._fireEvents = false;
	},
	
	enableEvents: function()
	{
		this._fireEvents = true;
	},
	
	findItemByText: function(text)
	{
		return this._findItemByText(text);
	},
	
	findItemByUrl: function(value)
	{
		return this._findItemByUrl(value);
	},
	
	findItemByAbsoluteUrl: function(value)
	{
		return this._findItemByAbsoluteUrl(value);
	},
	
	findItemByValue: function(value)
	{
		return this._findItemByValue(value);
	},
		
	findItemByAttribute : function (attributeName, attributeValue)
	{
		return this._findItemByAttribute(attributeName, attributeValue);
	},

	get_allItems : function()
	{
		return this._getAllItems();
	},
	
	get_items: function()
	{
		return this._getChildren();
	},
	
	set_items: function(value)
	{
		this._children = value;
	},
	
	get_itemData : function ()
	{
		return this._itemData;
	},
	
	set_itemData: function (value)
	{
		this._itemData = value;
	},
	
	set_fullExpandedItem : function(value)
	{
		this._fullExpandedItem = value;
	},
	
	set_singleExpandedItem : function(value)
	{
		this._singleExpandedItem = value;
	},
	
	set_multiExpandedItem : function(value)
	{
		this._multiExpandedItem = value;
	},
	
	get_fullExpandedItem : function()
	{
		return this.get_expandMode() == 2 ;
	},
	
	get_singleExpandedItem : function()
	{	
		
		return this.get_expandMode() == 1 || this.get_expandMode() == 2;
	},
	
	get_multiExpandedItem : function()
	{
		return this._multiExpandedItem ;
	},
	
	set_expandedItem : function(value)
	{
		this._expandedItem = value;
	},
	
	get_expandedItem : function()
	{
		return this._expandedItem ;
	},
		
	set_lastExpandedItem : function(value)
	{
		this.lastExpandedItem = value;
	},
	
	set_selectedItem : function(value)
	{
		this._selectedItem = value;
	},
	
	get_selectedItem : function()
	{
		return this._selectedItem ;
	},
		
	
	get_lastExpandedItem : function()
	{
		return this._lastExpandedItem ;
	},
	
	get_focusedItem: function()
	{
		return this._focusedItem;
	},
	
	set_focusedItem : function(value)
	{
		this._focusedItem = value;
	},
	get_expandMode : function()
	{
		return this._expandMode;
	},
	
	set_expandMode : function(value)
	{
		this._expandMode = value;		
	},
	
	set_persistStateInCookie  : function(value)
	{
		 this._persistStateInCookie  = value;	
	},
	
	get_persistStateInCookie  : function()
	{
		return this._persistStateInCookie ;
	},
	set_cookieName  : function(value)
	{
		 this._cookieName  = value;	
	},
	
	get_cookieName  : function()
	{
		return this._cookieName ;
	},
	set_allowCollapseAllItems : function(value)
	{
		 this._allowCollapseAllItems = value;	
	},
	
	get_allowCollapseAllItems : function()
	{
		return this._allowCollapseAllItems;
	},
	
	get_expandAnimation: function()
	{
		/// <exclude/>
		
		return this._expandAnimation;
	},
	
	set_expandAnimation: function(value)
	{
		/// <exclude/>
		
		var deserializedAnimationSettings = Sys.Serialization.JavaScriptSerializer.deserialize(value);
		this._expandAnimation = new Telerik.Web.UI.AnimationSettings(deserializedAnimationSettings);
	},
	
	get_collapseAnimation: function()
	{
		/// <exclude/>
		
		return this._collapseAnimation;
	},
	
	set_collapseAnimation: function(value)
	{
		/// <exclude/>
		
		var deserializedAnimationSettings = Sys.Serialization.JavaScriptSerializer.deserialize(value);
		this._collapseAnimation = new Telerik.Web.UI.AnimationSettings(deserializedAnimationSettings);
	},
	//public methods
	commitChanges : function()
	{
		this._logEntriesJson = this._log.serialize();
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, "commitChanges");
	},
	
	saveClientState : function()
	{
		if( this._persistStateInCookie)
		{
			this._persistState();
		}
		return "{\"expandedItems\":" + this._expandedItemsJson + 
			",\"logEntries\":" + this._logEntriesJson + 
				",\"selectedItems\":" + this._selectedItemsJson + "}";
				
				
	},

	_updateExpandState : function()
	{
		this._expandedItemsJson = 
			Sys.Serialization.JavaScriptSerializer.serialize(this._clientState.expandedItems);

		this.updateClientState();
	},
	
	_updateSelectedState : function()
	{
		this._selectedItemsJson = 
			Sys.Serialization.JavaScriptSerializer.serialize(this._clientState.selectedItems);
		this.updateClientState();
	},
	
	_registerExpandedItem : function (item)
	{
		var index = item._getHierarchicalIndex();
		
		if (Array.contains(this._clientState.expandedItems, index))
			return;
			
		Array.add(this._clientState.expandedItems, index);
		
		this._updateExpandState();		
	},
	
	_registerSelectedItem : function(item)
	{
		if (Array.contains(this._clientState.selectedItems, item._getHierarchicalIndex()))
		return;
		
		Array.add(this._clientState.selectedItems, item._getHierarchicalIndex());
		
		this._updateSelectedState();
		
	},
	
	_unregisterSelectedItem : function(item)
	{
		Array.remove(this._clientState.selectedItems, item._getHierarchicalIndex());
		this._updateSelectedState();
	},
	
	_unregisterExpandedItem : function(item)
	{
		Array.remove(this._clientState.expandedItems, item._getHierarchicalIndex());
		this._updateExpandState();
	},
	
	_unregisterItemFromClientState : function(item)
	{
		Array.remove(this._clientState.expandedItems, item._getHierarchicalIndex());
		Array.remove(this._clientState.selectedItems, item._getHierarchicalIndex());  
	},
	
	_unregisterItemChildrenFromClientState : function(item)
	{
		for(var i = 0; i < item.get_items().get_count(); i++)
		{
			this._unregisterItemHierarchyFromClientState(item.get_items().getItem(i));
		}
	},	
	
	_unregisterItemHierarchyFromClientState : function(item)
	{
		this._unregisterItemFromClientState(item);
		this._unregisterItemChildrenFromClientState(item);
	},	
	
	_backupClientState : function ()
	{
		this._backupExpandedItems = this.get_expandedItems();
		this._backupSelectedItems = this.get_selectedItems();
	},
	
	
	get_selectedItems : function ()
	{
		var selectedItems = [];
		for (var i = 0; i < this._clientState.selectedItems.length; i++)
		{
			var selectedItem = this._findItemByHierarchicalIndex(this._clientState.selectedItems[i]);
			Array.add(selectedItems, selectedItem);
		}
		return selectedItems;
	},
	
	get_expandedItems : function ()
	{
		var expandedItems = [];
		for (var i = 0; i < this._clientState.expandedItems.length; i++)
		{
			var expandedItem = this._findItemByHierarchicalIndex(this._clientState.expandedItems[i]);
			Array.add(expandedItems, expandedItem);
		}
		return expandedItems;
	},
	
	_restoreClientState : function ()
	{
		this._clientState.selectedItems = [];
		
		for (var i = 0; i < this._backupSelectedItems.length; i++)
		{
			Array.add(this._clientState.selectedItems, 
				this._backupSelectedItems[i]._getHierarchicalIndex());
		}
		
		this._clientState.expandedItems = [];
		
		for (var i = 0; i < this._backupExpandedItems.length; i++)
		{
			Array.add(this._clientState.expandedItems, 
				this._backupExpandedItems[i]._getHierarchicalIndex());
		}
		
		this._updateExpandState();
		this._updateSelectedState();
		
	},
	
	_persistState : function ()
	{
	
		var cookieValue = "{";
		if (this.get_selectedItem())
		{
			cookieValue += "\"SelectedItems\":" + this._selectedItemsJson + ",";
		}
		cookieValue += "\"ExpandedItems\":" + this._expandedItemsJson + "}";
	
		document.cookie = this.get_cookieName() + "=" + cookieValue  + ";path=/;expires=";

	},
	
	_getGroupHeight : function ()
	{	
		var expanedItem = this.get_expandedItem();
		var childListElement =  this.get_childListElement();
		if (expanedItem)
		{
			expanedItem._getAnimationContainer().style.display = "none";
			expanedItem.get_childListElement().style.display = "none";
		}

		var returnValue = this.get_element().offsetHeight - childListElement.offsetHeight;

		if (returnValue == 0)
		{
			returnValue = this.get_element().style.pixelHeight - childListElement.offsetHeight;
		}
		if (returnValue < 0)
		{
			returnValue = childListElement.offsetHeight;
			this.get_element().style.overflow = "auto";
		}
		if (expanedItem)
		{
			expanedItem._getAnimationContainer().style.display = "block";
			expanedItem.get_childListElement().style.display = "block";
		}

		return returnValue;
	},
	
	_raiseEvent : function(eventName, eventArgs)
	{
		if (this._fireEvents)
		{
			this.raiseEvent(eventName, eventArgs);
		}
	},
	_postback: function(hierarchicalIndex)
	{
		if (!this._postBackReference)
			return;
			
		var postbackFunction = this._postBackReference.replace("arguments", 
				hierarchicalIndex);
		eval(postbackFunction);
	},
	
	disable: function()
	{
		this.set_enabled(false);
	},
	
	enable: function()
	{
		this.set_enabled(true);
	},
	
	set_enabled: function(value)
	{
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, "set_enabled", [value]);
		
		if (!this.get_isInitialized())
			return;
		
		var element = this.get_element();
		var items = this.get_items();
		var itemCount = items.get_count();
		if (!value)
		{
			element.disabled = "disabled";
			var disabledCssClass = String.format("RadPanelBar_{0}_disabled", this._skin);
			this.toggleCssClass(disabledCssClass);
			this.disableEvents();
			
			for (var i = 0; i < itemCount; i++)
			{
				items.getItem(i).disable();
			}
		}
		else
		{
			element.disabled = "";
			var disabledCssClass = String.format("RadPanelBar_{0}_disabled", this._skin);
			this.toggleCssClass(disabledCssClass);
			this.enableEvents();
			
			for (var i = 0; i < itemCount; i++)
			{
				items.getItem(i).enable();
			}
		}
	},
	
	_onLinkClick: function(e)
	{
		var item = this._extractItemFromDomElement(e.eventMapTarget);
		
		if (!item._click(e))
		{
			e.preventDefault();
			return false;
		}
		
		return true;
	},
	
	_onLinkMouseOver: function(e)
	{
		var relatedTarget = e.eventMapRelatedTarget;
		var item = this._extractItemFromDomElement(e.eventMapTarget);

		var linkElement = item.get_linkElement();
		if (!relatedTarget || linkElement == relatedTarget ||
			$telerik.isDescendant(linkElement, relatedTarget))
		{
			return true;
		}
	
		item._hovered = true;
		if (item.get_isEnabled()) 
		{
			item._updateImageUrl();
		}
		
	
		this._raiseEvent("mouseOver", new Telerik.Web.UI.RadPanelMouseOverEventArgs(item, e));
			
		return true;
	},
	
	_onLinkMouseOut: function(e)
	{
		var relatedTarget = e.eventMapRelatedTarget;
		var item = this._extractItemFromDomElement(e.eventMapTarget);

		var linkElement = item.get_linkElement();
		
		if (!relatedTarget || !linkElement) 
		{
			return;
		}
		
		if (linkElement == relatedTarget ||
			$telerik.isDescendant(linkElement, relatedTarget))
		{
			return true;
		}

		item._hovered = false;
		if (item.get_isEnabled()) 
		{
			item._updateImageUrl();
		}
	
		this._raiseEvent("mouseOut", new Telerik.Web.UI.RadPanelMouseOutEventArgs(item, e));
		
		return true;
	},
	
	_onLinkBlur: function(e)
	{
		var item = this._extractItemFromDomElement(e.eventMapTarget);

		if (!item.get_isEnabled()) 
		{
			return true;
		}
		
		// The blur method will try to blur the link element if the item is not already marked as blurred.
		item._focused = false;
		
		item._blur(e);
		
		return true;
	},
		
	_onLinkFocus: function(e)
	{
		var item = this._extractItemFromDomElement(e.eventMapTarget);

		if (!item.get_isEnabled()) 
		{
			return true;
		}
		
		// The focus method will try to focus the link element if the item is not already marked as focused.
		item._focused = true;
		
		item.focus(e);
		
		return true;
	},
		
		
	_onLinkKeyDown: function(e)
	{
		var item = this._extractItemFromDomElement(e.eventMapTarget);
	
		if (!item.get_isEnabled()) 
		{
			return true;
		}
		
		return item._onKeyDown(e);
	},
	
	_childInserting : function (index, item, parent)
	{
		if (!parent._childControlsCreated) return;
		
		this._backupClientState();
	},

	_childInserted : function(index, item, parent)
	{
		if (!parent._childControlsCreated) return;
	
		this._restoreClientState();
		this._callRadResize();	
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, "_childInserted", [index, item, parent]);
		
	},

	_childrenCleared: function(parent)
	{
		this._unregisterItemChildrenFromClientState(parent);
		
		if(parent.collapse)
		{
			parent.collapse();
		}
			
		if (parent._slideWrapElement) 
		{
			parent._slideWrapElement.outerHTML = "";
			parent._slideWrapElement = null;
			parent._animationContainer = null;
		}
		parent._linkElement = null;
		parent._childListElement = null;

		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, "_childrenCleared", [parent]);
	},
	
	_childRemoving : function (item)
	{
		item.unSelect();
		if(item.get_parent().get_items().get_count() == 1 && item.get_parent().collapse)
		{
			item.get_parent().collapse()
		}
		this.set_selectedItem(null);
		this._unregisterItemHierarchyFromClientState(item);	
		this._backupClientState();
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, "_childRemoving", [item]);
	},

	_childRemoved: function(item, parent)
	{
		
		var childElement = item.get_element();
		if (parent.get_items().get_count() == 0) 
		{

			if (parent._slide) 
			{
				parent._slide.dispose();
				parent._slide = null;
			}

			childElement = $telerik.getFirstChildByTagName(parent.get_element(), "div", 0);
			if(item.get_level()==0)
			{
				childElement = $telerik.getFirstChildByTagName(parent.get_element(), "ul", 0);
			}
			
			parent._linkElement = null;
			parent._childListElement = null;
			parent._slideWrapElement = null;
			parent._animationContainer = null;
		}
		if (childElement) 
		{
			childElement.outerHTML = "";
			
			if (childElement.parentNode) 
			{
				childElement.parentNode.removeChild(childElement);
			}
			childElement = null;
		}
		
		var itemsCount = parent.get_items().get_count();
		if (itemsCount > 0) 
		{
			var firstItemElement = parent.get_items().getItem(0).get_element();
			if (firstItemElement && !Sys.UI.DomElement.containsCssClass(firstItemElement, "rpFirst")) 
			{
				
				firstItemElement.className += " rpFirst";
				firstItemElement.className = firstItemElement.className.replace("rpLast rpFirst", "rpFirst rpLast");
			}
		}
		
		var lastIndex = itemsCount - 1;
		if (itemsCount > 0) 
		{
			var lastItemElement = parent.get_items().getItem(lastIndex).get_element();
			if (lastItemElement && !Sys.UI.DomElement.containsCssClass(lastItemElement, "rpLast")) 
			{
				lastItemElement.className += " rpLast";
			}
		}
		this._restoreClientState();	
		this._callRadResize();
		
		if(item.get_level() > 0 && parent.get_expanded()&& parent.get_childListElement())
		{
			if(parent.get_childListElement().offsetHeight+"px" != parent._getAnimationContainer().style.height)
			{
				parent._getAnimationContainer().style.height = parent.get_childListElement().offsetHeight;
			}
		}
		
		Telerik.Web.UI.RadPanelBar.callBaseMethod(this, "_childRemoved", [item, parent]);		

	},
	
	_createChildListElement : function()
	{
		var childListElement = document.createElement("ul");
		childListElement.className = "rpRootGroup";
		this.get_element().appendChild(childListElement);
		return childListElement;
	},
	
	// Events
	add_load: function(handler)
	{
		this.get_events().addHandler("load", handler);
	},
	
	remove_load: function(handler)
	{
		this.get_events().removeHandler("load", handler);
	},
	
	add_mouseOver: function(handler)
	{
		this.get_events().addHandler("mouseOver", handler);
	},
	
	remove_mouseOver: function(handler)
	{
		this.get_events().removeHandler("mouseOver", handler);
	},
	
	add_mouseOut: function(handler)
	{
		this.get_events().addHandler("mouseOut", handler);
	},
	
	remove_mouseOut: function(handler)
	{
		this.get_events().removeHandler("mouseOut", handler);
	},
	
	add_itemClicked: function(handler)
	{
		this.get_events().addHandler("itemClicked", handler);
	},
	
	remove_itemClicked: function(handler)
	{
		this.get_events().removeHandler("itemClicked", handler);
	},
	
	add_itemClicking: function(handler)
	{
		this.get_events().addHandler("itemClicking", handler);
	},
	
	remove_itemClicking: function(handler)
	{
		this.get_events().removeHandler("itemClicking", handler);
	},
	
	add_itemExpand: function(handler)
	{
		this.get_events().addHandler("itemExpand", handler);
	},
	
	remove_itemExpand: function(handler)
	{
		this.get_events().removeHandler("itemExpand", handler);
	},
	
	add_itemCollapse: function(handler)
	{
		this.get_events().addHandler("itemCollapse", handler);
	},
	
	remove_itemCollapse: function(handler)
	{
		this.get_events().removeHandler("itemCollapse", handler);
	},
	add_itemFocus: function(handler)
	{
		this.get_events().addHandler("itemFocus", handler);
	},
	
	remove_itemFocus: function(handler)
	{
		this.get_events().removeHandler("itemFocus", handler);
	},
	
	add_itemBlur: function(handler)
	{
		this.get_events().addHandler("itemBlur", handler);
	},
	
	remove_itemBlur: function(handler)
	{
		this.get_events().removeHandler("itemBlur", handler);
	},
	add_contextMenu: function(handler)
	{
		this.get_events().addHandler("contextMenu", handler);
	},
	
	remove_contextMenu: function(handler)
	{
		this.get_events().removeHandler("contextMenu", handler);
	}
	
}

Telerik.Web.UI.RadPanelBar._getChildListElement = function(element)
{
	var childListElement = $telerik.getFirstChildByTagName(element, "ul", 0);
	return childListElement;
}


Telerik.Web.UI.RadPanelBar._preInitialize = function(elementId)
{
	var element = $get(elementId);
	var childList = Telerik.Web.UI.RadPanelBar._getChildListElement(element)
	if (childList)
	{
		var childElements = $telerik.getChildrenByTagName(childList, "li");
		for (var i = 0; i < childElements.length; i++) 
		{	
			var slide =  $telerik.getFirstChildByTagName(childElements[i], "div", 0);
			if(slide && slide.style.display == "block")
			{
				Telerik.Web.UI.RadPanelBar._setHeight(slide,elementId);
			}
		}
	}
}

Telerik.Web.UI.RadPanelBar._setHeight = function(element,elementId)
{
	var groupHeight = Telerik.Web.UI.RadPanelBar._getGroupHeight(element, elementId);
	if (groupHeight > 0)
	{
		Telerik.Web.UI.RadPanelBar._setChildrenHeight(groupHeight, element);
		$get(elementId).setHeight = "true";
	}
	var childList = Telerik.Web.UI.RadPanelBar._getChildListElement(element)
	if (childList)
	  childList.style.width = "100%";
}

Telerik.Web.UI.RadPanelBar._setChildrenHeight = function (groupHeight, element)
{
	if (groupHeight < 0) groupHeight = 0;
	if (!groupHeight == "") groupHeight += "px";
	
	var childList = Telerik.Web.UI.RadPanelBar._getChildListElement(element)
	if (childList)
	{
		childList.style.height = groupHeight;
		element.style.height = groupHeight;
	}
	
}
Telerik.Web.UI.RadPanelBar._getGroupHeight = function (element, elementId)
{	
	var childList = Telerik.Web.UI.RadPanelBar._getChildListElement(element)
	if (childList==null)
	{
		return;
	}
	var panelElement = $get(elementId);
	var panelChildList = Telerik.Web.UI.RadPanelBar._getChildListElement(panelElement)
	element.style.display = "none";
	childList.style.display = "none";
	
	var returnValue = panelElement.offsetHeight - panelChildList.offsetHeight;

	if (returnValue < 0)
	{
		returnValue = panelChildList.offsetHeight;
		panelChildList.style.overflow = "auto";
	}
	
	element.style.display = "block";
	childList.style.display = "block";
	

	return returnValue;
},
	
Telerik.Web.UI.RadPanelBar.registerClass('Telerik.Web.UI.RadPanelBar', Telerik.Web.UI.ControlItemContainer);

/* END Telerik.Web.UI.PanelBar.RadPanelBar.js */
/* START Telerik.Web.UI.PanelBar.ClientEvents.js */
// ---------- RadPanelEventArgs Class ----------
Telerik.Web.UI.RadPanelEventArgs = function()
{
	Telerik.Web.UI.RadPanelEventArgs.initializeBase(this);
}

Telerik.Web.UI.RadPanelEventArgs.prototype =
{
}

Telerik.Web.UI.RadPanelEventArgs.registerClass('Telerik.Web.UI.RadPanelEventArgs', Sys.EventArgs);

// ---------- RadPanelItemEventArgs Class ----------
Telerik.Web.UI.RadPanelItemEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemEventArgs.initializeBase(this);
	this._item = item;
	this._domEvent = e;
}

Telerik.Web.UI.RadPanelItemEventArgs.prototype =
{
	get_item : function ()
	{
		return this._item;
	},
	
	get_domEvent : function ()
	{
		return this._domEvent;
	}
}
Telerik.Web.UI.RadPanelItemEventArgs.registerClass('Telerik.Web.UI.RadPanelItemEventArgs', Sys.EventArgs);


// ---------- RadPanelItemCancelEventArgs Class ----------
Telerik.Web.UI.RadPanelItemCancelEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemCancelEventArgs.initializeBase(this);
	this._item = item;
	this._domEvent = e;
}

Telerik.Web.UI.RadPanelItemCancelEventArgs.prototype =
{
	get_item : function ()
	{
		return this._item;
	},
	
	get_domEvent : function ()
	{
		return this._domEvent;
	}
}
Telerik.Web.UI.RadPanelItemCancelEventArgs.registerClass('Telerik.Web.UI.RadPanelItemCancelEventArgs', Sys.CancelEventArgs);


// ---------- RadPanelMouseOverEventArgs Class ----------
Telerik.Web.UI.RadPanelMouseOverEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelMouseOverEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelMouseOverEventArgs.registerClass('Telerik.Web.UI.RadPanelMouseOverEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);


// ---------- RadPanelMouseOutEventArgs Class ----------
Telerik.Web.UI.RadPanelMouseOutEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelMouseOutEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelMouseOutEventArgs.registerClass('Telerik.Web.UI.RadPanelMouseOutEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);


// ---------- RadPanelItemFocusEventArgs Class ----------
Telerik.Web.UI.RadPanelItemFocusEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemFocusEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelItemFocusEventArgs.registerClass('Telerik.Web.UI.RadPanelItemFocusEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);


// ---------- RadPanelItemBlurEventArgs Class ----------
Telerik.Web.UI.RadPanelItemBlurEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemBlurEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelItemBlurEventArgs.registerClass('Telerik.Web.UI.RadPanelItemBlurEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);


// ---------- RadPanelItemClickingEventArgs Class ----------
Telerik.Web.UI.RadPanelItemClickingEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemClickingEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelItemClickingEventArgs.registerClass('Telerik.Web.UI.RadPanelItemClickingEventArgs', Telerik.Web.UI.RadPanelItemCancelEventArgs);


// ---------- RadPanelItemClickedEventArgs Class ----------
Telerik.Web.UI.RadPanelItemClickedEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemClickedEventArgs.initializeBase(this,[item, e]);
}
Telerik.Web.UI.RadPanelItemClickedEventArgs.registerClass('Telerik.Web.UI.RadPanelItemClickedEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);


// ---------- RadPanelItemExpandEventArgs Class ----------
Telerik.Web.UI.RadPanelItemExpandEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemExpandEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelItemExpandEventArgs.registerClass('Telerik.Web.UI.RadPanelItemExpandEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);



// ---------- RadPanelItemCollapseEventArgs Class ----------
Telerik.Web.UI.RadPanelItemCollapseEventArgs = function(item, e)
{
	Telerik.Web.UI.RadPanelItemCollapseEventArgs.initializeBase(this, [item, e]);
}
Telerik.Web.UI.RadPanelItemCollapseEventArgs.registerClass('Telerik.Web.UI.RadPanelItemCollapseEventArgs', Telerik.Web.UI.RadPanelItemEventArgs);

/* END Telerik.Web.UI.PanelBar.ClientEvents.js */
/* START Telerik.Web.UI.PanelBar.RadPanelItem.js */
(function ($) {

// ---------- RadPanelItem Class ----------
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadPanelItem = function()
{
	Telerik.Web.UI.RadPanelItem.initializeBase(this);
	
	this._properties = new Telerik.Web.UI.PropertyBag(this);
	
		this._linkElement = null;
		this._imageElement = null;
		this._hoveredImageUrl = "";
		this._selectedImageUrl = "";
		this._expandedImageUrl = "";
		this._postBack = true;
		this._childListElement = null;
		this._cssClass = "";
		this._navigateAfterClick = true;
		this._focusedCssClass = "rpFocused";
		this._selectedCssClass = "rpSelected";
		this._clickedCssClass = "rpClicked";
		this._expandedCssClass = "rpExpanded";
		this._disabledCssClass = "rpDisabled";
		this._expandedItem = null;
		this._lastExpandedItem = null;
		this._selectedItem = null;
		this._focusedItem = null;
		this._focused = false;
		this._clicked = false;
		this._enabled = true;
		this._expanded = false;
		this._selected = false;
		this._templated = false;
		this._preventCollapse = false;
		this._slideWrapElement = null;
		this._animationContainer = null;
		/* Animation */
		this._expanding = null;
		this._changedOverflow = false;
	    this._styleCssText = null;
	    this._registeredInitializedItems = false;
}

Telerik.Web.UI.RadPanelItem.prototype = 
{
	// Initialization and disposing
	
	_initialize: function(json, element)
	{
		Telerik.Web.UI.RadPanelItem.callBaseMethod(this, '_initialize', [json, element]);

	    this._properties.load(json);
	
	   if (this.get_expanded())
			this._ensureChildControls();
		
		//this._updateLinkClass();
		
		var element = this.get_element();
		var instance = this;
		this._renderAccessKey();
		this._windowLoadHandlerSavingState = Function.createDelegate(this, this._windowLoadHandlerSavingState);
		Sys.Application.add_load(this._windowLoadHandlerSavingState);

		this._attachEventsToTheLinkElement();

	},
	
	_attachEventsToTheLinkElement:function()
	{
	    // There is a bug in ASP.NET AJAX in IE, the workaround is to attach the handler directly
		if(this.get_linkElement())
		{
				this._onLinkMouseDown = Function.createDelegate(this, this._onLinkMouseDown);
				this._onLinkMouseUp = Function.createDelegate(this, this._onLinkMouseUp);
		    if($telerik.isIE)
		    {
		        this.get_linkElement().attachEvent("onmousedown",this._onLinkMouseDown);
		        this.get_linkElement().attachEvent("onmouseup",this._onLinkMouseUp);
		    }
		    else
		    {
			    $addHandler(this.get_linkElement(), "mousedown", this._onLinkMouseDown);
				 $addHandler(this.get_linkElement(), "mouseup", this._onLinkMouseUp);
		    }
		}
	},
	
	_windowLoadHandlerSavingState : function (e) 
	{
		if (this.get_expanded())
		{
				this.get_parent().set_expandedItem(this);
				this.get_panelBar()._registerExpandedItem(this);
		}
		if (this.get_selected())
		{	
			this.get_panelBar().set_selectedItem(this);
			this.get_panelBar()._registerSelectedItem(this);
		}
		this._updateImageUrl();
		this._windowLoadHandler(true);
		
	},
	
	_windowLoadHandler : function (callRadShow) 
	{	
		
		if(this.get_element()==null)
		{
			return;
		}
		if (this.get_expanded() && this.get_childListElement())
		{
			this.get_childListElement().style.display = "none";
		
			this.get_childListElement().style.width = "100%";//this.DomElement.offsetWidth + "px";
			
			
			if (this.get_level() > 0 && !this.get_panelBar().get_fullExpandedItem())
			{
				this.get_parent()._setChildrenHeight("");
			}
			
			this.get_childListElement().style.display = "block";
		
			if(callRadShow)
			{
				this.get_panelBar()._callRadShow();
			}
		}
		
		if (this.get_panelBar()._renderInProgress())
		{
			return;
		}
		
		if (this.get_expanded() && this.get_level() == 0 && this.get_panelBar().get_fullExpandedItem())// && !this.ExpandedItem.EaseInProgress)
		{
			var groupHeight = this.get_panelBar()._getGroupHeight();
		
			if (groupHeight > 0)
			{
				this._setChildrenHeight(groupHeight);
			}
		}
		
		Sys.Application.remove_load(this._windowLoadHandlerSavingState);
	},
	
	_dispose: function()
	{
		Telerik.Web.UI.RadPanelItem.callBaseMethod(this, '_dispose');
		
		if(this.get_linkElement())
		{
		    if($telerik.isIE)
		    {
		        this.get_linkElement().detachEvent("onmousedown",this._onLinkMouseDown);
		        this.get_linkElement().detachEvent("onmouseup",this._onLinkMouseUp);
		    }
		    else
		    {
			    $removeHandler(this.get_linkElement(), "mousedown", this._onLinkMouseDown);
				    $removeHandler(this.get_linkElement(), "mouseup", this._onLinkMouseUp);
		    }
		}
	},
	
	_shouldInitializeChild: function(childItem)
	{
		return true;
	},
	
	_callRadShow : function ()
	{
		var children =  this.get_childListElement().getElementsByTagName("*");
		for (var i = 0, length = children.length; i < length; i ++)
		{
			var child = children[i];
			if (child.RadShow)
			{
				child.RadShow();
			}
		}
	},
	
		
	_onLinkMouseDown: function(e)
	{
		if (!this.get_isEnabled()) 
		{
			return true;
		}
		
		this._clicked = true;
		this._updateLinkClass();
		this._updateImageUrl();
			
		return true;
	},
		
	_onLinkMouseUp: function(e)
	{
		
		if (!this.get_isEnabled()) 
		{
			return true;
		}
	
		this._clicked = false;
		this._updateLinkClass();
		this._updateImageUrl();
			
		return true;
	},
	_updateLinkClass :function ()
	{	
		if (this.get_isSeparator()||!this.get_linkElement())
		{
			return;
		}
		
		var cssClass = "rpLink " + this.get_cssClass();
		
		if (this.get_expandable() )
		{
			cssClass = "rpLink rpExpandable " + this.get_cssClass()
		}
		
		if (this.get_focused())
		{
			cssClass = cssClass + " " + this.get_focusedCssClass();
		}
		
		if (this.get_selected() )
		{
			cssClass = cssClass + " " + this.get_selectedCssClass();
		}	

		if (this.get_expanded())
		{
			cssClass = cssClass + " " + this.get_expandedCssClass();
			this.get_parent().set_expandedItem(this);
		}

		if (this.get_clicked())
		{
			cssClass = cssClass + " " + this.get_clickedCssClass();
		}

		if (!this.get_enabled())
		{
			cssClass = cssClass + " " + this.get_disabledCssClass();
		}

		this.get_linkElement().className = cssClass;
		
		this._updateImageUrl();
	},
	
	_onKeyDown : function (e)
	{
		var keyCode = e.keyCode ? e.keyCode : e.rawEvent.keyCode;
		
		switch (keyCode)
		{
			case Sys.UI.Key.up:
					this._onKeyboardUp();
				break;

			case Sys.UI.Key.down:
					this._onKeyboardDown();
				break;

			case Sys.UI.Key.esc:
				this._onKeyboardEsc();
				break;
				
			default:
				return true;
		}
		
		e.preventDefault();
		return false;
	},
	
	_onKeyboardUp : function ()
	{
		var parent = this.get_parent();
		this.get_index() || !parent.focus ? this.focusPreviousItem() : parent.focus();
	},
	
	_onKeyboardDown : function ()
	{
		var parent = this.get_parent();
			
		if (this.get_expanded())
		{
			this.focusFirstChild();
			return;
			
		}
		var last = this.get_index() == parent.get_items().get_count() - 1;	
		
		if ( last && parent.focus)
		{
			parent.focusNextItem();
		}
		
		else
		{
			this.focusNextItem();
		}
	},
	
	_onKeyboardEsc : function ()
	{
		var parent = this.get_parent();
		var panelBar = this.get_panelBar();
		
		if (parent.focus)
		{
			parent.focus();
		}
		else if(parent==panelBar && this.get_expanded())
		{
			this.collapse();
			this.blur();
		}
	},
	
	focusFirstChild: function()
	{
		var items = this.get_items();
		if (items.get_count() == 0)
		{
			return;
		}
		
		var item = items.getItem(0);
		var firstItem = item;	
		while (!item._canFocus())
		{
			item = item._getNextItem();
			if (item == firstItem) 
			{
				return; // no items to focus
			}
		}
			
		item.focus();
	},
	
	focusNextItem: function()
	{
		var item = this._getNextItem();	
		while (!item._canFocus())
		{
			item = item._getNextItem();
		}
		item.focus();
	},
	
	focusPreviousItem: function()
	{
		var item = this._getPreviousItem();
		while (!item._canFocus())
		{
			item = item._getPreviousItem();
		}	
		item.focus();
	},
	
	click : function()
	{
		this._click(null);
	},
	
	_getPreviousItem: function ()
	{
		var parentItems = this.get_parent().get_items();
		var index = this.get_index();
		if (index == 0)
		{
			return parentItems.getItem(parentItems.get_count() - 1);
		}
		
		return parentItems.getItem(index - 1);
	},
	
	_getNextItem: function ()
	{
		var parentItems = this.get_parent().get_items();
		var index = this.get_index();
		if (index == parentItems.get_count() - 1)
		{
			return parentItems.getItem(0);
		}
		
		return parentItems.getItem(index + 1);
	},
	
	_click : function (e)
	{
		if (this.get_isSeparator() ||!this.get_isEnabled()) 
		{
			if(e)
				e.preventDefault();
				
			return false;
		}
		
		var panel = this.get_panelBar();	
		var clickingArgs = new Telerik.Web.UI.RadPanelItemClickingEventArgs(this, e);
		panel._raiseEvent("itemClicking", clickingArgs);
		
		if (clickingArgs.get_cancel()) 
		{
			if (e)
				e.preventDefault();
			return false;
		}
	    
		var javaScriptUrl = this.get_linkElement().href.indexOf("javascript:") == 0;
		var expandedItem = this.get_parent().get_expandedItem();
		var selectedItem = this.get_panelBar().get_selectedItem();
	    
		if (this.get_navigateAfterClick() && !javaScriptUrl)
		{
			if (this.get_panelBar().get_singleExpandedItem() && !this.get_panelBar().get_allowCollapseAllItems())
			{
				if (expandedItem)
				{
					expandedItem._expanded = false;
					expandedItem._properties.setValue("expanded", false,true);
					this.get_panelBar()._unregisterExpandedItem(this);
				}
				if (this.get_items().get_count()>0)
				{
					this._expanded = true;
					this._properties.setValue("expanded", true,true);
					this.get_panelBar()._registerExpandedItem(this);
					
				}
			
			}
			else if (this.get_items().get_count()>0)
			{
				this.set_expanded(!this.get_expanded());
			}
			if (!this._shouldNavigate())
			{
				/*
					Select the item and update the CSS classes when the "Target" 
					property is set (navigating to frames or iframes)
				*/
				this.select();
			}
			else
			{
				/*
					Select but don't update the Css classes - normal (no frames) navigation and postback
				*/
				if (selectedItem)
				{
					selectedItem.set_selected(false);
				}
				
				this.set_selected(true);
				
			}
			
				var clickedArgs = new Telerik.Web.UI.RadPanelItemClickedEventArgs(this, e);
				panel._raiseEvent("itemClicked", clickedArgs);
				
				if (this._shouldNavigate())
				    return true;
				    
				if (this._shouldPostBack())
				{   
				   if (e)
						e.preventDefault();
						
					panel._postback(this._getHierarchicalIndex());
				}
				return true;
		}
	    
		if (!this.get_panelBar().get_allowCollapseAllItems() && this.get_panelBar().get_singleExpandedItem())
		{
			if (!this.get_expanded()) this.expand();
		}
		else
		{
			this.get_expanded() ? this.collapse() : this.expand();
		}
		
		this.select();
		
		var panel = this.get_panelBar();	
		var clickedArgs = new Telerik.Web.UI.RadPanelItemClickedEventArgs(this, e);
		panel._raiseEvent("itemClicked", clickedArgs);
		
		if (javaScriptUrl)
			return true;
		
		
		if (e)
			e.preventDefault();
		
		if (this._shouldPostBack())
		{
			panel._postback(this._getHierarchicalIndex());
		}
		
		return false;
	},
	
	focus: function()
	{
		this._focus(null);
	},
	
	blur: function()
	{
		this._blur(null);
	},
	
	_shouldPostBack : function()
	{
		if(!this.get_panelBar()) return false;
	
		return this.get_postBack() && this.get_panelBar()._postBackReference;
	},
	
	_replaceCssClass: function(element, oldClass, newClass)
	{
		element.className = element.className.replace(oldClass, newClass);
	},
	
	_updateImageUrl : function ()
	{
		if (!this.get_element())
			return;
			
		var url = this._getImageUrlToApply();
		
		if (!url) return;
		
		var image = this.get_imageElement();
		if (!image)
		{
			image = this._createImageElement();
		}
		image.src = url;
	},
	
	_getImageUrlToApply : function ()
	{
		var url = this.get_imageUrl();
		//Required when the selectedImageUrl is not serialized but rendered
		var selectedUrl = this.get_selectedImageUrl();
		
		var expandedUrl =this.get_expandedImageUrl();
		
		if (this._hovered && this.get_hoveredImageUrl())
			url = this.get_hoveredImageUrl();
		
		if (this.get_selected() && selectedUrl)
			url = selectedUrl;
		
		if (this.get_expanded() && expandedUrl)
			url = expandedUrl;
			
		if (!this.get_enabled() && this.get_disabledImageUrl())
		{
			url = this.get_disabledImageUrl();
		}
		return url;
	},
	
	_initializeRenderedItem: function()
	{
		Telerik.Web.UI.RadPanelItem.callBaseMethod(this, '_initializeRenderedItem');
		this._attachEventsToTheLinkElement();

		this._updateLinkClass();
	},
	
	//public methods
	disable: function()
	{
		this.set_enabled(false);
	},
	
	enable: function()
	{
		this.set_enabled(true);
	},
	
	collapse : function()
	{
		this.set_expanded(false);
	},
	
	expand : function()
	{
		this.set_expanded(true);
	},
	
	hide: function()
	{
		this.set_visible(false);
	},
	
	show: function()
	{
		this.set_visible(true);
	},
	
	_getAnimationContainer: function()
	{
		if (!this._animationContainer) 
		{
			if(this.get_templated())
			{
				this._animationContainer = $telerik.getFirstChildByTagName(this.get_element(), "div", 2);
			}
			else
			{
				this._animationContainer = $telerik.getFirstChildByTagName(this.get_element(), "div", 1);
			}
		}
		
		return this._animationContainer;

	},
	
	select: function()
	{
		this.set_selected(true);
	},
	
	unSelect: function()
	{
		this.set_selected(false);
	},
	
	_setChildrenHeight : function (value)
	{
		if (value < 0) value = 0;
		if (!value == "") value += "px";
		
		this.get_childListElement().style.height = value;
		this._getAnimationContainer().style.height = value;
		
	},
	
	set_lastExpandedItem : function(value)
	{
		this.lastExpandedItem = value;
	},
	
	//public properties
	get_isSeparator: function()
	{
		return this._properties.getValue("isSeparator", false);
	},
	
	set_isSeparator : function (value)
	{
		this._properties.setValue("isSeparator", value, true);
	},
	
	set_enabled : function (value)
	{
		Telerik.Web.UI.RadPanelItem.callBaseMethod(this, 'set_enabled', [value]);
		this._updateLinkClass();		
	},
	
	get_linkElement: function()
	{
		if (!this._linkElement) 
		{
			this._linkElement = $telerik.getFirstChildByTagName(this.get_element(), "a", 0);
		}
		
		return this._linkElement;
	},
	
	get_childListElement: function()
	{
		if (!this._childListElement) 
		{
			var slideWrapElement = this._getSlideWrapElement();
			if (slideWrapElement) 
			{
				var container = slideWrapElement;
				
				this._childListElement = $telerik.getFirstChildByTagName(container, "ul", 0);
			}
		}
		return this._childListElement;
	},
	
	_getSlideWrapElement: function()
	{
		if (!this._slideWrapElement) 
		{	
			if (this.get_templated())
			{
				this._slideWrapElement = $telerik.getFirstChildByTagName(this.get_element(), "div", 2);
			}
			else
			{
				this._slideWrapElement = $telerik.getFirstChildByTagName(this.get_element(), "div", 1);
			}
		}
		
		return this._slideWrapElement;
	},
	
	get_imageElement: function()
	{
		if (!this._imageElement)
			this._imageElement = $("img.rpImage", this.get_element()).get(0) || null;
		
		return this._imageElement;
	},
	
	get_disabledImageUrl : function ()
	{
		return this._properties.getValue("disabledImageUrl", null);
	},
	
	set_disabledImageUrl : function (value)
	{
		this._properties.setValue("disabledImageUrl", value, true);
		this._updateImageUrl();
	},
	
	_createImageElement : function()
	{
		this._imageElement = document.createElement("img");
		this._imageElement.className = "rpImage";
		var textElement = this.get_textElement();
		textElement.parentNode.insertBefore(this._imageElement, textElement);
		return this._imageElement;
	},
	
	get_textElement: function()
	{
	    var link = this.get_linkElement();
	    
		if (link) 
		{
			return $(link).find("span.rpText").get(0) || null;
		}
		else 
		{
			return null;
		}
	},
	
	get_panelBar: function()
	{
		return this._getControl();
	},
	
	get_items : function ()
	{
		return this._getChildren();
	},
	
	get_navigateUrl : function()
	{
		return this._getNavigateUrl();
	},
	
	set_navigateUrl : function (value)
	{
		this._properties.setValue("navigateUrl", value, true);
		
		if (this.get_linkElement())
		{
			this.get_linkElement().href = value;
		}
	},
	
	get_navigateAfterClick : function()
	{	
		 return this._shouldNavigate() || this._shouldPostBack() ;
	},
	
	get_target : function ()
	{
		return this._properties.getValue("target", null)
	},
	
	set_target : function (value)
	{
		this._target = value;
		this._properties.setValue("target", value, true);
	},
	
	get_cssClass : function ()
	{
		return this._properties.getValue("cssClass", "")
	},
	
	set_cssClass : function (value)
	{
		this._cssClass = value;
		this._properties.setValue("cssClass", value, true);
		this._updateLinkClass();
	},
	
	get_disabledCssClass : function ()
	{
		return this._properties.getValue("disabledCssClass", "rpDisabled")
	},
	
	set_disabledCssClass : function (value)
	{
		this._disbaledCssClass = value;
		this._properties.setValue("disabledCssClass", value, true);
		this._updateLinkClass();
	},
	
	get_expandedCssClass : function ()
	{
		return this._properties.getValue("expandedCssClass", "rpExpanded")
	},
	
	set_expandedCssClass : function (value)
	{
		this._expandedCssClass = value;
		this._properties.setValue("expandedCssClass", value, true);
		this._updateLinkClass();
	},
	
	get_selectedCssClass : function ()
	{
		return this._properties.getValue("selectedCssClass", "rpSelected")
	},
	
	set_selectedCssClass : function (value)
	{
		this._selectedCssClass = value;
		this._properties.setValue("selectedCssClass", value, true);
		this._updateLinkClass();
	},
	
	get_focusedCssClass : function ()
	{
		return this._properties.getValue("focusedCssClass", "rpFocused")
	},
	
	set_focusedCssClass : function (value)
	{
		this._focusedCssClass = value;
		this._properties.setValue("focusedCssClass", value, true);
		this._updateLinkClass();
	},
	
	get_clickedCssClass : function ()
	{
		return this._properties.getValue("clickedCssClass", "rpClicked")
	},
	
	set_clickedCssClass : function (value)
	{
		this._clickedCssClass = value;
		this._properties.setValue("clickedCssClass", value, true);
		this._updateLinkClass();
	},
	
	get_focused : function ()
	{
		return this._focused;
	},
	
	get_selected : function ()
	{
		return this._properties.getValue("selected", false) == true;
	},
	get_clicked : function ()
	{
		return this._clicked;
	},
	
	set_selected : function (value)
	{
		if (value) 
		{
			if (this.get_selected()||!this.get_isEnabled())
				 return;
			
			var selectedItem = this.get_panelBar().get_selectedItem();
			if (selectedItem)
			{
				selectedItem.unSelect();
			}
			this.get_panelBar().set_selectedItem(this);
			this.get_panelBar()._registerSelectedItem(this);
			this._selected = value;
			this._properties.setValue("selected", true);
			this._updateLinkClass();
			//this._doFocus();
		}
		else 
		{
			if (!this.get_selected()) return;
			
			this.get_panelBar().set_selectedItem(null);
			this.get_panelBar()._unregisterSelectedItem(this);
			
			this._selected = value;
			this._properties.setValue("selected", false);
			this._updateLinkClass();
			//this._doBlur();
		}
	},
	
	get_expanded : function ()
	{
		return this._properties.getValue("expanded", false);
	},
	
	set_expanded : function (value)
	{
		if (this.get_items().get_count() <= 0 || !this.get_isEnabled())
		{
			return;
		}
			
		if(value)
		{
			
			if (this.get_expanded())
			{
				return;
			}
			var panelbar =this.get_panelBar();
			var childListElement = this.get_childListElement();
			var parent = this.get_parent();
			
			if (this.get_level() == 0 && panelbar.get_fullExpandedItem())
			{
			    if(window.netscape && !window.opera)
		        {
			        childListElement.style.overflow = "hidden";
			        this._changedOverflow =  true;
		        }
				childListElement.style.height = panelbar._getGroupHeight() + "px";
			}
			childListElement.style.display = "none";
		
			childListElement.style.width = "100%";//this.DomElement.offsetWidth + "px";
			
			
			if (this.get_level() > 0 && !panelbar.get_fullExpandedItem())
			{
				parent._setChildrenHeight("");
			}
			
			if (parent.get_expandedItem() && panelbar.get_singleExpandedItem())
			{
				parent.get_expandedItem().collapse();
			}
			
			parent.set_expandedItem(this);
			panelbar.set_lastExpandedItem(this);
			panelbar._registerExpandedItem(this);
			
			this._expanded = true;
			
		    childListElement.style.display = "block";
			
			this._displayChildren(true);

			var panel = this.get_panelBar();
			var expandedArgs = new Telerik.Web.UI.RadPanelItemExpandEventArgs(this, null);
			
			panel._raiseEvent("itemExpand", expandedArgs);
			
			this._ensureChildControls();
	        this._registerInitializedItems();
			
		
		}
		else
		{
			if (!this.get_expanded())
			{
				return;
			}
			if (this.get_preventCollapse())
			{
				return;
			}
    		var panelbar =this.get_panelBar();
			var childListElement = this.get_childListElement();
			var parent = this.get_parent();
	    
			parent.set_expandedItem(null);
			
			parent.set_lastExpandedItem(parent);//parent.set_lastExpandedItem(parent);

			this._expanded = false;
			panelbar._unregisterExpandedItem(this);

			if (this.get_level() > 0 && !panelbar.get_fullExpandedItem())
			{
				parent._setChildrenHeight("");
			}
			this._displayChildren(false);
			
			
			
			var panel = this.get_panelBar();	
			var collapsedArgs = new Telerik.Web.UI.RadPanelItemCollapseEventArgs(this, null);
			panel._raiseEvent("itemCollapse", collapsedArgs);
		}
		
		this._expanded = value;
		this._properties.setValue("expanded", value,true);
		this._updateLinkClass();
	},
	
	get_expandable : function ()
	{
		if( this.get_linkElement() && this.get_linkElement().className.indexOf("rpExpandable") > -1)
		{
			return true;
		}
		else
		{
			return false;
		}
	},
	
	set_visible : function (value)
	{
		var valueChanged = this.get_visible() != value;
		if (!valueChanged)
		{
			return;
		}
		
		Telerik.Web.UI.RadPanelItem.callBaseMethod(this, 'set_visible', [value]);
		
		var displayValue = value ? "" : "none";	
      
	    this.get_element().style.display = displayValue;
	    this.get_panelBar()._resizeHandler();
	},
	
	get_postBack : function ()
	{
	    return this._properties.getValue("postBack", true) == true;
	},
	
	set_postBack : function (value)
	{
	    this._properties.setValue("postBack", value);
	},
	
	_getChildElements: function()
	{
		return $telerik.getChildrenByTagName(this.get_childListElement(), "li");
	},
	
	_canFocus: function()
	{
		return (!this.get_isSeparator()) && this.get_enabled();
	},
	
	_focus: function(e)
	{
		this.set_focused(true, e);
	},
	
	_blur : function(e)
	{
		this.set_focused(false, e);
	},
	
	set_focused: function(value, e)
	{
		if (value)
		{
			this._doFocus(e);
		}
		else 
		{
			this._doBlur(e);
		}

		this._focused = value;
		this._updateLinkClass();
	},
	
	_doFocus: function(e)
	{	
		if (!this._canFocus())
		{
			return;
		}
	
		this._ensureChildControls();
	    this._registerInitializedItems();
		var parent = this.get_parent();
		
		if (parent.get_expanded && (!parent.get_expanded()) && parent.expand)
		{
			parent.expand();
		}

		parent.set_focusedItem(this);
		
		var linkElement = this.get_linkElement();
		if ( linkElement)//!this.get_focused() &&
		{
			linkElement.focus();
		}
		
		this.get_panelBar()._raiseEvent("itemFocus", new Telerik.Web.UI.RadPanelItemFocusEventArgs(this, e));
	},
	
	_doBlur: function(e)
	{
		if (this.get_isSeparator())
		{
			return;
		}

		if (this.get_focused())
		{
			this.get_linkElement().blur();
		}
	
		this.get_parent()._focusedItem = null;

		var panelBar = this.get_panelBar();
		var instance = this;
		window.setTimeout(
			function()
			{
				if (panelBar._focusedItem == instance)
				{
					panelBar._focusedItem = null;
				}
			}, 100);

		this.get_panelBar()._raiseEvent("itemBlur", new Telerik.Web.UI.RadPanelItemBlurEventArgs(this, e));
	},
	
	get_focusedItem: function()
	{
		return this._focusedItem;
	},
	
	set_focusedItem : function(value)
	{
		this._focusedItem = value;
	},
	
	_createItemCollection: function()
	{
		var items = new Telerik.Web.UI.RadPanelItemCollection(this);
		Telerik.Web.UI.RadPanelBar._createChildControls(this, items);
		
		return items;
	},
	
	_createChildControls : function ()
	{
		Telerik.Web.UI.RadPanelItem.callBaseMethod(this, '_createChildControls');
	
	},
	
	_registerInitializedItems: function()
	{
	    if(!this._registeredInitializedItems)
	    {
		    for (var i = 0; i < this.get_items().get_count(); i++) 
            {
                var item= this.get_items().getItem(i);
        	    if (item.get_expanded())
                {
	                    item.get_parent().set_expandedItem(item);
	                    item.get_panelBar()._registerExpandedItem(item);
                }
                if (item.get_selected())
                {	
                    item.get_panelBar().set_selectedItem(item);
                    item.get_panelBar()._registerSelectedItem(item);
                }
                item._updateLinkClass();
	            item._registerInitializedItems();
	         }
	         this._registeredInitializedItems = true;
	     }
	},
	_determineCssClass: function()
	{
		var actualCssClass = "rpItem";
		var parent = this.get_parent();
		var itemsCount = parent.get_items().get_count();
		var lastIndex = itemsCount - 1;
		if (this.get_index() == 0 && itemsCount > 0) 
		{
			var previousFirstItem = parent.get_items().getItem(1);
			if (previousFirstItem && previousFirstItem.get_element()) 
			{
				if (previousFirstItem.get_index() == lastIndex) 
				{
					 this._replaceCssClass(previousFirstItem.get_element(), "rpItem rpFirst rpLast", "rpItem rpLast");
					 this._replaceCssClass(previousFirstItem.get_element(), "rpItem rpFirst", "rpItem rpLast");
				}
				else 
				{
					this._replaceCssClass(previousFirstItem.get_element(), "rpItem rpFirst", "rpItem");
				}
			}
			actualCssClass += " " + "rpFirst";
		}
		
		if (this.get_index() == lastIndex && itemsCount > 0) 
		{
			var previousLastItem = parent.get_items().getItem(lastIndex - 1);
			if (previousLastItem && previousLastItem.get_element()) 
			{
				if (previousLastItem.get_index() == 0) 
				{
					this._replaceCssClass(previousLastItem.get_element(), "rpItem rpFirst rpLast", "rpItem rpFirst");
					this._replaceCssClass(previousLastItem.get_element(), "rpItem rpLast", "rpItem rpFirst");
				}
				else 
				{
					this._replaceCssClass(previousLastItem.get_element(), "rpItem rpLast", "rpItem");
				}
			}
			actualCssClass += " " + "rpLast";
		}
		
		if(this.get_isSeparator())
		{
			actualCssClass += " " + "rpSeparator";
		}
		return actualCssClass;
	},
	
	get_imageUrl: function()
	{
		if(this._imageUrl = this._properties.getValue("imageUrl", null))
			return this._imageUrl;
	
		if (!this._imageUrl) 
		{
			var imageElement = this.get_imageElement();
			if (imageElement) 
			{
				this._imageUrl = imageElement.src;
			}
		}
		
		return this._imageUrl;
	},
	
	set_imageUrl: function(value)
	{
		this._imageUrl = value;
		this._properties.setValue("imageUrl", value, true);
		this._updateImageUrl();
	},
	
	get_hoveredImageUrl: function()
	{
		return this._properties.getValue("hoveredImageUrl", null);
	},
	
	set_hoveredImageUrl: function(value)
	{
		this._hoveredImageUrl = value;
		
		this._properties.setValue("hoveredImageUrl", value, true);
		this._updateImageUrl();
	},
	
	get_selectedImageUrl: function()
	{
		return this._properties.getValue("selectedImageUrl", null);
	},
	
	set_selectedImageUrl: function(value)
	{
		this._selectedImageUrl = value;
		this._properties.setValue("selectedImageUrl", value, true);
		this._updateImageUrl();
	},
	
	get_expandedImageUrl: function()
	{
		return this._properties.getValue("expandedImageUrl", null);
	},
	
	set_expandedImageUrl: function(value)
	{
		this._expandedImageUrl = value;
		this._properties.setValue("expandedImageUrl", value, true);
		this._updateImageUrl();
	},
	set_expandedItem : function(value)
	{
		this._expandedItem = value;
	},
	
	get_expandedItem : function()
	{
		return this._expandedItem ;
	},
	
	set_selectedItem : function(value)
	{
		this._selectedItem = value;
	},
	
	get_selectedItem : function()
	{
		return this._selectedItem;
	},
	
	get_templated : function ()
	{
		return this._properties.getValue("templated", false) == true;
	},
	
	get_preventCollapse : function ()
	{
		return this._properties.getValue("preventCollapse", false) == true;
	},
	
	set_preventCollapse : function (value)
	{
		this._preventCollapse = value;
		this._properties.setValue("preventCollapse", value, true);
	},
	
	_render: function(html)
	{
		var cssClass = "rpItem";
		var renderSlide = false;
		if (this.get_parent().get_items().get_count() == 1) 
		{
			renderSlide = true
		}
		
		html[html.length] = "<li class='" + this._determineCssClass() + "'>";
		this._renderLink(html);
		html[html.length] = "<span class='rpOut'>";
		
		if (this.get_imageUrl()) 
		{
			 this._renderImage(html);
		}
		
		html[html.length] = "<span class='rpText'>";
		html[html.length] = this.get_text();
		html[html.length] = "</span></span></a>";
		
		var items = this.get_items();
		var childrenCount = items.get_count();
		
		this._renderChildList(html);
		
		html[html.length] = "</li>";
	},
	
	_renderImage: function(html)
	{
		html[html.length] = "<img alt='' src='" + this._getImageUrlToApply() + "' class='rpImage'";
		
		html[html.length] = "/>";
		
		return html;
	},
	
	_renderLink: function(html)
	{
		if (this._isSeparator)
		{
			return;
		}
		var href = "#";

		var navigateUrl = this.get_navigateUrl();
		if (navigateUrl && navigateUrl != "#")
		{
			href = navigateUrl;
		}
		
		html[html.length] = "<a href=\"";
		html[html.length] = href;
		html[html.length] = "\" ";
	
		var target = this.get_target();
		if (target)
		{
			html[html.length] = "target=\"";
			html[html.length] = target;
			html[html.length] = "\" ";
		}
		
		if (this.get_enabled()) 
		{
			html[html.length] = "class=\"rpLink\"";
		}
		else 
		{
			html[html.length] = "class=\"rpLink rpDisabled\"";
		}
		
		html[html.length] = ">";
		
		return html;		
	},
	
	_renderChildList: function(html)
	{
		var childrenCount = this.get_items().get_count();
		if (childrenCount > 0) 
		{	
			html[html.length] = "<div class='rpSlide' style='";
			
			if (this.get_expanded()) 
			{
				html[html.length] = "display : block";
			}
			
			html[html.length] = " '>";
			
			var level = "rpLevel" + (this.get_level() + 1);
			groupCssClass = "rpGroup" + " " + level;
			
			
			html[html.length] = "<ul class='" + groupCssClass;
			if (this.get_expanded()) 
			{
				html[html.length] = "style='display : block'";
			}
			html[html.length] = "'>";
			for (var i = 0; i < childrenCount; i++) 
			{
				this.get_items().getItem(i)._render(html);
			}
			html[html.length] = "</ul></div>";
		}
	},
	
	_renderAccessKey : function ()
	{
		if (this.get_isSeparator())
		{
			return;
		}
		if (!this.get_linkElement())
		{
			return;
		}
		
		var accessKey = this.get_linkElement().accessKey.toLowerCase();
		
		// If accessKey is not set
		if (!accessKey)
		{
			return;
		}
		var text = this.get_textElement().firstChild.nodeValue;
		var indexOfAccessKey = text.toLowerCase().indexOf(accessKey);
		
		// If accesKey is not found
		if (indexOfAccessKey == -1)
		{
			return;
		}
		
		this.get_textElement().innerHTML = 
			text.substr(0, indexOfAccessKey) + 
			"<u>" + 
			text.substr(indexOfAccessKey,  1) + 
			"</u>" + 
			text.substr(indexOfAccessKey + 1, text.length);
	},
	
	_createChildListElement: function()
	{
		var parentListElement = document.createElement("ul");
	
		var level = "rpLevel" + (this.get_level() + 1);
		groupCssClass =  "rpGroup" + " " + level;
		
		parentListElement.className = groupCssClass;
		
		var slideWrapElement = this._createSlideWrapElement();
		slideWrapElement.appendChild(parentListElement);
		this.get_element().appendChild(slideWrapElement);	
		
		return slideWrapElement;

	},
	
	_createSlideWrapElement: function()
	{
		var slideWrapElement = document.createElement("div");
		slideWrapElement.className = "rpSlide";
		if(this.get_expanded())
		{
			slideWrapElement.style.display = "block";
		}
		else
		{
			slideWrapElement.style.display = "none";
		}
		return slideWrapElement;
	},
	
	_calculateGroupHeight : function()
	{
		var childList = this.get_childListElement();
		if (this.get_level() == 0 && this.get_panelBar().get_fullExpandedItem())
		{	
			childList.style.height = this.get_panelBar()._getGroupHeight() + "px";
		}
	},

	_displayChildren : function (show)
	{
		var animationContainer = this._getAnimationContainer();
		if ( ! animationContainer) return;
		
		var query = $(animationContainer);
		var panelBar = this.get_panelBar();
		var animationSettings = panelBar.get_collapseAnimation();
		var initialHeight = $telerik.quirksMode ? 1 : 0;
		var params = { height: initialHeight };
		
		this._expanding = show;

		if (show)
		{
		    if (query.is(":visible"))
				initialHeight = query.height();
					
			query.height("auto");
			var height = query.height();
			query.height(initialHeight);
			
			params.height = height;
						
			animationSettings = panelBar.get_expandAnimation();
		}
		
		this._playAnimation(panelBar, query, animationSettings, params, show);
	},
	
	_playAnimation: function(panelBar, query, animationSettings, params, show)
	{		
		if(window.netscape && ( ! window.opera))
		{
			this.get_childListElement().style.overflow = "hidden";
			this._changedOverflow =  true;
		}
		
		var thisObject = this;
		
		var onEnd = function () {
			if (show)
			{
				if(window.netscape && ( ! window.opera) && thisObject._changedOverflow)
			    {
				    thisObject.get_childListElement().style.overflow = "auto";
				    thisObject._changedOverflow = false;
			    }
			    
			    query.height("auto");
			    panelBar._callRadShow();
			}
			else
				query.css("display", "none");
		};
		
		if (animationSettings.get_type() != Telerik.Web.UI.AnimationType.None)
		{
		    var duration = animationSettings.get_duration();
		    
			query.stop().animate(params,
				animationSettings.get_duration(),
				Telerik.Web.UI.AnimationType.toEasing(animationSettings.get_type()),
				onEnd
			);
		}
		else
		{
			query.css({ display: "block", height: params.height });
			onEnd();
		}
	}
}

Telerik.Web.UI.RadPanelItem.registerClass('Telerik.Web.UI.RadPanelItem', Telerik.Web.UI.ControlItem);

})($telerik.$);

/* END Telerik.Web.UI.PanelBar.RadPanelItem.js */
/* START Telerik.Web.UI.PanelBar.RadPanelItemCollection.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadPanelItemCollection = function (parent)
{
	Telerik.Web.UI.RadPanelItemCollection.initializeBase(this, [parent]);
}

Telerik.Web.UI.RadPanelItemCollection.prototype = 
{
	
	
	insert : function(index, item)
	{
		var panelBar = this._parent._getControl();
		if (panelBar)
			panelBar._childInserting(index, item, this._parent);
		
		Telerik.Web.UI.RadPanelItemCollection.callBaseMethod(this, "insert",[index, item]);
	}
}

Telerik.Web.UI.RadPanelItemCollection.registerClass("Telerik.Web.UI.RadPanelItemCollection", Telerik.Web.UI.ControlItemCollection);


/* END Telerik.Web.UI.PanelBar.RadPanelItemCollection.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.MaskedEventWrap.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.MaskedEventWrap = function(e, TextBoxElement)
{	
	if (e)
	{
		this.event = e.rawEvent;
	}
	this._selectionStart = TextBoxElement.selectionStart;
	this._selectionEnd = TextBoxElement.selectionEnd;
	this.fieldValue = TextBoxElement.value;    
}

Telerik.Web.UI.MaskedEventWrap.prototype = 
{
    IsUpArrow : function()
    {
    	return this.event.keyCode == 38;
    },
    
    IsDownArrow : function()
    {
    	return this.event.keyCode == 40;
    }   
}

Telerik.Web.UI.MaskedEventWrap.registerClass("Telerik.Web.UI.MaskedEventWrap");

/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.MaskedEventWrap.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadBaseMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadMaskPart = function()
{
	this.value = "";
	this.index = -1; 
	this.type = -1; // undefined
	this.PromptChar = "_";
}

Telerik.Web.UI.RadMaskPart.prototype =
{
    HandleKey : function (ev)
    {
	    return false;
    },
    
    HandleWheel : function (delta)
    {
	    return true;
    },
    
    SetController : function (controller)
    {
	    this.controller = controller;
    },
    
    GetValue : function ()
    {
	    return this.value.toString();
    },
    
    GetVisValue : function ()
    {
	    return "";
    },
    
    SetValue : function (value, offset)
    {
	    return true;
    },
    
    CanHandle : function (value, offset)
    {
	    return true;
    },
    
    IsCaseSensitive : function ()
    {
	    return false;
    },
    
    GetLength : function ()
    {
	    return 1;
    },
    
    IsAlpha : function (character)
    {
	    return character.match(/[^\u005D\u005B\t\n\r\f\s\v\\!-@|^_`{-¿]{1}/) != null;
    }
};

Telerik.Web.UI.RadMaskPart.registerClass("Telerik.Web.UI.RadMaskPart");


/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadBaseMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadUpperMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadUpperMaskPart = function()
{
    Telerik.Web.UI.RadUpperMaskPart.initializeBase(this);
}

Telerik.Web.UI.RadUpperMaskPart.prototype =
{
    CanHandle : function (value, offset)
    {
	    if (!this.IsAlpha(value))
	    {
		    this.controller._OnChunkError(this, this.GetValue(), value);
		    return false;
	    }
	    
	    return true;
    },
    
    GetVisValue : function ()
    {
        if (this.value.toString() == "")
        {
		    return this.PromptChar;
        }
        return this.value.toString();
    },
    
    SetValue : function (value, offset)
    {
	    if (value == "")
	    {
		    this.value = "";
		    return true;
	    }

	    if (this.IsAlpha(value))
	    {
		    this.value = value.toUpperCase();
	    } else
	    {
		    this.controller._OnChunkError(this, this.GetValue(), value);
	    }
	    return true;
    }    
};

Telerik.Web.UI.RadUpperMaskPart.registerClass("Telerik.Web.UI.RadUpperMaskPart", Telerik.Web.UI.RadMaskPart);


/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadUpperMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadNumericRangeMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadNumericRangeMaskPart = function(lower, upper, leftAlign, zeroFill)
{
    Telerik.Web.UI.RadNumericRangeMaskPart.initializeBase(this);

    this.upperLimit = upper;
    this.lowerLimit = lower;
    this.length = Math.max(this.lowerLimit.toString().length, this.upperLimit.toString().length);
    this.leftAlign = leftAlign;
    this.zeroFill = zeroFill;
    
    this.minusIncluded = this.lowerLimit < 0 || this.upperLimit < 0;

    this.value = lower; 
    this.FlipDirection = 0;
};

Telerik.Web.UI.RadNumericRangeMaskPart.prototype =
{
    SetController : function (controller)
    {
	    this.controller = controller;
	    this.GetVisValue();
    },
    
    IsCaseSensitive : function ()
    {
	    return true;
    },
    
    CanHandle : function (value, offset)
    {
	    if ((value == "-" || value == "+") && this.lowerLimit < 0) 
	    {
		    return true;
	    }
    	
	    if (isNaN(parseInt(value)))
	    {
		    this.controller._OnChunkError(this, this.GetValue(), value);	
		    return false;
	    }
	    return true;
    },
    
    InsertAt : function(value, offset)
    {
	    return this.visValue.substr(0, offset) + 
		    value.toString() + 
		    this.visValue.substr(offset + 1, this.visValue.length);
    },
    
    ReplacePromptChar : function(value)
    {
	    var blankReplace = this.leftAlign ? "" : "0";
        while (value.indexOf(this.PromptChar) > -1)
        {
		    value = value.replace(this.PromptChar, blankReplace);
        }
        
        return value;
    },
    
    SetValue : function (value, offset)
    {
	    if (value == "")
	    {
		    value = 0;
	    }
        if (isNaN(parseInt(value)) && value != "+" && value != "-")
        {
		    return true;
        }
	    offset -= this.offset;
        
        var intent = this.InsertAt(value, offset);
        intent = this.ReplacePromptChar(intent);
        
        // special case when the minus sign gets stuck between digits
        if (intent.indexOf('-') != - 1 && intent.indexOf('-') > 0)
        {
		    intent = intent.replace('-', '0');
        }
        if (isNaN(parseInt(intent))) intent = 0;
        if (this.controller.get_roundNumericRanges())
        {
		    intent = Math.min(this.upperLimit, intent); 
		    intent = Math.max(this.lowerLimit, intent); 
		    this.setInternalValue(intent);
        } 
        else
        {
		    if (
			    intent <= this.upperLimit
			    && intent >= this.lowerLimit
		    )
		    {
			    this.setInternalValue(intent);
			    this.GetVisValue();
		    }
		    else
		    {
			    return false;
		    }
        }
        
	    this.GetVisValue();
	    return true;
    },
    
    setInternalValue : function (value)
    {//debugger;
        var oldValue = this.value;
        this.value = value;
        this.controller._OnEnumChanged(this, oldValue, value);
        if (oldValue > value)
        {
		    this.controller._OnMoveDown(this, oldValue, value);
	    }
	    else if (oldValue < value)
	    {
		    this.controller._OnMoveUp(this, oldValue, value);
	    }
	    this.FlipDirection = 0; // restore flip flag
    },
    
    GetVisValue : function ()
    {
    	
        var out = "";
        var stringValue = Math.abs(this.value).toString();
        if (this.leftAlign)
        {
		    if (this.value < 0)
		    {
			    out +=  this.PromptChar;
		    } 
            out += stringValue;
            while (out.length < this.length)
            {
                out += this.controller.get_promptChar();
            }
        }
        else
        {
            var filler = this.zeroFill ? '0' : this.controller.get_promptChar(); 
		    if (this.value < 0)
		    {
			    stringValue =  '-' + stringValue;
		    } 
            while (out.length < this.length - stringValue.length)
            {
                out += filler;
            }
            
            out += stringValue;
        }
        this.visValue = out;
        return out;
    },
    
    GetLength : function ()
    {
	    return this.length;
    },
    
    HandleKey : function (e)
    {
	    this.controller._calculateSelection();
	    var eventWrap = new Telerik.Web.UI.MaskedEventWrap(e, this.controller._textBoxElement);
	    if (eventWrap.IsDownArrow())
	    {
		    this.MoveDown();
		    this.controller._FixSelection(eventWrap);
		    return true;
	    }
	    else if (eventWrap.IsUpArrow())
	    {
		    this.MoveUp();
		    this.controller._FixSelection(eventWrap);
		    return true;
	    }
    },
    
    MoveUp : function ()
    {
	    var currentValue = this.value;
	    currentValue ++;
        if (currentValue > this.upperLimit)
        {
            currentValue = this.lowerLimit;
		    this.FlipDirection = 1;
        }
        
        this.setInternalValue(currentValue);
        
	    this.controller._Visualise();
    },
    
    MoveDown : function ()
    {
	    var currentValue = this.value;
	    currentValue --;
        if (currentValue < this.lowerLimit)
        {
            currentValue = this.upperLimit;
		    this.FlipDirection = -1;
        }
        
        
        this.setInternalValue(currentValue);
        
	    this.controller._Visualise();
    },
    
    HandleWheel : function (e)
    {
	    var currentValue = this.value;
	    
	    var delta;
        if (e.rawEvent.wheelDelta) 
        { 
            /* IE/Opera. */
            delta = e.rawEvent.wheelDelta/120;
            /** In Opera 9, delta differs in sign as compared to IE.*/
            if (window.opera)
                delta = -delta;
        } 
        else if (e.rawEvent.detail) 
        {
                /** Mozilla case. In Mozilla, sign of delta is different than in IE. Also, delta is multiple of 3.*/
                delta = - e.rawEvent.detail/3;
        }
            	    
	    currentValue = parseInt(currentValue) + delta;
	    var eventWrap = new Telerik.Web.UI.MaskedEventWrap(e, this.controller._textBoxElement);
    	
	    if (currentValue < this.lowerLimit)
	    {
		    currentValue = this.upperLimit - (this.lowerLimit - currentValue - 1);
		    this.FlipDirection = -1;
	    }
    	
	    if (currentValue > this.upperLimit)
	    {
		    currentValue = this.lowerLimit +  (currentValue - this.upperLimit - 1);
		    this.FlipDirection = 1;
	    }
    	
	    this.setInternalValue(currentValue);
	    this.controller._Visualise();
	    this.controller._FixSelection(eventWrap);
	    return false;
    }
};

Telerik.Web.UI.RadNumericRangeMaskPart.registerClass("Telerik.Web.UI.RadNumericRangeMaskPart", Telerik.Web.UI.RadMaskPart);
/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadNumericRangeMaskPart.js */
/* START Telerik.Web.UI.Input.RadInputEnumerations.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.InputErrorReason = function()
{
};

Telerik.Web.UI.InputErrorReason.prototype = 
{
    ParseError: 1,
    OutOfRange: 2
}

Telerik.Web.UI.InputErrorReason.registerEnum("Telerik.Web.UI.InputErrorReason", false);

Telerik.Web.UI.SelectionOnFocus = function()
{
};

Telerik.Web.UI.SelectionOnFocus.prototype = 
{
    None : 0,
    CaretToBeginning : 1,
    CaretToEnd : 2,
    SelectAll : 3
}

Telerik.Web.UI.SelectionOnFocus.registerEnum("Telerik.Web.UI.SelectionOnFocus", false);

Telerik.Web.UI.InputButtonType = function()
{
};

Telerik.Web.UI.InputButtonType.prototype = 
{
    Button:         1,
    MoveUpButton:   2,
    MoveDownButton: 3
}

Telerik.Web.UI.InputButtonType.registerEnum("Telerik.Web.UI.InputButtonType", false);

Telerik.Web.UI.DisplayFormatPosition = function()
{
};

Telerik.Web.UI.DisplayFormatPosition.prototype = 
{
    Left: 1,
    Right: 2
}

Telerik.Web.UI.DisplayFormatPosition.registerEnum("Telerik.Web.UI.DisplayFormatPosition", false);

Telerik.Web.UI.InputSettingValidateOnEvent = function()
{
};

Telerik.Web.UI.InputSettingValidateOnEvent.prototype = 
{
    Blur : 0,
    Submit : 1,
    All : 2
}

Telerik.Web.UI.InputSettingValidateOnEvent.registerEnum("Telerik.Web.UI.InputSettingValidateOnEvent", false);
/* END Telerik.Web.UI.Input.RadInputEnumerations.js */
/* START Telerik.Web.UI.Input.RadInputEventArgs.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.InputValueChangedEventArgs = function(newValue, oldValue) 
{
	Telerik.Web.UI.InputValueChangedEventArgs.initializeBase(this);
	this._newValue = newValue;
	this._oldValue = oldValue;
}

Telerik.Web.UI.InputValueChangedEventArgs.prototype = 
{
	get_oldValue : function ()
	{
		return this._oldValue;
	},
	
	get_newValue : function ()
	{
		return this._newValue;
	}
}

//$telerik.makeCompatible(Telerik.Web.UI.InputValueChangedEventArgs);
Telerik.Web.UI.InputValueChangedEventArgs.registerClass('Telerik.Web.UI.InputValueChangedEventArgs', Sys.CancelEventArgs);

Telerik.Web.UI.InputValueChangingEventArgs = function(newValue, oldValue) 
{
	Telerik.Web.UI.InputValueChangingEventArgs.initializeBase(this, [newValue, oldValue]);
}

Telerik.Web.UI.InputValueChangingEventArgs.prototype = 
{
    set_newValue : function(value) 
    {
        if (this._newValue !== value) {
            this._newValue = value;
        }
    }	
}

//$telerik.makeCompatible(Telerik.Web.UI.InputValueChangingEventArgs);
Telerik.Web.UI.InputValueChangingEventArgs.registerClass('Telerik.Web.UI.InputValueChangingEventArgs', Telerik.Web.UI.InputValueChangedEventArgs);

Telerik.Web.UI.MaskedTextBoxEventArgs = function(newValue, oldValue, chunk)
{
    Telerik.Web.UI.MaskedTextBoxEventArgs.initializeBase(this);
   
    this._newValue = newValue;
	this._oldValue = oldValue;
    this._chunk = chunk;
}

Telerik.Web.UI.MaskedTextBoxEventArgs.prototype = 
{
	get_oldValue : function ()
	{
		return this._oldValue;
	},
	
	get_newValue : function ()
	{
		return this._newValue;
	},
	
    get_currentPart : function()
    {
        return this._chunk;
    }
}

//$telerik.makeCompatible(Telerik.Web.UI.MaskedTextBoxEventArgs);
Telerik.Web.UI.MaskedTextBoxEventArgs.registerClass("Telerik.Web.UI.MaskedTextBoxEventArgs", Sys.CancelEventArgs);

Telerik.Web.UI.InputKeyPressEventArgs = function(domEvent, keyCode, keyCharacter) 
{
	Telerik.Web.UI.InputKeyPressEventArgs.initializeBase(this);

	this._domEvent = domEvent;
	this._keyCode = keyCode;
	this._keyCharacter = keyCharacter;
}

Telerik.Web.UI.InputKeyPressEventArgs.prototype = 
{
	get_domEvent : function ()
	{
		return this._domEvent;
	},
	get_keyCode : function ()
	{
		return this._keyCode;
	},
    get_keyCharacter : function ()
	{
		return this._keyCharacter;
	}
}

//$telerik.makeCompatible(Telerik.Web.UI.InputKeyPressEventArgs);
Telerik.Web.UI.InputKeyPressEventArgs.registerClass('Telerik.Web.UI.InputKeyPressEventArgs', Sys.CancelEventArgs);

Telerik.Web.UI.InputButtonClickEventArgs = function(buttonType) 
{
	Telerik.Web.UI.InputButtonClickEventArgs.initializeBase(this);

	this._buttonType = buttonType;
}

Telerik.Web.UI.InputButtonClickEventArgs.prototype = 
{
	get_buttonType : function ()
	{
		return this._buttonType;
	}
}

//$telerik.makeCompatible(Telerik.Web.UI.InputButtonClickEventArgs);
Telerik.Web.UI.InputButtonClickEventArgs.registerClass('Telerik.Web.UI.InputButtonClickEventArgs', Sys.CancelEventArgs);

Telerik.Web.UI.InputErrorEventArgs = function(reason, inputText)
{
    Telerik.Web.UI.InputErrorEventArgs.initializeBase(this);
    
    this._reason = reason;
	this._inputText = inputText;
}

Telerik.Web.UI.InputErrorEventArgs.prototype = 
{
    get_reason : function ()
	{
		return this._reason;
	},
    get_inputText : function ()
	{
		return this._inputText;
	}
}

//$telerik.makeCompatible(Telerik.Web.UI.InputErrorEventArgs);
Telerik.Web.UI.InputErrorEventArgs.registerClass("Telerik.Web.UI.InputErrorEventArgs", Sys.CancelEventArgs);

Telerik.Web.UI.NumericInputErrorEventArgs = function(reason, inputText, keyCode, keyCharacter) 
{
	Telerik.Web.UI.NumericInputErrorEventArgs.initializeBase(this, [reason, inputText]);
	
	this._keyCode = keyCode;
	this._keyCharacter = keyCharacter;
}

Telerik.Web.UI.NumericInputErrorEventArgs.prototype = 
{
    get_reason : function ()
	{
		return this._reason;
	},
    get_inputText : function ()
	{
		return this._inputText;
	},
    get_keyCode : function ()
	{
		return this._keyCode;
	},
    get_keyCharacter : function ()
	{
		return this._keyCharacter;
	}
}

//$telerik.makeCompatible(Telerik.Web.UI.NumericInputErrorEventArgs);
Telerik.Web.UI.NumericInputErrorEventArgs.registerClass('Telerik.Web.UI.NumericInputErrorEventArgs', Telerik.Web.UI.InputErrorEventArgs);



Telerik.Web.UI.InputManagerKeyPressEventArgs = function(domEvent, keyCode, keyCharacter, targetInput) 
{
	Telerik.Web.UI.InputManagerKeyPressEventArgs.initializeBase(this, [domEvent, keyCode, keyCharacter]);

	this._targetInput = targetInput;
}

Telerik.Web.UI.InputManagerKeyPressEventArgs.prototype = 
{
	get_targetInput : function ()
	{
		return this._targetInput;
	}
}

Telerik.Web.UI.InputManagerKeyPressEventArgs.registerClass('Telerik.Web.UI.InputManagerKeyPressEventArgs', Telerik.Web.UI.InputKeyPressEventArgs);


Telerik.Web.UI.InputManagerEventArgs = function(targetInput, domEvent) 
{
	Telerik.Web.UI.InputManagerEventArgs.initializeBase(this);

	this._targetInput = targetInput;
	this._domEvent = domEvent;
}

Telerik.Web.UI.InputManagerEventArgs.prototype = 
{
	get_targetInput : function ()
	{
		return this._targetInput;
	},
	get_domEvent : function ()
	{
		return this._domEvent;
	}	
}

Telerik.Web.UI.InputManagerEventArgs.registerClass('Telerik.Web.UI.InputManagerEventArgs', Sys.EventArgs);


Telerik.Web.UI.InputManagerErrorEventArgs = function(reason, inputText, targetInput) 
{
	Telerik.Web.UI.InputManagerErrorEventArgs.initializeBase(this, [reason, inputText]);

	this._targetInput = targetInput;
}

Telerik.Web.UI.InputManagerErrorEventArgs.prototype = 
{
	get_targetInput : function ()
	{
		return this._targetInput;
	},
	set_inputText : function (value)
	{
		this._inputText = value;
	}	
}

Telerik.Web.UI.InputManagerErrorEventArgs.registerClass('Telerik.Web.UI.InputManagerErrorEventArgs', Telerik.Web.UI.InputErrorEventArgs);



Telerik.Web.UI.NumericInputManagerErrorEventArgs = function(reason, inputText, keyCode, keyCharacter, targetInput) 
{
	Telerik.Web.UI.NumericInputManagerErrorEventArgs.initializeBase(this, [reason, inputText, keyCode, keyCharacter]);
	this._targetInput = targetInput;
}

Telerik.Web.UI.NumericInputManagerErrorEventArgs.prototype = 
{
	get_targetInput : function ()
	{
		return this._targetInput;
	}
}

Telerik.Web.UI.NumericInputManagerErrorEventArgs.registerClass('Telerik.Web.UI.NumericInputManagerErrorEventArgs', Telerik.Web.UI.NumericInputErrorEventArgs);

Telerik.Web.UI.InputManagerValidatingEventArgs = function(input) 
{
	Telerik.Web.UI.InputManagerValidatingEventArgs.initializeBase(this);
	
	this._input = input;
	this._isValid = true;
};

Telerik.Web.UI.InputManagerValidatingEventArgs.prototype = 
{
	get_input : function ()
	{
		return this._input;
	},

	get_isValid : function ()
	{
		return this._isValid;
	},
	set_isValid : function (value)
	{
		this._isValid = value;
	}	
};

Telerik.Web.UI.InputManagerValidatingEventArgs.registerClass("Telerik.Web.UI.InputManagerValidatingEventArgs", Sys.CancelEventArgs);






/* END Telerik.Web.UI.Input.RadInputEventArgs.js */
/* START Telerik.Web.UI.Input.RadInputControl.js */
Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadInputControl = function(element) 
{
	Telerik.Web.UI.RadInputControl.initializeBase(this, [element]);
	
    this._autoPostBack = false;
    this._enabled = true;
    this._showButton = false;
    this._invalidStyleDuration = 100;
    this._emptyMessage = "";
    this._selectionOnFocus = Telerik.Web.UI.SelectionOnFocus.None;
    this._postBackEventReferenceScript = "";
    this._styles = null;
    
    this._isEnterPressed = false;
    this._isDroped = false;
    
    this._enableOldBoxModel = false;
    this._shouldResetWidthInPixels = true;
    this._reducedPixelWidthFlag = false;
    this._originalTextBoxWidth = null;
    this._originalCellPadding = null;
    this._originalDisplay = null;
    
    this._onTextBoxKeyUpDelegate = null;
    this._onTextBoxKeyPressDelegate = null;
    this._onTextBoxBlurDelegate = null;
    this._onTextBoxFocusDelegate = null;
    this._onTextBoxMouseOutDelegate = null;
    this._onTextBoxMouseOverDelegate = null;
    this._onTextBoxKeyDownDelegate = null;
    this._onTextBoxMouseWheelDelegate = null;
    this._onTextBoxDragDropDelegate = null;
    
    //fix a problem with Safari and selectiononfocus
    if ($telerik.isSafari)
        this._onTextBoxMouseUpDelegate = null;
    
    
    this._focused = false;
    
    this._allowApplySelection = true;
}

Telerik.Web.UI.RadInputControl.prototype = 
{
    initialize : function()
    {
        Telerik.Web.UI.RadInputControl.callBaseMethod(this, 'initialize');        
        this._clientID = this.get_id();        
        this._wrapperElementID = this.get_id() + "_wrapper";        
        this._textBoxElement = $get(this.get_id() + "_text");
        
        if ($telerik.isIE7 && $get(this._wrapperElementID).style.display == "inline-block")
    	{
    		$get(this._wrapperElementID).style.display = "inline";
    		$get(this._wrapperElementID).style.zoom = 1;
    	}
        
        this._originalTextBoxCssText = this._textBoxElement.style.cssText; 
        if(this._originalTextBoxCssText.lastIndexOf(";") != this._originalTextBoxCssText.length - 1)
        {
            this._originalTextBoxCssText += ";" ;
        }
        
        this.repaint();
        
        this._originalMaxLength = this._textBoxElement.maxLength;
        if (this._originalMaxLength == -1) //not IE browser default value when not set
            this._originalMaxLength = 2147483647;
            
        this._initializeHiddenElement(this.get_id());
        this._initializeValidationField(this.get_id());
        this._selectionEnd = 0;
        this._selectionStart = 0;
        
        //_isInFocus fix blur event fires twice for input elements in Firefox 3
        this._isInFocus = true;

        // state flags
        this._hovered = false;
        this._invalid = false;
        
        this._attachEventHandlers();
        //this.updateDisplayValue();
        this.updateCssClass();       
        this._initializeButtons();
        
        this._initialValue = this.get_value();
        
        //obsolete fields
        //this.InitialValue = this._initialValue;
    
		//FF2 obeys maxLength for inputs
		if ($telerik.isFirefox2 && this.isEmpty() && this.get_emptyMessage().length > this._originalMaxLength)
		{
			this.updateDisplayValue();
		}
        
        this.raise_load(Sys.EventArgs.Empty);  
        
        if(this._focused)
        {
            this._updateStateOnFocus();
        }
    },
    
    dispose : function() 
    {
        Telerik.Web.UI.RadInputControl.callBaseMethod(this, 'dispose');
  
        if (this.Button)
        {
            if (this._onButtonClickDelegate)
            {
                $removeHandler(this.Button, "click", this._onButtonClickDelegate);                                              
                this._onButtonClickDelegate = null;
            }
        }
        
        if($telerik.isIE)
        {
            if (this._onTextBoxPasteDelegate)
            {
                $removeHandler(this._textBoxElement, "paste", this._onTextBoxPasteDelegate);
                this._onTextBoxPasteDelegate = null;
            }
        }
        else
        {
            if (this._onTextBoxInputDelegate)
            {
                $removeHandler(this._textBoxElement, "input", this._onTextBoxInputDelegate);
                this._onTextBoxInputDelegate = null;
            }
        }

        if (this._onTextBoxKeyDownDelegate)
        {
            $removeHandler(this._textBoxElement, "keydown", this._onTextBoxKeyDownDelegate);
            this._onTextBoxKeyDownDelegate = null;
        }
        if (this._onTextBoxKeyPressDelegate)
        {
            $removeHandler(this._textBoxElement, "keypress", this._onTextBoxKeyPressDelegate);
            this._onTextBoxKeyPressDelegate = null;
        }
        if (this._onTextBoxKeyUpDelegate)
        {
            $removeHandler(this._textBoxElement, "keyup", this._onTextBoxKeyUpDelegate);    
            this._onTextBoxKeyUpDelegate = null;
        }
        if (this._onTextBoxBlurDelegate)
        {
            $removeHandler(this._textBoxElement, "blur", this._onTextBoxBlurDelegate);
            this._onTextBoxBlurDelegate = null;
        }
        if (this._onTextBoxFocusDelegate)
        {
            $removeHandler(this._textBoxElement, "focus", this._onTextBoxFocusDelegate);
            this._onTextBoxFocusDelegate = null;
        }
        
        if (this._onTextBoxMouseOutDelegate)
        {
            $removeHandler(this._textBoxElement, "mouseout", this._onTextBoxMouseOutDelegate);   
            this._onTextBoxMouseOutDelegate = null;
        }
        if (this._onTextBoxMouseOverDelegate)
        {
            $removeHandler(this._textBoxElement, "mouseover", this._onTextBoxMouseOverDelegate);
            this._onTextBoxMouseOverDelegate = null;
        }
        //fix a problem with Safari and selectiononfocus        
        if ($telerik.isSafari 
            && this._onTextBoxMouseUpDelegate)
        {
            $removeHandler(this._textBoxElement, "mouseup", this._onTextBoxMouseUpDelegate);
            this._onTextBoxMouseUpDelegate = null;
        }        
        
        if (Sys.Browser.agent != Sys.Browser.InternetExplorer)
		{
		    //Gecko, Opera?
		    if (this._onTextBoxMouseWheelDelegate)
		    {
		        if ($telerik.isSafari3 || $telerik.isOpera)
		        {
		            $removeHandler(this._textBoxElement, "mousewheel", this._onTextBoxMouseWheelDelegate);
		        }
		        else
		        {
		            $removeHandler(this._textBoxElement, "DOMMouseScroll", this._onTextBoxMouseWheelDelegate);
		        }
		        this._onTextBoxMouseWheelDelegate = null;
		    }
		    if (this._onTextBoxDragDropDelegate)
		    {
		        $removeHandler(this._textBoxElement, "dragdrop", this._onTextBoxDragDropDelegate);
		        this._onTextBoxDragDropDelegate = null;
		    }
		}
		else
		{
			//IE
			if (this._onTextBoxMouseWheelDelegate)
			{
		        $removeHandler(this._textBoxElement, "mousewheel", this._onTextBoxMouseWheelDelegate);
		        this._onTextBoxMouseWheelDelegate = null;
		    }
		    if (this._onTextBoxDragDropDelegate)
		    {
		        $removeHandler(this._textBoxElement, "drop", this._onTextBoxDragDropDelegate);
		        this._onTextBoxDragDropDelegate = null;
		    }
		}
		
		if(this._textBoxElement)
		    this._textBoxElement._events = null;
    },
    
    // PUBLIC API START
    
    clear : function ()
    {
        this.set_value("");
    },
    
    disable : function()
    {
        this.set_enabled(false);
        this._textBoxElement.disabled = "disabled";
        this.updateCssClass();
        this.updateClientState();
        this.raise_disable(Sys.EventArgs.Empty);
    },
        
    enable : function ()
    {
        this.set_enabled(true);
        this._textBoxElement.disabled = "";
        this.updateCssClass();
        this.updateClientState();
        this.raise_enable(Sys.EventArgs.Empty);
    },
    
    focus : function ()
    {
        this._textBoxElement.focus();
    },

    blur : function ()
    {
        this._textBoxElement.blur();
    },
    
    isEmpty : function ()
    {
        return this._hiddenElement.value == "";
    }, 

    isNegative : function ()
	{
		return false;
	},
	
	isReadOnly : function ()
	{	    
	    return this._textBoxElement.readOnly || !this._enabled;
	},
	
	isMultiLine: function()
    {
        return this._textBoxElement.tagName.toUpperCase() == "TEXTAREA";
    },    
    
    updateDisplayValue : function()
    {
        if (this._focused)
        {
            this.set_textBoxValue(this.get_editValue());
        }
        else
        {
            if (this.isEmpty() && this.get_emptyMessage())
            {
                this._textBoxElement.maxLength = 2147483647; //the default value (when not set)               
                this._isEmptyMessage = true;
                this.set_textBoxValue(this.get_emptyMessage());
                this._textBoxElement.maxLength = this._originalMaxLength;         
            }
            else
            {
                this._isEmptyMessage = false;
                this.set_textBoxValue(this.get_displayValue());
            }
        }
    },
    
    __isEmptyMessage  : function ()
    {
        return this.isEmpty() && this.get_emptyMessage();
    },    
    
    repaint : function()
    {
		this._updatePercentageHeight();
		if (this._shouldResetWidthInPixels)
		{
			this._resetWidthInPixels();
		}
		if (!this._reducedPixelWidthFlag && this._enableOldBoxModel)
		{
			this._reducePixelWidthByPaddings();
		}
    },
	
    updateCssClass  : function ()
    {
        if (this._enabled && (!this.__isEmptyMessage()) && (!this.isNegative()))
        {
             this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["EnabledStyle"][0]);
             this._textBoxElement.className = this.get_styles()["EnabledStyle"][1];            
        }     
        if (this._enabled && (!this.__isEmptyMessage()) && this.isNegative())
        {
             this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["NegativeStyle"][0]);
             this._textBoxElement.className = this.get_styles()["NegativeStyle"][1];
        }          
        if (this._enabled && this.__isEmptyMessage())
        {
             this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["EmptyMessageStyle"][0]);
             this._textBoxElement.className = this.get_styles()["EmptyMessageStyle"][1];
        }   
        if (this._hovered)
        {
            this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["HoveredStyle"][0]);
            this._textBoxElement.className = this.get_styles()["HoveredStyle"][1];
        }
        if (this._focused)
        {
            this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["FocusedStyle"][0]);
            this._textBoxElement.className = this.get_styles()["FocusedStyle"][1];   
        }
        if (this._invalid)
        {
            this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["InvalidStyle"][0]);
            this._textBoxElement.className = this.get_styles()["InvalidStyle"][1];
        }   
        if (this._textBoxElement.readOnly && this.__isEmptyMessage())
        {
            this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["EmptyMessageStyle"][0]);
            this._textBoxElement.className = this.get_styles()["EmptyMessageStyle"][1];        
        }
        else if (this._textBoxElement.readOnly)
        {
            this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["ReadOnlyStyle"][0]);
            this._textBoxElement.className = this.get_styles()["ReadOnlyStyle"][1];        
        }
        if (!this._enabled)
        {   
            this._textBoxElement.style.cssText = this._originalTextBoxCssText + this.updateCssText(this.get_styles()["DisabledStyle"][0]);
            this._textBoxElement.className = this.get_styles()["DisabledStyle"][1];        
        }
    },
    
    updateCssText : function(styleCssText)
    {
        var settings = styleCssText.split(';');
        var i;
        var result = ""; 
        for (i=0; i < settings.length; i++)
        {
            var setting = settings[i].split(':');
            if(setting.length == 2)
            {   
                var name = "" + setting[0].toLowerCase();
                if(name != "width" && name != "height")
                {
                    result += settings[i] + ";";
                }  
            }
        }
        return result;
    },
    
    selectText : function (start, end)
    {
        this._selectionStart = start;
        this._selectionEnd = end;
        this._applySelection();
    },

    selectAllText : function ()
    {
        if (this._textBoxElement.value.length > 0)
        {
             this.selectText(0, this._textBoxElement.value.length);
             return true;
        }
        return false;
    },    
    
    // obsolete: use the value property
	GetValue : function()
	{
	    return this.get_value();
	},
	
    // obsolete: use the value property
    SetValue : function (newValue)
    {
        this.set_value(newValue);
    },
	
	// obsolete: use the displayValue property
	GetDisplayValue : function ()
    {
        return this.get_displayValue();
    },
    
    // obsolete: use the editValue property
    GetEditValue : function ()
    {
        return this.get_editValue();
    },
    
    // obsolete: use the caretPosition property
    SetCaretPosition : function(position)
    {
        this.set_caretPosition(position);
    },
    
    // obsolete: use the wrapperElement property
    GetWrapperElement : function()
    {
        return this.get_wrapperElement();
    },
    
    // obsolete: use the textBoxValue property    
    GetTextBoxValue : function ()
    {
        return this.get_textBoxValue();
    },
    
    // obsolete: use the textBoxValue property
    SetTextBoxValue : function (value)
    {
        this.set_textBoxValue(value);
    },
    
    get_value : function ()
    {
        return this._hiddenElement.value;
    },
    
    set_value : function(newValue)
    {
        var eventArgs = new Telerik.Web.UI.InputValueChangingEventArgs(newValue, this._initialValue);
        this.raise_valueChanging(eventArgs);
        
        if (eventArgs.get_cancel() == true)
        {
            this._SetValue(this._initialValue);
            return false;
        }
            
        if (eventArgs.get_newValue())
            newValue = eventArgs.get_newValue();
            
        var validValue = this._setHiddenValue(newValue);
        
        if (validValue == false)
            newValue = "";
            
        this._triggerDomEvent("change", this._getValidationField());
        this.raise_valueChanged(newValue, this._initialValue);
        
        if (typeof(validValue) == "undefined" || validValue == true)
        {
            this.set_textBoxValue(this.get_editValue());
            this.updateDisplayValue();
            this.updateCssClass();
        }
    },    

    get_displayValue : function()
    {
        return this._hiddenElement.value;
    },

    get_editValue: function()
    {
        return this._hiddenElement.value;
    },

    set_caretPosition : function (position)
    {   
        this._selectionStart = position;
        this._selectionEnd = position;
        this._applySelection();
    },
    
    get_caretPosition : function ()
    {
        this._calculateSelection();
        if (this._selectionStart != this._selectionEnd)
            return new Array(this._selectionStart, this._selectionEnd)
        else 
            return this._selectionStart;      
    },
    
    raisePostBackEvent : function()
    {
        eval(this._postBackEventReferenceScript);
    },
    
    get_wrapperElement : function()
    {
        return $get(this._wrapperElementID);
    },
    
    get_textBoxValue : function()
    {
        return this._textBoxElement.value; 
    },
    
    set_textBoxValue : function(value)
    {
        if (this._textBoxElement.value != value)
        {
            this._textBoxElement.value = value;
        }
    },
    
    get_autoPostBack : function() 
    {
        return this._autoPostBack;
    },
    set_autoPostBack : function(value) 
    {
        if (this._autoPostBack !== value) 
        {
            this._autoPostBack = value;
            this.raisePropertyChanged('autoPostBack');
        }
    },
    
    get_emptyMessage : function() 
    {
        return this._emptyMessage;
    },
    set_emptyMessage : function(value) 
    {
        if (this._emptyMessage !== value) 
        {
            this._emptyMessage = value;
            this._isEmptyMessage = (value != "");
            this.updateClientState();
            this.raisePropertyChanged('emptyMessage');
        }
    },
    
    get_selectionOnFocus : function() 
    {
        return this._selectionOnFocus;
    },
    set_selectionOnFocus : function(value) 
    {
        if (this._selectionOnFocus !== value) 
        {
            this._selectionOnFocus = value;
            this.raisePropertyChanged('selectionOnFocus');
        }
    },
    
    get_showButton : function() 
    {
        return this._showButton;
    },
    set_showButton : function(value) 
    {
        if (this._showButton !== value) 
        {
            this._showButton = value;
            this.raisePropertyChanged('showButton');
        }
    },
    
    get_invalidStyleDuration : function() 
    {
        return this._invalidStyleDuration;
    },
    set_invalidStyleDuration : function(value) 
    {
        if (this._invalidStyleDuration !== value) 
        {
            this._invalidStyleDuration = value;
            this.raisePropertyChanged('invalidStyleDuration');
        }
    },    
    
    get_enabled : function() 
    {
        return this._enabled;
    },
    set_enabled : function(value) 
    {
        if (this._enabled !== value) 
        {
            this._enabled = value;
            this.raisePropertyChanged('enabled');
        }
    },
    
    get_styles : function() 
    {
        return this._styles;
    },
    set_styles : function(value) 
    {
        if (this._styles !== value) 
        {
            this._styles = value;
            this.raisePropertyChanged('styles');
        }
    },
    
    saveClientState : function(additionalProps)
    {
		var propsToSerialize = [ "enabled", "emptyMessage" ];
		
		if (additionalProps)
		{
			for (var i=0,j=additionalProps.length; i<j; i++)
			{
				propsToSerialize[propsToSerialize.length] = additionalProps[i];
			}
		}
		
		var state = {};

		for (var i = 0; i < propsToSerialize.length; i++)
		{
			state[propsToSerialize[i]] = this["get_" + propsToSerialize[i]]();
		}

		return Sys.Serialization.JavaScriptSerializer.serialize(state);
    },
    
    get_visible : function()
    {
		if (this.get_wrapperElement().style.display == "none")
		{
			return false;
		}
		else
		{
			return true;
		}
    },
    
    set_visible : function(value)
    {
		if (value)
		{
			this.get_wrapperElement().style.display = this._originalDisplay;
			this.repaint();
		}
		else
		{
			this._originalDisplay = this.get_wrapperElement().style.display;
			this.get_wrapperElement().style.display = "none";
		}
    },
    
    // PUBLIC API END

    _reducePixelWidthByPaddings : function()
    {
		if (this._textBoxElement.offsetWidth > 0 &&
			this._textBoxElement.parentNode.tagName.toLowerCase() == "span" &&
			this._textBoxElement.parentNode.parentNode.className != "rcInputCell" &&
			this._textBoxElement.style.width &&
			this._textBoxElement.style.width.indexOf("%") == -1 &&
			(!this._originalTextBoxWidth || this._originalTextBoxWidth.indexOf("%") == -1)
		)
		{
			var PaddingsBorders = 0;
			if (document.defaultView && document.defaultView.getComputedStyle)
			{
				PaddingsBorders = parseInt(document.defaultView.getComputedStyle(this._textBoxElement, null).getPropertyValue("border-left-width")) + parseInt(document.defaultView.getComputedStyle(this._textBoxElement, null).getPropertyValue("padding-left")) + parseInt(document.defaultView.getComputedStyle(this._textBoxElement, null).getPropertyValue("padding-right")) + parseInt(document.defaultView.getComputedStyle(this._textBoxElement, null).getPropertyValue("border-right-width"));
			}
			else if (this._textBoxElement.currentStyle)
			{
				if (!$telerik.isIE || (document.compatMode && document.compatMode != "BackCompat"))
				{
					PaddingsBorders = parseInt(this._textBoxElement.currentStyle["borderLeftWidth"]) + parseInt(this._textBoxElement.currentStyle["paddingLeft"]) + parseInt(this._textBoxElement.currentStyle["paddingRight"]) + parseInt(this._textBoxElement.currentStyle["borderRightWidth"]);
				}
			}
			
			var widthPx = parseInt(this._textBoxElement.style.width) - PaddingsBorders;
			
			if (PaddingsBorders == 0 || widthPx <= 0)
			{
				return;
			}
			
			this._textBoxElement.style.width = widthPx + "px";
			
			var newTextBoxCssText = "";
			var settings = this._originalTextBoxCssText.split(';');
			for (var i = 0; i < settings.length; i++)
			{
				var setting = settings[i].split(':');
				if (setting.length == 2)
				{
					var name = "" + setting[0].toLowerCase();
					if (name != "width")
					{
						newTextBoxCssText += settings[i] + ";";
					}
					else
					{
						newTextBoxCssText += "width:" + widthPx + "px;";
						if (!this._originalTextBoxWidth)
						{
							this._originalTextBoxWidth = settings[i].split(':')[1].trim();
						}
					}
				}
			}
			this._originalTextBoxCssText = newTextBoxCssText;
			
			this._reducedPixelWidthFlag = true;
		}
    },

    _updatePercentageHeight : function()
    {
		var wrapper = $get(this._wrapperElementID);
		if(wrapper.style.height.indexOf("%") != -1 && wrapper.offsetHeight > 0)
		{
			var TopBottomPaddingsBorders = 0;
			
			if (this._textBoxElement.currentStyle)
			{
				TopBottomPaddingsBorders = parseInt(this._textBoxElement.currentStyle["borderTopWidth"]) + parseInt(this._textBoxElement.currentStyle["borderBottomWidth"]) + parseInt(this._textBoxElement.currentStyle["paddingTop"]) + parseInt(this._textBoxElement.currentStyle["paddingBottom"]);
			}
			else if (window.getComputedStyle)
			{
				TopBottomPaddingsBorders = parseInt(window.getComputedStyle(this._textBoxElement, null).getPropertyValue("border-top-width")) + parseInt(window.getComputedStyle(this._textBoxElement, null).getPropertyValue("border-bottom-width")) + parseInt(window.getComputedStyle(this._textBoxElement, null).getPropertyValue("padding-top")) + parseInt(window.getComputedStyle(this._textBoxElement, null).getPropertyValue("padding-bottom"));
			}
			
			this._textBoxElement.style.height = "1px";
			this._textBoxElement.style.cssText = this._textBoxElement.style.cssText;
			this._textBoxElement.style.height = wrapper.offsetHeight - TopBottomPaddingsBorders + "px";
			if (this._originalTextBoxCssText.search(/(^|[^-])height/) != -1)
			{
				this._originalTextBoxCssText = this._originalTextBoxCssText.replace(/(^|[^-])height(\s*):(\s*)([^;]+);/i, "$1height:" + (wrapper.offsetHeight - TopBottomPaddingsBorders) + "px;");
			}
			else
			{
				this._originalTextBoxCssText += "height:" + (wrapper.offsetHeight - TopBottomPaddingsBorders) + "px;";
			}
		}
    },

    _resetWidthInPixels : function()
    {
		if (($telerik.isIE7 || $telerik.isIE6) && this._textBoxElement.offsetWidth > 0 &&
			(this._textBoxElement.parentNode.tagName.toLowerCase() == "td"
			||
			(this._textBoxElement.parentNode.parentNode.tagName.toLowerCase() == "td" && this._textBoxElement.parentNode.parentNode.className == "rcInputCell")
			||
			(this._textBoxElement.parentNode.tagName.toLowerCase() == "span" && this._textBoxElement.parentNode.parentNode.className != "rcInputCell" && (this._textBoxElement.currentStyle["width"].indexOf("%") != -1 || (this._originalTextBoxWidth && this._originalTextBoxWidth.indexOf("%") != -1))))
			)
		{
			var textBoxValue = this._textBoxElement.value;
			var paddings;
			var widthPx;
			var newTextBoxCssText = "";
			
			if (textBoxValue != "")
			{
				this._textBoxElement.value = "";
			}
			
			if (this._originalCellPadding && this._textBoxElement.parentNode.tagName.toLowerCase() == "td")
			{
				this._textBoxElement.parentNode.style.paddingRight = this._originalCellPadding;
			}
			else if (this._originalCellPadding && this._textBoxElement.parentNode.parentNode.tagName.toLowerCase() == "td" && this._textBoxElement.parentNode.parentNode.className == "rcInputCell")
			{
				this._textBoxElement.parentNode.parentNode.style.paddingRight = this._originalCellPadding;
			}
			
			if (this._originalTextBoxWidth)
			{
				this._textBoxElement.style.width = this._originalTextBoxWidth;
			}
			else if (textBoxValue != "")
			{
				this._textBoxElement.style.cssText = this._textBoxElement.style.cssText;
			}
			
			paddings = parseInt(this._textBoxElement.currentStyle["paddingLeft"]) + parseInt(this._textBoxElement.currentStyle["paddingRight"]);
			widthPx = this._textBoxElement.clientWidth - paddings;
			
			if (widthPx > 0)
			{
				this._textBoxElement.style.width = widthPx + "px";

				if (this._textBoxElement.parentNode.tagName.toLowerCase() == "td")
				{
					if (!this._originalCellPadding)
					{
						this._originalCellPadding = this._textBoxElement.parentNode.currentStyle["paddingRight"];
					}
					this._textBoxElement.parentNode.style.paddingRight = "0px";
				}
				else if (this._textBoxElement.parentNode.parentNode.tagName.toLowerCase() == "td" && this._textBoxElement.parentNode.parentNode.className == "rcInputCell")
				{
					if (!this._originalCellPadding)
					{
						this._originalCellPadding = this._textBoxElement.parentNode.parentNode.currentStyle["paddingRight"];
					}
					this._textBoxElement.parentNode.parentNode.style.paddingRight = "0px";
				}

				var settings = this._originalTextBoxCssText.split(';');
				for (var i = 0; i < settings.length; i++)
				{
					var setting = settings[i].split(':');
					if (setting.length == 2)
					{
						var name = "" + setting[0].toLowerCase();
						if (name != "width")
						{
							newTextBoxCssText += settings[i] + ";";
						}
						else
						{
							newTextBoxCssText += "width:" + widthPx + "px;";
							if (!this._originalTextBoxWidth)
							{
								this._originalTextBoxWidth = settings[i].split(':')[1].trim();
							}
						}
					}
				}

				this._originalTextBoxCssText = newTextBoxCssText;
			}
			
			if (textBoxValue != "")
			{
				this._textBoxElement.value = textBoxValue;
			}
		}
	},
    
    _initializeHiddenElement : function(id)
    {
        this._hiddenElement = $get(id);
    },
    
    _initializeValidationField : function(id)
    {
    },
    
    _initializeButtons : function()
    {
        this._onButtonClickDelegate = Function.createDelegate(this, this._onButtonClickHandler);
        this.Button = null;
		var domElement = $get(this._wrapperElementID);
        var anchors = domElement.getElementsByTagName("a");
        
        for (i = 0; i < anchors.length; i++)
        {
			if (anchors[i].parentNode.className.indexOf("riBtn") != (-1))
            {
                this.Button = anchors[i];
                $addHandler(this.Button, "click", this._onButtonClickDelegate);        
            }            
        }   
    },

    _attachEventHandlers : function ()
    {   
        this._onTextBoxKeyUpDelegate = Function.createDelegate(this, this._onTextBoxKeyUpHandler);    
        this._onTextBoxKeyPressDelegate = Function.createDelegate(this, this._onTextBoxKeyPressHandler);
        this._onTextBoxBlurDelegate = Function.createDelegate(this, this._onTextBoxBlurHandler);
        this._onTextBoxFocusDelegate = Function.createDelegate(this, this._onTextBoxFocusHandler);
        this._onTextBoxKeyDownDelegate = Function.createDelegate(this, this._onTextBoxKeyDownHandler);

        $addHandler(this._textBoxElement, "keydown", this._onTextBoxKeyDownDelegate);
        $addHandler(this._textBoxElement, "keypress", this._onTextBoxKeyPressDelegate);
        $addHandler(this._textBoxElement, "keyup", this._onTextBoxKeyUpDelegate);    
        $addHandler(this._textBoxElement, "blur", this._onTextBoxBlurDelegate);
        $addHandler(this._textBoxElement, "focus", this._onTextBoxFocusDelegate);
        
        if($telerik.isIE || $telerik.isSafari)
        {
            this._onTextBoxPasteDelegate=Function.createDelegate(this,this._onTextBoxPasteHandler);
            $addHandler(this._textBoxElement,"paste",this._onTextBoxPasteDelegate);
        }
        else
        {
            this._onTextBoxInputDelegate=Function.createDelegate(this,this._onTextBoxInputHandler);
            $addHandler(this._textBoxElement,"input",this._onTextBoxInputDelegate);
        }

        this._attachMouseEventHandlers();
    },
    
    _onTextBoxPasteHandler : function(e)
    {
        if(this.isMultiLine() && this._maxLength > 0)
        {
			if ($telerik.isSafari) // || Chrome
			{
				var thisObj = this;
				window.setTimeout(function() { thisObj._textBoxElement.value = thisObj._textBoxElement.value.substr(0, thisObj._maxLength) }, 1);
			}
			else // IE
			{
				if(!e) var e=window.event;
				if(e.preventDefault) e.preventDefault();
	            
				var selection = this._textBoxElement.document.selection.createRange();
				var length = this._maxLength - this._textBoxElement.value.length + selection.text.length;
				var text = window.clipboardData.getData("Text").substr(0,length);
				selection.text = text;
            }
        }
    },
    
    _onTextBoxInputHandler : function(e)
    {
        if(this.isMultiLine() && this._maxLength > 0)
        {
            this._textBoxElement.value = this._textBoxElement.value.substr(0, this._maxLength);
        }
    },
    
    _attachMouseEventHandlers : function()
    {
        //fix a problem with Safari and selectiononfocus
        if ($telerik.isSafari)
        {
            this._onTextBoxMouseUpDelegate = Function.createDelegate(this, this._onTextBoxMouseUpHandler);        
            $addHandler(this._textBoxElement, "mouseup", this._onTextBoxMouseUpDelegate);        
        }
        
        this._onTextBoxMouseOutDelegate = Function.createDelegate(this, this._onTextBoxMouseOutHandler);
        this._onTextBoxMouseOverDelegate = Function.createDelegate(this, this._onTextBoxMouseOverHandler);
        this._onTextBoxMouseWheelDelegate = Function.createDelegate(this, this._onTextBoxMouseWheelHandler);
        this._onTextBoxDragDropDelegate = Function.createDelegate(this, this._onTextBoxDragDropHandler);        
        
        $addHandler(this._textBoxElement, "mouseout", this._onTextBoxMouseOutDelegate);   
        $addHandler(this._textBoxElement, "mouseover", this._onTextBoxMouseOverDelegate);
        
        if (Sys.Browser.agent != Sys.Browser.InternetExplorer)
		{		    
            if ($telerik.isSafari3 || $telerik.isOpera) 
            {
                //Safari, Chrome, Opera
                $addHandler(this._textBoxElement, "mousewheel", this._onTextBoxMouseWheelDelegate);
            }
            else 
            {
                //Gecko
                $addHandler(this._textBoxElement, "DOMMouseScroll", this._onTextBoxMouseWheelDelegate);
            }
		    $addHandler(this._textBoxElement, "dragdrop", this._onTextBoxDragDropDelegate);
		}
		else
		{
			//IE
		    $addHandler(this._textBoxElement, "mousewheel", this._onTextBoxMouseWheelDelegate);
		    $addHandler(this._textBoxElement, "drop", this._onTextBoxDragDropDelegate);
		}        
    },
    
    //
    //Event Handlers
    //
    //fix a problem with Safari and selectiononfocus    
    _onTextBoxMouseUpHandler : function (e)
    {
        if ($telerik.isSafari && this._allowApplySelection)
        { 	 
            this._allowApplySelection = false; 
            this._updateSelectionOnFocus();   
            e.preventDefault();
            e.stopPropagation();
        }
    },
    
    _onTextBoxKeyPressHandler : function (e)
    {    
    
          
        var eventArgs = new Telerik.Web.UI.InputKeyPressEventArgs(e, e.charCode, String.fromCharCode(e.charCode));
        this.raise_keyPress(eventArgs);
        
        if (eventArgs.get_cancel())
        {
            e.stopPropagation();
		    e.preventDefault();        
			return false;        
        }
       
        if ((e.charCode == 13) 
			&& !this.isMultiLine())
        {           
           this._updateHiddenValueOnKeyPress(e); 
          
           if (this.get_autoPostBack() && this._initialValue !== this.get_textBoxValue())
           {
               this._isEnterPressed = true;
               this.raisePostBackEvent();
               
               if (Sys.Browser.agent == Sys.Browser.InternetExplorer)
               {
                    e.stopPropagation();
		            e.preventDefault();     
               }         
           }
           return true;
        }        
    },
    
    _onTextBoxKeyUpHandler : function (e)
    {
        this._updateHiddenValueOnKeyPress(e);  
    },     
    
    _onTextBoxBlurHandler : function (e)
    {

        if (!this._isInFocus || this.isReadOnly())
        {
		    e.preventDefault();
            e.stopPropagation();            
            return false;
        }
            
        this._isInFocus = false;        
                    
        this._focused = false;
        
        var textBoxValue = this.get_textBoxValue(); 
        if (this._initialValue !== textBoxValue)
        {
            this.set_value(textBoxValue);
        }
        else
        {
            this.updateDisplayValue();
            this.updateCssClass();
        }
        
        this.raise_blur(Sys.EventArgs.Empty); 
        this._triggerDomEvent("blur", this._getValidationField());
    },
    
    _onTextBoxFocusHandler : function (e)
    {
		if (!this.isReadOnly())
		{
		    this._allowApplySelection = true;
	        this._updateStateOnFocus();
		    this._triggerDomEvent("focus", this._getValidationField());
		}
    },
    
    _updateStateOnFocus : function()
    {
        if (this._isDroped)
        {
            this._updateHiddenValue();
            this._isDroped = false;
        }
        this._isInFocus = true;      
        
        this._focused = true;
        this.updateDisplayValue();
        this.updateCssClass();
        if (!$telerik.isSafari)
            this._updateSelectionOnFocus();
        this.raise_focus(Sys.EventArgs.Empty); 
    },
    
    _onTextBoxMouseOutHandler : function (e)
    {
        this._hovered = false;
        this.updateCssClass();
        this.raise_mouseOut(Sys.EventArgs.Empty); 
    },    
    
    _onTextBoxMouseOverHandler : function (e)
    {
        this._hovered = true;
        this.updateCssClass(); 
        this.raise_mouseOver(Sys.EventArgs.Empty); 
    },    
    
	_onTextBoxKeyDownHandler : function(e)
	{
	},    
	
    _onTextBoxMouseWheelHandler : function(e)
	{
	    var delta;
	    if (this._focused)
	    {
            if (e.rawEvent.wheelDelta) 
            { 
                /* IE/Opera. */
                delta = e.rawEvent.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.*/
                if (window.opera)
                    delta = -delta;
            } 
            else if (e.detail) 
            {
                    /** Mozilla case. In Mozilla, sign of delta is different than in IE. Also, delta is multiple of 3.*/
                    delta = - e.rawEvent.detail/3;
            }
            else if (e.rawEvent && e.rawEvent.detail)
            {
                    /** Firefox 3.0 case.**/
                    delta = - e.rawEvent.detail/3;
            }
            
            if (delta > 0)
            {
                this._handleWheel(false);
            }
            else
            {
                this._handleWheel(true);
            }
            
            /*prevent the page scroll*/
			e.stopPropagation();
			e.preventDefault();
        }
	},
    
    _onButtonClickHandler : function (e)
    {
        var eventArgs = new Telerik.Web.UI.InputButtonClickEventArgs(Telerik.Web.UI.InputButtonType.Button);
        this.raise_buttonClick(eventArgs); 
    },    
    
    _onTextBoxDragDropHandler : function (e)
    {    
          this._isDroped = true;
    },
       
    _getValidationField : function()
    {
        return this._hiddenElement;
    },
	
    _calculateSelection : function ()
    {
        if ((Sys.Browser.agent == Sys.Browser.Opera) || !document.selection)
        {
            this._selectionEnd = this._textBoxElement.selectionEnd;
            this._selectionStart = this._textBoxElement.selectionStart;
            return;
        }
        
        var s1 = document.selection.createRange();
        if (s1.parentElement() != this._textBoxElement) return;
        var s = s1.duplicate();

        s.move('character', -this._textBoxElement.value.length);
        
        s.setEndPoint('EndToStart', s1);
        
        var sel1 = s.text.length;
        var sel2 = s.text.length +  s1.text.length;
        this._selectionEnd = Math.max(sel1, sel2);
        this._selectionStart = Math.min(sel1, sel2);
    },
    
    _SetValue : function (newValue)
    {
        var validValue = this._setHiddenValue(newValue);
			
        if (typeof(validValue) == "undefined" || validValue == true)
        {
            this.set_textBoxValue(this.get_editValue());
        }
    },    
        
    _triggerDomEvent : function(eventName, eventSource)
    {        
        if(!eventName || eventName == "" || !eventSource)
            return;
            
        if (eventSource.fireEvent && document.createEventObject) 
        {
            var eventObject = document.createEventObject();            
            eventSource.fireEvent(String.format("on{0}", eventName), eventObject);            
        } 
        else if (eventSource.dispatchEvent)
        {
            var canBubble = true;
            var eventObject = document.createEvent("HTMLEvents");
            eventObject.initEvent(eventName, canBubble, true);
            eventSource.dispatchEvent(eventObject);
        }
    },   
    
    _updateSelectionOnFocus : function()
    {
        if (!this.get_textBoxValue())
            this.set_caretPosition(0);
        
        switch (this.get_selectionOnFocus())
        {
            case Telerik.Web.UI.SelectionOnFocus.None:
                break;
            case Telerik.Web.UI.SelectionOnFocus.CaretToBeginning:

                this.set_caretPosition(0);
                break;
            case Telerik.Web.UI.SelectionOnFocus.CaretToEnd:
                if (this._textBoxElement.value.length > 0)
                {
					if ($telerik.isIE && this.isMultiLine())
					{
						// fix the caret's end position when new lines are present
						var newLines10 = 0;
						var newLines13 = 0;
						for (var j = 0; j < this._textBoxElement.value.length; j++)
						{
							if (this._textBoxElement.value.charCodeAt(j) == 10)
							{
								newLines10++;
							}
							else if (this._textBoxElement.value.charCodeAt(j) == 13)
							{
								newLines13++;
							}
						}
						
						this.set_caretPosition(this._textBoxElement.value.length - Math.max(newLines10, newLines13));
					}
					else
					{
						this.set_caretPosition(this._textBoxElement.value.length);
					}
                }
                break;
            case Telerik.Web.UI.SelectionOnFocus.SelectAll:
                this.selectAllText();
                break;            
            default : 
				this.set_caretPosition(0); //CaretToBeginning
				break;
        }
    },	   
    
    _isInVisibleContainer : function(element) 
    {
        var current = element;
        while((typeof(current) != "undefined") && (current != null)) 
        {
            if (current.disabled ||
                ( typeof(current.style) != "undefined" &&
                ( ( typeof(current.style.display) != "undefined" &&
                    current.style.display == "none") ||
                    ( typeof(current.style.visibility) != "undefined" &&
                    current.style.visibility == "hidden") ) ) ) {
                return false;
            }
            if (typeof(current.parentNode) != "undefined" &&
                    current.parentNode != null &&
                    current.parentNode != current &&
                    current.parentNode.tagName.toLowerCase() != "body") {
                current = current.parentNode;
            }
            else 
            {
                return true;
            }
        }
        return true;
    },
    
    _applySelection : function ()
    {
            if(!this._isInVisibleContainer(this._textBoxElement))
            {
                return;
            }
            
            if ((Sys.Browser.agent == Sys.Browser.Opera) || !document.selection)
            {
                this._textBoxElement.selectionStart = this._selectionStart;
                this._textBoxElement.selectionEnd = this._selectionEnd;
                return;
            }

            this._textBoxElement.select();
            sel = document.selection.createRange();
            sel.collapse();
            sel.moveStart('character', this._selectionStart);
            sel.collapse();
            sel.moveEnd('character', this._selectionEnd - this._selectionStart);
            sel.select();        
    },     
    
    _clearHiddenValue : function()
    {
        this._hiddenElement.value = "";
    },   
    
    _handleWheel : function(isNegativeWheel)
	{
	},

    _setHiddenValue : function(value)
    {
        if (this._hiddenElement.value != value.toString())
        {
            this._hiddenElement.value = value;
        }
        
        this._setValidationField(value);
        
        return true;
    },
    
    _setValidationField : function(value)
    {
    },     
    
    _updateHiddenValueOnKeyPress : function()
    {
		this._updateHiddenValue();
    },
    
    _updateHiddenValue : function()
    {
		if (!this._textBoxElement.readOnly)
		{
			return this._setHiddenValue(this._textBoxElement.value);
        }
    },
    
    _escapeNewLineChars : function(text, replaceWith)
    {
		text = escape(text);
	    
		while (text.indexOf("%0D%0A") != -1)
		{ 
			text = text.replace("%0D%0A", replaceWith);
		}
		while (text.indexOf("%0A") != -1)
		{ 
			text = text.replace("%0A", replaceWith);
		}
		while (text.indexOf("%0D") != -1)
		{ 
			text = text.replace("%0D", replaceWith);
		}
		return unescape(text);
    },
    
    _isNormalChar : function(e)
	{
        if (($telerik.isFirefox && e.rawEvent.keyCode != 0 && e.rawEvent.keyCode != 13)
            || 
            ($telerik.isOpera && e.rawEvent.which == 0)
            ||
            ($telerik.isSafari && (e.charCode < Sys.UI.Key.space || e.charCode > 60000)))
        {
            return false;
        }	
        return true;
	},
    
    //register events    
    add_blur: function(handler) 
    {
        this.get_events().addHandler('blur', handler);
    },
    remove_blur: function(handler) 
    {
        this.get_events().removeHandler('blur', handler);
    },
	raise_blur : function(args)
	{
		this.raiseEvent("blur", args);
	}, 
	
    add_mouseOut : function(handler) 
    {
        this.get_events().addHandler('mouseOut', handler);
    },
    remove_mouseOut : function(handler) 
    {
        this.get_events().removeHandler('mouseOut', handler);
    },
	raise_mouseOut : function(args)
	{
		this.raiseEvent("mouseOut", args);
	},   
	
    add_valueChanged : function(handler) 
    {
        this.get_events().addHandler('valueChanged', handler);
    },
    remove_valueChanged : function(handler) 
    {
        this.get_events().removeHandler('valueChanged', handler);
    },
	raise_valueChanged : function(newValue, oldValue)
	{
	   
	    if (newValue.toString() == oldValue.toString())
            return false;
        this._initialValue = this.get_value();
        var eventArgs = new Telerik.Web.UI.InputValueChangedEventArgs(newValue, oldValue);
        this.raiseEvent("valueChanged", eventArgs);
        
		var shouldPostBack = !eventArgs.get_cancel();		    
		
		
		
        if (this.get_autoPostBack() && shouldPostBack && !this._isEnterPressed)
            this.raisePostBackEvent();
	},
	
    add_error : function(handler) 
    {
        this.get_events().addHandler('error', handler);
    },
    remove_error : function(handler) 
    {
        this.get_events().removeHandler('error', handler);
    },
    
    raise_error : function(args)
    {
        if (this.InEventRaise)
        {
            return;
        }

        this.InEventRaise = true;
        this.raiseEvent("error", args);
        if (!args.get_cancel())
        {
            this._invalid = true;
            this._errorHandlingCanceled = false;
            
            this.updateCssClass();
        	
            var instance = this;
            var restore = function()
            {
	            instance._invalid = false;
	            instance.updateCssClass();
            }
            setTimeout(restore, this.get_invalidStyleDuration());	        
        }
        else
        {
            this._errorHandlingCanceled = true;
        }
        
        this.InEventRaise = false;	
    },
	
    add_load : function(handler) 
    {
        this.get_events().addHandler('load', handler);
    },
    remove_load : function(handler) 
    {
        this.get_events().removeHandler('load', handler);
    },
	raise_load : function(args)
	{
		this.raiseEvent("load", args);
	},
	
    add_mouseOver : function(handler) 
    {
        this.get_events().addHandler('mouseOver', handler);
    },
    remove_mouseOver : function(handler) 
    {
        this.get_events().removeHandler('mouseOver', handler);
    },
	raise_mouseOver : function(args)
	{
		this.raiseEvent("mouseOver", args);
	},
	
    add_focus : function(handler) 
    {
        this.get_events().addHandler('focus', handler);
    },
    remove_focus : function(handler) 
    {
        this.get_events().removeHandler('focus', handler);
    },
	raise_focus : function(args)
	{
		this.raiseEvent("focus", args);
	},
	
    add_disable : function(handler) 
    {
        this.get_events().addHandler('disable', handler);
    },
    remove_disable : function(handler) 
    {
        this.get_events().removeHandler('disable', handler);
    },
	raise_disable : function(args)
	{
		this.raiseEvent("disable", args);
	},
	
    add_enable : function(handler) 
    {
        this.get_events().addHandler('enable', handler);
    },
    remove_enable : function(handler) 
    {
        this.get_events().removeHandler('enable', handler);
    },
	raise_enable : function(args)
	{
		this.raiseEvent("enable", args);
	},	
	
    add_keyPress : function(handler) 
    {
        this.get_events().addHandler('keyPress', handler);
    },
    remove_keyPress : function(handler) 
    {
        this.get_events().removeHandler('keyPress', handler);
    },
	raise_keyPress : function(args)
	{
		this.raiseEvent("keyPress", args);
	},
	
    add_enumerationChanged : function(handler) 
    {
        this.get_events().addHandler('enumerationChanged', handler);
    },
    remove_enumerationChanged : function(handler) 
    {
        this.get_events().removeHandler('enumerationChanged', handler);
    },
	raise_enumerationChanged : function(args)
	{
		this.raiseEvent("enumerationChanged", args);
	},
	
    add_moveUp : function(handler) 
    {
        this.get_events().addHandler('moveUp', handler);
    },
    remove_moveUp : function(handler) 
    {
        this.get_events().removeHandler('moveUp', handler);
    },
	raise_moveUp : function(args)
	{
		this.raiseEvent("moveUp", args);
	},
	
    add_moveDown : function(handler) 
    {
        this.get_events().addHandler('moveDown', handler);
    },
    remove_moveDown : function(handler) 
    {
        this.get_events().removeHandler('moveDown', handler);
    },
	raise_moveDown : function(args)
	{
		this.raiseEvent("moveDown", args);
	},
	
    add_buttonClick : function(handler) 
    {
        this.get_events().addHandler('buttonClick', handler);
    },
    remove_buttonClick : function(handler) 
    {
        this.get_events().removeHandler('buttonClick', handler);
    },
	raise_buttonClick : function(args)
	{
		this.raiseEvent("buttonClick", args);
	},
	
    add_valueChanging : function(handler) 
    {
        this.get_events().addHandler('valueChanging', handler);
    },
    remove_valueChanging : function(handler) 
    {
        this.get_events().removeHandler('valueChanging', handler);
    },
	raise_valueChanging : function(args)
	{
		this.raiseEvent("valueChanging", args);
	}								
}

//$telerik.makeCompatible(Telerik.Web.UI.RadInputControl);
Telerik.Web.UI.RadInputControl.registerClass('Telerik.Web.UI.RadInputControl', Telerik.Web.UI.RadWebControl);


// fix ValidatorSetFocus: Work Item #6120
if (typeof(ValidatorSetFocus) == "function")
{
    ValidatorSetFocus = function (val, event) 
    {
        var ctrl;
        if (typeof(val.controlhookup) == "string") 
        {
            var eventCtrl;
            if ((typeof(event) != "undefined") && (event != null)) 
            {
                if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) 
                {
                    eventCtrl = event.srcElement;
                }
                else 
                {
                    eventCtrl = event.target;
                }
            }
            if ((typeof(eventCtrl) != "undefined") && (eventCtrl != null) &&
                (typeof(eventCtrl.id) == "string") &&
                (eventCtrl.id == val.controlhookup)) 
            {
                ctrl = eventCtrl;
            }
        }
        if ((typeof(ctrl) == "undefined") || (ctrl == null)) 
        {
            ctrl = document.getElementById(val.controltovalidate);
        }
        var isRadInputControl = false;
        if ((ctrl.style)
            && (typeof(ctrl.style.visibility) != "undefined") 
            && (ctrl.style.visibility == "hidden")
            && (typeof(ctrl.style.width) != "undefined")
            && (document.getElementById(ctrl.id + "_text") || document.getElementById(ctrl.id + "_dateInput_text"))
            && (ctrl.tagName.toLowerCase() == "input" || ctrl.tagName.toLowerCase() == "textarea"))
        {
            isRadInputControl = true;     
        }       
        if ((typeof(ctrl) != "undefined") && (ctrl != null) &&  
            (ctrl.tagName.toLowerCase() != "table" || (typeof(event) == "undefined") || (event == null)) &&
            ((ctrl.tagName.toLowerCase() != "input") || (ctrl.type.toLowerCase() != "hidden")) &&
            (typeof(ctrl.disabled) == "undefined" || ctrl.disabled == null || ctrl.disabled == false) &&
            (typeof(ctrl.visible) == "undefined" || ctrl.visible == null || ctrl.visible != false) &&
            (IsInVisibleContainer(ctrl) || isRadInputControl)) 
        {
            if (ctrl.tagName.toLowerCase() == "table" &&
                (typeof(__nonMSDOMBrowser) == "undefined" || __nonMSDOMBrowser)) 
            {
                var inputElements = ctrl.getElementsByTagName("input");
                var lastInputElement = inputElements[inputElements.length -1];
                if (lastInputElement != null) 
                {
                    ctrl = lastInputElement;
                }
            }

            if (typeof(ctrl.focus) != "undefined" && ctrl.focus != null) 
            {
                if (isRadInputControl && document.getElementById(ctrl.id + "_text"))
                {
					document.getElementById(ctrl.id + "_text").focus();
                }
                else if (isRadInputControl && document.getElementById(ctrl.id + "_dateInput_text"))
                {
					document.getElementById(ctrl.id + "_dateInput_text").focus();
                }
                else
                {
					ctrl.focus();
				}

                Page_InvalidControlToBeFocused = ctrl;
            }
        }
    } 
}

// RegularExpressionValidator override
if (typeof(ValidatedControlOnBlur) == "function")
{
	ValidatedControlOnBlur = function(event)
	{
		var control;
		if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null))
		{
			control = event.srcElement;
		}
		else
		{
			control = event.target;
		}
		
        var isRadInputControl = false;
        if ((control.style)
            && (typeof(control.style.visibility) != "undefined") 
            && (control.style.visibility == "hidden")
            && (typeof(control.style.width) != "undefined")
            && (document.getElementById(control.id + "_text") || document.getElementById(control.id + "_dateInput_text"))
            && (control.tagName.toLowerCase() == "input" || control.tagName.toLowerCase() == "textarea"))
        {
            isRadInputControl = true;     
        }

		if ((typeof(control) != "undefined") &&
			(control != null) &&
			(Page_InvalidControlToBeFocused == control)
		)
		{
            if (isRadInputControl && document.getElementById(control.id + "_text"))
            {
				document.getElementById(control.id + "_text").focus();
            }
            else if (isRadInputControl && document.getElementById(control.id + "_dateInput_text"))
            {
				document.getElementById(control.id + "_dateInput_text").focus();
            }
            else
            {
				control.focus();
			}
			
			Page_InvalidControlToBeFocused = null;
		}
	}
}

/* END Telerik.Web.UI.Input.RadInputControl.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadEnumerationMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadEnumerationMaskPart = function(opts)
{
    Telerik.Web.UI.RadEnumerationMaskPart.initializeBase(this);

	this.SetOptions(opts);	
	this.lastOffsetPunched = -1;
	this.selectedForCompletion = 0;
	this.FlipDirection = 0;
	
	this.RebuildKeyBuff();
};

Telerik.Web.UI.RadEnumerationMaskPart.prototype =
{
    SetOptions : function (opts)
    {
	    this.length = 0;
	    this.Options = opts;
	    this.optionsIndex = [];
	    for (var i = 0; i < this.Options.length; i ++)
	    {
		    this.length = Math.max(this.length, this.Options[i].length);
		    this.optionsIndex[this.Options[i]] = i;
	    }
    },
    
    CanHandle : function ()
    {
	    return true;
    },
    
    SetController : function (controller)
    {
	    this.controller = controller;
	    this.InitializeSelection(controller.get_allowEmptyEnumerations());
    },
    
    InitializeSelection : function(allowEmptyEnumerations)
    {
	    if (allowEmptyEnumerations)
	    {
		    this.value = "";
		    this.selectedIndex = -1;
	    }
	    else
	    {
		    this.value = this.Options[0];
		    this.selectedIndex = 0;	
	    }
    },
    
    RebuildKeyBuff : function ()
    {
	    this.keyBuff = [];
	    for (i = 0; i < this.length; i ++)
	    {
		    this.keyBuff[i] = "";
	    }
    	
	    this.keyBuffRebuilt = true;
    },
    
    IsCaseSensitive : function ()
    {
	    return true;
    },
    
    ResetCompletion : function()
    {
	    this.selectedForCompetion = 0;
    },
    
    SelectNextCompletion : function()
    {
	    this.selectedForCompletion ++;
    },
    
    Store : function (value, offset)
    {
	    if (this.lastOffsetPunched == offset)
	    {
		    if (this.keyBuff[offset] == value)
		    {
			    this.SelectNextCompletion();
		    } 
		    else
		    {
			    this.RebuildKeyBuff();
		    }
	    }
	    else
	    {
		    this.ResetCompletion();
	    }
    	
	    this.lastOffsetPunched = offset;
	    this.keyBuff[offset] = value;
    },
    
    SetNoCompletionValue : function()
    {
	    if (this.controller.get_allowEmptyEnumerations())
	    {
		    this.SetOption(-1);
	    }
    },
    
    SetValue : function (value, offset)
    {
	    offset -= this.offset;
    	
	    this.Store(value, offset);
    	
	    var completionList = new Telerik.Web.UI.CompletionList(this.Options, this.PromptChar);
	    var completions = completionList.GetCompletions(this.keyBuff, offset);
    	
	    if (completions.length > 0)
	    {
		    var selectedItemIndex = this.optionsIndex[completions[this.selectedForCompletion % completions.length]];
		    this.SetOption(selectedItemIndex);
	    } else
	    {
		    this.SetNoCompletionValue();
		    return false;
	    }

	    return true;
    },
    
    GetVisValue : function ()
    {
	    var v = this.value;
	    while (v.length < this.length)
	    {
		    v += this.PromptChar;
	    }
    	
	    return v;
    },
    
    GetLength : function ()
    {
	    return this.length;
    },
    
    GetSelectedIndex : function ()
    {
	    return this.selectedIndex;
    },
    
    SetOption : function (index, up)
    {
	    var oldValue = this.value;
    	
	    if (this.controller.get_allowEmptyEnumerations())
	    {
		    if (index < -1)
		    {
			    index = this.Options.length + index + 1;
			    this.FlipDirection = -1;
		    }
		    else if (index >= this.Options.length)
		    {
    			
			    index = index - this.Options.length -1;
			    this.FlipDirection = 1;
		    }
	    } 
	    else
	    {
		    if (index < 0)
		    {
    			
			    index = this.Options.length + index;
			    this.FlipDirection = -1;
		    }
    		
		    else if (index >= this.Options.length)
		    {
    			
			    index = index - this.Options.length;
			    this.FlipDirection = 1;
		    }	
	    }
	    this.selectedIndex = index;
	    this.value = index == -1 ? "" : this.Options[index];
    	
	    if (typeof(up) != "undefined")
	    {
		    if (up)
		    {
			    this.controller._OnMoveUp(this, oldValue, this.value);
		    }
		    else
		    {
			    this.controller._OnMoveDown(this, oldValue, this.value);
		    }
	    }
	    this.controller._OnEnumChanged(this, oldValue, this.value);
	    this.FlipDirection = 0;
    },
    
    HandleKey : function (e)
    {
	    this.controller._calculateSelection();
	    var eventWrap = new Telerik.Web.UI.MaskedEventWrap(e, this.controller._textBoxElement);
	    if (eventWrap.IsDownArrow())
	    {
		    this.SetOption(this.selectedIndex + 1, false);

		    this.controller._Visualise();
		    this.controller._FixSelection(eventWrap);
		    return true;
	    }
	    else if (eventWrap.IsUpArrow())
	    {
		    this.SetOption(this.selectedIndex - 1, true);
		    this.controller._Visualise();
		    this.controller._FixSelection(eventWrap);
		    return true;
	    }
    },
    
    HandleWheel : function (e)
    {  
	    this.controller._calculateSelection();
	    var eventWrap = new Telerik.Web.UI.MaskedEventWrap(e, this.controller._textBoxElement);	
    	
	    this.SetOption(this.selectedIndex - e.rawEvent.wheelDelta / 120);
    	
	    this.controller._Visualise();
	    this.controller._FixSelection(eventWrap);
	    return false;
    }
};

Telerik.Web.UI.RadEnumerationMaskPart.registerClass("Telerik.Web.UI.RadEnumerationMaskPart", Telerik.Web.UI.RadMaskPart);

Telerik.Web.UI.CompletionList = function(options, blankChar)
{
	this.options = options;
	this.blankChar = blankChar;
};

Telerik.Web.UI.CompletionList.prototype = 
{
    GetCompletions : function(keys, offset)
    {
	    var completions = this.options;
	    for (var currentPosition = 0; currentPosition <= offset; currentPosition++)
	    {
		    var currentChar = keys[currentPosition].toLowerCase();
		    completions = this.FilterCompletions(completions, currentPosition, currentChar);
	    }
	    return completions;
    },
    
    FilterCompletions : function(completions, wordIndex, key)
    {
	    var matches = [];
	    for (var completionIndex = 0; completionIndex < completions.length; completionIndex++)
	    {
		    var currentCompletion = completions[completionIndex];
		    var wordChar = currentCompletion.charAt(wordIndex).toLowerCase();
    		
		    if (this.CharacterMatchesCompletion(key, wordChar))
		    {
			    matches[matches.length] = currentCompletion;
		    }
	    }
	    return matches;
    },
    
    CharacterMatchesCompletion : function(currentChar, wordChar)
    {
	    return currentChar == this.blankChar ||
				    currentChar == " " ||
				    currentChar == wordChar;
    }
};

Telerik.Web.UI.CompletionList.registerClass("Telerik.Web.UI.CompletionList");

/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadEnumerationMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadDigitMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadDigitMaskPart = function()
{
    Telerik.Web.UI.RadDigitMaskPart.initializeBase(this);
}

Telerik.Web.UI.RadDigitMaskPart.prototype = 
{
    GetValue : function ()
    {
        return this.value.toString();
    },
    
    IsCaseSensitive : function ()
    {
        return true;
    },
    
    GetVisValue : function ()
    {
        if (this.value.toString() == "")
        {
            return this.PromptChar;
        }
        
        return this.value.toString();
    },
    
    CanHandle : function (value, offset)
    {
	    if (isNaN(parseInt(value)))
	    {
		    this.controller._OnChunkError(this, this.GetValue(), value);
		    return false;
	    }
	    
	    return true;
    },
    
    SetValue : function (value, offset)
    {
	    if (value == "" || value == this.PromptChar || value == " ")
	    {
		    this.value = "";
		    return true;
	    }

	    if (this.CanHandle(value, offset))
	    {
		    this.value = parseInt(value);
	    }
	    return true;
    } 
};

Telerik.Web.UI.RadDigitMaskPart.registerClass("Telerik.Web.UI.RadDigitMaskPart", Telerik.Web.UI.RadMaskPart);

/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadDigitMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadLowerMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadLowerMaskPart = function()
{
    Telerik.Web.UI.RadLowerMaskPart.initializeBase(this);
};

Telerik.Web.UI.RadLowerMaskPart.prototype = 
{
    CanHandle : function (value, offset)
    {
	    if (!this.IsAlpha(value))
	    {
		    this.controller._OnChunkError(this, this.GetValue(), value);	
		    return false;
	    }
	    return true;
    },
    
    GetVisValue : function ()
    {
        if (this.value.toString() == "")
        {
		    return this.PromptChar;
        }
        return this.value.toString();
    },
    
    SetValue : function (value, offset)
    {
	    if (value == "")
	    {
		    this.value = "";
		    return true;
	    }

	    if (this.IsAlpha(value))
	    {
		    this.value = value.toLowerCase();
	    }
	    else
	    {
		    this.controller._OnChunkError(this, this.GetValue(), value);
	    }
	    return true;
    }   
};

Telerik.Web.UI.RadLowerMaskPart.registerClass("Telerik.Web.UI.RadLowerMaskPart", Telerik.Web.UI.RadMaskPart);


/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadLowerMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadLiteralMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadLiteralMaskPart = function(ch)
{
    Telerik.Web.UI.RadLiteralMaskPart.initializeBase(this);
	this.ch = ch;
};

Telerik.Web.UI.RadLiteralMaskPart.prototype =
{
    GetVisValue : function ()
    {
        return this.ch;
    },
    
    GetLength : function ()
    {
	    if (Sys.Browser.agent == Sys.Browser.Firefox)
	    {
		    return this.ch.length - (this.ch.split("\r\n").length - 1);
	    }
	    
	    return this.ch.length;
    },
    
    GetValue : function ()
    {
	    return "";
    },
    
    IsCaseSensitive : function ()
    {
	    if (this.NextChunk != null)
	    {
		    return this.NextChunk.IsCaseSensitive();
	    }
    },
    
    SetValue : function (value, offset)
    {
	    offset -= this.offset;
	    // mimick that it has setup its value.
	    return value == this.ch.charAt(offset) || !value;
    },
    
    CanHandle : function (value, offset)
    {
	    offset -= this.offset;
	    // mimick that it has setup its value.
	    if ( value == this.ch.charAt(offset) ) return true;
	    if (!value) return true;
    	

	    if (this.NextChunk != null)
	    {
		    return this.NextChunk.CanHandle(value, offset + this.GetLength());
	    }
    }
};

Telerik.Web.UI.RadLiteralMaskPart.registerClass("Telerik.Web.UI.RadLiteralMaskPart", Telerik.Web.UI.RadMaskPart);


/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadLiteralMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadFreeMaskPart.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadFreeMaskPart = function()
{
    Telerik.Web.UI.RadFreeMaskPart.initializeBase(this);
};

Telerik.Web.UI.RadFreeMaskPart.prototype = 
{
    IsCaseSensitive : function ()
    {
	    return true;
    },
    
    GetVisValue : function ()
    {
        if (this.value.toString() == "")
        {
		    return this.PromptChar;
        }
        return this.value;
    },
    
    SetValue : function (value, offset)
    {
	    this.value = value;
	    return true;
    }        
};

Telerik.Web.UI.RadFreeMaskPart.registerClass("Telerik.Web.UI.RadFreeMaskPart", Telerik.Web.UI.RadMaskPart);

/* END Telerik.Web.UI.Input.MaskedTextBox.MaskParts.RadFreeMaskPart.js */
/* START Telerik.Web.UI.Input.MaskedTextBox.RadMaskedTextBox.js */

Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.RadMaskedTextBox = function(element)
{
    Telerik.Web.UI.RadMaskedTextBox.initializeBase(this, [element]);
    
    this._parts = [];
    this._partIndex = [];
    this._displayPartIndex = [];
    this._value = '';
    this._lastState = null;
    this._length = 0;
    this._displayLength = 0;
    this._internalValueUpdate = false;	
    this._projectedValue = "";
    this._isTextarea = false;
    
    this._initialMasks = [];
    this._initialDisplayMasks = [];
    
    this._promptChar = "_";
    this._displayPromptChar = "_";
    this._displayFormatPosition = Telerik.Web.UI.DisplayFormatPosition.Left;
    this._hideOnBlur = false;
    this._resetCaretOnFocus = false;
    this._roundNumericRanges = true;
    this._allowEmptyEnumerations = false;
    this._readOnly = false;
    this._focusOnStartup = false;
    
    this._onTextBoxMouseUpDelegate = null;
    this._onTextBoxMouseDownDelegate = null;
    this._onTextBoxPasteDelegate = null;
    this._onTextBoxPropertyChangeDelegate = null;
    this._onTextBoxInputDelegate = null;
    this._onFormResetDelegate = null;
    
    this._isInitialized = false;
    this._originalValue = "";  
    
    //when autopostback is set to true, the box should postback even when the set_value method is called from the client;
    //however this may lead to double post back - once on blur and once on set_value; 
    //this entails that the second post back should be prevented - accomplished through this flag.
    this.preventPostBackAfterBlur = false;      
};

Telerik.Web.UI.RadMaskedTextBox.prototype = 
{
    initialize : function() 
    {
        Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this, 'initialize');

		if (this._focused)
		{
			this._focusOnStartup = true;
		}
		
        this._fixAbsolutePositioning();
        
        this._setMask(this.get__initialMasks());
        if (this.get__initialDisplayMasks().length)
        {
            this._setDisplayMask(this.get__initialDisplayMasks());
        }
        
        this._SetValue(this._textBoxElement.value);
        this._Visualise();
        
        this._textBoxElement._oldValue = this._textBoxElement.value;
        this._isTextarea = this._textBoxElement.tagName.toLowerCase() == 'textarea';

        this._RecordInitialState();   
        this._isInitialized = true;
        
		if (this._focusOnStartup)
		{
			this._calculateSelection();
			this._lastState = new Telerik.Web.UI.MaskedEventWrap(null, this._textBoxElement);
		}
    },
    
    dispose : function()
    {
        if (this._onTextBoxMouseUpDelegate)
        {
         $removeHandler(this._textBoxElement, "mouseup", this._onTextBoxMouseUpDelegate);
         this._onTextBoxMouseUpDelegate = null;
        }
        if (this._onTextBoxMouseDownDelegate)
        {
         $removeHandler(this._textBoxElement, "mousedown", this._onTextBoxMouseDownDelegate);
         this._onTextBoxMouseDownDelegate = null;
        }
        if (this._onFormResetDelegate)
        {
            if(this._textBoxElement.form)
                $removeHandler(this._textBoxElement.form, "reset", this._onFormResetDelegate);
                
         this._onFormResetDelegate = null;
        }
         if (Sys.Browser.agent == Sys.Browser.InternetExplorer)
	     {
		    // ie specific
		    if (this._onTextBoxPasteDelegate) 
		    {
		        $removeHandler(this._textBoxElement, "paste", this._onTextBoxPasteDelegate);
		        this._onTextBoxPasteDelegate = null;
		    }
		    if (this._onTextBoxPropertyChangeDelegate)
		    {
		        $removeHandler(this._textBoxElement, "propertychange", this._onTextBoxPropertyChangeDelegate);
		        this._onTextBoxPropertyChangeDelegate = null;
		    }
	     }
	     else
	     {
	        if (this._onTextBoxInputDelegate)
	        {
    	        $removeHandler(this._textBoxElement, "input", this._onTextBoxInputDelegate);
	            this._onTextBoxInputDelegate = null;
	        }
	     } 
         Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this, 'dispose');
    },    
    
    isEmpty : function ()
    {
	    return this._value == '';
    },

    resetCursor : function ()
    {
	    this.set_cursorPosition(0);
    },    

    inSelection : function (e)
    {
	    this._calculateSelection();
    	
	    if (this._textBoxElement.selectionStart != this._textBoxElement.selectionEnd)
	    {
		    this._OnActivity(e);
		    return true;
	    }
    	
	    if (e.ctrlKey || e.altKey || Sys.Browser.agent == Sys.Browser.Safari)
	    {
		    this._OnActivity(e);
		    return true;
	    }
    	
	    return false;
    },
    
    // override
    updateDisplayValue : function()
    {
        if  (this._isInitialized)
        {
	        if (this._focused)
	        {
	            if ((this.get_hideOnBlur() && this.isEmpty()) || this._displayParts)
	            {
		            this._Visualise(); 
		            this._textBoxElement.select();
	            }
            	
	            if (this.get_resetCaretOnFocus())
	            {
		            this.resetCursor();
	            }
	        }
	        else
	        {
                this._Visualise();
	        }
	    }
    },
    
    // override
    updateHiddenValue : function ()
    {
	    return this._setHiddenValue(this.get_valueWithPromptAndLiterals());
    },    
    
    // obsolete: use the valueWithLiterals property
    GetValueWithLiterals : function()
    {
        return this.get_valueWithLiterals();
    },

    // obsolete: use the valueWithPromptAndLiterals property 
    GetValueWithPromptAndLiterals : function()
    {
	    return this.get_valueWithPromptAndLiterals();
    },

    // obsolete: use the prompt property
    GetPrompt : function()
    {
	    return this.get_prompt();
    },
    
    // obsolete: use the cursorPosition property
    SetCursorPosition : function (position)
    {
        this.set_cursorPosition(position);
    },
    
    get_valueWithLiterals : function()
    {
    	var result = [];
	    for (var i = 0; i < this._parts.length; i++)
	    {		
		    result[i] = this._parts[i].ch || this._parts[i].GetValue();
	    }
	    return result.join('');
    },
    
    get_valueWithPromptAndLiterals : function()
    {
        return this._GetVisibleValues(this._parts);
    },
    
    get_prompt : function()
    {
        var toPromptRep = new RegExp('.', 'g');
	    var result = [];
	    for (var i = 0; i < this._parts.length; i++)
	    {		
		    result[i] = this._parts[i].ch || this._parts[i].GetVisValue().replace(toPromptRep, this.get_promptChar());
	    }
	    return result.join('');
    },
    
    get_displayValue : function ()
    {
	    var value = this._value;
	    
        while (value.length < this._displayLength)
        {
            if (this.get_displayFormatPosition())
            {
                value = this.get_promptChar() + value;
            }
            else
            {
                value += this.get_promptChar();
            }
        }
	    
	    this._UpdateDisplayPartsInRange(value, 0, this._displayLength);
	    if (this._displayParts)
	        return this._GetVisibleValues(this._displayParts);
        else
            return this._GetVisibleValues(this._parts);
    },
    
    set_cursorPosition : function(position)
    {
	    if (!this._focused)
	        return;
	        
	    this._calculateSelection();
	    if (Sys.Browser.agent == Sys.Browser.InternetExplorer)
	    {
		    this._textBoxElement.select();
		    sel = document.selection.createRange();
		    var rnscount = this._textBoxElement.value.substr(0, position).split("\r\n").length - 1;
		    sel.move('character', position - rnscount);
		    sel.select();
	    }
	    else
	    {
		    this._textBoxElement.selectionStart = position;
		    this._textBoxElement.selectionEnd = position;
	    }
    },
    
    get_value : function()
    {
	    var result = [];
	    for (var i = 0; i < this._parts.length; i++)
	    {		
		    result[i] = this._parts[i].GetValue();
	    }
	    
	    return result.join('');
    }, 
   
    set_value : function (value)
    {
        this._SetValue(value);
	    
	    if (this._ValueHasChanged())
	    {	    
	        this.raise_valueChanged();
	    
	        if (this.get_autoPostBack() && !this.preventPostBackAfterBlur) 
	        {
		        this.raisePostBackEvent();
	        }
        }	    

    },
    
    get_promptChar : function()
    {
        return this._promptChar;
    },
    
    set_promptChar : function(value)
    {
        if (this._promptChar != value)
        {
            this._promptChar = value;
            this.raisePropertyChanged("PromptChar");
        }
    },
    
    get_displayPromptChar : function()
    {
        return this._displayPromptChar;
    },
    
    set_displayPromptChar : function(value)
    {
        if (this._displayPromptChar != value)
        {
            this._displayPromptChar = value;
            this.raisePropertyChanged("DisplayPromptChar");
        }
    },
    
    get_displayPromptChar : function()
    {
        return this._displayPromptChar;
    },
    
    set_displayPromptChar : function(value)
    {
        if (this._displayPromptChar != value)
        {
            this._displayPromptChar = value;
            this.raisePropertyChanged("DisplayPromptChar");
        }
    },
    
    get_displayPromptChar : function()
    {
        return this._displayPromptChar;
    },
    
    set_displayPromptChar : function(value)
    {
        if (this._displayPromptChar != value)
        {
            this._displayPromptChar = value;
            this.raisePropertyChanged("DisplayPromptChar");
        }
    },

    get_displayFormatPosition : function()
    {
        return this._displayFormatPosition;
    },
    
    set_displayFormatPosition : function(value)
    {
        if (this._displayFormatPosition != value)
        {
            this._displayFormatPosition = value;
            this.raisePropertyChanged("DisplayFormatPosition");
        }
    },
    
    get_hideOnBlur : function()
    {
        return this._hideOnBlur;
    },
    
    set_hideOnBlur : function(value)
    {
        if (this._hideOnBlur != value)
        {
            this._hideOnBlur = value;
            this.raisePropertyChanged("HideOnBlur");
        }
    },
    
    get_resetCaretOnFocus : function()
    {
        return this._resetCaretOnFocus;
    },
    
    set_resetCaretOnFocus : function(value)
    {
        if (this._resetCaretOnFocus != value)
        {
            this._resetCaretOnFocus = value;
            this.raisePropertyChanged("ResetCaretOnFocus");
        }
    },
    
    get_roundNumericRanges : function()
    {
        return this._roundNumericRanges;
    },
    
    set_roundNumericRanges : function(value)
    {
        if (this._roundNumericRanges != value)
        {
            this._roundNumericRanges = value;
            this.raisePropertyChanged("RoundNumericRanges");
        }
    },
    
    get_allowEmptyEnumerations : function()
    {
        return this._allowEmptyEnumerations;
    },
    
    set_allowEmptyEnumerations : function(value)
    {
        if (this._allowEmptyEnumerations != value)
        {
            this._allowEmptyEnumerations = value;
            this.raisePropertyChanged("AllowEmptyEnumerations");
        }
    },
    
    get_readOnly : function()
    {
        return this._readOnly;
    },
    
    set_readOnly : function(value)
    {
        if (this._readOnly != value)
        {
            this._readOnly = value;
            this.raisePropertyChanged("ReadOnly");
        }
    },
    
	saveClientState : function()
	{
		return Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this, "saveClientState");
	},
    
    _attachMouseEventHandlers : function()
    {
        Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this, "_attachMouseEventHandlers");
        
        this._onTextBoxMouseDownDelegate = Function.createDelegate(this, this._onTextBoxMouseDownHandler); 
        
        if (!$telerik.isSafari)
        {
            this._onTextBoxMouseUpDelegate = Function.createDelegate(this, this._onTextBoxMouseUpHandler);    
            $addHandler(this._textBoxElement, "mouseup", this._onTextBoxMouseUpDelegate);
        }
            
        $addHandler(this._textBoxElement, "mousedown", this._onTextBoxMouseDownDelegate);
    },
    
    _attachEventHandlers : function ()
    {
        Telerik.Web.UI.RadMaskedTextBox.callBaseMethod(this, "_attachEventHandlers");
    
        if(this._textBoxElement && this._textBoxElement.form)
        {
	        this._onFormResetDelegate = Function.createDelegate(this, this._onFormResetHandler);
	        $addHandler(this._textBoxElement.form, "reset", this._onFormResetDelegate);	    
	    }
	    
	    if (Sys.Browser.agent == Sys.Browser.InternetExplorer)
	    {
		    // ie specific
		    this._onTextBoxPasteDelegate = Function.createDelegate(this,  this._onTextBoxPasteHandler);
		    this._onTextBoxPropertyChangeDelegate = Function.createDelegate(this,  this._onTextBoxPropertyChangeHandler);
		    
		    $addHandler(this._textBoxElement, "paste", this._onTextBoxPasteDelegate);
		    $addHandler(this._textBoxElement, "propertychange", this._onTextBoxPropertyChangeDelegate);
	    }
	    else
	    {
	        this._onTextBoxInputDelegate = Function.createDelegate(this,  this._onTextBoxInputHandler);
	        
	        $addHandler(this._textBoxElement, "input", this._onTextBoxInputDelegate);
	    }
    	
	    if (Sys.Browser.agent == Sys.Browser.Opera)
	    {
	        var handler = this;
		    var intervalCheck = function () 
		    {
			    return handler._ValueHandler({});
		    };
		    
		    setInterval(intervalCheck, 10);
	    }
    },
    
    _SetValue : function(value)
    {
        this._internalValueUpdate = true;
	    this._UpdatePartsInRange(value, 0, this._length);
	    this._internalValueUpdate = false;
	    this._Visualise();
    },
    
    // override
	_initializeHiddenElement : function(id)
	{
	    this._hiddenElement = $get(id + "_Value");
	},
	
	// override 
	_initializeValidationField : function(id)
	{
	    this._validationField = $get(id);
	},
	
	// override
	_setValidationField : function(value)
	{
	    if (this.isEmpty())
	    {
		    this._validationField.value = "";
	    }
	    else
	    {
		    this._validationField.value = this.get_valueWithLiterals();
	    }
	},
	
	// override
	_getValidationField : function(value)
	{
	    return this._validationField;
	},    
	
	// Event handlers
	_onFormResetHandler : function(e)
	{
	    if(this._originalValue == null)
	       this._originalValue = "";
	       
        this._setHiddenValue(this._originalValue);        
        this._SetValue(this._originalValue);
	},
	
    _onTextBoxInputHandler : function (e)
    {
	    this._ValueHandler(e);
    },

    _onMouseWheel : function (e)
    {
        return this._OnMouseWheel(event);
    },

    _onTextBoxPropertyChangeHandler : function (e)
    {
        this._OnPropertyChange();
    },

    _onTextBoxPasteHandler : function (e)
    {
	    if (this.get_readOnly())
	    {
		    return false;
	    }
    	
//	    if (this._selectionStart == this._value.length)
//	    {
//		    return false;	
//	    }
    	
    	var owner = this;
	    setTimeout (function () {owner._FakeOnPropertyChange()}, 1);
    },

    _onTextBoxBlurHandler : function (e)
    {

        this._focused = false;
        this._hovered = false;
        
        if (this._ValueHasChanged())
	    {
            this.raise_valueChanged();     

            if (this.get_autoPostBack()) 
	        {
		        this.raisePostBackEvent();
		        this.preventPostBackAfterBlur = true;
	        }
        }
	    
        this.raise_blur(Sys.EventArgs.Empty);      
        
	    this.updateDisplayValue();
	    this.updateCssClass();
	    
    },

    _onTextBoxMouseUpHandler : function (e)
    {
	    this._FakeOnPropertyChange();
	    this._ValueHandler(e);
	    this._ActivityHandler(e);	
        //fix a problem with Safari and selectiononfocus	        
        if ($telerik.isSafari && this._allowApplySelection)
        { 	 
            this._allowApplySelection = false;               
            this._updateSelectionOnFocus();   
            e.preventDefault();
            e.stopPropagation();	    
        }
    },

    _onTextBoxMouseDownHandler : function (e)
    {
        this._FakeOnPropertyChange();
        this._ActivityHandler(e);
    },

    _onTextBoxFocusHandler : function (e)
    {   
        this._allowApplySelection = true;
                             
        this._focused = true;
	    this.updateDisplayValue();
	    this.updateCssClass();
	    this._updateSelectionOnFocus();
	    this._FakeOnPropertyChange()
	    this._ActivityHandler(e);
	    this.raise_focus(Sys.EventArgs.Empty);
    },
    
    _onTextBoxKeyUpHandler : function (e)
    {
	    this._FakeOnPropertyChange();
    },	
    
    _OnActivity : function (e)
    {
	    this._calculateSelection();
	    this._lastState = new Telerik.Web.UI.MaskedEventWrap(e, this._textBoxElement);
    },    
    
    _OnPropertyChange : function ()
    {
	    if (this._internalValueUpdate) 
	    {
	        return;
	    }
	    
	    if (event.propertyName == "value")
	    {
		    var e = event;
		    var handler = this;
		    var valueWrapper = function ()
		    {
			    handler._ValueHandler(e);
		    }
		    this._calculateSelection();
    		
		    if (this._textBoxElement.selectionStart > 0 || this._textBoxElement.selectionEnd > 0)
		    {
			    valueWrapper();
		    }
		    else // failed to calculate selection - wait a second.
		    {
			    setTimeout(valueWrapper, 1);
		    }
	    }
    },

    //we can use TextBoxMouseWheelHandler base handler instead of OnMouseWheel
    _onTextBoxMouseWheelHandler : function (e)
    {
	    if (this.get_readOnly())
	    {
		    return false;
	    }
	    this._calculateSelection();
	    var currentChunk = this._partIndex[this._textBoxElement.selectionStart];
	    if (currentChunk == null)
	    {
		    return true;
	    }
	    return currentChunk.HandleWheel(e);
    },
    
    _updateSelectionOnFocus : function()
    {               
        switch (this.get_selectionOnFocus())
        {
            case 0: //None
                break;
            case 1: //CaretToBeginning
                var position = 0;
                var i;
                
                for (i = 0; i < this._partIndex.length; i++)
                {
                    if (!this._partIndex[i].ch)
                    {
                        position = i;
                        break;
                    }  
                }            
                this.set_caretPosition(position);
                break;
            case 2: //CaretToEnd
                if (this._textBoxElement.value.length > 0)
                {
                    this.set_caretPosition(this._textBoxElement.value.length);
                }
                break;
            case 3: //SelectAll
                this.selectAllText();
                break;            
            default : 
				this.set_caretPosition(0); //CaretToBeginning
				break;
        }
    },

    _onTextBoxKeyDownHandler : function (e)
    {   
        
            
	    this._FakeOnPropertyChange();
    	
	    if (this.inSelection(e))
	    {
		    return true;
	    }
    	
	    var currentChunk = this._partIndex[this._textBoxElement.selectionStart];
    	
	    if (this.get_readOnly() && (e.keyCode == 46 || e.keyCode == 8 || e.keyCode == 38 || e.keyCode == 40))
	    {
		    e.preventDefault();
		    return false;
	    }   	
	    else if (e.keyCode == 13) // Enter
	    {
		    return true;
	    }	
    	else if (currentChunk == null && e.keyCode != 8)
	    {
		    return true;
	    }
    	else if (currentChunk != null)
	    {
		    if (currentChunk.HandleKey(e))
		    {
			    e.preventDefault();
			    return false;
		    }
	    }

	    var selectionEnd = this._textBoxElement.selectionEnd;	     	
	    var handled = false;
    	
	    // delete or interval
	    if ((e.keyCode == 46 || e.keyCode == 127) && selectionEnd < this._textBoxElement.value.length ) 
	    {
		    currentChunk.SetValue("", this._textBoxElement.selectionStart);
		    selectionEnd ++;
		    handled = true;	
		    
		    e.preventDefault();	    
	    }
    	
	    else if (e.keyCode == 8 && selectionEnd ) // backspace
	    {	        
		    this._partIndex[this._textBoxElement.selectionStart - 1].SetValue("", this._textBoxElement.selectionStart - 1);
		    selectionEnd --;
		    handled = true;
		    
		    e.preventDefault();
	    }    	
    	
	    if (handled)
	    {	        
		    return this._UpdateAfterKeyHandled(e, selectionEnd);		
	    }

	    this._OnActivity(e);
	    return true;
    },        
    
    _onTextBoxKeyPressHandler : function (e)
    {    
                           
	    if (this.get_readOnly())
	    {
		    e.preventDefault();
		    e.stopPropagation();
		    return false;
	    }
	    
	    var eventArgs = new Telerik.Web.UI.InputKeyPressEventArgs(e, e.charCode, String.fromCharCode(e.charCode));
	    this.raise_keyPress(eventArgs);
	    
        if (eventArgs.get_cancel())
        {
            e.stopPropagation();
		    e.preventDefault();
			return false;        
        }     

	    if (this.inSelection(e))
	    {
		    return true;
	    }	
    	
	    var currentChunk = this._partIndex[this._textBoxElement.selectionStart];
    	
	    if (currentChunk == null)
	    {
	        if (e.charCode == 13) // Enter - raise the ValueChanged event.
	        {
               if (this._ValueHasChanged())
	           { 	        
	                this.raise_valueChanged();     
        	        	
                    this.updateDisplayValue();
    	            this.updateCssClass();
        	       
	                if (this.get_autoPostBack())
                    {
                        this.raisePostBackEvent();
                    }       	        
                }
	            
	        }
	        
	        return true;
	    }
    	
	    if (Sys.Browser.agent == Sys.Browser.Firefox || Sys.Browser.agent == Sys.Browser.Opera)
	    {
	        
		    // keypress sneaks in here, prevent it;
		    if (e.charCode == 8)
		    {
			    e.preventDefault();
			    e.stopPropagation();
			    return false;
		    }
		    
		    if (!e.rawEvent.which)
		    {
			    this._OnActivity (e);
    			
			    e.stopPropagation();
			    return true;
		    }
	    }
    	
	    var selectionEnd = this._textBoxElement.selectionEnd;
	    if (e.charCode == 13) // Enter - raise the ValueChanged event.
	    {
	        if (this._ValueHasChanged())
	        {    
	            this.raise_valueChanged();     
    	        	
                this.updateDisplayValue();
    	        this.updateCssClass();
    	       
	            if (this.get_autoPostBack())
                {
                    this.raisePostBackEvent();
                }              
	          
	        }
	          
	        return true;
	    }	
    	
	    var ch = String.fromCharCode(e.charCode);
	    if (currentChunk.CanHandle(ch))
	    {
		    while (selectionEnd < this._textBoxElement.value.length)
		    {
			    if (this._partIndex[selectionEnd].SetValue(ch, selectionEnd))
			    {
				    selectionEnd ++;
				    break;
			    }
			    selectionEnd ++;
		    }
	    }
    	
	    var result = this._UpdateAfterKeyHandled (e, selectionEnd)
	    if (!result)
	    {
//	        //should bubble if in test suite
//	        if(!document.isAutomationDesignCanvas)
		        e.preventDefault();
	    }
	    
//	    //should bubble if in test suite
//    	if(!document.isAutomationDesignCanvas)
	        e.stopPropagation();	
	        
	    return result;
    },
////////////////////////////////////////////
//End Handlers//////////////////////////////
////////////////////////////////////////////   

////////////////////////////////////////////
//Raise Events//////////////////////////////
////////////////////////////////////////////    
    _OnEnumChanged : function (chunk, oldValue, newValue)
    {
        var eventArgs = new Telerik.Web.UI.MaskedTextBoxEventArgs(newValue, oldValue, chunk);
        this.raise_enumerationChanged(eventArgs);
    },

    _OnMoveUp : function (chunk, oldValue, newValue)
    {
        var eventArgs = new Telerik.Web.UI.MaskedTextBoxEventArgs(newValue, oldValue, chunk);
        this.raise_moveUp(eventArgs);
    },

    _OnMoveDown : function (chunk, oldValue, newValue)
    {
        var eventArgs = new Telerik.Web.UI.MaskedTextBoxEventArgs(newValue, oldValue, chunk);
        this.raise_moveDown(eventArgs);
    },

    _OnValueChange : function (chunk, oldValue, newValue)
    {
        var eventArgs = new Telerik.Web.UI.MaskedTextBoxEventArgs(newValue, oldValue, chunk);
        this.raiseEvent("valueChanged", eventArgs);
    },

    _OnChunkError : function (chunk, oldValue, newValue)
    {
        
        var eventArgs = new Telerik.Web.UI.MaskedTextBoxEventArgs(newValue, oldValue, chunk);
    	this.raise_error(eventArgs);
    },
    
////////////////////////////////////////////
//end Raise Events//////////////////////////
//////////////////////////////////////////// 

    _fixAbsolutePositioning : function ()
    {
	    var f = this._textBoxElement;
	    if (
	    f.previousSibling && 
	    f.previousSibling.tagName.toLowerCase() == "label" &&
	    f.style.position == "absolute")
	    {
		    f.style.position = "static";
		    var parent = f.parentNode;
		    parent.style.position = "absolute";
		    parent.style.top = f.style.top;
		    parent.style.left = f.style.left;
	    }
    },

    _RecordInitialState : function ()
    {
	    this.initialFieldValue = this._textBoxElement.value;
    },
    
    _PartAt : function(index)
    {
	    return this._partIndex[index];
    },    

    _CreatePartCollection : function (parts, promptChar)
    {
	    var chunk;
	    var collection = [];
	    var length = 0;
	    for (var j = 0; j < parts.length; j ++)
	    {
		    chunk = parts[j];
		    chunk.PromptChar = promptChar;
		    chunk.SetController(this);
		    chunk.index = this._parts.length;
		    collection[collection.length] = chunk;
    		
    		
		    // link the parts
		    if (collection.length > 1)
		    {
			    collection[collection.length - 2].NextChunk = chunk;
		    }
    		
		    chunk.NextChunk = null;
    		
		    var chunkLength = chunk.GetLength();

    		
		    chunk.offset = length;
		    length += chunkLength;
	    }
    	
	    return collection;
    },

    _setMask : function (maskParts)
    {
	    this._parts = this._CreatePartCollection(maskParts, this.get_promptChar());
    	
	    for (var i = 0; i < this._parts.length; i ++)
	    {
		    var chunkLength = this._parts[i].GetLength();
		    for (var j = this._length; j < this._length + chunkLength; j ++)
		    {
			    this._partIndex[j] = this._parts[i];
		    }			
    		
		    this._length += chunkLength;
	    }
    },

    _setDisplayMask : function (maskParts)
    {
	    this._displayParts = this._CreatePartCollection(maskParts, this.get_displayPromptChar());
    	
	    for (var i = 0; i < this._displayParts.length; i ++)
	    {
		    var part = this._displayParts[i];
		    var chunkLength = part.GetLength();
		    if (part.ch) // skip literal
		    {
			    continue;
		    }
		    for (var j = this._displayLength; j < this._displayLength + chunkLength; j ++)
		    {
			    this._displayPartIndex[j] = this._displayParts[i];
		    }			
    		
		    this._displayLength += chunkLength;
	    }	
    },

    _SafariSelectionFix : function (e)
    {
	    var selectionInfo = this._StrCompare(this._lastState.fieldValue, e.fieldValue)
    	
	    e._selectionStart = selectionInfo[0];
	    e._selectionEnd = selectionInfo[0];
	    this._lastState._selectionStart = selectionInfo[1];
	    this._lastState._selectionEnd = selectionInfo[2];	    
    },

    _HandleValueChange : function (e)
    {
	    if (this.get_readOnly())
	    {
		    this._Visualise();
		    return false;
	    }

	    if (this._lastState == null) return;
	    var i, j;	
    	
	    if ($telerik.isSafari3)//Sys.Browser.agent == Sys.Browser.Safari)
	    {
		    this._SafariSelectionFix(e);
	    }

	    // handle deleted chars
	    if (this._lastState.fieldValue.length > e.fieldValue.length)
	    {
		    // end of the mask
		    if (e._selectionStart == this._textBoxElement.value.length)
		    {
			    this._partIndex[this._partIndex.length - 1].SetValue("", this._partIndex.length - 1);
		    }	
    					
		    // backspace
		    if (this._lastState._selectionEnd > e._selectionStart)
		    {
			    i = this._lastState._selectionEnd;
			    while (i -- > e._selectionStart)
			    {
				    this._partIndex[i].SetValue("", i);
				    // e._selectionEnd --;
			    }
		    }
    		
		    // delete
		    else
		    {

			    i = this._lastState._selectionEnd + 1;
			    while (i -- > e._selectionStart)
			    {
				    this._partIndex[i].SetValue("", i);
				    e._selectionEnd ++;
			    }
		    }
		    /**/
	    }
    	
	    var updatedPartStart = this._lastState._selectionStart;
	    var updatedPartEnd = Math.min(e._selectionStart, this._length);
    	
	    var updatedPart = e.fieldValue.substr(updatedPartStart, updatedPartEnd - updatedPartStart);
	    var selectionOffset = this._UpdatePartsInRange(updatedPart, updatedPartStart, updatedPartEnd);
	    e._selectionEnd += selectionOffset;
	    this._FixSelection(e);	
    },

    _SetPartValues : function (partIndex, maxLength, value, from, to)
    {
	    var currentChar;
	    var i = 0;
	    var j = from;
	    var consumedTextLength = 0;
	    value = value.toString();
	    while (i < to - from && j < maxLength)
	    {
		    currentChar = value.charAt(i);
		    if (currentChar == this.get_promptChar())
		    {
			    currentChar = "";
		    }
    		
		    if (partIndex[j].SetValue(currentChar, j))
		    {
			    i ++;
		    }
		    else
		    {
			    consumedTextLength ++;
		    }

		    j ++;
	    }	
    	
	    return consumedTextLength;
    },

    _UpdateDisplayPartsInRange : function (value, from, to)
    {
	    this._SetPartValues(this._displayPartIndex, this._displayLength, value, from, to);
    },

    _UpdatePartsInRange : function (value, from, to)
    {
	    var selectionOffset = this._SetPartValues(this._partIndex, this._length, value, from, to);
	    this._Visualise();
	    return selectionOffset;
    },

    _FixSelection : function (eventData)
    {
	    this.set_cursorPosition(eventData._selectionEnd);
    },
    
    _GetVisibleValues : function (parts)
    {
	    var result = [];
	    for (var i = 0; i < parts.length; i++)
	    {		
		    result[i] = parts[i].GetVisValue();
	    }
	    return result.join('');
    },
    
    _Visualise : function ()
    {	
	    var fieldValue = this.get_valueWithPromptAndLiterals();
	    var value = this.get_value();

	    this._internalValueUpdate = true;
    	
	    this._Render(fieldValue);
        this.updateCssClass();
        
	    this._value = value;
	    this.updateHiddenValue();
	    this._internalValueUpdate = false;	
    	
	    this._projectedValue = this._textBoxElement.value;
    },

    _Render : function (inputValue)
    {
        this._isEmptyMessage = false;
	    if (!this._focused)
	    {
		    if (this.get_hideOnBlur() && this.isEmpty())
		    {
		        this._isEmptyMessage = true;
			    this.set_textBoxValue(this.get_emptyMessage());
		    }
		    else if (this._displayParts && this._displayParts.length)
		    {
			    this.set_textBoxValue(this.get_displayValue());
		    }
		    else
		    {
			     this.set_textBoxValue(inputValue);
		    }
	    }
	    else
	    {
		    this.set_textBoxValue(inputValue);
	    }
    },
    
    _getResetValue : function()
    {
        var value = "";
        var part = this._parts[0];
        while(part.NextChunk)
        {        
            if(part.GetVisValue() == part.GetValue())
            {
                value += part.PromptChar;
            }
            else
            {
                value += part.GetVisValue();
            }        
            part = part.NextChunk;
        }
        
        return value;
    },

    _ValueHasChanged : function ()
    {
	    return this._textBoxElement.value != this._textBoxElement._oldValue;
    },

    // ie specific, in order to fix the first skip of onpropertychange	
    _FakeOnPropertyChange : function()
    {
	    if (document.createEventObject)
	    {
		    if (event)
		    {
			    var ev = document.createEventObject(event);
		    }
		    else
		    {
			    var ev = document.createEventObject();
		    }
		    ev.propertyName = "value";
		    this._textBoxElement.fireEvent("onpropertychange", ev);
	    }
    },

    _UpdateAfterKeyHandled : function (e, selectionEnd)
    {    	
	    this._Visualise();
	    var eventData = new Telerik.Web.UI.MaskedEventWrap(e, this._textBoxElement);
	    eventData._selectionEnd = selectionEnd;
	    this._FixSelection(eventData);
	    return false;
    },

    _ValueHandler : function (e)
    {
	    if (this._internalValueUpdate)
	    {
		    return true;
	    }
	    if (!e) e = window.event;
    	
	    this._calculateSelection();

	    var evWrap = new Telerik.Web.UI.MaskedEventWrap(e, this._textBoxElement);
    	
	    if (evWrap.fieldValue != this._projectedValue)
	    {
		    this._HandleValueChange(evWrap);
	    }
    	
	    return true;
    },

    _ActivityHandler : function (e)
    {
	    if (this._internalValueUpdate)
	    {
		    return true;
	    }	
	    if (!e) e = window.event;
	    this._OnActivity (e);
    	
	    return true;
    },

    _calculateSelection : function ()
    {
	    if (document.selection && Sys.Browser.agent != Sys.Browser.Opera)
	    {
		    var s1;
		    try
		    {
			    s1 = document.selection.createRange();
		    }catch(error)
		    {
			    //Inside frame
			    return;	
		    }
            if (s1.parentElement() != this._textBoxElement) return;
            var s = s1.duplicate();
            if (this._isTextarea)
            {
			    s.moveToElementText(this._textBoxElement);
            }
            else
            {
			    s.move('character', - this._textBoxElement.value.length);
            }
            
            s.setEndPoint('EndToStart', s1);
            this._textBoxElement.selectionStart = s.text.length;
            this._textBoxElement.selectionEnd = this._textBoxElement.selectionStart + s1.text.length;
            if (this._isTextarea)
            {
            }
            
	    }	    
    },

    // safari specific
    _StrCompare : function (str1, str2)
    {
        var i;
        var selEnd, oldSelStart, oldSelEnd;
        i = 0;
        while (str1.charAt(i) == str2.charAt(i) && i < str1.length)
        {
            i ++;
        }
        oldSelStart = i;
        
        // reverse the strings, so that we may find the other endpoint;
        str1 = str1.substr(oldSelStart).split('').reverse().join('');
        str2 = str2.substr(oldSelStart).split('').reverse().join('');
        i = 0;
        while(str1.charAt(i) == str2.charAt(i) && i < str1.length)
        {
            i ++;
        }
        selEnd = oldSelStart + str2.length - i;
        
        oldSelEnd = str1.length - i + oldSelStart;
        return [selEnd, oldSelStart, oldSelEnd];
    },
    
    get__initialMasks : function()
    {
        return this._initialMasks;
    },
    
    set__initialMasks : function(value)
    {
        this._initialMasks = value;
    },
    
    get__initialDisplayMasks : function()
    {
        return this._initialDisplayMasks;
    },
    
    set__initialDisplayMasks : function(value)
    {
        this._initialDisplayMasks = value;
    },
    
    raise_valueChanged : function()
    {            

	        this._triggerDomEvent("change", this._getValidationField());
	        
	        //the old value should be made identical to the new value before the event is raised,
	        //since if the user has an event handler with an alert, the alert will get the input
	        //to lose focus, which will trigger the onblur event - the latter, for its part will
	        //raise again the ValueChanged event if the old and the new values are different.
	        
	        var tempOldValue = this._textBoxElement._oldValue;
	        
	        this._textBoxElement._oldValue = this._textBoxElement.value;
	        
		    this._OnValueChange(null, tempOldValue, this._textBoxElement.value);
	      
    }                   
};

//$telerik.makeCompatible(Telerik.Web.UI.RadMaskedTextBox);
Telerik.Web.UI.RadMaskedTextBox.registerClass("Telerik.Web.UI.RadMaskedTextBox", Telerik.Web.UI.RadInputControl);

/* END Telerik.Web.UI.Input.MaskedTextBox.RadMaskedTextBox.js */
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
(function() {var fn = function() {if(!$get('ctl00_ContentPlaceHolder1_ScriptManager_HiddenField')) return; $get('ctl00_ContentPlaceHolder1_ScriptManager_HiddenField').value += ';;System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35:en-US:0d787d5c-3903-4814-ad72-296cea810318:ea597d4b;Telerik.Web.UI, Version=2009.1.527.0, Culture=neutral, PublicKeyToken=29ac1a93ec063d92:en-US:20d6e79e-1cac-4f77-9569-104b4711830e:16e4e7cd:20a229d8:631b49c3:849755a8:a99715a8:f7645509:24ee1bba:c0337341:9aefb8d3:ffec1235:7bc691ca:36dbc598:92f4b95:302f82f:ff8c347e:2603bfe0:c12c82d6:a4b331bc:6b9569e0:d429b039:caa65755:e61bb925:91182c34:a8149c24:eac8f7ee:a88e443e:45618705:b8445069';Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();
