summaryrefslogtreecommitdiff
path: root/objectapp/static/objectapp/js/Gnowmacs/test/dl/js/thelib.js
diff options
context:
space:
mode:
Diffstat (limited to 'objectapp/static/objectapp/js/Gnowmacs/test/dl/js/thelib.js')
-rw-r--r--objectapp/static/objectapp/js/Gnowmacs/test/dl/js/thelib.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/objectapp/static/objectapp/js/Gnowmacs/test/dl/js/thelib.js b/objectapp/static/objectapp/js/Gnowmacs/test/dl/js/thelib.js
new file mode 100644
index 0000000..0706154
--- /dev/null
+++ b/objectapp/static/objectapp/js/Gnowmacs/test/dl/js/thelib.js
@@ -0,0 +1,12 @@
+
+/*
+ * DynarchLIB version: 2.0
+ * ____ _____
+ * A lightweight JavaScript toolkit for professionals. \ /_ / /
+ * \ / / /
+ * Copyright (c) Dynarch.com 2005-2010. All rights reserved. \/ /_ /
+ * See http://www.dynarchlib.com/licensing for licensing details. \ / /
+ * / /
+ * this package built at 2010/11/06 15:11 GMT \/
+ */
+DlTEXTS={goToday:"Go Today",_date_monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],_date_shortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_date_dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],_date_shortDayNames:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],_date_firstDayOfWeek:1};try{document.execCommand("BackgroundImageCache",false,true)}catch(a){}var CE_CACHE={HTML_ESCAPE_DIV:document.createElement("div"),HTML_ESCAPE_TEXT:document.createTextNode(""),CONTAINER:document.createElement("div")};CE_CACHE.HTML_ESCAPE_DIV.appendChild(CE_CACHE.HTML_ESCAPE_TEXT),Array.$=function(a,b){b==null&&(b=0);var c,d,e;try{c=Array.prototype.slice.call(a,b)}catch(f){for(c=new Array(a.length-b),d=b,e=0;d<a.length;++d,++e)c[e]=a[d]}return c},Object.merge=function(a,b){a==null&&(a={});if(b)for(var c in b)a[c]=b[c];return a},Object.merge(Object,{mergeDefined:function(a,b){for(var c in b)typeof b[c]!="undefined"&&(a[c]=b[c]);return a},mergeUndefined:function(a,b){for(var c in b)c in a||(a[c]=b[c]);return a},remove:function(a,b){for(var c=b.length;--c>=0;)delete a[b[c]]},isEmpty:function(a){for(var b in a)return false;return true},makeCopy:function(a){var b,c={};for(b in a)c[b]=a[b];return c},makeDeepCopy:function(a){if(a instanceof Array){var b=[],c=a.length;while(--c>=0)b[c]=Object.makeDeepCopy(a[c]);return b}if(a===null)return null;if(a instanceof Date)return new Date(a);if(a instanceof Object){var c,d={};for(c in a)d[c]=Object.makeDeepCopy(a[c]);return d}return a},makeShortcuts:function(a,b){for(var c in b)a[c]=a[b[c]]},foreach:function(a,b,c){for(var d in a)try{b.call(c,a[d],d)}catch(a){if(a===$_BREAK)break;if(a===$_CONTINUE)continue;if(a instanceof $_RETURN)return a.args;throw a}},map:function(a,b,c){var d=[];for(var e in a)if(a.hasOwnProperty(e))try{d.push(b.call(c,a[e],e))}catch(a){if(a===$_BREAK)break;if(a===$_CONTINUE)continue;if(a instanceof $_RETURN)return a.args;throw a}return d},curry2:function(a){a instanceof Function||(a=this[a]);return a.$A(this,Array.$(arguments,1))},HOP:function(a,b){return Object.prototype.hasOwnProperty.call(a,b)}}),Object.merge(Function,{INHERITANCE:{},getInheritanceGraph:function(){return Function.INHERITANCE},noop:function(){},identity:function(a){return a},returnTrue:function(){return true},returnFalse:function(){return false},invoke:function(a){return a()}});var $__JSOOP=new Function.noop;Object.merge(Function.prototype,{$:Function.prototype.closure=function(a){var b=Array.$(arguments,1),c=this;return a==window.undefined?function(){return c.apply(this,b.concat(Array.$(arguments)))}:function(){return c.apply(a,b.concat(Array.$(arguments)))}},$0:function(a){var b=this,c=Array.$(arguments,1);return function(){return b.apply(a,c)}},inherits:function(a,b){var c=this.prototype=new a($__JSOOP);c.constructor=this,this.BASE=a.prototype,Function.INHERITANCE[this.name=this._objectType=c._objectType=b||Dynarch.getFunctionName(this)]=Dynarch.getFunctionName(a);return this.BASE},setDefaults:function(a,b,c){return Dynarch.setDefaults.call(a,this.DEFAULT_ARGS,b,c)},$$:function(a){return this.$.apply(this,a)},$A:function(a,b){return this.$.apply(this,[a].concat(b))},$C:function(){var a=Array.$(arguments),b=this;return function(){return b.apply(null,a.concat(Array.$(arguments)))}},inverse:function(){var a=this;return function(){return!a.apply(this,arguments)}},clearingTimeout:function(a,b){var c=null,d=this,e=Array.$(arguments,2),f=function(){c&&clearTimeout(c),c=setTimeout(d.$A(b==null?this:b,e.concat(Array.$(arguments))),a)};f.cancel=function(){clearTimeout(c)},f.doItNow=function(){clearTimeout(c),d.apply(b,e.concat(Array.$(arguments)))};return f},rarify:function(a,b){var c=this.$$(Array.$(arguments,2)),d=this.clearingTimeout.apply(this,Array.$(arguments,1)),e=a,f=null,g=function(){e=a};return function(){f&&clearTimeout(f),f=setTimeout(g,b);if(e-->0)return c.apply(this,arguments);return d.apply(this,arguments)}},delayed:function(a){var b=arguments.length>1?this.$$(Array.$(arguments,1)):this;return setTimeout(b,a)},setInterval:function(a){var b=arguments.length>1?this.$$(Array.$(arguments,1)):this;setTimeout(b,0);return setInterval(b,a)},inject:function(a){a==null&&(a=this.OBJECT_EXTENSIONS),Object.merge(this.prototype,a);return this},memoize:function(){var a=this,b=$__JSOOP;return function(){b===$__JSOOP&&(b=a.apply(this,arguments));return b}}}),Object.merge(Array,{hashKeys:function(a){var b=[],c=0,d;for(d in a)a.hasOwnProperty(d)&&(b[c++]=d);return b},hashValues:function(a){var b=[],c=0,d;for(d in a)a.hasOwnProperty(d)&&(b[c++]=a[d]);return b}});function $_YIELD(a){this.timeout=a||0}var $_BREAK={},$_CONTINUE={};function $_RETURN(a){this.args=a}function $YIELD(a){throw new $_YIELD(a)}function $BREAK(){throw $_BREAK}function $CONTINUE(){throw $_CONTINUE}function $RETURN(a){throw new $_RETURN(a)}Array.inject({map_hash:function(a,b,c){c||(c={}),this.foreach(a instanceof Function?function(d){c[d]=a.call(b,d)}:function(b){c[b]=a[b]});return c},accumulate:function(a,b){arguments.length<2&&(b=0);for(var c=0;c<this.length;++c)b=a(this[c],b,c);return b},foreach:function(a,b){b==null&&(b=this);var c=0,d=this.length;while(d-->0)try{a.call(b,this[c],c++)}catch(a){if(a===$_BREAK)break;if(a===$_CONTINUE)continue;if(a instanceof $_RETURN)return a.args;throw a}},r_foreach:function(a,b){b==null&&(b=this);for(var c=this.length;--c>=0;)try{a.call(b,this[c],c)}catch(a){if(a===$_BREAK)break;if(a===$_CONTINUE)continue;if(a instanceof $_RETURN)return a.args;throw a}},assign_each:function(a,b){return this.foreach(function(c,d){this[d]=a.call(b,d,c)})},r_assign_each:function(a,b){return this.r_foreach(function(c,d){this[d]=a.call(b,d,c)})},toHash:function(a,b){var c={};a instanceof Function?this.foreach(function(d,e){c[d]=a.call(b,d,e)}):this.foreach(function(b,d){c[b]=a!=null?a:d+1});return c},toHash2:function(){var a={},b=0;while(b<this.length)a[this[b++]]=this[b++];return a},toHash3:function(a,b){var c={};a instanceof Function?this.foreach(function(d,e){var f=a.call(b!=null?b:d,d,e);c[f[0]]=f[1]}):this.foreach(function(b){c[b[a]]=b});return c},map:function(a,b){var c=0,d=this.length,e=[],f,g;if(a instanceof Function){b==null&&(b=this);while(d-->0)try{e.push(a.call(b,this[c],c++))}catch(a){if(a===$_BREAK)break;if(a===$_CONTINUE)continue;if(a instanceof $_RETURN){e.push(a.args);break}throw a}}else{f=Array.$(arguments,1);while(d-->0)b=this[c],e[c++]=(g=b[a])instanceof Function?g.apply(b,f):g}return e},r_map:function(a,b){var c=this.length,d=[],e;if(a instanceof Function){b==null&&(b=this);while(--c>=0)try{d.push(a.call(b,this[c],c))}catch(a){if(a===$_BREAK)break;if(a===$_CONTINUE)continue;if(a instanceof $_RETURN){d.push(a.args);break}throw a}}else{var f=Array.$(arguments,1);while(--c>=0)b=this[c],d[c]=(e=b[a])instanceof Function?e.apply(b,f):e}return d.reverse()},keys_map:function(a){return this.map(function(b){return a[b]})},grep:function(a,b){var c=0,d=this.length,e=[],f,g,h;if(a instanceof RegExp)while(d-->0)f=this[c++],a.test(f)&&e.push(f);else if(a instanceof Function){b==null&&(b=this);while(d-->0)f=this[c],a.call(b,f,c++)&&e.push(f)}else{g=Array.$(arguments,1);while(d-->0)b=this[c++],(h=b[a])instanceof Function?h.apply(b,g)&&e.push(b):h&&e.push(b)}return e},grep_last:function(a,b){b==null&&(b=this.length-1);while(b>=0){var c=this[b--];if(a(c))return c}return null},grep_first:function(a,b){for(b=b||0;b<this.length;++b){var c=this[b];if(a(c))return c}return null},contains:function(a){for(var b=this.length;--b>=0;)if(this[b]===a)return true;return false},any:function(a,b){if(a instanceof Function){b==null&&(b=this);for(var c=this.length;--c>=0;)if(a.call(b,this[c],c))return true}else for(var d=Array.$(arguments,1),e,c=this.length;--c>=0;){b=this[c];if((e=b[a])instanceof Function){if(e.apply(b,d))return true}else if(e)return true}return false},find:function(a){for(var b=this.length;--b>=0;)if(this[b]===a)return b;return-1},remove:function(a){for(var b=this.length;--b>=0;)this[b]===a&&this.splice(b,1);return this},pushUnique:function(a){if(this.find(a)<0){this.push(a);return this.length}return null},peek:function(a){if(this.length>0)return this[this.length-1-(a!=null?Math.abs(a):0)]},min:function(a,b){if(this.length==0)return null;if(arguments.length>0){for(var c=a!=null?a.call(b,this[0],0):this[0],d=1;d<this.length;++d)c=Math.min(c,a!=null?a.call(b,this[d],d):this[d]);return c}return Math.min.apply(Math,this)},minElement:function(a,b,c){if(this.length==0)return null;var d=0,e=this[0],f=a.call(b,e),g=0,h;while(++d<this.length)(h=a.call(b,this[d]))<f&&(f=h,g=d,e=this[d]);c&&this.splice(g,1);return e},max:function(a,b){if(this.length==0)return null;if(arguments.length>0){for(var c=a!=null?a.call(b,this[0],0):this[0],d=1;d<this.length;++d)c=Math.max(c,a!=null?a.call(b,this[d],d):this[d]);return c}return Math.max.apply(Math,this)},maxElement:function(a,b,c){if(this.length==0)return null;var d=0,e=this[0],f=a.call(b,e),g=0,h;while(++d<this.length)(h=a.call(b,this[d]))>f&&(f=h,g=d,e=this[d]);c&&this.splice(g,1);return e},rotateIndex:function(a){return Math.rotateLimit(a,0,this.length-1)},limitIndex:function(a){return Math.limit(a,0,this.length-1)},nullLimitIndex:function(a){return Math.nullLimit(a,0,this.length-1)},bytesToString:function(){var a="",b=0,c;while(b<this.length)c=this[b++],c&240^240?c&224^224?c&192^192||(c=(c&31)<<6|this[b++]&63):c=(c&15)<<12|(this[b++]&63)<<6|this[b++]&63:c=(c&3)<<18|(this[b++]&63)<<12|(this[b++]&63)<<6|this[b++]&63,a+=String.fromCharCode(c);return a},repeat:function(a){if(a==0)return[];if(a==1)return this;var b=this.repeat(a>>1);b=b.concat(b),a&1&&(b=b.concat(this));return b},common_prefix:function(){switch(this.length){case 0:return"";case 1:return this[0];case 2:var a=this[0],b=this[1],c=Math.min(a.length,b.length),d=0;while(d<c&&a.charAt(d)===b.charAt(d))++d;return a.substring(0,d);default:return[this[0],this.slice(1).common_prefix()].common_prefix()}},append:function(a){this.push.apply(this,a)},prepend:function(a){this.unshift.apply(this,a)},toXML:function(){var a=this[0];if(a=="~literal")return this.slice(1).flatJoin();var b="<"+a,c=1,d=this[1];typeof d=="object"&&(Object.foreach(d,function(a,c){c.charAt(0)=="$"&&(c=c.substr(1)),b+=" "+c.htmlEscape()+"=\"",typeof a=="object"?b+=Object.map(a,function(a,b){b=b.replace(/([a-z]?)([A-Z])/g,function(a,b,c){return b+"-"+c.toLowerCase()});return b.htmlEscape()+": "+a.htmlEscape()}).join("; "):b+=a.htmlEscape(),b+="\""}),++c),b+=">";while(c<this.length)(d=this[c++])instanceof Array?b+=d.toXML():b+=String(d).htmlEscape();return b+"</"+a+">"}}),Number.inject({map:function(a,b){return a+(b-a)*this},reduce:function(a,b){return(this-a)/(b-a)},mapInt:function(a,b){return Math.round(this.map(a,b))},reduceInt:function(a,b){return Math.round((this-a)/(b-a))},bits1Array:function(){var a=this,b=[],c=1,d=0;while(a>0)a&1&&(b[d++]=c),c=c<<1,a=a>>1;return b},times:function(a,b){var c=this,d=0;while(--c>=0)a.call(b,d++,c)},hex:function(a){var b=this.toString(16).toUpperCase();if(a)while(b.length<a)b="0"+b;return b},zeroPad:function(a,b){var c=""+Math.round(this);b==null&&(b="0");while(c.length<a)c=b+c;return c},formatTime:function(){var a=this,b,c;c=a/60,a%=60,b=c/60,c%=60;return[b,c,a].map("zeroPad",2).join(":")},toDate:function(a,b,c,d){return Date.intToDate(this,a,b,c,d)},limit:function(a,b){return Math.limit(this,a,b)},rotateLimit:function(a,b){return Math.rotateLimit(this,a,b)},nullLimit:function(a,b){return Math.nullLimit(this,a,b)},i18n:function(a){var b=this;arguments.length>1?a=Array.$(arguments):a=a.trim().split(/\s*\|\s*/),a=b<a.length?a[b]:a[a.length-1];return a.replace(/##?/g,function(a){return a.length==2?"#":b})}}),Object.merge(Math,{nullLimit:function(a,b,c){a<b&&(a=null),a>c&&(a=null);return a},limit:function(a,b,c){a<b&&(a=b),a>c&&(a=c);return a+0},rotateLimit:function(a,b,c){c++,a=a%(c-b),a<0?a=c+a:a<b&&(a=b-a);return a+0}}),Object.merge(Date,{_MD:[31,28,31,30,31,30,31,31,30,31,30,31],SECOND:1e3,MINUTE:6e4,HOUR:36e5,DAY:864e5,WEEK:6048e5,_MN:DlTEXTS._date_monthNames,_SMN:DlTEXTS._date_shortMonthNames,_DN:DlTEXTS._date_dayNames,_SDN:DlTEXTS._date_shortDayNames,_FDOW:DlTEXTS._date_firstDayOfWeek,isWeekend:function(a){return a==0||a==6},parseMySQL:function(a,b){var c=a.split(/\s+/),d=c[0].split(/-/),e=c[1].split(/:/),f;f=new Date(d[0],d[1]-1,d[2],e[0]||null,e[1]||null,e[2]||null),b&&(f.setUTCMilliseconds(0),f.setUTCSeconds(e[2]||0),f.setUTCMinutes(e[1]||0),f.setUTCHours(e[0]||0),f.setUTCDate(1),f.setUTCMonth(d[1]-1),f.setUTCDate(d[2]),f.setUTCFullYear(d[0]));return f},dateToInt:function(a){if(a instanceof Date)return 1e4*a.getFullYear()+100*(a.getMonth()+1)+a.getDate();if(typeof a=="string")return parseInt(a,10);return a},intToDate:function(a,b,c,d,e){if(!(a instanceof Date)){a=parseInt(a,10);var f=Math.floor(a/1e4);a=a%1e4;var g=Math.floor(a/100);a=a%100,a=new Date(f,g-1,a,b||12,c||0,d||0,e||0)}return a},getMonthName:function(a,b){var c=b?Date._SMN:Date._MN;return c[a%12]},getFirstDayOfWeek:function(){return Date._FDOW},getDayName:function(a,b){var c=b?Date._SDN:Date._DN;return c[a%7]}}),Date.now||(Date.now=function(){return(new Date).getTime()}),Date.inject({toInt:function(){return Date.dateToInt(this)},getMonthDays:function(a){var b=this.getFullYear();a==null&&(a=this.getMonth());return 0==b%4&&(0!=b%100||0==b%400)&&a==1?29:Date._MD[a]},getDayOfYear:function(){var a=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),b=new Date(this.getFullYear(),0,0,0,0,0),c=a-b;return Math.floor(c/Date.DAY)},getWeekNumber:function(){var a=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),b=a.getDay();a.setDate(a.getDate()-(b+6)%7+3);var c=a.valueOf();a.setMonth(0),a.setDate(4);return Math.round((c-a.valueOf())/6048e5)+1},dateEqualsTo:function(a,b){return this.getFullYear()==a.getFullYear()&&this.getMonth()==a.getMonth()&&(b||this.getDate()==a.getDate())},print:function(a){var b=this.getMonth(),c=this.getDate(),d=this.getFullYear(),e=this.getWeekNumber(),f=this.getDay(),g={},h=this.getHours(),i=h>=12,j=i?h-12:h,k=this.getDayOfYear();j==0&&(j=12);var l=this.getMinutes(),m=this.getSeconds();g["%a"]=Date.getDayName(f,true),g["%A"]=Date.getDayName(f),g["%b"]=Date.getMonthName(b,true),g["%B"]=Date.getMonthName(b),g["%C"]=1+Math.floor(d/100),g["%d"]=c<10?"0"+c:c,g["%e"]=c,g["%H"]=h<10?"0"+h:h,g["%I"]=j<10?"0"+j:j,g["%j"]=k<100?k<10?"00"+k:"0"+k:k,g["%k"]=h,g["%l"]=j,g["%m"]=b<9?"0"+(1+b):1+b,g["%M"]=l<10?"0"+l:l,g["%n"]="\n",g["%p"]=i?"PM":"AM",g["%P"]=i?"pm":"am",g["%s"]=Math.floor(this.getTime()/1e3),g["%S"]=m<10?"0"+m:m,g["%t"]="\t",g["%U"]=g["%W"]=g["%V"]=e<10?"0"+e:e,g["%u"]=f+1,g["%w"]=f,g["%y"]=(""+d).substr(2,2),g["%Y"]=d,g["%%"]="%";var n=/%./g;return a.replace(n,function(a){return g[a]||a})}}),String.inject({breakable:function(a){a||(a=/([_.-])/g);return this.replace(a,"$1<span class='BreakPoint'> </span>")},printf:function(){var a=Array.$(arguments),b=0;return this.replace(/%[sdfo%]/g,function(c){c=c.charAt(1);var d=a[b++];switch(c){case"s":return d.toString();case"d":return parseInt(d);case"f":return parseFloat(d).toFixed(3);case"o":return d;case"%":return"%"}return"undefined"})},fixedWidth:function(a){return String.buffer("<div style='width:",a,"'>",this,"</div>").get()},noWrap:function(){return this.replace(/\x20/g,"&nbsp;")},lastIndexOfRegexp:function(a,b){var c,d=0;a.lastIndex=0,a.global=true;while(c=a.exec(this)){if(a.lastIndex>=b)break;d=a.lastIndex}return d},hashWords:function(a){return this.trim().split(/\s+/).toHash(arguments.length>0?a:true)},arrayWords:function(){return this.trim().split(/\s+/)},trim:function(a,b){var c=a?this:this.replace(/^\s+/,"");b||(c=c.replace(/\s+$/,""));return c},htmlEscapeFull:function(){return this.replace(/&/g,"&amp;").replace(/\x22/g,"&quot;").replace(/\x27/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00A0/g,"&#xa0;")},decodeJSON:function(a){return DlJSON.decode(this,a)},makeLabel:function(){return this.replace(/\s+/g,"&nbsp;")},capitalizeString:function(){return this.charAt(0).toUpperCase()+this.substr(1)},htmlEmbed:function(a,b){var c=["<",a];b!=null&&c.push(" class='",b,"'"),c.push(">",this,"</",a,">");return c.join("")},repeat:function(a){if(a==0)return"";if(a==1)return""+this;var b=this.repeat(a>>1);b+=b,a&1&&(b+=this);return b},hexToBytes:function(a){var b=[],c=0,d=this;a&&(d=d.replace(/[^0-9a-f]/ig,"")),d.length&1&&(d="0"+d);while(c<d.length)b.push(parseInt(d.substr(c,2),16)),c++,c++;return b},toBytes:function(){var a=this.length,b=0,c=0,d,e=[];while(--a>=0)d=this.charCodeAt(c++),d<128?e[b++]=d:d<2048?(e[b++]=192|d>>>6&31,e[b++]=128|d&63):d<65536?(e[b++]=224|d>>>12&15,e[b++]=128|d>>>6&63,e[b++]=128|d&63):d<1114112&&(e[b++]=240|d>>>18&3,e[b++]=128|d>>>12&63,e[b++]=128|d>>>6&63,e[b++]=128|d&63);return e}}),function(){var a=navigator.userAgent;is_opera=/opera/i.test(a),is_ie5=(is_ie=/msie/i.test(a)&&!is_opera&&!/mac_powerpc/i.test(a))&&/msie 5\.[^5]/i.test(a),is_ie6=is_ie&&/msie 6/i.test(a),is_ie7=is_ie&&/msie 7/i.test(a),is_ie8=is_ie&&/msie 8/i.test(a),ie_box_model=is_ie&&document.compatMode&&document.compatMode=="BackCompat",is_mac_ie=/msie.*mac/i.test(a),is_khtml=/Konqueror|Safari|KHTML/i.test(a),is_safari3=(is_safari=/Safari/i.test(a))&&/Version\/3/i.test(a),is_konqueror=is_khtml&&!is_safari3,is_gecko=/gecko/i.test(a)&&!is_khtml&&!is_opera&&!is_ie,is_chrome=/Chrome/i.test(a),is_w3=!is_ie,is_macintosh=/Macintosh/i.test(a),is_gecko&&/rv:\s*([0-9.]+)/.test(a)&&(gecko_version=parseFloat(RegExp.$1));var b=Array.prototype,c=Date.prototype,d=String.prototype,e=Number.prototype;function f(a,b){return b?a instanceof Function?function(b,c){return a(c,b)}:function(a,b){return b<a?-1:b>a?1:0}:a instanceof Function?a:function(a,b){return a<b?-1:a>b?1:0}}b.mergeSort=function(a,b){if(this.length<2)return Array.$(this);var c=f(a,b);function d(a,b){var d=[],e=0,f=0,g=0;while(e<a.length&&f<b.length)c(a[e],b[f])<=0?d[g++]=a[e++]:d[g++]=b[f++];e<a.length&&d.push.apply(d,a.slice(e)),f<b.length&&d.push.apply(d,b.slice(f));return d}function e(a){if(a.length<=1)return a;var b=Math.floor(a.length/2),c=a.slice(0,b),f=a.slice(b);c=e(c),f=e(f);return d(c,f)}return e(this)},b.qsort=function(a,b){if(!(this.length<2)){var c=f(a,b),d=this,e,g=false;function h(a,b){var f=a,i=b,j=false;if(f<i){do c(d[f],d[i])>0&&(e=d[f],d[f]=d[i],d[i]=e,j=!j,g=true),j?--i:++f;while(f<i);h(a,f-1),h(f+1,b)}}h(0,this.length-1);return g}},b.x=b.repeat,b.flatJoin=function(){return h(this)},b.flatten=function(){var a=[];g.call(a,this);return a};function g(a){a instanceof Array?a.foreach(g,this):a instanceof Function?(a=a())!=null&&a!=false&&g.call(this,a):this.push(a)}function h(a){if(a instanceof Array)return a.accumulate(function(a,b){return b+h(a)},"");if(a instanceof Function)return h(a());if(a===false||a==null)return"";return String(a)}var i=e.$1K=1024,j=e.$1M=i*1024,k=e.$1G=j*1024,l=e.$1T=k*1024;e.formatBytes=function(a){var b=this,c,d;b<i?c="B":b<j?(b/=i,c="K"):b<k?(b/=j,c="M"):b<l&&(b/=k,c="G"),d=Math.round(b);return a&&b!=d?b.toFixed(a)+c:d+c},d.qw=d.arrayWords,d.bold=d.htmlEmbed.$(window.undefined,"b"),d.x=d.repeat}(),Object.merge(String,{firstNonEmpty:function(){for(var a=0;a<arguments.length;++a){var b=arguments[a];if(/\S/.test(b))return b}},template:function(){var format=String.buffer.apply(this,arguments).get();return function(props){return format.replace(/(.?)\$(\{.*?\}|[a-zA-Z0-9_]+)/g,function(s,p1,p2){if(p1.charAt(0)=="\\")return s.substr(1);p2.charAt(0)=="{"&&(p2=p2.substr(1,p2.length-2)),eval("p2 = props."+p2);return p1+p2})}},buffer:is_ie||is_khtml?function(){var a=[],b=0,c=function(){for(var d=0;d<arguments.length;++d)a[b++]=arguments[d];return c};c.get=function(){a=[a.join("")],b=1;return a[0]},arguments.length>0&&c.apply(this,arguments);return c}:function(){var a="",b=function(){a=a.concat.apply(a,arguments);return b};arguments.length>0&&b.apply(this,arguments),b.get=function(){return a};return b}}),String.prototype.htmlEscape=is_gecko?function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00A0/g,"&#xa0;")}:function(){CE_CACHE.HTML_ESCAPE_TEXT.data=this;return CE_CACHE.HTML_ESCAPE_DIV.innerHTML},window.Dynarch={dblClickTimeout:400,setDefaults:function(a,b,c){b||(b={});var d,e,f;for(d in a)if(c||!(d in this))(f=a[d])instanceof Array?f[0]!=null?(e=f[0])in b?e=b[e]:e=f[1]:e=f[1]:e=f,this[d]=e},__IDS:{},ID:function(a){var b=Dynarch.__IDS;a==null&&(a="generic"),a in b||(b[a]=0);return"dynarch-"+a+"-"+ ++b[a]},getFunctionName:function(a){if(a.name!=null)return a.name;if(/function\s+(\$?[a-z0-9_]+)\(/i.test(a.toString()))return RegExp.$1;return"UNKNOWN_FUNCTION"},EXPORT:function(a,b){var c=String.buffer("var D=window.",a,"=",a,",P=",a,".prototype;");b&&c(DynarchDomUtils.importCommonVars());return c.get()},getBaseURL:function(){var a=window.Dynarch_Base_Url;if(!a){var b=document.getElementsByTagName("script"),c=0,d;while(d=b[c++])if(d.className=="DynarchLIB"){a=d.src;if(/^(.*)\x2fjs\x2f/.test(a)){Dynarch_Base_Url=a=RegExp.$1;break}}}return a},getFileURL:function(a){return Dynarch.getBaseURL()+"/"+a},firebugRunning:function(){return window.console&&window.console.firebug},evalClean:function(code){return Dynarch.firebugRunning()?(new Function("return ("+code+");"))():eval("("+code+")")}},window.DynarchDomUtils={ID:Dynarch.ID,related:function(a,b){var c,d;is_ie?(d=b.type)=="mouseover"?c=b.fromElement:d=="mouseout"&&(c=b.toElement):c=b.relatedTarget;if(is_gecko&&c)try{c.parentNode}catch(a){try{c=b.parentNode}catch(a){c=b.target}}try{for(;c;c=c.parentNode)if(c===a)return true}catch(a){return true}return false},getScrollbarSize:function(a){return{x:a.offsetWidth-a.clientWidth,y:a.offsetHeight-a.clientHeight}},addEvent:function(a,b,c){if(typeof b=="string")a.addEventListener?a.addEventListener(b,c,false):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c;else if(b instanceof Array)DynarchDomUtils.addEvents(a,b,c);else for(var d in b)DynarchDomUtils.addEvent(a,d,b[d])},addEvents:function(a,b,c){for(var d=b.length;--d>=0;)DynarchDomUtils.addEvent(a,b[d],c)},removeEvent:function(a,b,c){if(typeof b=="string")a.removeEventListener?a.removeEventListener(b,c,false):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]="";else if(b instanceof Array)DynarchDomUtils.removeEvents(a,b,c);else for(var d in b)DynarchDomUtils.removeEvent(a,d,b[d])},removeEvents:function(a,b,c){for(var d=b.length;--d>=0;)DynarchDomUtils.removeEvent(a,b[d],c)},condEvent:function(a){a=a?DynarchDomUtils.addEvent:DynarchDomUtils.removeEvent;return a.apply(DynarchDomUtils,Array.$(arguments,1))},condEvents:function(a){a=a?DynarchDomUtils.addEvents:DynarchDomUtils.removeEvents;return a.apply(DynarchDomUtils,Array.$(arguments,1))},stopEvent:function(a){is_ie?(a.cancelBubble=true,a.returnValue=false):(a.preventDefault(),a.stopPropagation());return false},addLoadHandler:function(a,b){is_ie?a.onreadystatechange=function(){if(a.readyState==4){try{a.onreadystatechange=null}catch(a){}b()}}:DynarchDomUtils.addEvent(a,"load",b)},callHandler:function(a,b){if(a[b]instanceof Function)return a[b].call(a);if(typeof a[b]=="string")return Dynarch.evalClean(a[b])},setStyleProperty:function(a,b,c){switch(b){case"float":b="styleFloat";break;default:b=b.toLowerCase().replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})}a.style[b]=c},setOpacity:function(a,b){if(b!=null){b==""&&b!=0?is_ie?a.style.filter="":a.style.opacity="":is_ie?a.style.filter="alpha(opacity="+Math.round(b*100)+")":a.style.opacity=b;return b}if(is_ie){if(/alpha\(opacity=([0-9.])+\)/.test(a.style.opacity))return parseFloat(RegExp.$1)}else return parseFloat(a.style.opacity)},getClosestParentByTagName:function(a,b){b=b.toLowerCase();while(a&&a.tagName&&a.tagName.toLowerCase()!=b)a=a.parentNode;return a},isInside:function(a,b){try{while(a){if(a===b)return true;a=a.parentNode}}catch(a){}return false},getWindowSize:function(){if(is_gecko)return document.documentElement.clientWidth?{x:document.documentElement.clientWidth,y:document.documentElement.clientHeight}:{x:window.innerWidth,y:window.innerHeight};if(is_opera)return{x:window.innerWidth,y:window.innerHeight};if(is_ie)return!document.compatMode||document.compatMode=="BackCompat"?{x:document.body.clientWidth,y:document.body.clientHeight}:{x:document.documentElement.clientWidth,y:document.documentElement.clientHeight};var a=document.createElement("div"),b=a.style;b.position="absolute",b.bottom=b.right="0px",document.body.appendChild(a),b={x:a.offsetLeft,y:a.offsetTop},document.body.removeChild(a);return b},getPos:function(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect();return{x:b.left-document.documentElement.clientLeft,y:b.top-document.documentElement.clientTop}}if(document.getBoxObjectFor){var b=a.ownerDocument.getBoxObjectFor(a),c={x:b.x,y:b.y};while(a.parentNode&&a.parentNode!==document.body)a=a.parentNode,c.x-=a.scrollLeft,c.y-=a.scrollTop;return c}if(/^body$/i.test(a.tagName))return{x:0,y:0};var d=0,e=0,f=/^div$/i.test(a.tagName),g,h;f&&a.scrollLeft&&(d=a.scrollLeft),f&&a.scrollTop&&(e=a.scrollTop),g={x:a.offsetLeft-d,y:a.offsetTop-e},a.offsetParent&&(h=DynarchDomUtils.getPos(a.offsetParent),g.x+=h.x,g.y+=h.y);return g},getBRPos:function(a){var b=DynarchDomUtils.getPos(a),c=DynarchDomUtils.getOuterSize(a);b.x+=c.x-1,b.y+=c.y-1;return b},setPos:function(a,b,c){typeof b=="number"&&(b+="px"),typeof c=="number"&&(c+="px"),b!=null&&(a.style.left=b),c!=null&&(a.style.top=c)},createElement:function(a,b,c,d,e){var f=CE_CACHE[a]||(CE_CACHE[a]=document.createElement(a)),g;f=f.cloneNode(false);if(b)for(g in b)is_ie?DynarchDomUtils.setStyleProperty(f,g,b[g]):f.style.setProperty(g,b[g],"");if(c)for(g in c)f[g]=c[g];d&&(typeof e=="number"&&(e=d.childNodes[e]),e||(e=null),d.insertBefore(f,e));return f},setUnselectable:function(a,b){b==null&&(b=true);if(is_ie){b=b?"on":"off";var c=Array.$(a.getElementsByTagName("*"));c.push(a),c.foreach(function(a){a.setAttribute("unselectable",b)})}else a.style.userSelect=a.style.WebkitUserSelect=a.style.MozUserSelect=b=b?"none":"normal"},addClass:function(a,b,c){DynarchDomUtils.delClass(a,c,b)},delClass:function(a,b,c){if(a){var d=a.className;b instanceof RegExp&&(d=d.replace(b," "),b=null);if(c||b){var e=d.split(/\s+/),f=e.length,g={};b&&(g[b]=1),c&&(g[c]=1);while(--f>=0)e[f]in g&&e.splice(f,1);c&&e.push(c),d=e.join(" ")}a.className=d}},condClass:function(a,b,c,d){DynarchDomUtils[b?"addClass":"delClass"](a,c,d)},hasClass:function(a,b){return a.className.split(" ").contains(b)},elementIsVisible:function(a){return!!a.offsetWidth&&a.style.visibility!="hidden"},ie_getBackgroundColor:function(a){var b=document.body.createTextRange();b.moveToElementText(a);return"#"+parseInt(b.queryCommandValue("BackColor")).hex(6)},getStyle:function(a,b){var c=null;window.getComputedStyle?c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b):a.currentStyle&&((b=b.replace(/-[a-z]/g,function(a){return a.charAt(1).toUpperCase()}))=="backgroundColor"?c=ie_getBackgroundColor(a):c=a.currentStyle[b]);return c},getStylePX:function(a,b){var c=parseInt(DynarchDomUtils.getStyle(a,b),10);isNaN(c)&&(c=0);return c},getBorder:function(a){return{x:a.offsetWidth-a.clientWidth,y:a.offsetHeight-a.clientHeight}},getPadding:function(a){var b,c,d=DynarchDomUtils.getStylePX;b=d(a,"padding-left")+d(a,"padding-right"),c=d(a,"padding-top")+d(a,"padding-bottom");return{x:b,y:c}},getPaddingAndBorder:function(a){var b=0,c=0,d=DynarchDomUtils.getStylePX;b+=d(a,"border-left-width"),b+=d(a,"border-right-width"),c+=d(a,"border-top-width"),c+=d(a,"border-bottom-width"),b+=d(a,"padding-left"),b+=d(a,"padding-right"),c+=d(a,"padding-top"),c+=d(a,"padding-bottom");return{x:b,y:c}},getSelectionRange:function(a){var b,c;if(is_ie){var d,e,f;d=document.selection.createRange(),(e=d.compareEndPoints("StartToEnd",d)==0)||d.collapse(true),f=d.getBookmark(),b=f.charCodeAt(2)-2,d=document.selection.createRange(),(e=d.compareEndPoints("StartToEnd",d)==0)||d.collapse(false),f=d.getBookmark(),c=f.charCodeAt(2)-2}else b=a.selectionStart,c=a.selectionEnd;return{start:b,end:c}},setSelectionRange:function(a,b,c){c==null&&(c=b);if(b>c){var d=b;b=c,c=d}typeof b=="object"&&(c=b.end,b=b.start);if(is_ie){var e=a.createTextRange();e.collapse(true),e.moveStart("character",b),e.moveEnd("character",c-b),e.select()}else a.setSelectionRange(b,c)},setOuterSize:function(a,b,c){var d=DynarchDomUtils.getPaddingAndBorder(a);b!=null&&d.x!=NaN&&(b-=d.x),c!=null&&d.y!=NaN&&(c-=d.y),DynarchDomUtils.setInnerSize(a,b,c)},setInnerSize:function(a,b,c){try{typeof b=="number"&&b!=NaN&&(b=Math.abs(b)+"px"),typeof c=="number"&&c!=NaN&&(c=Math.abs(c)+"px"),b!=null&&b!=NaN&&!(is_ie&&b<=0)&&(a.style.width=b),c!=null&&c!=NaN&&!(is_ie&&c<=0)&&(a.style.height=c)}catch(a){}},getOuterSize:function(a){return{x:a.offsetWidth,y:a.offsetHeight}},getInnerSize:function(a){var b=DynarchDomUtils.getOuterSize(a),c=DynarchDomUtils.getPaddingAndBorder(a);b.x-=c.x,b.y-=c.y;return b},importCommonVars:function(){return["var DOM=DynarchDomUtils","AC=DOM.addClass","DC=DOM.delClass","CC=DOM.condClass","CE=DOM.createElement","ID=Dynarch.ID"].join(",")},trash:function(a,b){a&&(b=a.parentNode)&&b.removeChild(a)},strip:function(a){try{var b=a.ownerDocument.createRange();b.selectNodeContents(a),p.insertBefore(a,b.extractContents()),b.detach()}catch(b){var c=a.parentNode;while(a.firstChild)c.insertBefore(a.firstChild,a)}this.trash(a)},createFromHtml:function(a){var b=CE_CACHE.CONTAINER;b.innerHTML=a;return b.firstChild},swapNodes:function(a,b){var c=a.parentNode,d=a.nextSibling;b.parentNode.replaceChild(a,b),c.insertBefore(b,d)},scrollIntoView:function(a){var b=a.parentNode;while(b&&(b.scrollHeight==b.clientHeight&&b.scrollWidth==b.clientWidth||/table|tbody/i.test(b.tagName)))b=b.parentNode;if(b&&b!==document.body){var c=[],d=b;while(d)c.push(d),d=d.parentNode;var e=0,f=0;d=a;while(d&&d!=b){e+=d.offsetTop,f+=d.offsetLeft,d=d.offsetParent;if(c.contains(d)){d!=b&&(e-=b.offsetTop,f-=b.offsetLeft);break}}var g=e+a.offsetHeight,h=f+a.offsetWidth;e<b.scrollTop&&(b.scrollTop=e),e>b.scrollTop&&g>b.scrollTop+b.clientHeight&&(b.scrollTop=g-b.clientHeight),f<b.scrollLeft&&(b.scrollLeft=f),f>b.scrollLeft&&h>b.scrollLeft+b.clientWidth&&(b.scrollLeft=h-b.clientWidth)}},flash:function(a,b,c){c||(c=3);var d=setInterval(function(){a.style.visibility=c&1?"hidden":"",--c,c<0&&clearInterval(d)},b||150)},walk:function(a,b){if(!b(a))for(var c=a.firstChild;c;c=c.nextSibling)c.nodeType==1&&DynarchDomUtils.walk(c,b)},setDocumentTitle:function(a){document.title=a},CE_CACHE:CE_CACHE};var $=is_gecko?document.getElementById.$(document):function(a){return document.getElementById(a)};function DEFINE_CLASS(a,b,c,d){e.name=a||"",d&&(e.hidden=true),b&&e.inherits(b,a);function e(c){if(c!==$__JSOOP){if(this===window)return alert("FIXME: Constructor called without new in "+a);var d;e.FIXARGS&&(arguments.length==0&&(c={},d=[c]),e.FIXARGS.apply(this,d||arguments)),e.DEFAULT_ARGS&&e.setDefaults(this,c),e.BEFORE_BASE&&e.BEFORE_BASE.apply(this,d||arguments),b&&b.apply(this,d||arguments),e.CONSTRUCT&&e.CONSTRUCT.apply(this,d||arguments)}}a&&!d&&(window[a]=e);var f=e.prototype;c&&(e.DEFINITION=c)(e,f,DynarchDomUtils),f.FINISH_OBJECT_DEF instanceof Function&&f.FINISH_OBJECT_DEF(),f.$||(f.$=Object.curry2);return e}function EXTEND_CLASS(a,b){b(a,a.prototype,DynarchDomUtils)}function DEFINE_HIDDEN_CLASS(a,b,c){return DEFINE_CLASS.call(this,a,b,c,true)}function DEFINE_SINGLETON(a,b,c){var d=DEFINE_HIDDEN_CLASS(a,b,c);DlSingleton.register(a,d,true);return d}DEFINE_CLASS("DlException",null,function(a,b){a.CONSTRUCT=function(a,b){this.error=this.constructor.name,a||(a="*** no error message given ***"),this.message=this.constructor.name+": "+a,b!=null&&(this.code=b)},b.toString=function(){var a=this.message;this.code&&(a+=" / code: "+this.code);return a}}).stopEventBubbling=function(){throw new DlExStopEventBubbling};function DEFINE_EXCEPTION(a,b){return DEFINE_CLASS(a,b||DlException)}DEFINE_EXCEPTION("DlExInvalidOperation"),DEFINE_EXCEPTION("DlExAbstractBaseClass"),DEFINE_EXCEPTION("DlExStopEventProcessing"),DEFINE_EXCEPTION("DlExStopFrameEvent"),DEFINE_EXCEPTION("DlExStopEventBubbling"),DEFINE_EXCEPTION("DlDataException"),DEFINE_EXCEPTION("DlSecurityException"),DEFINE_CLASS("DlEventProxy",null,function(a,b){a.CONSTRUCT=function(){this.__eventHooks={},this.__disHooks={},this.registerEvents(this.DEFAULT_EVENTS),this.addEventListener("onDestroy",this.__onDestroy)},b.DEFAULT_EVENTS=["onDestroy"],b.FINISH_OBJECT_DEF=function(){var a=this.constructor.DEFAULT_EVENTS;a&&(this.DEFAULT_EVENTS=this.DEFAULT_EVENTS.concat(a))},b.__onDestroy=function(){["__eventHooks","__disHooks"].foreach(function(a){for(var b in this[a]){var c=this[a][b];c&&c.foreach(function(a,b){this[b]=null}),this[a][b]=null}this[a]=null},this)},b.__getEventHooks=function(a,b){if(!this.__eventHooks)throw new DlExStopEventBubbling;var c=this.__eventHooks[a.toLowerCase()];b&&(c=c.slice(0));return c};function c(a,b){return a.applyHooks(b,Array.$(arguments,2))}b.registerEvents=function(a){var b=this.__eventHooks,c=0,d;while(d=a[c++])d=d.toLowerCase(),b[d]||(b[d]=[])},b.condEventListener=function(a){a=a?this.addEventListener:this.removeEventListener;return a.apply(this,Array.$(arguments,1))},b.addEventListener=function(a,b,c,d){if(a instanceof Array){var e=0,f;while(f=a[e++])this.addEventListener(f,b,c,d)}else if(typeof a=="object")for(var e in a)this.addEventListener(e,a[e],b,c);else{var g=this.__getEventHooks(a);g.remove(b),c==null&&a.toLowerCase()=="ondestroy"&&(c=true),c?g.unshift(b):g.push(b),d&&d.addEventListener("onDestroy",this.removeEventListener.$(this,a,b))}return this},b.listenOnce=function(a,b,c){c==null&&(c=1);var d=function(){--c==0&&this.removeEventListener(a,d),b.apply(this,arguments)};return this.addEventListener(a,d)},b.connectEvents=function(a,b,d){typeof b=="string"?(d=b,b=this):d||(d=a);if(a instanceof Array)for(var e=0;e<a.length;++e)this.connectEvents(a[e],b,d[e]);else this.addEventListener(a,c.$(null,b,d));return this},b.removeEventListener=function(a,b){var c=0,d;if(a instanceof Array)while(d=a[c++])this.removeEventListener(d,b);else if(typeof a=="object")for(c in a)this.removeEventListener(c,a[c]);else this.__getEventHooks(a).remove(b);return this},b.removeAllListeners=function(a){if(a instanceof Array)a.foreach(this.removeAllListeners,this);else if(typeof a=="object")for(var b in a)this.removeAllListeners(b);else this.__getEventHooks(a).length=0;return this},b.disableHooks=function(a){a instanceof Array?a.r_foreach(this.disableHooks,this):(a=a.toLowerCase(),this.__disHooks[a]=this.__eventHooks[a],this.__eventHooks[a]=[]);return this},b.enableHooks=function(a){a instanceof Array?a.r_foreach(this.enableHooks,this):(a=a.toLowerCase(),this.__eventHooks[a]=this.__disHooks[a],this.__disHooks[a]=null);return this},b.callHooks=function(a){var b=arguments.length>1?Array.$(arguments,1):[];return this.applyHooks(a,b)},b.hasHooks=function(a){var b=this.__eventHooks[a.toLowerCase()];return b&&b.length>0},b.withHooks=function(a,b){this.addEventListener.apply(this,a);try{return b()}finally{this.removeEventListener.apply(this,a)}},b.withDisabledHooks=function(a,b){this.disableHooks.apply(this,a);try{return b()}finally{this.enableHooks.apply(this,a)}},b.applyHooks=function(a,b){var c=[],d,e=0,f;try{d=this.__getEventHooks(a,true);while(f=d[e++])c.push(f.apply(this,b))}catch(a){if(!(a instanceof DlExStopEventProcessing))throw a}return c},b.debug_countHooks=function(){var a={},b;for(b in this.__eventHooks)a[b]=this.__eventHooks[b].length;return a},b.invoke=function(a){var b=Array.$(arguments,1);return function(){this[a].apply(this,b.concat(Array.$(arguments)))}.$(this)},b.destroy=function(){this.destroyed||(this.destroying=true,this.callHooks("onDestroy"),this.__eventHooks=null,this.destroying=false,this.destroyed=true)}}),DEFINE_CLASS("DlEvent",null,function(a,b,c){var d=c.createElement,e={mouseover:"onMouseEnter",mouseout:"onMouseLeave",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyup:"onKeyUp",keypress:"onKeyPress",contextmenu:"onContextMenu",focus:"on_DOM_Focus",blur:"on_DOM_Blur",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",textInput:"onTextInput"};a.CONSTRUCT=function(b){this.type=b.type,this.dl_type=e[this.type]||this.type,this.ctrlKey=b.ctrlKey,this.which=b.which,this.keyIdentifier=b.keyIdentifier,is_macintosh?(this.altGrKey=b.altKey,this.altKey=b.metaKey):this.altKey=b.altKey,this.shiftKey=b.shiftKey,this.button=b.button,this.focusedWidget=a.focusedWidget();if(is_ie)switch(b.button){case 0:this.button=null;break;case 1:this.button=0;break;case 2:this.button=2;break;case 4:this.button=1}this.type.indexOf("key")==0&&(this.keyCode=b.keyCode,this.charCode="which"in b?b.which:is_ie||is_opera?b.keyCode:b.charCode,this.keyStr=String.fromCharCode(this.charCode));if(this.dl_type=="onMouseWheel"){var c;b.wheelDelta?c=b.wheelDelta/120:b.detail&&(c=-b.detail/3),this.wheelDelta=c}this.pos={x:b.clientX,y:b.clientY},this.relPos=this.pos;if(is_ie){this.target=b.srcElement;switch(this.type){case"mouseover":this.relatedTarget=b.fromElement;break;case"mouseout":this.relatedTarget=b.toElement}}else try{this.target=b.target,this.target.nodeType==3&&(this.target=this.target.parentNode);if(this.type=="mouseout"||this.type=="mouseover")this.relatedTarget=b.relatedTarget,this.relatedTarget&&this.relatedTarget.nodeType==3&&(this.relatedTarget=this.relatedTarget.parentNode)}catch(a){this.relatedTarget=b.explicitOriginalTarget}},b.computePos=function(a){var b=a?a instanceof DlWidget?a.getElement():a:document.body,d=this.elPos=b?c.getPos(b):{x:0,y:0};return this.relPos={x:this.pos.x-d.x,y:this.pos.y-d.y,elPos:d}},b.getObject=function(a){var b=this.target,c=this.object;if(!c){try{while(b&&!DlWidget.getFromElement(b))b=b.parentNode;c=b?DlWidget.getFromElement(b):null}catch(a){c=null}this.object=c}a&&(c=c.getParent(a));return c},b.getParentElement=function(a,b){b&&b instanceof DlWidget&&(b=b.getElement());if(b&&c===b)return null;var c=this.target;try{while(c&&c.tagName.toLowerCase()!=a){c=c.parentNode;if(b&&c===b)return null}}catch(a){c=null}return c},a.stopEvent=c.stopEvent;function f(a,b,d,e){var f=b.getObject();switch(b.type){case"click":break;case"mousedown":a._ev_mouseDown=true,a.applyHooks(b.dl_type,[b]);break;case"mouseup":var g=a._ev_mouseDown;a._ev_mouseDown=false,a.applyHooks(b.dl_type,[b]),g&&a._ev_mouseInside&&b.button===0&&(b=new DlEvent(e),b.dl_type="onClick",this.push([a,b,d,e]));break;case"mouseover":case"mouseout":!d||!c.related(d,e)?(a===f&&(a._ev_mouseInside=b.type=="mouseover"),a.applyHooks(b.dl_type,[b])):(b.dl_type=b.type=="mouseover"?"onMouseOver":"onMouseOut",a.applyHooks(b.dl_type,[b]));break;case"dblclick":if((is_ie||is_opera)&&!a.hasHooks("onDblClick")){b=new DlEvent(e),b.type="click",a.applyHooks(b.dl_type="onClick",[b]);break};default:a.applyHooks(b.dl_type,[b])}e&&b.domStop&&c.stopEvent(e)}var g=null;function h(){this===g&&(g=null)}a.fakeBlur=function(){if(is_safari&&g.blur)return g.blur();var a=c.CE_CACHE.FAKE_FOCUS;a||(a=c.CE_CACHE.FAKE_FOCUS=d("a",null,{href:"#",innerHTML:"test",className:"DYNARCH-FAKE-FOCUS"},document.body)),a.focus();if(is_ie){var b=document.body.createTextRange();b.moveStart("character",0),b.collapse(true),b.select()}a.blur(),window.status=""},a.focusedWidget=function(b){if(arguments.length>0&&g!==b){g&&!g.destroyed&&(g._focusable==2?b._focusable<2&&a.fakeBlur():g.blur(),g.removeEventListener("onDestroy",h));if(g=b){b.addEventListener("onDestroy",h);var c=b.parent;while(c)c._focusedWidget=b,c=c.parent}}return g},a.checkDisabled=function(a){while(a){if(a.disabled())return true;a=a.parent}return false},b.destroy=function(){this.object=this.target=this.relatedTarget=null},b.stopDomEvent=function(){a.stopEvent(a.latestDomEvent)};var i=a.GLOBAL_CAPTURES={},j="keydown keyup keypress".hashWords();a._genericEventHandler=function(b,c){b||(b=window.event);var d,e,h=b instanceof a?b:new a(b);c&&(b=c);if(h._failed){a.stopEvent(b);return}a.latestEvent=h,a.latestDomEvent=b,h.pos.x&&h.dl_type!="onMouseWheel"&&(a.latestMouseEvent=h,h.dl_type=="onMouseDown"&&(a.latestMouseDownEvent=h));try{var k=i[h.dl_type],l;if(k)for(l=k.length;--l>=0;)k[l](h);h.type in j&&g?d=g.getElement():d=h.target;var m=[];l=0;while(d){if(e=DlWidget.getFromElement(d)){a.checkDisabled(e)||(m[l++]=[e,h,d,b]);if(e.__noPropEvents&&e.__noPropEvents.test(h.dl_type))break}d=d.parentNode}for(l=0;l<m.length;++l)f.apply(m,m[l])}catch(c){if(c instanceof DlExStopEventBubbling)a.stopEvent(b);else throw c}h.destroy()};var k=[];function l(){k.r_foreach(Function.invoke)}a._unloadHandler=l,a.captureGlobals=function(b){for(var c in b)a.captureGlobal(c,b[c])},a.releaseGlobals=function(b){for(var c in b)a.releaseGlobal(c,b[c])},a.captureGlobal=function(a,b){var c=i[a];c||(c=i[a]=[]),c.push(b)},a.releaseGlobal=function(a,b){var c=i[a];c&&c.remove(b)},a.atUnload=function(a){k.push(a)},c.addEvents(document,["contextmenu","click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove",is_gecko?"DOMMouseScroll":"mousewheel","keydown","keyup","keypress"],a._genericEventHandler),c.addEvent(window,"unload",l)}),DEFINE_CLASS("DlWidget",DlEventProxy,function(a,b,c){var d=c.createElement,e=c.addClass,f=c.delClass,g=c.condClass,h=Dynarch.ID;a.FIXARGS=function(a){a.focusable==null&&a.tabIndex&&(a.focusable=true)},a.CONSTRUCT=function(){this.__propsUserData={},this.__refNodes=[];if(!(this._parent==null||this._parent instanceof DlContainer))throw new DlException("Parent must be an instance of DlContainer");this.id=h(this._objectType||"DlWidget"),i[this.id]=this,this.initDOM()},a.DEFAULT_ARGS={userData:["data",null],_parent:["parent",null],_fillParent:["fillParent",null],_tagName:["tagName","div"],_dragArgs:["drag",null],_element:["element",null],_focusable:["focusable",false],_tabIndex:["tabIndex",0],_accessKey:["accessKey",null],__appendArgs:["appendArgs",window.undefined],__addClassName:["className",""],__disabled:["disabled",false],__tooltip:["tooltip",null],__contextMenu:["contextMenu",null],__tooltipTimeout:["tooltipTimeout",650],__refCnt:["_refCnt",0],__noPropEvents:["dontBubbleEvents",null]},a.DEFAULT_EVENTS=["onMouseEnter","onMouseLeave","onMouseMove","onMouseDown","onMouseUp","onMouseOver","onMouseOut","onMouseWheel","onClick","onDblClick","onDisabled","onDisplay","onFocus","on_DOM_Focus","onBlur","on_DOM_Blur","onKeyDown","onKeyUp","onKeyPress","onResize","onContextMenu","onTooltipShow","onTooltipHide"];var i=a.WIDGETS={};a.getById=function(a){return i[a]},a.getFromElement=function(a){return a._dynarch_object},a.getFromUpElement=function(a){while(a&&!a._dynarch_object)a=a.parentNode;return a&&a._dynarch_object};var j=null;function k(){j||(j=new DlTooltip({}));return j}a.getTooltip=k,b.getWidgetId=function(){return this.id},b._className=[],b.FINISH_OBJECT_DEF=function(){a.BASE.FINISH_OBJECT_DEF.call(this),(this._className=Array.$(this._className)).push(this._objectType)};var l=null;b.getResizeRect=a.getResizeRect=function(){l||(l=d("div",{display:"none"},{className:"Dl-ResizeRect",innerHTML:"&nbsp;"},document.body));return l},a.debug_countHooks=function(){var a={};Array.hashKeys(DlWidget.WIDGETS).foreach(function(b){a[b]=DlWidget.WIDGETS[b].debug_countHooks()});return a};function m(){this.__tooltipActive&&k().hide(),this.__contextMenu instanceof a&&this.__contextMenu.destroy();if(this.parent)try{this.parent.removeWidget(this)}catch(a){}var b=this.getElement();b&&(b._dynarch_focusable=b._dynarch_object=null),this._element=null,c.trash(b),i[this.id]&&(i[this.id]=null,delete i[this.id]),b=null,this.__refNodes.r_foreach(function(a,b){this[a]=this.__refNodes[b]=null,delete this[a]},this),this.__propsUserData=this.userData=this.__refNodes=null}b.destroy=function(){this.unref()<=0&&a.BASE.destroy.call(this)},b.__onTooltipShow=function(){this.__tooltipActive=true,this.callHooks("onTooltipShow")},b.__onTooltipHide=function(){this.__tooltipActive=false,this.callHooks("onTooltipHide")},b._popupTooltip=function(){k().popup({timeout:this.__tooltipTimeout,content:this.__tooltip,anchor:this.getElement(),align:"mouse",onPopup:this.__onTooltipShow,onHide:this.__onTooltipHide,widget:this})};function n(){this.__tooltip&&this._popupTooltip()}function o(){k().hide()}function p(a,b){if(!a.dragging)if(Math.abs(b.pos.x-a.startPos.x)>=a.delta||Math.abs(b.pos.y-a.startPos.y)>=a.delta)a.dragging=true,a.makeElementCopy(this,b),a.applyHooks("onStartDrag",[this,b]),this.addClass(a.draggingClass);if(a.dragging){var c=a.elementCopy;c&&(c.style.left=b.pos.x+5+"px",c.style.top=b.pos.y+5+"px"),a.moving(this,b),DlException.stopEventBubbling()}}function q(a,b,c){this.delClass(a.draggingClass),DlEvent.releaseGlobals(a.captures),a.captures=null,y=false,c||a.doDrop(this,b),a.reset(c)}function r(a,b){if(b.button==0){var c=a.dragging&&a.canDrop;q.call(this,a,b,!c)}}function s(a,b){DlException.stopEventBubbling()}function t(a,b){DlException.stopEventBubbling()}function u(a,b){var c=b.getObject(),d=false,e=c;while(e){if(e===this){d=true;break}e=e.parent}var f=a.dropOK(this,b,c,d);DlException.stopEventBubbling()}function v(a,b){DlException.stopEventBubbling()}function w(a,b){b.keyCode==DlKeyboard.ESCAPE&&q.call(this,a,b,true),DlException.stopEventBubbling()}function x(a,b){DlException.stopEventBubbling()}var y=false;function z(a){k().cancel(),this._focusable&&!a._justFocusedWidget&&(a._justFocusedWidget=this,this._focusable<2&&this.focus());if(a.button==0){var b=this._dragArgs,c;if(b&&!y)if(b.startOK(this,a)){var d=a.getObject();d&&d.applyHooks("onMouseLeave",[a]),y=true,b.source=this,b.captures={onMouseMove:p.$(this,b),onMouseUp:r.$(this,b),onMouseOver:s.$(this,b),onMouseOut:t.$(this,b),onMouseEnter:u.$(this,b),onMouseLeave:v.$(this,b),onContextMenu:x.$(this,b),onKeyPress:w.$(this,b)},b.startPos=a.pos,b.startElPos=this.getPos(),DlEvent.captureGlobals(b.captures)}}}function A(a){var b=this.__contextMenu;typeof b=="function"&&(b=b.call(this,a));if(b){var c=this._getContextMenuPopup();c.popup({timeout:0,content:b,anchor:b.contextMenuAnchor||this.getElement(),align:b.contextMenuAlign||"mouse",widget:this,onPopup:b.contextMenuOnPopup||null,onHide:b.contextMenuOnHide||null,isContext:true}),DlException.stopEventBubbling()}}b.setData=function(a,b){arguments.length==1?delete this.__propsUserData[a]:this.__propsUserData[a]=b},b.getData=function(a){return this.__propsUserData[a]},b._getDlPopup=function(){var a=this.getParent(DlPopup)||0;a&&(a=a._level+1);return DlPopupMenu.get(a)},b._getContextMenuPopup=b._getDlPopup;var B={onDestroy:m,onMouseEnter:n,onMouseLeave:o,onMouseDown:z,onContextMenu:A};b._setListeners=function(){this.addEventListener(B),this.addEventListener(is_ie?"onKeyDown":"onKeyPress",this._handle_focusKeys)},b._handle_focusKeys=function(a){},b._check_accessKey=function(a){return this._accessKey&&DlKeyboard.checkKey(a,this._accessKey)},b._handle_accessKey=function(a){this.focus()},b._setFocusedStyle=function(a){this.condClass(a,this._className.peek()+"-focus")},b.focus=function(){this._focusable?(DlEvent.focusedWidget(this),this._setFocusedStyle(true),this.callHooks("onFocus"),this instanceof DlEntry||this.scrollIntoView()):this.parent&&this.parent.focus()},b.blur=function(){this._focusable&&(this.destroyed||(this._setFocusedStyle(false),this.callHooks("onBlur")))},b.focusInside=function(){var a=DlEvent.focusedWidget();while(a){if(a==this)break;a=a.parent}return!!a},b._createElement=function(a){var b=this._element;if(b)this.__alreadyInDom=true;else{var e=this.constructor,f=e.__joinedClassName||this._className.join(" ");e.__joinedClassName||(e.__joinedClassName=f),this.__addClassName&&(f+=" "+this.__addClassName),a?(b=c.createFromHtml(a),b.className=f):b=d(this._tagName,null,{className:f}),this._focusable&&(b._dynarch_focusable=true),this._element=b}b._dynarch_object=this},b.getElement=function(){return this._element},b.getParentNode=function(){return this._element.parentNode},b.getDOMChildren=function(){return Array.$(this.getContentElement().childNodes)},b.getContentElement=function(){return this.getElement()},b.setStyle=function(a,b){var c=this.getElement().style;if(arguments.length>1)c[a]=b;else for(var d in a)this.setStyle(d,a[d])},b.setContent=function(b){var c=this.getContentElement();while(c.firstChild)c.removeChild(c.lastChild);if(typeof b=="string")c.innerHTML=b;else{if(b instanceof Function)return this.setContent(b.call(this));b instanceof a?this.appendWidget(b,this.__appendArgs):b instanceof Array?c.innerHTML=b.join(""):b!=null&&c.appendChild(b)}return b!=null},b.ref=function(){return this.__refCnt++},b.unref=function(){return--this.__refCnt},b.refCnt=function(){return this.__refCnt},b.setContextMenu=function(b){this.__contextMenu instanceof a&&this.__contextMenu.destroy(),b instanceof a&&b.ref(),this.__contextMenu=b},b.setTooltip=function(a){this.__tooltip=a},b.initDOM=function(){this._setListeners(),this._createElement(),this._parent&&(this._parent.appendWidget(this,this.__appendArgs),this._parent=null),this.__disabled&&this.disabled(true,true),this.__onTooltipShow=this.__onTooltipShow.$(this),this.__onTooltipHide=this.__onTooltipHide.$(this);return this},b.setUnselectable=function(a,b){a==null&&(a=this.getElement()),c.setUnselectable(a,b)},b.disabled=function(a,b){a!=null&&(b||a!=this.__disabled)&&(this.__disabled=a,this.condClass(a,"DlWidget-disabled"),this.condClass(a,this._className.peek()+"-disabled"),this.applyHooks("onDisabled",[a]));return this.__disabled},b.enabled=function(a,b){a!=null&&this.disabled(!a,b);return!this.__disabled},b.getParent=function(a,b){if(a==null)return this.parent;var c=this;b&&(c=this.parent);while(c&&!(c instanceof a))c=c.parent;return c},b.findParent=function(a,b){var c,d=this;b&&(d=this.parent);if(a instanceof Function)while(d&&!a(d))d=d.parent;else{var e=Array.$(arguments,2);while(d){if(c=d[a])if(c instanceof Function){if(c.apply(d,e))break}else break;d=d.parent}}return d},b.getPos=function(){return c.getPos(this.getElement())},b.getBRPos=function(){return c.getBRPos(this.getElement())},b.getOffsetPos=function(){var a=this.getElement();return{x:a.offsetLeft,y:a.offsetTop}},b.setPos=function(a,b){var c=this.getElement();a!=null&&typeof a=="object"&&(b=a.y,a=a.x),a!=null&&(c.style.left=a+"px"),b!=null&&(c.style.top=b+"px")},b.setSize=b.setOuterSize=function(a){c.setOuterSize(this.getElement(),a.x,a.y),this.callHooks("onResize")},b.setInnerSize=function(a){c.setInnerSize(this.getContentElement(),a.x,a.y),this.callHooks("onResize")},b.getSize=b.getOuterSize=function(){return c.getOuterSize(this.getElement())},b.getInnerSize=function(){return c.getInnerSize(this.getContentElement())},b.display=function(a){var b=this.getElement().style;if(a!=null){b.display=a?"":"none",this.applyHooks("onDisplay",[a,b.display,"display"]);return a}return b.display!="none"},b.visibility=function(a){var b=this.getElement().style;if(a!=null){b.visibility=a?"":"hidden",this.applyHooks("onDisplay",[a,b.visibility,"visibility"]);return a}return b.visible!="hidden"},b.opacity=function(a){return c.setOpacity(this.getElement(),a)},b.position=function(a){var b=this.getElement().style,c=b.position;a!=null&&(b.position=a);return c},b.setIconClass=function(a){var b=this.getContentElement();g(b,a!=null,this.__withIconClass||this._className.peek()+"-withIcon"),this.iconClass&&f(b,this.iconClass),a&&e(b,a),this.iconClass=a},b.addClass=function(a,b){e(this.getElement(),a,b)},b.delClass=function(a,b){f(this.getElement(),a,b)},b.condClass=function(a,b,c){g(this.getElement(),a,b,c);return a},b.zIndex=function(a){var b=this.getElement();if(a!=null)return b.style.zIndex=a;if(b.style.zIndex)return parseInt(b.style.zIndex,10);return 0},b.refNode=function(a,b){this[a]=b,this.__refNodes.remove(a),b!=null&&this.__refNodes.push(a);return b},b.debug_highlight=function(a){this.getElement().style.backgroundColor=a||"yellow"},b.getQuickPopup=function(){var a=this.getParent(DlPopup)||0;a&&(a=a._level+1);return DlDialogPopup.get(a)},b.quickPopup=function(a){var b=this.getQuickPopup();a=Object.makeCopy(a),Object.mergeUndefined(a,{anchor:this.getElement(),align:{prefer:"CC"}}),b.popup(a)},b.getScroll=function(){var a=this.getElement();return{x:a.scrollLeft,y:a.scrollTop}},b.scrollIntoView=function(){c.scrollIntoView(this.getElement())},b.flash=function(a,b){c.flash(this.getElement(),a,b)},DlEvent.atUnload(function(){do{window.DL_CLOSING=true;var a=false;for(var b in i){a=true;var c=i[b];try{i[b]=null,delete i[b],c.destroy()}catch(a){}break}}while(a);i=null})}),DEFINE_CLASS("DlContainer",DlWidget,function(a,b){a.BEFORE_BASE=function(){this._widgets=[]},a.DEFAULT_ARGS={_scrollBars:["scroll",false],__noParentKeyBindings:["noParentKB",false]},b._createElement=function(){a.BASE._createElement.apply(this,arguments),this._scrollBars&&this.setStyle("overflow","auto")},b.appendWidget=function(a){a.parent&&a.parent.removeWidget(a),this._widgets.push(a),a.parent=this,a.__alreadyInDom||this._appendWidgetElement.apply(this,arguments),delete a.__alreadyInDom},b._appendWidgetElement=function(a,b){var c=a.getElement();if(typeof b=="number"){var d=this.getContentElement();try{b=d.childNodes[b],d.insertBefore(c,b)}catch(a){d.appendChild(c)}}else b==null?b=this.getContentElement():typeof b=="string"&&(b=document.getElementById(b)),c.parentNode!==b&&b.appendChild(c)},b.removeWidget=function(a){a.parent===this&&(this._removeWidgetElement(a),this._widgets.remove(a),a.parent=null)},b._removeWidgetElement=function(a){if(this._widgets.contains(a)){var b=a.getElement();b.parentNode&&b.parentNode.removeChild(b)}},b.destroyChildWidgets=function(){for(var b=Array.$(this._widgets),c=0;c<b.length;++c)b[c]instanceof a&&b.push.apply(b,b[c]._widgets);b.r_foreach(function(a){try{a.destroy()}catch(a){}});var d=this.getContentElement();d&&(d.innerHTML="");return d},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener("onDestroy",this.destroyChildWidgets),this.addEventListener("onResize",this.__doLayout)},b.disabled=function(b,c){var d=a.BASE.disabled.call(this,b,c);b!=null&&this._widgets.r_foreach(function(a){a.disabled(b,c)});return d},b.children=function(a){return a!=null?this._widgets[a]:this._widgets},b.__doLayout=function(){var a=this.children().grep_first(function(a){return a._fillParent});a&&a.setSize(this.getInnerSize())};function c(a,b){a=a?Array.$(a.getElement().getElementsByTagName("*")):[];return Array.$(this.getElement().getElementsByTagName("*")).grep(b?"_dynarch_object":"_dynarch_focusable").grep(DynarchDomUtils.elementIsVisible).grep(a.contains.$(a).inverse()).map(DlWidget.getFromElement).grep("enabled").mergeSort(function(a,b){return a._tabIndex-b._tabIndex})}function d(a,b){var d=c.call(this,a),e=d.find(a);e=d.rotateIndex(e+b);if(e!=null)return d[e]}b.getNextFocusWidget=function(a){return d.call(this,a,1)},b.getPrevFocusWidget=function(a){return d.call(this,a,-1)},b.getFirstFocusWidget=function(){return this.getNextFocusWidget(null)},b.getLastFocusWidget=function(){return this.getPrevFocusWidget(null)},b._handleKeybinding=function(a,b){if(a.altKey||a.ctrlKey){var d=c.call(this,b,true);d.foreach(function(b){if(b._check_accessKey(a)){b._handle_accessKey(a),a.domStop=true;throw new DlExStopEventBubbling}}),this.parent&&!this.__noParentKeyBindings&&this.parent._handleKeybinding(a,this)}};var e;a.getHiddenContainer=function(){e||(e=new this({className:"DlContainer-Hidden"}),document.body.appendChild(e.getElement()));return e}}),DEFINE_CLASS("DlRadioGroup",DlEventProxy,function(a,b){a.CONSTRUCT=function(a){a!=null&&(this._maxChecked=1,this._minChecked=null,this.id=a,this.reset(),this.addEventListener("onDestroy",d))};var c={};a.DEFAULT_EVENTS=["onChange"],a.getById=a.get=function(a){a||(a=Dynarch.ID("group"));var b=c[a];b||(b=c[a]=new this(a));return b};function d(){c[this.id]&&(this._history=this._buttonsByValue=this._buttonsById=this._buttons=null,delete c[this.id])}function e(a){if(a!=null){this._changed=true;if(a.checked()){if(this._maxChecked!=null)while(this._history.length>=this._maxChecked){var b=this._history[0];b.checked(false,true),this._history.splice(0,1)}this._history.push(a)}else{if(this._minChecked!=null&&this._history.length<=this._minChecked){a.checked(true,true);throw new DlExStopEventProcessing}this._history.remove(a)}}}b.reset=function(){this._buttons&&this._buttons.r_foreach(function(a){a.__group=a.__groupId=null}),this._changed=false,this._buttons=[],this._buttonsById={},this._buttonsByValue={},this._history=[],this.removeAllListeners("onChange"),this.addEventListener("onChange",e)},b.changed=function(a){var b=this._changed;a!=null&&(this._changed=a);return b},b.getSelected=function(){return this._history},b.getButtons=function(){return this._buttons},b.getNextButton=function(a){a==null&&(a=this.getSelected()[0]);var b=this._buttons,c=b.nullLimitIndex(b.find(a)+1);if(c!=null)return b[c]},b.getPrevButton=function(a){a==null&&(a=this.getSelected()[0]);var b=this._buttons,c=b.nullLimitIndex(b.find(a)-1);if(c!=null)return b[c]},b.getValue=function(){return this._history.map("value")},b.setValue=function(a,b){var c=this._buttonsByValue;a instanceof Array||(a=[a]),a=a.toHash(true),this._history=[];for(var d in c)c[d].checked(a[d],true),a[d]&&this._history.push(c[d]);b&&this.callHooks("onChange")},b.getByValue=function(a){return this._buttonsByValue[a]},b.addWidget=function(a,b){if(!this._buttonsById[a.id]){b==null&&(b=this._buttons.length),this._buttonsById[a.id]=a,this._buttons.splice(b,0,a),a.checked()&&this._history.push(a);var c=a.value();typeof c!="undefined"&&(this._buttonsByValue[c]=a),a.addEventListener("onDestroy",this.removeWidget.$(this,a))}},b.removeWidget=function(a){if(this._buttonsById[a.id]){this._changed=true,delete this._buttonsById[a.id];var b=a.value();typeof b!="undefined"&&delete this._buttonsByValue[a.value()],this._buttons.remove(a),this._history.length!=this._history.remove(a).length&&this.callHooks("onChange")}},b.minChecked=function(a){arguments.length>0&&(this._minChecked=a);return this._minChecked},b.maxChecked=function(a){arguments.length>0&&(this._maxChecked=a);return this._maxChecked},b.checkAll=function(a,b){a==null&&(a=true),b==null&&(b=false),this._buttons.foreach(function(c){c.checked(a,!b)}),this._history=a?Array.$(this._buttons):[]},b.unCheckAll=function(){this._history.r_foreach(function(a){a.checked(false)})}}),DEFINE_CLASS("DlAbstractButton",DlWidget,function(a,b){var c=["onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onUpdateLabel","onClick","onCheck","onChange","onDisabled"],d={STANDARD:1,TWOSTATE:2};a.DEFAULT_ARGS={_label:["label",""],_classes:["classes",{}],_checked:["checked",false],__groupId:["group",null],_btnType:["type",d.STANDARD],_value:["value",window.undefined],_noCapture:["noCapture",false],_alwaysCheck:["alwaysCheck",false]},a.CONSTRUCT=function(a){var b=this.__groupId;if(b!=null){var c;typeof b=="object"?(c=b,this.__groupId=c.id):c=DlRadioGroup.get(b),this.__group=c,c.addWidget(this,typeof a.appendArgs=="number"?a.appendArgs:null)}this._noCapture||(this._btnpressCapture={onMouseMove:DlException.stopEventBubbling,onMouseUp:this._cap_onMouseUp.$(this),onMouseOver:DlException.stopEventBubbling,onMouseOut:DlException.stopEventBubbling,onMouseEnter:this._cap_onMouseEnter.$(this),onMouseLeave:this._cap_onMouseLeave.$(this)})},a.DEFAULT_EVENTS=["onCheck","onUncheck","onChange","onUpdateLabel"],b._cap_onMouseUp=function(a){var b=a.getObject();DlEvent.releaseGlobals(this._btnpressCapture),this.applyHooks("onMouseUp",[a]),this._ev_mouseInside||this.applyHooks("onMouseLeave",[a]),b!==this&&(b&&b.applyHooks("onMouseEnter",[a]),DlException.stopEventBubbling())},b._cap_onMouseEnter=function(a){var b=a.getObject();b===this&&this.addClass(this._classes.active),b&&(b._ev_mouseInside=true),DlException.stopEventBubbling()},b._cap_onMouseLeave=function(a){var b=a.getObject();b===this&&this.delClass(this._classes.active),b&&(b._ev_mouseInside=false),DlException.stopEventBubbling()},a.TYPE=d,b._onMouseEnter=function(a){this.addClass(this._classes.hover)},b._onMouseLeave=function(a){this.delClass(this._classes.hover),this.delClass(this._classes.active)},b._onMouseDown=function(a){a.button===0&&(this._ev_mouseInside=true,this.addClass(this._classes.hover),this.addClass(this._classes.active),this._noCapture||(DlEvent.captureGlobals(this._btnpressCapture),a.domStop=true))},b._onMouseUp=function(a){this.delClass(this._classes.active)},b._onUpdateLabel=function(){this.condClass(!this._label||!/\S/.test(this._label),this._classes.empty)},b._onClick=function(){this._btnType==d.TWOSTATE&&(this._alwaysCheck?this.checked(true):this.toggle())},b.keyClicked=function(a){this.addClass(this._classes.active),function(){this.delClass(this._classes.hover),this.delClass(this._classes.active),this.applyHooks("onClick",[a])}.delayed(90,this),a&&(a.domStop=true,DlException.stopEventBubbling())},b._handle_focusKeys=function(b){var c=b.keyCode;if(c==DlKeyboard.ENTER||b.charCode==DlKeyboard.SPACE)this.keyClicked(b);else if(!this._customMoveKeys&&this.__group&&c in DlKeyboard.KEYS_MOVE){var d=c in DlKeyboard.KEYS_MOVE_PREV,e=d?this.__group.getPrevButton(this):this.__group.getNextButton(this);e&&(e.focus(),b.shiftKey&&(this.checked(true),e.checked(true)),b.domStop=true,DlException.stopEventBubbling())}a.BASE._handle_focusKeys.call(this,b)},b._handle_accessKey=function(a){this.focus(),this.keyClicked(a)},b.disabled=function(b,c){b!=null&&b&&(this.delClass(this._classes.hover),this.delClass(this._classes.active));return a.BASE.disabled.call(this,b,c)},b._onChange=function(){this.__group!=null&&this.__group.applyHooks("onChange",[this])},b._onCheck=Function.noop,b._onDisabled=function(a){this.condClass(a,this._classes.disabled),a&&this._capture&&(DlEvent.releaseCapture(this._capture),this._capture=null)},b._createElement=function(){a.BASE._createElement.call(this),this._createLabelElement(),this.label(this._label,true),this._updateState(),this.setUnselectable()},b._setListeners=function(){a.BASE._setListeners.call(this),c.r_foreach(function(a){this.addEventListener(a,this["_"+a])},this)},b._createLabelElement=Function.noop,b.label=function(a,b){if(b||arguments.length>0&&a!==this._label)(this._label=a)&&(a="<div class='DlButton-Label'>"+this._label+"</div>"),this.setContent(a),this.applyHooks("onUpdateLabel",[this._label]);return this._label},b.setLabel=b.label,b.getLabel=b.label,b.group=function(){return this.__group},b._checkTwoState=function(a){var b=this._btnType!=d.TWOSTATE;if(b&&!a)throw new DlExInvalidOperation("This operation is only available for a TWOSTATE button");return!b},b._updateState=function(){if(this._checkTwoState(true)){var a=this._classes;this.condClass(this._checked,a.checked,a.unchecked)}},b.checked=function(a,b){this._checkTwoState();if(arguments.length>0){a=!!a;var c=!b&&this._checked!==a;this._checked=a,this._updateState(),c&&(this.callHooks("onChange"),this.callHooks(a?"onCheck":"onUncheck"))}return this._checked},b.toggle=function(a){this._checkTwoState(),this.checked(!this._checked,a)},b.value=function(a){var b=this._value;arguments.length>0&&(this._value=a);return b},b.setValue=b.value,b.getValue=b.value}),DEFINE_CLASS("DlAnimation",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["onStart","onStop","onPause","onUpdate"],a.CONSTRUCT=function(a,b){this.addEventListener("onDestroy",this.stop.$(this)),a!=null&&(this.length=a),b!=null&&(this._speed=1e3/b),this._update=c.$(this)},b.start=function(a,b,c){this.stop(),a!=null&&(this.length=a),b!=null&&(this._speed=1e3/b),c!=null&&(c instanceof Function||(c=DlAnimation.easing[c]),this.func=c),this.i=this.t=0,this.callHooks("onStart"),this._timer=setInterval(this._update,this._speed)},b.running=function(){return this._timer},b.stop=function(a){this._timer&&(clearInterval(this._timer),this._timer=null,this.applyHooks("onStop",[a]))},b.getPos=function(a){a==null&&(a=this.func);return a.call(this,this.t)};function c(){this.t=this.i/this.length;try{this.applyHooks("onUpdate",[this.t]),++this.i>this.length&&this.stop(true)}catch(a){this.stop();throw a}}var d=Math.PI,e=Math.abs,f=Math.asin,g=Math.pow,h=Math.sin,i=Math.cos,j=Math.exp,k=Math.round,l=a.easing={elastic_b:function(a){return 1-i(-a*5.5*d)/g(2,7*a)},elastic_b_custom:function(a,b,c){a+=.5;return 1-i(-c*a*d)/g(2,b*c)},magnetic:function(a){return 1-i(a*a*a*10.5*d)/j(4*a)},accel_b:function(a){a=1-a;return 1-a*a*a},accel_a:function(a){return a*a*a},accel_ab:function(a){a=1-a;return 1-h(a*a*a*d/2)},bounce_b:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},shake:function(a){return a<.5?-i(a*11*d)*a*a:(a=1-a,i(a*11*d)*a*a)}}}),DEFINE_CLASS("DlBox",DlContainer,function(a,b,c){a.DEFAULT_ARGS={_borderSpacing:["borderSpacing",0],_align:["align",null],_tagName:["tagName","table"]},b._createElement=function(){a.BASE._createElement.call(this);var b=this.getElement();b.cellSpacing=this._borderSpacing,b.cellPadding=0,this._align&&(b.align=this._align),this.refNode("_tbody",c.createElement("tbody",null,null,b))},b.getTableElement=b.getElement,b._appendWidgetElement=function(a,b){b==null?this.createCellElement().appendChild(a.getElement()):b.appendChild(a.getElement())},b.destroyChildWidgets=function(){var a=Array.$(this._widgets);a.r_foreach(function(a){try{a.destroy()}catch(a){}})},b.__addSep=function(a,b,d){d||(d=this.createCellElement()),d.separator=true;var e=this._objectType+"-"+a;b&&(e+=" "+b),d.className=e,d.innerHTML="<div class='"+e+"'>&nbsp;</div>",c.setUnselectable(d);return d},b.addSeparator=function(a,b){return this.__addSep("separator",a,b)},b.addSpace=function(a,b){return this.__addSep("spacer",a,b)}}),DEFINE_CLASS("DlButton",DlAbstractButton,function(a,b,c){a.CONSTRUCT=function(){this.setIconClass(this._iconClass),this._iconClass=null},a.TYPE=DlAbstractButton.TYPE,a.DEFAULT_ARGS={_classes:["classes",{active:"DlButton-active",hover:"DlButton-hover",checked:"DlButton-1",unchecked:"DlButton-0",empty:"DlButton-empty",disabled:"DlButton-disabled"}],_iconClass:["iconClass",null]},b.__withIconClass="DlButton-withIcon",b._createElement=function(){a.BASE._createElement.call(this),this.addClass("DlWidget-3D")},b._createLabelElement=function(){this.getElement().innerHTML="<div class='DlButton-inner'><div></div></div>"},b.getContentElement=function(){return this.getElement().firstChild.firstChild},b.setSize=b.setOuterSize=function(a){var b=c.getPaddingAndBorder(this.getElement());a.x!=null&&(a.x-=b.x),a.y!=null&&(a.y-=b.y),b=c.getPaddingAndBorder(this.getElement().firstChild),a.x!=null&&(a.x-=b.x),a.y!=null&&(a.y-=b.y),c.setOuterSize(this.getContentElement(),a.x,a.y)}}),DEFINE_CLASS("DlHbox",DlBox,function(a,b,c){var d=c.createElement;b._createElement=function(){a.BASE._createElement.call(this),this.refNode("_row",d("tr",null,null,this._tbody))},b.createCellElement=function(a){var b=d("td",null,{className:"cell"});a!=null?this._row.insertBefore(b,a):this._row.appendChild(b);return b},b._removeWidgetElement=function(a){if(this._widgets.contains(a)){var b=a.getElement();b.parentNode.parentNode.removeChild(b.parentNode)}},b.addFiller=function(){this.addClass("DlHbox-hasFiller")},b.setAlign=function(a,b){var c=this.getElement();switch(a){case"left":c.style.marginLeft="0",c.style.marginRight="auto";break;case"center":c.style.marginRight=c.style.marginLeft="auto";break;case"right":c.style.marginLeft="auto",c.style.marginRight="0";break;default:c.style.marginLeft=a!=null?a:"auto",c.style.marginRight=b!=null?b:"auto"}},b.setEqualWidths=function(a){var b=this.children().max(function(a){return a.getSize().x});a&&(b+=a),this.children().r_foreach(function(a){a.setSize({x:b})})}});function DlPoint(a,b){typeof a=="object"?(this.x=a.x,this.y=a.y):(this.x=a,this.y=b)}DlPoint.prototype={clone:function(){return new DlPoint(this.x,this.y)},normalize:function(a){var b;this.x>a.x&&(b=this.x,this.x=a.x,a.x=b),this.y>a.y&&(b=this.y,this.y=a.y,a.y=b);return this},distanceTo:function(a){var b=Math.abs(a.x-this.x),c=Math.abs(a.y-this.y);return Math.sqrt(b*b+c*c)}};function DlRect(a,b,c,d){a instanceof DlRect?this.setFromRect(a):typeof a=="object"?typeof b=="object"?b instanceof DlPoint?this.setFromPoints(a,b):this.setFromValues(a.x,a.y,b.x,b.y):this.setFromValues(a.x,a.y,c,d):this.setFromValues(a,b,c,d)}DlRect.prototype={setFromRect:function(a){this.x=a.x,this.y=a.y,this.w=a.w,this.h=a.h;return this},setFromPoints:function(a,b){a=a.clone().normalize(b=b.clone()),this.x=a.x,this.y=a.y,this.w=b.x-a.x+1,this.h=b.y-a.y+1;return this},setFromValues:function(a,b,c,d){this.x=a,this.y=b,this.w=c,this.h=d;return this},getTL:function(){return new DlPoint(this.x,this.y)},getBR:function(){return new DlPoint(this.x+this.w-1,this.y+this.h-1)},getPoints:function(){return[getTL(),getBR()]},height:function(a){a!=null&&(this.h=a);return this.h},width:function(a){a!=null&&(this.w=a);return this.w},containsPoint:function(a){return this.x<=a.x&&this.x+this.w>a.x&&this.y<=a.y&&this.y+this.h>a.y},intersect:function(a){var b=null,c=Math,d=c.max(this.x,a.x),e=c.max(this.y,a.y),f=c.min(this.x+this.w,a.x+a.w)-d,g=c.min(this.y+this.h,a.y+a.h)-e;f>0&&g>0&&(b=new DlRect(d,e,f,g));return b},area:function(){return this.w*this.h},makeDiv:function(a,b){b||(b="#000"),a==null&&(a=0);var c={position:"absolute",left:this.x+"px",top:this.y+"px",width:this.w-a*2+"px",height:this.h-a*2+"px",overflow:"hidden",lineHeight:"1px",fontSize:"1px",border:a+"px solid "+b};return c=DynarchDomUtils.createElement("div",c,{innerHTML:"&nbsp;"})},positionDiv:function(a){a.style.left=this.x+"px",a.style.top=this.y+"px",a.style.height=this.h+"px",a.style.width=this.w+"px"},toString:function(){return this.w+"x"+this.h+"@"+this.x+","+this.y}},DEFINE_CLASS("DlPopup",DlContainer,function(a,b,c){var d=c.createElement,e=c.addClass,f=c.delClass,g=c.condClass,h={},i={},j={},k=/DlPopup-scroll(Up|Down)?-hover/g;a.BEFORE_BASE=function(){this.visible=this._hasScrolling=false},a.DEFAULT_EVENTS=["onPopup","onHide"],a.DEFAULT_ARGS={_level:["level",0],_autolink:["autolink",true],_oscroll:["scroll",{step1:5,step2:10,speed:40}],_align:["align",null],_zIndex:["zIndex",1e3],_focusable:["focusable",true],_shadows:["shadows",true]},b.FINISH_OBJECT_DEF=function(){a.BASE.FINISH_OBJECT_DEF.call(this),this.constructor.get=a.get,this.constructor.clearAll=a.clearAll,h[this._objectType]=[],i[this._objectType]={}},a.get=function(a,b){var c=this.prototype._objectType,d=false,e=h[c].length;if(a==null||a>=e)a=e,d=true;var f=i[c];i[c]||(f=i[c]={});var g=f[a];g||(b?g=null:g=f[a]=new this({level:a})),g.detachPopup(),d&&a>0&&g.attachToPopup(h[c].peek());return g},a.clearAll=function(a){var b=h[this.prototype._objectType];b=b[a||0],b&&b.hide()},a.clearAllPopups=function(a){for(var b in j)(!a||!a[b])&&j[b].hide()},b._createElement=function(){var b=this._parent;this._parent=null,a.BASE._createElement.call(this);var c=this.getElement();this.parent=b,this.display(false),document.body.appendChild(c),this._shadows&&!is_ie6?(c.appendChild(DlElementCache.get("SHADOWS")),e(c,typeof this._shadows=="string"?this._shadows:"ThinShadows")):(this._shadows=false,e(c,this._objectType+"-noShadow")),is_gecko&&(c=d("div",null,{className:"Gecko-Bug-302380"},c)),this.refNode("_contentEl",d("div",null,{className:"DlPopup-scrollArea"},c)),this.zIndex(this._zIndex)},b.getContentElement=function(){return this._contentEl},b.getScrollDiv=b.getContentElement,b._scrollSetArrowState=function(){var a=this.getScrollDiv(),b=this._scroll_el(0),c=this._scroll_el(1),d=a.scrollTop==0,e=a.scrollTop+a.offsetHeight==a.scrollHeight;(d||e)&&this._scrollStopHandler(),g(b,d,"DlPopup-scrollUp-disabled"),g(c,e,"DlPopup-scrollDown-disabled")};function l(a){this.getScrollDiv().scrollTop+=this._scrollStep*a,this._scrollSetArrowState()}function m(a,b){a._scrollStep=a._oscroll.step1,a._scrollTimer=setInterval(l.$(a,b),a._oscroll.speed),e(this,"DlPopup-scroll-hover"),g(this,b>0,"DlPopup-scrollDown-hover","DlPopup-scrollUp-hover")}b._scrollStopHandler=function(){this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null,this._scrollSetArrowState()),f(this._scroll_el(0),k),f(this._scroll_el(1),k)},b._scrollDoubleSpeed=function(a){this._scrollStep=this._oscroll[a?"step2":"step1"];return false},b._scroll_setup=function(){if(!this._hasScrolling){this._hasScrolling=true;var a=this.getElement(),b=d("div",null,{className:"DlPopup-scrollUp"},a,0),c=d("div",null,{className:"DlPopup-scrollDown"},a);b.onmouseover=m.$(null,this,-1),c.onmouseover=m.$(null,this,1),b.onmouseout=c.onmouseout=this._scrollStopHandler.$(this),b.onmousedown=c.onmousedown=this._scrollDoubleSpeed.$(this,true),b.onmouseup=c.onmouseup=this._scrollDoubleSpeed.$(this,false),this.refNode("_scrollEl0",b),this.refNode("_scrollEl1",c),this.getScrollDiv().onscroll=this._scrollSetArrowState.$(this)}this._scroll_visibile(true)},b._scroll_el=function(a){return this["_scrollEl"+a]},b._scroll_visibile=function(a){this._hasScrolling&&(is_gecko&&(this.getScrollDiv().parentNode.style.overflow=a?"auto":""),this._scroll_el(1).style.display=this._scroll_el(0).style.display=a=a?"":"none",this.args.scrollVisible=!a)};function n(){h[this._objectType][this._level]=this;if(!this._autolink||this._level==0)j[this.id]=this}function o(){var a=h[this._objectType],b=a[this._level+1];b&&b.hide(),a.splice(this._level,1),j[this.id]&&delete j[this.id]}function p(a){if(this.args.scrollVisible){var b=this.getScrollDiv(),c=b.scrollTop;a.wheelDelta<0?c+=20:(c-=20,c<0&&(c=0)),b.scrollTop=c,a.domStop=true,DlException.stopEventBubbling()}}var q=false;function r(b){var c=b.getObject(),d={};while(c&&!(c instanceof a))c.currentPopup&&(d[c.currentPopup.id]=true),c=c.parent;if(c)while(c!=null)d[c.id]=true,c=c._parentPopup;a.clearAllPopups(d)}b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onPopup:n,onMouseWheel:p,onHide:o}),q||(q=true,DlEvent.captureGlobal("onMouseDown",r))};function s(a){a.onBeforePopup&&a.onBeforePopup.call(this,a),this._timer=null;this.setContent(a.content)&&(a.onPopup&&a.onPopup.call(this,a),this.applyHooks("onPopup",[a]),this.showAt(a.anchor,a.align||this._align,a.pos,a.shift,a.fluid),this._prevFocus=DlEvent.focusedWidget(),this.focus())}b.popup=function(a){this.args=a,this.cancel(),a.timeout?this._timer=s.$(this,a).delayed(a.timeout):s.call(this,a)};function t(){if(this.visible){this.args&&this.args.onHide&&this.args.onHide.call(this,this.args);if(this._focusable&&this._prevFocus)try{this._prevFocus.focus()}catch(a){}this._timer=this.args=null,this.callHooks("onHide"),this.display(false),this.visible=false}}b.hide=function(a){this.cancel(),a?this._timer=t.$(this).delayed(a):t.call(this)},b.cancel=function(){this._timer&&(clearTimeout(this._timer),this._timer=null)},b.correctPos=Function.noop,b.reposition=function(){this.visible&&this.showAt(this.args.anchor,this.args.align||this._align,this.args.pos,this.args.shift,this.args.fluid)},b.showAt=function(a,b,d,e,f){var g,h,i,j=this.getScrollDiv();b||(b=this._align),b=="mouse"?(d==null&&(d=Object.makeCopy(DlEvent.latestMouseEvent.pos)),g=d,this._mouseDiff&&(g.x+=this._mouseDiff.x,g.y+=this._mouseDiff.y),b={prefer:"__",fallX1:"_R",fallX2:"_L",fallY1:"B_",fallY2:"T_"}):(g=c.getPos(a),e&&(e.x&&(g.x+=e.x),e.y&&(g.y+=e.y))),i=c.getOuterSize(a),h=Object.makeCopy(g),this.visibility(false),j.style.height="",this._scroll_visibile(false),this.setPos(-3e4,-3e4),this.display(true),is_ie&&(this.getElement().style.width="");var k=this._bestPosition(b,h,i),l=k.height(),m=this.getScrollDiv().offsetHeight,n=this.getElement().offsetHeight-m;h=k.getTL();if(l<m)if(f)this.children(0).setSize({y:l});else{is_ie&&(this.getElement().style.width=j.offsetWidth+"px"),this._scroll_setup();var o=this._scroll_el(0).offsetHeight,p=this._scroll_el(1).offsetHeight;j.style.height=l-o-p-n+"px",this._scrollSetArrowState(),j.scrollTop=0}this.correctPos(h),this.setPos(h.x,h.y);if(this._parentPopup){var q=this._parentPopup.zIndex()+1;this.zIndex(q)}this.visibility(true),this.visible=true},b._bestPosition=function(a,b,d){var e=c.getWindowSize(),f=new DlRect(0,0,e.x,e.y),g=new DlPoint(b);e=this.getSize(),this._doAlign(a.prefer,g,d);var h=(new DlRect(g,e)).intersect(f),i=this.checkXPos(g,f),j=this.checkYPos(g,f);if(i==0&&j==0)return h;if(i!=0){g.x=b.x,this._doAlign(a.fallX1,g,d);var k=(new DlRect(g,e)).intersect(f);g.x=b.x,this._doAlign(a.fallX2,g,d);var l=(new DlRect(g,e)).intersect(f);k&&l?g=k.area()>l.area()?k.getTL():l.getTL():k?g=k.getTL():l&&(g=l.getTL()),this.args.fallX=true}if(j!=0){g.y=b.y,this._doAlign(a.fallY1,g,d);var m=(new DlRect(g,e)).intersect(f);g.y=b.y,this._doAlign(a.fallY2,g,d);var n=(new DlRect(g,e)).intersect(f);m&&n?g=m.area()>n.area()?m.getTL():n.getTL():m?g=m.getTL():n&&(g=n.getTL()),this.args.fallY=true}return(new DlRect(g,e)).intersect(f)},b._doAlign=function(a,b,c){var d=this.getSize(),e=a.substr(0,1),f="";a.length>1&&(f=a.substr(1,1));switch(e){case"T":b.y-=d.y,this._mouseDiff&&this.args.align=="mouse"&&(b.y-=2*this._mouseDiff.y);break;case"B":b.y+=c.y,this._mouseDiff&&this.args.align=="mouse"&&(b.y+=2*this._mouseDiff.y);break;case"C":case"c":b.y+=(c.y-d.y)/2;break;case"t":b.y+=c.y-d.y;break;case"b":}switch(f){case"L":b.x-=d.x,this._mouseDiff&&this.args.align=="mouse"&&(b.x-=2*this._mouseDiff.x);break;case"R":b.x+=c.x,this._mouseDiff&&this.args.align=="mouse"&&(b.x+=2*this._mouseDiff.x);break;case"C":case"c":b.x+=(c.x-d.x)/2;break;case"l":b.x+=c.x-d.x;break;case"r":}},b.checkXPos=function(a,b){if(a.x<b.x)return a.x-b.x;var c=this.getSize(),d=a.x+c.x-b.x-b.w;return d>0?d:0},b.checkYPos=function(a,b){if(a.y<b.y)return a.y-b.y;var c=this.getSize(),d=a.y+c.y-b.y-b.h;return d>0?d:0},b.attachToPopup=function(a){this._parentPopup=a,a._childPopup=this},b.detachPopup=function(){this._parentPopup&&(this._parentPopup._childPopup=null),this._parentPopup=null},b.getToplevelPopup=function(){var a=this;while(a._parentPopup)a=a._parentPopup;return a},b._handle_focusKeys=function(a){if(!a.altKey&&!a.ctrlKey)if(a.keyCode==DlKeyboard.ESCAPE)this.hide();else if(a.keyCode==DlKeyboard.TAB){var b=a.focusedWidget;b=a.shiftKey?this.getPrevFocusWidget(b):this.getNextFocusWidget(b),b&&b.focus(),a.domStop=true,DlException.stopEventBubbling()}this._handleKeybinding(a)}}),DEFINE_CLASS("DlVbox",DlBox,function(a,b,c){var d=c.createElement;b.createCellElement=function(){return d("td",null,{className:"cell"},d("tr",null,{className:"row"},this._tbody))},b._removeWidgetElement=function(a){if(this._widgets.contains(a)){var b=a.getElement();b.parentNode.parentNode.parentNode.removeChild(b.parentNode.parentNode)}}});function DlMenuBase(){if(!this._isMenuBase){this._isMenuBase=true,this._items=[];var a=this;function b(b,c,d){var e=d?d.widget:null;this._noClose||DlPopupMenu.clearAll(),a.applyHooks.delayed(1,a,"onSelect",[this.name,this,e])}var c=this.appendWidget;this.appendWidget=function(a){a instanceof DlMenuItem&&(this._items.push(a),a.name!=null&&a.addEventListener("onSelect",b)),c.apply(this,Array.$(arguments))},this.getItemByName=function(a){return this._items.grep_first(function(b){return b.name&&b.name==a})},this.getItemById=function(a){return this._items.grep_first(function(b){return b.__itemId&&b.__itemId==a})},this instanceof DlHbox?this._popupAlign={prefer:"Br",fallX1:"_r",fallX2:"_l",fallY1:"B_",fallY2:"T_"}:this._popupAlign={prefer:"bR",fallX1:"_R",fallX2:"_L",fallY1:"b_",fallY2:"t_"},this._getDlPopup=function(){var a=this.getParent(DlPopupMenu),b=0,c;a&&(b=a._level+1),c=DlPopupMenu.get(b),c.detachPopup(),a&&c.attachToPopup(a);return c},this.getToplevelMenu=function(){var a=this;while(a.parentMenu)a=a.parentMenu;return a}}}DEFINE_CLASS("DlPopupMenu",DlPopup,function(a,b){a.CONSTRUCT=function(){this._mouseDiff={x:2,y:1}};function c(){this.cancel();var a=this.args}a.onBeforePopup=function(a){a.isContext?a.widget.activateSubmenu&&a.widget.activateSubmenu(true):(a.item.currentPopup=this,a.menu._popupVisible=a.item._popupVisible=true,a.item.activateSubmenu(true));var b=a.content;b instanceof Function&&(a.content=b=b.call(this)),b.parentMenu=a.isContext?a.widget:a.menu,b instanceof DlWidget&&b.hasHooks("onPopup")&&b.applyHooks("onPopup",[a])},a.onHide=function(a,b){if(a.isContext)a.widget.activateSubmenu&&a.widget.activateSubmenu(false);else{a.item.activateSubmenu(false),a.item.currentPopup=null,a.menu._popupVisible=a.item._popupVisible=false;var c=a.content;c instanceof DlWidget&&c.hasHooks("onHide")&&c.applyHooks("onHide",[a]),c.parentMenu=null}b&&b.call(this,a)},b.popup=function(b){b.onBeforePopup||(b.onBeforePopup=a.onBeforePopup),b.onHide?b.onHide=a.onHide.$(this,b,b.onHide):b.onHide=a.onHide,a.BASE.popup.call(this,b)},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onMouseEnter:c})},b.correctPos=function(a){var b=this.args;try{if(!b.isContext&&!b.scrollVisible){var c=b.menu;if(c&&c instanceof DlVMenu){var d=b.content._widgets[0].getPos().y-b.content.parent.getElement().offsetTop;Math.abs(d)<50&&(b.fallY?a.y+=d:a.y-=d)}}}catch(a){}}}),DEFINE_CLASS("DlHMenu",DlHbox,function(a,b){a.CONSTRUCT=DlMenuBase,a.DEFAULT_EVENTS=["onSelect","onPopup"]}),DEFINE_CLASS("DlVMenu",DlVbox,function(a,b){a.CONSTRUCT=DlMenuBase,a.DEFAULT_EVENTS=["onSelect","onPopup"]}),DEFINE_CLASS("DlMenuItem",DlContainer,function(a,b,c){a.CONSTRUCT=function(){this.parentMenu||(this.parentMenu=this.parent)},a.DEFAULT_EVENTS=["onSelect"],a.DEFAULT_ARGS={label:["label","DlMenuItem"],_iconClass:["iconClass",null],_noClose:["noClose",false],parentMenu:["menu",null],name:["name",null],__itemId:["id",null]},b._inBaseMenu=function(){return!this.parentMenu.parentMenu},b._createElement=function(){a.BASE._createElement.call(this);var b=this.getElement();b.innerHTML="<div class=\"div1\"><div class=\"div2\"></div></div>",this.setIconClass(this._iconClass),this._iconClass=null,this.setUnselectable(),this.label&&this.setContent(this.label)},b.getContentElement=function(){return this.getElement().firstChild.firstChild},b._getDlPopup=function(){return this.parentMenu._getDlPopup()};function d(){this.scrollIntoView(),this.addClass("DlMenuItem-hover","DlMenuItem-active");var a=this._inBaseMenu();if(!a||this.parentMenu._popupVisible)this._menu?this._popupMenu(a?0:250):a&&this._getDlPopup().hide(100)}function e(){this.delClass("DlMenuItem-hover"),this.delClass("DlMenuItem-active");var a=this._inBaseMenu();a||this._getDlPopup().hide(100)}function f(){this.delClass("DlMenuItem-active");if(this.hasHooks("onSelect")){var a=DlPopupMenu.get(0).args;this._noClose||DlPopupMenu.clearAll(),this.applyHooks.delayed(1,this,"onSelect",[this.name,this,a])}}function g(){this.addClass("DlMenuItem-active"),this._popupMenu(0),DlException.stopEventBubbling()}function h(){this._menu instanceof DlWidget&&(this._menu.destroy(),this._menu=null)}b._popupMenu=function(a){if(this._menu&&!this._popupVisible){var b=this.parentMenu,c=this._getDlPopup();c.visible&&c.hide(),c.popup({timeout:a,content:this.getMenu(),anchor:this.getElement(),align:b._popupAlign,item:this,menu:this.parentMenu,onPopup:this._onPopup,onHide:this._onHide})}},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onMouseEnter:d,onMouseLeave:e,onMouseDown:g,onMouseUp:f,onDestroy:h})},b.getMenu=function(){return this._menu},b.setMenu=function(a,b,d){this._menu instanceof DlWidget&&this._menu.destroy(),a instanceof DlWidget&&a.ref(),this._menu=a,this._onPopup=b,this._onHide=d,c.condClass(this.getElement().firstChild,a,"DlMenuItem-withPopup")},b.activateSubmenu=function(a){this.condClass(a,"DlMenuItem-popped")}}),DEFINE_CLASS("DlButtonMenu",DlHbox,function(a,b){a.CONSTRUCT=DlMenuBase,a.DEFAULT_EVENTS=["onSelect","onPopup","onHide","onClick"],a.DEFAULT_ARGS={label:["label",null],_iconClass:["iconClass",null],_shiftMenu:["shiftMenu",null],_connected:["connected",false]},b.ALIGN={prefer:"Br",fallX1:"_r",fallX2:"_l",fallY1:"B_",fallY2:"T_"},b.activateSubmenu=function(a){this._mainBtn.condClass(a,"DlButton-1"),this._menuBtn.condClass(a,"DlButton-1")},b._createElement=function(){a.BASE._createElement.call(this),this._mainBtn=new DlButton({parent:this,focusable:false,label:this.label,className:"LabelPart",noCapture:this._connected,iconClass:this._iconClass}),this._mainBtn.connectEvents("onClick",this),this._menuBtn=new DlButton({parent:this,focusable:false,label:"&nbsp;",className:"MenuArrow",noCapture:true}),this._menuBtn.getElement().parentNode.style.width="3px",this._menuBtn.getContentElement().className="MenuArrow-inner",this._connected&&this._mainBtn.connectEvents("onMouseDown",this._menuBtn),this._mainBtn.connectEvents(["onMouseEnter","onMouseLeave"],this._menuBtn),this._menuBtn.addEventListener("onMouseDown",this._do_popupMenu.$(this)),this.addEventListener("onDestroy",this.setMenu.$(this,null))},b._do_popupMenu=function(a){if(!this._popupVisible){var b=this._getContextMenuPopup();b.popup({timeout:0,content:this.getMenu(),align:this.ALIGN,anchor:this.getTableElement(),isContext:true,widget:this,shift:this._shiftMenu,onHide:this.callHooks.$(this,"onHide")}),a instanceof DlEvent&&(a._justFocusedWidget=b),this.callHooks("onPopup")}},b.getMenu=function(){return this._menu},b.getButton=function(){return this._mainBtn},b.getArrow=function(){return this._menuBtn},b.setMenu=function(a){this._menu instanceof DlWidget&&this._menu.destroy(),a instanceof DlWidget&&a.ref(),this._menu=a}});var DlElementCache={get:function(a){return this[a].cloneNode(true)}};(function(){var a=DynarchDomUtils.createElement,b=Dynarch.ID,c=DlElementCache;(function(){var b=document.createDocumentFragment();a("td",null,null,a("tr",null,null,a("tbody",null,null,b))),c.TBODY_RC=b})(),function(){var b=document.createDocumentFragment();a("div",null,{className:"Shadow Shadow-TL"},b),a("div",null,{className:"Shadow Shadow-T"},b),a("div",null,{className:"Shadow Shadow-TR"},b),a("div",null,{className:"Shadow Shadow-L"},b),a("div",null,{className:"Shadow Shadow-R"},b),a("div",null,{className:"Shadow Shadow-BL"},b),a("div",null,{className:"Shadow Shadow-B"},b),a("div",null,{className:"Shadow Shadow-BR"},b),c.SHADOWS=b}(),function(){var b=a("tr"),d=a("td",null,null,b);(6).times(function(){b.appendChild(d.cloneNode(true))}),c.CAL_HEAD=a("thead"),c.CAL_HEAD.appendChild(b.cloneNode(true));var e=c.CAL_BODY=a("tbody");(6).times(function(){e.appendChild(b.cloneNode(true))})}(),c.DRAGGING_LINE=a("div",null,{className:"DlResizeBar-DraggingLine"})})(),DEFINE_CLASS("DlCalendar",DlWidget,function(a,b,c){var d=c.createElement,e=c.addClass,f=c.delClass,g=c.condClass;a.FIXARGS=function(a){a.tagName="table",this._dayNamesOn=-1,this._selectedDate=a.date&&a.selected?a.date.getDate():0},a.CONSTRUCT=function(){this._noinit||this.init()},a.DEFAULT_EVENTS=["onSelect","onChange","onRendered"],a.DEFAULT_ARGS={firstDay:["firstDay",Date.getFirstDayOfWeek()],fixedFirstDay:["fixedFirstDay",true],_weekNumbers:["weekNumbers",false],date:["date",null],selected:["selected",true],_navigation:["navigation",2],_navDisabled:["navDisabled",false],_omDisabled:["omDisabled",false],_noinit:["noinit",false],_withMenu:["withMenu",false],_disableHandler:["disableHandler",Function.returnFalse],_cal_tooltip:["dayTooltip",null],_infoDates:["infoDates",null],__tooltip:["tooltip",m]},b._createElement=function(){a.BASE._createElement.call(this);var b,c,e,f,g=this.getElement(),h=DlElementCache.get("CAL_BODY");g.cellSpacing=g.cellPadding=g.border=0,g.appendChild(DlElementCache.get("CAL_HEAD")),g.appendChild(h);if(this._weekNumbers)for(b=g.getElementsByTagName("tr"),c=b.length;--c>=0;)e=b[c],f=d("td",null,{className:"DlCalendar-WeekNumber"}),e.insertBefore(f,e.firstChild);e=d("tr"),f=d("td",null,null,e),e.className="DlCalendar-Navigation";if(this._navigation==0)f.colSpan=this.getNCols(),this._makeNavPart(f,0);else{var i=d("td",null,null,e),j=d("td",null,null,e);if(this._navigation==1)i.colSpan=this.getNCols()-2,this._makeNavPart(i,0,f,-1,j,1);else if(this._navigation==2){var k=d("td",null,null,e),l=d("td",null,null,e);j.colSpan=this.getNCols()-4,this._makeNavPart(j,0,f,-2,i,-1,k,1,l,2)}}c=g.rows[0],c.parentNode.insertBefore(e,c),this.setUnselectable(),this._withMenu&&this._createQuickNavMenu()};var h=null;function i(){if(!h){h=new DlVMenu({}),h.setStyle("textAlign","center"),new DlMenuItem({parent:h,label:DlTEXTS.goToday,name:"today",noClose:true}),h.addSeparator();var a=new DlSpinner({parent:h,size:4});a.addEventListener("onChange",function(){a.validationError||h.calendar.setYear(a.getValue())}),a.getElement().align="center",h.addSeparator(),(12).times(function(a){new DlMenuItem({parent:h,label:Date.getMonthName(a),name:a,noClose:true})}),h.addEventListener("onPopup",function(b){this.calendar=b.widget,a.setValue(this.calendar.date.getFullYear()),a.focus.$(a).delayed(5)}),h.addEventListener("onSelect",function(b){b=="today"?this.calendar.setToday():(this.calendar.setMonth(b),this.calendar.setYear(a.getValue())),h.getParent(DlPopup).hide()})}return h}b._createQuickNavMenu=function(){this.setContextMenu(i)},b._makeNavPart=function(){for(var a,b,c=0;c<arguments.length;++c){a=arguments[c++];switch(a._navType=b=arguments[c]){case-2:a.className="PrevYear";break;case-1:a.className="PrevMonth";break;case 0:a.className="Month",this.refNode("_monthTD",a);break;case 1:a.className="NextMonth";break;case 2:a.className="NextYear"}}},b.getNCols=function(){return this._weekNumbers?8:7},b.getTableElement=function(){return this.getElement()},b._displayDayNames=function(){var a,b=new Date,c=b.getDay(),d=this.getTableElement().getElementsByTagName("tr")[1],e=this._weekNumbers?1:0,f=this.firstDay;d.className="DlCalendar-DayNames";while(a=d.cells[e++])a._firstDay=f%7,g(a,f==c,"Today"),a.innerHTML=Date.getDayName(f++,true),g(a,Date.isWeekend(a._firstDay),"WeekEnd");this._dayNamesOn=this.firstDay,this._weekNumbers&&(a=d.cells[0],a.innerHTML="w",a._week=-1,a.className="WeekNumber")},b._displayCalendar=function(){var a=new Date,b=a.getFullYear(),c=a.getMonth(),d=a.getDate();this._selectedTD=null,this._dayNamesOn!=this.firstDay&&this._displayDayNames();var e=new Date(this.date);e.setHours(12);var f=e.getMonth(),g=e.getDate(),h=e.getFullYear(),i=e.getMonthDays();this._monthTD.innerHTML=String.buffer("<b>",Date.getMonthName(f,this._navigation==2),"</b> ",h).get(),e.setDate(1);var j=(e.getDay()-this.firstDay)%7;j<0&&(j+=7),e.setDate(-j),e.setDate(e.getDate()+1);for(var k=this.getTableElement().rows[2],l=this._cells=[],m=this._displayedInterval={},n,o=0;o<6;++o,k=k.nextSibling){k.className="Dates";var p=k.firstChild;this._weekNumbers&&(p.className="WeekNumber",p.innerHTML=p._week=e.getWeekNumber(),p=p.nextSibling);for(var q,r=0;r<7;++r,p=p.nextSibling,e.setDate(q+1)){var s=e.getDay(),t=[];p._iday=q=e.getDate(),p._month=e.getMonth(),p._year=e.getFullYear(),p._info=null,n={y:p._year,m:p._month,d:p._iday};if(this._infoDates){var u=n.y+"-"+(1+n.m).zeroPad(2)+"-"+n.d.zeroPad(2),v=this._infoDates[u];v&&(p._info=v,t.push(v.className||"DlCalendar-infoDay"))}m.start||(m.start=n),(p._otherMonth=f!=n.m)?(t.push("OtherMonth"),l[q+(q>15?100:200)]=p):(f==c&&q==d&&b==n.y&&t.push("Today"),this._selectedDate==q&&(this._selectCell(p),t.push("Selected")),l[q]=p),(s==0||s==6)&&t.push("WeekEnd"),p.disabled=this._disableHandler(e,t,p),p.innerHTML=this.getDayHTML(q),p.className=t.join(" ")}}m.end=n,this.applyHooks("onRendered",[this])},b.getDayHTML=Function.identity,b.getDateCell=function(a){return this._cells[a]},b.getDisplayedInterval=function(){return this._displayedInterval},b.selectDate=function(a,b){a instanceof Date&&(a.dateEqualsTo(this.date,true)||(this.date=new Date(a),this.init()),a=a.getDate()),this._selectCell(this.getDateCell(a),!b)},b.clearSelection=function(){this._selectedDate=null,this._initialized&&this._displayCalendar()};function j(a){this._clearTimer();var b=a.getParentElement("td",this);if(b){this._currentHover&&(f(this._currentHover,"hover"),f(this._currentHover,"rolling"),this._currentHover=null,DlWidget.getTooltip().hide());if(b._navType!=null&&this._navDisabled)return;if(b._otherMonth&&this._omDisabled)return;if(b._firstDay!=null&&this.fixedFirstDay||b._week!=null)return;if(b.disabled)return;e(b,"hover"),this._currentHover=b,this.__tooltip&&this._popupTooltip()}}function k(a){this._clearTimer(),this._currentHover&&(f(this._currentHover,"hover"),f(this._currentHover,"rolling"),this._currentHover=null)}b.setYear=function(a){a!=this.date.getFullYear()&&(this.date.setFullYear(a),this.init())},b.setMonth=function(a){a!=this.date.getMonth()&&(this.date.setMonth(a),this.init())},b.setToday=function(){var a=new Date;this._selectedDate=0,this.date=a,this.init()},b._navCellClicked=function(a,b,c){e(a,"rolling"),this._selectedDate=0;var d=this.date;a._navType!=0&&d.setDate(1);switch(a._navType){case 0:if(this._withMenu)this.applyHooks("onContextMenu",[c]);else{var f=new Date;if(d.dateEqualsTo(f,true))return;this.date=f}break;case-2:d.setFullYear(d.getFullYear()-1);break;case-1:d.setMonth(d.getMonth()-1);break;case 1:d.setMonth(d.getMonth()+1);break;case 2:d.setFullYear(d.getFullYear()+1)}this.init(),this.applyHooks("onChange",[a._navType]),this.applyHooks("onSelect",[true,a._navType,null,d]),b&&a._navType!=0&&(++this._timerStep,this._timer=setTimeout(this._navCellClicked.$(this,a,this._timerStep>4?50:100),b))},b._clearTimer=function(){this._timer&&clearTimeout(this._timer),this._timer=null,this._timerStep=0};function l(a){j.call(this,a);var b=a.getParentElement("td",this);if(b){if(a.button!=0&&(b._navType!=null||b._otherMonth))return;if(b._otherMonth&&this._omDisabled||b.disabled)return;if(b._navType!=null&&a.dl_type=="onMouseDown")this._navDisabled||this._navCellClicked(b,b._navType!=0?350:0,a);else if(b._year!=null&&a.dl_type=="onMouseUp"){var c=this.date;c.setFullYear(b._year,b._month,b._iday);var d=this._selectedDate;this._selectedDate=b._iday,b._otherMonth?(this.init(),this.applyHooks("onSelect",[false,true,false,c])):d!=this._selectedDate?this._selectCell(b,true):this.applyHooks("onSelect",[false,false,true,c])}else b._firstDay!=null&&!this.fixedFirstDay&&a.button==0&&a.dl_type=="onMouseDown"&&(this.firstDay=b._firstDay,this._displayCalendar())}}b._selectCell=function(a,b){this._selectedDate=a._iday,this._selectedTD&&(f(this._selectedTD,"Selected"),f(this._selectedTD.parentNode,"Selected")),this._selectedTD=a,e(a,"Selected"),e(a.parentNode,"Selected"),f(a,"hover"),b&&this.applyHooks("onSelect",[false,false,false,this.date])},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onMouseOver:j,onMouseLeave:k,onMouseUp:l,onMouseDown:l})},b.setInfoDates=function(a){this._infoDates=a,this._initialized&&this._displayCalendar()};function m(){var a=this.args.widget,b,c;(c=a._currentHover)&&(b=c._info);return(c=a._cal_tooltip)?c.call(a,b):b?b.tooltip:null}b.init=function(){this.date||(this.date=new Date),this._displayCalendar(),this._initialized=true},b.setSize=b.setOuterSize=function(b){a.BASE.setOuterSize.call(this,{x:b.x!=null?b.x+2:null,y:b.y})}}),DEFINE_CLASS("DlButtonCalendar",DlButtonMenu,function(a,b){a.DEFAULT_ARGS={dateFormat:["dateFormat","%Y/%m/%d"],_calendarArgs:["calendar",{}],_iconClass:["iconClass","IconCalendar"],date:["date","Select date..."]},a.DEFAULT_EVENTS=["onSelect","onCalendarRendered"];function c(a,b,c){b||(this.getButton().setContent(a.date.print(this.dateFormat)),DlPopup.clearAllPopups(),this.date=new Date(a.date),this.applyHooks("onSelect",[this.date]))}function d(a){if(this.date instanceof Date){var b=this.getCalendar();b.date.dateEqualsTo(this.date)||(b.date=new Date(this.date),b._selectedDate=this.date.getDate(),b.init())}this.getArrow().applyHooks("onMouseDown",[a])}b.getCalendar=function(){var a=this._calendar;a||(this._calendarArgs.noinit=true,a=this._calendar=new DlCalendar(this._calendarArgs),this.addEventListener("onDestroy",a.destroy.$(a)),a.addEventListener("onSelect",c.$(this,a)),a.connectEvents("onRendered",this,"onCalendarRendered"),this.date instanceof Date&&(a.date=new Date(this.date)),a.init());return this._calendar},b.initDOM=function(){a.BASE.initDOM.call(this);var b=this.getButton();this.date instanceof Date?b.label(this.date.print(this.dateFormat)):b.label(this.date),this.setMenu(this.getCalendar.$(this)),b.addEventListener("onClick",d.$(this))},b.getValue=function(){return this.date instanceof Date?this.date:null}}),DEFINE_CLASS("DlButtonColorPicker",DlButtonMenu,function(a,b,c){a.CONSTRUCT=function(){this._events_cp={onSelect:d.$(null,this),onHueChange:f.$(null,this),onHover:e.$(null,this),onHoverOut:g.$(null,this)},this._updateValues()},a.DEFAULT_ARGS={rgb:["rgb",null],hsv:["hsv",null],color:["color",null]};function d(a,b,c,d,e){var f=a.getColorElement();f.style.backgroundColor=d,a.hsv=Array.$(c),a._updateValues(),DlPopup.clearAllPopups(),a.applyHooks("onSelect",[b,c,d,e])}function e(a,b,c,d,e){a.getColorElement().style.backgroundColor=d}function f(a,b){if(a.hsv){var c=[b,a.hsv[1],a.hsv[2]],d=DlColor.RGB2color(DlColor.HSV2RGB(c));a.getColorElement().style.backgroundColor=d,a.hsv=c,a._updateValues()}}function g(a){var b=a.getColorElement();b.style.backgroundColor=a.rgb?DlColor.RGB2color(a.rgb):""}b._updateValues=function(){this.hsv?(this.rgb=DlColor.HSV2RGB(this.hsv),this.color=DlColor.RGB2color(this.rgb)):this.rgb?(this.hsv=DlColor.RGB2HSV(this.rgb),this.color=DlColor.RGB2color(this.rgb)):this.color&&(this.rgb=DlColor.color2RGB(this.color),this.hsv=DlColor.RGB2HSV(this.rgb))};function h(){this._cp.addEventListener(this._events_cp),this.hsv&&this._cp.setHSV(this.hsv)}function i(){this._cp.removeEventListener(this._events_cp)}b.setColorPicker=function(a){this._cp=a,this.setMenu(a),this.hsv&&(a.setHSV(this.hsv),d.call(a,this,this.rgb,this.hsv,DlColor.RGB2color(this.rgb),DlColor.RGBrightness(this.rgb)))},b._createElement=function(){a.BASE._createElement.call(this);var b=this.getButton().setContent(["<table cellspacing='0' cellpadding='0'><tr><td>","<div unselectable='on' class='ColorPart'>&nbsp;</div>","</td><td></td></tr></table>"].join(""));this.setLabel(this.label)},b.setLabel=function(a){var b=this.getLabelElement();b.innerHTML=a||"",c.condClass(b,a,"Label","EmptyLabel")},b.getColorElement=function(){return this.getButton().getContentElement().firstChild.rows[0].cells[0].firstChild},b.getLabelElement=function(){return this.getButton().getContentElement().firstChild.rows[0].cells[1]},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onPopup:h,onHide:i})}}),DEFINE_CLASS("DlCheckbox",DlAbstractButton,function(a,b){a.DEFAULT_ARGS={_classes:["classes",{active:"DlCheckbox-active",hover:"DlCheckbox-hover",checked:"DlCheckbox-1",unchecked:"DlCheckbox-0",empty:"DlCheckbox-empty",disabled:"DlCheckbox-disabled"}]},a.FIXARGS=function(a){a.type=DlButton.TYPE.TWOSTATE}});var DlColor={RGB2HSV:function(a){var b=a[0],c=a[1],d=a[2],e,f,g,h,i,j;e=Math.min(b,c,d),g=(j=f=Math.max(b,c,d))-e,f!=0?(i=g/f,b==f?h=(c-d)/g:c==f?h=2+(d-b)/g:h=4+(b-c)/g,h*=60,h<0&&(h+=360)):(i=0,h=-1);return[h,i,j]},HSV2RGB:function(a){var b=a[0],c=a[1],d=a[2],e,f,g,h,i,j,k,l;if(c==0)f=g=h=d;else{b/=60,e=Math.floor(b),i=b-e,j=d*(1-c),k=d*(1-c*i),l=d*(1-c*(1-i));switch(e){case 0:f=d,g=l,h=j;break;case 1:f=k,g=d,h=j;break;case 2:f=j,g=d,h=l;break;case 3:f=j,g=k,h=d;break;case 4:f=l,g=j,h=d;break;default:f=d,g=j,h=k}}return[f,g,h]},RGB2bytes:function(a){var b=new Array(3);b[0]=Math.round(a[0]*255),b[1]=Math.round(a[1]*255),b[2]=Math.round(a[2]*255);return b},RGB2color:function(a){return String.buffer("rgb(",a[0]*100,"%,",a[1]*100,"%,",a[2]*100,"%)").get()},RGB2hex:function(a){a=DlColor.RGB2bytes(a);return a[0].hex(2)+a[1].hex(2)+a[2].hex(2)},color2RGB:function(a){var b=0,c=0,d=0;if(/^#/.test(a))a.length==4&&(a=a.replace(/([a-f0-9])/ig,"$1$1")),b=parseInt(a.substr(1,2),16)/255,c=parseInt(a.substr(3,2),16)/255,d=parseInt(a.substr(5,2),16)/255;else throw new DlException("Can't parse color: "+a);return[b,c,d]},brighter:function(a){var b=Array.$(a);b[1]-=.5,b[1]<0&&(b[1]=0);return b},darker:function(a){var b=Array.$(a);b[2]-=.5,b[2]<0&&(b[2]=0);return b},RGBrightness:function(a){return(a[0]*299+a[1]*587+a[2]*114)/1e3}};DEFINE_CLASS("DlColorPickerHSV",DlWidget,function(a,b,c){var d=c.delClass,e=c.condClass;a.DEFAULT_EVENTS=["onSelect","onHover","onHoverOut","onHueChange"];var f=String.buffer("<table cellspacing='1' cellpadding='0' border='0'>","<tbody>","<tr>","<td></td>".repeat(11),"<td rowspan='11' class='DlColorPickerHSV-Sep'></td>","<td rowspan='11' class='DlColorPickerHSV-HSV' hueCell='1'>","<div class='DlColorPickerHSV-HSV-bar'></div>","</td>","</tr>",("<tr>"+"<td></td>".repeat(11)+"</tr>").repeat(10),"</tbody></table>").get();b.getHueBarElement=function(){return this.getElement().rows[0].cells[12].firstChild},b._createElement=function(){a.BASE._createElement.call(this,f),this.setUnselectable()};function g(a){var b=a.target;try{while(b&&b.tagName.toLowerCase()!="td")b=b.parentNode}catch(a){b=null}return b}function h(a){var b=g(a);if(b){b.rgb&&this.applyHooks("onSelect",[b.rgb,b.hsv,b.style.backgroundColor,DlColor.RGBrightness(b.rgb)]);throw new DlExStopEventBubbling}}function i(a){var b=g(a);if(b){var c=b.getAttribute("hueCell");c&&(a.computePos(this),this._refresh(a),DlEvent.captureGlobals(this._dragHandlers));throw new DlExStopEventBubbling}}function j(a){this._currentHover&&(d(this._currentHover,"hover1"),d(this._currentHover,"hover2"));var b=g(a);if(b)if(b.rgb){this._currentHover=b;var c=DlColor.RGBrightness(b.rgb);e(b,c>.6,"hover2","hover1"),this.applyHooks("onHover",[b.rgb,b.hsv,b.style.backgroundColor,c])}else this._currentHover&&(this.callHooks("onHoverOut"),this._currentHover=null)}function k(){var a=this._currentHover;a&&(d(a,"hover1"),d(a,"hover2"),this.callHooks("onHoverOut")),this._currentHover=null}function l(a){DlEvent.releaseGlobals(this._dragHandlers);throw new DlExStopEventBubbling}function m(a){var b=a.computePos(this),c=b.y-2;c<0?c=0:c>119&&(c=119),this.getHueBarElement().style.top=c+"px",this.__cphsvTimeout&&clearTimeout(this.__cphsvTimeout),this.__cphsvTimeout=this._refresh.$(this,a).delayed(5);throw new DlExStopEventBubbling}b.initDOM=function(){a.BASE.initDOM.call(this),this.addEventListener({onMouseUp:h,onMouseDown:i,onMouseOver:j,onMouseLeave:k}),this._dragHandlers={onMouseMove:m.$(this),onMouseUp:l.$(this),onMouseOver:DlException.stopEventBubbling,onMouseOut:DlException.stopEventBubbling,onMouseEnter:DlException.stopEventBubbling,onMouseLeave:DlException.stopEventBubbling},this._redraw(360)},b._refresh=function(a){var b=Math.limit(a.relPos.y-2,0,119),c=Math.round((1-b/120)*360);c=this._redraw(c),this.applyHooks("onHueChange",[c]),this.__cphsvTimeout=null},b.setHSV=function(a){this._redraw(a[0])},b._redraw=function(a){var b,c,d,e,f=this.getHueBarElement(),g=this.getElement(),h=g.rows,i=h.length-1,j=h[0].cells.length-3;for(f.style.top=120-a/3+"px",a==360&&(a=0),b=i;b>=0;--b)for(e=h[b].cells,d=j;d>=0;--d)c=e[d],c.hsv=[a,1-b/i,d/j],c.rgb=DlColor.HSV2RGB(c.hsv),c.style.backgroundColor=DlColor.RGB2color(c.rgb);return a}}),DEFINE_CLASS("DlEntry",DlContainer,function(a,b,c){var d=c.createElement;a.FIXARGS=function(a){a.tagName="table",this._isTextArea=a.type=="textarea"},a.DEFAULT_EVENTS=["onChange","onKey-ENTER","onKey-ESCAPE","onValidationError","onValidation"],a.DEFAULT_ARGS={_domType:["type","text"],_value:["value",null],_size:["size",null],_rows:["rows",null],_readonly:["readonly",false],_emptyText:["emptyText",""],_emptyValue:["emptyValue",""],_width:["width",null],_name:["name",null],_validators:["validators",[]],_allowEmpty:["allowEmpty",null],_focusable:["focusable",2],_maxlen:["maxlength",null],_noSelect:["noSelect",false],_noWrap:["noWrap",false]},b.validate=function(a){a==null&&(a=this.getValue(true));if(this._allowEmpty!=null)if(!/\S/.test(a)){this.condClass(!this._allowEmpty,"DlEntry-ValidationError"),this.applyHooks("onValidation",[!this._allowEmpty]);return this._allowEmpty}var b=this._validators,c,d,e=false;for(c=0;c<b.length;++c){d=b[c];if(!d.ok(a)){e=d.getError()||true;break}}d&&!e&&this.setValue(d.getLastVal(),true),this.validationError=e,!this._noSelect&&this._focused&&!this.readonly()&&this._domType!="textarea"&&this.select(),this.condClass(e,"DlEntry-ValidationError"),this.applyHooks("onValidation",[e]),e&&(this.setInvalidTooltip(e.message),this.applyHooks("onValidationError",[e]));return!e},b.setInvalidTooltip=function(a){this._invalidTooltip.setTooltip(a)},b.timerFocus=function(a){return this.focus.clearingTimeout(a||10,this)},b.select=function(){try{is_gecko?this.setSelectionRange(0,this.getValue(true).length):this.getInputElement().select()}catch(a){}},b.focus=function(){this.getInputElement().focus(),!this._noSelect&&!this.readonly()&&this._domType!="textarea"&&this.select()},b.blur=function(){this.getInputElement().blur()};function e(){this.addClass("DlEntry-Focus"),this._focused=true,a.BASE.focus.call(this),this._isEmpty&&(this.getInputElement().value="",this.delClass("DlEntry-empty"),this._isEmpty=false)}function f(){this.delClass("DlEntry-Focus"),this._focused=false,a.BASE.blur.call(this),this.__setEmpty()}function g(){this.__setEmpty(),this.callHooks("onChange")}b.__setEmpty=function(a){a==null&&(a=this.getInputElement().value),this._isEmpty=this.__checkEmpty(a),this._isEmpty?this._focused?this.getInputElement().value=a:(this.addClass("DlEntry-empty"),this.getInputElement().value=""):this.delClass("DlEntry-empty");return this._isEmpty},b.__checkEmpty=function(a){a==null&&(a=this.getInputElement().value);return a===""},b._createElement=function(){a.BASE._createElement.apply(this,arguments);var b=this.getElement();b.appendChild(DlElementCache.get("TBODY_RC")),b.cellSpacing=b.cellPadding=b.border=0,b=b.rows[0].cells[0],b.className="DlEntry-cell";var c=this._isTextArea?document.createElement("textarea"):c=document.createElement("input");c.id=this.id+"-input",c.setAttribute("autocomplete","off",1),this._noWrap&&c.setAttribute("wrap","off"),this._isTextArea&&(this._rows&&(c.rows=this._rows)),this._maxlen!=null&&c.setAttribute("maxlength",this._maxlen);switch(this._domType){case"password":case"file":case"hidden":c.type=this._domType}is_gecko&&gecko_version<1.9&&!this._no_gecko_bug&&(b=d("div",null,{className:"Gecko-Bug-226933"},b)),b=d("div",{position:"relative",overflow:"hidden"},null,b),this._emptyText&&d("label",null,{htmlFor:this.id+"-input",className:"DlEntry-emptyText",innerHTML:this._emptyText.htmlEscape()},b),b.appendChild(c),this.refNode("_invalidTooltip",new DlWidget({className:"DlEntry-invalidIcon",parent:this,appendArgs:b}))},b.getInputElement=function(){return this.getElement().getElementsByTagName(this._isTextArea?"textarea":"input")[0]},b.getContentElement=b.getInputElement,b.setIfEmpty=function(a,b){this._isEmpty&&a&&this.setValue(a,b)},b.isEmpty=function(){return this.__checkEmpty()},b.setValue=function(a,b){this.__setEmpty(a)||(this._maxlen!=null&&(a=String(a).substr(0,this._maxlen)),this.getInputElement().value=a),b||this.callHooks("onChange")},b.clear=function(a){this.setValue("",a);return this},b.getValue=function(a){return!a&&this.isEmpty()?this._emptyValue:this.getInputElement().value},b.getSelectionRange=function(){return c.getSelectionRange(this.getInputElement())},b.setSelectionRange=function(a,b){c.setSelectionRange(this.getInputElement(),a,b)},b.moveEOF=function(){var a=this.getValue(true).length;this.setSelectionRange(a,a)},b.moveBOF=function(){this.setSelectionRange(0,0)},b.collapse=function(a){var b=this.getSelectionRange();b=a?b.start:b.end,this.setSelectionRange(b,b)};function h(){this.validate()}function i(a){this._isEmpty=false,a.keyCode==DlKeyboard.ENTER?this.applyHooks("onKey-ENTER",[a]):a.keyCode==DlKeyboard.ESCAPE&&this.applyHooks("onKey-ESCAPE",[a])}function j(){c.removeEvent(this.getInputElement(),{focus:this._on_element_focus,blur:this._on_element_blur,change:this._on_element_change})}b.initDOM=function(){a.BASE.initDOM.call(this);var b=this.getInputElement();c.addEvent(b,{focus:this._on_element_focus=e.$(this),blur:this._on_element_blur=f.$(this),change:this._on_element_change=g.$(this)}),this.addEventListener({onChange:h,onKeyPress:i,onDestroy:j}),this._value!=null?this.setValue(this._value,true):this.clear(true),this._width!=null?b.style.width=this._width:this._size!=null&&this.setSize({x:this._size*9+7-this._size}),this._name!=null&&(b.name=this._name),this.readonly(this._readonly)},b.readonly=function(a){var b=this.getInputElement();a!=null&&((b.readOnly=a)?b.setAttribute("readonly",true,1):b.removeAttribute("readonly"),this.condClass(a,"DlEntry-Readonly"));return b.getAttribute("readonly")},b.disabled=function(b,c){var d=a.BASE.disabled.call(this,b,c);b!=null&&(this.getInputElement().disabled=!!b);return d},b.setSize=b.setOuterSize=function(a){var b=this.getInputElement(),d=a.x,e=a.y,f=c.getPaddingAndBorder(this.getElement()),g=c.getPaddingAndBorder(b),h=this._btn?this._btn.getSize().x:0;h?c.setOuterSize(b,a.x-f.x-g.x-h+2):(d!=null&&(d-=g.x+4),e!=null&&(e-=g.y+4),this._domType!="textarea"&&(e=null),c.setInnerSize(b,d,e),d!=null&&(d+=8,c.setInnerSize(this.getElement(),d)))},b._makeButton=function(a,b,c,e){!e&&!c&&(c="DlEntry-dropDownBtn",e={hover:"DlEntry-dropDownBtn-hover",active:"DlEntry-dropDownBtn-active"});var f=d("td",null,null,this.getElement().rows[0]);return this._btn=new DlAbstractButton({parent:this,appendArgs:f,label:a,iconClass:b,className:c,classes:e})}}),DEFINE_CLASS("DlCompletionEntry",DlEntry,function(a,b,c){a.DEFAULT_EVENTS=["onCompletion","onSelect"],a.DEFAULT_ARGS={__timeout:["timeout",500],_shiftMenu:["shift",null],__smart:["smart",true],__noTab:["noTab",false],_noSelect:["noSelect",true],_sizeToFit:["sizeToFit",false],_electric:["electric",true]},b.ALIGN={prefer:"Br",fallX1:"_r",fallX2:"_L",fallY1:"B_",fallY2:"T_"},b._setListeners=function(){this.__on_itemHover=j.$(null,this),this.__on_itemSelect=k.$(null,this),a.BASE._setListeners.call(this),this.addEventListener({onKeyDown:n,onBlur:o,onDestroy:this.__clearTimer})},b._hideMenu=function(){e().hide(50),this.__clearTimer()},b.__clearTimer=function(){this.__timer&&clearTimeout(this.__timer),this.__timer=null};var d=null;function e(){d||(d=DlCompletionPopup.get());return d}var f=null,g=null;function h(){f&&(g=null,f.destroy());return f=new DlVMenu({})}function i(){return f&&f.parent.visible}function j(a,b){var c=f.children().find(this);c!=g&&g!=null&&f.children(g).callHooks("onMouseLeave"),g=c,(a._electric||!b)&&a._applyCompletion(this.userData)}function k(a){a._hideMenu(),a._applyCompletion(this.userData,true),a.applyHooks("onSelect",[this.userData]),a.focus.delayed(0,a)}b._applyCompletion=function(a,b){if(!a.nomodify||b){var c=this.getSelectionRange(),d=a.completion||a.label;b&&a.after&&(d+=a.after);var e=this.getValue(),f=a.start!=null?a.start:c.start;e=e.substr(0,f)+d+e.substr(c.end),this.setValue(e),c.end=f+d.length,a.rstart!=null&&(c.start=a.rstart);if(a.noselect||b)c.start=c.end;this.setSelectionRange(c)}},b._on_menuHide=function(){f&&(f.destroy(),g=f=null)},b.completionReady=function(a){if(this.__timer||this.__forced)if(a!=null&&a.length>0)if(this.__smart&&a.length==1)this._applyCompletion(a[0],true),this.applyHooks("onSelect",[a[0]]);else{var b=h(),d=null;a.foreach(function(a){var c=new DlMenuItem({parent:b,label:a.label,data:a});c.addEventListener({onSelect:this.__on_itemSelect,onMouseEnter:this.__on_itemHover}),a.selected&&(d=c)},this),e().popup({timeout:0,content:b,align:this.ALIGN,anchor:this.getElement(),isContext:true,widget:this,onHide:this._on_menuHide.$(this),shift:this._shiftMenu});if(this._sizeToFit){var f=this.getSize().x;b.getSize().x<f&&b.setSize({x:f-c.getPaddingAndBorder(e().getElement()).x})}d&&d.callHooks("onMouseEnter")}this.cancelCompletion()},b.cancelCompletion=function(){this.delClass("DlCompletionEntry-busy"),this.__clearTimer(),this.__forced=null};function l(a,b){this.__origData={value:this.getValue(),range:this.getSelectionRange()},this.__forced=b,this.addClass("DlCompletionEntry-busy"),this.applyHooks("onCompletion",[this.getSelectionRange(),a,b])}function m(a){if(!i())return false;var b=g,c;switch(a.keyCode){case DlKeyboard.ARROW_UP:g==null&&(g=0),g=f.children().rotateIndex(--g);break;case DlKeyboard.ARROW_DOWN:case DlKeyboard.TAB:g==null&&(g=-1),g=f.children().rotateIndex(++g);break;case DlKeyboard.ENTER:g!=null&&(this.collapse(false),f.children(g).callHooks("onSelect")),DlException.stopEventBubbling();case DlKeyboard.ESCAPE:this._hideMenu();var d=this.__origData;d&&(this.setValue(d.value),this.setSelectionRange(d.range)),DlException.stopEventBubbling()}b!=g?(b!=null&&(c=f.children(b),c.callHooks("onMouseLeave")),c=f.children(g),c.callHooks("onMouseEnter"),DlException.stopEventBubbling()):this._hideMenu()}function n(a){if(is_ie)return m.call(this,a)}b._handle_focusKeys=function(b){if(DlKeyboard.KEYS_CONTROL[b.keyCode]){if(!is_ie)if(!this.__noTab&&b.keyCode==DlKeyboard.TAB&&!i()&&!this.isEmpty())l.call(this,b,true),b.domStop=true,DlException.stopEventBubbling();else return m.call(this,b)}else this._hideMenu(),this.__timeout!=null&&(this.__timer=l.delayed(this.__timeout,this,b,false));return a.BASE._handle_focusKeys.call(this,b)};function o(){this.cancelCompletion()}b.completeFromWords=function(b,c){return a.completeFromWords.call(a,this,b,c)},a.completeFromWords=function(a,b,c){c==null&&(c={}),c.sep==null&&(c.sep=/\s+/g);return function(d){var e=[],f=a.getValue(),g=f.lastIndexOfRegexp(c.sep,d.start);if(f=f.substring(g,d.start))for(var h=0;h<b.length;++h)b[h].indexOf(f)==0&&e.push({label:b[h],noselect:c.noselect,after:c.addSep,start:g});e.length>0?a.completionReady(e):a.cancelCompletion()}}}),DEFINE_CLASS("DlCompletionPopup",DlPopup,function(a,b){a.FIXARGS=function(a){a.zIndex=1e3,a.focusable=false}}),DEFINE_CLASS("DlComboBox",DlCompletionEntry,function(a,b){a.DEFAULT_ARGS={_noSelect:["noSelect",false],__smart:["smart",false],__noTab:["noTab",true],_options:["options",null],_sizeToFit:["sizeToFit",true],_electric:["electric",false]},b._createElement=function(){a.BASE._createElement.apply(this,arguments),this._makeButton(null,null,"DlComboBox-dropDownBtn",{hover:"DlComboBox-dropDownBtn-hover"}).addEventListener("onMouseDown",c.$(this)),this.addEventListener("onCompletion",this.doCompletion)},b._on_menuHide=function(){a.BASE._on_menuHide.call(this),this._btn.delClass("DlComboBox-dropDownBtn-active")};function c(a){a.button==0&&(this._forcePopup(),DlException.stopEventBubbling())}b._forcePopup=function(){this._btn.addClass("DlComboBox-dropDownBtn-active"),this.__forced=true,this.doCompletion(null),this.focus.delayed(0,this)},b.doCompletion=function(a){var b="",c=[];if(a){b=this.getValue().trim().toLowerCase();if(!b)return this.cancelCompletion()}var d=this._options;if(d instanceof Function){d=d.apply(this,arguments);if(d==null)return}d.foreach(function(a){a.toLowerCase().indexOf(b)==0&&c.push({label:a.htmlEscape(),start:0,completion:a})}),c.length>0?this.completionReady(c):this.cancelCompletion()}}),DEFINE_CLASS("DlDrag",DlEventProxy,function(a,b,c){a.DEFAULT_EVENTS=["onDrop","onStartDrag"],a.DEFAULT_ARGS={delta:["delta",3],dragging:["_dragging",false],draggingClass:["draggingClass","DlWidget-dragging"],_animArgs:["animation",{length:30,fps:50}],cursor:["cursor",{noDrop:"CURSOR-NO-DROP",okDrop:"CURSOR-DROP"}]},b.dropOK=function(a,b,c,d){this.target=c;return this.canDrop=true},b._handleDrop=function(a,b,c){this.applyHooks("onDrop",[a,b,c])},b.doDrop=function(a,b){throw new DlExAbstractBaseClass},b.startOK=function(a,b){return true},b.moving=function(a,b){},b.reset=function(a){var b=this.elementCopy;if(b&&b.parentNode)if(a&&this._animArgs){var d=new DlAnimation(this._animArgs.length,this._animArgs.fps),e=this.startElPos||this.startPos,f=c.getPos(b);d.addEventListener({onUpdate:function(){var a=this.getPos();b.style.left=a.mapInt(f.x,e.x)+"px",b.style.top=a.mapInt(f.y,e.y)+"px",c.setOpacity(b,this.t.map(1,.2))},onStop:function(){c.trash(b),b=null}}),d.start(null,null,"accel_ab")}else b.parentNode.removeChild(b);this.canDrop=this.dragging=false,this.source=this.startPos=this.elementCopy=this.target=null},b.makeElementCopy=function(a,b){var d=this.elementCopy;d||(d=this.elementCopy=a.getElement().cloneNode(true),c.addClass(d,"DlWidget-dragged-clone"),d.style.top=b.pos.y+"px",d.style.left=b.pos.x+"px",document.body.appendChild(d),d.style.width=d.offsetWidth+"px");return d}}),DEFINE_CLASS("DlDragTreeItem",DlDrag,function(a,b){a.DEFAULT_ARGS={_noReparent:["noReparent",false]};var c="DlTreeItem-dropTarget",d="DlTreeItem-dropTarget-upper",e="DlTreeItem-dropTarget-lower",f=/DlTreeItem-dropTarget[^\s]*/g,g=/DlTreeItem-dropTarget-[^\s]*/g;function h(a){return/DlTree-IconWidth/.test(a.target.className)}b.startOK=function(a,b){return!h(b)},b.dropOK=function(a,b,d,e){while(d&&!(d instanceof DlTreeItem))d=d.parent;var g=!e&&d;g&&(g=!this._noReparent||a.parent===d.parent),this.target=g?d:null,this.canDrop=!!g,this.oldTarget&&this.oldTarget!==this.target&&this.oldTarget.delClass(f),g&&this.target.addClass(c),this.oldTarget=this.target;return g},b.doDrop=function(a,b){if(this._noReparent||h(b)){var c=this.target.getIndex();this.dropBefore||++c,this.target.parent.appendWidget(a,c),this._handleDrop(a,this.target,this.dropBefore?"before":"after")}else this.target.getSubtreeWidget()!==a.parent&&(this.target.addSubItem(a),this._handleDrop(a,this.target))},b.moving=function(a,b){var c=this.target;if(this.canDrop&&c&&(this._noReparent||h(b))){var f=b.computePos(c),i=c.getDivElement().offsetHeight/2,j=f.y<=i;c.condClass(j,d,e),this.dropBefore=j}else c&&(this.dropBefore=null,c.delClass(g))},b.reset=function(){this.target&&this.target.delClass(f),this.oldTarget&&this.oldTarget.delClass(f),a.BASE.reset.apply(this,arguments),this.oldTarget=null}}),DEFINE_CLASS("DlLayout",DlContainer,function(a,b,c){a.DEFAULT_ARGS={_outerSpace:["outerSpace",0],_fillParent:["fillParent",true]},a.setFill=function(a,b){var c=a._dllayout_args.fill;(a._dllayout_args.fill=b)!=c&&a.parent.doLayout()},a.getArgs=function(a){return a._dllayout_args},b._appendWidgetElement=function(b,d){if(d==null)return a.BASE._appendWidgetElement.apply(this,arguments);var e=c.createElement("div",null,{className:"DlLayout-positioned"},this.getElement());d.zIndex&&(e.style.zIndex=d.zIndex),d.overflow&&(e.style.overflow=d.overflow),e.appendChild(b.getElement()),b._dllayout_args=d},b._removeWidgetElement=function(a){if(this._widgets.contains(a)){var b=a.getElement(),c=b.parentNode;c&&(c.parentNode.removeChild(c),c.removeChild(b))}},b.packWidget=function(a,b){this.appendWidget(a,b)},b.replaceWidget=function(a,b){var c=this._widgets.find(a);if(c>=0){b.parent&&b.parent.removeWidget(b),this._widgets.splice(c,1,b),b._dllayout_args=a._dllayout_args,a._dllayout_args=null;var d=a.getElement(),e=d.parentNode;e.insertBefore(b.getElement(),d),e.removeChild(d),b.parent=this,a.parent=null}},b.doLayout=function(){var a=this.getInnerSize(),b,c,d,e,f=this._outerSpace;function g(){typeof f=="number"?b=c=d=e=f:f instanceof Array?(e=f[0],c=f[1],d=f[2],b=f[3]):(e=f.top||0,c=f.right||0,d=f.bottom||0,b=f.left||0)}g();for(var h=this._widgets,i=new Array(h.length),j={},k=0;k<h.length;++k){var l=h[k],m=l._dllayout_args;if(!m||!l.display())continue;var n=l.getElement().parentNode,o=m.before=m.before||0,p=m.after=m.after||0,q=m.fill;m.resetSize&&(l.getElement().style.width=l.getElement().style.height="");var r=l.getOuterSize();switch(m.pos){case"top":e+=o,q==null&&(q=r.y),i[k]={sy:q},typeof q=="number"&&(e+=q),e+=p;break;case"right":c+=o,q==null&&(q=r.x),i[k]={sx:q},typeof q=="number"&&(c+=q),c+=p;break;case"bottom":d+=o,q==null&&(q=r.y),i[k]={sy:q},typeof q=="number"&&(d+=q),d+=p;break;case"left":b+=o,q==null&&(q=r.x),i[k]={sx:q},typeof q=="number"&&(b+=q),b+=p}i[k].w=l,i[k].args=m,i[k].div=n}var s=a.x-b-c,t=a.y-e-d;g(),i.foreach(function(f,g){f||$CONTINUE();var h=f.args,i=f.w;if(i.display()){switch(h.pos){case"top":case"bottom":typeof f.sy!="number"&&(f.sy=="*"?f.sy=t:/%/.test(f.sy)&&(f.sy=Math.floor(parseFloat(f.sy)*t/100)),h.min!=null&&f.sy<h.min&&(f.sy=h.min),h.max!=null&&f.sy>h.max&&(f.sy=h.max),t-=f.sy);break;case"left":case"right":typeof f.sx!="number"&&(f.sx=="*"?f.sx=s:/%/.test(f.sx)&&(f.sx=Math.floor(parseFloat(f.sx)*s/100)),h.min!=null&&f.sx<h.min&&(f.sx=h.min),h.max!=null&&f.sx>h.max&&(f.sx=h.max),s-=f.sx)}function j(){}function k(){var b=e,c=a.y-e-d,g={x:f.sx};switch(h.valign){case"top":break;case"center":b+=(c-i.getOuterSize().y)/2;break;case"bottom":b+=c-i.getOuterSize().y;default:g.y=c}f.div.style.top=b+"px",i.setSize(g)}switch(h.pos){case"top":e+=h.before,f.div.style.left=b+"px",f.div.style.top=e+"px",i.setSize({x:a.x-b-c,y:f.sy}),e+=f.sy+h.after;break;case"bottom":d+=h.before,f.div.style.left=b+"px",f.div.style.top=a.y-d-f.sy+"px",i.setSize({x:a.x-b-c,y:f.sy}),d+=f.sy+h.after;break;case"left":b+=h.before,f.div.style.left=b+"px",k(),b+=f.sx+h.after;break;case"right":c+=h.before,f.div.style.left=a.x-c-f.sx+"px",k(),c+=f.sx+h.after}}})},b.__doLayout=function(){this.doLayout()},b.sizeToFit=function(){for(var a=this._widgets,b=0,c=0,d=0;d<a.length;++d){var e=a[d],f=e._dllayout_args,g=e.getOuterSize();switch(f.pos){case"top":case"bottom":b+=g.y,g.x>c&&(c=g.x);break;case"left":case"right":c+=g.x,g.h>b&&(b=g.h)}}this.setOuterSize({x:c,y:b})}}),DEFINE_CLASS("DlResizeBar",DlWidget,function(a,b,c){var d=c.condClass;a.FIXARGS=function(a){a.invert=a.invert?-1:1},a.DEFAULT_ARGS={_isHoriz:["horiz",null],_widget:["widget",null],_invert:["invert",false],_min:["min",null],_max:["max",null],_cont:["continuous",false],_keepPrc:["keepPercent",false]},a.getDragBar=function(){return DlElementCache.DRAGGING_LINE},b.initDOM=function(){a.BASE.initDOM.call(this),this.condClass(this.isHoriz(),"DlResizeBar-Horizontal","DlResizeBar-Vertical"),this.setUnselectable(null,true)},b.isHoriz=function(){if(this._isHoriz==null){var a=DlLayout.getArgs(this);a&&(this._isHoriz=/top|bottom/.test(a.pos))}return this._isHoriz},b._setListeners=function(){a.BASE._setListeners.call(this),this._resizeHandlers={onMouseMove:g.$(this),onMouseUp:f.$(this),onMouseOver:DlException.stopEventBubbling,onMouseOut:DlException.stopEventBubbling,onMouseEnter:DlException.stopEventBubbling,onMouseLeave:DlException.stopEventBubbling},this.addEventListener("onMouseDown",e)},b._setResizeCaptures=function(a){(a?DlEvent.captureGlobals:DlEvent.releaseGlobals)(this._resizeHandlers);var b=DlDialog.activateEventStopper(a);d(b,a,this.isHoriz()?"CURSOR-RESIZE-S":"CURSOR-RESIZE-E")};function e(a){var b=DlElementCache.DRAGGING_LINE,d=this.getPos();this._dragPos=this.isHoriz()?d.y:d.x;var e=this.isHoriz()?a.pos.y:a.pos.x;this._mposDiff=e-this._dragPos;var f=this.getSize();b.style.top=d.y+"px",b.style.left=d.x+"px",b.style.width=f.x+"px",b.style.height=f.y+"px";if(this._widget){var g=this._widget instanceof DlWidget?this._widget.getSize():c.getOuterSize(this._widget);this._dragSize=this.isHoriz()?g.y:g.x}document.body.appendChild(b),this._setResizeCaptures(true),DlException.stopEventBubbling()}b._doResize=function(a){var b=this.isHoriz(),d=c.getPos(DlElementCache.DRAGGING_LINE);d=b?d.y:d.x;var e=this._invert*(d-this._dragPos),f=this._widget;if(f){var g=this._dragSize;if(f instanceof DlWidget){var h=DlLayout.getArgs(f);if(h){h=h.fill;var i=/%$/.test(h);i&&!this._keepPrc||h==null||typeof h=="number"?DlLayout.setFill(f,g+e):i&&(h=parseFloat(h),DlLayout.setFill(f,h*(g+e)/g+"%"))}else this._isHoriz?f.setSize({y:g+e}):f.setSize({x:g+e})}else this._isHoriz?c.setOuterSize(f,null,g+e):c.setOuterSize(f,g+e,null)}};function f(a){this._setResizeCaptures(false),this._doResize(a),document.body.removeChild(DlElementCache.DRAGGING_LINE)}function g(a){var b=DlElementCache.DRAGGING_LINE,c=this.isHoriz()?a.pos.y:a.pos.x;c-=this._mposDiff;var d=this._invert*(c-this._dragPos),e=this._min,f=this._max,g=this._widget;if(g){var h=DlLayout.getArgs(g);h&&(e==null&&(e=h.min),f==null&&(f=h.max));var i;if(e!=null||f!=null)i=this._dragSize+d;e!=null&&i<e?c+=this._invert*(e-i):f!=null&&i>f&&(c+=this._invert*(f-i))}this.isHoriz()?b.style.top=c+"px":b.style.left=c+"px",this._cont&&this._doResize(a)}}),DEFINE_CLASS("DlWM",DlContainer,function(a,b,c){b.getInnerSize=b.getOuterSize=b.getSize=function(){return this.parent?this.parent.getInnerSize():c.getWindowSize()},b.initDOM=function(){a.BASE.initDOM.apply(this,arguments),this.getElement().innerHTML="<div class='DlWM-modalStopper'></div>",this.dialogsVisible=[],this.modalsVisible=0,this._manageEvents={onShow:d.$(null,this),onHide:e.$(null,this)};var b=this.on_parentResize.$(this);this.parent?this.parent.addEventListener("onResize",b):c.addEvent(window,"resize",b)},b.getModalStopperElement=function(){return this.getElement().childNodes[0]},b.activatePrev=function(){var a=this.dialogsVisible;a.length>1&&(a.peek().deactivate(),a.unshift(a.pop()),top=a.pop(),top.activate())},b.activateNext=function(){var a=this.dialogsVisible;a.length>1&&a[0].activate()},b.getActiveDialog=function(){return this.dialogsVisible.peek()},b.updateZIndex=function(){this.dialogsVisible.r_foreach(function(a,b){a.zIndex((a.__modal?900:500)+b)})},b.getVisibleDialogs=function(){return this.dialogsVisible},b.getAllDialogs=function(){return this.children().grep(function(a){return a instanceof DlDialog})},b.appendWidget=function(b){a.BASE.appendWidget.apply(this,arguments),b instanceof DlDialog&&this.manage(b)},b.removeWidget=function(b){a.BASE.removeWidget.apply(this,arguments),b instanceof DlDialog&&this.unmanage(b)},b.manage=function(a){a.addEventListener(this._manageEvents)},b.unmanage=function(a){a.removeEventListener(this._manageEvents)},b.on_dlgShow=function(a){a.__modal&&this.modalsVisible++,this.condClass(this.modalsVisible>0,"DlWM-hasModals")},b.on_dlgHide=function(a){a.__modal&&this.modalsVisible--,this.condClass(this.modalsVisible>0,"DlWM-hasModals"),this.dialogsVisible.length==0&&this.parent&&this.parent.focus()},b.on_parentResize=function(){this.dialogsVisible.foreach(function(a){a.__maximized&&a.__doMaximize()}),this.callHooks("onResize")},b.rearrange=function(a){var b=this.dialogsVisible.map(function(a){var b=a.getOffsetPos(),c=a.getOuterSize();return{dlg:a,x:b.x,y:b.y,w:c.x,h:c.y}});a(b,this.getInnerSize()),b.foreach(function(a){a.dlg.setPos(a.x,a.y),a.dlg.setSize({x:a.w,y:a.h})})},b.tileHoriz=function(){this.rearrange(h)},b.tileVert=function(){this.rearrange(i)};function d(a){a.on_dlgShow(this)}function e(a){a.on_dlgHide(this)}DlContainer.prototype._makeWindowManager=function(){this.__wm||(this.__wm=new DlWM({parent:this})).addEventListener("onDestroy",function(){this.__wm=null}.$(this));return this.__wm};function f(a,b){return a.x<b.x?-1:a.x>b.x?1:0}function g(a,b){return a.y<b.y?-1:a.y>b.y?1:0}function h(a,b){var c=a.length,d=Math.floor(b.x/c),e=0;a.mergeSort(f).foreach(function(a,f){a.y=0,a.x=e,a.h=b.y,f==c-1?a.w=b.x-e:a.w=d,e+=d})}function i(a,b){var c=a.length,d=Math.floor(b.y/c),e=0;a.mergeSort(g).foreach(function(a,f){a.x=0,a.y=e,a.w=b.x,f==c-1?a.h=b.y-e:a.h=d,e+=d})}}),DEFINE_CLASS("DlDialog",DlContainer,function(a,b,c){var d=DlException.stopEventBubbling,e=c.addClass,f=c.delClass,g=c.condClass,h=c.createElement;a.DEFAULT_EVENTS=["onShow","onHide","onActivate","onQuitBtn"],a.DEFAULT_ARGS={_title:["title","DlDialog"],_noEmptyTitle:["noEmptyTitle",true],_fixed:["fixed",false],_resizable:["resizable",false],_focusable:["focusable",true],_iconClass:["iconClass",null],_focusedWidget:["focusDefault",null],__noShadows:["noShadows",false],__quitBtn:["quitBtn",false],__maxBtn:["maxBtn",true],__modal:["modal",false],__moveDelay:["moveDelay",5e3]},a.FIXARGS=function(b){b.parent||(b.parent=a.getTopWM()),b.parent instanceof DlWM||(b.parent instanceof DlDialog&&(b.noShadows=true),b.parent=b.parent._makeWindowManager())},a.CONSTRUCT=function(){this.__doDrag=this.__moveDelay!=null?s.clearingTimeout(this.__moveDelay,this):s.$(this),this.active=false};var i;a.getTopWM=function(){i||(i=new DlWM({}),document.body.appendChild(i.getElement()));return i};var j="<table cellspacing='0' cellpadding='0'><tr><td><div class='DlDialog-Rel'><div class='DlDialog-WindowButtons'></div><div class='DlDialog-Title'><div></div></div><div class='DlDialog-Content'></div></div></td></tr></table>",k={x:-3e4,y:-3e4};b._setDragCaptures=function(a){DlEvent[a?"captureGlobals":"releaseGlobals"](this._dragHandlers)},b._setResizeCaptures=function(a){DlEvent[a?"captureGlobals":"releaseGlobals"](this._resizeHandlers)};function l(){var a=c.CE_CACHE["DlDialog.EVENT_STOPPER"];a||(a=c.CE_CACHE["DlDialog.EVENT_STOPPER"]=h("div",null,{className:"DYNARCH-EVENT-STOPPER"},document.body)),a.style.visibility="";return a}function m(){var a=c.CE_CACHE["DlDialog.EVENT_STOPPER"];a&&(a.className="DYNARCH-EVENT-STOPPER",a.style.visibility="hidden");return a}a.activateEventStopper=function(a){return a?l():m()};function n(a){if(!this.dragging&&!this.__maximized){DlPopup.clearAllPopups(),this.activate(),this.dragging=true,a||(a=window.event);var b=a instanceof DlEvent?a:new DlEvent(a);this.addClass("DlDialog-Dragging"),this._dragPos=b.computePos(this),this._setDragCaptures(true),e(l(),"CURSOR-DRAGGING");if(this.__moveDelay!=null){var d=this.getResizeRect();e(d,"Dl-ResizeRect-moving");var f=this.getOuterSize();c.setPos(d,b.elPos.x,b.elPos.y),c.setOuterSize(d,f.x,f.y),d.style.display=""}if(b!==a)return c.stopEvent(a)}}function o(a){a.ctrlKey&&a.shiftKey&&(a.button==0&&this._dragHandlers?n.call(this,a):a.button==2&&a.dl_type=="onContextMenu"&&this._resizable&&(u.call(this,a),d()))}function p(a){if(this.dragging){var b=this.getResizeRect();this.dragging=false,this.delClass("DlDialog-Dragging"),this._setDragCaptures(false);if(this.__moveDelay!=null)if(a){var c=q.call(this,a);this.__doDrag.doItNow(c.x,c.y)}else this.__doDrag.cancel();f(b,"Dl-ResizeRect-moving"),b.style.display="none",m()}}function q(a){var b=this.parent;a.computePos(b.getContentElement());var c=a.relPos.x-this._dragPos.x,d=a.relPos.y-this._dragPos.y,e=this.getOuterSize(),f=b.getInnerSize();c<0?c=0:c+e.x>f.x&&(c=f.x-e.x),d<0?d=0:d+e.y>f.y&&(d=f.y-e.y);return{x:c,y:d}}function r(a){var b=a.x,d=a.y;a=c.getPos(this.parent.getContentElement()),b+=a.x,d+=a.y,c.setPos(this.getResizeRect(),b,d)}function s(a,b){this.setPos(a,b),this.__oldDlgPos=this.getOffsetPos()}function t(a){var b=q.call(this,a);this.__moveDelay!=null&&r.call(this,b),this.__doDrag(b.x,b.y),d()}function u(a){if(!this.resizing){this.resizing=true,a||(a=window.event);var b=a instanceof DlEvent?a:new DlEvent(a);this._dragPos=b.computePos(this);var d=this.getOuterSize();this._dragPos.x-=d.x,this._dragPos.y-=d.y;var f=this.getPos(),g=this.getResizeRect();c.setPos(g,f.x,f.y),c.setOuterSize(g,d.x,d.y),g.style.display="",this.addClass("DlDialog-Resizing"),this._setResizeCaptures(true),e(l(),"CURSOR-DRAGGING"),w.call(this,b,true),b!==a&&c.stopEvent(a)}}function v(b){if(this.resizing){this.disableHooks("onResize"),this.getElement().style.overflow="hidden";var d=this.getResizeRect(),e=c.getOuterSize(d);c.setPos(d,0,0),d.style.display="none",this.delClass("DlDialog-Resizing"),this.setOuterSize({x:e.x,y:e.y}),is_gecko&&a.BASE.setOuterSize.call(this,{x:"auto",y:"auto"}),this.resizing=false,this._setResizeCaptures(false),this.getElement().style.overflow="",m(),this.enableHooks("onResize"),this.callHooks("onResize")}}function w(a,b){if(this.resizing){var e=this.getResizeRect(),f=c.getPos(e);f.x=a.pos.x-this._dragPos.x-f.x-2,f.x<100&&(f.x=100),f.y=a.pos.y-this._dragPos.y-f.y-2,f.y<100&&(f.y=100),this._resizable===1&&(f.y=null),this._resizable===2&&(f.x=null),c.setInnerSize(e,f.x,f.y),b||d()}}b.setOuterSize=b.setSize=function(a){a.y!=null&&(a.y-=this.getTitleElement().offsetHeight),this.setInnerSize(a)},b.hide=function(){this.display()&&c.elementIsVisible(this.getElement())&&(this.__oldDlgPos=this.getOffsetPos(),this.display(false),this.setPos(k))},b.show=function(a){this.__wasDisplayed||this.setStyle({visibility:""}),!this.display()||!this.__wasDisplayed?(this.__oldDlgPos?this.setPos(this.__oldDlgPos):a&&this.centerOnParent(),this.display(true)):this.activate(),this.__wasDisplayed=true},b.activate=function(){var a=this.parent.getVisibleDialogs(),b=a.peek();this.active||(b&&b.active&&b.deactivate(true),this.addClass("DlDialog-Active"),a.remove(this),a.push(this),this.parent.updateZIndex(),this.active=true,this.focus(),this._focusedWidget&&!this._focusedWidget.destroyed&&this._focusedWidget.focus(),this.applyHooks("onActivate",[true]))},b.deactivate=function(){this.active&&(this.delClass("DlDialog-Active"),this.active=false,this.blur(),this.applyHooks("onActivate",[false]))};function x(a,b){var c=DlSystem();if(a)this.callHooks("onShow"),this.activate(),this.setModal(this.__modal,true),c.applyHooks("on-dialog-show",[this]),this.__maximized&&this.__doMaximize.delayed(1,this);else{var d=this.parent.getVisibleDialogs();d.remove(this),this.callHooks("onHide"),this.deactivate(),c.applyHooks("on-dialog-hide",[this]),d.length>=1&&d.peek().activate()}}function y(a){if(a.shiftKey||a.altKey){var b=this.__dlgOpacity;b==null&&(b=100),a.wheelDelta>0?b+=.05:b-=.05,b=this.__dlgOpacity=b.limit(.1,1),this.opacity(b),d()}}b._createElement=function(){a.BASE._createElement.call(this),this.setPos(k),this.setStyle({visibility:"hidden"}),this.getElement().innerHTML=j;var b=this.getRelElement();!this.__noShadows&&!is_ie6?b.insertBefore(DlElementCache.get("SHADOWS"),b.firstChild):(this.__noShadows=true,e(b,"DlDialog-noShadows")),this.title(this._title),this.setUnselectable(this.getTitleElement());var c=this.__quitBtn;if(c){var d=this.__quitBtn=new DlAbstractButton({parent:this,className:"DlDialog-QuitBtn",appendArgs:this.getButtonsElement(),classes:{hover:"DlDialog-QuitBtn-hover",active:"DlDialog-QuitBtn-active"}});c=="destroy"?c=this.destroy.$(this):c=="hide"&&(c=this.hide.$(this)),c instanceof Function?d.addEventListener("onClick",c):d.connectEvents("onClick",this,"onQuitBtn")}this._resizable&&this.makeResizable(),this.setIconClass(this._iconClass),this._fixed||this.makeDraggable(),this.addEventListener({onMouseDown:this.activate,onMouseWheel:y,onDisplay:x,onDestroy:this.hide})},b.setIconClass=function(a){var b=this.getTitleElement().firstChild;g(b,a!=null,"DlDialog-Title-withIcon"),this.iconClass&&f(b,this.iconClass),a&&e(b,a),this.iconClass=a},b.getState=function(){var a=this.__maximized&&this.__maximizeSavePos;a?a=Object.makeDeepCopy(a):a={pos:this.getOffsetPos(),size:this.getOuterSize()},a.max=!!this.__maximized;return a},b.maximize=function(a){a==null&&(a=this.__maxBtn.checked());var b,c;this.__maximized=a,a&&(b=this.getOffsetPos(),c=this.getOuterSize(),this.__maximizeSavePos={pos:b,size:c}),this.condClass(a,"DlDialog-Maximized"),a?this.__doMaximize():(b=this.__maximizeSavePos,c=b.size,b=b.pos,this.setOuterSize({x:c.x,y:c.y}),this.setPos(b.x,b.y)),this.__maxBtn.checked(a,true),this._focusedWidget&&!this._focusedWidget.destroyed&&this._focusedWidget.focus()},b.__doMaximize=function(){this.setPos(0,0);var a=this.parent.getInnerSize();this.setOuterSize({x:a.x,y:a.y})},b.setModal=function(a,b){b||(this.__modal=a),this.display()&&this.parent.updateZIndex()},b.modal=function(){return this.__modal},b.makeResizable=function(){if(!this._resizeHandlers){this.getContentElement().style.overflow="hidden";var a=this.getRelElement(),b=h("div",null,{className:"ResizeHandle"},null);a.insertBefore(b,a.firstChild),this._resizeHandlers={onMouseMove:w.$(this),onMouseUp:v.$(this),onMouseOver:d,onMouseOut:d,onMouseEnter:d,onMouseLeave:d},c.addEvent(b,"mousedown",u.$(this)),this.resizing=false,this.__maxBtn&&(this.__maxBtn=new DlAbstractButton({parent:this,className:"DlDialog-MaximizeBtn",appendArgs:this.getButtonsElement(),type:DlAbstractButton.TYPE.TWOSTATE,classes:{hover:"DlDialog-MaximizeBtn-hover",active:"DlDialog-MaximizeBtn-active",checked:"DlDialog-MaximizeBtn-1"}}),this.__maxBtn.addEventListener("onChange",this.maximize.$0(this,null)))}},b.makeDraggable=function(){if(!this._dragHandlers){var a=this.getTitleElement();a.style.cursor="default",this._dragHandlers={onMouseMove:t.$(this),onMouseUp:p.$(this),onMouseOver:d,onMouseOut:d,onMouseEnter:d,onMouseLeave:d},c.addEvent(a,"mousedown",n.$(this)),this.addEventListener(["onMouseDown","onContextMenu"],o),this.dragging=false}},b.title=function(a){a!=null&&(a instanceof Array&&(a=a.join("")),this.getTitleElement().firstChild.innerHTML=this._title=a,this._noEmptyTitle&&(this.getTitleElement().style.display=/\S/.test(a)?"":"none"));return this._title},b._handle_focusKeys=function(a){if(!a.altKey&&!a.ctrlKey)if(a.keyCode==DlKeyboard.ESCAPE)!this.dragging&&this.__quitBtn?this.__quitBtn.keyClicked(a):this.dragging&&p.call(this);else if(a.keyCode==DlKeyboard.TAB){var b=a.focusedWidget;b=a.shiftKey?this.getPrevFocusWidget(b):this.getNextFocusWidget(b),b&&b.focus(),a.domStop=true,d()}this._handleKeybinding(a)};function z(a,b){var c=a.getRelElement().childNodes;return c[c.length-b]}b.getRelElement=function(){return this.getElement().firstChild.rows[0].cells[0].firstChild},b.getContentElement=function(){return z(this,1)},b.getTitleElement=function(){return z(this,2)},b.getButtonsElement=function(){return z(this,3)},b.centerOnParent=function(){var a=this.getOuterSize(),b=this.parent.getOuterSize();this.setPos((b.x-a.x)/2,(b.y-a.y)/2)},b.getWM=function(){return this.parent},DlWidget.prototype.getParentDialog=function(){var b=this.parent;while(b&&!(b instanceof a))b=b.parent;return b}}),DEFINE_CLASS("DlDialogPopup",DlPopup,function(a,b){a.FIXARGS=function(a){a.autolink=false,a.zIndex=5e3}}),DEFINE_CLASS("DlRecord",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["onChange"],a.DEFAULT_ARGS={_data:["data",null],_set:["recordSet",null]},b.id=function(){return this._data.id},b.get=function(a){return this._data[a]},b.set=function(a,b,c){var d,e=this._data[a];this._data[a]=b,c||(d=[this,a,b,e],this.applyHooks("onChange",d),this._set&&this._set.applyHooks("onChange",d))},b.compareTo=function(a,b){var c=this.get(b),d=a.get(b);return c<d?-1:c==d?0:1}}),DEFINE_CLASS("DlRecordCache",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["onChange","onInsert","onBeforeDelete","onDelete","onRefresh"],a.DEFAULT_ARGS={_data:["data",null]},a.CONSTRUCT=function(){this._init()},b.get=function(a){return this._data[a]},b.hasRecord=function(a){return this.get(a)},b.getRecords=function(a,b,c){b.call(c,a.map(this.get,this))},b.getAllIds=function(){return Array.hashKeys(this._data)},b.getAllRecords=function(){return Array.hashValues(this._data)},b.getHash=function(){return this._data},b.formatHTML=function(a,b,c){c(String(a.get(b)).htmlEscape())},b.getRecClass=function(a){},b.getCellClass=function(a,b){},b.getInsertPos=function(a){},b.insert=function(a,b){b==null&&(b=this.getInsertPos(a)),this._data[a.id()]=a,a._set=this,this.applyHooks("onInsert",[a,b])},b.remove=function(a){this.applyHooks("onBeforeDelete",[this.get(a)]),a instanceof Array?a.foreach(function(a){delete this._data[a]},this):delete this._data[a],this.applyHooks("onDelete",[a])},b.sort=function(a,b,c,d,e,f){var g;b==c&&d!==null?g=a.reverse():g=a.mergeSort(function(a,c){a=this.get(a),c=this.get(c);return a.compareTo(c,b)}.$(this),d),e.call(f,g)},b._init=function(){if(this._data){var a={};this._data.foreach(function(b){a[b.id()]=b,b._set=this},this),this._data=a}else this._data={}}}),DEFINE_CLASS("DlDataGridHeadLabel",DlButton,function(a,b,c){a.FIXARGS=function(a){"contextMenu"in a||(a.contextMenu=this._getContextMenu)},a.CONSTRUCT=function(){if(!this.isSortable()){var a=this._classes=Object.makeCopy(this._classes);a.active=a.hover=null}};var d=20;b.setWidth=function(a){this.setOuterSize({x:a})},b.isSortable=function(){return this.col.isSortable()},b._onClick=function(){this.isSortable()&&this.parent._onHeadClick(this.col,this)},b._getContextMenu=function(){var a=this._dgContextMenu,b=this.parent,c;a?(c=a.buttons,b._cols.foreach(function(a,b){c[b].checked(a.isVisible(),true)})):(this._dgContextMenu=a=new DlVMenu({}),c=a.buttons=[],b._cols.foreach(function(b,d){if(b.getMenuLabel()){var e=c[d]=new DlCheckbox({parent:a,label:b.getMenuLabel(),checked:b.isVisible()});e.addEventListener("onChange",function(){b.setVisible(this.checked())})}}));return a},a.DEFAULT_ARGS={col:["col",null],_focusable:["focusable",false],_noCapture:["noCapture",true],_classes:["classes",{active:"DlDataGridHeadLabel-active",hover:"DlDataGridHeadLabel-hover",checked:"DlDataGridHeadLabel-1",unchecked:"DlDataGridHeadLabel-0",empty:"DlDataGridHeadLabel-empty",disabled:"DlDataGridHeadLabel-disabled"}]};var e=DlException.stopEventBubbling;function f(a){var b=a._resizeHandle;b||(b=a._resizeHandle=new DlWidget({parent:a,className:"DlDataGrid-resizeHandle"}),b.display(false),b.grid=a.parent,b.addEventListener({onMouseLeave:b.display.$(b,false),onMouseDown:g}),b._resizeCaptures={onMouseMove:h.$(b),onMouseUp:i.$(b),onMouseOver:e,onMouseOut:e,onMouseEnter:e,onMouseLeave:e});return b}a._on_headMouseMove=function(a){if(!(!this._colPos||this.dragging)){var b=this.parent,c=b.getBodyDiv().scrollLeft,d=a.computePos(this).x+c,e;this._colPos.foreach(function(a){Math.abs(d-a.pos)<4&&(a.col.isResizable()&&(e=a),$BREAK())});var g=f(this);e?(e.col!==g.col&&(g.found=e,g.col=e.col,g.pos=e.pos,g.setPos(e.pos-c)),g.display(true)):(g.display(false),g.found=g.col=null)}},a._on_headMouseLeave=function(a){f(this).display(false)};function g(a){this.dragging=true;var b=DlResizeBar.getDragBar(),d=b.style;this.sl=this.grid.getBodyDiv().scrollLeft,d.left=this.pos-this.sl-1+"px",d.height="100%",d.width=this.getElement().offsetWidth-4+"px",d.top="0px",this.grid.getElement().appendChild(b);var f=DlDialog.activateEventStopper(true);c.addClass(f,"CURSOR-RESIZE-E"),DlEvent.captureGlobals(this._resizeCaptures),this.origW=this.grid.getColWidth(this.col),this.origM=a.pos.x,this.col._button.addClass("DlDataGridHeadLabel-resizing"),e()}function h(a){var b=DlResizeBar.getDragBar(),c=this.pos+a.pos.x-this.origM-1,f=c-this.pos,g=this.origW+f;g<d&&(c+=d-g,g=d),c-=this.sl,b.style.left=c+"px",this.width=g,this.diff=f;if(!is_ie){var h=this.col._button.getElement();h.style.width=h.parentNode.style.width=h.parentNode.parentNode.style.width=g+"px"}e()}function i(a){this.dragging=false,this.grid.getElement().removeChild(DlResizeBar.getDragBar());var b=DlDialog.activateEventStopper(false);c.delClass(b,"CURSOR-RESIZE-E"),DlEvent.releaseGlobals(this._resizeCaptures),this.width&&(this.grid.setColWidth(this.col,this.width),this.grid._computeColPos()),this.col._button.delClass("DlDataGridHeadLabel-resizing");if(!is_ie){var d=this.col._button.getElement();d.style.width=d.parentNode.style.width=d.parentNode.parentNode.style.width=""}this.width=this.diff=this.found=this.col=null,this.parent.callHooks("onMouseMove",a),e()}}),DEFINE_CLASS("DlGridCol",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["onChange","onVisibility"],a.DEFAULT_ARGS={_field_id:["id",null],_width:["width",null],_fill:["fill",null],_style:["style",null],_label:["label",null],_menuLabel:["menuLabel",null],_tooltip:["tooltip",null],_iconClass:["iconClass",null],_isSortable:["sortable",true],_isResizable:["resizable",true],_cssRule:["cssRule",null],_isVisible:["visible",true]};var c={};b.id=function(){return this._field_id},b.getWidth=function(){return this._width},b.getFill=function(){return this._fill},b.getLabel=function(){return this._label},b.getMenuLabel=function(){return this._menuLabel||this._label},b.getTooltip=function(){return this._tooltip},b.getIconClass=function(){return this._iconClass},b.getStyle=function(a,b){return(this._style||c)[a]||b},b.isSortable=function(){return this._isSortable},b.isResizable=function(){return this._isResizable},b.isVisible=function(){return this._isVisible},b.setVisible=function(a){this._isVisible=a,this.applyHooks("onVisibility",[a])},b.sort=function(){}}),DEFINE_CLASS("DlGridDragCol",DlDrag,function(a,b,c){a.CONSTRUCT=function(){this.addEventListener("onStartDrag",function(a){this.grid_pos=a.parent.getPos(),a._onMouseLeave()})},b.startOK=function(a,b){return true},b.dropOK=function(a,b,c,d){if(!d&&c instanceof DlDataGridHeadLabel&&a.parent===c.parent){this.target=c;return this.canDrop=true}return this.canDrop=false},b.doDrop=function(a,b){a.parent.reorderColumn(a.col,this.target.col,!this.dropBefore)};var d;function e(){var a=d;a||(a=d=c.createElement("div",{display:"none"},{className:"DlDataGrid-drop-col"},document.body));return a}b.moving=function(a,b){var c=this.target,d=e(),f=d.style;if(this.canDrop&&c){var g=b.computePos(c),h=c.getElement(),i=h.offsetWidth,j=g.x<=i/2,k=c.col.index;j&&k--,k<0?k=0:k=a.parent._headCont._colPos[k].pos-a.parent.getBodyDiv().scrollLeft,f.display="block",f.left=k+this.grid_pos.x+"px",f.top=g.elPos.y+"px",this.dropBefore=j}else c&&(this.dropBefore=null,f.display="none")},b.reset=function(){d&&(d.style.display="none"),a.BASE.reset.apply(this,arguments)}}),DEFINE_CLASS("DlSelectionModel",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["onChange","onReset"],a.CONSTRUCT=function(){this.sel||(this.sel={})},a.DEFAULT_ARGS={multiple:["multiple",true],sel:["sel",null]},b.reset=function(a,b){var c=this.sel;this.sel=a.toHash(true),b||this.applyHooks("onReset",[c,this.sel])},b.clear=function(a){this.reset([],a)},b.get=function(){return this.sel},b.getArray=function(){return Array.hashKeys(this.sel)},b.getFirst=function(){for(var a in this.sel)return a},b.isSelected=function(a){return this.sel[a]},b.size=function(){var a=0;for(var b in this.sel)a++;return a},b.filter=function(a){var b=[];for(var c in this.sel)c in a||b.push(c);this.unselect(b)},b.select=function(a,b){var c=this.sel,d=null,e;a instanceof Array?(e={},a.foreach(function(a){c[a]||(d=c[a]=e[a]=true)},this),!b&&d!=null&&this.applyHooks("onReset",[{},e])):c[a]||(c[a]=true,b||this.applyHooks("onChange",[a,true]),d=true);return d},b.unselect=function(a,b){var c=this.sel,d=null,e;a instanceof Array?(e={},a.foreach(function(a){c[a]&&(delete c[a],e[a]=true,d=false)},this),!b&&d!=null&&this.applyHooks("onReset",[e,{}])):c[a]&&(delete c[a],b||this.applyHooks("onChange",[a,false]),d=false);return d},b.toggle=function(a,b){return this.sel[a]?this.unselect(a,b):this.select(a,b)}}),DEFINE_CLASS("DlDataGrid",DlContainer,function(a,b,c){var d=c.addClass,e=c.delClass,f=c.condClass;a.DEFAULT_EVENTS=["onBodyDblClick","onBodyScroll","onRowClick","onRowDblClick","onResetIds"],a.CONSTRUCT=function(){this.__scrollConts=0};var g=DlException.stopEventBubbling;a.DEFAULT_ARGS={_records:["records",null],_selection:["selection",null],_data:["data",null],_page:["page",0],_rpp:["rpp",60],_minReqRows:["minReq",null],_threshold:["threshold",null],_vScroll:["virtualScrolling",true],_cols:["cols",null],_headType:["headType",DlDataGridHeadLabel],_focusable:["focusable",true],_rtClickKeepSel:["rightClickKeepsSel",false],_noReselect:["noReselect",false],_rarify:["rarifyScroll",null]};var i=String.buffer("<div class='DlDataGrid-Headers'>","<table class='DlDataGrid-rowTable' cellspacing='0' cellpadding='0'>","<tbody><tr></tr></tbody>","</table></div>","<div class='DlDataGrid-Body'>","<div class='DlDataGrid-VSHeight'>","<div class='DlDataGrid-VSHeight-before'></div>","<div class='DlDataGrid-RowsCont'></div>","</div>","</div>").get();b.getHeaderDiv=function(){return this.getElement().firstChild},b.getHeaderTable=function(){return this.getHeaderDiv().firstChild},b.getHeaderRow=function(){return this.getHeaderDiv().firstChild.rows[0]},b.getBodyDiv=function(){return this.getElement().childNodes[1]},b._getVSHeightDiv=function(){return this.getBodyDiv().firstChild},b._getVSScrollDiv=function(){return this._getVSHeightDiv().firstChild},b.getRowsContainer=function(){return this._getVSHeightDiv().childNodes[1]},b.resetIDS=function(a){var b={},c=this._selection;a.foreach(function(a,c){b[a]=c}),this._records={array:a,id_to_pos:b},c.filter(b),c.getArray().length==0&&(c._last=null),this.callHooks("onResetIds")},b._fetch_data=function(a,b,c){var d=this._minReqRows,e=a.length,f=this._data;if(d==null||d<=e)f.getRecords(a,c,this);else{var g=a.slice(0),h=this._records.array,i,j=this._threshold||Math.ceil(this._rpp/2);if(b<=0){var k=this._records.id_to_pos[a[0]],l=j;while(l-->0)if(!f.hasRecord(h[--k]))break;if(l>0)for(i=k;i>=0&&g.length<d;i--){var m=h[i];f.hasRecord(m)||g.push(m)}}if(b>=0){var k=this._records.id_to_pos[a.peek()],l=j;while(l-->0)if(!f.hasRecord(h[++k]))break;if(l>0)for(i=k;i<h.length&&g.length<d;i++){var m=h[i];f.hasRecord(m)||g.push(m)}}f.getRecords(g,function(a){c.call(this,a.slice(0,e))},this)}},b._display_ids=function(a,b){this._info_display={length:a.length,first_row_index:this._records.id_to_pos[a[0]],last_row_index:this._records.id_to_pos[a.peek()]},this._fetch_data(a,0,function(a){var c=String.buffer();a.foreach(this._fetchRowHTML.$(this,c)),this.getRowsContainer().innerHTML=c.get(),b!=null&&this._setVScroll(b),this._resetVSHeight(),a.length>1?this.scrollToRecord(a[1].id()):this._setVScroll(this.getBodyDiv().scrollTop=0),this.getBoundRecords()})},b.displayPage=function(a){a==null&&(a=0),this._page=a;var b=this._records.array;if(this._rpp){var c=a*this._rpp;b=b.slice(c,c+this._rpp)}this._display_ids(b)},b._resetVSHeight=function(){this._vScroll&&this._info_display&&(h=Math.floor(this.getRowsContainer().offsetHeight*this.getNRecords()/this._info_display.length),this._getVSHeightDiv().style.height=isNaN(h)?"":h+"px")},b._setVScroll=function(a){var b=this._getVSScrollDiv();a?(b.style.height=a+"px",b.style.display="block"):b.style.display="none"},b.initWidths=function(){var a={};this._cols.foreach(function(b){a[b.id()]=this.getColWidth(b)},this);for(var b=this.getRowsContainer(),c=b.firstChild;c;c=c.nextSibling)for(var d=c.firstChild.rows[0].cells,e=d.length;--e>=0;){var f=d[e],g=f.getAttribute("colid");a[g]=Math.max(a[g]||0,f.offsetWidth)}this._cols.foreach(function(b){this.setColWidth(b,a[b.id()])},this)},b.resetColumns=function(a){var b=this.getHeaderRow(),c=b.cells,d=[];this._cols=a.map(function(a,b){var c=this._colsById[a.id];d.push(c._cell),c.index=b,c._width=a.width,c._isVisible=a.visible;return c},this);var e=document.createDocumentFragment();d.foreach(function(a){e.appendChild(a)}),b.appendChild(e),this.refreshDisplay(),this._cols.foreach(function(a){this.setColVisible(a,a.isVisible()),this.setColWidth(a,a.getWidth())},this)},b.reorderColumn=function(a,b,c){var d=a.index,e=b.index;c&&e++;var f=this._cols;f.splice(d,1),f.splice(d<e?e-1:e,0,a);for(var g=0;g<f.length;++g)f[g].index=g;for(var g=this.getRowsContainer().firstChild;g;g=g.nextSibling){var h=g.firstChild.rows[0].cells,a=h[d],b=h[e];a.parentNode.insertBefore(a,b||null)}var h=this.getHeaderRow().cells,a=h[d],b=h[e];a.parentNode.insertBefore(a,b||null),this._computeColPos()},b.getNRecords=function(){return this._records?this._records.array.length:0},b.getNPages=function(){if(!this._rpp)return 1;return Math.ceil(this.getNRecords()/this._rpp)},b.rec_isSelected=function(a){return this._selection.isSelected(a.id())},b._computeColPos=function(){var a=-1;this._headCont._colPos=this._cols.map(function(b){a+=this.getColWidth(b);return{pos:a,col:b}},this)},b._createElement=function(){a.BASE._createElement.call(this),this.getElement().id=this.id,this._ss=new DlStyleSheet,this._cssPrefix="#"+this.id,this.setContent(i),this._initHeaders(),this.getBodyDiv().onscroll=this._rarify?k.rarify(this._rarify.calls,this._rarify.timeout,this):k.$(this);var b=this._headCont=new DlContainer({parent:this,element:this.getHeaderDiv()});b.addEventListener({onMouseMove:DlDataGridHeadLabel._on_headMouseMove,onMouseLeave:DlDataGridHeadLabel._on_headMouseLeave,onMouseEnter:this._computeColPos.$(this)}),this._bodyCont=new DlContainer({parent:this,element:this.getBodyDiv(),drag:this._dragArgs}),this._dragArgs=null,"onMouseOver onMouseOut onMouseDown onMouseUp onMouseLeave onDblClick".qw().foreach(function(a){this.addEventListener(a,this["_body_"+a])},this),this._cacheEvents={onChange:this._data_onChange.$(this),onInsert:this._data_onInsert.$(this),onDelete:this._data_onDelete.$(this),onRefresh:this._data_onRefresh.$(this)},this.setCache(this._data),this.addEventListener("onDestroy",this._onDestroy),this._records&&this.resetIDS(this._records),this._sel_events={onChange:this._sel_onChange.$(this),onReset:this._sel_onReset.$(this)},this._selection||(this._selection=new DlSelectionModel({})),this.setSelectionModel(this._selection)},b._onDestroy=function(){this._ss.destroy(),this.setCache(null)},b.setCache=function(a){this._data&&this._data.removeEventListener(this._cacheEvents),(this._data=a)&&a.addEventListener(this._cacheEvents)},b._data_onChange=function(a){var b=this.getRowElement(a.id());if(b){var d=String.buffer();this._fetchRowHTML(d,a),d=d.get();if(is_ie)b.outerHTML=d;else{var e=c.createFromHtml(d);c.trash(b.parentNode.replaceChild(e,b))}}},b._data_onInsert=function(a,b){var c=this._records.array;b==null&&(b=c.length),c.splice(b,0,a.id()),this.resetIDS(c),this.refreshDisplay()},b._data_onDelete=function(a){var b=this._records.array;a instanceof Array?a.foreach(function(a){this.remove(a)},b):b.remove(a),this.resetIDS(b),this.refreshDisplay()},b._data_onRefresh=function(){},b._recompDynamicWidths=function(){var a=this.getBodyDiv().clientWidth,b=[];this._cols.foreach(function(c){c.getFill()==null?a-=this.getColWidth(c):b.push(c)},this),a-=1,b.foreach(function(b){this.setColWidth(b,a*b.getFill())},this)},b._initHeaders=function(){this._colsById={},this._cols.foreach(function(a,b){a instanceof DlGridCol||(a=this._cols[b]=new DlGridCol(a)),a.addEventListener("onVisibility",this.setColVisible.$(this,a)),a.index=b,this._colsById[a.id()]=a;var c="DlDataGrid-col-"+a.id(),d=this._cssPrefix+" ."+c;d=d+","+d+" .DlDataGrid-cellData";var e=[],f=a.getWidth();typeof f=="number"&&e.push("width:"+f+"px"),e=e.join(";"),a._cssRule=this._ss.insertRule(d,e),a.isVisible()||this._ss.modifyRule(a._cssRule,{display:"none"});var g=a._cell=document.createElement("td");g.innerHTML="<div class='DlDataGrid-cellData'></div>",g.className=c,this.getHeaderRow().appendChild(g);var h=this._makeHeadLabel({parent:this,appendArgs:g.firstChild,iconClass:a.getIconClass(),label:a.getLabel(),col:a,className:"DlGrid-align-"+a.getStyle("textAlign","left"),tooltip:a.getTooltip.$(a),drag:this._getDragObject()});a._button=h},this)},b.findRowFromEvent=function(a){return j(a)};function j(a){var b=a.target,c,d,e,f,g;try{while(b&&b.tagName){if((g=b.tagName.toLowerCase())=="div"&&(e=b.getAttribute("recid"))!=null){c=b;break}!f&&g=="td"&&(d=b,f=b.getAttribute("colid")),b=b.parentNode}}catch(a){}return c?{row:c,col:d,id:e,col_id:f}:null}b._sel_onChange=function(a,b){var c=this.getRowElement(a);c&&f(c,b,"DlDataGridRow-selected")},b._sel_onReset=function(a,b){var c,f;for(c in a)b[c]||(f=this.getRowElement(c))&&e(f,"DlDataGridRow-selected");for(c in b)a[c]||(f=this.getRowElement(c))&&d(f,"DlDataGridRow-selected")},b.setSelectionModel=function(a){this._selection&&this._selection.removeEventListener(this._sel_events),this._selection=a,a.addEventListener(this._sel_events)},b._body_onDblClick=function(a){this.callHooks("onBodyDblClick");var b=j(a);b&&this.callHooks("onRowDblClick",b)},b._body_onMouseOver=function(a){var b=j(a);b&&this.__tooltip instanceof Function&&(this._tooltipRow=b,DlWidget.getTooltip().popup({timeout:this.__tooltipTimeout,content:this.__tooltip.$(this,b),anchor:this.getElement(),align:"mouse",onPopup:this.__onTooltipShow,onHide:this.__onTooltipHide,widget:this}))},b._body_onMouseOut=function(a){var b=j(a);b&&(DlWidget.getTooltip().hide(),this._tooltipRow=null)},b._body_onMouseLeave=function(a){},b.__handleSelectClick=function(a,b){var c=this._selection,d=this._records;if(c.multiple)if(b.button==2)this._rtClickKeepSel||(b.ctrlKey?(this.callHooks("onRowClick",a,b,{rtc:true,ctrl:true,type:"select",ids:[a.id]}),c.select([a.id])):c.isSelected(a.id)||(this.callHooks("onRowClick",a,b,{rtc:true,type:"reset",ids:[a.id]}),c.reset([a.id])));else if(b.ctrlKey)this.callHooks("onRowClick",a,b,{ctrl:true,type:"toggle",ids:[a.id]}),c.toggle(a.id),c._last=a.id;else if(b.shiftKey)if(c._last!=null){var e=d.id_to_pos[c._last],f=d.id_to_pos[a.id],g=d.array.slice(Math.min(e,f),Math.max(e,f)+1);this.callHooks("onRowClick",a,b,{shift:true,type:"reset",ids:g}),c.reset(g)}else this.callHooks("onRowClick",a,b,{shift:true,type:"toggle",ids:[a.id]}),c.toggle(a.id),c._last=a.id;else this.callHooks("onRowClick",a,b,{type:"reset",ids:[a.id]}),c.reset([a.id]),c._last=a.id;else if(!this._noReselect||!c.isSelected(a.id))this.callHooks("onRowClick",a,b,{type:"reset",ids:[a.id]}),c.reset([a.id]),c._last=a.id},b._body_onMouseUp=function(a){var b=j(a),c=this.__handleOnMouseUp;b&&c&&b.id==c.id&&this.__handleSelectClick(b,a)},b._body_onMouseDown=function(a){var b=j(a),c=this._selection;b&&(this.__handleOnMouseUp=!c.isSelected(b.id)||!this._bodyCont._dragArgs||a.ctrlKey||a.shiftKey?null:b,this.__handleOnMouseUp||this.__handleSelectClick(b,a),a.button!=2&&g())},b.scrollToRecord=function(a,b){var c=this.getRowsContainer(),d=Math.floor(c.offsetHeight/c.childNodes.length),e=d*this._records.id_to_pos[a||this._selection._last],f=this.getBodyDiv(),g=f.scrollTop,h=f.clientHeight;if(b==null)e<g?(f.scrollTop=e,this._setVScroll(d*this._info_display.first_row_index)):e+d>g+h&&(f.scrollTop=e+d-h,this._setVScroll(d*this._info_display.first_row_index));else switch(b){case"top":f.scrollTop=e;break;case"bottom":f.scrollTop=e+d-h;break;case"center":f.scrollTop=(2*e+d-h)/2}},b.scrollHome=function(){this.getBodyDiv().scrollTop=0},b.scrollEnd=function(){this.getBodyDiv().scrollTop=this._getVSHeightDiv().offsetHeight},b.scrollPage=function(a){var b=this.getBodyDiv();b.scrollTop+=a*b.clientHeight-20},b._handle_focusKeys=function(b){var c=this._selection,d=b.keyCode,e=b.charCode,f=this._records,h;switch(d){case DlKeyboard.ARROW_DOWN:h=-1,c._last!=null&&(h=f.id_to_pos[c._last]);if(b.shiftKey&&c.multiple){var i=f.array.slice(h,h+2);c.select(i),c._last=i.peek()}else{h=f.array.limitIndex(h+1);var j=f.array[h];c.reset([j]),c._last=j}this.scrollToRecord(),g();break;case DlKeyboard.ARROW_UP:h=f.array.length,c._last!=null&&(h=f.id_to_pos[c._last]);if(b.shiftKey&&c.multiple){var i=f.array.slice(h-1,h);c.select(i),c._last=i.peek()}else{h=f.array.limitIndex(h-1);var j=f.array[h];c.reset([j]),c._last=j}this.scrollToRecord(),g();break;case DlKeyboard.HOME:this.scrollHome(),g();break;case DlKeyboard.END:this.scrollEnd(),g();break;case DlKeyboard.PAGE_UP:this.scrollPage(-1),g();break;case DlKeyboard.PAGE_DOWN:this.scrollPage(1),g()}a.BASE._handle_focusKeys.call(this,b)},b._makeHeadLabel=function(a){return new this._headType(a)},b._onHeadClick=function(a,b){if(a.isSortable()){a=a.id();var c=this.__sortCol||null,d=null;a==c&&(d=true,this.__sortRev&&(d=!d)),this.__sortRev=d,this._data.sort(this._records.array,a,c,d,this._handleSort.$(this,a,d))}},b._handleSort=function(a,b,c){this.resetIDS(c),this.refreshDisplay(),this.setSortColumn(a,b)},b.setSortColumn=function(a,b){var c=this.__sortCol;c&&(c=this._colsById[c],c._button.delClass(/DlDataGridHeadLabel-sort-[^\s]+/g)),(this.__sortCol=a)&&this._colsById[a]._button.condClass(b,"DlDataGridHeadLabel-sort-down","DlDataGridHeadLabel-sort-up")},b.getSortColumn=function(){return this.__sortCol},b.getSortReverse=function(){return this.__sortRev},b.getCol=function(a){a instanceof DlGridCol||(a=this._colsById[a]);return a},b.getRec=function(a){a instanceof DlRecord||(a=this._data.get(a));return a},b.setColWidth=function(a,b){a=this.getCol(a),a._width=b,this._ss.modifyRule(a._cssRule,{width:b+"px"})},b.setColVisible=function(a,b){a=this.getCol(a),this._ss.modifyRule(a._cssRule,{display:b?"":"none"}),a._isVisible=!!b},b.getColWidth=function(a){a=this.getCol(a);return this.getHeaderRow().cells[a.index].offsetWidth},b._getDragObject=function(){this.__drag||(this.__drag=new DlGridDragCol({}));return this.__drag},b._fetchRowContentHTML=function(a,b){a("<table class='DlDataGrid-rowTable' cellspacing='0' cellpadding='0'><tr>");var c=this._cols,d=c.length,e=this._data,f,g,h,i;for(i=0;i<d;++i)f=c[i],g=f.id(),a("<td colid='",g,"' class='DlDataGrid-col-",g),(h=e.getCellClass(b,f.id()))&&a(" ",h),a("'>"),is_ie&&a("<div class='DlDataGrid-cellData'>"),e.formatHTML(b,f.id(),a),is_ie&&a("</div>"),a("</td>");a("</tr></table>")},b._fetchRowHTML=function(a,b){var c="DlDataGrid-row",d=this._data.getRecClass(b);d&&(c+=" "+d),this.rec_isSelected(b)&&(c+=" DlDataGridRow-selected"),a("<div id='",this.id,":",b.id(),"' class='",c,"' recid='",b.id(),"'>"),this._fetchRowContentHTML(a,b),a("</div>")},b.getRowElement=function(a){return document.getElementById(this.id+":"+a)},b.refreshDisplay=function(){this._oldScroll=null;var a=this.getBodyDiv(),b=a.scrollTop,c=this.getRowsContainer(),d=this._records.array,e=this._info_display;this._rpp&&d.length<this._rpp&&this.displayPage(0);if(this._rpp){var f=Math.floor(c.offsetHeight/c.childNodes.length),g=Math.ceil(b/f)-1;g<0&&(g=0);var h=Math.floor((b+a.clientHeight)/f);h>=d.length&&(h=d.length-1);var i=d.slice(g,g+this._rpp);this._display_ids(i,f*g)}},b.__doLayout=function(){var a=this.getInnerSize(),b=this.getBodyDiv(),d=this.getHeaderDiv();c.setOuterSize(b,a.x,a.y-d.offsetHeight),c.setOuterSize(d,a.x,null),this._resetVSHeight(),this._records&&this._records.array.length>0&&(this._oldScroll=null,k.call(this)),this._recompDynamicWidths()},b.getBoundRecords=function(){var a=this.getBodyDiv(),b=a.scrollTop,c=this.getRowsContainer(),d=this._records.array,e=c.offsetHeight;if(e==0)return this.__boundRecords;var f=Math.floor(e/c.childNodes.length),g=Math.ceil(b/f)-1;g<0&&(g=0);var h=Math.floor((b+a.clientHeight)/f);h>=d.length&&(h=d.length-1);return this.__boundRecords={first:g,last:h,count:h-g+1,h:f}};function k(){if(!this._processing_scroll){this._processing_scroll=true;var a=this.getBodyDiv(),b=a.scrollTop;this.getHeaderTable().style.marginLeft=-a.scrollLeft+"px";if(this._vScroll&&this._records&&b!=this._oldScroll){var d=this.getRowsContainer(),e=this._records.array,f=this._info_display,g=this.getBoundRecords(),h=g.first,i=g.last;g=g.h;if(!(h>=f.first_row_index&&i<=f.last_row_index))if(i<f.first_row_index||h>f.last_row_index){var j=e.slice(h,h+this._rpp);this._display_ids(j,g*h)}else if(h<f.first_row_index){var j=e.slice(h,f.first_row_index);this.__scrollConts++,this.__cont=function(a){var b=String.buffer("<div>"),e=a.length;a.foreach(this._fetchRowHTML.$(this,b)),b("</div>");var i=b.get(),j=c.createFromHtml(i),k;try{var l=document.createRange(),m=d.childNodes;l.selectNodeContents(j),k=l.extractContents(),l.detach(),l=document.createRange(),l.setStartBefore(m[m.length-e]),l.setEndAfter(m[m.length-1]),l.deleteContents()}catch(a){k||(k=document.createDocumentFragment());while(j.firstChild)d.removeChild(d.lastChild),k.appendChild(j.firstChild)}d.insertBefore(k,d.firstChild),this._setVScroll(g*h),f.first_row_index=h,f.last_row_index-=e},this._fetch_data(j,-1,function(a){this.__scrollConts--,this.__scrollConts==0&&this.__cont(a)})}else if(i>f.last_row_index){var j=e.slice(f.last_row_index+1,i+1);this.__scrollConts++,this.__cont=function(a){var b=String.buffer("<div>"),e=a.length;a.foreach(this._fetchRowHTML.$(this,b)),b("</div>");var h=b.get(),j=c.createFromHtml(h),k;try{var l=document.createRange();l.selectNodeContents(j),k=l.extractContents(),l.detach(),l=document.createRange(),l.setStartBefore(d.firstChild),l.setEndBefore(d.childNodes[e]),l.deleteContents()}catch(a){k||(k=document.createDocumentFragment());while(j.firstChild)d.removeChild(d.firstChild),k.appendChild(j.firstChild)}d.appendChild(k),this._setVScroll(this._getVSScrollDiv().offsetHeight+g*e),f.first_row_index+=e,f.last_row_index=i},this._fetch_data(j,1,function(a){this.__scrollConts--,this.__scrollConts==0&&this.__cont(a)})}this._oldScroll=b}this.callHooks("onBodyScroll"),this._processing_scroll=false}}}),DEFINE_CLASS("DlDragDataGrid",DlDrag,function(a,b){b.startOK=function(a,b){var c=a.parent,d=false,e=b.target;while(e&&e!=a.getElement()){if(e==c._getVSHeightDiv()){d=true;break}e=e.parentNode}d&&c._selection.getArray().length>0?this.grid=c:d=false;return d},b.reset=function(){this.grid=null,a.BASE.reset.apply(this,arguments)}}),DEFINE_CLASS("DlDesktop",DlContainer,function(a,b){a.DEFAULT_ARGS={_bounds:["bounds",new DlRect(500,70,500,500)]},b._createElement=function(){a.BASE._createElement.call(this);var b=this.getElement();this._bounds.positionDiv(b),document.body.appendChild(b)};if(is_ie)var c=Dynarch.ID("IEsux"),d=function(){var a=document.getElementById(c);a||(a=document.createElement("div"),a.style.position="absolute",a.style.right=a.style.bottom=a.style.width=a.style.height="0px",a.style.zIndex="-100",document.body.appendChild(a)),this.setSize({x:a.offsetLeft,y:a.offsetTop+a.offsetHeight})};b.fullScreen=function(){var a=this.getElement().style;a.left=a.top="0px",a.height=a.width="100%";var b;is_ie?b=d.$(this):b=this.callHooks.$(this,"onResize"),DynarchDomUtils.addEvent(window,"resize",b.clearingTimeout(25))}}),DEFINE_CLASS("DlTable",DlContainer,function(a,b,c){var d=c.createElement;a.FIXARGS=function(a){a.tagName="table",this._colSpan=0},a.DEFAULT_ARGS={__cellSpacing:["cellSpacing",null],__cellPadding:["cellPadding",null],__align:["align",null]},b._createElement=function(){a.BASE._createElement.call(this);var b=this.getElement();this.__cellPadding!=null&&(b.cellPadding=this.__cellPadding),this.__cellSpacing!=null&&(b.cellSpacing=this.__cellSpacing),this.__align!=null&&(b.align=this.__align),d("tbody",null,null,b)},b.getContentElement=function(){return this.getElement().firstChild},b.addRow=function(){return new DlTableRow({parent:this})},b.getRow=function(a){return this.children(a)},b.addCell=function(a,b,c){var d=new DlTableCell({parent:a});b!=null&&d.addClass("DlAlign-"+b);if(c!=null){var e=d.getElement().style;e.verticalAlign=c}var f=d.getElement().cellIndex+1;f>this._colSpan&&(this._colSpan=f);return d},b.getColSpan=function(){return this._colSpan},b.setColSpan=function(a){this._colSpan=a},b.addSeparator=function(a){a==null&&(a=this.getColSpan()),d("div",null,{innerHTML:"&nbsp;"},d("td",null,{colSpan:a},d("tr",null,{className:"DlTable-RowSeparator"},this.getContentElement())))}}),DEFINE_CLASS("DlTableRow",DlContainer,function(a,b){a.DEFAULT_ARGS={_tagName:["tagName","tr"]}}),DEFINE_CLASS("DlTableCell",DlContainer,function(a,b){a.DEFAULT_ARGS={_tagName:["tagName","td"]}}),DEFINE_CLASS("DlFieldGrid",DlTable,function(a,b){a.CONSTRUCT=function(){this.__fields={}},b.addField=function(a,b,c){var d=a.widget||new DlEntry(a),e=a.label;b||(b={}),e&&(e instanceof DlWidget?e instanceof DlLabel&&e.setWidget(d):e=new DlLabel({label:a.label.makeLabel(),widget:d}));var f=this.addRow(),g=this.addCell(f,"right",a.valign);g.addClass("DlFieldGrid-labelCell"),a.valign=="top"&&e instanceof DlLabel&&(g.getElement().style.paddingTop="4px"),e&&g.appendWidget(e);if(b.middleText){var h=this.addCell(f);h.setContent(b.middleText)}var i=this.addCell(f);i.appendWidget(d);var j=a.id||a.name;j!=null&&(this.__fields[j]=d.getWidgetId(),delete a.id);if(b){var k=i.getElement();b.colSpan&&(k.colSpan=b.colSpan),b.rowSpan&&(k.rowSpan=b.rowSpan)}c&&(c.row=f,c.c1=g,c.c2=i,c.label=e,c.entry=d);return d},b.getField=function(a){return a?DlWidget.getById(this.__fields[a]):this.__fields},b.setField=function(a,b){this.__fields[a]=b.getWidgetId()},b.getValue=function(){var a={};for(var b in this.__fields){var c=this.getField(b),d=c.getFormValue||c.getValue;if(d instanceof Function)if(c instanceof DlAbstractButton&&c._checkTwoState(true)){var e=d.call(c);typeof e=="boolean"?a[b]=e:e==null?a[b]=c.checked():c.checked()&&(a[b]=e)}else a[b]=d.call(c)}return a},b.getValues=b.getValue,b.setValue=function(a){for(var b in a){var c=this.getField(b),d=a[b],e;c&&((e=c.setFormValue||c.setValue)instanceof Function&&(c instanceof DlAbstractButton&&c._checkTwoState(true)?c.checked(typeof d=="string"?d!="0":!!d):e.call(c,d)))}},b.setValues=b.setValue}),DEFINE_CLASS("DlFieldset",DlContainer,function(a,b,c){a.DEFAULT_ARGS={_label:["label","DlFieldset"]},b._createElement=function(){a.BASE._createElement.call(this),this.getElement().innerHTML=["<span class='DlFieldset-label'>",this._label,"</span>","<div class='DlFieldset-content'></div>"].join("")},b.getContentElement=function(){return this.getElement().childNodes[1]},b.getLabelElement=function(){return this.getElement().firstChild},b.setOuterSize=b.setSize=function(a){var b=c.getPos(this.getLabelElement()),d=c.getPos(this.getContentElement()),e=d.y-b.y;c.setOuterSize(this.getElement(),a.x,a.y-e),a=c.getInnerSize(this.getElement()),c.setOuterSize(this.getContentElement(),a.x,a.y),this.callHooks("onResize")}}),function(){var a={},b={};window.DlSingleton={get:function(c,d){return b[c]||!d&&(b[c]=new a[c])},register:function(b,c,d){a[b]=c,d&&(window[b]=this.get.$C(b))}}}(),DEFINE_SINGLETON("DlFlashUtils",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["onLoad","onStorageStatus"];var c=is_ie?String.template("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"215\" height=\"138\" id=\"DlFlashUtils-MOVIE\" align=\"middle\">","<param name=\"allowScriptAccess\" value=\"always\" />","<param name=\"movie\" value=\"$url\" />","<param name=\"quality\" value=\"high\" />","</object>"):String.template("<embed id=\"DlFlashUtils-MOVIE\" src=\"$url\" quality=\"high\" bgcolor=\"#ffffff\" width=\"215\" height=\"138\" ","allowScriptAccess=\"always\" ","type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"),d=null;window.DlFlashUtils_init=function(a){DlFlashUtils().callHooks("onLoad")},b.init=function(){if(!d){var a=c({url:Dynarch.getFileURL("swf/flash.swf")});document.write("<div style='position: absolute; z-index: 31000; left: -256px; top: 50%; margin-left: -108px; margin-top: -69px; width: 216px; height: 138px;'>"+a+"</div>"),d=document.getElementById("DlFlashUtils-MOVIE")}},b.getObject=function(){return d},b.display=function(a){d.parentNode.style.left=a?"50%":"-256px"};function e(a){var b=null;try{b=a.GetVariable("$version")}catch(a){}return b}var f={"ShockwaveFlash.ShockwaveFlash.7":e,"ShockwaveFlash.ShockwaveFlash.6":function(a){var b="Win 6,0,21";try{a.AllowScriptAccess="always",b=e(a)}catch(a){}return b},"ShockwaveFlash.ShockwaveFlash":e};b.isSupported=function(){var a=navigator.plugins;if(a&&a.length){a=a["Shockwave Flash"];if(a&&a.description&&/^Shockwave Flash\s+([^\s]+)/i.test(a.description))return parseFloat(RegExp.$1)>=8}else if(is_ie)for(var b in f)try{var c=new ActiveXObject(b);if(c){var d=f[b](c);if(d!=null){d=d.split(/\s+/)[1];return parseFloat(d)>=8}}}catch(a){}return false},b.loadPolicyFile=function(a){return this.getObject().DlSocket_loadPolicyFile(a)};var g=b.decodeString=function(a){return a.replace(/%22/g,"\"").replace(/%5c/g,"\\").replace(/%26/g,"&").replace(/%25/g,"%")},h=b.decodeObject=function(a){var b,c;if(a instanceof Array)for(b=a.length;--b>=0;)a[b]=h(a[b]);else if(typeof a=="object"){if(a==null)return a;c={};for(b in a)c[g(b)]=h(a[b]);a=c}else typeof a=="string"&&(a=g(a));return a}}),DlFlashStore={set:function(a,b){DlFlashUtils().getObject().DlStorage_set(a,b)},get:function(a){return DlFlashUtils().decodeObject(DlFlashUtils().getObject().DlStorage_get(a))},getAllKeys:function(){return DlFlashUtils().decodeObject(DlFlashUtils().getObject().DlStorage_getAllKeys())},remove:function(a){DlFlashUtils().getObject().DlStorage_remove(a)},clear:function(){DlFlashUtils().getObject().DlStorage_clear()},flush:function(a){var b=DlFlashUtils().getObject().DlStorage_flush();a&&b=="pending"&&DlFlashUtils().display(true);return b},_onStatus:function(a){DlFlashUtils().display(false),DlFlashUtils().applyHooks("onStorageStatus",[a])}},DEFINE_CLASS("DlGridLayout",DlLayout,function(a,b,c){var d=c.createElement,e=c.addClass;a.DEFAULT_ARGS={__layout:["layout",null],__layoutHTML:["layoutHTML",null],__cellSpacing:["cellSpacing",0],__cellPadding:["cellPadding",1]};var f=["width","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","verticalAlign","textAlign","whiteSpace"];b._createElement=function(){a.BASE._createElement.call(this);var b;if(this.__layoutHTML)this.setContent(this.__layoutHTML),b=this.getElement().getElementsByTagName("table")[0];else{b=d("table",null,{cellSpacing:this.__cellSpacing,cellPadding:this.__cellPadding,className:"DlGridLayout-table"}),d("tbody",null,null,b);var c=this.__layout;c.foreach(function(a){var c=a.props,d=b.insertRow(-1);c&&c.minHeight&&(e(d,"DlGridLayout-tr-minHeight"),d.minHeight=true),a.cells.foreach(function(a,b){var g=d.insertCell(-1);b==0&&c&&c.height&&(g.style.height=c.height),a&&(a.colSpan&&(g.colSpan=a.colSpan),a.className&&(g.className=a.className),a.rowSpan&&(g.rowSpan=a.rowSpan),a.minWidth&&e(g,"DlGridLayout-td-minWidth"),a.minHeight&&(g.minHeight=true,e(g,"DlGridLayout-td-minHeight")),f.r_foreach(function(b){var c=a[b];c!=null&&(this[b]=c)},g.style))})}),this.getElement().appendChild(b)}this.refNode("__table",b)},b._appendWidgetElement=function(b,c){if(c.inCell){var d=this.getCellElement(c.row,c.col);d.appendChild(b.getElement()),b._dllayout_args=c}else a.BASE._appendWidgetElement.call(this,b,c)},b._removeWidgetElement=function(b){if(this._widgets.contains(b))if(b._dllayout_args.inCell){var c=b.getElement();c.parentNode.removeChild(c)}else a.BASE._removeWidgetElement.call(this,b)},b.getTableElement=function(){return this.__table},b.getCellElement=function(a,b){return this.getTableElement().rows[a].cells[b]},b.doLayout=function(){var a=this.children();(2).times(function(b){a.foreach(function(a){var c=a._dllayout_args;if(!c.inCell){var d=this.getCellElement(c.row,c.col),e=d.offsetLeft,f=d.offsetTop,g=d.offsetWidth,h=d.offsetHeight;if(b==0){var i=a.getOuterSize();(d.minHeight||d.parentNode.minHeight)&&h<i.y&&(d.style.height=i.y+"px")}else{var j=a.getElement().parentNode.style;j.left=e+"px",j.top=f+"px",a.setOuterSize({x:g,y:h})}}},this)},this)},b.showWidgets=function(a){arguments.length==0&&(a=true),this.children().r_foreach(function(b){b.display(a)})}}),DlHtmlUtils={_blockTags:"body form textarea fieldset ul ol dl dd dt li div blockquote p h1 h2 h3 h4 h5 h6 quote pre table thead tbody tfoot tr td iframe address".hashWords(),_quickTags:"br hr input link meta img".hashWords(),_headingTags:"h1 h2 h3 h4 h5 h6".hashWords(),_descTags:"p blockquote td div li".hashWords(),isBlockElement:function(a){return a&&a.nodeType==1&&a.tagName.toLowerCase()in DlHtmlUtils._blockTags},needsClosingTag:function(a){return a&&a.nodeType==1&&!(a.tagName.toLowerCase()in DlHtmlUtils._quickTags)},htmlEncode:function(a){return String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\x22/g,"&quot;").replace(/\u00A0/g,"&#xa0;")},getHTML:function(a,b,c){var d=DlHtmlUtils,e=[],f=0,g=d.needsClosingTag,h=d.htmlEncode,i=d.getInnerText,j=null,k=null,l=null,m=d._descTags,n=d._headingTags,o=0;function p(a,b){var d;switch(a.nodeType){case 11:b=false;case 1:var q=a.tagName.toLowerCase();if(a.className=="DynarchLIB-REMOVE-ME")break;if(b){var r=!(a.hasChildNodes()||g(a));if(q=="br"){if(a.previousSibling&&!a.nextSibling)break;if(o){e[f++]="\n";break}}c&&(j==null&&q in n?(j=i(a),l=0):k==null&&q in m&&(k=i(a))),e[f++]="<",e[f++]=q;var s=a.attributes;for(d=0;d<s.length;++d){var t=s.item(d);if(!t.specified)continue;var u=t.nodeName.toLowerCase();if(/^_moz|^_msh/.test(u))continue;var v;u!="style"?typeof a[t.nodeName]!="undefined"&&u!="href"&&u!="src"&&!/^on/.test(u)?v=a[t.nodeName]:v=t.nodeValue:v=a.style.cssText;if(/(_moz|^$)/.test(v))continue;e[f++]=" "+u+"=\""+h(v)+"\""}e[f++]=r?" />":">"}for(q=="pre"&&++o,d=a.firstChild;d;d=d.nextSibling)p(d,true);q=="pre"&&--o,b&&!r&&(e[f++]="</"+q+">"),l===0&&(l=f);break;case 3:/^(script|style)$/i.test(a.parentNode.tagName)?a.data.indexOf("/*<![CDATA[*/")!=0?(e[f++]="/*<![CDATA[*/",e[f++]=a.data,e[f++]="/*]]>*/"):e[f++]=a.data:e[f++]=a.data.htmlEscape();break;case 4:case 8:e[f++]="<!--",e[f++]=a.data,e[f++]="-->"}}p(a,b);var q=e.join("");c&&(q={title:j,description:k,content:q,contentButTitle:""},l&&(q.contentButTitle=e.slice(l).join("")));return q},getInnerText:function(a){if(a.innerText!=null)return a.innerText;if(a.textContent!=null)return a.textContent},getText:function(a){for(var b=a.cloneNode(true),c=b.getElementsByTagName("*"),d=c.length;--d>=0;){var e=c[d];if(DlHtmlUtils.isBlockElement(e)){var f=e.ownerDocument.createTextNode(" ");e.insertBefore(f,e.firstChild),e.appendChild(f.cloneNode(true))}}var g=DlHtmlUtils.getInnerText(b);DynarchDomUtils.trash(b);return g},_can_t_DeleteFull_tags:"td".hashWords(),canDeleteFullNode:function(a){return!(a.toLowerCase()in DlHtmlUtils._can_t_DeleteFull_tags)},_can_t_DeleteContent_tags:"ul ol dd table tr img br hr".hashWords(),canDeleteContent:function(a){return!(a.toLowerCase()in DlHtmlUtils._can_t_DeleteContent_tags)},_can_t_StripNode_tags:"ul ol li dd dt dl img br hr table tr td object applet iframe form textarea".hashWords(),canStripNode:function(a){return!(a.toLowerCase()in DlHtmlUtils._can_t_StripNode_tags)}},DEFINE_CLASS("DlIconListView",DlContainer),DEFINE_CLASS("DlIconListItem",DlAbstractButton,function(a,b){a.DEFAULT_ARGS={__itemSize:["itemSize",{x:100,y:null}],__itemSpacing:["itemSpacing",0],__spaceEvenly:["spaceEvenly",false],__iconSize:["iconSize",{x:40,y:40}],__iconAbove:["iconAbove",true],_btnType:["type",DlAbstractButton.TYPE.TWOSTATE],_tagName:["tagName","table"],_classes:["classes",{active:"DlIconListItem-active",hover:"DlIconListItem-hover",checked:"DlIconListItem-1",unchecked:"DlIconListItem-0",empty:"DlIconListItem-empty",disabled:"DlIconListItem-disabled"}],_iconClass:["iconClass",null]};var c=["DlIconListItem-iconCell","DlIconListItem-labelCell"];b._createElement=function(){DlWidget.prototype._createElement.call(this);var a=this.getElement();a.cellSpacing=a.cellPadding=0,this.__spaceEvenly?a.style.margin=this.__itemSpacing+"px":a.style.marginRight=a.style.marginBottom=this.__itemSpacing+"px",a.insertRow(-1).insertCell(-1),a.insertRow(-1).insertCell(-1),a.align="left",this.setIconAbove(this.__iconAbove,true),this.setIconClass(this._iconClass),this.label(this._label,true),this.setIconSize(this.__iconSize),this._updateState()},b.setIconClass=function(a){this.getIconCell().className=c[0]+" "+a},b.getIconCell=function(){return this.getElement().rows[this.__iconAbove?0:1].cells[0]},b.getLabelCell=function(){return this.getElement().rows[this.__iconAbove?1:0].cells[0]},b.setIconSize=function(a){DynarchDomUtils.setInnerSize(this.getIconCell(),a.x,a.y),this.__iconSize=a},b.getIconSize=function(){return this.__iconSize},b.setIconAbove=function(a,b){var d=this.getElement().rows;b?(d[0].cells[0].className=c[a?0:1],d[1].cells[0].className=c[a?1:0]):a!==this.__iconAbove&&d[1].parentNode.insertBefore(d[1],d[0]),this.__iconAbove=a},b.label=function(a,b){a!=null&&(b||a!==this._label)&&(this._label=a,this.getLabelCell().innerHTML=String.buffer("<div class='DlIconListItem-labelDiv' style='width:",this.__itemSize.x,"px'>",a,"</div>").get(),this.applyHooks("onUpdateLabel",[this._label]));return this._label}}),DlJSON={RE_strings:/(\x22(\\.|[^\x22\\])*\x22|\x27(\\.|[^\x27\\])*\x27)/g,RE_forbid:/([\n;()+=\x2f*-])/g,encode:function(a){var b,c;if(a==null)b="null";else if(a.dynarchlib_toJSON)b=a.dynarchlib_toJSON();else if(a instanceof Array)b=["[",a.map(DlJSON.encode).join(","),"]"].join("");else if(a instanceof Date)b=DlJSON.encode(a.toUTCString());else if(typeof a=="object"){b=[];for(c in a)b.push([DlJSON.encode(c),":",DlJSON.encode(a[c])].join(""));b=["{",b.join(","),"}"].join("")}else typeof a=="string"?b=["\"",a.replace(/\x5c/g,"\\\\").replace(/\r?\n/g,"\\n").replace(/\t/g,"\\t").replace(/\x22/g,"\\\""),"\""].join(""):b=a.toString();return b},decode:function(a,b){if(!b){a=a.trim();var c=a.replace(DlJSON.RE_strings,"");if(DlJSON.RE_forbid.test(c))throw new DlSecurityException("Character "+RegExp.$1+" not allowed in JSON input!")}try{return Dynarch.evalClean(a)}catch(a){throw new DlDataException("Malformed data in JSON input: "+a)}},domToObject:function(a){for(var b={},c=String.buffer(),d=a.firstChild;d;d=d.nextSibling)if(d.nodeType==1){var e=DlJSON.domToObject(d),f=d.nodeName;f in b?(b[f]instanceof Array||(b[f]=[b[f]]),b[f].push(e)):b[f]=e}else d.nodeType==3&&c(d.nodeValue);b.$text=c.get();return b}};var DlKeyboard={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DASH:45,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,INSERT:45,DELETE:46,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,parseKey:function(a){var b={},c;a=a.toUpperCase();if(c=/^([a-z]+)\s+\x27(.)\x27$/i.exec(a))b[c[1]]=true,b.key=c[2];else if(c=/^([a-z]+)-([a-z]+)\s+\x27(.)\x27$/i.exec(a))b[c[1]]=b[c[2]]=true,b.key=c[3];else if(c=/^([a-z]+)-([a-z]+)-([a-z]+)\s+\x27(.)\x27$/i.exec(a))b[c[1]]=b[c[2]]=b[c[3]]=true,b.key=c[4];return b},checkKey:function(a,b){typeof b=="string"&&(b=DlKeyboard.parseKey(b));return(!b.CTRL&&!a.ctrlKey||b.CTRL&&a.ctrlKey)&&(!b.ALT&&!a.altKey||b.ALT&&a.altKey)&&(!b.SHIFT&&!a.shiftKey||b.SHIFT&&a.shiftKey)&&a.keyStr.toUpperCase()==b.key.toUpperCase()}};DlKeyboard.KEYS_CONTROL=["BACKSPACE","TAB","DELETE","ESCAPE","ENTER","PAGE_UP","PAGE_DOWN","END","HOME","ARROW_LEFT","ARROW_UP","ARROW_RIGHT","ARROW_DOWN"].keys_map(DlKeyboard).toHash(true),DlKeyboard.KEYS_MOVE=["ARROW_LEFT","ARROW_UP","ARROW_RIGHT","ARROW_DOWN"].keys_map(DlKeyboard).toHash(true),DlKeyboard.KEYS_MOVE_PREV=["ARROW_LEFT","ARROW_UP"].keys_map(DlKeyboard).toHash(true),DEFINE_CLASS("DlLabel",DlAbstractButton,function(a,b){a.DEFAULT_ARGS={_activateWidget:["widget",null],_tagName:["tagName","span"]},b._onMouseDown=function(a){var b=this._activateWidget;b&&(b.focus(),a.domStop=true,DlException.stopEventBubbling())},b.setWidget=function(a){this._activateWidget=a},b.getWidget=function(){return this._activateWidget},b._handle_accessKey=function(a){this._onMouseDown(a)}}),DEFINE_CLASS("DlLiteTree",DlContainer,function(a,b,c){a.DEFAULT_EVENTS="onItemMouseDown onItemDblClick".qw(),a.DEFAULT_ARGS={items:["items",null],sort:["sort",Function.identity],_opt_toggleSelection:["toggleSelection",false],_focusable:["focusable",true]},a.FIXARGS=function(a){Object.mergeUndefined(a,{fillParent:true})},a.CONSTRUCT=function(){this.addEventListener({onMouseDown:this._onMouseDown,onDblClick:this._onDblClick})},b.reset=function(a){this.top_items=a,this.setContent(this._buildHTML(a,0)),this._selection&&this._selection.filter(this._itemsById)},b.setSelectionModel=function(a){this._selection?this._selection.removeEventListener(this._selListeners):this._selListeners||(this._selListeners={onChange:this.$("_on_selChange"),onReset:this.$("_on_selReset")}),this._selection=a,a.addEventListener(this._selListeners)},b.isSelected=function(a){return this._selection&&this._selection.isSelected(a)},b.refreshItems=function(a){a.foreach(function(a){var b=this._getItemElement(a);if(b){var c=["item-label"],d=this._itemsById[a];this.isSelected(a)&&c.push("selected"),d.addClassNames(c),b.className=c.join(" ");var e=String.buffer("<span class='expander'></span>");d.formatHTML(e),b.innerHTML=e.get()}},this)},b.getItemById=function(a){return this._itemsById[a]},b._buildHTML=function(a,b){a=this.sort(a);if(a.length==0)return"";b==null&&(b=0),b==0&&(this._itemsById={});var c=String.buffer("<ul>");a.foreach(function(a){var d=a.children(),e=d.length>0;c("<li>");var f=["item-label"],g=a.id();a.addClassNames(f),this.isSelected(g)&&f.push("selected"),e&&f.push("expanded"),c("<div id='",this._makeId(g),"' lite-tree-item='",g,"' class='",f.join(" "),"'><span class='expander'></span>"),a.formatHTML(c),c("</div>",this._buildHTML(d,b+1),"</li>"),this._itemsById[a.id()]=a},this),c("</ul>");return c.get()},b._makeId=function(a){return this.id+":"+a},b._findItemFromEvent=function(a){var b={},c=a.target;while(c&&c.nodeType==1){var d=c.getAttribute("lite-tree-item");if(d!=null){b.el=c,b.id=d,b.item=this._itemsById[d];return b}c.className=="expander"&&(b.expander=c),c=c.parentNode}},b._getItemElement=function(a){return document.getElementById(this._makeId(a))},b.__handleSelectClick=function(a,b,d){var e=this._selection,f=this._itemsById[a.id],g=[f,a,b];if(d){e&&!e.isSelected(a.id)&&f.isSelectable()&&e.reset([a.id]),this.applyHooks("onItemDblClick",g);return}if(!e||a.expander||!a.item.isSelectable()){var h=a.el.nextSibling;if(h){var i=c.hasClass(h,"hidden");c.condClass(h,!i,"hidden"),c.condClass(a.el,i,"expanded","collapsed")}this.applyHooks("onItemMouseDown",g)}else e&&a.item.isSelectable()&&(e.multiple?b.ctrlKey?e.toggle(a.id):e.reset([a.id]):this._opt_toggleSelection&&e.isSelected(a.id)?e.toggle(a.id):e.reset([a.id]),this.applyHooks("onItemMouseDown",g))};var d=(new Date).getTime(),e=null;b._onMouseDown=function(a){var b=this._findItemFromEvent(a),c=(new Date).getTime();c-d<Dynarch.dblClickTimeout&&b&&e&&b.id==e.id?this.__handleSelectClick(b,a,true):b&&(d=c,this.__handleSelectClick(b,a,false)),e=b},b._on_selChange=function(a,b){c.condClass(this._getItemElement(a),b,"selected")},b._on_selReset=function(a,b){Object.foreach(a,function(a,b){c.delClass(this._getItemElement(b),"selected")},this),Object.foreach(b,function(a,b){c.addClass(this._getItemElement(b),"selected")},this)},a.Item=DEFINE_HIDDEN_CLASS(null,DlEventProxy,function(a,b){a.DEFAULT_ARGS={_name:["name",null],_id:["id",null],_children:["children",null]},a.CONSTRUCT=function(){this._children==null&&(this._children=[])},b.formatHTML=function(a){a(this._name)},b.addClassNames=Function.noop,b.id=function(){return this._id},b.children=function(){return this._children},b.isSelectable=Function.returnTrue})}),DEFINE_CLASS("DlMacBarIcon",DlAbstractButton,function(a,b){a.BEFORE_BASE=function(){this.__currentWidth=this.__minWidth,this.__currentHeight=this.__minHeight,this.__align=this.__align.split(/\s+/).toHash()};var c={active:"DlMacBarIcon-active",hover:"DlMacBarIcon-hover",checked:"DlMacBarIcon-1",unchecked:"DlMacBarIcon-0",empty:"DlMacBarIcon-empty",disabled:"DlMacBarIcon-disabled"};a.DEFAULT_ARGS={_classes:["classes",c],__image:["img",null],__minWidth:["minWidth",32],__minHeight:["minHeight",32],__maxWidth:["maxWidth",64],__maxHeight:["maxHeight",64],__align:["align","bottom"],__tooltipTimeout:["tooltipTimeout",900]},b._createElement=function(){DlWidget.prototype._createElement.call(this),this.setContent(String.buffer("<img src='",this.__image,"' width='",this.__minWidth,"' height='",this.__minHeight," ' />").get())},b.getImgElement=function(){return this.getElement().firstChild},b.flash=function(a){this._onMouseEnter(),this._onMouseLeave.delayed(a||100,this)},b.initDOM=function(){a.BASE.initDOM.call(this),this.addEventListener({onDestroy:d}),this.__anim=new DlAnimation(25,40),this.__anim.addEventListener({onUpdate:f.$(this),onStart:e.$(this)})};function d(){this.__anim.destroy()}b._onMouseEnter=function(){a.BASE._onMouseEnter.apply(this,arguments);var b=this.__anim;b.ew=this.__maxWidth,b.eh=this.__maxHeight,b.start(30,50,DlAnimation.easing.elastic_b)},b._onMouseLeave=function(){a.BASE._onMouseLeave.apply(this,arguments);var b=this.__anim;b.ew=this.__minWidth,b.eh=this.__minHeight,b.start(50,50,DlAnimation.easing.accel_b)};function e(){this.__anim.sw=this.__currentWidth,this.__anim.sh=this.__currentHeight}function f(){var a=this.__anim,b=this.getImgElement(),c=a.getPos(),d,e=a.getPos(function(a){return 1-Math.cos(a*2.5*Math.PI)/Math.exp(5*a)});b.width=this.__currentWidth=c.mapInt(a.sw,a.ew),b.height=this.__currentHeight=e.mapInt(a.sh,a.eh),a=this.__align,d=this.__minWidth-this.__currentWidth,a.center&&(d/=2);if(a.left||a.center)b.style.marginRight=d+"px";if(a.right||a.center)b.style.marginLeft=d+"px";d=this.__minHeight-this.__currentHeight,a.middle&&(d/=2);if(a.top||a.middle)b.style.marginBottom=d+"px";if(a.bottom||a.middle)b.style.marginTop=d+"px"}}),DEFINE_CLASS("DlNotebook",DlContainer,function(a,b){var c=["onChange"];b._createElement=function(){a.BASE._createElement.call(this),this.getElement().innerHTML="<div class='TabContent-inner'></div>"},b.appendWidget=function(b,c){b.registerEvents(["onNotebookShow"]),a.BASE.appendWidget.call(this,b);var d=b.getElement(),e=this.getContentElement();c!=null?c=this.__widgetsPosition:this.__widgetsPosition=c,c==null&&(c=this.__widgetsPosition=DynarchDomUtils.getPadding(e).x/2),d.style.position="absolute",d.style.visibility="hidden",d.style.left=d.style.top=c+"px",e.appendChild(d),this._panes.push(b)},b.initDOM=function(){this._panes=[],this._currentPane=null,this.registerEvents(c),a.BASE.initDOM.call(this)},b.getPane=function(a){return this._panes[a]},b.getAllPanes=function(){return this._panes},b.getCurrentPane=function(){return this.getPane(this._currentPane)},b.getCurrentPaneIndex=function(){return this._currentPane},b.length=function(){return this._panes.length},b.showPane=function(a){var b=this._currentPane;b!=null&&(this.getPane(b).visibility(false),this.getPane(b).setPos({x:-3e4,y:-3e4})),this._currentPane=a;var c=this.getPane(a);c._dl_notebook_has_size||(c.setSize(this.getInnerSize()),c._dl_notebook_has_size=true),c.setStyle({left:"",top:""}),c.visibility(true),a!==b&&this.applyHooks("onChange",[a,b]),c.callHooks("onNotebookShow");return this},b.firstPane=function(){this.showPane(0)},b.lastPane=function(){this.showPane(this.length()-1)},b.nextPane=function(){var a=this._currentPane;a==null?a=0:++a,a>=this._panes.length&&(a=0);return this.showPane(a)},b.prevPane=function(){var a=this._currentPane;a==null?a=this._panes.length-1:--a,a<0&&(a=this._panes.length-1);return this.showPane(a)},b.isFirstPane=function(){return this._currentPane==0},b.isLastPane=function(){return this._currentPane==this._panes.length-1},b.getContentElement=function(){return this.getElement().firstChild},b.setSize=b.setOuterSize=function(b){a.BASE.setOuterSize.call(this,b);var c=this.getElement();b=DynarchDomUtils.getInnerSize(c),DynarchDomUtils.setOuterSize(this.getContentElement(),b.x,b.y),c.style.width=c.style.height="",b=DynarchDomUtils.getInnerSize(this.getContentElement());var d=this.getCurrentPane();this._panes.foreach(function(a){a._dl_notebook_has_size=false}),d.setSize(b),d._dl_notebook_has_size=true},b.setIdealSize=function(){var a={x:0,y:0};this._panes.r_foreach(function(b){var c=b.getOuterSize();c.x>a.x&&(a.x=c.x),c.y>a.y&&(a.y=c.y)}),this.setInnerSize(a)}}),DEFINE_CLASS("DlProgressBar",DlWidget,function(a,b){var c=DynarchDomUtils.createElement;a.DEFAULT_ARGS={__progress_minVal:["min",0],__progress_maxVal:["max",100],__progress_val:["val",0],__label:["label",null]},b._createElement=function(){a.BASE._createElement.call(this);var b=this.getElement();c("div",null,{className:"DlProgressBar-fill"},b),c("div",null,{className:"DlProgressBar-label",innerHTML:"&nbsp;"},b),this.setLabel(this.__label),this.setValue(this.__progress_val)},b._getLabelElement=function(){return this.getElement().lastChild},b._getFillElement=function(){return this.getElement().firstChild},b.getValue=function(){return this.__progress_val},b.getMaxVal=function(){return this.__progress_maxVal},b.getMinVal=function(){return this.__progress_minVal},b.setValue=function(a){(this.__progress_val=a)>this.__progress_maxVal&&(a=this.__progress_maxVal);var b=this.__progress_maxVal-this.__progress_minVal,c=a-this.__progress_minVal,d=100*c/b;!isNaN(d)&&d>=0&&(this._getFillElement().style.width=d+"%",this._updateLabel(d))},b.setLabel=function(a){this.__label=a,this._updateLabel()},b._updateLabel=function(a){var b=this.__label;a==null&&(a=0),b!=null&&(typeof b=="function"?b=b(this,a,this.__progress_val):b=b.replace(/%d/g,Math.round(a)).replace(/%f/g,a.toFixed(2)).replace(/%v/g,this.__progress_val),/\S/.test(b)||(b="&nbsp;"),this._getLabelElement().innerHTML=b)},b.reset=function(a,b,c,d){c==null&&(c=a),this.__progress_minVal=a,this.__progress_maxVal=b,arguments.length>3&&(this.__label=d),this.setValue(c)}}),DEFINE_CLASS("DlRadioButton",DlCheckbox,function(a,b){a.FIXARGS=function(a){a.alwaysCheck=true},a.DEFAULT_ARGS={_groupId:["group",0],_classes:["classes",{active:"DlRadioButton-active",hover:"DlRadioButton-hover",checked:"DlRadioButton-1",unchecked:"DlRadioButton-0",empty:"DlRadioButton-empty",disabled:"DlRadioButton-disabled"}]},b.FINISH_OBJECT_DEF=function(){a.BASE.FINISH_OBJECT_DEF.call(this),this._className.remove("DlCheckbox")}}),DEFINE_CLASS("DlRadioSelect",DlButtonMenu,function(a,b){a.DEFAULT_ARGS={_options:["options",[]],_value:["value",null],_connected:["connected",true]},a.DEFAULT_EVENTS=["onChange"],a.CONSTRUCT=function(){this._radioGroup=DlRadioGroup.get(),this._options.length&&this.setOptions(this._options),this.value(this._value,true),this.addEventListener("onDestroy",function(){this._radioGroup.reset()})},b.value=function(a,b,c){var d=this._value;if(b||typeof a!="undefined"&&a!==d)this._value=a,this._updateLabel(),c||this.applyHooks("onChange",[d,a]);return d},b.getValue=function(){return this.value()},b.setValue=b.value;function c(a){this.value(a.userData),DlPopup.clearAllPopups(),a._onMouseLeave()}b._updateLabel=function(){var a=null,b=this._options,c,d;for(c=b.length;--c>=0;){d=b[c];if(d==null)continue;this._value==d.value?(this.getButton().label(d.label),d.widget.checked(true,true)):d.widget.checked(false,true)}},b.setOptions=function(a){var b=this._radioGroup,d,e;b.reset(),b.addEventListener("onChange",c.$(this)),d=new DlVMenu({className:"DlSelect-menu"}),e={parent:d,group:b,noCapture:true},a.foreach(function(a){if(a==null)d.addSeparator();else{e.label=a.label,e.data=e.value=a.value,e.className=a.className;var b=a.widget=new DlRadioButton(e)}},this);var f=d.getElement();f.style.position="absolute",d.zIndex(-100),document.body.appendChild(f);var g=d.getOuterSize().x;document.body.removeChild(f),d.zIndex(""),f.style.position="",function(){this.getButton().setOuterSize({x:g-this.getArrow().getOuterSize().x+2})}.$(this).delayed(10),this.setMenu(d),this._options=a},b.addOption=function(a,b){b==null&&(b=this._options.length);var c=a.widget=new DlRadioButton({parent:this._menu,group:this._radioGroup,noCapture:true,label:a.label,data:a.value,value:a.value,className:a.className});this._options.splice(b,0,a);return c}}),DlRegexp={EMAIL:/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,MIME_WEB_IMAGE:/^image\x2f.*(png|jpe?g|gif|tiff?)/i,UNICODE_LETTER:"\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0523\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971\\u0972\\u097B-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D3D\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8B\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10D0-\\u10FA\\u10FC\\u1100-\\u1159\\u115F-\\u11A2\\u11A8-\\u11F9\\u1200-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u1676\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19A9\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u2094\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2C6F\\u2C71-\\u2C7D\\u2C80-\\u2CE4\\u2D00-\\u2D25\\u2D30-\\u2D65\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31B7\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FC3\\uA000-\\uA48C\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA65F\\uA662-\\uA66E\\uA67F-\\uA697\\uA717-\\uA71F\\uA722-\\uA788\\uA78B\\uA78C\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA90A-\\uA925\\uA930-\\uA946\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAC00\\uD7A3\\uF900-\\uFA2D\\uFA30-\\uFA6A\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC"},DEFINE_SINGLETON("DlSystem",DlEventProxy,function(a,b){a.DEFAULT_EVENTS=["on-dialog-create","on-dialog-show","on-dialog-hide","on-dialog-minimize","on-dialog-restore","on-rpc-start","on-rpc-stop","on-rpc-timeout"]}),DEFINE_CLASS("DlRPC",DlEventProxy,function(a,b){a.CONSTRUCT=function(){this.method==null&&(this.method=this.data!=null?"POST":"GET"),this._timeoutID=0},a.DEFAULT_EVENTS=["onStart","onStop","onTimeout"],a.DEFAULT_ARGS={url:["url",null],args:["args",null],callback:["callback",null],method:["method",null],data:["data",null],timeout:["timeout",null]};function c(a){if(a.readyState==4){delete a.onreadystatechange,this._request=null,this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null);var b;try{b={success:a.status==200,status:a.status,statusText:a.statusText,timeout:false,xml:a.responseXML,text:a.responseText}}catch(a){}DlSystem().applyHooks("on-rpc-stop",[this,b,a]),this.applyHooks("onStop",[this,b,a]),this.callback&&this.callback(b)}}function d(a){this._request=null,a.abort(),DlSystem().applyHooks("on-rpc-timeout",[this,a]),this.applyHooks("onTimeout",[this,a]),this.callback&&this.callback({success:false,timeout:true})}b.abort=function(){this._request.abort()},b.call=function(a){a!=null&&Object.merge(this,a);var b,d=false,e;if(window.XMLHttpRequest)b=new XMLHttpRequest;else if(window.ActiveXObject)b=new ActiveXObject("Microsoft.XMLHTTP");else throw"Browser does not support XMLHttpRequest";this._request=b,b.onreadystatechange=c.$(this,b);var f=this.args;if(f){d=[];for(e in f)d.push(escape(e)+"="+escape(f[e]));d.length==0?d=false:d=d.join("&")}var g=this.url;switch(this.method){case"POST":var h=this.data;d&&h&&(g+="?"+d),b.open("POST",g,true),h?(typeof h!="string"&&(this.data=h=DlJSON.encode(h),b.setRequestHeader("Content-Type","text/javascript; charset=UTF-8")),this._start(h)):(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),this._start(d));break;case"GET":d&&(g+="?"+d),b.open("GET",g,true),this._start(null)}},b._start=function(a){this.timeout?this._timeoutID=d.delayed(this.timeout,this,this._request):this._timeoutID=0,DlSystem().applyHooks("on-rpc-start",[this]),this.applyHooks("onStart",[this]),this._request.send(a)}}),DEFINE_CLASS("DlRteFrame",DlWidget,function(a,b,c){var d=c.createElement,e=c.addClass,f=c.delClass,g=c.condClass,h=c.ID,i=["mouseover","mouseout","mousemove","mousedown","mouseup","click","keydown","keyup","keypress","contextmenu"],j=is_gecko?"<br type='_moz' />":"",k="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html class=\"DlRteFrame-HTML\"><head><title>DynarchLIB Rich Text Editor</title></head><body class=\"DlRteFrame-Body\"><p>"+j+"</p></body></html>";a.BEFORE_BASE=function(){this.__eventProxy=o.$(this),this.callUpdateHooks=this.callUpdateHooks.clearingTimeout(40,this)},a.CONSTRUCT=function(){this.__sections&&this.setSections(this.__sections)},a.DEFAULT_EVENTS=["onUpdate","onSectionChange"],a.DEFAULT_ARGS={__paragraphsMode:["useParagraphs",true],__sections:["sections",null],_focusable:["focusable",2],_tabChar:["tabChar"," "]},b.COMMANDS={backcolor:{id:is_ie?"backcolor":"hilitecolor"},forecolor:{id:"forecolor"},bold:{id:"bold",key:"CTRL 'B'"},italic:{id:"italic",key:"CTRL 'I'"},underline:{id:"underline",key:"CTRL 'U'"},strike:{id:"strikethrough",key:"CTRL '-'"},subscript:{id:"subscript"},superscript:{id:"superscript"},removeformat:{id:"removeformat",key:"ALT-CTRL '0'"},justifyleft:{id:"justifyleft",key:"ALT-CTRL 'l'"},justifyright:{id:"justifyright",key:"ALT-CTRL 'r'"},justifycenter:{id:"justifycenter",key:"ALT-CTRL 'e'"},justifyfull:{id:"justifyfull",key:"ALT-CTRL 'j'"},orderedlist:{id:"insertorderedlist",key:"ALT-CTRL 'o'"},unorderedlist:{id:"insertunorderedlist",key:"ALT-CTRL-SHIFT 'o'"},unorderedlist1:{id:"insertunorderedlist",key:"ALT-CTRL 'u'"},indent:{id:"indent",key:"CTRL '.'"},outdent:{id:"outdent",key:"CTRL ','"},undo:{id:"undo"},redo:{id:"redo"},"<hr>":{id:"inserthorizontalrule",key:"CTRL ' '"},"<h1>":{id:"formatblock",key:"CTRL '1'",arg:"h1"},"<h2>":{id:"formatblock",key:"CTRL '2'",arg:"h2"},"<h3>":{id:"formatblock",key:"CTRL '3'",arg:"h3"},"<h4>":{id:"formatblock",key:"CTRL '4'",arg:"h4"},"<h5>":{id:"formatblock",key:"CTRL '5'",arg:"h5"},"<h6>":{id:"formatblock",key:"CTRL '6'",arg:"h6"},"<p>":{id:"formatblock",key:"CTRL 'm'",arg:"p"},"<pre>":{id:"formatblock",key:"CTRL-ALT 'n'",arg:"pre"},"<address>":{id:"formatblock",arg:"pre"},"<blockquote>":{id:"formatblock",key:"CTRL 'q'",arg:"blockquote"},_nextSection:{id:"_nextSection",key:"CTRL ']'"},_prevSection:{id:"_prevSection",key:"CTRL '['"},showHtml:{id:"showHtml",key:"CTRL-ALT-SHIFT 'h'"}};var l="h1 h2 h3 h4 h5 h6 p pre address blockquote".hashWords();b.SEMANTIC_TAGS={bold:true,italic:true,strike:true,subscript:true,superscript:true,indent:true,underline:true,outdent:true,strikethrough:true,strike:true},b.callUpdateHooks=function(a,b){this.destroyed||this.applyHooks("onUpdate",[a,b])},b.execCommand=function(a,b){if(!this.readonly()){this.focus();var c,d=this.getIframeDoc();is_gecko&&d.execCommand("styleWithCSS",false,!(a in this.SEMANTIC_TAGS)),this.COMMANDS[a]&&(a=this.COMMANDS[a],typeof b=="undefined"&&(b=a.arg||""),a=a.id);if(a=="formatblock")if(is_ie){var e=this.getAncestorsHash();if(e.pre){if(b=="pre")return;var f=this.getSelection(),g=this.getRange(f),h=this.createRange();h.moveToElementText(e.pre),g.setEndPoint("EndToEnd",h),g.select();var i,j=String.buffer("<",b,">dummy</",b,">").get();if(g.compareEndPoints("StartToStart",h)==0)e.pre.insertAdjacentHTML("beforeBegin",j),i=e.pre.previousSibling;else{var k=g.htmlText,l=g.text;g.moveStart("character",-1),g.text.charAt(0)!=l.charAt(0)&&g.moveStart("character",1),e.pre.insertAdjacentHTML("afterEnd","<br />"),g.pasteHTML(""),e.pre.parentNode.removeChild(e.pre.nextSibling),e.pre.insertAdjacentHTML("afterEnd",j),i=e.pre.nextSibling;if(/\S/.test(l)){var m=e.pre.cloneNode(true);m.innerHTML=k,i.parentNode.insertBefore(m,i.nextSibling)}}g.moveToElementText(i),g.collapse(),g.select(),i.innerHTML="";return}b="<"+b+">"}switch(a){case"showHtml":try{alert(this.getHTML())}catch(a){alert("ERROR: "+a)}break;case"_nextSection":this.nextSection();break;case"_prevSection":this.prevSection();break;default:c=d.execCommand(a,false,b)}this.focus(),this.callUpdateHooks();return c}},b.queryCommandState=function(a){if(!this.readonly()){this.COMMANDS[a]&&(a=this.COMMANDS[a].id);return this.getIframeDoc().queryCommandState(a)}},b.queryCommandValue=function(a){if(!this.readonly()){this.COMMANDS[a]&&(a=this.COMMANDS[a].id);if(!is_gecko&&/^formatblock$/i.test(a))for(var b=this.getAllAncestors(),c=0;c<b.length;++c){var d=b[c].tagName.toLowerCase();if(d in l)return d}return this.getIframeDoc().queryCommandValue(a)}},b.getInnerHTML=function(){return this.getIframeBody().innerHTML},b.getHTML=function(a,b){if(!is_ie&&!b){this.collapse(true);var c=this.getIframeDoc().createElement("span");c.id="DYNARCHLIB_RTEFRAME_CARET",this.insertNode(c)}var d=DlHtmlUtils.getHTML(this.getIframeBody(),false,a);!is_ie&&!b&&this.deleteNode(c);return d},b.getInnerText=function(){return DlHtmlUtils.getInnerText(this.getIframeBody())},b.getText=function(){return DlHtmlUtils.getText(this.getIframeBody())},b.setSections=function(a){this.__sections=a;var b=this.__sectionsHash={};a.foreach(function(a,c){a.index=c,b[a.name]=a;if(a.current||c==0)this.__currentSection=c,this.setHTML(a.content)}.$(this))},b.setSectionContent=function(a,b){var c=this.getSection(a,true);c.content=b,c.index==this.__currentSection&&this.setHTML(b)},b.getSections=function(){var a=this.getHTML(true);Object.merge(this.getCurrentSection(),a);return this.__sectionsHash},b.getSection=function(a,b){var c=this.__sectionsHash[a];if(c.index==this.__currentSection&&!b){var d=this.getHTML(true);Object.merge(c,d)}return c},b.getCurrentSection=function(){return this.__sections[this.__currentSection]},b._setCurrentSection=function(a){var b=this.getCurrentSection();if(b!==a){var c=this.getHTML(true);Object.merge(b,c),this.__currentSection=a.index,this.setHTML(a.content),this.applyHooks("onSectionChange",[b,a])}},b.setCurrentSection=function(a){var b=this.__sectionsHash[a];this._setCurrentSection(b)},b.setCurrentSectionIndex=function(a){if(a!=this.__currentSection){var b=this.__sections[a];this._setCurrentSection(b)}},b.prevSection=function(){this.setCurrentSectionIndex(this.__sections.rotateIndex(this.__currentSection-1))},b.nextSection=function(){this.setCurrentSectionIndex(this.__sections.rotateIndex(this.__currentSection+1))},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener(is_ie?"onKeyDown":"onKeyPress",function(a){this._onKeypress(a)}),this.addEventListener({onDestroy:q})},b._createElement=function(){a.BASE._createElement.call(this);var b=d("iframe",{display:"block"},{frameBorder:0,marginHeight:0,marginWidth:0,src:is_ie?"javascript:'';":"about:blank"},this.getElement());this.__hasFrameEvents=false,this.updateKeymap()},b.updateKeymap=function(){var a=this.__rte_keymap=[];for(var b in this.COMMANDS){var c=this.COMMANDS[b];c.key&&a.push([DlKeyboard.parseKey(c.key),b])}},b.setOuterSize=b.setSize=function(a){var b=c.getBorder(this.getElement()),d=c.getBorder(this.getContentElement());this.setInnerSize({x:a.x-b.x-d.x,y:a.y-b.y-d.y})},b.getIframeElement=function(){return this.getElement().firstChild},b.getContentElement=b.getIframeElement,b.getIframeWin=function(){return this.getIframeElement().contentWindow},b.getIframeDoc=function(){return this.getIframeWin().document},b.getIframeBody=function(){return this.getIframeDoc().body},b.initDesignMode=function(a){var b=this.getIframeDoc();b.open(),b.write(k),b.close(),b.designMode="on",this.__hasFrameEvents||p.delayed(5,this,a)},b.readonly=function(a){var b=this.getIframeDoc();arguments.length>0&&(b.designMode=a?"off":"on",g(b.documentElement,a,"DlRteFrame-ReadOnly"));return b.designMode=="off"},b.setHTML=function(a){a instanceof Array&&(a=a.join("")),a=a.trim(),this.__hasFrameEvents?(is_ie&&(a=a.replace(/(<pre[^>]*>)((.|\n)+?)(<\x2fpre>)/gi,function(a,b,c,d,e){c=c.replace(/\x20/g," ").replace(/\t/g," ".repeat(4));return b+c+e})),this.getIframeBody().innerHTML=a,this._onSetHTML(),this.moveBOF(),this.callUpdateHooks()):this.__pendingHTML=a},b._onSetHTML=function(){for(var a=this.getIframeDoc().getElementsByTagName("pre"),b=a.length;--b>=0;){var c=a[b];c.innerHTML=c.innerHTML.replace(/\n/g,"<br>")}if(!is_ie){var d=this.getIframeDoc().getElementById("DYNARCHLIB_RTEFRAME_CARET");d&&function(a){try{this.selectNodeContents(a),this.collapse(true),this.deleteNode(a)}catch(a){}}.delayed(10,this,d)}},b.clear=function(){this.setHTML("")},b.focus=function(){this.getIframeWin().focus(),a.BASE.focus.call(this)},b.loadStyle=function(a){var b=this.getIframeDoc(),c=a.replace(/\x2f/g,"_");if(!b.getElementById(c)){var d=b.getElementsByTagName("head")[0],e=b.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=a,e.id=c,d.appendChild(e),e.disabled=true,e.disabled=false}},b.createRange=function(){return is_ie?this.getIframeBody().createTextRange():this.getIframeDoc().createRange()},b.getSelection=function(){return is_ie?this.getIframeDoc().selection:this.getIframeWin().getSelection()},b.getRange=function(a){a==null&&(a=this.getSelection());return is_ie?a.createRange():a.getRangeAt(0)},b.getParentElement=function(){var a=this.getSelection(),b=this.getRange(a);if(is_ie)switch(a.type){case"Text":case"None":return b.parentElement();case"Control":return b.item(0);default:return null}else try{var c=b.commonAncestorContainer;!b.collapsed&&b.startContainer==b.endContainer&&b.startOffset-b.endOffset<=1&&b.startContainer.hasChildNodes()&&(c=b.startContainer.childNodes[b.startOffset]);while(c.nodeType==3)c=c.parentNode;return c}catch(a){return null}},b.getAllAncestors=function(){var a=this.getParentElement();a&&a.nodeType==1&&(a=this.getParentElement());var b=this.getIframeBody(),c=[];while(a&&a!==b&&a.nodeType==1)c.push(a),a=a.parentNode;c.push(b);return c},b.getAncestorsHash=function(){var a=this.getAllAncestors(),b,c,d,e={__all:a};a.foreach(function(a){d=a.tagName.toLowerCase(),e[d]||(e[d]=a)});return e},b.getSelectedText=function(){var a=this.getRange();return is_ie?a.text:a.toString()},b.selectRange=function(a){if(is_ie)a.select();else{var b=this.getSelection();b.removeAllRanges(),b.addRange(a)}},b.isCollapsed=function(){var a=this.getRange();return is_w3?a.collapsed:a.compareEndPoints("StartToEnd",a)==0},b.collapse=function(a){var b=this.getSelection(),c=this.getRange(b);is_w3&&b.removeAllRanges(),c.collapse(!!a),this.selectRange(c)},b.insertNode=function(a,b){var c=this.getSelection(),d=this.getRange(c);if(is_w3)d.deleteContents(),d.insertNode(a),b&&(c.removeAllRanges(),d.selectNode(a),c.addRange(d));else{var e=h("rteframe");d.pasteHTML(["<span id='",e,"'></span>"].join(""));var f=this.getIframeDoc().getElementById(e);f.parentNode.insertBefore(a,f),f.parentNode.removeChild(f),b&&a.nodeType!=3&&(d.moveToElementText(a),d.select())}return a},b.insertText=function(a,b){var c=this.getIframeDoc().createTextNode(a);return this.insertNode(c,b)},b.selectNodeContents=function(a){var b=this.createRange();is_w3?b.selectNodeContents(a):b.moveToElementText(a),this.selectRange(b)},b.selectNode=function(a){if(is_w3){var b=this.createRange();b.selectNode(a),this.selectRange(b)}else this.selectNodeContents(a)},b.createLink=function(a,b){var c,d,e,f;for(b&&this.insertText(b,true),c="javascript:"+h("link"),this.execCommand("createlink",c),d=this.getIframeDoc().getElementsByTagName("a"),f=d.length;--f>=0;)if(d[f].href==c){e=d[f];break}e.href=a;return e},b.createAnchor=function(a){var b=this.getSelectedText()?null:"Anchor",c=this.createLink("#",b);c.removeAttribute("href"),e(c,b?"DlAnchor-Empty":"DlAnchor"),c.setAttribute("name",a),b&&(c.innerHTML="");return c},b.getAnchors=function(){var a=this.getIframeDoc().getElementsByTagName("a"),b=a.length,c,d=[];while(--b>=0)c=a[b],c.name&&d.unshift(c);return d},b.unlink=function(){this.execCommand("unlink")},b.getSelectedImage=function(){var a=this.getParentElement();a&&!/^img$/i.test(a.tagName)&&(a=null);return a},b.insertImage=function(a){var b=this.getSelectedImage();if(!b){var c="javascript:"+h("img"),d,e;for(this.execCommand("insertimage",c),d=this.getIframeDoc().getElementsByTagName("img"),e=d.length;--e>=0;)if(d[e].src==c){b=d[e];break}}b.src=a.url,a.width&&(b.width=a.width),a.height&&(b.height=a.height),a.align&&(b.align=a.align),a.alt&&(b.alt=a.alt),a.marginLeft&&(b.style.marginLeft=a.marginLeft),a.marginTop&&(b.style.marginTop=a.marginTop),a.marginRight&&(b.style.marginRight=a.marginRight),a.marginBottom&&(b.style.marginBottom=a.marginBottom);return b},b.moveBOF=function(a){var b=this.getIframeBody(),c,d,e=a?b.lastChild:b.firstChild;e&&(is_w3?(d=this.getRange(c=this.getSelection()),c.removeAllRanges(),e.nodeType==1?d.selectNodeContents(e):d.selectNode(e),d.collapse(!a),c.addRange(d)):(d=b.createTextRange(),d.collapse(!a),d.select()))},b.moveEOF=function(a){return this.moveBOF(!a)},b.setParagraphsMode=function(a){this.__paragraphsMode=a},b.addBlockClass=function(a,b,d){var e=this.getAncestorsHash()[a];if(e){if(c.hasClass(e,b)){if(d){c.delClass(e,b);return false}}else c.addClass(e,b);return true}return null},b.canDeleteFullNode=function(a){return DlHtmlUtils.canDeleteFullNode(a.tagName)},b.canDeleteContent=function(a){return DlHtmlUtils.canDeleteContent(a.tagName)},b.canStripNode=function(a){return DlHtmlUtils.canStripNode(a.tagName)},b.deleteNodeContents=function(a){a.innerHTML=DlHtmlUtils.isBlockElement(a)?j:""},b.deleteNode=function(a){a.parentNode.removeChild(a)},b.stripNode=function(a){var b=a.ownerDocument.createDocumentFragment();while(a.firstChild)b.appendChild(a.firstChild);a.parentNode.insertBefore(b,a),a.parentNode.removeChild(a),this.callUpdateHooks()};function m(a){a.lastChild.nodeType==1&&a.lastChild.tagName.toLowerCase()=="br"&&a.removeChild(a.lastChild)}function n(){if(this.__paragraphsMode){var a=this.getAncestorsHash(),b=true,c=this.getIframeDoc(),d=this.getSelection(),e=this.getRange(d),f=a.li||a.dd,g=a.p;if(f){var h=this.createRange();h.selectNodeContents(f);var i,j=/\S/.test(h.toString());if(g&&j){d.removeAllRanges(),i=e.cloneRange(),i.setStartBefore(g.firstChild);if(!/\S/.test(i.toString())){var k=true,l=g.previousSibling;while(l){if(l.nodeType==1){k=false;break}l=l.previousSibling}if(k){var m=f.cloneNode(false);i.setStartBefore(f),i.insertNode(m),i.selectNodeContents(m),d.addRange(i),this.execCommand("<p>");return true}h.selectNodeContents(g);if(/\S/.test(h.toString())){var n=g.cloneNode(false);i.setStartBefore(g),i.insertNode(n),i.selectNodeContents(n),d.addRange(i),this.execCommand("<p>");return true}i=e.cloneRange(),i.setStartBefore(g),i.setEndAfter(f);var o=i.extractContents(),m=o.firstChild;i.insertNode(o),i.selectNodeContents(m.firstChild||m),i.collapse(true),d.addRange(i),this.execCommand("<p>");return true}i=e.cloneRange(),i.setEndAfter(g.lastChild);if(!/\S/.test(i.toString())){var n=g.cloneNode(false);i.setEndAfter(g),i.collapse(false),i.insertNode(n),i.selectNodeContents(n),d.addRange(i),this.execCommand("<p>");return true}i=e.cloneRange(),i.setEndAfter(g);var o=i.extractContents();i.collapse(false);var n=o.firstChild;i.insertNode(o),i.selectNodeContents(n),i.collapse(true),d.addRange(i);return true}if(!j){d.removeAllRanges();var p=f.parentNode;i=e.cloneRange(),i.selectNode(p),i.setStartAfter(f);var o=i.extractContents();p.removeChild(f);var n=c.createElement("p");o.insertBefore(n,o.firstChild),i.setEndAfter(p),i.collapse(false),i.insertNode(o),i.selectNodeContents(n),i.collapse(true),d.addRange(i),this.execCommand("<p>");return true}}else{var q=a.pre;if(q){d.removeAllRanges(),i=e.cloneRange();var r="",s=i.startContainer;s==q&&(s=s.childNodes[i.startOffset]);while(s&&s.parentNode!=q)s=s.parentNode;if(s){while(s&&!/^br$/i.test(s.tagName))s=s.previousSibling;s=s?s.nextSibling:q.firstChild;while(s&&s.nodeType!=3)s=s.firstChild;s&&/^(\s+)/.test(s.data)&&(r=RegExp.$1)}var o=c.createDocumentFragment(),t=c.createElement("br");o.appendChild(t),r&&(t=c.createTextNode(r),o.appendChild(t)),i.insertNode(o),i.setEndAfter(t),i.collapse(false),d.addRange(i);return true}}var u=a.h6||a.h5||a.h4||a.h3||a.h2||a.h1;if(u){var h=e.cloneRange();h.setEndAfter(u);if(!/\S/.test(h.toString())){d.removeAllRanges(),h.collapse(false);var n=this.getIframeDoc().createElement("p");h.insertNode(n),h.selectNodeContents(n),h.collapse(true),d.addRange(h),this.execCommand("<p>");return true}}}}b._onKeypress=function(a){var b=a.keyCode;if(is_gecko&&!a.shiftKey&&!a.ctrlKey&&!a.altKey&&b==DlKeyboard.ENTER)if(n.call(this))throw new DlExStopFrameEvent;this.__rte_keymap.r_foreach(function(b){if(DlKeyboard.checkKey(a,b[0])){this.execCommand(b[1]);throw new DlExStopFrameEvent}},this);if(b==DlKeyboard.TAB){var c=this.queryCommandValue("formatblock");if(c=="pre"){this.insertText(this._tabChar,true),this.collapse(false);throw new DlExStopFrameEvent}}else if(b==DlKeyboard.ENTER&&is_ie&&!a.shiftKey){var c=this.queryCommandValue("formatblock");if(c=="pre"){var d=this.getSelection(),e=this.getRange(d);e.pasteHTML("<br/><div class='DynarchLIB-REMOVE-ME'></div>");throw new DlExStopFrameEvent}}};function o(a){a||(a=this.getIframeWin().event);var b=new DlEvent(a);b.type=="oncontextmenu"&&c.stopEvent(a),b.origTarget=b.target;var d=b.origPos=b.pos,e=c.getPos(this.getIframeElement());b.pos={x:d.x+e.x,y:d.y+e.y},b.target=this.getElement();try{DlEvent._genericEventHandler(b,a)}catch(b){b instanceof DlExStopFrameEvent&&c.stopEvent(a)}/onMouseDown|onMouseUp|onKey/.test(b.dl_type)&&this.callUpdateHooks(b,a)}function p(a){var b=this.getIframeDoc();this.__hasFrameEvents=true,c.addEvents(b,i,this.__eventProxy),this.__pendingHTML&&(this.getIframeBody().innerHTML=this.__pendingHTML,this._onSetHTML(),this.moveBOF(),this.__pendingHTML=null),this.__rte_onFocus=r.$(this),this.__rte_onBlur=s.$(this),is_ie?(b=this.getIframeElement(),b.onfocus=this.__rte_onFocus):c.addEvent(b,"focus",this.__rte_onFocus),b.onblur=this.__rte_onBlur,a&&a.call(this)}function q(){var a=this.getIframeDoc();c.removeEvents(a,i,this.__eventProxy),is_ie?(a=this.getIframeElement(),delete a.onfocus,a.onfocus=null):c.removeEvent(a,"focus",this.__rte_onFocus),delete a.onblur,a.onblur=null}function r(){e(this.getIframeDoc().documentElement,"DlRteFrame-Focused"),a.BASE.focus.call(this)}function s(){f(this.getIframeDoc().documentElement,"DlRteFrame-Focused"),a.BASE.blur.call(this,true)}}),DEFINE_CLASS("DlSocket",DlEventProxy,function(a,b){function c(){return DlFlashUtils().getObject()}a.DEFAULT_EVENTS=["onConnect","onRelease","onData"],a.DEFAULT_ARGS={_host:["host",null],_port:["port",null],_json:["json",false]},a.FIXARGS=function(a){a.host||(a.host=document.domain)},a.CONSTRUCT=function(a){this.addEventListener("onDestroy",e),DlEvent.atUnload(this.destroy.$(this))};var d={};function e(){c().DlSocket_destroy(this.id),delete d[this.id]}b.send=function(a){c().DlSocket_send(this.id,a)},b.sendJSON=function(a){c().DlSocket_send(this.id,DlJSON.encode(a))},b.connect=function(){this.id=c().DlSocket_connect(this._host,this._port),d[this.id]=this},b.reconnect=function(){c().DlSocket_reconnect(this.id)},b.disconnect=function(){c().DlSocket_disconnect(this.id)},window.DlSocket_onConnect=function(a,b){d[a].applyHooks("onConnect",[b])},window.DlSocket_onData=function(a,b){b=DlFlashUtils.decodeString(b);var c=d[a];c._json&&(b=DlJSON.decode(b)),c.applyHooks("onData",[b])},window.DlSocket_onDisconnect=function(a,b){d[a].applyHooks("onRelease",[b])}}),DEFINE_CLASS("DlSound",DlEventProxy,function(a,b){var c={};function d(){return DlFlashUtils().getObject()}a.DEFAULT_EVENTS=["onLoad","onComplete"],a.DEFAULT_ARGS={_volume:["volume",null],_pan:["pan",null],_url:["url",null],_stream:["stream",false]},a.CONSTRUCT=function(a){this.addEventListener({onDestroy:e,onLoad:f}),this.id=d().DlSound_create(),this._volume!=null&&this.setVolume(this._volume),this._pan!=null&&this.setPan(this._pan),c[this.id]=this},b.load=function(a,b){a==null&&(a=this._url),b==null&&(b=this._stream),this.__fileLoaded=false,this.__loadCalled=true,d().DlSound_load(this.id,this._url=a,this._stream=b)},b.play=function(a,b){this.__fileLoaded?d().DlSound_play(this.id,a,b):this.__loadCalled||(this.__shouldPlay=[a,b],this.load())},b.stop=function(){d().DlSound_stop(this.id)},b.getBytesLoaded=function(){return d().DlSound_getBytesLoaded(this.id)},b.getBytesTotal=function(){return d().DlSound_getBytesTotal(this.id)},b.getDuration=function(){return d().DlSound_getDuration(this.id)},b.getPosition=function(){return d().DlSound_getPosition(this.id)},b.setPan=function(a){d().DlSound_setPan(this.id,this._pan=a)},b.setVolume=function(a){d().DlSound_setVolume(this.id,this._volume=a)},b.getPan=function(){return this._pan},b.getVolume=function(){return this._volume},b.getURL=function(){return this._url};function e(){delete c[this.id]}function f(a){(this.__fileLoaded=a)&&this.__shouldPlay&&(this.play.apply(this,this.__shouldPlay),this.__shouldPlay=null)}window.DlSound_onLoad=function(a,b){c[a].applyHooks("onLoad",[b])},window.DlSound_onSoundComplete=function(a){c[a].callHooks("onComplete")}}),DEFINE_CLASS("DlSpinner",DlEntry,function(a,b,c){var d=c.createElement;a.FIXARGS=function(a){a.validators=[new DlValidator(DlValidator.Number,a.minVal,a.maxVal,a.integer,a.decimals)],a.type="text"},a.CONSTRUCT=function(){this._timerPos=this._timerState=this._timerStep=this._timer=null},a.DEFAULT_EVENTS=["onSpin"],a.DEFAULT_ARGS={_step:["step",1],_size:["size",4],_value:["value",0],_minVal:["minVal",null],_maxVal:["maxVal",null],_decimals:["decimals",null],_integer:["integer",false]},b.intervals=[{pos:1,step:1,speed:125},{pos:10,step:1,speed:70},{pos:20,step:1,speed:35},{pos:50,step:1,speed:20},{pos:100,step:1,speed:10},{pos:200,step:2,speed:10}],b._createElement=function(){this._no_gecko_bug=true,a.BASE._createElement.call(this);var b=this.getElement(),c=b.rows[0].cells[0];c.rowSpan=2,c=c.parentNode;var e=d("tr",null,null,c.parentNode),f=d("td",null,{className:"DlSpinner-Button DlSpinner-Button-Up"},c),g=d("td",null,{className:"DlSpinner-Button DlSpinner-Button-Down"},e);this._buttonUp=new DlButton({parent:this,appendArgs:f}),this._buttonDown=new DlButton({parent:this,appendArgs:g}),this._btn=this._buttonUp};function e(){this.select()}function f(){this._clearTimer()}function g(a){this._spinnerUpdateVal(a.wheelDelta>0);throw new DlExStopEventBubbling}function h(a){switch(a.keyCode){case DlKeyboard.ARROW_DOWN:k.call(this,{_direction:false});throw new DlExStopEventBubbling;case DlKeyboard.ARROW_UP:k.call(this,{_direction:true});throw new DlExStopEventBubbling}}function i(a){this._clearTimer()}function j(){var a=this.getValue(),b=a==this._maxVal,c=a==this._minVal;this._buttonUp.disabled(b||!!this.readonly()),this._buttonDown.disabled(c||!!this.readonly()),(b||c)&&this._clearTimer()}b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onFocus:e,onBlur:f,onMouseWheel:g,onKeyDown:h,onKeyUp:i,onChange:j})},b.initDOM=function(){a.BASE.initDOM.call(this),this._setupSpinnerBtn(this._buttonUp,true),this._setupSpinnerBtn(this._buttonDown,false)},b.readonly=function(b){b!=null&&(this._buttonUp.disabled(b),this._buttonDown.disabled(b));return a.BASE.readonly.apply(this,arguments)},b.getFormValue=function(){var a=this.getValue(),b=parseFloat(a);return isNaN(b)?a:b},b._spinnerUpdateVal=function(a){if(!this._readonly){var b=new Number(this.getValue()),c=this._timerStep||this._step;b=a?b+c:b-c,this._minVal!=null&&b<this._minVal&&(b=this._minVal),this._maxVal!=null&&b>this._maxVal&&(b=this._maxVal),this.setValue(b),this.applyHooks("onSpin",[b]),this.focus(),this.select();if(this._timer){var d=++this._timerPos;if(this._timerState.length&&d==this._timerState[0].pos){var e=this._timerState.shift();this._clearTimer(true),this._timerStep=e.step,this._startTimer(a,e.speed)}}}};function k(a){this._spinnerUpdateVal(a._direction),(this._timerState=Array.$(this.intervals)).r_foreach(function(a){a.step*=this.step},this),this._timerPos=0,this._startTimer(a._direction,250);throw new DlExStopEventBubbling}function l(a){this._clearTimer()}b._clearTimer=function(a){this._timer&&clearInterval(this._timer),a||(this._timerPos=this._timerStep=this._timerState=null),this._timer=null},b._startTimer=function(a,b){this._timer&&clearInterval(this._timer),this._timer=setInterval(this._spinnerUpdateVal.$(this,a),b)},b._setupSpinnerBtn=function(a,b){a._direction=b;var c=l.$(this,a);a.addEventListener({onMouseDown:k.$(this,a),onMouseUp:c})}}),DEFINE_CLASS("DlStyleSheet",DlEventProxy,function(a,b,c){a.CONSTRUCT=function(){this._init()};function d(){c.trash(this._el),this._el=this._s=null}b.insertRule=function(a,b,d){var e=this._s;d==null&&(d=this.getRules().length);if(typeof b=="object"){var f=[];for(var g in b)f.push(g+":"+b[g]);b=f.join(";")}else b instanceof Array&&(b=b.join(";"));if(is_ie){a=a.split(/\s*,\s*/);if(a.length==1)e.addRule(a,b,d);else{for(var h=c.ID(),i=this._ier[h]=[],g=0;g<a.length;++g)e.addRule(a[g],b,d+g),i.push(this.getRules()[d+g]);return h}}else e.insertRule(a+"{"+b+"}",d);return this.getRules()[d]},b.deleteRule=function(a){if(is_ie&&typeof a=="string")this._ier[a].foreach(this.deleteRule.$(this)),delete this._ier[a];else for(var b=this.getRules(),c=b.length;--c>=0;)if(b[c]===a){is_ie?this._s.removeRule(c):this._s.deleteRule(c);return c}},b.modifyRule=function(a,b){if(is_ie&&typeof a=="string")this._ier[a].foreach(function(a){this.modifyRule(a,b)},this);else for(var c in b)a.style[c]=b[c]},b.refresh=function(){var a=this.disabled();this.disabled(!a),this.disabled(a)},b.getRules=function(){return is_ie?this._s.rules:this._s.cssRules},b.disabled=function(a){var b=is_ie?this._s:this._el;a!=null&&(b.disabled=a);return!!b.disabled},b._init=function(){is_ie&&(this._ier={}),this._el=c.createElement("style",null,{type:"text/css"},document.getElementsByTagName("head")[0]),this._s=document.styleSheets[document.styleSheets.length-1],this.addEventListener("onDestroy",d)}}),DEFINE_CLASS("DlTabs",DlContainer,function(a,b,c){a.DEFAULT_EVENTS=["onChange"],a.DEFAULT_ARGS={_tabPos:["tabPos","top"]};function d(a,b,c){var d=b!=null?this._panes[b]:null;d&&d._tab.checked(true),a.applyHooks("onChange",[b,c])}function e(a){a.checked()&&this._tabContent.showPane(a.userData)}function f(a){this.checked(true);throw new DlExStopEventProcessing}b.addTab=function(a,b,c){this._tabContent.appendWidget(a,c),a._tab=new DlButton({label:b,parent:this._tabBar,group:this._tabGroup,type:DlButton.TYPE.TWOSTATE,data:this._tabContent.length()-1}),a._tab.addEventListener("onClick",f,true),a.addEventListener("onDestroy",a._tab.destroy.$(a._tab));return a},b.addTab2=function(a){var b=this.addTab(a.widget,a.title,a.pos);a.iconClass&&b._tab.setIconClass(a.iconClass);return b},b.getTabBar=function(){return this._tabBar},b.getNotebook=function(){return this._tabContent},b.getTabButton=function(a){return this.getNotebook().getPane(a)._tab},b.getTabContent=b.getNotebook,b.initDOM=function(){a.BASE.initDOM.call(this),this._tabGroup=DlRadioGroup.get(this.id),this._tabBar=new DlHbox({className:"TabBar"}),this._tabContent=new DlNotebook({className:"TabContent"});switch(this._tabPos){case"top":case"left":this.appendWidget(this._tabBar),this.appendWidget(this._tabContent);break;case"bottom":case"right":this.appendWidget(this._tabContent),this.appendWidget(this._tabBar)}this._tabContent.addEventListener("onChange",d.$(this._tabContent,this)),this._tabGroup.addEventListener("onChange",e.$(this)),this.addClass("DlTabs-"+this._tabPos)},b.setTabPos=function(a){var b=this._tabBar.getElement(),c=this._tabContent.getElement();b.parentNode&&b.parentNode.removeChild(b);var d=a=="top"||a=="left"?d=c:null;c.parentNode.insertBefore(b,d),this.addClass("DlTabs-"+a,"DlTabs-"+this._tabPos),this._tabPos=a},b.setTabAlign=function(a){return this._tabBar.setAlign(a)},b.setOuterSize=b.setSize=function(b){a.BASE.setSize.call(this,b),b=this.getInnerSize();var c=this._tabBar.getSize();switch(this._tabPos){case"top":case"bottom":b.y-=c.y;break;case"left":case"right":b.x-=c.x}this._tabContent.setSize(b)},b.showPane=function(a){return this._tabContent.showPane(a)},b.nextPane=function(){return this._tabContent.nextPane()},b.prevPane=function(){return this._tabContent.prevPane()},b.isFirstPane=function(){return this._tabContent.isFirstPane()},b.isLastPane=function(){return this._tabContent.isLastPane()},b.getCurrentPane=function(){return this._tabContent.getCurrentPane()},b.getCurrentPaneIndex=function(){return this._tabContent.getCurrentPaneIndex()},b._handle_focusKeys=function(a){if(a.shiftKey)a.keyCode==DlKeyboard.PAGE_UP?(this.prevPane(),this.getCurrentPane()._tab.focus(),DlException.stopEventBubbling()):a.keyCode==DlKeyboard.PAGE_DOWN&&(this.nextPane(),this.getCurrentPane()._tab.focus(),DlException.stopEventBubbling());else if(a.keyCode==DlKeyboard.TAB&&this._tabBar.focusInside()){var b=this.getCurrentPane().getFirstFocusWidget();b&&(b.focus(),DlException.stopEventBubbling())}}}),DlTextUtils=function(){var a,b=DynarchDomUtils,c=DlKeyboard,d=[/^(\s*[-*]+\s+)/,function(a){return[a," ".x(a[0].length),a[0].length]},/^(\s*)([0-9]+)(\.\s+)/,function(a){return[function(){var b=parseInt(a[2],10)+1;return a[1]+b+a[3]}," ".x(a[0].length),a[0].length]},/^(\s*)([a-z])(\)\s+)/i,function(a){return[function(){var b=String.fromCharCode(a[2].charCodeAt(0)+1);return a[1]+b+a[3]}," ".x(a[0].length),a[0].length]},/^\s*([>|]\s*)*/,function(a){return[a,a[0],a[0].length,/\n\s*([>|]\s*)*/g,"\n"]},/^\s+/,function(a){return[a,a[0],a[0].length]}],e=[c.ARROW_UP,c.ARROW_DOWN].toHash(true),f=String.fromCharCode(0);function g(d){d||(d=window.event);var f=b.getSelectionRange(this),g={x:this.scrollLeft,y:this.scrollTop};function h(){this.scrollLeft=g.x,this.scrollTop=g.y;return b.stopEvent(d)}if(d.altKey&&d.charCode==113){var i=a.fillText(this.value,72,f.start);this.value=i.text,b.setSelectionRange(this,i.pos,i.pos);return h.call(this)}if(d.ctrlKey&&d.keyCode in e){var j=d.keyCode==c.ARROW_UP,k=a.getParagraph(this.value,j?f.start:f.end),l;l=(j?k.start-1:k.end+1).limit(0,this.length),b.setSelectionRange(this,d.shiftKey?j?f.end:f.start:l,l);return b.stopEvent(d)}if(d.altKey&&d.keyCode==c.ENTER){var m=this.value,k=a.getParagraph(m,f.start),n=a.getFillPrefix(k.text),o=n[0];typeof o=="function"?o=o(n):o=o[0],this.value=m=m.substr(0,k.end)+"\n\n"+o+m.substr(k.end),b.setSelectionRange(this,k.end+2+o.length);return h.call(this)}}var h=/\n([>|\s]*\n)+/g;function i(a,b,c){var d,e=-1;b.lastIndex=0,b.global=true;var f=-1;while(d=b.exec(a)){if(b.lastIndex>=c)break;if((e=b.lastIndex)==f)throw"Repeated! "+e;f=e}return e}function j(a,b,c){b.lastIndex=c,b.global=true;var d=b.exec(a);return d?d.index:null}return a={getParagraph:function(a,b){var c=i(a,h,b+1),d=j(a,h,b);c==-1&&(c=0),d==null&&(d=a.length);return{start:c,end:d,text:a.substring(c,d)}},getFillPrefix:function(a){var b=0,c,e,f;a=a.replace(/\x00/g,"");while(b<d.length){c=d[b++],e=d[b++],c.lastIndex=0;if(f=c.exec(a))return e(f)}},fillParagraph:function(b,c,d){b=b.substr(0,d)+f+b.substr(d);var e=a.getFillPrefix(b),g=e[1],h=e[2],i=b.substr(0,h);b=b.substr(h),e[3]&&(b=b.replace(e[3],function(a){return e[4]||""})),b=b.replace(/\n/g," ").replace(/([^.?!])\s\s+/g,"$1 ");var j=new RegExp("(.{0,"+(c-g.length)+"})(\\s+|$)","g"),k,l=[],m=0,n;while(k=j.exec(b)){j.index!=m?n=b.substring(m,j.lastIndex):n=k[1],m=j.lastIndex;if(!/\S/.test(n))break;l.push(n.trim(true))}b=i+l.join("\n"+g),(d=b.indexOf(f))>=0&&(b=b.substr(0,d)+b.substr(d+1));return{text:b,pos:d}},fillText:function(b,c,d){var e=a.getParagraph(b,d),f=b.substr(0,e.start),g=b.substr(e.end),h=d-e.start,i=a.fillParagraph(e.text,c,h);return{text:f+i.text+g,pos:e.start+i.pos}},emacsipateTextarea:function(a){b.addEvent(a,is_ie?"keydown":"keypress",g)}}}(),DEFINE_CLASS("DlTooltip",DlPopup,function(a,b){a.FIXARGS=function(a){a.zIndex=2e3,a.focusable=false,this._mouseDiff={x:8,y:12}}}),DEFINE_CLASS("DlTree",DlContainer,function(a,b,c){a.CONSTRUCT=function(){this.__treeItems=[]},b.getItem=function(a){return this.__treeItems[a]},b.getItems=function(){return this.__treeItems},b.appendWidget=function(b,c){b instanceof DlTreeItem&&b.parent===this&&c>b.getIndex()&&--c,a.BASE.appendWidget.call(this,b,c)},b.removeWidget=function(b){a.BASE.removeWidget.call(this,b);if(b instanceof DlTreeItem){var c=this.__treeItems.find(b);this.__treeItems.splice(c,1);var d=this.__treeItems.length;d==0?this.parent instanceof DlTreeItem&&this.destroy():(c==0&&this.__treeItems[c]._setFirstLast(true,null),c==d&&this.__treeItems[c-1]._setFirstLast(null,true))}},b._appendWidgetElement=function(a,b){var c=this.__treeItems,d=this.getContentElement();if(b==null){if(a instanceof DlTreeItem){var e=c.peek();e?e._setFirstLast(null,false):a._setFirstLast(true,null),c.push(a),a._setFirstLast(null,true)}d.appendChild(a.getElement())}else{if(b==c.length)return this._appendWidgetElement(a,null);var f=c[b];f&&f._setFirstLast(false,b==c.length-1),a._setFirstLast(b==0,false),c.splice(b,0,a),d.insertBefore(a.getElement(),d.childNodes[b])}},b.addSeparator=function(a){c.createElement("div",null,{className:a||"DlTree-separator",innerHTML:"&nbsp;"},this.getElement())}}),DEFINE_CLASS("DlTreeItem",DlContainer,function(a,b,c){var d=c.createElement,e=c.addClass,f=c.delClass,g=c.condClass;a.CONSTRUCT=function(){this.setIconClass(this.__iconClass),this.__iconClass=null},a.DEFAULT_ARGS={__label:["label",null],__iconClass:["iconClass",null],__itemClass:["itemClassName",null]},a.DEFAULT_EVENTS=["onExpand","onCollapse","onLabelMouseDown"];var h="<div class='DlTreeItem-div'><table cellspacing='0' cellpadding='0' class='DlTreeItem-Table'><tbody><tr><td class='DlTreeItem-Expander'><div class='DlTree-IconWidth'>&nbsp;</div></td><td></td><td class='DlTreeItem-Label'></td></tr></tbody></table></div><div class='DlTreeItem-Subtree'></div>";function i(a){var b=a.target;try{while(b&&b.tagName.toLowerCase()!="td")b=b.parentNode}catch(a){b=null}return b}function j(a){var b=i(a);if(b&&/DlTreeItem-(Expander|Icon)/.test(b.className)){this.toggle();throw new DlExStopEventBubbling}}function k(){var a=this.getSubtreeDiv();window.DL_CLOSING||c.trash(a),c.removeEvent(this.getDivElement(),"mousedown",this.__onLabelMouseDown)}b._setFirstLast=function(a,b){a!=null&&(this.condClass(a,"DlTreeItem-First"),g(this.getTableElement(),a,"DlTreeItem-First")),b!=null&&(this.condClass(b,"DlTreeItem-Last"),g(this.getTableElement(),b,"DlTreeItem-Last"))},b._setListeners=function(){a.BASE._setListeners.call(this),this.addEventListener({onMouseDown:j,onDestroy:k})},b._createElement=function(){a.BASE._createElement.call(this),this.getElement().innerHTML=h,this.__label&&this.setContent(this.__label),this.setUnselectable(),this.__onLabelMouseDown=this._onLabelMouseDown.$(this),c.addEvent(this.getDivElement(),"mousedown",this.__onLabelMouseDown),this.__itemClass&&e(this.getDivElement(),this.__itemClass)},b._onLabelMouseDown=function(a){this.callHooks("onLabelMouseDown")},b.getDivElement=function(){return this.getElement().firstChild},b.getTableElement=function(){return this.getElement().firstChild.firstChild},b.getExpanderElement=function(){return this.getTableElement().rows[0].cells[0]},b.getIconElement=function(){return this.getTableElement().rows[0].cells[1]},b.getContentElement=function(){return this.getTableElement().rows[0].cells[2]},b.getSubtreeDiv=function(){return this.getElement().childNodes[1]},b.getSubtreeWidget=function(){return this._subtree},b.getIndex=function(){return this.parent.__treeItems.find(this)},b.getParentItem=function(){return this.parent.parent},b.addSubItem=function(a,b){var c=this.getSubtreeWidget();!c&&!this._tree&&(c=new DlTree({}),this.setTree(c),this.expand()),c.appendWidget(a,b)},b.setTree=function(a,b,c){this._tree&&typeof this._tree!="function"&&this.removeWidget(this._tree),(this._tree=a)!=null&&(typeof a!="function"?this.appendWidget(a,true):b==null&&(b=false),b?this.expand(b):(this.getSubtreeDiv().style.display="none",this.updateExpanderState())),c==null?(this._subtreeNeverExpires=true,this._subtreeExpires=null):(this._subtreeNeverExpires=false,this._subtreeExpires=(new Date).getTime()+c),this.condClass(a,"DlTreeItem-hasSubtree"),this.updateExpanderState()},b.isExpanded=function(){return this.getSubtreeDiv().style.display!=="none"},b.toggle=function(){this.expand(!this.isExpanded())},b.getPath=function(){var a=[],b=this.getParentItem();while(b instanceof DlTreeItem)a.push(b),b=b.getParentItem();return a},b.expandParents=function(a){var b=this.getParentItem();while(b instanceof DlTreeItem)b.expand(a),b=b.getParentItem()},b.expand=function(a,b){a==null&&(a=true);var c=this;function d(){c.getSubtreeDiv().style.display=a?"block":"none",c.updateExpanderState(),b||c.callHooks(a?"onExpand":"onCollapse")}function e(a,b){var e=c._tree;if(c._subtree)try{c._subtree.destroy()}catch(a){}c._tree=e,b==null?(c._subtreeNeverExpires=true,c._subtreeExpires=null):(c._subtreeNeverExpires=false,c._subtreeExpires=(new Date).getTime()+b),c.appendWidget(a,true),d()}if(a!==this.isExpanded())if(a&&typeof this._tree=="function")if(this._subtree)if(this._subtreeNeverExpires)d();else{var f=(new Date).getTime();this._subtreeExpires&&f<=this._subtreeExpires?d():this._tree(e,this)}else this._tree(e,this);else d()},b.setIconClass=function(a){var b=this.getIconElement();g(b,a!=null,"DlTreeItem-Icon"),this.iconClass&&(b.innerHTML="",f(b,this.iconClass)),a&&(b.innerHTML="<div class='DlTree-IconWidth'>&nbsp;</div>",e(b,a)),this.iconClass=a},b.updateExpanderState=function(){var a=this.getExpanderElement().firstChild;if(this._tree){var b=this.isExpanded();g(a,b,"DlTreeItem-Arrow-Expanded","DlTreeItem-Arrow-Collapsed"),g(this.getTableElement(),b,"DlTreeItem-Table-Expanded","DlTreeItem-Table-Collapsed")}else f(a,"DlTreeItem-Arrow-Expanded"),f(a,"DlTreeItem-Arrow-Collapsed"),this.delClass("DlTreeItem-hasSubtree")},b._appendWidgetElement=function(a,b){var c=a.getElement(),d;a instanceof DlTreeItem?this.addSubItem(a,b):(d=b||a instanceof DlTree?this.getSubtreeDiv():this.getContentElement(),b&&(this._subtree=a,e(c,"DlTree-withLines"),this.addClass("DlTreeItem-hasSubtree")),d.appendChild(c))},b._removeWidgetElement=function(b){a.BASE._removeWidgetElement.call(this,b),this.getSubtreeDiv().firstChild||(this._subtree=this._tree=null),this.updateExpanderState()},b._setFocusedStyle=function(a){g(this.getDivElement(),a,"DlTreeItem-div-focus")}});function DlType(a){a&&(this.name=a,DlType.TYPES[a]=this)}DlType.TYPES={},DlType.prototype={getDisplayValue:function(a){return a},compare:function(a,b){throw"No comparator for type: "+this.name}},DEFINE_CLASS("DlUploadEntry",DlWidget,function(a,b,c){a.DEFAULT_EVENTS=["onUploadStart","onUploadEnd","onChange"],a.DEFAULT_ARGS={_url:["url",null],_files:["files",["file"]],_params:["params",null]},a.BEFORE_BASE=function(){this._files instanceof Array||(this._files=[this._files])},b._createElement=function(){a.BASE._createElement.call(this);var b=c.createElement("iframe",null,{frameBorder:0,marginHeight:0,marginWidth:0,allowTransparency:true,src:is_ie?"javascript:'';":"about:blank"},this.getElement());this.refNode("_iframe",b)},b.init=function(){var a=String.buffer("<html style='margin: 0; padding: 0; overflow: hidden; height: 100%;'>","<head>","<link type='text/css' rel='stylesheet' href='",Dynarch.getFileURL("css/uploadentry.css"),"' />","</head>","<body>","<form action='",this._url,"' method='POST' encoding='multipart/form-data'>","<input type='hidden' name='_uploaderID' value='",this.getWidgetId(),"' />"),b=this._params;if(b){b instanceof Array&&(b=b.toHash(""));for(var c in b)a("<input type='hidden' name='",c,"' value='",b[c],"' />")}this._files.foreach(function(b){a("<label class='upload'><input type='file' name='",b,"' /></label>")}),a("</form></body></html>");var f=this._iframe.contentWindow,g=f.document;g.open(),g.write(a.get()),g.close(),this.refNode("_win",f),this.refNode("_doc",g),this.refNode("_form",g.getElementsByTagName("form")[0]),this._form.method="POST",this._form.encoding="multipart/form-data";var h=d.$(null,this);this._files.foreach(function(a){var b=this._form.elements.namedItem(a);b.onchange=h,b.parentNode.onmousemove=e},this)},b.setParam=function(a,b){if(typeof a=="string"){var c=this.getField(a);c||(c=this._doc.createElement("input"),c.type="hidden",c.name=a,this._form.appendChild(c)),c.value=b}else for(var d in a)this.setParam(d,a[d])},b.getParam=function(a){var b=this.getField(a);return b&&b.value},b.getField=function(a){return this._form.elements.namedItem(a)},b.submit=function(){this.callHooks("onUploadStart"),this._form.submit()},a.finishUpload=function(a){a instanceof DlUploadEntry||(a=DlWidget.getById(a));if(a)a.init(),a.applyHooks("onUploadEnd",Array.$(arguments,1));else throw"No such uploader: "+a};function d(a){a.applyHooks("onChange",[this,this.name,this.value])}function e(a){is_ie&&(a=this.ownerDocument.parentWindow.event),this.firstChild.style.right=30-a.clientX+"px"}}),DEFINE_EXCEPTION("DlValidatorException"),DlValidatorException.MISMATCH=1,DlValidatorException.TOO_SMALL=2,DlValidatorException.TOO_BIG=3,DEFINE_CLASS("DlValidator",null,function(a,b){a.CONSTRUCT=function(b){b&&(typeof b=="string"&&(b=a[b]),this._callback=b,this._args=arguments.length>1?Array.$(arguments,1):null)},b.ok=function(a){if(typeof this._lastData!="undefined"&&this._lastData===a)return true;try{var b=[a].concat(this._args||Array.$(arguments,1)),c=this._callback.apply(this,b);this._lastData=a,this._lastValue=c;return true}catch(a){if(a instanceof DlValidatorException){this._error=a;return false}throw a}},b.getLastVal=function(){return this._lastValue},b.getLastData=function(){return this._lastData},b.getError=function(){return this._error},a.Number=function(a,b,c,d,e){a=a.replace(/\s/g,"");var f=new Number(a);if(isNaN(f))throw new DlValidatorException("Value must be numeric",DlValidatorException.MISMATCH);if(d&&f!=Math.round(f))throw new DlValidatorException("Value must be an integer",DlValidatorException.MISMATCH);if(b!=null&&f<b)throw new DlValidatorException("Value must be bigger than "+b,DlValidatorException.TOO_SMALL);if(c!=null&&f>c)throw new DlValidatorException("Value must be smaller than "+c,DlValidatorException.TOO_BIG);e&&(f=f.toFixed(e));return f},a.Email=function(a){if(!/^([^@\n\r]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i.test(a))throw new DlValidatorException("That doesn't look like an email address",DlValidatorException.MISMATCH);return a},a.URL=function(a,b){b||(b={}),a=a.trim();if(!/^(https?|ftps?):\x2f\x2f/.test(a)){if(/^([a-z0-9_-]+\.)+[a-z]+$/i.test(a)){/^www\./.test(a)||(a="www."+a);return"http://"+a+"/"}throw new DlValidatorException("Value must be an absolute URL",DlValidatorException.MISMATCH)}return a};function c(a){a=a.toLowerCase();function b(b){return b.foreach(function(b,c){b.toLowerCase().indexOf(a)==0&&$RETURN(c)})}var c=b(DlTEXTS._date_shortMonthNames)||b(DlTEXTS._date_monthNames);c!=null&&c++;return c}a.Date=function(a,b,d){if(!/\S/.test(a))return"";b||(b="%Y-%m-%d"),a=a.replace(/^\s+/,"").replace(/\s+$/,"");var e=new Date,f=null,g=null,h=null,i=null,j=null,k=null,l=a.match(/([0-9]{1,2}):([0-9]{1,2})(:[0-9]{1,2})?\s*(am|pm)?/i);l&&(i=parseInt(l[1],10),j=parseInt(l[2],10),k=l[3]?parseInt(l[3].substr(1),10):0,a=a.substring(0,l.index)+a.substr(l.index+l[0].length),l[4]&&(l[4].toLowerCase()=="pm"&&i<12?i+=12:l[4].toLowerCase()=="am"&&i>=12&&(i-=12)));var m=a.split(/\W+/),n=[];m.foreach(function(a){/^[0-9]{4}$/.test(a)?(f=parseInt(a,10),!g&&!h&&d==null&&(d=true)):/^[0-9]{1,2}$/.test(a)?(a=parseInt(a,10),a>=60?f=a:a>=0&&a<=12?n.push(a):a>=1&&a<=31&&(h=a)):g=c(a)}),n.length>=2?d?(g||(g=n.shift()),h||(h=n.shift())):(h||(h=n.shift()),g||(g=n.shift())):n.length==1&&(h?g||(g=n.shift()):h=n.shift()),f||(f=n.length>0?n.shift():e.getFullYear()),f<30?f+=2e3:f<99&&(f+=1900),g||(g=e.getMonth()+1);if(f&&g&&h)this._date=new Date(f,g-1,h,i,j,k);else{this._date=null;throw new DlValidatorException("Can't figure out this date",DlValidatorException.MISMATCH)}return this._date.print(b)}});function DlConsole(){this._messages=[],DlConsole.INSTANCE=this}DlConsole.prototype={log:function(a){a=a.printf.apply(a,Array.$(arguments,1)),this._addMsg({str:a})},line:function(){this._addMsg({str:"&nbsp;",cls:"sep"})},CC:function(a,b){var c=this.win.document.createElement("div");c.className=b||"msg",c.innerHTML=a,this.win.document.body.appendChild(c),this.win.scrollTo(0,c.offsetTop+c.offsetHeight),this._last&&DynarchDomUtils.delClass(this._last,"current"),DynarchDomUtils.addClass(c,"current"),this._last=c},_addMsg:function(a){this._init(),this.win?this.CC(a.str,a.cls):this._messages.push(a)},_init:function(){this.win||window.open(Dynarch.getFileURL("html/dlconsole.html"),"DlConsole","height=400,width=600,menubar=0,toolbar=0,scrollbars=1")},_loaded:function(a){this._last=null,this.win=a,this.log("<b>DynarchLIB Console</b><br />Initialized at %s",new Date),this.line(),this._messages.foreach(this._addMsg,this)},protect:function(name){var func=eval(name),f=function(){try{for(var a=[],b=0;b<arguments.length;++b)a.push(arguments[b]);console.log(name+" ["+a.join(", ")+"]"),func.apply(this,arguments)}catch(a){alert("Exception in "+name+"\n"+a);throw a}};eval(name+" = f")}},window.dlconsole||(window.dlconsole=new DlConsole)