/*
 * DynarchLIB version: 1.0
 *                                                                ____   _____
 * A lightweight JavaScript toolkit for professionals.            \  /_  /   /
 *                                                                 \  / /   /
 * Copyright (c) Dynarch.com 2005-2008.  All rights reserved.       \/ /_  /
 * See http://www.dynarchlib.com/licensing for licensing details.    \  / /
 *                                                                     / /
 *          this package built at 2009/05/12 11:49 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(e){};Array.$=function(obj,start){if(start==null)start=0;var a,i,j;try{a=Array.prototype.slice.call(obj,start);}catch(ex){a=new Array(obj.length-start);for(i=start,j=0;i<obj.length;++i,++j)a[j]=obj[i];}return a;};Object.merge=function(dest,src){for(var i in src)dest[i]=src[i];};Object.merge(Object,{mergeDefined:function(dest,src){for(var i in src){if(typeof src[i]!="undefined")dest[i]=src[i];}},mergeUndefined:function(dest,src){for(var i in src)if(!(i in dest))dest[i]=src[i];},remove:function(from,keys){for(var i=keys.length;--i>=0;)delete from[keys[i]];},isEmpty:function(o){for(var i in o)return false;return true;},makeCopy:function(src){var i,dest={};for(i in src)dest[i]=src[i];return dest;},makeDeepCopy:function(src){if(src instanceof Array)return src.map(Object.makeDeepCopy);if(src===null)return null;if(src instanceof Date)return new Date(src);if(src instanceof Object){var i,dest={};for(i in src)dest[i]=Object.makeDeepCopy(src[i]);return dest;}return src;}});Object.merge(Function.prototype,{$:Function.prototype.closure=function(obj){var args=Array.$(arguments,1),f=this;if(obj==window.undefined)return function(){return f.apply(this,args.concat(Array.$(arguments)))};else return function(){return f.apply(obj,args.concat(Array.$(arguments)))};},$0:function(obj){var f=this,args=Array.$(arguments,1);return function(){return f.apply(obj,args)};},$$:function(a){return this.$.apply(this,a)},$A:function(obj,a){return this.$.apply(this,[obj].concat(a))},$C:function(){var args=Array.$(arguments),f=this;return function(){return f.apply(null,args.concat(Array.$(arguments)))}},inverse:function(){var f=this;return function(){return!f.apply(this,arguments);};},clearingTimeout:function(timeout,obj){var id=null,handler=this,args=Array.$(arguments,2),f=function(){id&&clearTimeout(id);id=setTimeout(handler.$A(obj==null?this:obj,args.concat(Array.$(arguments))),timeout);};f.cancel=function(){clearTimeout(id)};f.doItNow=function(){clearTimeout(id);handler.apply(obj,args.concat(Array.$(arguments)))};return f;},rarify:function(calls,timeout){var f=this.$$(Array.$(arguments,2)),ft=this.clearingTimeout.apply(this,Array.$(arguments,1)),i=calls,id=null,restart=function(){i=calls};return function(){id&&clearTimeout(id);id=setTimeout(restart,timeout);if(i-->0)return f.apply(this,arguments);return ft.apply(this,arguments);};}});Object.merge(Function,{noop:function(){},identity:function(x){return x;},returnTrue:function(){return true;},returnFalse:function(){return false;},invoke:function(x){return x();}});function $_YIELD(timeout){this.timeout=timeout||0;};var $_BREAK={};var $_CONTINUE={};function $_RETURN(args){this.args=args;};function $YIELD(timeout){throw new $_YIELD(timeout);};function $BREAK(){throw $_BREAK;};function $CONTINUE(){throw $_CONTINUE;};function $RETURN(args){throw new $_RETURN(args);};(function(){var UA=navigator.userAgent;is_opera=/opera/i.test(UA);is_ie=/msie/i.test(UA)&&!is_opera&&!(/mac_powerpc/i.test(UA));is_ie5=is_ie&&/msie 5\.[^5]/i.test(UA);is_ie6=is_ie&&/msie 6/i.test(UA);is_ie7=is_ie&&/msie 7/i.test(UA);is_ie8=is_ie&&/msie 8/i.test(UA);ie_box_model=is_ie&&document.compatMode&&document.compatMode=="BackCompat";is_mac_ie=/msie.*mac/i.test(UA);is_khtml=/Konqueror|Safari|KHTML/i.test(UA);is_safari=/Safari/i.test(UA);is_safari3=is_safari&&/Version\/3/i.test(UA);is_konqueror=is_khtml&&!is_safari3;is_gecko=/gecko/i.test(UA)&&!is_khtml&&!is_opera&&!is_ie;is_chrome=/Chrome/i.test(UA);is_w3=!is_ie;if(is_gecko&&/rv:\s*([0-9.]+)/.test(UA))gecko_version=parseFloat(RegExp.$1);Date._MD=[31,28,31,30,31,30,31,31,30,31,30,31];Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;var F=Function.prototype,A=Array.prototype,D=Date.prototype,S=String.prototype,N=Number.prototype;INHERITANCE={};F.inherits=function(base){var p=(this.prototype=new base);p.constructor=this;this.BASE=base.prototype;this._objectType=p._objectType=Dynarch.getFunctionName(this);INHERITANCE[this._objectType]=Dynarch.getFunctionName(base);if(p.__patchSubclassPrototype instanceof Function)p.__patchSubclassPrototype();return this.BASE;};Function.getInheritanceGraph=function(){return INHERITANCE;};F.delayed=function(timeout){var f=arguments.length>1?this.$$(Array.$(arguments,1)):this;return setTimeout(f,timeout);};F.setInterval=function(timeout){var f=arguments.length>1?this.$$(Array.$(arguments,1)):this;setTimeout(f,0);return setInterval(f,timeout);};F.inject=function(props){if(props==null)props=this.OBJECT_EXTENSIONS;Dynarch.merge(this.prototype,props);return this;};F.setDefaults=function(obj,args,overwrite){return Dynarch.setDefaults.call(obj,this.DEFAULT_ARGS,args,overwrite);};Array.hashKeys=function(obj){var a=[],i=0,key;for(key in obj)a[i++]=key;return a;};Array.hashValues=function(obj){var a=[],i=0,key;for(key in obj)a[i++]=obj[key];return a;};A.accumulate=function(f,val){if(arguments.length<2)val=0;for(var i=0;i<this.length;++i)val=f(this[i],val,i);return val;};A.foreach=function(f,obj){if(obj==null)obj=this;var i=0,l=this.length;while(l-->0)try{f.call(obj,this[i],i++);}catch(ex){if(ex===$_BREAK)break;if(ex===$_CONTINUE)continue;if(ex instanceof $_RETURN)return ex.args;throw ex;}};A.r_foreach=function(f,obj){if(obj==null)obj=this;for(var i=this.length;--i>=0;)try{f.call(obj,this[i],i);}catch(ex){if(ex===$_BREAK)break;if(ex===$_CONTINUE)continue;if(ex instanceof $_RETURN)return ex.args;throw ex;}};A.assign_each=function(f,obj){return this.foreach(function(el,i){this[i]=f.call(obj,i,el);});};A.r_assign_each=function(f,obj){return this.r_foreach(function(el,i){this[i]=f.call(obj,i,el);});};A.toHash=function(val,obj){var h={};if(val instanceof Function){this.foreach(function(s,i){h[s]=val.call(obj,s,i);});}else{this.foreach(function(s,i){h[s]=val!=null?val:(i+1);});}return h;};A.toHash2=function(){var hash={},i=0;while(i<this.length)hash[this[i++]]=this[i++];return hash;};A.map=function(f,obj){var i=0,l=this.length,a=[],args,func;if(!(f instanceof Function)){args=Array.$(arguments,1);while(l-->0){obj=this[i];func=obj[f];a[i++]=(func instanceof Function)?func.apply(obj,args):func;}}else{if(obj==null)obj=this;while(l-->0)try{a.push(f.call(obj,this[i],i++));}catch(ex){if(ex===$_BREAK)break;if(ex===$_CONTINUE)continue;if(ex instanceof $_RETURN){a.push(ex.args);break;}throw ex;}}return a;};A.r_map=function(f,obj){var i=this.length,a=[],func;if(!(f instanceof Function)){args=Array.$(arguments,1);while(--i>=0){obj=this[i];func=obj[f];a[i]=(func instanceof Function)?func.apply(obj,args):func;}}else{if(obj==null)obj=this;while(--i>=0)try{a.push(f.call(obj,this[i],i));}catch(ex){if(ex===$_BREAK)break;if(ex===$_CONTINUE)continue;if(ex instanceof $_RETURN){a.push(ex.args);break;}throw ex;}}return a.reverse();};A.keys_map=function(obj){return this.map(function(key){return obj[key];});};A.grep=function(cond,obj){var i=0,l=this.length,a=[],el,args,func;if(cond instanceof RegExp){while(l-->0){el=this[i++];cond.test(el)&&a.push(el);}}else if(cond instanceof Function){if(obj==null)obj=this;while(l-->0){el=this[i];cond.call(obj,el,i++)&&a.push(el);}}else{args=Array.$(arguments,1);while(l-->0){obj=this[i++];func=obj[cond];if(obj[cond]instanceof Function){obj[cond].apply(obj,args)&&a.push(obj);}else if(obj[cond]){a.push(obj);}}}return a;};A.grep_last=function(f,i){if(i==null)i=this.length-1;while(i>=0){var el=this[i--];if(f(el))return el;}return null;};A.grep_first=function(f,i){for(i=i||0;i<this.length;++i){var el=this[i];if(f(el))return el;}return null;};A.contains=function(el){for(var i=this.length;--i>=0;)if(this[i]===el)return true;return false;};A.find=function(el){for(var i=this.length;--i>=0;)if(this[i]===el)return i;return-1;};A.remove=function(el){for(var i=this.length;--i>=0;)if(this[i]===el)this.splice(i,1);return this;};A.pushUnique=function(el){if(this.find(el)<0){this.push(el);return this.length;}return null;};function makeComparator(cmp,reverse){if(reverse){if(cmp instanceof Function)return function(el1,el2){return cmp(el2,el1);};else return function(el2,el1){return(el1<el2)?-1:((el1>el2)?1:0);};}else{if(cmp instanceof Function)return cmp;else return function(el1,el2){return(el1<el2)?-1:((el1>el2)?1:0);};}};A.mergeSort=function(cmp,reverse){if(this.length<2)return Array.$(this);var _cmp=makeComparator(cmp,reverse);function merge(a,b){var r=[],ai=0,bi=0,i=0;while(ai<a.length&&bi<b.length){_cmp(a[ai],b[bi])<=0?r[i++]=a[ai++]:r[i++]=b[bi++];}if(ai<a.length)r.push.apply(r,a.slice(ai));if(bi<b.length)r.push.apply(r,b.slice(bi));return r;};function _ms(a){if(a.length<=1)return a;var m=Math.floor(a.length/2),left=a.slice(0,m),right=a.slice(m);left=_ms(left);right=_ms(right);return merge(left,right);};return _ms(this);};A.qsort=function(cmp,reverse){if(this.length<2)return;var _cmp=makeComparator(cmp,reverse),a=this,tmp,modified=false;function _qs(st,en){var j=st,k=en,sw=false;if(j<k){do{if(_cmp(a[j],a[k])>0){tmp=a[j];a[j]=a[k];a[k]=tmp;sw=!sw;modified=true;}sw?--k:++j;}while(j<k);_qs(st,j-1);_qs(j+1,en);}};_qs(0,this.length-1);return modified;};A.peek=function(){if(this.length>0)return this[this.length-1];};A.min=function(f,obj){if(this.length==0)return null;if(arguments.length>0){var min=f!=null?f.call(obj,this[0],0):this[0];for(i=1;i<this.length;++i){min=Math.min(min,(f!=null?f.call(obj,this[i],i):this[i]));}return min;}return Math.min.apply(Math,this);};A.max=function(f,obj){if(this.length==0)return null;if(arguments.length>0){var max=f!=null?f.call(obj,this[0],0):this[0];for(i=1;i<this.length;++i){max=Math.max(max,(f!=null?f.call(obj,this[i],i):this[i]));}return max;}return Math.max.apply(Math,this);};A.rotateIndex=function(idx){return Math.rotateLimit(idx,0,this.length-1);};A.limitIndex=function(idx){return Math.limit(idx,0,this.length-1);};A.nullLimitIndex=function(idx){return Math.nullLimit(idx,0,this.length-1);};A.bytesToString=function(){var s=String.buffer(),i=0,c;while(i<this.length){c=this[i++];if(!(c&0xF0 ^ 0xF0)){c=((c&0x03)<<18)|((this[i++]&0x3F)<<12)|((this[i++]&0x3F)<<6)|(this[i++]&0x3F);}else if(!(c&0xE0 ^ 0xE0)){c=((c&0x0F)<<12)|((this[i++]&0x3F)<<6)|(this[i++]&0x3F);}else if(!(c&0xC0 ^ 0xC0)){c=((c&0x1F)<<6)|(this[i++]&0x3F);}s(String.fromCharCode(c));}return s.get();};N.map=function(start,stop){return start+(stop-start)*this;};N.mapInt=function(start,stop){return Math.round(this.map(start,stop));};N.bits1Array=function(){var n=this,a=[],v=1,i=0;while(n>0){if(n&1)a[i++]=v;v=v<<1;n=n>>1;}return a;};N.times=function(f,obj){var i=this,j=0;while(--i>=0)f.call(obj,j++,i);};N.hex=function(width){var n=this.toString(16).toUpperCase();if(width)while(n.length<width)n="0"+n;return n;};var $1K=N.$1K=1024,$1M=N.$1M=$1K*1024,$1G=N.$1G=$1M*1024,$1T=N.$1T=$1G*1024;N.formatBytes=function(fixed){var sz=this,spec,r;if(sz<$1K){spec="B";}else if(sz<$1M){sz/=$1K;spec="K";}else if(sz<$1G){sz/=$1M;spec="M";}else if(sz<$1T){sz/=$1G;spec="G";}r=Math.round(sz);if(fixed&&sz!=r)return sz.toFixed(fixed)+spec;else return r+spec;};N.zeroPad=function(width,zero){var s=""+Math.round(this);if(zero==null)zero="0";while(s.length<width)s=zero+s;return s;};N.formatTime=function(){var s=this,h,m;m=s/60;s%=60;h=m/60;m%=60;return[h,m,s].map("zeroPad",2).join(":");};N.limit=function(min,max){return Math.limit(this,min,max);};N.rotateLimit=function(min,max){return Math.rotateLimit(this,min,max);};N.nullLimit=function(min,max){return Math.nullLimit(this,min,max);};Math.nullLimit=function(n,min,max){if(n<min)n=null;if(n>max)n=null;return n;};Math.limit=function(n,min,max){if(n<min)n=min;if(n>max)n=max;return n+0;};Math.rotateLimit=function(n,min,max){if(n<min)n=max;if(n>max)n=min;return n+0;};Date._MN=DlTEXTS._date_monthNames;Date._SMN=DlTEXTS._date_shortMonthNames;Date._DN=DlTEXTS._date_dayNames;Date._SDN=DlTEXTS._date_shortDayNames;Date._FDOW=DlTEXTS._date_firstDayOfWeek;Date.isWeekend=function(day){return day==0||day==6;};Date.parseMySQL=function(str){var a=str.split(/\s+/),d=a[0].split(/-/),t=a[1].split(/:/);return new Date(d[0],d[1]-1,d[2],t[0]||null,t[1]||null,t[2]||null);};D.getMonthDays=function(m){var y=this.getFullYear();if(m==null)m=this.getMonth();return(((0==(y%4))&&((0!=(y%100))||(0==(y%400))))&&m==1)?29:Date._MD[m];};D.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};D.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};D.dateEqualsTo=function(date,monthOnly){return this.getFullYear()==date.getFullYear()&&this.getMonth()==date.getMonth()&&(monthOnly||this.getDate()==date.getDate());};D.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Date.getDayName(w,true);s["%A"]=Date.getDayName(w);s["%b"]=Date.getMonthName(m,true);s["%B"]=Date.getMonthName(m);s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}return str;};Date.getMonthName=function(mon,sh){var a=sh?Date._SMN:Date._MN;return a[mon%12];};Date.getFirstDayOfWeek=function(){return Date._FDOW;};Date.getDayName=function(day,sh){var a=sh?Date._SDN:Date._DN;return a[day%7];};S.breakable=function(re){if(!re)re=/([_.-])/g;return this.replace(re,"$1<span class='BreakPoint'> </span>");};S.printf=function(){var a=Array.$(arguments),i=0;return this.replace(/%[sdfo%]/g,function(s){s=s.charAt(1);var v=a[i++];switch(s){case "s":return v.toString();case "d":return parseInt(v);case "f":return parseFloat(v).toFixed(3);case "o":return v;case "%":return "%";}return "undefined";});};S.fixedWidth=function(w){return String.buffer("<div style='width:",w,"'>",this,"</div>").get();};S.noWrap=function(){return this.replace(/\x20/g,"&nbsp;");};S.lastIndexOfRegexp=function(re,caret){var m,pos=0;re.lastIndex=0;re.global=true;while(m=re.exec(this)){if(re.lastIndex>=caret)break;pos=re.lastIndex;}return pos;};S.hashWords=function(val){return this.trim().split(/\s+/).toHash(arguments.length>0?val:true);};S.arrayWords=function(){return this.trim().split(/\s+/);};S.qw=S.arrayWords;S.trim=function(nostart,noend){var str=nostart?this:this.replace(/^\s+/,"");if(!noend)str=str.replace(/\s+$/,"");return str;};var CE_CACHE={HTML_ESCAPE_DIV:document.createElement("div"),HTML_ESCAPE_TEXT:document.createTextNode("")};CE_CACHE.HTML_ESCAPE_DIV.appendChild(CE_CACHE.HTML_ESCAPE_TEXT);S.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;};S.decodeJSON=function(safe){return DlJSON.decode(this,safe);};S.makeLabel=function(){return this.replace(/\s+/g,"&nbsp;");};S.capitalizeString=function(){return this.charAt(0).toUpperCase()+this.substr(1);};S.htmlEmbed=function(tag,c){var a=["<",tag];if(c!=null)a.push(" class='",c,"'");a.push(">",this,"</",tag,">");return a.join("");};S.bold=S.htmlEmbed.$(window.undefined,"b");S.repeat=S.x=function(i){if(i==0)return "";if(i==1)return ""+this;var d=this.repeat(i>>1);d+=d;if(i&1)d+=this;return d;};S.hexToBytes=function(unsafe){var a=[],i=0,s=this;if(unsafe)s=s.replace(/[^0-9a-f]/ig,"");if(s.length&1)s="0"+s;while(i<s.length){a.push(parseInt(s.substr(i,2),16));i++;i++;}return a;};S.toBytes=function(){var a=[],i=this.length,j=0,k=0,c;while(--i>=0){c=this.charCodeAt(k++);if(c<0x80){a[j++]=c;}else if(c<0x800){a[j++]=0xC0|((c>>>6)&0x1F);a[j++]=0x80|(c&0x3F);}else if(c<0x10000){a[j++]=0xE0|((c>>>12)&0x0F);a[j++]=0x80|((c>>>6)&0x3F);a[j++]=0x80|(c&0x3F);}else if(c<0x110000){a[j++]=0xF0|((c>>>18)&0x03);a[j++]=0x80|((c>>>12)&0x3F);a[j++]=0x80|((c>>>6)&0x3F);a[j++]=0x80|(c&0x3F);}}return a;};String.firstNonEmpty=function(){for(var i=0;i<arguments.length;++i){var s=arguments[i];if(/\S/.test(s))return s;}};var ids={};window.Dynarch={merge:Object.merge,copy:function(dest,src){for(var i in dest)delete dest[i];Dynarch.merge(dest,src);},makeCopy:Object.makeCopy,makeDeepCopy:Object.makeDeepCopy,mergeUndefined:Object.mergeUndefined,setDefaults:function(defaults,args,overwrite){var i,val,def;for(i in defaults){if(overwrite||!(i in this)){def=defaults[i];if(def instanceof Array){if(def[0]!=null){val=def[0];if(val in args)val=args[val];else val=def[1];}else val=def[1];}else val=def;this[i]=val;}}},ID:function(namespace){if(namespace==null)namespace="generic";if(!(namespace in ids))ids[namespace]=0;return "dynarch-"+namespace+"-"+(++ids[namespace]);},getFunctionName:function(f){if(f.name)return f.name;else if(/function\s+(\$?[a-z0-9_]+)\(/i.test(f.toString()))return RegExp.$1;return "UNKNOWN_FUNCTION";},EXPORT:function(name,imp){var ret=String.buffer("var D=window.",name,"=",name,",P=",name,".prototype;");if(imp)ret(DynarchDomUtils.importCommonVars());return ret.get();},getBaseURL:function(){var u=window.Dynarch_Base_Url;if(!u){var scripts=document.getElementsByTagName("script"),i=0,s;while(s=scripts[i++])if(s.className=="DynarchLIB"){u=s.src;if(/^(.*)\x2fjs\x2f/.test(u)){Dynarch_Base_Url=u=RegExp.$1;break;}}}return u;},getFileURL:function(file){return Dynarch.getBaseURL()+"/"+file;},makeArray:Array.$,noop:Function.noop};window.DynarchDomUtils={related:function(element,ev){var related,type;if(is_ie){type=ev.type;if(type=="mouseover")related=ev.fromElement;else if(type=="mouseout")related=ev.toElement;}else related=ev.relatedTarget;if(is_gecko&&related){try{related.parentNode;}catch(ex){try{related=ev.parentNode;}catch(ex){related=ev.target;}}}try{for(;related;related=related.parentNode)if(related===element)return true;}catch(ex){return true;}return false;},getScrollbarSize:function(el){return{x:el.offsetWidth-el.clientWidth,y:el.offsetHeight-el.clientHeight};},addEvent:function(el,evname,func){if(typeof evname=="string"){if(el.addEventListener){el.addEventListener(evname,func,false);}else if(el.attachEvent){el.attachEvent("on"+evname,func);}else{el["on"+evname]=func;}}else if(evname instanceof Array){DynarchDomUtils.addEvents(el,evname,func);}else{for(var i in evname)DynarchDomUtils.addEvent(el,i,evname[i]);}},addEvents:function(el,evs,func){for(var i=evs.length;--i>=0;)DynarchDomUtils.addEvent(el,evs[i],func);},removeEvent:function(el,evname,func){if(typeof evname=="string"){if(el.removeEventListener)el.removeEventListener(evname,func,false);else if(el.detachEvent)el.detachEvent("on"+evname,func);else el["on"+evname]="";}else if(evname instanceof Array){DynarchDomUtils.removeEvents(el,evname,func);}else{for(var i in evname)DynarchDomUtils.removeEvent(el,i,evname[i]);}},removeEvents:function(el,evs,func){for(var i=evs.length;--i>=0;)DynarchDomUtils.removeEvent(el,evs[i],func);},condEvent:function(cond){cond=cond?DynarchDomUtils.addEvent:DynarchDomUtils.removeEvent;return cond.apply(DynarchDomUtils,Array.$(arguments,1));},condEvents:function(cond){cond=cond?DynarchDomUtils.addEvents:DynarchDomUtils.removeEvents;return cond.apply(DynarchDomUtils,Array.$(arguments,1));},stopEvent:function(ev){if(is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;},addLoadHandler:function(el,handler){if(is_ie){el.onreadystatechange=function(){if(el.readyState==4){try{el.onreadystatechange=null;}catch(ex){};handler();}};}else DynarchDomUtils.addEvent(el,"load",handler);},callHandler:function(obj,method){if(!obj[method])return;if(obj[method]instanceof Function)obj[method].call(obj);else if(typeof obj[method]=="string")eval(obj[method]);},setStyleProperty:function(el,prop,val){switch(prop){case "float":prop="styleFloat";break;default:prop=prop.toLowerCase().replace(/-([a-z])/g,function(s,p1){return p1.toUpperCase();});}el.style[prop]=val;},setOpacity:function(el,o){if(o!=null){if(o==""&&o!=0){is_ie?el.style.filter="":el.style.opacity="";}else{is_ie?el.style.filter="alpha(opacity="+Math.round(o*100)+")":el.style.opacity=o;}return o;}else{if(!is_ie)return parseFloat(el.style.opacity);else if(/alpha\(opacity=([0-9.])+\)/.test(el.style.opacity))return parseFloat(RegExp.$1);}},getClosestParentByTagName:function(el,tag){tag=tag.toLowerCase();while(el&&el.tagName&&el.tagName.toLowerCase()!=tag)el=el.parentNode;return el;},isInside:function(el,parent){try{while(el){if(el===parent)return true;el=el.parentNode;}}catch(ex){}return false;},getWindowSize:function(){if(is_gecko){if(document.documentElement.clientWidth)return{x:document.documentElement.clientWidth,y:document.documentElement.clientHeight};else return{x:window.innerWidth,y:window.innerHeight};}if(is_opera)return{x:window.innerWidth,y:window.innerHeight};if(is_ie){if(!document.compatMode||document.compatMode=="BackCompat")return{x:document.body.clientWidth,y:document.body.clientHeight};else return{x:document.documentElement.clientWidth,y:document.documentElement.clientHeight};}var div=document.createElement("div"),s=div.style;s.position="absolute";s.bottom=s.right="0px";document.body.appendChild(div);s={x:div.offsetLeft,y:div.offsetTop};document.body.removeChild(div);return s;},getPos:function(el){if(el.getBoundingClientRect){var box=el.getBoundingClientRect();return{x:box.left-document.documentElement.clientLeft,y:box.top-document.documentElement.clientTop};}else if(document.getBoxObjectFor){var box=el.ownerDocument.getBoxObjectFor(el);var pos={x:box.x,y:box.y};while(el.parentNode&&el.parentNode!==document.body){el=el.parentNode;pos.x-=el.scrollLeft;pos.y-=el.scrollTop;}return pos;}if(/^body$/i.test(el.tagName))return{x:0,y:0};var SL=0,ST=0,is_div=/^div$/i.test(el.tagName),r,tmp;if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){tmp=DynarchDomUtils.getPos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;},getBRPos:function(el){var pos=DynarchDomUtils.getPos(el),size=DynarchDomUtils.getOuterSize(el);pos.x+=size.x-1;pos.y+=size.y-1;return pos;},setPos:function(el,x,y){if(typeof x=="number")x+="px";if(typeof y=="number")y+="px";if(x!=null)el.style.left=x;if(y!=null)el.style.top=y;},createElement:function(tag,st,at,par,pos){var el=CE_CACHE[tag],i;if(!el)el=CE_CACHE[tag]=document.createElement(tag);el=el.cloneNode(false);if(st)for(i in st)if(is_ie)DynarchDomUtils.setStyleProperty(el,i,st[i]);else el.style.setProperty(i,st[i],"");if(at)for(i in at)el[i]=at[i];if(par){if(typeof pos=="number")pos=par.childNodes[pos];if(!pos)pos=null;par.insertBefore(el,pos);}return el;},setUnselectable:function(el,unsel){if(unsel==null)unsel=true;if(!is_ie){unsel=unsel?"none":"normal";el.style.MozUserSelect=unsel;el.style.WebkitUserSelect=unsel;el.style.userSelect=unsel;}else{unsel=unsel?"on":"off";var els=Array.$(el.getElementsByTagName("*"));els.push(el);els.foreach(function(el){el.setAttribute("unselectable",unsel);});}},addClass:function(el,ac,dc){DynarchDomUtils.delClass(el,dc,ac);},delClass:function(el,dc,ac){if(el){var cls=el.className;if(dc instanceof RegExp){cls=cls.replace(dc," ");dc=null;}if(ac||dc){var a=cls.split(/\s+/),i=a.length,r={};dc&&(r[dc]=1);ac&&(r[ac]=1);while(--i>=0)if(a[i]in r)a.splice(i,1);ac&&a.push(ac);cls=a.join(" ");}el.className=cls;}},condClass:function(el,cond,clsTrue,clsFalse){DynarchDomUtils[cond?"addClass":"delClass"](el,clsTrue,clsFalse);},hasClass:function(el,cls){return el.className.split(" ").contains(cls);},elementIsVisible:function(el){return!!el.offsetWidth&&el.style.visibility!="hidden";},ie_getBackgroundColor:function(el){var r=document.body.createTextRange();r.moveToElementText(el);return "#"+parseInt(r.queryCommandValue("BackColor")).hex(6);},getStyle:function(el,prop){var ret=null;if(window.getComputedStyle){ret=document.defaultView.getComputedStyle(el,"").getPropertyValue(prop);}else if(el.currentStyle){prop=prop.replace(/-[a-z]/g,function(s){return s.charAt(1).toUpperCase();});if(prop=="backgroundColor"){ret=ie_getBackgroundColor(el);}else{ret=el.currentStyle[prop];}}return ret;},getStylePX:function(el,prop){var val=parseInt(DynarchDomUtils.getStyle(el,prop),10);if(isNaN(val))val=0;return val;},getBorder:function(el){return{x:el.offsetWidth-el.clientWidth,y:el.offsetHeight-el.clientHeight};},getPadding:function(el){var dx,dy,getStyle=DynarchDomUtils.getStylePX;dx=getStyle(el,"padding-left")+getStyle(el,"padding-right");dy=getStyle(el,"padding-top")+getStyle(el,"padding-bottom");return{x:dx,y:dy};},getPaddingAndBorder:function(el){var dx=0,dy=0,getStyle=DynarchDomUtils.getStylePX;dx+=getStyle(el,"border-left-width");dx+=getStyle(el,"border-right-width");dy+=getStyle(el,"border-top-width");dy+=getStyle(el,"border-bottom-width");dx+=getStyle(el,"padding-left");dx+=getStyle(el,"padding-right");dy+=getStyle(el,"padding-top");dy+=getStyle(el,"padding-bottom");return{x:dx,y:dy};},getSelectionRange:function(input){var start,end;if(is_ie){var range,isCollapsed,b;range=document.selection.createRange();isCollapsed=range.compareEndPoints("StartToEnd",range)==0;if(!isCollapsed)range.collapse(true);b=range.getBookmark();start=b.charCodeAt(2)-2;range=document.selection.createRange();isCollapsed=range.compareEndPoints("StartToEnd",range)==0;if(!isCollapsed)range.collapse(false);b=range.getBookmark();end=b.charCodeAt(2)-2;}else{start=input.selectionStart;end=input.selectionEnd;}return{start:start,end:end};},setSelectionRange:function(input,start,end){if(end==null)end=start;if(start>end){var tmp=start;start=end;end=tmp;}if(typeof start=="object"){end=start.end;start=start.start;}if(is_ie){var range=input.createTextRange();range.collapse(true);range.moveStart("character",start);range.moveEnd("character",end-start);range.select();}else{input.setSelectionRange(start,end);}},setOuterSize:function(el,x,y){var pb=DynarchDomUtils.getPaddingAndBorder(el);if(x!=null&&pb.x!=NaN)x-=pb.x;if(y!=null&&pb.y!=NaN)y-=pb.y;DynarchDomUtils.setInnerSize(el,x,y);},setInnerSize:function(el,x,y){try{if(typeof x=="number"&&x!=NaN)x=Math.abs(x)+"px";if(typeof y=="number"&&y!=NaN)y=Math.abs(y)+"px";if(x!=null&&x!=NaN&&!(is_ie&&x<=0))el.style.width=x;if(y!=null&&y!=NaN&&!(is_ie&&y<=0))el.style.height=y;}catch(ex){};},getOuterSize:function(el){return{x:el.offsetWidth,y:el.offsetHeight};},getInnerSize:function(el){var s=DynarchDomUtils.getOuterSize(el);var pb=DynarchDomUtils.getPaddingAndBorder(el);s.x-=pb.x;s.y-=pb.y;return s;},importCommonVars:function(){return["var DOM=DynarchDomUtils","AC=DOM.addClass","DC=DOM.delClass","CC=DOM.condClass","CE=DOM.createElement","ID=Dynarch.ID"].join(",");},trash:function(el){var gc=CE_CACHE._trash;if(!gc){gc=CE_CACHE._trash=DynarchDomUtils.createElement("div",{zIndex:-10000},{className:"DYNARCH-GARBAGE-COLLECTOR"},document.body);}if(el){gc.appendChild(el);gc.innerHTML="";}return gc;},createFromHtml:function(html){var div=this.trash();div.innerHTML=html;return div.firstChild;},swapNodes:function(n1,n2){var n1p=n1.parentNode,n1n=n1.nextSibling;n2.parentNode.replaceChild(n1,n2);n1p.insertBefore(n2,n1n);},scrollIntoView:function(el){var p=el.parentNode;while(p&&(p.scrollHeight==p.clientHeight||p.scrollWidth==p.clientWidth||/table|tbody/i.test(p.tagName)))p=p.parentNode;if(p&&p!==document.body){var a=[],tmp=p;while(tmp){a.push(tmp);tmp=tmp.parentNode;}var t=0,l=0;tmp=el;while(tmp&&tmp!=p){t+=tmp.offsetTop;l+=tmp.offsetLeft;tmp=tmp.offsetParent;if(a.contains(tmp)){if(tmp!=p){t-=p.offsetTop;l-=p.offsetLeft;}break;}}var b=t+el.offsetHeight,r=l+el.offsetWidth;if(t<p.scrollTop)p.scrollTop=t;if(t>p.scrollTop&&b>p.scrollTop+p.clientHeight)p.scrollTop=b-p.clientHeight;if(l<p.scrollLeft)p.scrollLeft=l;if(l>p.scrollLeft&&r>p.scrollLeft+p.clientWidth)p.scrollLeft=r-p.clientWidth;}},flash:function(el,timeout,steps){if(!steps)steps=3;var timer=setInterval(function(){el.style.visibility=(steps&1)?"hidden":"";--steps;if(steps<0)clearInterval(timer);},timeout||150);},walk:function(el,f){if(!f(el))for(var i=el.firstChild;i;i=i.nextSibling)if(i.nodeType==1)DynarchDomUtils.walk(i,f);}};DynarchDomUtils.CE_CACHE=CE_CACHE;})();var $=is_gecko?document.getElementById.$(document):function(id){return document.getElementById(id);};String.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);if(p2.charAt(0)=="{")p2=p2.substr(1,p2.length-2);eval("p2 = props."+p2);return p1+p2;});};};String.buffer=(is_ie||is_khtml)?function(){var a=[],idx=0,f=function(){for(var i=0;i<arguments.length;++i)a[idx++]=arguments[i];return f;};f.get=function(){a=[a.join("")];idx=1;return a[0];};if(arguments.length>0)f.apply(this,arguments);return f;}:function(){var str="",f=function(){str=str.concat.apply(str,arguments);return f;};if(arguments.length>0)f.apply(this,arguments);f.get=function(){return str;};return f;};if((is_safari&&!is_safari3)||is_ie5){if(!String.prototype.__old_replace){String.prototype.__old_replace=String.prototype.replace;String.prototype.replace=function(re,val){if(!(val instanceof Function))return this.__old_replace(re,val);else{var str=this.slice(0),v,l,a;while(a=re.exec(str)){v=val.apply(null,a);l=a[0].length;re.lastIndex-=l-v.length;str=str.substr(0,a.index)+v+str.substr(a.index+l);if(!re.global)break;}return str;}};}}function DlException(message,code){this.error=this.constructor.name;if(!message)message="*** no error message given ***";this.message=this.constructor.name+": "+message;if(code!=null)this.code=code;};DlException.prototype.toString=function(){var str=this.message;if(this.code)str+=" / code: "+this.code;return str;};DlException.defineException=function(className,base){if(base==null)base="DlException";return eval(["window.",className,"=function ",className,"(message){",base,".call(this, message);};",className,".inherits(",base,");"].join(""));};DlException.defineException("DlExInvalidOperation");DlException.defineException("DlExAbstractBaseClass");DlException.defineException("DlExStopEventProcessing");DlException.defineException("DlExStopFrameEvent");DlException.defineException("DlExStopEventBubbling");DlException.defineException("DlDataException");DlException.defineException("DlSecurityException");DlException.stopEventBubbling=function(){throw new DlExStopEventBubbling;};(function(){function DlEventProxy(){this.__eventHooks={};this.__disHooks={};this.registerEvents(DEFAULT_EVENTS);this.addEventListener("onDestroy",this.__onDestroy);};eval(Dynarch.EXPORT("DlEventProxy"));var DEFAULT_EVENTS=["onDestroy"];P.__onDestroy=function(){["__eventHooks","__disHooks"].foreach(function(hooks){for(var i in this[hooks]){var h=this[hooks][i];if(h){h.foreach(function(h,i){this[i]=null;});}this[hooks][i]=null;}this[hooks]=null;},this);};P.__getEventHooks=function(ev,copy){if(!this.__eventHooks)throw new DlExStopEventBubbling;var a=this.__eventHooks[ev.toLowerCase()];if(!a)throw new DlException("Event ["+ev+"] not registered.");if(copy)a=a.slice(0);return a;};function _connect_callback(w2,e2){return w2.applyHooks(e2,Array.$(arguments,2));};P.registerEvents=function(evs){var h=this.__eventHooks,i=0,e;while(e=evs[i++]){var e=e.toLowerCase();if(!h[e])h[e]=[];}};P.condEventListener=function(cond){cond=cond?this.addEventListener:this.removeEventListener;return cond.apply(this,Array.$(arguments,1));};P.addEventListener=function(ev,handler,phase,object){if(ev instanceof Array){var i=0,e;while(e=ev[i++])this.addEventListener(e,handler,phase,object);}else if(typeof ev=="object"){for(var i in ev)this.addEventListener(i,ev[i],handler,phase);}else{var a=this.__getEventHooks(ev);a.remove(handler);if(phase==null&&ev.toLowerCase()=="ondestroy")phase=true;phase?a.unshift(handler):a.push(handler);if(object)object.addEventListener("onDestroy",this.removeEventListener.$(this,ev,handler));}};P.listenOnce=function(ev,handler,times){if(times==null)times=1;var f=function(){if(--times==0)this.removeEventListener(ev,f);handler.apply(this,arguments);};this.addEventListener(ev,f);};P.connectEvents=function(e1,w2,e2){if(typeof w2=="string"){e2=w2;w2=this;}else if(!e2){e2=e1;}if(e1 instanceof Array){for(var i=0;i<e1.length;++i)this.connectEvents(e1[i],w2,e2[i]);}else{this.addEventListener(e1,_connect_callback.$(null,w2,e2));}};P.removeEventListener=function(ev,handler){if(ev instanceof Array){var i=0,e;while(e=ev[i++])this.removeEventListener(e,handler);}else if(typeof ev=="object"){for(var i in ev)this.removeEventListener(i,ev[i]);}else{this.__getEventHooks(ev).remove(handler);}};P.removeAllListeners=function(ev){if(ev instanceof Array){ev.foreach(this.removeAllListeners,this);}else if(typeof ev=="object"){for(var i in ev)this.removeAllListeners(i);}else{this.__getEventHooks(ev).length=0;}};P.disableHooks=function(ev){if(ev instanceof Array)ev.r_foreach(this.disableHooks,this);else{ev=ev.toLowerCase();this.__disHooks[ev]=this.__eventHooks[ev];this.__eventHooks[ev]=[];}};P.enableHooks=function(ev){if(ev instanceof Array)ev.r_foreach(this.enableHooks,this);else{ev=ev.toLowerCase();this.__eventHooks[ev]=this.__disHooks[ev];this.__disHooks[ev]=null;}};P.callHooks=function(ev){var args=arguments.length>1?Array.$(arguments,1):[];return this.applyHooks(ev,args);};P.hasHooks=function(ev){var a=this.__eventHooks[ev.toLowerCase()];return a&&a.length>0;};P.applyHooks=function(ev,args){var ret=[],a,i=0,f;try{a=this.__getEventHooks(ev,true);while(f=a[i++])ret.push(f.apply(this,args));}catch(ex){if(!(ex instanceof DlExStopEventProcessing))throw ex;}return ret;};P.destroy=function(){if(!this.destroyed){this.destroying=true;this.callHooks("onDestroy");this.__eventHooks=null;this.destroying=false;this.destroyed=true;}};})();(function(){var EVENT_MAP={"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"};function DlEvent(ev){this.type=ev.type;this.dl_type=EVENT_MAP[this.type]||this.type;this.ctrlKey=ev.ctrlKey;this.altKey=ev.altKey;this.shiftKey=ev.shiftKey;this.button=ev.button;this.focusedWidget=D.focusedWidget();if(is_ie){switch(ev.button){case 0:this.button=null;break;case 1:this.button=0;break;case 2:this.button=2;break;case 4:this.button=1;break;}}if(this.type.indexOf("key")==0){this.keyCode=ev.keyCode;this.charCode=(is_ie||is_opera)?ev.keyCode:ev.charCode;this.keyStr=String.fromCharCode(this.charCode);}if(this.dl_type=="onMouseWheel"){var delta;if(ev.wheelDelta){delta=ev.wheelDelta/120;}else if(ev.detail){delta=-ev.detail/3;}this.wheelDelta=delta;}this.pos={x:ev.clientX,y:ev.clientY};this.relPos=this.pos;if(is_ie){this.target=ev.srcElement;switch(this.type){case "mouseover":this.relatedTarget=ev.fromElement;break;case "mouseout":this.relatedTarget=ev.toElement;break;}}else try{this.target=ev.target;if(this.target.nodeType==3)this.target=this.target.parentNode;if(this.type=="mouseout"||this.type=="mouseover"){this.relatedTarget=ev.relatedTarget;if(this.relatedTarget&&this.relatedTarget.nodeType==3)this.relatedTarget=this.relatedTarget.parentNode;}}catch(ex){this.relatedTarget=ev.explicitOriginalTarget;}};eval(Dynarch.EXPORT("DlEvent",true));P.computePos=function(widget){var el=widget?(widget instanceof DlWidget?widget.getElement():widget):document.body;var pos=this.elPos=el?DOM.getPos(el):{x:0,y:0};return this.relPos={x:this.pos.x-pos.x,y:this.pos.y-pos.y,elPos:pos};};P.getObject=function(){var el=this.target;var obj=this.object;if(!obj){try{while(el&&!DlWidget.getFromElement(el))el=el.parentNode;obj=el?DlWidget.getFromElement(el):null;}catch(ex){obj=null;}this.object=obj;}return obj;};P.getParentElement=function(tag,stop){if(stop&&stop instanceof DlWidget)stop=stop.getElement();if(stop&&el===stop)return null;var el=this.target;try{while(el&&el.tagName.toLowerCase()!=tag){el=el.parentNode;if(stop&&el===stop)return null;}}catch(ex){el=null;}return el;};D.stopEvent=DOM.stopEvent;function _processEvent(obj,dev,el,ev){var o2=dev.getObject();switch(dev.type){case "click":break;case "mousedown":obj._ev_mouseDown=true;obj.applyHooks(dev.dl_type,[dev]);break;case "mouseup":var tmp=obj._ev_mouseDown;obj._ev_mouseDown=false;obj.applyHooks(dev.dl_type,[dev]);if(tmp&&obj._ev_mouseInside&&dev.button===0){dev=new DlEvent(ev);dev.dl_type="onClick";this.push([obj,dev,el,ev]);}break;case "mouseover":case "mouseout":if(!el||!DOM.related(el,ev)){if(obj===o2)obj._ev_mouseInside=dev.type=="mouseover";obj.applyHooks(dev.dl_type,[dev]);}else{dev.dl_type=dev.type=="mouseover"?"onMouseOver":"onMouseOut";obj.applyHooks(dev.dl_type,[dev]);}break;case "dblclick":if((is_ie||is_opera)&&!obj.hasHooks("onDblClick")){dev=new DlEvent(ev);dev.type="click";obj.applyHooks(dev.dl_type="onClick",[dev]);break;}default:obj.applyHooks(dev.dl_type,[dev]);break;}if(ev&&dev.domStop)DOM.stopEvent(ev);};var focusedWidget=null;function on_focusedWidget_destroy(){if(this===focusedWidget)focusedWidget=null;};D.fakeBlur=function(){if(is_safari&&focusedWidget.blur)return focusedWidget.blur();var a=DynarchDomUtils.CE_CACHE.FAKE_FOCUS;if(!a){a=DynarchDomUtils.CE_CACHE.FAKE_FOCUS=CE("a",null,{className:"DYNARCH-FAKE-FOCUS"},document.body);}a.focus();if(is_ie){var r=document.body.createTextRange();r.moveStart("character",0);r.collapse(true);r.select();}a.blur();window.status="";};D.focusedWidget=function(w){if(arguments.length>0&&focusedWidget!==w){if(focusedWidget){if(focusedWidget._focusable==2){if(w._focusable<2)D.fakeBlur();}else{focusedWidget.blur();}focusedWidget.removeEventListener("onDestroy",on_focusedWidget_destroy);}focusedWidget=w;if(w){w.addEventListener("onDestroy",on_focusedWidget_destroy);var p=w.parent;while(p){p._focusedWidget=w;p=p.parent;}}}return focusedWidget;};D.checkDisabled=function(w){while(w){if(w.disabled())return true;w=w.parent;}return false;};P.destroy=function(){this.object=this.target=this.relatedTarget=null;};P.stopDomEvent=function(){D.stopEvent(D.latestDomEvent);};var GLOBAL_CAPTURES={};var KEY_EVENTS="keydown keyup keypress".hashWords();D._genericEventHandler=function(ev,ev2){ev||(ev=window.event);var el,obj,dev=ev instanceof D?ev:new D(ev);if(ev2)ev=ev2;if(dev._failed){D.stopEvent(ev);return;}D.latestEvent=dev;D.latestDomEvent=ev;if(dev.pos.x&&dev.dl_type!="onMouseWheel"){D.latestMouseEvent=dev;if(dev.dl_type=="onMouseDown")D.latestMouseDownEvent=dev;}try{var a=GLOBAL_CAPTURES[dev.dl_type],i;if(a)for(i=a.length;--i>=0;)a[i](dev);if(dev.type in KEY_EVENTS&&focusedWidget)el=focusedWidget.getElement();else el=dev.target;var objects=[];i=0;while(el){obj=DlWidget.getFromElement(el);if(obj){if(!D.checkDisabled(obj))objects[i++]=[obj,dev,el,ev];if(obj.__noPropEvents&&obj.__noPropEvents.test(dev.dl_type))break;}el=el.parentNode;}for(i=0;i<objects.length;++i)_processEvent.apply(objects,objects[i]);}catch(ex){if(ex instanceof DlExStopEventBubbling)D.stopEvent(ev);else throw ex;}dev.destroy();};var _unloadListeners=[];function _unloadHandler(){_unloadListeners.r_foreach(Function.invoke);};D._unloadHandler=_unloadHandler;D.captureGlobals=function(obj){for(var i in obj)D.captureGlobal(i,obj[i]);};D.releaseGlobals=function(obj){for(var i in obj)D.releaseGlobal(i,obj[i]);};D.captureGlobal=function(type,f){var a=GLOBAL_CAPTURES[type];if(!a)a=GLOBAL_CAPTURES[type]=[];a.push(f);};D.releaseGlobal=function(type,f){var a=GLOBAL_CAPTURES[type];if(a)a.remove(f);};D.atUnload=function(f){_unloadListeners.push(f);};DOM.addEvents(document,["contextmenu","click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove",is_gecko?"DOMMouseScroll":"mousewheel","keydown","keyup","keypress"],D._genericEventHandler);DOM.addEvent(window,"unload",_unloadHandler);})();(function(){var BASE=DlWidget.inherits(DlEventProxy);function DlWidget(args){if(args){DlEventProxy.call(this);if(args.focusable==null&&args.tabIndex)args.focusable=true;D.setDefaults(this,args);this.__propsUserData={};this.__refNodes=[];if(!(this._parent==null||this._parent instanceof DlContainer))throw new DlException("Parent must be an instance of DlContainer");this.id=ID(this._objectType||"DlWidget");WIDGETS[this.id]=this;this.initDOM();}};eval(Dynarch.EXPORT("DlWidget",true));D.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]};var 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 WIDGETS={};D.getById=function(id){return WIDGETS[id];};D.getFromElement=function(el){return el._dynarch_object;};var TOOLTIP=null;function getTooltip(){if(!TOOLTIP)TOOLTIP=new DlTooltip({});return TOOLTIP;};D.getTooltip=getTooltip;P.getWidgetId=function(){return this.id;};P._className=["DlWidget"];P.__patchSubclassPrototype=function(){(this._className=Array.$(this._className)).push(this._objectType);};var RESIZE_RECT=null;P.getResizeRect=D.getResizeRect=function(){if(!RESIZE_RECT)RESIZE_RECT=CE("div",{display:"none"},{className:"Dl-ResizeRect",innerHTML:"&nbsp;"},document.body);return RESIZE_RECT;};function onDestroy(){if(this.__tooltipActive)getTooltip().hide();if(this.__contextMenu instanceof D)this.__contextMenu.destroy();if(this.parent)try{this.parent.removeWidget(this);}catch(ex){};var el=this.getElement();if(el){el._dynarch_object=null;el._dynarch_focusable=null;}this._element=null;DOM.trash(el);if(WIDGETS[this.id]){WIDGETS[this.id]=null;delete WIDGETS[this.id];}el=null;this.__refNodes.r_foreach(function(name,i){this.__refNodes[i]=null;this[name]=null;delete this[name];},this);this.__refNodes=null;this.userData=null;this.__propsUserData=null;};P.destroy=function(){if(this.unref()<=0)BASE.destroy.call(this);};P.__onTooltipShow=function(){this.__tooltipActive=true;this.callHooks("onTooltipShow");};P.__onTooltipHide=function(){this.__tooltipActive=false;this.callHooks("onTooltipHide");};P._popupTooltip=function(){getTooltip().popup({timeout:this.__tooltipTimeout,content:this.__tooltip,anchor:this.getElement(),align:"mouse",onPopup:this.__onTooltipShow,onHide:this.__onTooltipHide,widget:this});};function onMouseEnter(){if(this.__tooltip)this._popupTooltip();};function onMouseLeave(){getTooltip().hide();};{function dragMouseMove(da,ev){if(!da.dragging){if(Math.abs(ev.pos.x-da.startPos.x)>=da.delta||Math.abs(ev.pos.y-da.startPos.y)>=da.delta){da.dragging=true;da.makeElementCopy(this,ev);da.applyHooks("onStartDrag",[this,ev]);this.addClass(da.draggingClass);}}if(da.dragging){var el=da.elementCopy;if(el){el.style.left=ev.pos.x+5+"px";el.style.top=ev.pos.y+5+"px";}da.moving(this,ev);DlException.stopEventBubbling();}};function dragCancel(da,ev,wasCancel){this.delClass(da.draggingClass);DlEvent.releaseGlobals(da.captures);da.captures=null;DRAGGING=false;if(!wasCancel)da.doDrop(this,ev);da.reset(wasCancel);};function dragMouseUp(da,ev){if(ev.button==0){var wasDropped=da.dragging&&da.canDrop;dragCancel.call(this,da,ev,!wasDropped);}};function dragMouseOver(da,ev){DlException.stopEventBubbling();};function dragMouseOut(da,ev){DlException.stopEventBubbling();};function dragMouseEnter(da,ev){var obj=ev.getObject();var insideThis=false,p=obj;while(p){if(p===this){insideThis=true;break;}p=p.parent;}var canDrop=da.dropOK(this,ev,obj,insideThis);DlException.stopEventBubbling();};function dragMouseLeave(da,ev){DlException.stopEventBubbling();};function dragKeyPress(da,ev){if(ev.keyCode==DlKeyboard.ESCAPE){dragCancel.call(this,da,ev,true);}DlException.stopEventBubbling();};function dragContextMenu(da,ev){DlException.stopEventBubbling();};var DRAGGING=false;}function onMouseDown(ev){getTooltip().cancel();if(this._focusable&&!ev._justFocusedWidget){ev._justFocusedWidget=this;if(this._focusable<2)this.focus();}if(ev.button==0){var da=this._dragArgs,el;if(da&&!DRAGGING){if(da.startOK(this,ev)){var obj=ev.getObject();if(obj)obj.applyHooks("onMouseLeave",[ev]);DRAGGING=true;da.source=this;da.captures={onMouseMove:dragMouseMove.$(this,da),onMouseUp:dragMouseUp.$(this,da),onMouseOver:dragMouseOver.$(this,da),onMouseOut:dragMouseOut.$(this,da),onMouseEnter:dragMouseEnter.$(this,da),onMouseLeave:dragMouseLeave.$(this,da),onContextMenu:dragContextMenu.$(this,da),onKeyPress:dragKeyPress.$(this,da)};da.startPos=ev.pos;da.startElPos=this.getPos();DlEvent.captureGlobals(da.captures);}}}};function onContextMenu(ev){var content=this.__contextMenu;if(typeof content=="function")content=content.call(this);if(content){var p=this._getContextMenuPopup();p.popup({timeout:0,content:content,anchor:content.contextMenuAnchor||this.getElement(),align:content.contextMenuAlign||"mouse",widget:this,onPopup:content.contextMenuOnPopup||null,onHide:content.contextMenuOnHide||null,isContext:true});DlException.stopEventBubbling();}};P.setData=function(key,val){if(arguments.length==1)delete this.__propsUserData[key];else this.__propsUserData[key]=val;};P.getData=function(key){return this.__propsUserData[key];};P._getDlPopup=function(){var p=this.getParent(DlPopup)||0;if(p)p=p._level+1;return DlPopupMenu.get(p);};P._getContextMenuPopup=P._getDlPopup;var LISTENERS={onDestroy:onDestroy,onMouseEnter:onMouseEnter,onMouseLeave:onMouseLeave,onMouseDown:onMouseDown,onContextMenu:onContextMenu};P._setListeners=function(){this.addEventListener(LISTENERS);this.addEventListener(is_ie?"onKeyDown":"onKeyPress",this._handle_focusKeys);};P._handle_focusKeys=function(ev){};P._check_accessKey=function(ev){return this._accessKey&&DlKeyboard.checkKey(ev,this._accessKey);};P._handle_accessKey=function(ev){this.focus();};P._setFocusedStyle=function(focused){this.condClass(focused,this._className.peek()+"-focus");};P.focus=function(){if(this._focusable){DlEvent.focusedWidget(this);this._setFocusedStyle(true);this.callHooks("onFocus");if(!(this instanceof DlEntry)){this.scrollIntoView();}}else if(this.parent){this.parent.focus();}};P.blur=function(){if(this._focusable){if(!this.destroyed){this._setFocusedStyle(false);this.callHooks("onBlur");}}};P.focusInside=function(){var fw=DlEvent.focusedWidget();while(fw){if(fw==this)break;fw=fw.parent;}return!!fw;};P._createElement=function(html){var el=this._element;if(!el){var C=this.constructor,cn=C.__joinedClassName||this._className.join(" ");if(!C.__joinedClassName)C.__joinedClassName=cn;if(this.__addClassName)cn+=" "+this.__addClassName;if(html){el=DOM.createFromHtml(html);el.className=cn;}else{el=CE(this._tagName,null,{className:cn});}if(this._focusable)el._dynarch_focusable=true;this._element=el;}else{this.__alreadyInDom=true;}el._dynarch_object=this;};P.getElement=function(){return this._element};P.getParentNode=function(){return this._element.parentNode};P.setStyle=function(a,b){var s=this.getElement().style;if(arguments.length>1){s[a]=b;}else{for(var i in a)this.setStyle(i,a[i]);}};P.getContentElement=function(){return this.getElement();};P.setContent=function(content){var el=this.getContentElement();while(el.firstChild)el.removeChild(el.lastChild);if(typeof content=="string"){el.innerHTML=content;}else if(content instanceof Function){return this.setContent(content.call(this));}else if(content instanceof D){this.appendWidget(content,this.__appendArgs);}else if(content instanceof Array){el.innerHTML=content.join("");}else if(content!=null){el.appendChild(content);}return content!=null;};P.ref=function(){return this.__refCnt++;};P.unref=function(){return--this.__refCnt;};P.refCnt=function(){return this.__refCnt;};P.setContextMenu=function(menu){if(this.__contextMenu instanceof D)this.__contextMenu.destroy();if(menu instanceof D)menu.ref();this.__contextMenu=menu;};P.setTooltip=function(tt){this.__tooltip=tt;};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);this._setListeners();this._createElement();if(this._parent){this._parent.appendWidget(this,this.__appendArgs);this._parent=null;}if(this.__disabled)this.disabled(true,true);this.__onTooltipShow=this.__onTooltipShow.$(this);this.__onTooltipHide=this.__onTooltipHide.$(this);return this;};P.setUnselectable=function(el,val){if(el==null)el=this.getElement();DOM.setUnselectable(el,val);};P.disabled=function(v,force){if(v!=null&&(force||v!=this.__disabled)){this.__disabled=v;this.condClass(v,"DlWidget-disabled");this.condClass(v,this._className.peek()+"-disabled");this.applyHooks("onDisabled",[v]);}return this.__disabled;};P.enabled=function(v,force){if(v!=null){this.disabled(!v,force);}return!this.__disabled;};P.getParent=function(type,skipThis){if(type==null)return this.parent;var parent=this;if(skipThis)parent=this.parent;while(parent&&!(parent instanceof type))parent=parent.parent;return parent;};P.findParent=function(f,skipThis){var tmp,parent=this;if(skipThis)parent=this.parent;if(f instanceof Function){while(parent&&!f(parent))parent=parent.parent;}else{var args=Array.$(arguments,2);while(parent){tmp=parent[f];if(tmp)if(tmp instanceof Function){if(tmp.apply(parent,args))break;}else break;parent=parent.parent;}}return parent;};P.getPos=function(){return DOM.getPos(this.getElement());};P.getBRPos=function(){return DOM.getBRPos(this.getElement());};P.getOffsetPos=function(){var el=this.getElement();return{x:el.offsetLeft,y:el.offsetTop};};P.setPos=function(x,y){var el=this.getElement();if(x!=null&&typeof x=="object"){x=x.x;y=x.y;}if(x!=null)el.style.left=x+"px";if(y!=null)el.style.top=y+"px";};P.setSize=P.setOuterSize=function(size){DOM.setOuterSize(this.getElement(),size.x,size.y);this.callHooks("onResize");};P.setInnerSize=function(size){DOM.setInnerSize(this.getContentElement(),size.x,size.y);this.callHooks("onResize");};P.getSize=P.getOuterSize=function(){return DOM.getOuterSize(this.getElement());};P.getInnerSize=function(){return DOM.getInnerSize(this.getContentElement());};P.display=function(v){var s=this.getElement().style;if(v!=null){s.display=v?"":"none";this.applyHooks("onDisplay",[v,s.display,"display"]);return v;}return s.display!="none";};P.visibility=function(v){var s=this.getElement().style;if(v!=null){s.visibility=v?"":"hidden";this.applyHooks("onDisplay",[v,s.visibility,"visibility"]);return v;}return s.visible!="hidden";};P.opacity=function(o){return DOM.setOpacity(this.getElement(),o);};P.position=function(p){var s=this.getElement().style,o=s.position;if(p!=null){s.position=p;}return o;};P.setIconClass=function(iconClass){var e2=this.getContentElement();CC(e2,iconClass!=null,this.__withIconClass||this._className.peek()+"-withIcon");if(this.iconClass)DC(e2,this.iconClass);if(iconClass)AC(e2,iconClass);this.iconClass=iconClass;};P.addClass=function(ac,dc){AC(this.getElement(),ac,dc);};P.delClass=function(dc,ac){DC(this.getElement(),dc,ac);};P.condClass=function(cond,clsTrue,clsFalse){CC(this.getElement(),cond,clsTrue,clsFalse);return cond;};P.zIndex=function(zIndex){var el=this.getElement();if(zIndex!=null){el.style.zIndex=zIndex;return zIndex;}if(el.style.zIndex)return parseInt(el.style.zIndex,10);return 0;};P.refNode=function(name,el){this[name]=el;this.__refNodes.remove(name);if(el!=null)this.__refNodes.push(name);return el;};P.debug_highlight=function(color){this.getElement().style.backgroundColor=color||"yellow";};P.getQuickPopup=function(){var p=this.getParent(DlPopup)||0;if(p)p=p._level+1;return DlDialogPopup.get(p);};P.quickPopup=function(args){var p=this.getQuickPopup();args=Dynarch.makeCopy(args);Dynarch.mergeUndefined(args,{anchor:this.getElement(),align:{prefer:"CC"}});p.popup(args);};P.getScroll=function(){var el=this.getElement();return{x:el.scrollLeft,y:el.scrollTop};};P.scrollIntoView=function(){DOM.scrollIntoView(this.getElement());};P.flash=function(timeout,steps){DOM.flash(this.getElement(),timeout,steps);};DlEvent.atUnload(function(){do{window.DL_CLOSING=true;var destroying=false;for(var i in WIDGETS){destroying=true;var w=WIDGETS[i];try{WIDGETS[i]=null;delete WIDGETS[i];w.destroy()}catch(ex){};break;}}while(destroying);WIDGETS=null;});})();(function(){var BASE=DlContainer.inherits(DlWidget);function DlContainer(args){if(args){DlContainer.setDefaults(this,args);this._widgets=[];DlWidget.call(this,args);}};eval(Dynarch.EXPORT("DlContainer"));D.DEFAULT_ARGS={_scrollBars:["scroll",false],__noParentKeyBindings:["noParentKB",false]};P._createElement=function(){BASE._createElement.apply(this,arguments);if(this._scrollBars)this.setStyle("overflow","auto");};P.appendWidget=function(w){if(w.parent)w.parent.removeWidget(w);this._widgets.push(w);w.parent=this;if(!w.__alreadyInDom)this._appendWidgetElement.apply(this,arguments);delete w.__alreadyInDom;};P._appendWidgetElement=function(w,p){var el=w.getElement();if(typeof p=="number"){var parent=this.getContentElement();try{p=parent.childNodes[p];parent.insertBefore(el,p);}catch(ex){parent.appendChild(el);}}else{if(p==null)p=this.getContentElement();else if(typeof p=="string")p=document.getElementById(p);if(el.parentNode!==p)p.appendChild(el);}};P.removeWidget=function(w){if(w.parent===this){this._removeWidgetElement(w);this._widgets.remove(w);w.parent=null;}};P._removeWidgetElement=function(w){if(this._widgets.contains(w)){var el=w.getElement();if(el.parentNode)el.parentNode.removeChild(el);}};P.destroyChildWidgets=function(){var a=Array.$(this._widgets);a.r_foreach(function(w){try{w.destroy();}catch(ex){};});var el=this.getContentElement();if(el)el.innerHTML="";return el;};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener("onDestroy",this.destroyChildWidgets);this.addEventListener("onResize",this.__doLayout);};P.disabled=function(v,force){var isDisabled=BASE.disabled.call(this,v,force);if(v!=null)this._widgets.r_foreach(function(w){w.disabled(v,force);});return isDisabled;};P.children=function(idx){return idx!=null?this._widgets[idx]:this._widgets;};P.__doLayout=function(){var w=this.children().grep_first(function(w){return w._fillParent;});if(w)w.setSize(this.getInnerSize());};function getAllFocusableWidgets(sub,all){sub=sub?Array.$(sub.getElement().getElementsByTagName("*")):[];return Array.$(this.getElement().getElementsByTagName("*")).grep(all?"_dynarch_object":"_dynarch_focusable").grep(DynarchDomUtils.elementIsVisible).grep(sub.contains.$(sub).inverse()).map(DlWidget.getFromElement).grep("enabled").mergeSort(function(a,b){return a._tabIndex-b._tabIndex;});};function getFocusableWidget(w,d){var a=getAllFocusableWidgets.call(this,w);var i=a.find(w);i=a.rotateIndex(i+d);if(i!=null)return a[i];};P.getNextFocusWidget=function(w){return getFocusableWidget.call(this,w,1);};P.getPrevFocusWidget=function(w){return getFocusableWidget.call(this,w,-1);};P.getFirstFocusWidget=function(){return this.getNextFocusWidget(null);};P.getLastFocusWidget=function(){return this.getPrevFocusWidget(null);};P._handleKeybinding=function(ev,w){if(ev.altKey||ev.ctrlKey){var a=getAllFocusableWidgets.call(this,w,true);a.foreach(function(w){if(w._check_accessKey(ev)){w._handle_accessKey(ev);ev.domStop=true;DlExStopEventBubbling();}});if(this.parent&&!this.__noParentKeyBindings)this.parent._handleKeybinding(ev,this);}};var HIDDEN;D.getHiddenContainer=function(){if(!HIDDEN){HIDDEN=new this({className:"DlContainer-Hidden"});document.body.appendChild(HIDDEN.getElement());}return HIDDEN;};})();(function(){var BASE=DlRadioGroup.inherits(DlEventProxy);function DlRadioGroup(id){if(id!=null){DlEventProxy.call(this);this._maxChecked=1;this._minChecked=null;this.id=id;this.registerEvents(DEFAULT_EVENTS);this.reset();this.addEventListener("onDestroy",onDestroy);}};var GROUPS={};eval(Dynarch.EXPORT("DlRadioGroup"));var DEFAULT_EVENTS=["onChange"];D.getById=D.get=function(id){if(!id)id=Dynarch.ID("group");var g=GROUPS[id];if(!g)g=GROUPS[id]=new this(id);return g;};function onDestroy(){if(GROUPS[this.id]){this._buttons=null;this._buttonsById=null;this._buttonsByValue=null;this._history=null;delete GROUPS[this.id];}};function onChange(w){if(w!=null){this._changed=true;if(w.checked()){if(this._maxChecked!=null){while(this._history.length>=this._maxChecked){var o=this._history[0];o.checked(false,true);this._history.splice(0,1);}}this._history.push(w);}else if(this._minChecked!=null&&this._history.length<=this._minChecked){w.checked(true,true);throw new DlExStopEventProcessing();}else{this._history.remove(w);}}};P.reset=function(){if(this._buttons)this._buttons.r_foreach(function(b){b.__group=b.__groupId=null;});this._changed=false;this._buttons=[];this._buttonsById={};this._buttonsByValue={};this._history=[];this.removeAllListeners("onChange");this.addEventListener("onChange",onChange);};P.changed=function(c){var r=this._changed;if(c!=null)this._changed=c;return r;};P.getSelected=function(){return this._history;};P.getButtons=function(){return this._buttons;};P.getNextButton=function(btn){if(btn==null)btn=this.getSelected()[0];var a=this._buttons,idx=a.nullLimitIndex(a.find(btn)+1);if(idx!=null)return a[idx];};P.getPrevButton=function(btn){if(btn==null)btn=this.getSelected()[0];var a=this._buttons,idx=a.nullLimitIndex(a.find(btn)-1);if(idx!=null)return a[idx];};P.getValue=function(){return this._history.map("value");};P.setValue=function(val,hooks){var h=this._buttonsByValue;if(!(val instanceof Array))val=[val];val=val.toHash(true);this._history=[];for(var i in h){h[i].checked(val[i],true);if(val[i])this._history.push(h[i]);}if(hooks)this.callHooks("onChange");};P.getByValue=function(val){return this._buttonsByValue[val];};P.addWidget=function(w,pos){if(!this._buttonsById[w.id]){if(pos==null)pos=this._buttons.length;this._buttonsById[w.id]=w;this._buttons.splice(pos,0,w);if(w.checked())this._history.push(w);var val=w.value();if(typeof val!="undefined")this._buttonsByValue[val]=w;w.addEventListener("onDestroy",this.removeWidget.$(this,w));}};P.removeWidget=function(w){if(this._buttonsById[w.id]){this._changed=true;delete this._buttonsById[w.id];var val=w.value();if(typeof val!="undefined")delete this._buttonsByValue[w.value()];this._buttons.remove(w);if(this._history.length!=this._history.remove(w).length)this.callHooks("onChange");}};P.minChecked=function(minChecked){if(arguments.length>0)this._minChecked=minChecked;return this._minChecked;};P.maxChecked=function(maxChecked){if(arguments.length>0)this._maxChecked=maxChecked;return this._maxChecked;};P.checkAll=function(val,hooks){if(val==null)val=true;if(hooks==null)hooks=false;this._buttons.foreach(function(w){w.checked(val,!hooks);});this._history=val?Array.$(this._buttons):[];};P.unCheckAll=function(){this._history.r_foreach(function(w){w.checked(false);});};})();(function(){var DEFAULT_LISTENERS=["onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onUpdateLabel","onClick","onCheck","onChange","onDisabled"];var BASE=DlAbstractButton.inherits(DlWidget);function DlAbstractButton(args){if(args){D.setDefaults(this,args);DlWidget.call(this,args);var gid=this.__groupId;if(gid!=null){var g;if(typeof gid=="object"){g=gid;this.__groupId=g.id;}else g=DlRadioGroup.get(gid);this.__group=g;g.addWidget(this,typeof args.appendArgs=="number"?args.appendArgs:null);}if(!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)};}}};eval(Dynarch.EXPORT("DlAbstractButton",true));var DEFAULT_EVENTS=["onCheck","onUncheck","onChange","onUpdateLabel"];var TYPE={STANDARD:1,TWOSTATE:2};D.DEFAULT_ARGS={_label:["label",""],_classes:["classes",{}],_checked:["checked",false],__groupId:["group",null],_btnType:["type",TYPE.STANDARD],_value:["value",window.undefined],_noCapture:["noCapture",false],_alwaysCheck:["alwaysCheck",false]};P._cap_onMouseUp=function(ev){var obj=ev.getObject();DlEvent.releaseGlobals(this._btnpressCapture);this.applyHooks("onMouseUp",[ev]);if(!this._ev_mouseInside)this.applyHooks("onMouseLeave",[ev]);if(obj!==this){obj&&obj.applyHooks("onMouseEnter",[ev]);DlException.stopEventBubbling();}};P._cap_onMouseEnter=function(ev){var obj=ev.getObject();if(obj===this)this.addClass(this._classes.active);obj&&(obj._ev_mouseInside=true);DlException.stopEventBubbling();};P._cap_onMouseLeave=function(ev){var obj=ev.getObject();if(obj===this)this.delClass(this._classes.active);obj&&(obj._ev_mouseInside=false);DlException.stopEventBubbling();};D.TYPE=TYPE;P._onMouseEnter=function(ev){this.addClass(this._classes.hover);};P._onMouseLeave=function(ev){this.delClass(this._classes.hover);this.delClass(this._classes.active);};P._onMouseDown=function(ev){if(ev.button===0){this._ev_mouseInside=true;this.addClass(this._classes.hover);this.addClass(this._classes.active);if(!this._noCapture){DlEvent.captureGlobals(this._btnpressCapture);ev.domStop=true;}}};P._onMouseUp=function(ev){this.delClass(this._classes.active);};P._onUpdateLabel=function(){var el=this.getElement();CC(el,!this._label||!/\S/.test(this._label),this._classes.empty);};P._onClick=function(){if(this._btnType==TYPE.TWOSTATE){this._alwaysCheck?this.checked(true):this.toggle();}};P.keyClicked=function(ev){this.addClass(this._classes.active);(function(){this.delClass(this._classes.hover);this.delClass(this._classes.active);this.applyHooks("onClick",[ev]);}).delayed(90,this);if(ev){ev.domStop=true;DlException.stopEventBubbling();}};P._handle_focusKeys=function(ev){var k=ev.keyCode;if(k==DlKeyboard.ENTER||ev.charCode==DlKeyboard.SPACE){this.keyClicked(ev);}else if(!this._customMoveKeys&&this.__group&&k in DlKeyboard.KEYS_MOVE){var prev=k in DlKeyboard.KEYS_MOVE_PREV,w=prev?this.__group.getPrevButton(this):this.__group.getNextButton(this);if(w){w.focus();if(ev.shiftKey){this.checked(true);w.checked(true);}ev.domStop=true;DlException.stopEventBubbling();}}BASE._handle_focusKeys.call(this,ev);};P._handle_accessKey=function(ev){this.focus();this.keyClicked(ev);};P.disabled=function(v,force){if(v!=null&&v){DC(this.getElement(),this._classes.hover);DC(this.getElement(),this._classes.active);}return BASE.disabled.call(this,v,force);};P._onChange=function(){if(this.__group!=null)this.__group.applyHooks("onChange",[this]);};P._onCheck=Dynarch.noop;P._onDisabled=function(v){CC(this.getElement(),v,this._classes.disabled);if(v&&this._capture){DlEvent.releaseCapture(this._capture);this._capture=null;}};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);this.setUnselectable();};P._createElement=function(){BASE._createElement.call(this);this._createLabelElement();this.label(this._label,true);this._updateState();};P._setListeners=function(){BASE._setListeners.call(this);DEFAULT_LISTENERS.r_foreach(function(ev){this.addEventListener(ev,this["_"+ev]);},this);};P._createLabelElement=Dynarch.noop;P.label=function(label,force){if(force||arguments.length>0&&label!==this._label){this._label=label;if(label)label="<div class='DlButton-Label'>"+this._label+"</div>";this.setContent(label);this.applyHooks("onUpdateLabel",[this._label]);}return this._label;};P.setLabel=P.label;P.getLabel=P.label;P.group=function(){return this.__group;};P._checkTwoState=function(nothrow){var cond=this._btnType!=TYPE.TWOSTATE;if(cond&&!nothrow)throw new DlExInvalidOperation("This operation is only available for a TWOSTATE button");return!cond;};P._updateState=function(){if(this._checkTwoState(true)){var c=this._classes;CC(this.getElement(),this._checked,c.checked,c.unchecked);}};P.checked=function(checked,nohooks){this._checkTwoState();if(arguments.length>0){checked=!!checked;var diff=!nohooks&&(this._checked!==checked);this._checked=checked;this._updateState();if(diff){this.callHooks("onChange");this.callHooks(checked?"onCheck":"onUncheck");}}return this._checked;};P.toggle=function(nohooks){this._checkTwoState();this.checked(!this._checked,nohooks);};P.value=function(newval){var oldval=this._value;if(arguments.length>0)this._value=newval;return oldval;};P.setValue=P.value;P.getValue=P.value;})();(function(){DlAnimation.inherits(DlEventProxy);function DlAnimation(length,fps){DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);this.addEventListener("onDestroy",this.stop.$(this));if(length!=null)this.length=length;if(fps!=null)this._speed=1000/fps;this._update=update.$(this);};eval(Dynarch.EXPORT("DlAnimation"));var DEFAULT_EVENTS=["onStart","onStop","onPause","onUpdate"];P.start=function(length,fps,func){this.stop();if(length!=null)this.length=length;if(fps!=null)this._speed=1000/fps;if(func!=null){if(!(func instanceof Function))func=DlAnimation.easing[func];this.func=func;}this.t=0;this.i=0;this.callHooks("onStart");this._timer=setInterval(this._update,this._speed);};P.stop=function(finished){if(this._timer){clearInterval(this._timer);this._timer=null;this.applyHooks("onStop",[finished]);}};P.getPos=function(f){if(f==null)f=this.func;return f.call(this,this.t);};function update(){this.t=this.i/this.length;try{this.applyHooks("onUpdate",[this.t]);if(++this.i>this.length)this.stop(true);}catch(ex){this.stop();throw ex;}};var PI=Math.PI,abs=Math.abs,asin=Math.asin,pow=Math.pow,sin=Math.sin,cos=Math.cos,exp=Math.exp,round=Math.round;var E=D.easing={elastic_b:function(t){return 1-cos(-t*5.5*PI)/pow(2,7*t);},elastic_b_custom:function(elasticity,stability,t){elasticity+=0.5;return 1-cos(-t*elasticity*PI)/pow(2,stability*t);},magnetic:function(t){return 1-cos(t*t*t*10.5*PI)/exp(4*t);},accel_b:function(t){t=1-t;return 1-t*t*t;},accel_a:function(t){return t*t*t;},accel_ab:function(t){t=1-t;return 1-sin(t*t*t*PI/2);},bounce_b:function(t){return t<1/2.75?7.5625*t*t:(t<2/2.75?(7.5625*(t-=1.5/2.75)*t+.75):(t<2.5/2.75?(7.5625*(t-=2.25/2.75)*t+.9375):(7.5625*(t-=2.625/2.75)*t+.984375)));},shake:function(t){return t<0.5?-cos(t*11*PI)*t*t:(t=1-t,cos(t*11*PI)*t*t);}};})();(function(){var BASE=DlBox.inherits(DlContainer);function DlBox(args){if(args){DlBox.setDefaults(this,args);args.tagName="table";DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlBox",true));D.DEFAULT_ARGS={_borderSpacing:["borderSpacing",0],_align:["align",null]};P._createElement=function(){BASE._createElement.call(this);var table=this.getElement();table.cellSpacing=this._borderSpacing;table.cellPadding=0;if(this._align)table.align=this._align;this.refNode("_tbody",CE("tbody",null,null,table));};P.getTableElement=P.getElement;P._appendWidgetElement=function(widget,where){if(where==null)this.createCellElement().appendChild(widget.getElement());else where.appendChild(widget.getElement());};P.destroyChildWidgets=function(){var a=Array.$(this._widgets);a.r_foreach(function(w){try{w.destroy();}catch(ex){};});};P.__addSep=function(sep_cls,cls,td){if(!td)td=this.createCellElement();td.separator=true;var cn=this._objectType+"-"+sep_cls;if(cls)cn+=" "+cls;td.className=cn;td.innerHTML="<div class='"+cn+"'>&nbsp;</div>";DOM.setUnselectable(td);return td;};P.addSeparator=function(cls,td){return this.__addSep("separator",cls,td);};P.addSpace=function(cls,td){return this.__addSep("spacer",cls,td);};})();(function(){var BASE=DlButton.inherits(DlAbstractButton);function DlButton(args){if(args){D.setDefaults(this,args);DlAbstractButton.call(this,args);this.setIconClass(this._iconClass);this._iconClass=null;}};eval(Dynarch.EXPORT("DlButton",true));D.TYPE=DlAbstractButton.TYPE;D.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]};P._createElement=function(){BASE._createElement.call(this);this.addClass("DlWidget-3D");};P._createLabelElement=function(){this.getElement().innerHTML="<div class='DlButton-inner'><div></div></div>";};P.getContentElement=function(){return this.getElement().firstChild.firstChild;};P.setSize=P.setOuterSize=function(size){var d1=DOM.getPaddingAndBorder(this.getElement());if(size.x!=null)size.x-=d1.x;if(size.y!=null)size.y-=d1.y;d1=DOM.getPaddingAndBorder(this.getElement().firstChild);if(size.x!=null)size.x-=d1.x;if(size.y!=null)size.y-=d1.y;DOM.setOuterSize(this.getContentElement(),size.x,size.y);};})();(function(){DlHbox.inherits(DlBox);function DlHbox(args){if(args)DlBox.call(this,args);};eval(Dynarch.EXPORT("DlHbox",true));P._createElement=function(){D.BASE._createElement.call(this);this.refNode("_row",CE("tr",null,null,this._tbody));};P.createCellElement=function(pos){var td=CE("td",null,{className:"cell"});pos!=null?this._row.insertBefore(td,pos):this._row.appendChild(td);return td;};P._removeWidgetElement=function(w){if(this._widgets.contains(w)){var el=w.getElement();el.parentNode.parentNode.removeChild(el.parentNode);}};P.addFiller=function(){var td=this.createCellElement();td.className+=" DlHbox-filler";this.addClass("DlHbox-hasFiller");};P.setAlign=function(left,right){var el=this.getElement();switch(left){case "left":el.style.marginLeft="0";el.style.marginRight="auto";break;case "center":el.style.marginLeft="auto";el.style.marginRight="auto";break;case "right":el.style.marginLeft="auto";el.style.marginRight="0";break;default:el.style.marginLeft=left!=null?left:"auto";el.style.marginRight=right!=null?right:"auto";}};P.setEqualWidths=function(d){var width=this.children().max(function(w){return w.getSize().x;});if(d)width+=d;this.children().r_foreach(function(w){w.setSize({x:width});});};})();function DlPoint(x,y){if(typeof x=="object"){this.x=x.x;this.y=x.y;}else{this.x=x;this.y=y;}};DlPoint.prototype={clone:function(){return new DlPoint(this.x,this.y);},normalize:function(p){var tmp;if(this.x>p.x){tmp=this.x;this.x=p.x;p.x=tmp;}if(this.y>p.y){tmp=this.y;this.y=p.y;p.y=tmp;}return this;},distanceTo:function(p){var a=Math.abs(p.x-this.x),b=Math.abs(p.y-this.y);return Math.sqrt(a*a+b*b);}};function DlRect(x,y,w,h){if(x instanceof DlRect){this.setFromRect(x);}else if(typeof x=="object"){if(typeof y=="object"){if(y instanceof DlPoint){this.setFromPoints(x,y);}else{this.setFromValues(x.x,x.y,y.x,y.y);}}else{this.setFromValues(x.x,x.y,w,h);}}else{this.setFromValues(x,y,w,h);}};DlRect.prototype={setFromRect:function(r){this.x=r.x;this.y=r.y;this.w=r.w;this.h=r.h;return this;},setFromPoints:function(p1,p2){p1=p1.clone().normalize(p2=p2.clone());this.x=p1.x;this.y=p1.y;this.w=p2.x-p1.x+1;this.h=p2.y-p1.y+1;return this;},setFromValues:function(x,y,w,h){this.x=x;this.y=y;this.w=w;this.h=h;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(h){if(h!=null)this.h=h;return this.h;},width:function(w){if(w!=null)this.w=w;return this.w;},containsPoint:function(p){return this.x<=p.x&&this.x+this.w>p.x&&this.y<=p.y&&this.y+this.h>p.y;},intersect:function(r){var ret=null,M=Math,dx=M.max(this.x,r.x),dy=M.max(this.y,r.y),dw=M.min(this.x+this.w,r.x+r.w)-dx,dh=M.min(this.y+this.h,r.y+r.h)-dy;if(dw>0&&dh>0)ret=new DlRect(dx,dy,dw,dh);return ret;},area:function(){return this.w*this.h;},makeDiv:function(bw,bc){bc||(bc="#000");bw==null&&(bw=0);var s={position:"absolute",left:this.x+"px",top:this.y+"px",width:this.w-bw*2+"px",height:this.h-bw*2+"px",overflow:"hidden",lineHeight:"1px",fontSize:"1px",border:bw+"px solid "+bc};s=DynarchDomUtils.createElement("div",s,{innerHTML:"&nbsp;"});return s;},positionDiv:function(div){div.style.left=this.x+"px";div.style.top=this.y+"px";div.style.height=this.h+"px";div.style.width=this.w+"px";},toString:function(){return this.w+"x"+this.h+"@"+this.x+","+this.y;}};(function(){var POPUPS={};var ALL_POPUPS={};var POPUPS_BY_ID={};var RE_REMOVE_SCROLL=/DlPopup-scroll(Up|Down)?-hover/g;var BASE=DlPopup.inherits(DlContainer);function DlPopup(args){if(args){D.setDefaults(this,args);this._hasScrolling=false;DlContainer.call(this,args);this.visible=false;}};eval(Dynarch.EXPORT("DlPopup",true));var DEFAULT_EVENTS=["onPopup","onHide"];D.DEFAULT_ARGS={_level:["level",0],_autolink:["autolink",true],_oscroll:["scroll",{step1:5,step2:10,speed:40}],_align:["align",null],_zIndex:["zIndex",1000],_focusable:["focusable",true],_shadows:["shadows",true]};D.get=function(level,nocreate){var type=this.prototype._objectType;var shouldAttach=false;var max=POPUPS[type].length;if(level==null||level>=max){level=max;shouldAttach=true;}var pt=ALL_POPUPS[type];if(!ALL_POPUPS[type])pt=ALL_POPUPS[type]={};var ret=pt[level];if(!ret){if(!nocreate)ret=pt[level]=new this({level:level});else ret=null;}ret.detachPopup();if(shouldAttach&&level>0)ret.attachToPopup(POPUPS[type].peek());return ret;};D.clearAll=function(lev){var a=POPUPS[this.prototype._objectType];a=a[lev||0];if(a)a.hide();};D.clearAllPopups=function(except){for(var i in POPUPS_BY_ID){if(!except||!except[i])POPUPS_BY_ID[i].hide();}};P.__patchSubclassPrototype=function(){BASE.__patchSubclassPrototype.call(this);this.constructor.get=D.get;this.constructor.clearAll=D.clearAll;POPUPS[this._objectType]=[];ALL_POPUPS[this._objectType]={};};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);};P._createElement=function(){var parent=this._parent;this._parent=null;BASE._createElement.call(this);var div=this.getElement();this.parent=parent;this.display(false);document.body.appendChild(div);if(this._shadows&&!is_ie6){div.appendChild(DlElementCache.get("SHADOWS"));AC(div,typeof this._shadows=="string"?this._shadows:"ThinShadows");}else{this._shadows=false;AC(div,this._objectType+"-noShadow");}if(is_gecko)div=CE("div",null,{className:"Gecko-Bug-302380"},div);this.refNode("_contentEl",CE("div",null,{className:"DlPopup-scrollArea"},div));this.zIndex(this._zIndex);};P.getContentElement=function(){return this._contentEl;};P.getScrollDiv=P.getContentElement;P._scrollSetArrowState=function(){var div=this.getScrollDiv(),s1=this._scroll_el(0),s2=this._scroll_el(1),at_start=div.scrollTop==0,at_end=div.scrollTop+div.offsetHeight==div.scrollHeight;if(at_start||at_end)this._scrollStopHandler();CC(s1,at_start,"DlPopup-scrollUp-disabled");CC(s2,at_end,"DlPopup-scrollDown-disabled");};function _scrollHandler(dir){this.getScrollDiv().scrollTop+=this._scrollStep*dir;this._scrollSetArrowState();};function _scrollStartHandler(self,dir){self._scrollStep=self._oscroll.step1;self._scrollTimer=setInterval(_scrollHandler.$(self,dir),self._oscroll.speed);AC(this,"DlPopup-scroll-hover");CC(this,dir>0,"DlPopup-scrollDown-hover","DlPopup-scrollUp-hover");};P._scrollStopHandler=function(){if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;this._scrollSetArrowState();}DC(this._scroll_el(0),RE_REMOVE_SCROLL);DC(this._scroll_el(1),RE_REMOVE_SCROLL);};P._scrollDoubleSpeed=function(dbl){this._scrollStep=this._oscroll[dbl?"step2":"step1"];return false;};P._scroll_setup=function(){if(!this._hasScrolling){this._hasScrolling=true;var e=this.getElement(),s1=CE("div",null,{className:"DlPopup-scrollUp"},e,0),s2=CE("div",null,{className:"DlPopup-scrollDown"},e);s1.onmouseover=_scrollStartHandler.$(null,this,-1);s2.onmouseover=_scrollStartHandler.$(null,this,1);s1.onmouseout=s2.onmouseout=this._scrollStopHandler.$(this);s1.onmousedown=s2.onmousedown=this._scrollDoubleSpeed.$(this,true);s1.onmouseup=s2.onmouseup=this._scrollDoubleSpeed.$(this,false);this.refNode("_scrollEl0",s1);this.refNode("_scrollEl1",s2);this.getScrollDiv().onscroll=this._scrollSetArrowState.$(this);}this._scroll_visibile(true);};P._scroll_el=function(p){return this["_scrollEl"+p];};P._scroll_visibile=function(vis){if(this._hasScrolling){if(is_gecko)this.getScrollDiv().parentNode.style.overflow=vis?"auto":"";vis=vis?"":"none";this._scroll_el(0).style.display=vis;this._scroll_el(1).style.display=vis;this.args.scrollVisible=!vis;}};function onPopup(){POPUPS[this._objectType][this._level]=this;if(!this._autolink||this._level==0)POPUPS_BY_ID[this.id]=this;};function onHide(){var a=POPUPS[this._objectType];var child=a[this._level+1];if(child)child.hide();a.splice(this._level,1);if(POPUPS_BY_ID[this.id])delete POPUPS_BY_ID[this.id];};function onMouseWheel(ev){if(this.args.scrollVisible){var div=this.getScrollDiv(),st=div.scrollTop;if(ev.wheelDelta<0){st+=20;}else{st-=20;if(st<0)st=0;}div.scrollTop=st;ev.domStop=true;DlException.stopEventBubbling();}};var have_doc_listener=false;function global_onMouseDown(ev){var obj=ev.getObject();var except={};while(obj&&!(obj instanceof D)){if(obj.currentPopup)except[obj.currentPopup.id]=true;obj=obj.parent;}if(obj){while(obj!=null){except[obj.id]=true;obj=obj._parentPopup;}}D.clearAllPopups(except);};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener({onPopup:onPopup,onMouseWheel:onMouseWheel,onHide:onHide});if(!have_doc_listener){have_doc_listener=true;DlEvent.captureGlobal("onMouseDown",global_onMouseDown);}};function _do_popup(args){if(args.onBeforePopup)args.onBeforePopup.call(this,args);this._timer=null;if(!this.setContent(args.content))return;if(args.onPopup)args.onPopup.call(this,args);this.applyHooks("onPopup",[args]);this.showAt(args.anchor,args.align||this._align,args.pos,args.shift,args.fluid);this._prevFocus=DlEvent.focusedWidget();this.focus();};P.popup=function(args){this.args=args;this.cancel();if(!args.timeout)_do_popup.call(this,args);else this._timer=_do_popup.$(this,args).delayed(args.timeout);};function _do_hide(){if(this.visible){if(this.args&&this.args.onHide)this.args.onHide.call(this,this.args);if(this._focusable&&this._prevFocus)try{this._prevFocus.focus();}catch(ex){}this.args=null;this._timer=null;this.callHooks("onHide");this.display(false);this.visible=false;}};P.hide=function(timeout){this.cancel();if(!timeout)_do_hide.call(this);else this._timer=_do_hide.$(this).delayed(timeout);};P.cancel=function(){if(this._timer){clearTimeout(this._timer);this._timer=null;}};P.correctPos=Dynarch.noop;P.showAt=function(anchor,align,mousePos,shift,fluid){var origpos,p,sa,div=this.getScrollDiv();if(!align)align=this._align;if(align=="mouse"){if(mousePos==null)mousePos=Dynarch.makeCopy(DlEvent.latestMouseEvent.pos);origpos=mousePos;if(this._mouseDiff){origpos.x+=this._mouseDiff.x;origpos.y+=this._mouseDiff.y;}align={prefer:"__",fallX1:"_R",fallX2:"_L",fallY1:"B_",fallY2:"T_"};}else{origpos=DOM.getPos(anchor);if(shift){if(shift.x)origpos.x+=shift.x;if(shift.y)origpos.y+=shift.y;}}sa=DOM.getOuterSize(anchor);p=Dynarch.makeCopy(origpos);this.visibility(false);div.style.height="";this._scroll_visibile(false);this.setPos(-30000,-30000);this.display(true);if(is_ie)this.getElement().style.width="";var r=this._bestPosition(align,p,sa),h=r.height();var sph=this.getScrollDiv().offsetHeight;var fuzz=this.getElement().offsetHeight-sph;p=r.getTL();if(h<sph){if(fluid){this.children(0).setSize({y:h});}else{if(is_ie)this.getElement().style.width=div.offsetWidth+"px";this._scroll_setup();var h1=this._scroll_el(0).offsetHeight,h2=this._scroll_el(1).offsetHeight;div.style.height=h-h1-h2-fuzz+"px";this._scrollSetArrowState();div.scrollTop=0;}}this.correctPos(p);this.setPos(p.x,p.y);if(this._parentPopup){var ZI=this._parentPopup.zIndex()+1;this.zIndex(ZI);}this.visibility(true);this.visible=true;};P._bestPosition=function(align,p,sa){var sp=DOM.getWindowSize(),r=new DlRect(0,0,sp.x,sp.y),p1=new DlPoint(p);sp=this.getSize();this._doAlign(align.prefer,p1,sa);var tmp=new DlRect(p1,sp).intersect(r);var cxp=this.checkXPos(p1,r);var cyp=this.checkYPos(p1,r);if(cxp==0&&cyp==0)return tmp;if(cxp!=0){p1.x=p.x;this._doAlign(align.fallX1,p1,sa);var rl=new DlRect(p1,sp).intersect(r);p1.x=p.x;this._doAlign(align.fallX2,p1,sa);var rr=new DlRect(p1,sp).intersect(r);if(rl&&rr){p1=rl.area()>rr.area()?rl.getTL():rr.getTL();}else if(rl){p1=rl.getTL();}else if(rr){p1=rr.getTL();}this.args.fallX=true;}if(cyp!=0){p1.y=p.y;this._doAlign(align.fallY1,p1,sa);var rt=new DlRect(p1,sp).intersect(r);p1.y=p.y;this._doAlign(align.fallY2,p1,sa);var rb=new DlRect(p1,sp).intersect(r);if(rt&&rb){p1=rt.area()>rb.area()?rt.getTL():rb.getTL();}else if(rt){p1=rt.getTL();}else if(rb){p1=rb.getTL();}this.args.fallY=true;}return new DlRect(p1,sp).intersect(r);};P._doAlign=function(align,p,sa){var sp=this.getSize(),valign=align.substr(0,1),halign="";if(align.length>1)halign=align.substr(1,1);switch(valign){case "T":p.y-=sp.y;if(this._mouseDiff&&this.args.align=="mouse")p.y-=2*this._mouseDiff.y;break;case "B":p.y+=sa.y;if(this._mouseDiff&&this.args.align=="mouse")p.y+=2*this._mouseDiff.y;break;case "C":case "c":p.y+=(sa.y-sp.y)/2;break;case "t":p.y+=sa.y-sp.y;break;case "b":break;}switch(halign){case "L":p.x-=sp.x;if(this._mouseDiff&&this.args.align=="mouse")p.x-=2*this._mouseDiff.x;break;case "R":p.x+=sa.x;if(this._mouseDiff&&this.args.align=="mouse")p.x+=2*this._mouseDiff.x;break;case "C":case "c":p.x+=(sa.x-sp.x)/2;break;case "l":p.x+=sa.x-sp.x;break;case "r":break;}};P.checkXPos=function(p,rect){if(p.x<rect.x)return p.x-rect.x;var s=this.getSize();var d=p.x+s.x-rect.x-rect.w;return d>0?d:0;};P.checkYPos=function(p,rect){if(p.y<rect.y)return p.y-rect.y;var s=this.getSize();var d=p.y+s.y-rect.y-rect.h;return d>0?d:0;};P.attachToPopup=function(popup){this._parentPopup=popup;popup._childPopup=this;};P.detachPopup=function(){if(this._parentPopup)this._parentPopup._childPopup=null;this._parentPopup=null;};P.getToplevelPopup=function(){var p=this;while(p._parentPopup)p=p._parentPopup;return p;};P._handle_focusKeys=function(ev){if(!ev.altKey&&!ev.ctrlKey){if(ev.keyCode==DlKeyboard.ESCAPE){this.hide();}else if(ev.keyCode==DlKeyboard.TAB){var w=ev.focusedWidget;w=ev.shiftKey?this.getPrevFocusWidget(w):this.getNextFocusWidget(w);if(w)w.focus();ev.domStop=true;DlException.stopEventBubbling();}}this._handleKeybinding(ev);};})();(function(){DlVbox.inherits(DlBox);function DlVbox(args){if(args)DlBox.call(this,args);};eval(Dynarch.EXPORT("DlVbox",true));P.createCellElement=function(){return CE("td",null,{className:"cell"},CE("tr",null,{className:"row"},this._tbody));};P._removeWidgetElement=function(w){if(this._widgets.contains(w)){var el=w.getElement();el.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode);}};})();function DlMenuBase(){if(this._isMenuBase)return;this._isMenuBase=true;this._items=[];var self=this;function onNamedItemSelect(name,item,args){var widget=args?args.widget:null;if(!this._noClose)DlPopupMenu.clearAll();self.applyHooks.delayed(1,self,"onSelect",[this.name,this,widget]);};var orig_appendWidget=this.appendWidget;this.appendWidget=function(w){if(w instanceof DlMenuItem){this._items.push(w);if(w.name!=null)w.addEventListener("onSelect",onNamedItemSelect);}orig_appendWidget.apply(this,Array.$(arguments));};this.getItemByName=function(name){return this._items.grep_first(function(item){return item.name&&item.name==name;});};this.getItemById=function(name){return this._items.grep_first(function(item){return item.__itemId&&item.__itemId==name;});};if(this instanceof DlHMenu){this._popupAlign={prefer:"Br",fallX1:"_r",fallX2:"_l",fallY1:"B_",fallY2:"T_"};}else{this._popupAlign={prefer:"bR",fallX1:"_R",fallX2:"_L",fallY1:"b_",fallY2:"t_"};}this._getDlPopup=function(){var p=this.getParent(DlPopupMenu),l=0,ret;if(p)l=p._level+1;ret=DlPopupMenu.get(l);ret.detachPopup();if(p){ret.attachToPopup(p);}return ret;};this.getToplevelMenu=function(){var m=this;while(m.parentMenu)m=m.parentMenu;return m;};};(function(){var BASE=DlPopupMenu.inherits(DlPopup);function DlPopupMenu(args){if(args){DlPopup.call(this,args);this._mouseDiff={x:2,y:1};}};eval(Dynarch.EXPORT("DlPopupMenu"));function onMouseEnter(){this.cancel();var args=this.args;};D.onBeforePopup=function(args){if(!args.isContext){args.item.currentPopup=this;args.item._popupVisible=true;args.menu._popupVisible=true;args.item.activateSubmenu(true);}else{if(args.widget.activateSubmenu)args.widget.activateSubmenu(true);}var content=args.content;if(content instanceof Function)args.content=content=content.call(this);content.parentMenu=args.isContext?args.widget:args.menu;if(content instanceof DlWidget&&content.hasHooks("onPopup"))content.applyHooks("onPopup",[args]);};D.onHide=function(args,callback){if(!args.isContext){args.item.activateSubmenu(false);args.item.currentPopup=null;args.item._popupVisible=false;args.menu._popupVisible=false;var content=args.content;if(content instanceof DlWidget&&content.hasHooks("onHide"))content.applyHooks("onHide",[args]);content.parentMenu=null;}else{if(args.widget.activateSubmenu)args.widget.activateSubmenu(false);}if(callback)callback.call(this,args);};P.popup=function(args){if(!args.onBeforePopup)args.onBeforePopup=D.onBeforePopup;if(!args.onHide)args.onHide=D.onHide;else args.onHide=D.onHide.$(this,args,args.onHide);BASE.popup.call(this,args);};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener({onMouseEnter:onMouseEnter});};P.correctPos=function(p){var args=this.args;try{if(!args.isContext&&!args.scrollVisible){var m1=args.menu;if(m1&&(m1 instanceof DlVMenu)){var diff=args.content._widgets[0].getPos().y-args.content.parent.getElement().offsetTop;if(Math.abs(diff)<50){if(args.fallY)p.y+=diff;else p.y-=diff;}}}}catch(ex){};};})();(function(){DlHMenu.inherits(DlHbox);function DlHMenu(args){if(args){DlHbox.call(this,args);DlMenuBase.call(this,args);}};eval(Dynarch.EXPORT("DlHMenu"));var DEFAULT_EVENTS=["onSelect","onPopup"];P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);D.BASE.initDOM.call(this);};})();(function(){DlVMenu.inherits(DlVbox);function DlVMenu(args){if(args){DlVbox.call(this,args);DlMenuBase.call(this,args);}};eval(Dynarch.EXPORT("DlVMenu"));var DEFAULT_EVENTS=["onSelect","onPopup"];P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);D.BASE.initDOM.call(this);};})();(function(){var BASE=DlMenuItem.inherits(DlContainer);function DlMenuItem(args){if(args){DlMenuItem.setDefaults(this,args);DlContainer.call(this,args);if(!this.parentMenu)this.parentMenu=this.parent;}};eval(Dynarch.EXPORT("DlMenuItem",true));var DEFAULT_EVENTS=["onSelect"];D.DEFAULT_ARGS={label:["label","DlMenuItem"],_iconClass:["iconClass",null],_noClose:["noClose",false],parentMenu:["menu",null],name:["name",null],__itemId:["id",null]};P._inBaseMenu=function(){return!this.parentMenu.parentMenu;};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);};P._createElement=function(){BASE._createElement.call(this);var el=this.getElement();el.innerHTML='<div class="div1"><div class="div2"></div></div>';this.setIconClass(this._iconClass);this._iconClass=null;this.setUnselectable();if(this.label)this.setContent(this.label);};P.getContentElement=function(){return this.getElement().firstChild.firstChild;};P._getDlPopup=function(){return this.parentMenu._getDlPopup();};function onMouseEnter(){this.scrollIntoView();this.addClass("DlMenuItem-hover","DlMenuItem-active");var base=this._inBaseMenu();if(!base||this.parentMenu._popupVisible){if(this._menu){this._popupMenu(base?0:250);}else if(base){this._getDlPopup().hide(100);}}};function onMouseLeave(){this.delClass("DlMenuItem-hover");this.delClass("DlMenuItem-active");var base=this._inBaseMenu();if(!base)this._getDlPopup().hide(100);};function onMouseUp(){this.delClass("DlMenuItem-active");if(this.hasHooks("onSelect")){var args=DlPopupMenu.get(0).args;if(!this._noClose)DlPopupMenu.clearAll();this.applyHooks.delayed(1,this,"onSelect",[this.name,this,args]);}};function onMouseDown(){this.addClass("DlMenuItem-active");this._popupMenu(0);DlException.stopEventBubbling();};function onDestroy(){if(this._menu instanceof DlWidget){this._menu.destroy();this._menu=null;}};P._popupMenu=function(timeout){if(this._menu&&!this._popupVisible){var pm=this.parentMenu;var p=this._getDlPopup();if(p.visible)p.hide();p.popup({timeout:timeout,content:this.getMenu(),anchor:this.getElement(),align:pm._popupAlign,item:this,menu:this.parentMenu,onPopup:this._onPopup,onHide:this._onHide});}};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener({onMouseEnter:onMouseEnter,onMouseLeave:onMouseLeave,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onDestroy:onDestroy});};P.getMenu=function(){return this._menu;};P.setMenu=function(menu,onPopup,onHide){if(this._menu instanceof DlWidget)this._menu.destroy();if(menu instanceof DlWidget)menu.ref();this._menu=menu;this._onPopup=onPopup;this._onHide=onHide;CC(this.getElement().firstChild,menu,"DlMenuItem-withPopup");};P.activateSubmenu=function(act){this.condClass(act,"DlMenuItem-popped");};})();(function(){var BASE=DlButtonMenu.inherits(DlHbox);function DlButtonMenu(args){if(args){D.setDefaults(this,args);DlMenuBase.call(this,args);DlHbox.call(this,args);}};eval(Dynarch.EXPORT("DlButtonMenu"));var DEFAULT_EVENTS=["onSelect","onPopup","onHide","onClick"];D.DEFAULT_ARGS={label:["label",null],_iconClass:["iconClass",null],_shiftMenu:["shiftMenu",null],_connected:["connected",false]};P.ALIGN={prefer:"Br",fallX1:"_r",fallX2:"_l",fallY1:"B_",fallY2:"T_"};P.activateSubmenu=function(activate){this._mainBtn.condClass(activate,"DlButton-1");this._menuBtn.condClass(activate,"DlButton-1");};P._createElement=function(){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";if(this._connected)this._mainBtn.connectEvents("onMouseDown",this._menuBtn);this._mainBtn.connectEvents(["onMouseEnter","onMouseLeave"],this._menuBtn);};function popupMenu(ev){if(!this._popupVisible){var p=this._getContextMenuPopup();p.popup({timeout:0,content:this.getMenu(),align:this.ALIGN,anchor:this.getTableElement(),isContext:true,widget:this,shift:this._shiftMenu,onHide:this.callHooks.$(this,"onHide")});ev._justFocusedWidget=p;this.callHooks("onPopup");}};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);this._menuBtn.addEventListener("onMouseDown",popupMenu.$(this));this.addEventListener("onDestroy",function(){if(this._menu instanceof DlWidget)this._menu.destroy();});};P.getMenu=function(){return this._menu;};P.getButton=function(){return this._mainBtn;};P.getArrow=function(){return this._menuBtn;};P.setMenu=function(menu){if(this._menu instanceof DlWidget)this._menu.destroy();if(menu instanceof DlWidget)menu.ref();this._menu=menu;};})();var DlElementCache={get:function(tag){return this[tag].cloneNode(true);}};(function(){eval(DynarchDomUtils.importCommonVars());var C=DlElementCache;(function(){var TBODY_RC=document.createDocumentFragment();CE("td",null,null,CE("tr",null,null,CE("tbody",null,null,TBODY_RC)));C.TBODY_RC=TBODY_RC;})();(function(){var SHADOWS=document.createDocumentFragment();CE("div",null,{className:"Shadow Shadow-TL"},SHADOWS);CE("div",null,{className:"Shadow Shadow-T"},SHADOWS);CE("div",null,{className:"Shadow Shadow-TR"},SHADOWS);CE("div",null,{className:"Shadow Shadow-L"},SHADOWS);CE("div",null,{className:"Shadow Shadow-R"},SHADOWS);CE("div",null,{className:"Shadow Shadow-BL"},SHADOWS);CE("div",null,{className:"Shadow Shadow-B"},SHADOWS);CE("div",null,{className:"Shadow Shadow-BR"},SHADOWS);C.SHADOWS=SHADOWS;})();(function(){var STATIC_ROW=CE("tr");var STATIC_CELL=CE("td",null,null,STATIC_ROW);(6).times(function(){STATIC_ROW.appendChild(STATIC_CELL.cloneNode(true));});C.CAL_HEAD=CE("thead");C.CAL_HEAD.appendChild(STATIC_ROW.cloneNode(true));var STATIC_BODY=C.CAL_BODY=CE("tbody");(6).times(function(){STATIC_BODY.appendChild(STATIC_ROW.cloneNode(true));});})();C.DRAGGING_LINE=CE("div",null,{className:"DlResizeBar-DraggingLine"});DlEvent.atUnload(function(){var trash=DynarchDomUtils.trash();for(var i in C){var el=C[i];if(!(el instanceof Function)){trash.appendChild(C[i]);delete C[i];el=C[i]=null;}}C=DynarchDomUtils.CE_CACHE;for(var i in C){var el=C[i];if(el!==trash){trash.appendChild(C[i]);delete C[i];el=C[i]=null;}}trash.innerHTML="";if(is_ie)trash.outerHTML="";delete DynarchDomUtils.CE_CACHE["_trash"];DynarchDomUtils.CE_CACHE._trash=null;C=null;});})();(function(){var BASE=DlCalendar.inherits(DlWidget);function DlCalendar(args){if(args){args.tagName="table";D.setDefaults(this,args);this._dayNamesOn=-1;this._selectedDate=(this.date&&this.selected)?this.date.getDate():0;DlWidget.call(this,args);if(!this._noinit)this.init();}};eval(Dynarch.EXPORT("DlCalendar",true));var DEFAULT_EVENTS=["onSelect","onChange","onRendered"];D.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",getTooltip]};P._createElement=function(){BASE._createElement.call(this);var trs,i,tr,td,table=this.getElement(),tbody=DlElementCache.get("CAL_BODY");table.cellSpacing=table.cellPadding=table.border=0;table.appendChild(DlElementCache.get("CAL_HEAD"));table.appendChild(tbody);if(this._weekNumbers){trs=table.getElementsByTagName("tr");for(i=trs.length;--i>=0;){tr=trs[i];td=CE("td",null,{className:"DlCalendar-WeekNumber"});tr.insertBefore(td,tr.firstChild);}}tr=CE("tr");td=CE("td",null,null,tr);tr.className="DlCalendar-Navigation";if(this._navigation==0){td.colSpan=this.getNCols();this._makeNavPart(td,0);}else{var td1=CE("td",null,null,tr);var td2=CE("td",null,null,tr);if(this._navigation==1){td1.colSpan=this.getNCols()-2;this._makeNavPart(td1,0,td,-1,td2,1);}else if(this._navigation==2){var td3=CE("td",null,null,tr);var td4=CE("td",null,null,tr);td2.colSpan=this.getNCols()-4;this._makeNavPart(td2,0,td,-2,td1,-1,td3,1,td4,2);}}i=table.rows[0];i.parentNode.insertBefore(tr,i);this.setUnselectable();if(this._withMenu)this._createQuickNavMenu();};var MENU=null;function getMenu(){if(!MENU){MENU=new DlVMenu({});MENU.setStyle("textAlign","center");new DlMenuItem({parent:MENU,label:DlTEXTS.goToday,name:"today",noClose:true});MENU.addSeparator();var year=new DlSpinner({parent:MENU,size:4});year.addEventListener("onChange",function(){if(!year.validationError)MENU.calendar.setYear(year.getValue());});year.getElement().align="center";MENU.addSeparator();(12).times(function(i){new DlMenuItem({parent:MENU,label:Date.getMonthName(i),name:i,noClose:true});});MENU.addEventListener("onPopup",function(args){this.calendar=args.widget;year.setValue(this.calendar.date.getFullYear());year.focus.$(year).delayed(5);});MENU.addEventListener("onSelect",function(mon){if(mon=="today"){this.calendar.setToday();}else{this.calendar.setMonth(mon);this.calendar.setYear(year.getValue());}MENU.getParent(DlPopup).hide();});}return MENU;};P._createQuickNavMenu=function(){this.setContextMenu(getMenu);};P._makeNavPart=function(){var td,type,i;for(var i=0;i<arguments.length;++i){td=arguments[i++];type=arguments[i];td._navType=type;switch(type){case-2:td.className="PrevYear";break;case-1:td.className="PrevMonth";break;case 0:td.className="Month";this.refNode("_monthTD",td);break;case 1:td.className="NextMonth";break;case 2:td.className="NextYear";break;}}};P.getNCols=function(){return this._weekNumbers?8:7;};P.getTableElement=function(){return this.getElement();};P._displayDayNames=function(){var td,today=new Date(),todayWD=today.getDay(),dnrow=this.getTableElement().getElementsByTagName("tr")[1],i=this._weekNumbers?1:0,j=this.firstDay;dnrow.className="DlCalendar-DayNames";while(td=dnrow.cells[i++]){td._firstDay=j%7;CC(td,j==todayWD,"Today");td.innerHTML=Date.getDayName(j++,true);CC(td,Date.isWeekend(td._firstDay),"WeekEnd");}this._dayNamesOn=this.firstDay;if(this._weekNumbers){td=dnrow.cells[0];td.innerHTML="w";td._week=-1;td.className="WeekNumber";}};P._displayCalendar=function(){var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this._selectedTD=null;if(this._dayNamesOn!=this.firstDay)this._displayDayNames();var date=new Date(this.date);date.setHours(12);var month=date.getMonth();var mday=date.getDate();var year=date.getFullYear();var no_days=date.getMonthDays();this._monthTD.innerHTML=String.buffer("<b>",Date.getMonthName(month,this._navigation==2),"</b> ",year).get();date.setDate(1);var day1=(date.getDay()-this.firstDay)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.getTableElement().rows[2];var cells=this._cells=[];var di=this._displayedInterval={};var tmp;for(var i=0;i<6;++i,row=row.nextSibling){row.className="Dates";var cell=row.firstChild;if(this._weekNumbers){cell.className="WeekNumber";cell.innerHTML=cell._week=date.getWeekNumber();cell=cell.nextSibling;}var iday;for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){var wday=date.getDay();var cn=[];cell._iday=iday=date.getDate();cell._month=date.getMonth();cell._year=date.getFullYear();cell._info=null;tmp={y:cell._year,m:cell._month,d:cell._iday};if(this._infoDates){var str=tmp.y+"-"+(1+tmp.m).zeroPad(2)+"-"+tmp.d.zeroPad(2);var id=this._infoDates[str];if(id){cell._info=id;cn.push(id.className||"DlCalendar-infoDay");}}if(!di.start)di.start=tmp;if(cell._otherMonth=month!=tmp.m){cn.push("OtherMonth");cells[iday+(iday>15?100:200)]=cell;}else{if(month==TM&&iday==TD&&TY==tmp.y)cn.push("Today");if(this._selectedDate==iday)this._selectCell(cell);cells[iday]=cell;}if(wday==0||wday==6)cn.push("WeekEnd");cell.disabled=this._disableHandler(date,cn,cell);cell.innerHTML=this.getDayHTML(iday);cell.className=cn.join(" ");}}di.end=tmp;this.applyHooks("onRendered",[this]);};P.getDayHTML=Function.identity;P.getDateCell=function(date){return this._cells[date];};P.getDisplayedInterval=function(){return this._displayedInterval;};P.selectDate=function(date,nohooks){if(date instanceof Date){if(!date.dateEqualsTo(this.date,true)){this.date=new Date(date);this.init();}date=date.getDate();}this._selectCell(this.getDateCell(date),!nohooks);};function onMouseOver(ev){this._clearTimer();var cell=ev.getParentElement("td",this);if(cell){if(this._currentHover){DC(this._currentHover,"hover");DC(this._currentHover,"rolling");this._currentHover=null;DlWidget.getTooltip().hide();}if(cell._navType!=null&&this._navDisabled)return;if(cell._otherMonth&&this._omDisabled)return;if((cell._firstDay!=null&&this.fixedFirstDay)||cell._week!=null)return;if(cell.disabled)return;AC(cell,"hover");this._currentHover=cell;if(this.__tooltip)this._popupTooltip();}};function onMouseLeave(ev){this._clearTimer();if(this._currentHover){DC(this._currentHover,"hover");DC(this._currentHover,"rolling");this._currentHover=null;}};P.setYear=function(y){if(y!=this.date.getFullYear()){this.date.setFullYear(y);this.init();}};P.setMonth=function(m){if(m!=this.date.getMonth()){this.date.setMonth(m);this.init();}};P.setToday=function(){var today=new Date();this._selectedDate=0;this.date=today;this.init();};P._navCellClicked=function(cell,timeout,ev){AC(cell,"rolling");this._selectedDate=0;var d=this.date;if(cell._navType!=0)d.setDate(1);switch(cell._navType){case 0:if(this._withMenu){this.applyHooks("onContextMenu",[ev]);}else{var today=new Date();if(d.dateEqualsTo(today,true))return;this.date=today;}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);break;}this.init();this.applyHooks("onChange",[cell._navType]);this.applyHooks("onSelect",[true,cell._navType,null,d]);if(timeout&&cell._navType!=0){++this._timerStep;this._timer=setTimeout(this._navCellClicked.$(this,cell,this._timerStep>4?50:100),timeout);}};P._clearTimer=function(){if(this._timer)clearTimeout(this._timer);this._timer=null;this._timerStep=0;};function onClick(ev){onMouseOver.call(this,ev);var cell=ev.getParentElement("td",this);if(!cell)return;if(ev.button!=0&&(cell._navType!=null||cell._otherMonth))return;if(cell._otherMonth&&this._omDisabled||cell.disabled)return;if(cell._navType!=null&&ev.dl_type=="onMouseDown"){this._navDisabled||this._navCellClicked(cell,cell._navType!=0?350:0,ev);}else if(cell._year!=null&&ev.dl_type=="onMouseUp"){var d=this.date;d.setDate(1);d.setMonth(cell._month);d.setFullYear(cell._year);d.setDate(cell._iday);var old_date=this._selectedDate;this._selectedDate=cell._iday;if(cell._otherMonth){this.init();this.applyHooks("onSelect",[false,true,false,d]);}else if(old_date!=this._selectedDate){this._selectCell(cell,true);}else{this.applyHooks("onSelect",[false,false,true,d]);}}else if(cell._firstDay!=null&&!this.fixedFirstDay&&ev.button==0&&ev.dl_type=="onMouseDown"){this.firstDay=cell._firstDay;this._displayCalendar();}};P._selectCell=function(cell,hooks){this._selectedDate=cell._iday;if(this._selectedTD){DC(this._selectedTD,"Selected");DC(this._selectedTD.parentNode,"Selected");}this._selectedTD=cell;AC(cell,"Selected");AC(cell.parentNode,"Selected");DC(cell,"hover");if(hooks)this.applyHooks("onSelect",[false,false,false,this.date]);};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener({onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseUp:onClick,onMouseDown:onClick});};P.initDOM=function(){BASE.initDOM.call(this);this.registerEvents(DEFAULT_EVENTS);};P.setInfoDates=function(a){this._infoDates=a;if(this._initialized)this._displayCalendar();};function getTooltip(){var cal=this.args.widget,di,td;td=cal._currentHover;if(td)di=td._info;td=cal._cal_tooltip;return td?td.call(cal,di):di?di.tooltip:null;};P.init=function(){if(!this.date)this.date=new Date();this._displayCalendar();this._initialized=true;};})();(function(){var BASE=DlButtonCalendar.inherits(DlButtonMenu);function DlButtonCalendar(args){if(args){D.setDefaults(this,args);DlButtonMenu.call(this,args);}};eval(Dynarch.EXPORT("DlButtonCalendar"));D.DEFAULT_ARGS={dateFormat:["dateFormat","%Y/%m/%d"],_calendarArgs:["calendar",{}],_iconClass:["iconClass","IconCalendar"],date:["date","Select date..."]};var DEFAULT_EVENTS=["onSelect","onCalendarRendered"];function calendar_onSelect(cal,cleared,otherMonth){if(!cleared){this.getButton().setContent(cal.date.print(this.dateFormat));DlPopup.clearAllPopups();this.date=new Date(cal.date);this.applyHooks("onSelect",[this.date]);}};function button_onClick(ev){if(this.date instanceof Date){var cal=this.getCalendar();if(!cal.date.dateEqualsTo(this.date)){cal.date=new Date(this.date);cal._selectedDate=this.date.getDate();cal.init();}}this.getArrow().applyHooks("onMouseDown",[ev]);};P.getCalendar=function(){var cal=this._calendar;if(!cal){this._calendarArgs.noinit=true;cal=this._calendar=new DlCalendar(this._calendarArgs);this.addEventListener("onDestroy",cal.destroy.$(cal));cal.addEventListener("onSelect",calendar_onSelect.$(this,cal));cal.connectEvents("onRendered",this,"onCalendarRendered");if(this.date instanceof Date)cal.date=new Date(this.date);cal.init();}return this._calendar;};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);var b=this.getButton();if(this.date instanceof Date)b.setContent(this.date.print(this.dateFormat));else b.setContent(this.date);this.setMenu(this.getCalendar.$(this));b.addEventListener("onClick",button_onClick.$(this));};P.getValue=function(){return this.date instanceof Date?this.date:null;};})();(function(){var BASE=DlButtonColorPicker.inherits(DlButtonMenu);function DlButtonColorPicker(args){if(args){D.setDefaults(this,args);DlButtonMenu.call(this,args);this._events_cp={onSelect:onSelect.$(null,this),onHueChange:onHueChange.$(null,this),onHover:onHover.$(null,this),onHoverOut:onLeave.$(null,this)};this._updateValues();}};eval(Dynarch.EXPORT("DlButtonColorPicker",true));D.DEFAULT_ARGS={rgb:["rgb",null],hsv:["hsv",null],color:["color",null]};function onSelect(btn,rgb,hsv,color,brightness){var div=btn.getColorElement();div.style.backgroundColor=color;btn.hsv=Dynarch.makeArray(hsv);btn._updateValues();DlPopup.clearAllPopups();btn.applyHooks("onSelect",[rgb,hsv,color,brightness]);};function onHover(btn,rgb,hsv,color,brightness){btn.getColorElement().style.backgroundColor=color;};function onHueChange(btn,hue){if(btn.hsv){var hsv=[hue,btn.hsv[1],btn.hsv[2]];var color=DlColor.RGB2color(DlColor.HSV2RGB(hsv));btn.getColorElement().style.backgroundColor=color;btn.hsv=hsv;btn._updateValues();}};function onLeave(btn){var div=btn.getColorElement();div.style.backgroundColor=btn.rgb?DlColor.RGB2color(btn.rgb):"";};P._updateValues=function(){if(this.hsv){this.rgb=DlColor.HSV2RGB(this.hsv);this.color=DlColor.RGB2color(this.rgb);}else if(this.rgb){this.hsv=DlColor.RGB2HSV(this.rgb);this.color=DlColor.RGB2color(this.rgb);}else if(this.color){this.rgb=DlColor.color2RGB(this.color);this.hsv=DlColor.RGB2HSV(this.rgb);}};function _popupCP(){this._cp.addEventListener(this._events_cp);if(this.hsv)this._cp.setHSV(this.hsv);};function _hideCP(){this._cp.removeEventListener(this._events_cp);};P.setColorPicker=function(cp){this._cp=cp;this.setMenu(cp);if(this.hsv){cp.setHSV(this.hsv);onSelect.call(cp,this,this.rgb,this.hsv,DlColor.RGB2color(this.rgb),DlColor.RGBrightness(this.rgb));}};P._createElement=function(){BASE._createElement.call(this);var el=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);};P.setLabel=function(label){var div=this.getLabelElement();div.innerHTML=label||"";CC(div,label,"Label","EmptyLabel");};P.getColorElement=function(){return this.getButton().getContentElement().firstChild.rows[0].cells[0].firstChild;};P.getLabelElement=function(){return this.getButton().getContentElement().firstChild.rows[0].cells[1];};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener({onPopup:_popupCP,onHide:_hideCP});};})();DlCheckbox.inherits(DlAbstractButton);function DlCheckbox(args){if(args){args.type=DlButton.TYPE.TWOSTATE;DlCheckbox.setDefaults(this,args);DlAbstractButton.call(this,args);}};DlCheckbox.DEFAULT_ARGS={_classes:["classes",{active:"DlCheckbox-active",hover:"DlCheckbox-hover",checked:"DlCheckbox-1",unchecked:"DlCheckbox-0",empty:"DlCheckbox-empty",disabled:"DlCheckbox-disabled"}]};var DlColor={RGB2HSV:function(rgb){var r=rgb[0],g=rgb[1],b=rgb[2];var min,max,delta,h,s,v;min=Math.min(r,g,b);max=Math.max(r,g,b);v=max;delta=max-min;if(max!=0){s=delta/max;if(r==max)h=(g-b)/delta;else if(g==max)h=2+(b-r)/delta;else h=4+(r-g)/delta;h*=60;if(h<0)h+=360;}else{s=0;h=-1;}return[h,s,v];},HSV2RGB:function(hsv){var h=hsv[0],s=hsv[1],v=hsv[2];var i,r,g,b,f,p,q,t;if(s==0)r=g=b=v;else{h/=60;i=Math.floor(h);f=h-i;p=v*(1-s);q=v*(1-s*f);t=v*(1-s*(1-f));switch(i){case 0:r=v;g=t;b=p;break;case 1:r=q;g=v;b=p;break;case 2:r=p;g=v;b=t;break;case 3:r=p;g=q;b=v;break;case 4:r=t;g=p;b=v;break;default:r=v;g=p;b=q;break;}}return[r,g,b];},RGB2bytes:function(rgb){var b=new Array(3);b[0]=Math.round(rgb[0]*255);b[1]=Math.round(rgb[1]*255);b[2]=Math.round(rgb[2]*255);return b;},RGB2color:function(rgb){return String.buffer("rgb(",rgb[0]*100,"%,",rgb[1]*100,"%,",rgb[2]*100,"%)").get();},RGB2hex:function(rgb){rgb=DlColor.RGB2bytes(rgb);return rgb[0].hex(2)+rgb[1].hex(2)+rgb[2].hex(2);},color2RGB:function(color){var r=0,g=0,b=0;if(/^#/.test(color)){if(color.length==4)color=color.replace(/([a-f0-9])/ig,"$1$1");r=parseInt(color.substr(1,2),16)/255;g=parseInt(color.substr(3,2),16)/255;b=parseInt(color.substr(5,2),16)/255;}else throw new DlException("Can't parse color: "+color);return[r,g,b];},brighter:function(hsv){var a=Array.$(hsv);a[1]-=0.5;if(a[1]<0)a[1]=0;return a;},darker:function(hsv){var a=Array.$(hsv);a[2]-=0.5;if(a[2]<0)a[2]=0;return a;},RGBrightness:function(rgb){return(rgb[0]*299+rgb[1]*587+rgb[2]*114)/1000;}};(function(){var BASE=DlColorPickerHSV.inherits(DlWidget);function DlColorPickerHSV(args){if(args)DlWidget.call(this,args);};eval(Dynarch.EXPORT("DlColorPickerHSV",true));var DEFAULT_EVENTS=["onSelect","onHover","onHoverOut","onHueChange"];var HTML=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();P.getHueBarElement=function(){return this.getElement().rows[0].cells[12].firstChild;};P._createElement=function(){BASE._createElement.call(this,HTML);this.setUnselectable();};function getTD(ev){var el=ev.target;try{while(el&&el.tagName.toLowerCase()!="td")el=el.parentNode;}catch(ex){el=null;}return el;};function onMouseUp(ev){var td=getTD(ev);if(!td)return;if(td.rgb){this.applyHooks("onSelect",[td.rgb,td.hsv,td.style.backgroundColor,DlColor.RGBrightness(td.rgb)]);}throw new DlExStopEventBubbling;};function onMouseDown(ev){var td=getTD(ev);if(!td)return;var isHue=td.getAttribute("hueCell");if(isHue){ev.computePos(this);this._refresh(ev);DlEvent.captureGlobals(this._dragHandlers);}throw new DlExStopEventBubbling;};function onMouseOver(ev){if(this._currentHover){DC(this._currentHover,"hover1");DC(this._currentHover,"hover2");}var td=getTD(ev);if(td){if(td.rgb){this._currentHover=td;var br=DlColor.RGBrightness(td.rgb);CC(td,br>0.6,"hover2","hover1");this.applyHooks("onHover",[td.rgb,td.hsv,td.style.backgroundColor,br]);}else if(this._currentHover){this.callHooks("onHoverOut");this._currentHover=null;}}};function onMouseLeave(){var el=this._currentHover;if(el){DC(el,"hover1");DC(el,"hover2");this.callHooks("onHoverOut");}this._currentHover=null;};function stopDrag(ev){DlEvent.releaseGlobals(this._dragHandlers);throw new DlExStopEventBubbling;};function doDrag(ev){var pos=ev.computePos(this);var y=pos.y-2;if(y<0)y=0;else if(y>119)y=119;this.getHueBarElement().style.top=y+"px";if(this.__cphsvTimeout)clearTimeout(this.__cphsvTimeout);this.__cphsvTimeout=this._refresh.$(this,ev).delayed(5);throw new DlExStopEventBubbling;};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);this.addEventListener({onMouseUp:onMouseUp,onMouseDown:onMouseDown,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave});this._dragHandlers={onMouseMove:doDrag.$(this),onMouseUp:stopDrag.$(this),onMouseOver:DlException.stopEventBubbling,onMouseOut:DlException.stopEventBubbling,onMouseEnter:DlException.stopEventBubbling,onMouseLeave:DlException.stopEventBubbling};this._redraw(360);};P._refresh=function(ev){var y=Math.limit(ev.relPos.y-2,0,119);var hue=Math.round((1-y/120)*360);hue=this._redraw(hue);this.applyHooks("onHueChange",[hue]);this.__cphsvTimeout=null;};P.setHSV=function(hsv){this._redraw(hsv[0]);};P._redraw=function(hue){var i,c,j,cells,div=this.getHueBarElement(),table=this.getElement(),rows=table.rows,di=rows.length-1,dj=rows[0].cells.length-3;div.style.top=(120-hue/3)+"px";if(hue==360)hue=0;for(i=di;i>=0;--i){cells=rows[i].cells;for(j=dj;j>=0;--j){c=cells[j];c.hsv=[hue,1-i/di,j/dj];c.rgb=DlColor.HSV2RGB(c.hsv);c.style.backgroundColor=DlColor.RGB2color(c.rgb);}}return hue;};})();(function(){var BASE=DlEntry.inherits(DlContainer);function DlEntry(args){if(args){args.tagName="table";D.setDefaults(this,args);this._isTextArea=args.type=="textarea";DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlEntry",true));var DEFAULT_EVENTS=["onChange","onKey-ENTER","onKey-ESCAPE","onValidationError","onValidation"];D.DEFAULT_ARGS={_domType:["type","text"],_value:["value",null],_size:["size",null],_rows:["rows",null],_readonly:["readonly",false],_emptyText:["emptyText",""],_width:["width",null],_name:["name",null],_validators:["validators",[]],_allowEmpty:["allowEmpty",null],_focusable:["focusable",2],_maxlen:["maxlength",null],_noSelect:["noSelect",false],_noWrap:["noWrap",false]};P.validate=function(val){if(val==null)val=this.getValue();if(this._allowEmpty!=null){if(!/\S/.test(val)){this.condClass(!this._allowEmpty,"DlEntry-ValidationError");this.applyHooks("onValidation",[!this._allowEmpty]);return this._allowEmpty;}}var a=this._validators,i,v,err=false;for(i=0;i<a.length;++i){v=a[i];if(!v.ok(val)){err=v.getError()||true;break;}}if(v&&!err)this.setValue(v.getLastVal(),true);this.validationError=err;if(!this._noSelect&&this._focused&&!this.readonly()&&this._domType!="textarea")this.select();this.condClass(err,"DlEntry-ValidationError");this.applyHooks("onValidation",[err]);if(err)this.applyHooks("onValidationError",[err]);return!err;};P.timerFocus=function(timeout){return this.focus.clearingTimeout(timeout||10,this);};P.select=function(){try{if(is_gecko)this.setSelectionRange(0,this.getValue().length);else this.getInputElement().select();}catch(ex){}};P.focus=function(){this.getInputElement().focus();if(!this._noSelect&&!this.readonly()&&this._domType!="textarea")this.select();};P.blur=function(){this.getInputElement().blur();};function element_focus(){this.addClass("DlEntry-Focus");this._focused=true;BASE.focus.call(this);if(this._isEmpty){this.getInputElement().value="";this.delClass("DlEntry-empty");this._isEmpty=false;}};function element_blur(){this.delClass("DlEntry-Focus");this._focused=false;BASE.blur.call(this);this.__setEmpty();};function element_change(){this.__setEmpty();this.callHooks("onChange");};P.__setEmpty=function(value){if(value==null)value=this.getInputElement().value;this._isEmpty=this.__checkEmpty(value);if(!this._isEmpty){this.delClass("DlEntry-empty");}else if(!this._focused){this.addClass("DlEntry-empty");this.getInputElement().value="";(function(){if(!this.destroyed&&!this._focused&&this.__checkEmpty())this.getInputElement().value=this._emptyText;}).delayed(0,this);}else{this.getInputElement().value=value;}return this._isEmpty;};P.__checkEmpty=function(value){if(value==null)value=this.getInputElement().value;return value==="";};P._createElement=function(){BASE._createElement.apply(this,arguments);var el=this.getElement();el.appendChild(DlElementCache.get("TBODY_RC"));el.cellSpacing=el.cellPadding=el.border=0;el=el.rows[0].cells[0];el.className="DlEntry-cell";var input=this._isTextArea?document.createElement("textarea"):input=document.createElement("input");input.setAttribute("autocomplete","off",1);if(this._noWrap)input.setAttribute("wrap","off");if(this._isTextArea){if(this._rows)input.rows=this._rows;}if(this._maxlen!=null)input.setAttribute("maxlength",this._maxlen);switch(this._domType){case "password":case "file":case "hidden":input.type=this._domType;}if(is_gecko&&gecko_version<1.9&&!this._no_gecko_bug)el=CE("div",null,{className:"Gecko-Bug-226933"},el);el.appendChild(input);};P.getInputElement=function(){return this.getElement().getElementsByTagName(this._isTextArea?"textarea":"input")[0];};P.getContentElement=P.getInputElement;P.setIfEmpty=function(value,nocall){if(this._isEmpty&&value)this.setValue(value,nocall);};P.isEmpty=function(){return this.__checkEmpty();};P.setValue=function(value,nocall){if(!this.__setEmpty(value)){if(this._maxlen!=null)value=String(value).substr(0,this._maxlen);this.getInputElement().value=value;}if(!nocall)this.callHooks("onChange");};P.clear=function(nocall){this.setValue("",nocall);return this;};P.getValue=function(){return this._isEmpty?"":this.getInputElement().value;};P.getSelectionRange=function(){return DOM.getSelectionRange(this.getInputElement());};P.setSelectionRange=function(start,end){DOM.setSelectionRange(this.getInputElement(),start,end);};P.moveEOF=function(){var l=this.getValue().length;this.setSelectionRange(l,l);};P.moveBOF=function(){this.setSelectionRange(0,0);};P.collapse=function(atStart){var p=this.getSelectionRange();p=atStart?p.start:p.end;this.setSelectionRange(p,p);};function onChange(){this.validate();};function onKeyPress(ev){this._isEmpty=false;if(ev.keyCode==DlKeyboard.ENTER){this.applyHooks("onKey-ENTER",[ev]);}else if(ev.keyCode==DlKeyboard.ESCAPE){this.applyHooks("onKey-ESCAPE",[ev]);}};function onDestroy(){DOM.removeEvent(this.getInputElement(),{focus:this._on_element_focus,blur:this._on_element_blur,change:this._on_element_change});};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);var input=this.getInputElement();DOM.addEvent(input,{focus:this._on_element_focus=element_focus.$(this),blur:this._on_element_blur=element_blur.$(this),change:this._on_element_change=element_change.$(this)});this.addEventListener({onChange:onChange,onKeyPress:onKeyPress,onDestroy:onDestroy});if(this._value!=null)this.setValue(this._value,true);else this.clear(true);if(this._width!=null)input.style.width=this._width;else if(this._size!=null)this.setSize({x:this._size*9+7-this._size});if(this._name!=null)input.name=this._name;this.readonly(this._readonly);};P.readonly=function(readonly){var input=this.getInputElement();if(readonly!=null){input.readOnly=readonly;readonly?input.setAttribute("readonly",true,1):input.removeAttribute("readonly");this.condClass(readonly,"DlEntry-Readonly");}return input.getAttribute("readonly");};P.disabled=function(v,force){var isDisabled=BASE.disabled.call(this,v,force);if(v!=null)this.getInputElement().disabled=!!v;return isDisabled;};P.setSize=P.setOuterSize=function(size){var input=this.getInputElement(),x=size.x,y=size.y,pb=DOM.getPaddingAndBorder(input);if(x!=null)x-=pb.x+4;if(y!=null)y-=pb.y+4;if(this._domType!="textarea")y=null;DOM.setInnerSize(input,x,y);if(x!=null){x+=8;DOM.setInnerSize(this.getElement(),x);}};})();(function(){DlCompletionPopup.inherits(DlPopup);function DlCompletionPopup(args){if(args){args.zIndex=1000;args.focusable=false;DlPopup.call(this,args);}};var BASE=DlCompletionEntry.inherits(DlEntry);function DlCompletionEntry(args){if(args){DlCompletionEntry.setDefaults(this,args);DlEntry.call(this,args);}};eval(Dynarch.EXPORT("DlCompletionEntry",true));var DEFAULT_EVENTS=["onCompletion","onSelect"];D.DEFAULT_ARGS={__timeout:["timeout",500],_shiftMenu:["shift",null],__smart:["smart",true],__noTab:["noTab",false],_noSelect:["noSelect",true],_sizeToFit:["sizeToFit",false],_electric:["electric",true]};P.ALIGN={prefer:"Br",fallX1:"_r",fallX2:"_L",fallY1:"B_",fallY2:"T_"};P._setListeners=function(){this.__on_itemHover=on_itemHover.$(null,this);this.__on_itemSelect=on_itemSelect.$(null,this);BASE._setListeners.call(this);this.registerEvents(DEFAULT_EVENTS);this.addEventListener({onKeyDown:onKeyDown,onBlur:onBlur,onDestroy:this.__clearTimer});};P._hideMenu=function(){_getPopup().hide(50);this.__clearTimer();};P.__clearTimer=function(){if(this.__timer)clearTimeout(this.__timer);this.__timer=null;};var POPUP=null;function _getPopup(){if(!POPUP){POPUP=DlCompletionPopup.get();}return POPUP;};var MENU=null;var ITEM=null;function _getMenu(){if(MENU){ITEM=null;MENU.destroy();}return MENU=new DlVMenu({});};function _menuVisible(){return MENU&&MENU.parent.visible;};function on_itemHover(obj,ev){var newitem=MENU.children().find(this);if(newitem!=ITEM&&ITEM!=null)MENU.children(ITEM).callHooks("onMouseLeave");ITEM=newitem;if(obj._electric||!ev)obj._applyCompletion(this.userData);};function on_itemSelect(obj){obj._hideMenu();obj._applyCompletion(this.userData,true);obj.applyHooks("onSelect",[this.userData]);obj.focus.delayed(0,obj);};P._applyCompletion=function(c,finish){if(!c.nomodify||finish){var r=this.getSelectionRange();var str=c.completion||c.label;if(finish&&c.after)str+=c.after;var val=this.getValue();var start=c.start!=null?c.start:r.start;val=val.substr(0,start)+str+val.substr(r.end);this.setValue(val);r.end=start+str.length;if(c.rstart!=null)r.start=c.rstart;if(c.noselect||finish)r.start=r.end;this.setSelectionRange(r);}};P._on_menuHide=function(){if(MENU){MENU.destroy();MENU=null;ITEM=null;}};P.completionReady=function(data){if(this.__timer||this.__forced){if(data!=null&&data.length>0){if(this.__smart&&data.length==1){this._applyCompletion(data[0],true);this.applyHooks("onSelect",[data[0]]);}else{var mnu=_getMenu();var sel_item=null;data.foreach(function(c){var w=new DlMenuItem({parent:mnu,label:c.label,data:c});w.addEventListener({onSelect:this.__on_itemSelect,onMouseEnter:this.__on_itemHover});if(c.selected)sel_item=w;},this);_getPopup().popup({timeout:0,content:mnu,align:this.ALIGN,anchor:this.getElement(),isContext:true,widget:this,onHide:this._on_menuHide.$(this),shift:this._shiftMenu});if(this._sizeToFit){var w=this.getSize().x;if(mnu.getSize().x<w)mnu.setSize({x:w-DOM.getPaddingAndBorder(_getPopup().getElement()).x});}if(sel_item)sel_item.callHooks("onMouseEnter");}}}this.cancelCompletion();};P.cancelCompletion=function(){this.delClass("DlCompletionEntry-busy");this.__clearTimer();this.__forced=null;};function __triggerCompletion(ev,forced){this.__origData={value:this.getValue(),range:this.getSelectionRange()};this.__forced=forced;this.addClass("DlCompletionEntry-busy");this.applyHooks("onCompletion",[this.getSelectionRange(),ev,forced]);};function handleMenuKey(ev){if(!_menuVisible())return false;var old_item=ITEM,w;switch(ev.keyCode){case DlKeyboard.ARROW_UP:if(ITEM==null)ITEM=0;ITEM=MENU.children().rotateIndex(--ITEM);break;case DlKeyboard.ARROW_DOWN:case DlKeyboard.TAB:if(ITEM==null)ITEM=-1;ITEM=MENU.children().rotateIndex(++ITEM);break;case DlKeyboard.ENTER:if(ITEM!=null){this.collapse(false);MENU.children(ITEM).callHooks("onSelect");}DlException.stopEventBubbling();case DlKeyboard.ESCAPE:this._hideMenu();var d=this.__origData;if(d){this.setValue(d.value);this.setSelectionRange(d.range);}DlException.stopEventBubbling();}if(old_item!=ITEM){if(old_item!=null){w=MENU.children(old_item);w.callHooks("onMouseLeave");}w=MENU.children(ITEM);w.callHooks("onMouseEnter");DlException.stopEventBubbling();}else{this._hideMenu();}};function onKeyDown(ev){if(is_ie)return handleMenuKey.call(this,ev);};P._handle_focusKeys=function(ev){if(!DlKeyboard.KEYS_CONTROL[ev.keyCode]){this._hideMenu();if(this.__timeout!=null)this.__timer=__triggerCompletion.delayed(this.__timeout,this,ev,false);}else if(!is_ie){if(!this.__noTab&&ev.keyCode==DlKeyboard.TAB&&!_menuVisible()&&!this.isEmpty()){__triggerCompletion.call(this,ev,true);ev.domStop=true;DlException.stopEventBubbling();}else{return handleMenuKey.call(this,ev);}}return BASE._handle_focusKeys.call(this,ev);};function onBlur(){this.cancelCompletion();};P.completeFromWords=function(words,args){return D.completeFromWords.call(D,this,words,args);};D.completeFromWords=function(entry,words,args){if(args==null)args={};if(args.sep==null)args.sep=/\s+/g;return function(range){var comp=[],val=entry.getValue(),pos=val.lastIndexOfRegexp(args.sep,range.start);val=val.substring(pos,range.start);if(val){for(var i=0;i<words.length;++i)if(words[i].indexOf(val)==0)comp.push({label:words[i],noselect:args.noselect,after:args.addSep,start:pos});}if(comp.length>0)entry.completionReady(comp);else entry.cancelCompletion();};};})();(function(){DlComboBox.inherits(DlCompletionEntry);function DlComboBox(args){if(args){D.setDefaults(this,args);DlCompletionEntry.call(this,args);}};eval(Dynarch.EXPORT("DlComboBox",true));D.DEFAULT_ARGS={_noSelect:["noSelect",false],__smart:["smart",false],__noTab:["noTab",true],_options:["options",null],_sizeToFit:["sizeToFit",true],_electric:["electric",false]};P._createElement=function(){D.BASE._createElement.apply(this,arguments);var td=CE("td",null,null,this.getElement().rows[0]);(this._btn=new DlWidget({parent:this,className:"DlComboBox-dropDownBtn",appendArgs:td})).addEventListener("onMouseEnter onMouseLeave onMouseDown".qw(),btnEvent.$(null,this));this.addEventListener("onCompletion",this.doCompletion);};P._on_menuHide=function(){D.BASE._on_menuHide.call(this);this._btn.delClass("DlComboBox-dropDownBtn-active");};P.setSize=P.setOuterSize=function(size){var input=this.getInputElement(),tpb=DOM.getPaddingAndBorder(this.getElement()),ipb=DOM.getPaddingAndBorder(input),sb=this._btn.getSize().x;DOM.setOuterSize(input,size.x-tpb.x-ipb.x-sb+2);};function btnEvent(self,ev){switch(ev.dl_type){case "onMouseEnter":this.addClass("DlComboBox-dropDownBtn-hover");break;case "onMouseLeave":this.delClass("DlComboBox-dropDownBtn-hover");break;case "onMouseDown":if(ev.button==0){self._forcePopup();DlException.stopEventBubbling();}break;}};P._forcePopup=function(){this._btn.addClass("DlComboBox-dropDownBtn-active");this.__forced=true;this.doCompletion(null);this.focus.delayed(0,this);};P.doCompletion=function(range){var val="",comp=[];if(range){val=this.getValue().trim().toLowerCase();if(!val)return this.cancelCompletion();}var a=this._options;if(a instanceof Function){a=a.apply(this,arguments);if(a==null)return;}a.foreach(function(opt){if(opt.toLowerCase().indexOf(val)==0){comp.push({label:opt.htmlEscape(),start:0,completion:opt});}});if(comp.length>0)this.completionReady(comp);else this.cancelCompletion();};})();(function(){DlDrag.inherits(DlEventProxy);function DlDrag(args){if(args){DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);D.setDefaults(this,args);}};eval(Dynarch.EXPORT("DlDrag"));var DEFAULT_EVENTS=["onDrop","onStartDrag"];D.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"}]};P.dropOK=function(widget,ev,target,inside){this.target=target;return this.canDrop=true;};P._handleDrop=function(src,dest,pos){this.applyHooks("onDrop",[src,dest,pos]);};P.doDrop=function(widget,ev){throw new DlExAbstractBaseClass();};P.startOK=function(widget,ev){return true;};P.moving=function(widget,ev){};P.reset=function(wasCancel){var el=this.elementCopy;if(el&&el.parentNode){if(wasCancel&&this._animArgs){var anim=new DlAnimation(this._animArgs.length,this._animArgs.fps);var pos=this.startElPos||this.startPos;var cpos=DynarchDomUtils.getPos(el);anim.addEventListener({onUpdate:function(){var y=this.getPos();el.style.left=y.mapInt(cpos.x,pos.x)+"px";el.style.top=y.mapInt(cpos.y,pos.y)+"px";DynarchDomUtils.setOpacity(el,this.t.map(1,0.2));},onStop:function(){DynarchDomUtils.trash(el);el=null;}});anim.start(null,null,"accel_ab");}else el.parentNode.removeChild(el);}this.dragging=false;this.canDrop=false;this.target=null;this.elementCopy=null;this.startPos=null;this.source=null;};P.makeElementCopy=function(widget,ev){var el=this.elementCopy;if(!el){el=this.elementCopy=widget.getElement().cloneNode(true);DynarchDomUtils.addClass(el,"DlWidget-dragged-clone");el.style.top=ev.pos.y+"px";el.style.left=ev.pos.x+"px";document.body.appendChild(el);el.style.width=el.offsetWidth+"px";}return el;};})();(function(){var BASE=DlDragTreeItem.inherits(DlDrag);function DlDragTreeItem(args){if(args){DlDrag.call(this,args);DlDragTreeItem.setDefaults(this,args);}};eval(Dynarch.EXPORT("DlDragTreeItem"));D.DEFAULT_ARGS={_noReparent:["noReparent",false]};var CLASS="DlTreeItem-dropTarget";var CLASS_UPPER="DlTreeItem-dropTarget-upper";var CLASS_LOWER="DlTreeItem-dropTarget-lower";var CLASS_ALL_RE=/DlTreeItem-dropTarget[^\s]*/g;var CLASS_POS_RE=/DlTreeItem-dropTarget-[^\s]*/g;function onExpander(ev){return/DlTree-IconWidth/.test(ev.target.className);};P.startOK=function(widget,ev){return!onExpander(ev);};P.dropOK=function(item,ev,obj,inside){while(obj&&!(obj instanceof DlTreeItem))obj=obj.parent;var ok=!inside&&obj;if(ok)ok=!this._noReparent||item.parent===obj.parent;this.target=ok?obj:null;this.canDrop=!!ok;if(this.oldTarget&&this.oldTarget!==this.target)this.oldTarget.delClass(CLASS_ALL_RE);if(ok)this.target.addClass(CLASS);this.oldTarget=this.target;return ok;};P.doDrop=function(item,ev){if(this._noReparent||onExpander(ev)){var pos=this.target.getIndex();if(!this.dropBefore)++pos;this.target.parent.appendWidget(item,pos);this._handleDrop(item,this.target,this.dropBefore?"before":"after");}else{if(this.target.getSubtreeWidget()!==item.parent){this.target.addSubItem(item);this._handleDrop(item,this.target);}}};P.moving=function(item,ev){var target=this.target;if(this.canDrop&&target&&(this._noReparent||onExpander(ev))){var relPos=ev.computePos(target);var h=target.getDivElement().offsetHeight/2;var upper=relPos.y<=h;target.condClass(upper,CLASS_UPPER,CLASS_LOWER);this.dropBefore=upper;}else if(target){this.dropBefore=null;target.delClass(CLASS_POS_RE);}};P.reset=function(){if(this.target)this.target.delClass(CLASS_ALL_RE);if(this.oldTarget)this.oldTarget.delClass(CLASS_ALL_RE);BASE.reset.apply(this,arguments);this.oldTarget=null;};})();(function(){var BASE=DlLayout.inherits(DlContainer);function DlLayout(args){if(args){D.setDefaults(this,args);DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlLayout"));D.DEFAULT_ARGS={_outerSpace:["outerSpace",0],_fillParent:["fillParent",true]};D.setFill=function(widget,fill){var oldfill=widget._dllayout_args.fill;widget._dllayout_args.fill=fill;if(fill!=oldfill)widget.parent.doLayout();};D.getArgs=function(widget){return widget._dllayout_args;};P._appendWidgetElement=function(w,pos){if(!pos)return D.BASE._appendWidgetElement.apply(this,arguments);var div=DynarchDomUtils.createElement("div",null,{className:"DlLayout-positioned"},this.getElement());if(pos.zIndex)div.style.zIndex=pos.zIndex;if(pos.overflow)div.style.overflow=pos.overflow;div.appendChild(w.getElement());w._dllayout_args=pos;};P._removeWidgetElement=function(w){if(this._widgets.contains(w)){var el=w.getElement();if(el.parentNode){el.parentNode.parentNode.removeChild(el.parentNode);el.parentNode.removeChild(el);}}};P.packWidget=function(w,args){this.appendWidget(w,args);};P.doLayout=function(){var full_size=this.getInnerSize();var left,right,bottom,top;var OS=this._outerSpace;function reinit(){if(typeof OS=="number")left=right=bottom=top=OS;else if(OS instanceof Array){top=OS[0];right=OS[1];bottom=OS[2];left=OS[3];}else{top=OS.top||0;right=OS.right||0;bottom=OS.bottom||0;left=OS.left||0;}};reinit();var wa=this._widgets;var info=new Array(wa.length);var margins={};for(var i=0;i<wa.length;++i){var w=wa[i];var args=w._dllayout_args;if(!args||!w.display())continue;var div=w.getElement().parentNode;var space_before=args.before=args.before||0;var space_after=args.after=args.after||0;var fill=args.fill;if(args.resetSize){w.getElement().style.height="";w.getElement().style.width="";}var ws=w.getOuterSize();switch(args.pos){case "top":top+=space_before;if(fill==null)fill=ws.y;info[i]={sy:fill};if(typeof fill=="number")top+=fill;top+=space_after;break;case "right":right+=space_before;if(fill==null)fill=ws.x;info[i]={sx:fill};if(typeof fill=="number")right+=fill;right+=space_after;break;case "bottom":bottom+=space_before;if(fill==null)fill=ws.y;info[i]={sy:fill};if(typeof fill=="number")bottom+=fill;bottom+=space_after;break;case "left":left+=space_before;if(fill==null)fill=ws.x;info[i]={sx:fill};if(typeof fill=="number")left+=fill;left+=space_after;break;}info[i].w=w;info[i].args=args;info[i].div=div;}var remaining_x=full_size.x-left-right;var remaining_y=full_size.y-top-bottom;reinit();info.foreach(function(info,i){if(!info)$CONTINUE();var args=info.args;var w=info.w;if(!w.display())return;switch(args.pos){case "top":case "bottom":if(typeof info.sy!="number"){if(info.sy=="*"){info.sy=remaining_y;}else if(/%/.test(info.sy)){info.sy=Math.floor(parseFloat(info.sy)*remaining_y/100);}if(args.min!=null&&info.sy<args.min)info.sy=args.min;if(args.max!=null&&info.sy>args.max)info.sy=args.max;remaining_y-=info.sy;}break;case "left":case "right":if(typeof info.sx!="number"){if(info.sx=="*"){info.sx=remaining_x;}else if(/%/.test(info.sx)){info.sx=Math.floor(parseFloat(info.sx)*remaining_x/100);}if(args.min!=null&&info.sx<args.min)info.sx=args.min;if(args.max!=null&&info.sx>args.max)info.sx=args.max;remaining_x-=info.sx;}break;}function doHAlign(){};function doVAlign(){var y=top;var h=full_size.y-top-bottom;var s={x:info.sx};switch(args.valign){case "top":break;case "center":y+=(h-w.getOuterSize().y)/2;break;case "bottom":y+=h-w.getOuterSize().y;default:s.y=h;}info.div.style.top=y+"px";w.setSize(s);};switch(args.pos){case "top":top+=args.before;info.div.style.left=left+"px";info.div.style.top=top+"px";w.setSize({x:full_size.x-left-right,y:info.sy});top+=info.sy+args.after;break;case "bottom":bottom+=args.before;info.div.style.left=left+"px";info.div.style.top=full_size.y-bottom-info.sy+"px";w.setSize({x:full_size.x-left-right,y:info.sy});bottom+=info.sy+args.after;break;case "left":left+=args.before;info.div.style.left=left+"px";doVAlign();left+=info.sx+args.after;break;case "right":right+=args.before;info.div.style.left=full_size.x-right-info.sx+"px";doVAlign();right+=info.sx+args.after;break;}});};P.__doLayout=function(){this.doLayout();};P.sizeToFit=function(){var wa=this._widgets;var height=0,width=0;for(var i=0;i<wa.length;++i){var w=wa[i];var args=w._dllayout_args;var ws=w.getOuterSize();switch(args.pos){case "top":case "bottom":height+=ws.y;if(ws.x>width)width=ws.x;break;case "left":case "right":width+=ws.x;if(ws.h>height)height=ws.h;break;}}this.setOuterSize({x:width,y:height});};})();(function(){var BASE=DlResizeBar.inherits(DlWidget);function DlResizeBar(args){if(args){D.setDefaults(this,args);this._invert=this._invert?-1:1;DlWidget.call(this,args);}};eval(Dynarch.EXPORT("DlResizeBar",true));D.DEFAULT_ARGS={_isHoriz:["horiz",null],_widget:["widget",null],_invert:["invert",false],_min:["min",null],_max:["max",null],_cont:["continuous",false],_keepPrc:["keepPercent",false]};D.getDragBar=function(){return DlElementCache.DRAGGING_LINE;};P.initDOM=function(){BASE.initDOM.call(this);this.condClass(this.isHoriz(),"DlResizeBar-Horizontal","DlResizeBar-Vertical");this.setUnselectable(null,true);};P.isHoriz=function(){if(this._isHoriz==null){var args=DlLayout.getArgs(this);if(args)this._isHoriz=/top|bottom/.test(args.pos);}return this._isHoriz;};P._setListeners=function(){BASE._setListeners.call(this);this._resizeHandlers={onMouseMove:mouseMove.$(this),onMouseUp:stopResize.$(this),onMouseOver:DlException.stopEventBubbling,onMouseOut:DlException.stopEventBubbling,onMouseEnter:DlException.stopEventBubbling,onMouseLeave:DlException.stopEventBubbling};this.addEventListener("onMouseDown",startDrag);};P._setResizeCaptures=function(capture){(capture?DlEvent.captureGlobals:DlEvent.releaseGlobals)(this._resizeHandlers);var div=DlDialog.activateEventStopper(capture);CC(div,capture,this.isHoriz()?"CURSOR-RESIZE-S":"CURSOR-RESIZE-E");};function startDrag(ev){var el=DlElementCache.DRAGGING_LINE;var pos=this.getPos();this._dragPos=this.isHoriz()?pos.y:pos.x;var mpos=this.isHoriz()?ev.pos.y:ev.pos.x;this._mposDiff=mpos-this._dragPos;var size=this.getSize();el.style.top=pos.y+"px";el.style.left=pos.x+"px";el.style.width=size.x+"px";el.style.height=size.y+"px";if(this._widget){var s=this._widget instanceof DlWidget?this._widget.getSize():DOM.getOuterSize(this._widget);this._dragSize=this.isHoriz()?s.y:s.x;}document.body.appendChild(el);this._setResizeCaptures(true);DlException.stopEventBubbling();};P._doResize=function(ev){var H=this.isHoriz();var pos=DOM.getPos(DlElementCache.DRAGGING_LINE);var pos=H?pos.y:pos.x;var diff=this._invert*(pos-this._dragPos);var w=this._widget;if(w){var s=this._dragSize;if(w instanceof DlWidget){var f=DlLayout.getArgs(w);if(f){f=f.fill;var isPrc=/%$/.test(f);if(isPrc&&!this._keepPrc||f==null||typeof f=="number"){DlLayout.setFill(w,s+diff);}else if(isPrc){f=parseFloat(f);DlLayout.setFill(w,f*(s+diff)/s+"%");}}else{if(this._isHoriz)w.setSize({y:s+diff});else w.setSize({x:s+diff});}}else{if(this._isHoriz)DOM.setOuterSize(w,null,s+diff);else DOM.setOuterSize(w,s+diff,null);}}};function stopResize(ev){this._setResizeCaptures(false);this._doResize(ev);document.body.removeChild(DlElementCache.DRAGGING_LINE);};function mouseMove(ev){var el=DlElementCache.DRAGGING_LINE;var pos=this.isHoriz()?ev.pos.y:ev.pos.x;pos-=this._mposDiff;var diff=this._invert*(pos-this._dragPos);var min=this._min,max=this._max,w=this._widget;if(w){var args=DlLayout.getArgs(w);if(args){if(min==null)min=args.min;if(max==null)max=args.max;}var s;if(min!=null||max!=null){s=this._dragSize+diff;}if(min!=null&&s<min){pos+=this._invert*(min-s);}else if(max!=null&&s>max){pos+=this._invert*(max-s);}}if(this.isHoriz())el.style.top=pos+"px";else el.style.left=pos+"px";if(this._cont)this._doResize(ev);};})();(function(){DlWM.inherits(DlContainer);function DlWM(args){if(args){DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlWM",true));P.getInnerSize=P.getOuterSize=P.getSize=function(){return(this.parent?this.parent.getInnerSize():DOM.getWindowSize());};P.initDOM=function(){D.BASE.initDOM.apply(this,arguments);this.getElement().innerHTML="<div class='DlWM-modalStopper'></div>";this.dialogsVisible=[];this.modalsVisible=0;this._manageEvents={onShow:_on_dlgShow.$(null,this),onHide:_on_dlgHide.$(null,this)};var resize=this.on_parentResize.$(this);this.parent?this.parent.addEventListener("onResize",resize):DOM.addEvent(window,"resize",resize);};P.getModalStopperElement=function(){return this.getElement().childNodes[0];};P.activatePrev=function(){var a=this.dialogsVisible;if(a.length>1){a.peek().deactivate();a.unshift(a.pop());top=a.pop();top.activate();}};P.activateNext=function(){var a=this.dialogsVisible;if(a.length>1){a[0].activate();}};P.getActiveDialog=function(){return this.dialogsVisible.peek();};P.updateZIndex=function(){this.dialogsVisible.r_foreach(function(d,i){d.zIndex((d.__modal?900:500)+i);});};P.getVisibleDialogs=function(){return this.dialogsVisible;};P.getAllDialogs=function(){return this.children().grep(function(w){return w instanceof DlDialog});};P.appendWidget=function(w){D.BASE.appendWidget.apply(this,arguments);if(w instanceof DlDialog)this.manage(w);};P.removeWidget=function(w){D.BASE.removeWidget.apply(this,arguments);if(w instanceof DlDialog)this.unmanage(w);};P.manage=function(dlg){dlg.addEventListener(this._manageEvents)};P.unmanage=function(dlg){dlg.removeEventListener(this._manageEvents)};P.on_dlgShow=function(dlg){if(dlg.__modal)this.modalsVisible++;this.condClass(this.modalsVisible>0,"DlWM-hasModals");};P.on_dlgHide=function(dlg){if(dlg.__modal)this.modalsVisible--;this.condClass(this.modalsVisible>0,"DlWM-hasModals");if(this.dialogsVisible.length==0&&this.parent)this.parent.focus();};P.on_parentResize=function(){this.dialogsVisible.foreach(function(dlg){if(dlg.__maximized)dlg.__doMaximize();});this.callHooks("onResize");};P.rearrange=function(algo){var a=this.dialogsVisible.map(function(dlg){var pos=dlg.getOffsetPos(),size=dlg.getOuterSize();return{dlg:dlg,x:pos.x,y:pos.y,w:size.x,h:size.y};});algo(a,this.getInnerSize());a.foreach(function(o){o.dlg.setPos(o.x,o.y);o.dlg.setSize({x:o.w,y:o.h});});};P.tileHoriz=function(){this.rearrange(algo_tileHoriz)};P.tileVert=function(){this.rearrange(algo_tileVert)};function _on_dlgShow(wm){wm.on_dlgShow(this)};function _on_dlgHide(wm){wm.on_dlgHide(this)};DlContainer.prototype._makeWindowManager=function(){if(!this.__wm)(this.__wm=new DlWM({parent:this})).addEventListener("onDestroy",function(){this.__wm=null}.$(this));return this.__wm;};function sortX(a,b){return a.x<b.x?-1:a.x>b.x?1:0};function sortY(a,b){return a.y<b.y?-1:a.y>b.y?1:0};function algo_tileHoriz(a,size){var n=a.length,w=Math.floor(size.x/n),x=0;a.mergeSort(sortX).foreach(function(o,i){o.y=0;o.x=x;o.h=size.y;if(i==n-1)o.w=size.x-x;else o.w=w;x+=w;});};function algo_tileVert(a,size){var n=a.length,h=Math.floor(size.y/n),y=0;a.mergeSort(sortY).foreach(function(o,i){o.x=0;o.y=y;o.w=size.x;if(i==n-1)o.h=size.y-y;else o.h=h;y+=h;});};})();(function(){var BASE=DlDialog.inherits(DlContainer);function DlDialog(args){if(args){if(!args.parent)args.parent=D.getTopWM();if(!(args.parent instanceof DlWM)){if(args.parent instanceof DlDialog)args.noShadows=true;args.parent=args.parent._makeWindowManager();}D.setDefaults(this,args);this.__doDrag=this.__moveDelay!=null?__doDrag.clearingTimeout(this.__moveDelay,this):__doDrag.$(this);DlContainer.call(this,args);this.active=false;}};eval(Dynarch.EXPORT("DlDialog",true));var EX=DlException.stopEventBubbling;var DEFAULT_EVENTS=["onShow","onHide","onActivate","onQuitBtn"];D.DEFAULT_ARGS={_title:["title","DlDialog"],_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",5000]};var TOP_WM;D.getTopWM=function(){if(!TOP_WM){TOP_WM=new DlWM({});document.body.appendChild(TOP_WM.getElement());}return TOP_WM;};var HTML=("<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>");var HIDE_POS={x:-30000,y:-30000};P._setDragCaptures=function(capture){DlEvent[capture?"captureGlobals":"releaseGlobals"](this._dragHandlers);};P._setResizeCaptures=function(capture){DlEvent[capture?"captureGlobals":"releaseGlobals"](this._resizeHandlers);};function activateCkt(){var ckt=DOM.CE_CACHE["DlDialog.EVENT_STOPPER"];if(!ckt){ckt=DOM.CE_CACHE["DlDialog.EVENT_STOPPER"]=CE("div",null,{className:"DYNARCH-EVENT-STOPPER"},document.body);}ckt.style.visibility="";return ckt;};function deactivateCkt(){var ckt=DOM.CE_CACHE["DlDialog.EVENT_STOPPER"];if(ckt){ckt.className="DYNARCH-EVENT-STOPPER";ckt.style.visibility="hidden";}return ckt;};D.activateEventStopper=function(act){return act?activateCkt():deactivateCkt();};function startDrag(ev){if(!this.dragging&&!this.__maximized){DlPopup.clearAllPopups();this.activate();this.dragging=true;ev||(ev=window.event);var dlev=(ev instanceof DlEvent)?ev:new DlEvent(ev);this.addClass("DlDialog-Dragging");this._dragPos=dlev.computePos(this);this._setDragCaptures(true);AC(activateCkt(),"CURSOR-DRAGGING");if(this.__moveDelay!=null){var div=this.getResizeRect();AC(div,"Dl-ResizeRect-moving");var sz=this.getOuterSize();DOM.setPos(div,dlev.elPos.x,dlev.elPos.y);DOM.setOuterSize(div,sz.x,sz.y);div.style.display="";}if(dlev!==ev)return DOM.stopEvent(ev);}};function startCtrlDrag(ev){if(ev.ctrlKey&&ev.shiftKey){if(ev.button==0&&this._dragHandlers){startDrag.call(this,ev);}else if(ev.button==2&&ev.dl_type=="onContextMenu"&&this._resizable){startResize.call(this,ev);EX();}}};function stopDrag(ev){if(this.dragging){var div=this.getResizeRect();this.dragging=false;this.delClass("DlDialog-Dragging");this._setDragCaptures(false);if(this.__moveDelay!=null){if(ev){var pos=__dragGetPos.call(this,ev);this.__doDrag.doItNow(pos.x,pos.y);}else{this.__doDrag.cancel();}}DC(div,"Dl-ResizeRect-moving");div.style.display="none";deactivateCkt();}};function __dragGetPos(ev){var p=this.parent;ev.computePos(p.getContentElement());var x=ev.relPos.x-this._dragPos.x,y=ev.relPos.y-this._dragPos.y,sz=this.getOuterSize(),ws=p.getInnerSize();if(x<0)x=0;else if(x+sz.x>ws.x)x=ws.x-sz.x;if(y<0)y=0;else if(y+sz.y>ws.y)y=ws.y-sz.y;return{x:x,y:y};};function __dragDIV(pos){var x=pos.x,y=pos.y;pos=DOM.getPos(this.parent.getContentElement());x+=pos.x;y+=pos.y;DOM.setPos(this.getResizeRect(),x,y);};function __doDrag(x,y){this.setPos(x,y);this.__oldDlgPos=this.getOffsetPos();};function doDrag(ev){var pos=__dragGetPos.call(this,ev);if(this.__moveDelay!=null)__dragDIV.call(this,pos);this.__doDrag(pos.x,pos.y);EX();};function startResize(ev){if(!this.resizing){this.resizing=true;ev||(ev=window.event);var dlev=(ev instanceof DlEvent)?ev:new DlEvent(ev);this._dragPos=dlev.computePos(this);var sz=this.getOuterSize();this._dragPos.x-=sz.x;this._dragPos.y-=sz.y;var pos=this.getPos();var div=this.getResizeRect();DOM.setPos(div,pos.x,pos.y);DOM.setOuterSize(div,sz.x,sz.y);div.style.display="";this.addClass("DlDialog-Resizing");this._setResizeCaptures(true);AC(activateCkt(),"CURSOR-DRAGGING");doResize.call(this,dlev,true);if(dlev!==ev)DOM.stopEvent(ev);}};function stopResize(ev){if(this.resizing){this.disableHooks("onResize");this.getElement().style.overflow="hidden";var div=this.getResizeRect();var sz=DOM.getOuterSize(div);DOM.setPos(div,0,0);div.style.display="none";this.delClass("DlDialog-Resizing");sz.x--;if(is_gecko){sz.y--;}if(this.__noShadows){sz.x-=4;sz.y-=4;}this.setOuterSize({x:sz.x,y:sz.y});if(is_gecko)BASE.setOuterSize.call(this,{x:"auto",y:"auto"});this.resizing=false;this._setResizeCaptures(false);this.getElement().style.overflow="";deactivateCkt();this.enableHooks("onResize");this.callHooks("onResize");}};function doResize(ev,domStop){if(this.resizing){var div=this.getResizeRect();var pos=DOM.getPos(div);pos.x=ev.pos.x-this._dragPos.x-pos.x-1;if(pos.x<100)pos.x=100;pos.y=ev.pos.y-this._dragPos.y-pos.y-1;if(pos.y<100)pos.y=100;if(this._resizable===1)pos.y=null;if(this._resizable===2)pos.x=null;DOM.setInnerSize(div,pos.x,pos.y);domStop||EX();}};P.setOuterSize=P.setSize=function(sz){if(sz.y!=null)sz.y-=this.getTitleElement().offsetHeight;this.setInnerSize(sz);};P.hide=function(){this.__oldDlgPos=this.getOffsetPos();this.display(false);this.setPos(HIDE_POS);};P.show=function(center){if(!this.__wasDisplayed){this.setStyle({visibility:""});}if(!this.display()||!this.__wasDisplayed){if(this.__oldDlgPos)this.setPos(this.__oldDlgPos);else if(center)this.centerOnParent();this.display(true);}else{this.activate();}this.__wasDisplayed=true;};P.activate=function(){var vd=this.parent.getVisibleDialogs();var act=vd.peek();if(!this.active){if(act&&act.active)act.deactivate(true);this.addClass("DlDialog-Active");vd.remove(this);vd.push(this);this.parent.updateZIndex();this.active=true;this.focus();if(this._focusedWidget&&!this._focusedWidget.destroyed)this._focusedWidget.focus();this.applyHooks("onActivate",[true]);}};P.deactivate=function(){if(this.active){this.delClass("DlDialog-Active");this.active=false;this.blur();this.applyHooks("onActivate",[false]);}};function onDisplay(disp,val){var sys=DlSystem();if(disp){this.callHooks("onShow");this.activate();this.setModal(this.__modal,true);sys.applyHooks("on-dialog-show",[this]);if(this.__maximized)this.__doMaximize.delayed(1,this);}else{var vd=this.parent.getVisibleDialogs();vd.remove(this);this.callHooks("onHide");this.deactivate();sys.applyHooks("on-dialog-hide",[this]);if(vd.length>=1)vd.peek().activate();}};function onDestroy(){this.hide();};function onMouseWheel(ev){if(ev.shiftKey||ev.altKey){var opc=this.__dlgOpacity;if(opc==null)opc=100;if(ev.wheelDelta>0)opc+=0.05;else opc-=0.05;opc=this.__dlgOpacity=opc.limit(0.1,1);this.opacity(opc);EX();}};P._createElement=function(){BASE._createElement.call(this);this.setPos(HIDE_POS);this.setStyle({visibility:"hidden"});this.getElement().innerHTML=HTML;var rel=this.getRelElement();if(!this.__noShadows&&!is_ie6)rel.insertBefore(DlElementCache.get("SHADOWS"),rel.firstChild);else{this.__noShadows=true;AC(rel,"DlDialog-noShadows");}this.title(this._title);this.setUnselectable(this.getTitleElement());var quitBtn=this.__quitBtn;if(quitBtn){var foo=this.__quitBtn=new DlAbstractButton({parent:this,className:"DlDialog-QuitBtn",appendArgs:this.getButtonsElement(),classes:{hover:"DlDialog-QuitBtn-hover",active:"DlDialog-QuitBtn-active"}});if(quitBtn=="destroy"){quitBtn=this.destroy.$(this);}else if(quitBtn=="hide"){quitBtn=this.hide.$(this);}if(quitBtn instanceof Function)foo.addEventListener("onClick",quitBtn);else foo.connectEvents("onClick",this,"onQuitBtn");}if(this._resizable)this.makeResizable();this.setIconClass(this._iconClass);};P.setIconClass=function(iconClass){var e2=this.getTitleElement().firstChild;CC(e2,iconClass!=null,"DlDialog-Title-withIcon");if(this.iconClass)DC(e2,this.iconClass);if(iconClass)AC(e2,iconClass);this.iconClass=iconClass;};P.getState=function(){var state=this.__maximized&&this.__maximizeSavePos;if(state)state=Object.makeDeepCopy(state);else state={pos:this.getOffsetPos(),size:this.getOuterSize()};state.max=!!this.__maximized;return state;};P.maximize=function(c){if(c==null)c=this.__maxBtn.checked();var pos,size;this.__maximized=c;if(c){pos=this.getOffsetPos();size=this.getOuterSize();this.__maximizeSavePos={pos:pos,size:size};}this.condClass(c,"DlDialog-Maximized");if(c){this.__doMaximize();}else{pos=this.__maximizeSavePos;size=pos.size;pos=pos.pos;this.setOuterSize({x:size.x,y:size.y});this.setPos(pos.x,pos.y);}this.__maxBtn.checked(c,true);};P.__doMaximize=function(){this.setPos(0,0);var ws=this.parent.getInnerSize();if(this.__noShadows){ws.x-=4;ws.y-=4;}this.setOuterSize({x:ws.x,y:ws.y});};P.setModal=function(modal,noset){if(!noset)this.__modal=modal;if(this.display()){this.parent.updateZIndex();}};P.makeResizable=function(){if(!this._resizeHandlers){this.getContentElement().style.overflow="hidden";var div=this.getRelElement();var el=CE("div",null,{className:"ResizeHandle"},null);div.insertBefore(el,div.firstChild);this._resizeHandlers={onMouseMove:doResize.$(this),onMouseUp:stopResize.$(this),onMouseOver:EX,onMouseOut:EX,onMouseEnter:EX,onMouseLeave:EX};DOM.addEvent(el,"mousedown",startResize.$(this));this.resizing=false;if(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));}}};P.makeDraggable=function(){if(!this._dragHandlers){var el=this.getTitleElement();el.style.cursor="default";this._dragHandlers={onMouseMove:doDrag.$(this),onMouseUp:stopDrag.$(this),onMouseOver:EX,onMouseOut:EX,onMouseEnter:EX,onMouseLeave:EX};DOM.addEvent(el,"mousedown",startDrag.$(this));this.addEventListener(["onMouseDown","onContextMenu"],startCtrlDrag);this.dragging=false;}};P.title=function(title){if(title!=null){if(title instanceof Array)title=title.join("");this._title=title;this.getTitleElement().firstChild.innerHTML=title;}return this._title;};P._handle_focusKeys=function(ev){if(!ev.altKey&&!ev.ctrlKey){if(ev.keyCode==DlKeyboard.ESCAPE){if(!this.dragging&&this.__quitBtn){this.__quitBtn.keyClicked(ev);}else if(this.dragging){stopDrag.call(this);}}else if(ev.keyCode==DlKeyboard.TAB){var w=ev.focusedWidget;w=ev.shiftKey?this.getPrevFocusWidget(w):this.getNextFocusWidget(w);if(w)w.focus();ev.domStop=true;EX();}}this._handleKeybinding(ev);};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);if(!this._fixed)this.makeDraggable();this.addEventListener({onMouseDown:this.activate,onMouseWheel:onMouseWheel,onDisplay:onDisplay,onDestroy:onDestroy});};function _el(o,p){var a=o.getRelElement().childNodes;return a[a.length-p];};P.getRelElement=function(){return this.getElement().firstChild.rows[0].cells[0].firstChild;};P.getContentElement=function(){return _el(this,1);};P.getTitleElement=function(){return _el(this,2);};P.getButtonsElement=function(){return _el(this,3);};P.centerOnParent=function(){var sz=this.getOuterSize(),ps=this.parent.getOuterSize();this.setPos((ps.x-sz.x)/2,(ps.y-sz.y)/2);};P.getWM=function(){return this.parent};DlWidget.prototype.getParentDialog=function(){var d=this.parent;while(d&&!(d instanceof D))d=d.parent;return d;};})();DlDialogPopup.inherits(DlPopup);function DlDialogPopup(args){if(args){args.autolink=false;args.zIndex=5000;DlPopup.call(this,args);}};(function(){var DEFAULT_EVENTS=["onChange"];DlRecord.inherits(DlEventProxy);function DlRecord(args){if(args){D.setDefaults(this,args);DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);}};eval(Dynarch.EXPORT("DlRecord"));D.DEFAULT_ARGS={_data:["data",null],_set:["recordSet",null]};P.id=function(){return this._data.id;};P.get=function(key){return this._data[key];};P.set=function(key,val,nohooks){var a,old=this._data[key];this._data[key]=val;if(!nohooks){a=[this,key,val,old];this.applyHooks("onChange",a);this._set&&this._set.applyHooks("onChange",a);}};P.compareTo=function(rec,col){var a=this.get(col),b=rec.get(col);return a<b?-1:a==b?0:1;};})();(function(){var DEFAULT_EVENTS=["onChange","onInsert","onDelete","onRefresh"];DlRecordCache.inherits(DlEventProxy);function DlRecordCache(args){if(args){D.setDefaults(this,args);DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);this._init();}};eval(Dynarch.EXPORT("DlRecordCache"));D.DEFAULT_ARGS={_data:["data",null]};P.get=function(id){return this._data[id];};P.hasRecord=function(id){return this.get(id);};P.getRecords=function(ids,callback,obj){callback.call(obj,ids.map(this.get,this));};P.getAllIds=function(){var a=[],i;for(i in this._data)a.push(i);return a;};P.getAllRecords=function(){var a=[],i;for(i in this._data)a.push(this._data[i]);return a;};P.getHash=function(){return this._data;};P.formatHTML=function(rec,col,buf){buf(rec.get(col).toString().htmlEscape());};P.getRecClass=function(rec){};P.getCellClass=function(rec,col){};P.getInsertPos=function(rec){};P.insert=function(rec,where){if(where==null)where=this.getInsertPos(rec);this._data[rec.id()]=rec;rec._set=this;this.applyHooks("onInsert",[rec,where]);};P.remove=function(id){if(id instanceof Array){id.foreach(function(id){delete this._data[id];},this);}else delete this._data[id];this.applyHooks("onDelete",[id]);};P.sort=function(ids,col,prev,rev,callback,obj){var a;if(col==prev&&rev!==null){a=ids.reverse();}else{a=ids.mergeSort(function(a,b){a=this.get(a);b=this.get(b);return a.compareTo(b,col);}.$(this),rev);}callback.call(obj,a);};P._init=function(){if(!this._data){this._data={};}else{var d={};this._data.foreach(function(rec){d[rec.id()]=rec;rec._set=this;},this);this._data=d;}};})();(function(){var BASE=DlDataGridHeadLabel.inherits(DlButton);function DlDataGridHeadLabel(args){if(args){D.setDefaults(this,args);this.__withIconClass="DlButton-withIcon";DlButton.call(this,args);if(!this.col.isSortable())this.__disabled=true;this.setContextMenu(this._getContextMenu);}};eval(Dynarch.EXPORT("DlDataGridHeadLabel",true));var MIN_COL_WID=20;P.setWidth=function(w){this.setOuterSize({x:w});};P._onClick=function(){this.parent._onHeadClick(this.col,this);};P._getContextMenu=function(){var m=this._dgContextMenu,grid=this.parent,a;if(!m){this._dgContextMenu=m=new DlVMenu({});a=m.buttons=[];grid._cols.foreach(function(col,i){if(col.getMenuLabel()){var cb=a[i]=new DlCheckbox({parent:m,label:col.getMenuLabel(),checked:col.isVisible()});cb.addEventListener("onChange",function(){col.setVisible(this.checked());});}});}else{a=m.buttons;grid._cols.foreach(function(col,i){a[i].checked(col.isVisible(),true);});}return m;};D.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 EX=DlException.stopEventBubbling;function getResizeHandle(p){var d=p._resizeHandle;if(!d){d=p._resizeHandle=new DlWidget({parent:p,className:"DlDataGrid-resizeHandle"});d.display(false);d.grid=p.parent;d.addEventListener({onMouseLeave:d.display.$(d,false),onMouseDown:startResize});d._resizeCaptures={onMouseMove:doResize.$(d),onMouseUp:stopResize.$(d),onMouseOver:EX,onMouseOut:EX,onMouseEnter:EX,onMouseLeave:EX};}return d;};D._on_headMouseMove=function(ev){if(!this._colPos||this.dragging)return;var grid=this.parent,sl=grid.getBodyDiv().scrollLeft;var x=ev.computePos(this).x+sl;var found;this._colPos.foreach(function(c){if(Math.abs(x-c.pos)<4){if(c.col.isResizable())found=c;$BREAK();}});var rh=getResizeHandle(this);if(found){if(found.col!==rh.col){rh.found=found;rh.col=found.col;rh.pos=found.pos;rh.setPos(found.pos-sl);}rh.display(true);}else{rh.display(false);rh.found=rh.col=null;}};D._on_headMouseLeave=function(ev){getResizeHandle(this).display(false);};function startResize(ev){this.dragging=true;var bar=DlResizeBar.getDragBar(),s=bar.style;this.sl=this.grid.getBodyDiv().scrollLeft;s.left=this.pos-this.sl-1+"px";s.height="100%";s.width=this.getElement().offsetWidth-4+"px";s.top="0px";this.grid.getElement().appendChild(bar);var es=DlDialog.activateEventStopper(true);DOM.addClass(es,"CURSOR-RESIZE-E");DlEvent.captureGlobals(this._resizeCaptures);this.origW=this.grid.getColWidth(this.col);this.origM=ev.pos.x;this.col._button.addClass("DlDataGridHeadLabel-resizing");EX();};function doResize(ev){var bar=DlResizeBar.getDragBar(),left=this.pos+ev.pos.x-this.origM-1,diff=left-this.pos,w=this.origW+diff;if(w<MIN_COL_WID){left+=MIN_COL_WID-w;w=MIN_COL_WID;}left-=this.sl;bar.style.left=left+"px";this.width=w;this.diff=diff;if(!is_ie){var el=this.col._button.getElement();el.style.width=el.parentNode.style.width=el.parentNode.parentNode.style.width=w+"px";}EX();};function stopResize(ev){this.dragging=false;this.grid.getElement().removeChild(DlResizeBar.getDragBar());var es=DlDialog.activateEventStopper(false);DOM.delClass(es,"CURSOR-RESIZE-E");DlEvent.releaseGlobals(this._resizeCaptures);if(this.width){this.grid.setColWidth(this.col,this.width);this.grid._computeColPos();}this.col._button.delClass("DlDataGridHeadLabel-resizing");if(!is_ie){var el=this.col._button.getElement();el.style.width=el.parentNode.style.width=el.parentNode.parentNode.style.width="";}this.width=this.diff=this.found=this.col=null;this.parent.callHooks("onMouseMove",ev);EX();};})();(function(){var DEFAULT_EVENTS=["onChange","onVisibility"];DlGridCol.inherits(DlEventProxy);function DlGridCol(args){if(args){D.setDefaults(this,args);DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);}};eval(Dynarch.EXPORT("DlGridCol"));D.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 DEFAULT_STYLE={};P.id=function(){return this._field_id;};P.getWidth=function(){return this._width;};P.getFill=function(){return this._fill;};P.getLabel=function(){return this._label;};P.getMenuLabel=function(){return this._menuLabel||this._label;};P.getTooltip=function(){return this._tooltip;};P.getIconClass=function(){return this._iconClass;};P.getStyle=function(key,def){return(this._style||DEFAULT_STYLE)[key]||def;};P.isSortable=function(){return this._isSortable;};P.isResizable=function(){return this._isResizable;};P.isVisible=function(){return this._isVisible;};P.setVisible=function(v){this._isVisible=v;this.applyHooks("onVisibility",[v]);};P.sort=function(){};})();(function(){DlGridDragCol.inherits(DlDrag);function DlGridDragCol(args){if(args){DlDrag.call(this,args);this.addEventListener("onStartDrag",function(w){this.grid_pos=w.parent.getPos();w._onMouseLeave();});}};eval(Dynarch.EXPORT("DlGridDragCol",true));P.startOK=function(widget,ev){return true;};P.dropOK=function(widget,ev,target,inside){if(!inside&&target instanceof DlDataGridHeadLabel&&widget.parent===target.parent){this.target=target;return this.canDrop=true;}return this.canDrop=false;};P.doDrop=function(widget,ev){widget.parent.reorderColumn(widget.col,this.target.col,!this.dropBefore);};var DROP_INDICATOR;function getDropIndicator(){var d=DROP_INDICATOR;if(!d)d=DROP_INDICATOR=CE("div",{display:"none"},{className:"DlDataGrid-drop-col"},document.body);return d;};P.moving=function(widget,ev){var target=this.target;var di=getDropIndicator();if(this.canDrop&&target){var relPos=ev.computePos(target);var te=target.getElement();var w=te.offsetWidth;var before=relPos.x<=w/2;var pos=target.col.index;if(before)pos--;if(pos<0){pos=0;}else{pos=widget.parent._headCont._colPos[pos].pos-widget.parent.getBodyDiv().scrollLeft;}with(di.style){display="block";left=pos+this.grid_pos.x+"px";top=relPos.elPos.y+"px";}this.dropBefore=before;}else if(target){this.dropBefore=null;di.style.display="none";}};P.reset=function(){if(DROP_INDICATOR)DROP_INDICATOR.style.display="none";D.BASE.reset.apply(this,arguments);};})();(function(){var DEFAULT_EVENTS=["onChange","onReset"];DlSelectionModel.inherits(DlEventProxy);function DlSelectionModel(args){if(args){D.setDefaults(this,args);DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);if(!this.sel)this.sel={};}};eval(Dynarch.EXPORT("DlSelectionModel"));D.DEFAULT_ARGS={multiple:["multiple",true],sel:["sel",null]};P.reset=function(ids){var old=this.sel;this.sel=ids.toHash(true);this.applyHooks("onReset",[old,this.sel]);};P.clear=function(){this.reset([]);};P.get=function(){return this.sel;};P.getArray=function(){return Array.hashKeys(this.sel);};P.isSelected=function(id){return this.sel[id];};P.size=function(){var cnt=0;for(var i in this.sel)cnt++;return cnt;};P.filter=function(h){var unsel=[];for(var i in this.sel)if(!(i in h))unsel.push(i);this.unselect(unsel);};P.select=function(id){var s=this.sel,ret=null,tmp;if(id instanceof Array){tmp={};id.foreach(function(id){if(!s[id]){s[id]=tmp[id]=true;ret=true;}},this);if(ret!=null)this.applyHooks("onReset",[{},tmp]);}else{if(!s[id]){s[id]=true;this.applyHooks("onChange",[id,true]);ret=true;}}return ret;};P.unselect=function(id){var s=this.sel,ret=null,tmp;if(id instanceof Array){tmp={};id.foreach(function(id){if(s[id]){delete s[id];tmp[id]=true;ret=false;}},this);if(ret!=null)this.applyHooks("onReset",[tmp,{}]);}else{if(s[id]){delete s[id];this.applyHooks("onChange",[id,false]);ret=false;}}return ret;};P.toggle=function(id){return this.sel[id]?this.unselect(id):this.select(id);};})();(function(){var DEFAULT_EVENTS=["onBodyDblClick","onBodyScroll"];var BASE=DlDataGrid.inherits(DlContainer);function DlDataGrid(args){if(args){D.setDefaults(this,args);DlContainer.call(this,args);this.registerEvents(DEFAULT_EVENTS);this.__scrollConts=0;}};eval(Dynarch.EXPORT("DlDataGrid",true));var EX=DlException.stopEventBubbling;D.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],_rarify:["rarifyScroll",null]};var HTML=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();P.getHeaderDiv=function(){return this.getElement().firstChild;};P.getHeaderTable=function(){return this.getHeaderDiv().firstChild;};P.getHeaderRow=function(){return this.getHeaderDiv().firstChild.rows[0];};P.getBodyDiv=function(){return this.getElement().childNodes[1];};P._getVSHeightDiv=function(){return this.getBodyDiv().firstChild;};P._getVSScrollDiv=function(){return this._getVSHeightDiv().firstChild;};P.getRowsContainer=function(){return this._getVSHeightDiv().childNodes[1];};P.resetIDS=function(ids){var h={},sel=this._selection;ids.foreach(function(id,i){h[id]=i;});this._records={array:ids,id_to_pos:h};sel.filter(h);if(sel.getArray().length==0)sel._last=null;};P._fetch_data=function(ids,dir,callback){var min=this._minReqRows,n=ids.length,d=this._data;if(min==null||min<=n){d.getRecords(ids,callback,this);}else{var more=ids.slice(0);var a=this._records.array,i;var threshold=this._threshold||Math.ceil(this._rpp/2);if(dir<=0){var start=this._records.id_to_pos[ids[0]],k=threshold;while(k-->0)if(!d.hasRecord(a[--start]))break;if(k>0){for(i=start;i>=0&&more.length<min;i--){var id=a[i];if(!d.hasRecord(id))more.push(id);}}}if(dir>=0){var start=this._records.id_to_pos[ids.peek()],k=threshold;while(k-->0)if(!d.hasRecord(a[++start]))break;if(k>0){for(i=start;i<a.length&&more.length<min;i++){var id=a[i];if(!d.hasRecord(id))more.push(id);}}}d.getRecords(more,function(records){callback.call(this,records.slice(0,n));},this);}};P._display_ids=function(ids,vscroll){this._info_display={length:ids.length,first_row_index:this._records.id_to_pos[ids[0]],last_row_index:this._records.id_to_pos[ids.peek()]};this._fetch_data(ids,0,function(records){var buf=String.buffer();records.foreach(this._fetchRowHTML.$(this,buf));this.getRowsContainer().innerHTML=buf.get();if(vscroll!=null)this._setVScroll(vscroll);this._resetVSHeight();if(records.length>1)this.scrollToRecord(records[1].id());else this._setVScroll(this.getBodyDiv().scrollTop=0);this.getBoundRecords();});};P.displayPage=function(page){if(page==null)page=0;this._page=page;var ids=this._records.array;if(this._rpp){var start=page*this._rpp;ids=ids.slice(start,start+this._rpp);}this._display_ids(ids);};P._resetVSHeight=function(){if(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";}};P._setVScroll=function(pos){var v1=this._getVSScrollDiv();if(pos){v1.style.height=pos+"px";v1.style.display="block";}else{v1.style.display="none";}};P.initWidths=function(){var maxes={};this._cols.foreach(function(col){maxes[col.id()]=this.getColWidth(col);},this);var body=this.getRowsContainer();for(var i=body.firstChild;i;i=i.nextSibling){var cells=i.firstChild.rows[0].cells;for(var j=cells.length;--j>=0;){var td=cells[j];var colid=td.getAttribute("colid");maxes[colid]=Math.max(maxes[colid]||0,td.offsetWidth);}}this._cols.foreach(function(col){this.setColWidth(col,maxes[col.id()]);},this);};P.resetColumns=function(cols){var header_row=this.getHeaderRow();var header_cells=header_row.cells;var new_headers=[];this._cols=cols.map(function(el,i){var col=this._colsById[el.id];new_headers.push(header_cells[col.index]);col.index=i;col._width=el.width;col._isVisible=el.visible;return col;},this);var df=document.createDocumentFragment();new_headers.foreach(function(el){df.appendChild(el);});header_row.appendChild(df);this.refreshDisplay();this._cols.foreach(function(col){this.setColVisible(col,col.isVisible());this.setColWidth(col,col.getWidth());},this);};P.reorderColumn=function(src,dest,after){var si=src.index,di=dest.index;if(after)di++;var a=this._cols;a.splice(si,1);a.splice(si<di?di-1:di,0,src);for(var i=0;i<a.length;++i)a[i].index=i;for(var i=this.getRowsContainer().firstChild;i;i=i.nextSibling){var cells=i.firstChild.rows[0].cells;var src=cells[si],dest=cells[di];src.parentNode.insertBefore(src,dest||null);}var cells=this.getHeaderRow().cells;var src=cells[si],dest=cells[di];src.parentNode.insertBefore(src,dest||null);this._computeColPos();};P.getNRecords=function(){return this._records?this._records.array.length:0;};P.getNPages=function(){if(!this._rpp)return 1;return Math.ceil(this.getNRecords()/this._rpp);};P.rec_isSelected=function(rec){return this._selection.isSelected(rec.id());};P._computeColPos=function(){var pos=-1;this._headCont._colPos=this._cols.map(function(col){pos+=this.getColWidth(col);return{pos:pos,col:col};},this);};P._createElement=function(){BASE._createElement.call(this);this.getElement().id=this.id;this._ss=new DlStyleSheet();this._cssPrefix="#"+this.id;this.setContent(HTML);this._initHeaders();this.getBodyDiv().onscroll=this._rarify?onBodyScroll.rarify(this._rarify.calls,this._rarify.timeout,this):onBodyScroll.$(this);var h=this._headCont=new DlContainer({parent:this,element:this.getHeaderDiv()});h.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(ev){this.addEventListener(ev,this["_body_"+ev]);},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);if(this._records)this.resetIDS(this._records);this._sel_events={onChange:this._sel_onChange.$(this),onReset:this._sel_onReset.$(this)};if(!this._selection)this._selection=new DlSelectionModel({});this.setSelectionModel(this._selection);};P._onDestroy=function(){this.setCache(null);};P.setCache=function(cache){if(this._data)this._data.removeEventListener(this._cacheEvents);this._data=cache;if(cache)cache.addEventListener(this._cacheEvents);};P._data_onChange=function(rec){var el=this.getRowElement(rec.id());if(el){var buf=String.buffer();this._fetchRowHTML(buf,rec);buf=buf.get();if(is_ie)el.outerHTML=buf;else{var div=DOM.createFromHtml(buf);DOM.trash(el.parentNode.replaceChild(div,el));}}};P._data_onInsert=function(rec,where){var a=this._records.array;if(where==null)where=a.length;a.splice(where,0,rec.id());this.resetIDS(a);this.refreshDisplay();};P._data_onDelete=function(id){var a=this._records.array;if(id instanceof Array){id.foreach(function(id){this.remove(id);},a);}else a.remove(id);this.resetIDS(a);this.refreshDisplay();};P._data_onRefresh=function(){};P._recompDynamicWidths=function(){var width=this.getBodyDiv().clientWidth;var pc=[];this._cols.foreach(function(col){if(col.getFill()==null)width-=this.getColWidth(col);else pc.push(col);},this);width-=1;pc.foreach(function(col){this.setColWidth(col,width*col.getFill());},this);};P._initHeaders=function(){this._colsById={};this._cols.foreach(function(col,i){if(!(col instanceof DlGridCol))col=this._cols[i]=new DlGridCol(col);col.addEventListener("onVisibility",this.setColVisible.$(this,col));col.index=i;this._colsById[col.id()]=col;var cls="DlDataGrid-col-"+col.id();var sel=this._cssPrefix+" ."+cls;sel=sel+","+sel+" .DlDataGrid-cellData";var css=["text-align:"+col.getStyle("textAlign","left")];var width=col.getWidth();if(typeof width=="number"){css.push("width:"+width+"px");}css=css.join(";");col._cssRule=this._ss.insertRule(sel,css);if(!col.isVisible())this._ss.modifyRule(col._cssRule,{display:"none"});var td=document.createElement("td");td.innerHTML="<div class='DlDataGrid-cellData'></div>";td.className=cls;this.getHeaderRow().appendChild(td);var btn=this._makeHeadLabel({parent:this,appendArgs:td.firstChild,iconClass:col.getIconClass(),label:col.getLabel(),col:col,className:"DlGrid-align-"+col.getStyle("textAlign","left"),tooltip:col.getTooltip.$(col),drag:this._getDragObject()});col._button=btn;},this);};function ev_find_row(ev){var p=ev.target,row,col,row_id,col_id,tn;try{while(p){tn=p.tagName.toLowerCase();if(tn=="div"&&(row_id=p.getAttribute("recid"))!=null){row=p;break;}if(!col_id&&tn=="td"){col=p;col_id=p.getAttribute("colid");}p=p.parentNode;}}catch(ex){}return row?{row:row,col:col,id:row_id,col_id:col_id}:null;};P._sel_onChange=function(id,selected){var div=this.getRowElement(id);if(div)CC(div,selected,"DlDataGridRow-selected");};P._sel_onReset=function(oldSel,newSel){var i,div;for(i in oldSel){if(!newSel[i]){div=this.getRowElement(i);if(div)DC(div,"DlDataGridRow-selected");}}for(i in newSel){if(!oldSel[i]){div=this.getRowElement(i);if(div)AC(div,"DlDataGridRow-selected");}}};P.setSelectionModel=function(sel){if(this._selection)this._selection.removeEventListener(this._sel_events);this._selection=sel;sel.addEventListener(this._sel_events);};P._body_onDblClick=function(ev){this.callHooks("onBodyDblClick");};P._body_onMouseOver=function(ev){var r=ev_find_row(ev);if(r&&(this.__tooltip instanceof Function)){this._tooltipRow=r;DlWidget.getTooltip().popup({timeout:this.__tooltipTimeout,content:this.__tooltip(r),anchor:this.getElement(),align:"mouse",onPopup:this.__onTooltipShow,onHide:this.__onTooltipHide,widget:this});};};P._body_onMouseOut=function(ev){var r=ev_find_row(ev);if(r){DlWidget.getTooltip().hide();this._tooltipRow=null;}};P._body_onMouseLeave=function(ev){};P.__handleSelectClick=function(r,ev){var sel=this._selection,rs=this._records;if(sel.multiple){if(ev.button==2){if(!this._rtClickKeepSel){if(ev.ctrlKey){sel.select([r.id]);}else if(!sel.isSelected(r.id)){sel.reset([r.id]);}}}else{if(ev.ctrlKey){sel.toggle(r.id);sel._last=r.id;}else if(ev.shiftKey){if(sel._last!=null){var from=rs.id_to_pos[sel._last];var to=rs.id_to_pos[r.id];var ids=rs.array.slice(Math.min(from,to),Math.max(from,to)+1);sel.reset(ids);}else{sel.toggle(r.id);sel._last=r.id;}}else{sel.reset([r.id]);sel._last=r.id;}}}else{sel.reset([r.id]);sel._last=r.id;}};P._body_onMouseUp=function(ev){var r1=ev_find_row(ev),r2=this.__handleOnMouseUp;if(r1&&r2&&r1.id==r2.id)this.__handleSelectClick(r1,ev);};P._body_onMouseDown=function(ev){var r=ev_find_row(ev),sel=this._selection;if(r){this.__handleOnMouseUp=!sel.isSelected(r.id)||!this._bodyCont._dragArgs||ev.ctrlKey||ev.shiftKey?null:r;if(!this.__handleOnMouseUp){this.__handleSelectClick(r,ev);}EX();}};P.scrollToRecord=function(rec_id,where){var rc=this.getRowsContainer();var h=Math.floor(rc.offsetHeight/rc.childNodes.length);var pos=h*this._records.id_to_pos[rec_id||this._selection._last];var body=this.getBodyDiv(),st=body.scrollTop,bh=body.clientHeight;if(where==null){if(pos<st){body.scrollTop=pos;this._setVScroll(h*this._info_display.first_row_index);}else if(pos+h>st+bh){body.scrollTop=pos+h-bh;this._setVScroll(h*this._info_display.first_row_index);}}else{switch(where){case "top":body.scrollTop=pos;break;case "bottom":body.scrollTop=pos+h-bh;break;case "center":body.scrollTop=(2*pos+h-bh)/2;break;}}};P.scrollHome=function(){this.getBodyDiv().scrollTop=0;};P.scrollEnd=function(){this.getBodyDiv().scrollTop=this._getVSHeightDiv().offsetHeight;};P.scrollPage=function(page){var b=this.getBodyDiv();b.scrollTop+=page*b.clientHeight-20;};P._handle_focusKeys=function(ev){var sel=this._selection,k=ev.keyCode,c=ev.charCode,rs=this._records;switch(k){case DlKeyboard.ARROW_DOWN:var index=-1;if(sel._last!=null)index=rs.id_to_pos[sel._last];if(ev.shiftKey&&sel.multiple){var ids=rs.array.slice(index,index+2);sel.select(ids);sel._last=ids.peek();}else{index=rs.array.limitIndex(index+1);var id=rs.array[index];sel.reset([id]);sel._last=id;}this.scrollToRecord();EX();break;case DlKeyboard.ARROW_UP:var index=rs.array.length;if(sel._last!=null)index=rs.id_to_pos[sel._last];if(ev.shiftKey&&sel.multiple){var ids=rs.array.slice(index-1,index);sel.select(ids);sel._last=ids.peek();}else{index=rs.array.limitIndex(index-1);var id=rs.array[index];sel.reset([id]);sel._last=id;}this.scrollToRecord();EX();break;case DlKeyboard.HOME:this.scrollHome();EX();break;case DlKeyboard.END:this.scrollEnd();EX();break;case DlKeyboard.PAGE_UP:this.scrollPage(-1);EX();break;case DlKeyboard.PAGE_DOWN:this.scrollPage(1);EX();break;}BASE._handle_focusKeys.call(this,ev);};P._makeHeadLabel=function(args){return new this._headType(args);};P._onHeadClick=function(col,btn){if(col.isSortable()){col=col.id();var prev=this.__sortCol||null;var rev=null;if(col==prev){rev=true;if(this.__sortRev)rev=!rev;}this.__sortRev=rev;this._data.sort(this._records.array,col,prev,rev,function(ids){this.resetIDS(ids);this.refreshDisplay();this.setSortColumn(col,rev);},this);}};P.setSortColumn=function(col,rev){var prev=this.__sortCol;if(prev){prev=this._colsById[prev];prev._button.delClass(/DlDataGridHeadLabel-sort-[^\s]+/g);}this.__sortCol=col;if(col)this._colsById[col]._button.condClass(rev,"DlDataGridHeadLabel-sort-down","DlDataGridHeadLabel-sort-up");};P.getSortColumn=function(){return this.__sortCol;};P.getSortReverse=function(){return this.__sortRev;};P.getCol=function(col){if(!(col instanceof DlGridCol))col=this._colsById[col];return col;};P.getRec=function(rec){if(!(rec instanceof DlRecord))rec=this._data.get(rec);return rec;};P.setColWidth=function(col,w){col=this.getCol(col);col._width=w;this._ss.modifyRule(col._cssRule,{width:w+"px"});};P.setColVisible=function(col,v){col=this.getCol(col);this._ss.modifyRule(col._cssRule,{display:v?"":"none"});col._isVisible=!!v;};P.getColWidth=function(col){col=this.getCol(col);return this.getHeaderRow().cells[col.index].offsetWidth;};P._getDragObject=function(){if(!this.__drag){this.__drag=new DlGridDragCol({});}return this.__drag;};P._fetchRowContentHTML=function(buf,rec){buf("<table class='DlDataGrid-rowTable' cellspacing='0' cellpadding='0'><tr>");var cols=this._cols,n=cols.length,d=this._data,col,id,cn,i;for(i=0;i<n;++i){col=cols[i];if (!col._isVisible) {continue;}id=col.id();buf("<td colid='",id,"' class='DlDataGrid-col-",id);cn=d.getCellClass(rec,col.id());if(cn)buf(" ",cn);buf("'>");if(is_ie)buf("<div class='DlDataGrid-cellData'>");d.formatHTML(rec,col.id(),buf);if(is_ie)buf("</div>");buf("</td>");}buf("</tr></table>");};P._fetchRowHTML=function(buf,rec){var cls='DlDataGrid-row',tmp=this._data.getRecClass(rec);if(tmp)cls+=' '+tmp;if(this.rec_isSelected(rec))cls+=' DlDataGridRow-selected';buf("<div id='",this.id,':',rec.id(),"' class='",cls,"' recid='",rec.id(),"'>");this._fetchRowContentHTML(buf,rec);buf("</div>");};P.getRowElement=function(rec_id){return document.getElementById(this.id+":"+rec_id);};P.refreshDisplay=function(){this._oldScroll=null;var body=this.getBodyDiv(),st=body.scrollTop;var rc=this.getRowsContainer();var a=this._records.array;var info=this._info_display;if(this._rpp&&a.length<this._rpp)this.displayPage(0);if(this._rpp){var h=Math.floor(rc.offsetHeight/rc.childNodes.length);var frv=Math.ceil(st/h)-1;if(frv<0)frv=0;var lrv=Math.floor((st+body.clientHeight)/h);if(lrv>=a.length)lrv=a.length-1;var ids=a.slice(frv,frv+this._rpp);this._display_ids(ids,h*frv);}};P.__doLayout=function(){var size=this.getInnerSize();var body=this.getBodyDiv();var header=this.getHeaderDiv();DOM.setOuterSize(body,size.x,size.y-header.offsetHeight);DOM.setOuterSize(header,size.x,null);this._resetVSHeight();if(this._records&&this._records.array.length>0){this._oldScroll=null;onBodyScroll.call(this);}this._recompDynamicWidths();};P.getBoundRecords=function(){var body=this.getBodyDiv(),st=body.scrollTop;var rc=this.getRowsContainer();var a=this._records.array;var rh=rc.offsetHeight;if(rh==0)return this.__boundRecords;var h=Math.floor(rh/rc.childNodes.length);var frv=Math.ceil(st/h)-1;if(frv<0)frv=0;var lrv=Math.floor((st+body.clientHeight)/h);if(lrv>=a.length)lrv=a.length-1;return this.__boundRecords={first:frv,last:lrv,count:lrv-frv+1,h:h};};function onBodyScroll(){if(this._processing_scroll)return;this._processing_scroll=true;var body=this.getBodyDiv(),st=body.scrollTop;this.getHeaderTable().style.marginLeft=-body.scrollLeft+"px";if(this._vScroll&&this._records&&st!=this._oldScroll){var rc=this.getRowsContainer();var a=this._records.array;var info=this._info_display;var h=this.getBoundRecords();var frv=h.first;var lrv=h.last;h=h.h;if(frv>=info.first_row_index&&lrv<=info.last_row_index){}else if(lrv<info.first_row_index||frv>info.last_row_index){var ids=a.slice(frv,frv+this._rpp);this._display_ids(ids,h*frv);}else if(frv<info.first_row_index){var ids=a.slice(frv,info.first_row_index);this.__scrollConts++;this.__cont=function(records){var buf=String.buffer("<div>"),n=records.length;records.foreach(this._fetchRowHTML.$(this,buf));buf("</div>");var html=buf.get();var div=DOM.createFromHtml(html),df;try{var r=document.createRange(),c=rc.childNodes;r.selectNodeContents(div);df=r.extractContents();r.detach();r=document.createRange();r.setStartBefore(c[c.length-n]);r.setEndAfter(c[c.length-1]);r.deleteContents();}catch(ex){if(!df)df=document.createDocumentFragment();while(div.firstChild){rc.removeChild(rc.lastChild);df.appendChild(div.firstChild);}}rc.insertBefore(df,rc.firstChild);this._setVScroll(h*frv);info.first_row_index=frv;info.last_row_index-=n;};this._fetch_data(ids,-1,function(records){this.__scrollConts--;if(this.__scrollConts==0)this.__cont(records);});}else if(lrv>info.last_row_index){var ids=a.slice(info.last_row_index+1,lrv+1);this.__scrollConts++;this.__cont=function(records){var buf=String.buffer("<div>"),n=records.length;records.foreach(this._fetchRowHTML.$(this,buf));buf("</div>");var html=buf.get();var div=DOM.createFromHtml(html),df;try{var r=document.createRange();r.selectNodeContents(div);df=r.extractContents();r.detach();r=document.createRange();r.setStartBefore(rc.firstChild);r.setEndBefore(rc.childNodes[n]);r.deleteContents();}catch(ex){if(!df)df=document.createDocumentFragment();while(div.firstChild){rc.removeChild(rc.firstChild);df.appendChild(div.firstChild);}}rc.appendChild(df);this._setVScroll(this._getVSScrollDiv().offsetHeight+(h*n));info.first_row_index+=n;info.last_row_index=lrv;};this._fetch_data(ids,1,function(records){this.__scrollConts--;if(this.__scrollConts==0)this.__cont(records);});}this._oldScroll=st;}this.callHooks("onBodyScroll");this._processing_scroll=false;};})();(function(){DlDragDataGrid.inherits(DlDrag);function DlDragDataGrid(args){if(args){DlDrag.call(this,args);}};eval(Dynarch.EXPORT("DlDragDataGrid"));P.startOK=function(body,ev){var grid=body.parent,found=false,el=ev.target;while(el&&el!=body.getElement()){if(el==grid._getVSHeightDiv()){found=true;break;}el=el.parentNode;}if(found&&grid._selection.getArray().length>0)this.grid=grid;else found=false;return found;};P.reset=function(){this.grid=null;D.BASE.reset.apply(this,arguments);};})();(function(){var BASE=DlDesktop.inherits(DlContainer);function DlDesktop(args){if(args){D.setDefaults(this,args);DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlDesktop"));D.DEFAULT_ARGS={_bounds:["bounds",new DlRect(50,30,800,600)]};P._createElement=function(){BASE._createElement.call(this);var div=this.getElement();this._bounds.positionDiv(div);document.body.appendChild(div);};var resizeDivID=Dynarch.ID("IEsux");IEresize=function(){var tmp=document.getElementById(resizeDivID);if(!tmp){tmp=document.createElement("div");tmp.style.position="absolute";tmp.style.right=tmp.style.bottom=tmp.style.width=tmp.style.height="0px";tmp.style.zIndex="-100";document.body.appendChild(tmp);}this.setSize({x:tmp.offsetLeft,y:tmp.offsetTop+tmp.offsetHeight});};P.fullScreen=function(){var s=this.getElement().style;s.top="0px";s.left="0px";s.width="100%";s.height="100%";var handler;if(!is_ie)handler=this.callHooks.$(this,"onResize");else handler=IEresize.$(this);DynarchDomUtils.addEvent(window,"resize",handler.clearingTimeout(25));};})();(function(){var BASE=DlTable.inherits(DlContainer);function DlTable(args){if(args){D.setDefaults(this,args);args.tagName="table";this._colSpan=0;DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlTable",true));D.DEFAULT_ARGS={__cellSpacing:["cellSpacing",null],__cellPadding:["cellPadding",null],__align:["align",null]};P._createElement=function(){BASE._createElement.call(this);var el=this.getElement();if(this.__cellPadding!=null)el.cellPadding=this.__cellPadding;if(this.__cellSpacing!=null)el.cellSpacing=this.__cellSpacing;if(this.__align!=null)el.align=this.__align;CE("tbody",null,null,el);};P.getContentElement=function(){return this.getElement().firstChild;};P.addRow=function(){return new DlTableRow({parent:this});};P.getRow=function(index){return this.children(index);};P.addCell=function(row,align,valign){var cell=new DlTableCell({parent:row});if(align!=null)cell.addClass("DlAlign-"+align);if(valign!=null){var s=cell.getElement().style;s.verticalAlign=valign;}var index=cell.getElement().cellIndex+1;if(index>this._colSpan)this._colSpan=index;return cell;};P.getColSpan=function(){return this._colSpan;};P.setColSpan=function(colSpan){this._colSpan=colSpan;};P.addSeparator=function(span){if(span==null)span=this.getColSpan();CE("div",null,{innerHTML:"&nbsp;"},CE("td",null,{colSpan:span},CE("tr",null,{className:"DlTable-RowSeparator"},this.getContentElement())));};})();DlTableRow.inherits(DlContainer);function DlTableRow(args){if(args){args.tagName="tr";DlContainer.call(this,args);}};DlTableCell.inherits(DlContainer);function DlTableCell(args){if(args){args.tagName="td";DlContainer.call(this,args);}};(function(){var BASE=DlFieldGrid.inherits(DlTable);function DlFieldGrid(args){if(args){DlTable.call(this,args);this.__fields={};}};eval(Dynarch.EXPORT("DlFieldGrid"));P.addField=function(args,opts,ret){var entry=args.widget||new DlEntry(args);var label=args.label;if(!opts)opts={};if(label){if(!(label instanceof DlWidget)){label=new DlLabel({label:args.label.makeLabel(),widget:entry});}else if(label instanceof DlLabel){label.setWidget(entry);}}var row=this.addRow();var c1=this.addCell(row,"right",args.valign);if(args.valign=="top"&&(label instanceof DlLabel))c1.getElement().style.paddingTop="4px";if(label)c1.appendWidget(label);if(opts.middleText){var tmp=this.addCell(row);tmp.setContent(opts.middleText);}var c2=this.addCell(row);c2.appendWidget(entry);var id=args.id||args.name;if(id!=null){this.__fields[id]=entry.getWidgetId();delete args["id"];}if(opts){var el=c2.getElement();if(opts.colSpan)el.colSpan=opts.colSpan;if(opts.rowSpan)el.rowSpan=opts.rowSpan;}if(ret){ret.row=row;ret.c1=c1;ret.c2=c2;ret.label=label;ret.entry=entry;}return entry;};P.getField=function(id){return id?DlWidget.getById(this.__fields[id]):this.__fields;};P.setField=function(name,widget){this.__fields[name]=widget.getWidgetId();};P.getValue=function(){var val={};for(var name in this.__fields){var w=this.getField(name);if(w.getValue instanceof Function){if(w instanceof DlAbstractButton&&w._checkTwoState(true)){var v=w.getValue();if(v==null){val[name]=w.checked();}else if(w.checked()){val[name]=v;}}else{val[name]=w.getValue();}}}return val;};P.getValues=P.getValue;P.setValue=function(hash){for(var name in hash){var w=this.getField(name),v=hash[name];if(w&&w.setValue instanceof Function){if(w instanceof DlAbstractButton&&w._checkTwoState(true)){w.checked(typeof v=="string"?v!="0":!!v);}else{w.setValue(v);}}}};P.setValues=P.setValue;})();(function(){var BASE=DlFieldset.inherits(DlContainer);function DlFieldset(args){if(args){D.setDefaults(this,args);DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlFieldset",true));D.DEFAULT_ARGS={_label:["label","DlFieldset"]};P._createElement=function(){BASE._createElement.call(this);this.getElement().innerHTML=["<span class='DlFieldset-label'>",this._label,"</span>","<div class='DlFieldset-content'></div>"].join("");};P.getContentElement=function(){return this.getElement().childNodes[1];};P.getLabelElement=function(){return this.getElement().firstChild;};P.setOuterSize=P.setSize=function(sz){var p1=DOM.getPos(this.getLabelElement()),p2=DOM.getPos(this.getContentElement()),diff=p2.y-p1.y;DOM.setOuterSize(this.getElement(),sz.x,sz.y-diff);sz=DOM.getInnerSize(this.getElement());DOM.setOuterSize(this.getContentElement(),sz.x,sz.y);this.callHooks("onResize");};})();(function(){var CTORS={},OBJECTS={};window.DlSingleton={get:function(type,noCreate){return OBJECTS[type]||!noCreate&&(OBJECTS[type]=new CTORS[type]());},register:function(type,ctor,globalize){CTORS[type]=ctor;if(globalize)window[type]=this.get.$C(type);}};})();(function(){var DEFAULT_EVENTS=["onLoad","onStorageStatus"];DlFlashUtils.inherits(DlEventProxy);function DlFlashUtils(){DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);};var P=DlFlashUtils.prototype;var HTML=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" />');var OBJ=null;window.DlFlashUtils_init=function(o){DlSingleton.get("DlFlashUtils").callHooks("onLoad");};P.init=function(){if(!OBJ){var html=HTML({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;'>"+html+"</div>");OBJ=document.getElementById('DlFlashUtils-MOVIE');}};P.getObject=function(){return OBJ;};P.display=function(disp){OBJ.parentNode.style.left=disp?"50%":"-256px";};{function getAXVersion(obj){var v=null;try{v=obj.GetVariable("$version");}catch(ex){}return v;};var IE_DETECT={"ShockwaveFlash.ShockwaveFlash.7":getAXVersion,"ShockwaveFlash.ShockwaveFlash.6":function(obj){var version="Win 6,0,21";try{obj.AllowScriptAccess="always";version=getAXVersion(obj);}catch(ex){}return version;},"ShockwaveFlash.ShockwaveFlash":getAXVersion};}P.isSupported=function(){var p=navigator.plugins;if(p&&p.length){p=p["Shockwave Flash"];if(p&&p.description&&/^Shockwave Flash\s+([^\s]+)/i.test(p.description))return parseFloat(RegExp.$1)>=8;}else if(is_ie){for(var i in IE_DETECT){try{var obj=new ActiveXObject(i);if(obj){var v=IE_DETECT[i](obj);if(v!=null){v=v.split(/\s+/)[1];return parseFloat(v)>=8;}}}catch(ex){}}}return false;};P.loadPolicyFile=function(addr){return this.getObject().DlSocket_loadPolicyFile(addr);};DlSingleton.register("DlFlashUtils",DlFlashUtils,true);var decodeString=P.decodeString=function(str){return str.replace(/%22/g,"\"").replace(/%5c/g,"\\").replace(/%26/g,"&").replace(/%25/g,"%");};var decodeObject=P.decodeObject=function(obj){var i,tmp;if(obj instanceof Array){for(i=obj.length;--i>=0;)obj[i]=decodeObject(obj[i]);}else if(typeof obj=="object"){if(obj==null)return obj;tmp={};for(i in obj)tmp[decodeString(i)]=decodeObject(obj[i]);obj=tmp;}else if(typeof obj=="string"){obj=decodeString(obj);}return obj;};})();DlFlashStore={set:function(key,val){DlFlashUtils().getObject().DlStorage_set(key,val);},get:function(key){return DlFlashUtils().decodeObject(DlFlashUtils().getObject().DlStorage_get(key));},getAllKeys:function(){return DlFlashUtils().decodeObject(DlFlashUtils().getObject().DlStorage_getAllKeys());},remove:function(key){DlFlashUtils().getObject().DlStorage_remove(key);},clear:function(){DlFlashUtils().getObject().DlStorage_clear();},flush:function(showUI){var val=DlFlashUtils().getObject().DlStorage_flush();if(showUI&&val=="pending"){DlFlashUtils().display(true);}return val;},_onStatus:function(info){DlFlashUtils().display(false);DlFlashUtils().applyHooks("onStorageStatus",[info]);}};(function(){var BASE=DlGridLayout.inherits(DlLayout);function DlGridLayout(args){if(args){D.setDefaults(this,args);DlLayout.call(this,args);}};eval(Dynarch.EXPORT("DlGridLayout",true));D.DEFAULT_ARGS={__layout:["layout",null],__layoutHTML:["layoutHTML",null],__cellSpacing:["cellSpacing",0],__cellPadding:["cellPadding",1]};var CELL_STYLE_PROPS=["width","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","verticalAlign","textAlign","whiteSpace"];P._createElement=function(){BASE._createElement.call(this);var table;if(!this.__layoutHTML){table=CE("table",null,{cellSpacing:this.__cellSpacing,cellPadding:this.__cellPadding,className:"DlGridLayout-table"});CE("tbody",null,null,table);var rows=this.__layout;rows.foreach(function(row){var row_props=row.props;var tr=table.insertRow(-1);if(row_props&&row_props.minHeight){AC(tr,"DlGridLayout-tr-minHeight");tr.minHeight=true;}row.cells.foreach(function(cell,i){var td=tr.insertCell(-1);if(i==0&&row_props&&row_props.height){td.style.height=row_props.height;}if(cell){if(cell.colSpan)td.colSpan=cell.colSpan;if(cell.className)td.className=cell.className;if(cell.rowSpan)td.rowSpan=cell.rowSpan;if(cell.minWidth)AC(td,"DlGridLayout-td-minWidth");if(cell.minHeight){td.minHeight=true;AC(td,"DlGridLayout-td-minHeight");}CELL_STYLE_PROPS.r_foreach(function(prop){var val=cell[prop];if(val!=null)this[prop]=val;},td.style);}});});this.getElement().appendChild(table);}else{this.setContent(this.__layoutHTML);table=this.getElement().getElementsByTagName("table")[0];}this.refNode("__table",table);};P._appendWidgetElement=function(w,pos){if(pos.inCell){var td=this.getCellElement(pos.row,pos.col);td.appendChild(w.getElement());w._dllayout_args=pos;}else BASE._appendWidgetElement.call(this,w,pos);};P._removeWidgetElement=function(w){if(this._widgets.contains(w)){if(!w._dllayout_args.inCell)BASE._removeWidgetElement.call(this,w);else{var el=w.getElement();el.parentNode.removeChild(el);}}};P.getTableElement=function(){return this.__table;};P.getCellElement=function(row,col){return this.getTableElement().rows[row].cells[col];};P.doLayout=function(){var wa=this.children();(2).times(function(iteration){wa.foreach(function(wid){var pos=wid._dllayout_args;if(!pos.inCell){var td=this.getCellElement(pos.row,pos.col);var x=td.offsetLeft,y=td.offsetTop;var w=td.offsetWidth,h=td.offsetHeight;if(iteration==0){var sz=wid.getOuterSize();if((td.minHeight||td.parentNode.minHeight)&&h<sz.y){td.style.height=sz.y+"px";}}else{var div=wid.getElement().parentNode.style;div.left=x+"px";div.top=y+"px";wid.setOuterSize({x:w,y:h});}}},this);},this);};P.showWidgets=function(show){if(arguments.length==0)show=true;this.children().r_foreach(function(w){w.display(show);});};})();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(el){return el&&el.nodeType==1&&(el.tagName.toLowerCase()in DlHtmlUtils._blockTags);},needsClosingTag:function(el){return el&&el.nodeType==1&&!(el.tagName.toLowerCase()in DlHtmlUtils._quickTags);},htmlEncode:function(s){return s.htmlEscape();},getHTML:function(root,outputRoot,withMeta){var D=DlHtmlUtils;var html=[];var hi=0;var needsClosingTag=D.needsClosingTag;var htmlEncode=D.htmlEncode;var getText=D.getInnerText;var title=null;var description=null;var content_start=null;var descTags=D._descTags;var headingTags=D._headingTags;var newlineMode=0;function rec(root,outputRoot){switch(root.nodeType){case 11:outputRoot=false;case 1:var tag=root.tagName.toLowerCase();if(root.className=="DynarchLIB-REMOVE-ME")break;if(outputRoot){var closed=!(root.hasChildNodes()||needsClosingTag(root));if(tag=="br"){if(root.previousSibling&&!root.nextSibling)break;if(newlineMode){html[hi++]="\n";break;}}if(withMeta){if(title==null&&tag in headingTags){title=getText(root);content_start=0;}else if(description==null&&tag in descTags){description=getText(root);}}html[hi++]="<";html[hi++]=tag;var attrs=root.attributes;for(var i=0;i<attrs.length;++i){var a=attrs.item(i);if(!a.specified)continue;var name=a.nodeName.toLowerCase();if(/^_moz|^_msh/.test(name))continue;var value;if(name!="style"){if(typeof root[a.nodeName]!="undefined"&&name!="href"&&name!="src"&&!/^on/.test(name))value=root[a.nodeName];else value=a.nodeValue;}else value=root.style.cssText;if(/(_moz|^$)/.test(value))continue;html[hi++]=" "+name+'="'+value+'"';}html[hi++]=closed?" />":">";}if(tag=="pre")++newlineMode;for(i=root.firstChild;i;i=i.nextSibling)rec(i,true);if(tag=="pre")--newlineMode;if(outputRoot&&!closed)html[hi++]="</"+tag+">";if(content_start===0)content_start=hi;break;case 3:if(/^(script|style)$/i.test(root.parentNode.tagName)){if(root.data.indexOf("/*<![CDATA[*/")!=0){html[hi++]="/*<![CDATA[*/";html[hi++]=root.data;html[hi++]="/*]]>*/";}else{html[hi++]=root.data;}}else html[hi++]=htmlEncode(root.data);break;case 4:case 8:html[hi++]="<!--";html[hi++]=root.data;html[hi++]="-->";break;}};rec(root,outputRoot);var content=html.join("");if(withMeta){content={title:title,description:description,content:content,contentButTitle:""};if(content_start)content.contentButTitle=html.slice(content_start).join("");}return content;},getInnerText:function(el){if(el.innerText!=null)return el.innerText;if(el.textContent!=null)return el.textContent;},getText:function(node){var tmp=node.cloneNode(true);var a=tmp.getElementsByTagName("*");for(var i=a.length;--i>=0;){var el=a[i];if(DlHtmlUtils.isBlockElement(el)){var sep=el.ownerDocument.createTextNode(" ");el.insertBefore(sep,el.firstChild);el.appendChild(sep.cloneNode(true));}}var txt=DlHtmlUtils.getInnerText(tmp);DynarchDomUtils.trash(tmp);return txt;},_can_t_DeleteFull_tags:"td".hashWords(),canDeleteFullNode:function(tag){return!(tag.toLowerCase()in DlHtmlUtils._can_t_DeleteFull_tags);},_can_t_DeleteContent_tags:"ul ol dd table tr img br hr".hashWords(),canDeleteContent:function(tag){return!(tag.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(tag){return!(tag.toLowerCase()in DlHtmlUtils._can_t_StripNode_tags);}};DlIconListView.inherits(DlContainer);function DlIconListView(args){if(args)DlContainer.call(this,args);};(function(){var CLS={active:"DlIconListItem-active",hover:"DlIconListItem-hover",checked:"DlIconListItem-1",unchecked:"DlIconListItem-0",empty:"DlIconListItem-empty",disabled:"DlIconListItem-disabled"};var BASE=DlIconListItem.inherits(DlAbstractButton);function DlIconListItem(args){if(args){DlIconListItem.setDefaults(this,args);DlAbstractButton.call(this,args);}};eval(Dynarch.EXPORT("DlIconListItem"));D.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",CLS],_iconClass:["iconClass",null]};var ICON_LABEL_CLASSES=["DlIconListItem-iconCell","DlIconListItem-labelCell"];P._createElement=function(){DlWidget.prototype._createElement.call(this);var table=this.getElement();table.cellSpacing=table.cellPadding=0;if(this.__spaceEvenly)table.style.margin=this.__itemSpacing+"px";else table.style.marginRight=table.style.marginBottom=this.__itemSpacing+"px";table.insertRow(-1).insertCell(-1);table.insertRow(-1).insertCell(-1);table.align="left";this.setIconAbove(this.__iconAbove,true);this.setIconClass(this._iconClass);this.label(this._label,true);this.setIconSize(this.__iconSize);this._updateState();};P.setIconClass=function(className){this.getIconCell().className=ICON_LABEL_CLASSES[0]+" "+className;};P.getIconCell=function(){return this.getElement().rows[this.__iconAbove?0:1].cells[0];};P.getLabelCell=function(){return this.getElement().rows[this.__iconAbove?1:0].cells[0];};P.setIconSize=function(sz){DynarchDomUtils.setInnerSize(this.getIconCell(),sz.x,sz.y);this.__iconSize=sz;};P.getIconSize=function(){return this.__iconSize;};P.setIconAbove=function(ia,init){var rows=this.getElement().rows;if(init){rows[0].cells[0].className=ICON_LABEL_CLASSES[ia?0:1];rows[1].cells[0].className=ICON_LABEL_CLASSES[ia?1:0];}else if(ia!==this.__iconAbove){rows[1].parentNode.insertBefore(rows[1],rows[0]);}this.__iconAbove=ia;};P.label=function(label,force){if(label!=null&&(force||label!==this._label)){this._label=label;this.getLabelCell().innerHTML=String.buffer("<div class='DlIconListItem-labelDiv' style='width:",this.__itemSize.x,"px'>",label,'</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(obj){var tmp,i;if(obj instanceof Array){tmp=["[",obj.map(DlJSON.encode).join(","),"]"].join("");}else if(obj instanceof Date){tmp=DlJSON.encode(obj.toUTCString());}else if(obj==null){tmp="null";}else if(typeof obj=="object"){tmp=[];for(i in obj)tmp.push([DlJSON.encode(i),":",DlJSON.encode(obj[i])].join(""));tmp=["{",tmp.join(","),"}"].join("");}else if(typeof obj=="string"){tmp=['"',obj.replace(/\x5c/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\x22/g,"\\\""),'"'].join("");}else tmp=obj.toString();return tmp;},decode:function(str,safe){str=str.trim();if(!safe){var tmp=str.replace(DlJSON.RE_strings,"");if(DlJSON.RE_forbid.test(tmp))throw new DlSecurityException("Character "+RegExp.$1+" not allowed in JSON input!");}try{var val;eval(["val=",str].join(""));return val;}catch(ex){throw new DlDataException("Malformed data in JSON input: "+ex);}},domToObject:function(el){var obj={};var text=String.buffer();for(var i=el.firstChild;i;i=i.nextSibling){if(i.nodeType==1){var o=DlJSON.domToObject(i),tag=i.nodeName;if(!(tag in obj)){obj[tag]=o;}else{if(!(obj[tag]instanceof Array))obj[tag]=[obj[tag]];obj[tag].push(o);}}else if(i.nodeType==3){text(i.nodeValue);}}obj.$text=text.get();return obj;}};var DlKeyboard={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,DELETE:46,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,parseKey:function(str){var o={},m;str=str.toUpperCase();if(m=/^([a-z]+)\s+\x27(.)\x27$/i.exec(str)){o[m[1]]=true;o.key=m[2];}else if(m=/^([a-z]+)-([a-z]+)\s+\x27(.)\x27$/i.exec(str)){o[m[1]]=o[m[2]]=true;o.key=m[3];}else if(m=/^([a-z]+)-([a-z]+)-([a-z]+)\s+\x27(.)\x27$/i.exec(str)){o[m[1]]=o[m[2]]=o[m[3]]=true;o.key=m[4];}return o;},checkKey:function(ev,k){if(typeof k=="string")k=DlKeyboard.parseKey(k);return(((!k.CTRL&&!ev.ctrlKey)||(k.CTRL&&ev.ctrlKey))&&((!k.ALT&&!ev.altKey)||(k.ALT&&ev.altKey))&&((!k.SHIFT&&!ev.shiftKey)||(k.SHIFT&&ev.shiftKey))&&ev.keyStr.toUpperCase()==k.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);(function(){var BASE=DlLabel.inherits(DlAbstractButton);function DlLabel(args){if(args){args.tagName=args.tagName||"span";D.setDefaults(this,args);DlAbstractButton.call(this,args);}};eval(Dynarch.EXPORT("DlLabel"));D.DEFAULT_ARGS={_activateWidget:["widget",null]};P._onMouseDown=function(ev){var w=this._activateWidget;if(w){w.focus();ev.domStop=true;DlException.stopEventBubbling();}};P.setWidget=function(widget){this._activateWidget=widget;};P.getWidget=function(){return this._activateWidget;};P._handle_accessKey=function(ev){this._onMouseDown(ev);};})();(function(){var BASE=DlMacBarIcon.inherits(DlAbstractButton);function DlMacBarIcon(args){if(args){DlMacBarIcon.setDefaults(this,args);this.__currentWidth=this.__minWidth;this.__currentHeight=this.__minHeight;this.__align=this.__align.split(/\s+/).toHash();DlAbstractButton.call(this,args);}};eval(Dynarch.EXPORT("DlMacBarIcon"));var CLS={active:"DlMacBarIcon-active",hover:"DlMacBarIcon-hover",checked:"DlMacBarIcon-1",unchecked:"DlMacBarIcon-0",empty:"DlMacBarIcon-empty",disabled:"DlMacBarIcon-disabled"};D.DEFAULT_ARGS={_classes:["classes",CLS],__image:["img",null],__minWidth:["minWidth",32],__minHeight:["minHeight",32],__maxWidth:["maxWidth",64],__maxHeight:["maxHeight",64],__align:["align","bottom"],__tooltipTimeout:["tooltipTimeout",900]};P._createElement=function(){DlWidget.prototype._createElement.call(this);this.setContent(String.buffer("<img src='",this.__image,"' width='",this.__minWidth,"' height='",this.__minHeight," ' />").get());};P.getImgElement=function(){return this.getElement().firstChild;};P.flash=function(timeout){this._onMouseEnter();this._onMouseLeave.delayed(timeout||100,this);};P.initDOM=function(){BASE.initDOM.call(this);this.addEventListener({onDestroy:onDestroy});this.__anim=new DlAnimation(25,40);this.__anim.addEventListener({onUpdate:onAnimationUpdate.$(this),onStart:onAnimationStart.$(this)});};function onDestroy(){this.__anim.destroy();};P._onMouseEnter=function(){BASE._onMouseEnter.apply(this,arguments);var a=this.__anim;a.ew=this.__maxWidth;a.eh=this.__maxHeight;a.start(30,50,DlAnimation.easing.elastic_b);};P._onMouseLeave=function(){BASE._onMouseLeave.apply(this,arguments);var a=this.__anim;a.ew=this.__minWidth;a.eh=this.__minHeight;a.start(50,50,DlAnimation.easing.accel_b);};function onAnimationStart(){this.__anim.sw=this.__currentWidth;this.__anim.sh=this.__currentHeight;};function onAnimationUpdate(){var a=this.__anim,img=this.getImgElement(),y=a.getPos(),mt;var yy=a.getPos(function(x){return 1-Math.cos(x*2.5*Math.PI)/Math.exp(5*x);});img.width=this.__currentWidth=y.mapInt(a.sw,a.ew);img.height=this.__currentHeight=yy.mapInt(a.sh,a.eh);a=this.__align;mt=this.__minWidth-this.__currentWidth;if(a.center)mt/=2;if(a.left||a.center)img.style.marginRight=mt+"px";if(a.right||a.center)img.style.marginLeft=mt+"px";mt=this.__minHeight-this.__currentHeight;if(a.middle)mt/=2;if(a.top||a.middle)img.style.marginBottom=mt+"px";if(a.bottom||a.middle)img.style.marginTop=mt+"px";};})();(function(){var BASE=DlNotebook.inherits(DlContainer);function DlNotebook(args){if(args){DlContainer.call(this,args);this._panes=[];this._currentPane=null;}};eval(Dynarch.EXPORT("DlNotebook"));var DEFAULT_EVENTS=["onChange"];P._createElement=function(){BASE._createElement.call(this);this.getElement().innerHTML="<div class='TabContent-inner'></div>";};P.appendWidget=function(w,pos){w.registerEvents(["onNotebookShow"]);BASE.appendWidget.call(this,w);var el=w.getElement();var cont=this.getContentElement();if(pos!=null)pos=this.__widgetsPosition;else this.__widgetsPosition=pos;if(pos==null)pos=this.__widgetsPosition=DynarchDomUtils.getPadding(cont).x/2;el.style.position="absolute";el.style.visibility="hidden";el.style.left=el.style.top=pos+"px";cont.appendChild(el);this._panes.push(w);};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);};P.getPane=function(index){return this._panes[index];};P.getAllPanes=function(){return this._panes};P.getCurrentPane=function(){return this.getPane(this._currentPane);};P.getCurrentPaneIndex=function(){return this._currentPane;};P.length=function(){return this._panes.length;};P.showPane=function(index){var old=this._currentPane;if(old!=null){this.getPane(old).visibility(false);this.getPane(old).setPos({x:-30000,y:-30000});}this._currentPane=index;var pane=this.getPane(index);if(!pane._dl_notebook_has_size){pane.setSize(this.getInnerSize());pane._dl_notebook_has_size=true;}pane.setPos(this.__widgetsPosition,this.__widgetsPosition);pane.visibility(true);if(index!==old)this.applyHooks("onChange",[index,old]);pane.callHooks("onNotebookShow");return this;};P.firstPane=function(){this.showPane(0);};P.lastPane=function(){this.showPane(this.length()-1);};P.nextPane=function(){var i=this._currentPane;i==null?i=0:++i;if(i>=this._panes.length)i=0;return this.showPane(i);};P.prevPane=function(){var i=this._currentPane;i==null?i=this._panes.length-1:--i;if(i<0)i=this._panes.length-1;return this.showPane(i);};P.isFirstPane=function(){return this._currentPane==0;};P.isLastPane=function(){return this._currentPane==this._panes.length-1;};P.getContentElement=function(){return this.getElement().firstChild;};P.setSize=P.setOuterSize=function(size){BASE.setOuterSize.call(this,size);var el=this.getElement();size=DynarchDomUtils.getInnerSize(el);DynarchDomUtils.setOuterSize(this.getContentElement(),size.x,size.y);el.style.width=el.style.height="";size=DynarchDomUtils.getInnerSize(this.getContentElement());var cp=this.getCurrentPane();this._panes.foreach(function(p){p._dl_notebook_has_size=false;});cp.setSize(size);cp._dl_notebook_has_size=true;};P.setIdealSize=function(){var size={x:0,y:0};this._panes.r_foreach(function(p){var s=p.getOuterSize();if(s.x>size.x)size.x=s.x;if(s.y>size.y)size.y=s.y;});this.setInnerSize(size);};})();(function(){var BASE=DlProgressBar.inherits(DlWidget);function DlProgressBar(args){if(args){D.setDefaults(this,args);DlWidget.call(this,args);}};eval(Dynarch.EXPORT("DlProgressBar"));D.DEFAULT_ARGS={__progress_minVal:["min",0],__progress_maxVal:["max",100],__progress_val:["val",0],__label:["label",null]};P._createElement=function(){BASE._createElement.call(this);var CE=DynarchDomUtils.createElement;var el=this.getElement();CE("div",null,{className:"DlProgressBar-fill"},el);CE("div",null,{className:"DlProgressBar-label",innerHTML:"&nbsp;"},el);this.setLabel(this.__label);this.setValue(this.__progress_val);};P._getLabelElement=function(){return this.getElement().lastChild;};P._getFillElement=function(){return this.getElement().firstChild;};P.getValue=function(){return this.__progress_val;};P.getMaxVal=function(){return this.__progress_maxVal;};P.getMinVal=function(){return this.__progress_minVal;};P.setValue=function(val){this.__progress_val=val;if(val>this.__progress_maxVal)val=this.__progress_maxVal;var diff=this.__progress_maxVal-this.__progress_minVal;var pos=val-this.__progress_minVal;var percent=100*pos/diff;if(!isNaN(percent)&&percent>=0){this._getFillElement().style.width=percent+"%";this._updateLabel(percent);}};P.setLabel=function(label){this.__label=label;this._updateLabel();};P._updateLabel=function(percent){var label=this.__label;if(percent==null)percent=0;if(label!=null){if(typeof label=="function")label=label(this,percent,this.__progress_val);else{label=label.replace(/%d/g,Math.round(percent)).replace(/%f/g,percent.toFixed(2)).replace(/%v/g,this.__progress_val);}if(!/\S/.test(label))label="&nbsp;";this._getLabelElement().innerHTML=label;}};P.reset=function(min,max,val,label){if(val==null)val=min;this.__progress_minVal=min;this.__progress_maxVal=max;if(arguments.length>3)this.__label=label;this.setValue(val);};})();DlRadioButton.inherits(DlCheckbox);function DlRadioButton(args){if(args){args.alwaysCheck=true;DlRadioButton.setDefaults(this,args);DlCheckbox.call(this,args);}};DlRadioButton.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"}]};DlRadioButton.prototype._className.remove("DlCheckbox");(function(){var BASE=DlRadioSelect.inherits(DlButtonMenu);function DlRadioSelect(args){if(args){D.setDefaults(this,args);DlButtonMenu.call(this,args);if(this._options.length)this.setOptions(this._options);this.value(this._value,true);}};eval(Dynarch.EXPORT("DlRadioSelect"));var DEFAULT_EVENTS=["onChange"];D.DEFAULT_ARGS={_options:["options",[]],_value:["value",null],_connected:["connected",true]};P.value=function(value,force,nocalls){var oldval=this._value;if(force||typeof value!="undefined"&&value!==oldval){this._value=value;this._updateLabel();if(!nocalls)this.applyHooks("onChange",[oldval,value]);}return oldval;};P.getValue=function(){return this.value();};P.setValue=P.value;function radioGroup_onChange(cb){if(cb.checked()){this.value(cb.userData);DlPopup.clearAllPopups();}cb._onMouseLeave();};P._updateLabel=function(){var label=null,a=this._options,i,o;for(i=a.length;--i>=0;){o=a[i];if(o==null)continue;if(this._value==o.value){this.getButton().label(o.label);o.widget.checked(true);}}};P._setListeners=function(){this.registerEvents(DEFAULT_EVENTS);BASE._setListeners.call(this);this._radioGroup=new DlRadioGroup(this.id);};P.setOptions=function(options){var g=this._radioGroup,menu,args;g.reset();g.addEventListener("onChange",radioGroup_onChange.$(this));menu=new DlVMenu({className:"DlSelect-menu"});args={parent:menu,group:g,noCapture:true};options.foreach(function(o){if(o==null)menu.addSeparator();else{args.label=o.label;args.data=o.value;args.className=o.className;var r=o.widget=new DlRadioButton(args);r.connectEvents("onMouseUp","onClick");}},this);var el=menu.getElement();el.style.position="absolute";menu.zIndex(-100);document.body.appendChild(el);var width=menu.getOuterSize().x;document.body.removeChild(el);menu.zIndex("");el.style.position="";(function(){this.getButton().setOuterSize({x:width-this.getArrow().getOuterSize().x+2});}).$(this).delayed(10);this.setMenu(menu);this._options=options;};P.addOption=function(opt,index){if(index==null)index=this._options.length;var item=opt.widget=new DlRadioButton({parent:this._menu,group:this._radioGroup,noCapture:true,label:opt.label,data:opt.value,className:opt.className});item.connectEvents("onMouseUp","onClick");this._options.splice(index,0,opt);return item;};P.initDOM=function(){BASE.initDOM.call(this);};})();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};(function(){DlSystem.inherits(DlEventProxy);function DlSystem(){DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);};var 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"];DlSingleton.register("DlSystem",DlSystem,true);})();(function(){var BASE=DlRPC.inherits(DlEventProxy);function DlRPC(args){if(args){DlEventProxy.call(this);DlRPC.setDefaults(this,args);this.registerEvents(DEFAULT_EVENTS);if(this.method==null)this.method=this.data!=null?"POST":"GET";this._timeoutID=0;}};eval(Dynarch.EXPORT("DlRPC"));var DEFAULT_EVENTS=["onStart","onStop","onTimeout"];D.DEFAULT_ARGS={url:["url",null],args:["args",null],callback:["callback",null],method:["method",null],data:["data",null],timeout:["timeout",null]};function onState(req){if(req.readyState==4){delete req['onreadystatechange'];this._request=null;if(this._timeoutID){clearTimeout(this._timeoutID);this._timeoutID=null;}var args;try{args={success:req.status==200,status:req.status,statusText:req.statusText,timeout:false,xml:req.responseXML,text:req.responseText};}catch(ex){};DlSystem().applyHooks("on-rpc-stop",[this,args,req]);this.applyHooks("onStop",[this,args,req]);if(this.callback)this.callback(args);}};function onTimeout(req){this._request=null;req.abort();DlSystem().applyHooks("on-rpc-timeout",[this,req]);this.applyHooks("onTimeout",[this,req]);if(this.callback)this.callback({success:false,timeout:true});};P.abort=function(){this._request.abort();};P.call=function(newArgs){if(newArgs!=null)Dynarch.merge(this,newArgs);var req,urlargs=false,i;if(window.XMLHttpRequest){req=new XMLHttpRequest();}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");}else throw "Browser does not support XMLHttpRequest";this._request=req;req.onreadystatechange=onState.$(this,req);var args=this.args;if(args){urlargs=[];for(i in args)urlargs.push(escape(i)+"="+escape(args[i]));if(urlargs.length==0)urlargs=false;else urlargs=urlargs.join("&");}var url=this.url;switch(this.method){case "POST":var data=this.data;if(urlargs&&data)url+="?"+urlargs;req.open("POST",url,true);if(!data){req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");this._start(urlargs);}else{if(typeof data!="string"){data=DlJSON.encode(data);req.setRequestHeader("Content-Type","text/javascript; charset=UTF-8");}this._start(data);}break;case "GET":if(urlargs)url+="?"+urlargs;req.open("GET",url,true);this._start(null);break;}};P._start=function(data){if(this.timeout)this._timeoutID=onTimeout.delayed(this.timeout,this,this._request);else this._timeoutID=0;DlSystem().applyHooks("on-rpc-start",[this]);this.applyHooks("onStart",[this]);this._request.send(data);};})();(function(){var FORWARD_EVENTS=["mouseover","mouseout","mousemove","mousedown","mouseup","click","keydown","keyup","keypress","contextmenu"];var BR=is_gecko?"<br type='_moz' />":"";var INIT_HTML=('<!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>'+BR+'</p></body></html>');var BASE=DlRteFrame.inherits(DlWidget);function DlRteFrame(args){if(args){D.setDefaults(this,args);this.__eventProxy=eventProxy.$(this);this.callUpdateHooks=this.callUpdateHooks.clearingTimeout(40,this);DlWidget.call(this,args);if(this.__sections)this.setSections(this.__sections);}};eval(Dynarch.EXPORT("DlRteFrame",true));var DEFAULT_EVENTS=["onUpdate","onSectionChange"];D.DEFAULT_ARGS={__paragraphsMode:["useParagraphs",true],__sections:["sections",null],_focusable:["focusable",2],_tabChar:["tabChar","    "]};P.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 FORMATBLOCK_TAGS="h1 h2 h3 h4 h5 h6 p pre address blockquote".hashWords();P.SEMANTIC_TAGS={"bold":true,"italic":true,"strike":true,"subscript":true,"superscript":true,"indent":true,"underline":true,"outdent":true,"strikethrough":true,"strike":true};P.callUpdateHooks=function(){if(!this.destroyed)this.callHooks("onUpdate");};P.execCommand=function(cmd,param){this.focus();var ret;var doc=this.getIframeDoc();if(is_gecko)doc.execCommand("styleWithCSS",false,!(cmd in this.SEMANTIC_TAGS));if(this.COMMANDS[cmd]){cmd=this.COMMANDS[cmd];if(typeof param=="undefined")param=cmd.arg||"";cmd=cmd.id;}if(cmd=="formatblock"){if(is_ie){var h=this.getAncestorsHash();if(h.pre){if(param=="pre"){return;}var sel=this.getSelection(),r=this.getRange(sel);var r2=this.createRange();r2.moveToElementText(h.pre);r.setEndPoint("EndToEnd",r2);r.select();var newEl,newElHtml=String.buffer("<",param,">dummy</",param,">").get();if(r.compareEndPoints("StartToStart",r2)==0){h.pre.insertAdjacentHTML("beforeBegin",newElHtml);newEl=h.pre.previousSibling;}else{var html=r.htmlText,text=r.text;r.moveStart("character",-1);if(r.text.charAt(0)!=text.charAt(0))r.moveStart("character",1);h.pre.insertAdjacentHTML("afterEnd","<br />");r.pasteHTML("");h.pre.parentNode.removeChild(h.pre.nextSibling);h.pre.insertAdjacentHTML("afterEnd",newElHtml);newEl=h.pre.nextSibling;if(/\S/.test(text)){var p2=h.pre.cloneNode(true);p2.innerHTML=html;newEl.parentNode.insertBefore(p2,newEl.nextSibling);}}r.moveToElementText(newEl);r.collapse();r.select();newEl.innerHTML="";return;}param="<"+param+">";}}switch(cmd){case "showHtml":try{alert(this.getHTML());}catch(ex){alert("ERROR: "+ex);}break;case "_nextSection":this.nextSection();break;case "_prevSection":this.prevSection();break;default:ret=doc.execCommand(cmd,false,param);}this.focus();this.callUpdateHooks();return ret;};P.queryCommandState=function(cmd){if(this.COMMANDS[cmd])cmd=this.COMMANDS[cmd].id;return this.getIframeDoc().queryCommandState(cmd);};P.queryCommandValue=function(cmd){if(this.COMMANDS[cmd])cmd=this.COMMANDS[cmd].id;if(!is_gecko&&/^formatblock$/i.test(cmd)){var a=this.getAllAncestors();for(var i=0;i<a.length;++i){var tag=a[i].tagName.toLowerCase();if(tag in FORMATBLOCK_TAGS)return tag;};}return this.getIframeDoc().queryCommandValue(cmd);};P.getInnerHTML=function(){return this.getIframeBody().innerHTML;};P.getHTML=function(withMeta){return DlHtmlUtils.getHTML(this.getIframeBody(),false,withMeta);};P.getInnerText=function(){return DlHtmlUtils.getInnerText(this.getIframeBody());};P.getText=function(){return DlHtmlUtils.getText(this.getIframeBody());};P.setSections=function(sec){this.__sections=sec;var h=this.__sectionsHash={};sec.foreach(function(s,i){s.index=i;h[s.name]=s;if(s.current||i==0){this.__currentSection=i;this.setHTML(s.content);}}.$(this));};P.setSectionContent=function(name,html){var s=this.getSection(name,true);s.content=html;if(s.index==this.__currentSection)this.setHTML(html);};P.getSections=function(){var tmp=this.getHTML(true);Dynarch.merge(this.getCurrentSection(),tmp);return this.__sectionsHash;};P.getSection=function(name,noSetContent){var sec=this.__sectionsHash[name];if(sec.index==this.__currentSection&&!noSetContent){var tmp=this.getHTML(true);Dynarch.merge(sec,tmp);}return sec;};P.getCurrentSection=function(){return this.__sections[this.__currentSection];};P._setCurrentSection=function(newsec){var oldsec=this.getCurrentSection();if(oldsec!==newsec){var tmp=this.getHTML(true);Dynarch.merge(oldsec,tmp);this.__currentSection=newsec.index;this.setHTML(newsec.content);this.applyHooks("onSectionChange",[oldsec,newsec]);}};P.setCurrentSection=function(name){var newsec=this.__sectionsHash[name];this._setCurrentSection(newsec);};P.setCurrentSectionIndex=function(idx){if(idx!=this.__currentSection){var newsec=this.__sections[idx];this._setCurrentSection(newsec);}};P.prevSection=function(){this.setCurrentSectionIndex(this.__sections.rotateIndex(this.__currentSection-1));};P.nextSection=function(){this.setCurrentSectionIndex(this.__sections.rotateIndex(this.__currentSection+1));};P._setListeners=function(){this.registerEvents(DEFAULT_EVENTS);BASE._setListeners.call(this);this.addEventListener(is_ie?"onKeyDown":"onKeyPress",function(ev){this._onKeypress(ev)});this.addEventListener({onDestroy:onDestroy});};P._createElement=function(){BASE._createElement.call(this);var iframe=CE("iframe",{display:'block'},{frameBorder:0,marginHeight:0,marginWidth:0,src:is_ie?"javascript:'';":"about:blank"},this.getElement());this.__hasFrameEvents=false;this.updateKeymap();};P.updateKeymap=function(){var keymap=this.__rte_keymap=[];for(var i in this.COMMANDS){var cmd=this.COMMANDS[i];if(cmd.key)keymap.push([DlKeyboard.parseKey(cmd.key),i]);}};P.setOuterSize=P.setSize=function(s){var pb1=DOM.getBorder(this.getElement());var pb2=DOM.getBorder(this.getContentElement());this.setInnerSize({x:s.x-pb1.x-pb2.x,y:s.y-pb1.y-pb2.y});};P.getIframeElement=function(){return this.getElement().firstChild;};P.getContentElement=P.getIframeElement;P.getIframeWin=function(){return this.getIframeElement().contentWindow;};P.getIframeDoc=function(){return this.getIframeWin().document;};P.getIframeBody=function(){return this.getIframeDoc().body;};P.initDesignMode=function(callback){var doc=this.getIframeDoc();doc.open();doc.write(INIT_HTML);doc.close();doc.designMode="on";if(!this.__hasFrameEvents)addIframeEvents.delayed(5,this,callback);};P.setHTML=function(html){if(html instanceof Array)html=html.join("");html=html.trim();if(this.__hasFrameEvents){if(is_ie){html=html.replace(/(<pre[^>]*>)((.|\n)+?)(<\x2fpre>)/gi,function(s,p1,p2,p3,p4){p2=p2.replace(/\x20/g,"\xA0").replace(/\t/g,"\xA0".repeat(4));return p1+p2+p4;});}this.getIframeBody().innerHTML=html;this._onSetHTML();this.moveBOF();this.callUpdateHooks();}else this.__pendingHTML=html;};P._onSetHTML=function(){var pres=this.getIframeDoc().getElementsByTagName("pre");for(var i=pres.length;--i>=0;){var pre=pres[i];pre.innerHTML=pre.innerHTML.replace(/\n/g,"<br>");}};P.clear=function(){this.setHTML("");};P.focus=function(){this.getIframeWin().focus();BASE.focus.call(this);};P.loadStyle=function(css){var doc=this.getIframeDoc();var id=css.replace(/\x2f/g,"_");if(!doc.getElementById(id)){var head=doc.getElementsByTagName("head")[0];var link=doc.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=css;link.id=id;head.appendChild(link);link.disabled=true;link.disabled=false;}};P.createRange=function(){return is_ie?this.getIframeBody().createTextRange():this.getIframeDoc().createRange();};P.getSelection=function(){return is_ie?this.getIframeDoc().selection:this.getIframeWin().getSelection();};P.getRange=function(sel){if(sel==null)sel=this.getSelection();return is_ie?sel.createRange():sel.getRangeAt(0);};P.getParentElement=function(){var sel=this.getSelection();var range=this.getRange(sel);if(is_ie){switch(sel.type){case "Text":case "None":return range.parentElement();case "Control":return range.item(0);default:return null;}}else try{var p=range.commonAncestorContainer;if(!range.collapsed&&range.startContainer==range.endContainer&&range.startOffset-range.endOffset<=1&&range.startContainer.hasChildNodes())p=range.startContainer.childNodes[range.startOffset];while(p.nodeType==3)p=p.parentNode;return p;}catch(ex){return null;}};P.getAllAncestors=function(){var p=this.getParentElement();if(p&&p.nodeType==1)p=this.getParentElement();var body=this.getIframeBody();var a=[];while(p&&p!==body&&p.nodeType==1){a.push(p);p=p.parentNode;}a.push(body);return a;};P.getAncestorsHash=function(){var p=this.getAllAncestors(),el,i,tn,pnodes={__all:p};p.foreach(function(el){tn=el.tagName.toLowerCase();if(!pnodes[tn])pnodes[tn]=el;});return pnodes;};P.getSelectedText=function(){var range=this.getRange();return is_ie?range.text:range.toString();};P.selectRange=function(range){if(is_ie)range.select();else{var sel=this.getSelection();sel.removeAllRanges();sel.addRange(range);}};P.isCollapsed=function(){var r=this.getRange();return is_w3?r.collapsed:r.compareEndPoints("StartToEnd",r)==0;};P.collapse=function(toStart){var sel=this.getSelection();var r=this.getRange(sel);if(is_w3)sel.removeAllRanges();r.collapse(!!toStart);this.selectRange(r);};P.insertNode=function(node,select){var sel=this.getSelection(),r=this.getRange(sel);if(is_w3){r.deleteContents();r.insertNode(node);if(select){sel.removeAllRanges();r.selectNode(node);sel.addRange(r);}}else{var id=ID("rteframe");r.pasteHTML(["<span id='",id,"'></span>"].join(""));var el=this.getIframeDoc().getElementById(id);el.parentNode.insertBefore(node,el);el.parentNode.removeChild(el);if(select&&node.nodeType!=3){r.moveToElementText(node);r.select();}}return node;};P.insertText=function(str,select){var node=this.getIframeDoc().createTextNode(str);return this.insertNode(node,select);};P.selectNodeContents=function(node){var r=this.createRange();is_w3?r.selectNodeContents(node):r.moveToElementText(node);this.selectRange(r);};P.createLink=function(url,text){var tmp,as,link,i;if(text)this.insertText(text,true);tmp="javascript:"+ID("link");this.execCommand("createlink",tmp);as=this.getIframeDoc().getElementsByTagName("a");for(i=as.length;--i>=0;)if(as[i].href==tmp){link=as[i];break;}link.href=url;return link;};P.createAnchor=function(name){var text=this.getSelectedText()?null:"Anchor";var link=this.createLink("#",text);link.removeAttribute("href");AC(link,text?"DlAnchor-Empty":"DlAnchor");link.setAttribute("name",name);if(text)link.innerHTML="";return link;};P.getAnchors=function(){var as=this.getIframeDoc().getElementsByTagName("a"),i=as.length,a,ret=[];while(--i>=0){a=as[i];if(a.name)ret.unshift(a);}return ret;};P.unlink=function(){this.execCommand("unlink");};P.getSelectedImage=function(){var img=this.getParentElement();if(img&&!/^img$/i.test(img.tagName))img=null;return img;};P.insertImage=function(params){var img=this.getSelectedImage();if(!img){var tmp="javascript:"+ID("img"),as,i;this.execCommand("insertimage",tmp);as=this.getIframeDoc().getElementsByTagName("img");for(i=as.length;--i>=0;)if(as[i].src==tmp){img=as[i];break;}}img.src=params.url;if(params.width)img.width=params.width;if(params.height)img.height=params.height;if(params.align)img.align=params.align;if(params.alt)img.alt=params.alt;if(params.marginLeft)img.style.marginLeft=params.marginLeft;if(params.marginTop)img.style.marginTop=params.marginTop;if(params.marginRight)img.style.marginRight=params.marginRight;if(params.marginBottom)img.style.marginBottom=params.marginBottom;return img;};P.moveBOF=function(pos){var body=this.getIframeBody(),sel,r;var el=pos?body.lastChild:body.firstChild;if(!el)return;if(is_w3){r=this.getRange(sel=this.getSelection());sel.removeAllRanges();if(el.nodeType==1)r.selectNodeContents(el);else r.selectNode(el);r.collapse(!pos);sel.addRange(r);}else{r=body.createTextRange();r.collapse(!pos);r.select();}};P.moveEOF=function(pos){return this.moveBOF(!pos);};P.setParagraphsMode=function(mode){this.__paragraphsMode=mode;};P.addBlockClass=function(tagName,className,toggle){var el=this.getAncestorsHash()[tagName];if(el){if(DOM.hasClass(el,className)){if(toggle){DOM.delClass(el,className);return false;}}else{DOM.addClass(el,className);}return true;}return null;};P.canDeleteFullNode=function(el){return DlHtmlUtils.canDeleteFullNode(el.tagName);};P.canDeleteContent=function(el){return DlHtmlUtils.canDeleteContent(el.tagName);};P.canStripNode=function(el){return DlHtmlUtils.canStripNode(el.tagName);};P.deleteNodeContents=function(el){el.innerHTML=DlHtmlUtils.isBlockElement(el)?BR:"";};P.deleteNode=function(el){el.parentNode.removeChild(el);};P.stripNode=function(el){var df=el.ownerDocument.createDocumentFragment();while(el.firstChild)df.appendChild(el.firstChild);el.parentNode.insertBefore(df,el);el.parentNode.removeChild(el);this.callUpdateHooks();};function removeBR(el){if(el.lastChild.nodeType==1&&el.lastChild.tagName.toLowerCase()=="br")el.removeChild(el.lastChild);};function handleEnter(){if(!this.__paragraphsMode)return;var anc=this.getAncestorsHash(),doit=true,doc=this.getIframeDoc();var sel=this.getSelection();var sel_range=this.getRange(sel);var el_li=anc.li||anc.dd;var el_p=anc.p;if(el_li){var r1=this.createRange();r1.selectNodeContents(el_li);var r2;var has_text=/\S/.test(r1.toString());if(el_p&&has_text){sel.removeAllRanges();r2=sel_range.cloneRange();r2.setStartBefore(el_p.firstChild);if(!/\S/.test(r2.toString())){var first=true;var tmp=el_p.previousSibling;while(tmp){if(tmp.nodeType==1){first=false;break;}tmp=tmp.previousSibling;}if(first){var li=el_li.cloneNode(false);r2.setStartBefore(el_li);r2.insertNode(li);r2.selectNodeContents(li);sel.addRange(r2);this.execCommand("<p>");return true;}else{r1.selectNodeContents(el_p);if(!/\S/.test(r1.toString())){r2=sel_range.cloneRange();r2.setStartBefore(el_p);r2.setEndAfter(el_li);var df=r2.extractContents();var li=df.firstChild;r2.insertNode(df);r2.selectNodeContents(li.firstChild||li);r2.collapse(true);sel.addRange(r2);this.execCommand("<p>");return true;}else{var p=el_p.cloneNode(false);r2.setStartBefore(el_p);r2.insertNode(p);r2.selectNodeContents(p);sel.addRange(r2);this.execCommand("<p>");return true;}}}r2=sel_range.cloneRange();r2.setEndAfter(el_p.lastChild);if(!/\S/.test(r2.toString())){var p=el_p.cloneNode(false);r2.setEndAfter(el_p);r2.collapse(false);r2.insertNode(p);r2.selectNodeContents(p);sel.addRange(r2);this.execCommand("<p>");return true;}r2=sel_range.cloneRange();r2.setEndAfter(el_p);var df=r2.extractContents();r2.collapse(false);var p=df.firstChild;r2.insertNode(df);r2.selectNodeContents(p);r2.collapse(true);sel.addRange(r2);return true;}else if(!has_text){sel.removeAllRanges();var ul=el_li.parentNode;r2=sel_range.cloneRange();r2.selectNode(ul);r2.setStartAfter(el_li);var df=r2.extractContents();ul.removeChild(el_li);var p=doc.createElement("p");df.insertBefore(p,df.firstChild);r2.setEndAfter(ul);r2.collapse(false);r2.insertNode(df);r2.selectNodeContents(p);r2.collapse(true);sel.addRange(r2);this.execCommand("<p>");return true;}}else{var el_pre=anc.pre;if(el_pre){sel.removeAllRanges();r2=sel_range.cloneRange();var indent="";var node=r2.startContainer;if(node==el_pre)node=node.childNodes[r2.startOffset];while(node&&node.parentNode!=el_pre)node=node.parentNode;if(node){while(node&&!/^br$/i.test(node.tagName))node=node.previousSibling;node=node?node.nextSibling:el_pre.firstChild;while(node&&node.nodeType!=3)node=node.firstChild;if(node&&/^(\s+)/.test(node.data))indent=RegExp.$1;}var df=doc.createDocumentFragment();var br=doc.createElement("br");df.appendChild(br);if(indent){br=doc.createTextNode(indent);df.appendChild(br);}r2.insertNode(df);r2.setEndAfter(br);r2.collapse(false);sel.addRange(r2);return true;}}var el_head=anc.h6||anc.h5||anc.h4||anc.h3||anc.h2||anc.h1;if(el_head){var r1=sel_range.cloneRange();r1.setEndAfter(el_head);if(!/\S/.test(r1.toString())){sel.removeAllRanges();r1.collapse(false);var p=this.getIframeDoc().createElement("p");r1.insertNode(p);r1.selectNodeContents(p);r1.collapse(true);sel.addRange(r1);this.execCommand("<p>");return true;}}};P._onKeypress=function(ev){var key=ev.keyCode;if(is_gecko&&!ev.shiftKey&&!ev.ctrlKey&&!ev.altKey&&key==DlKeyboard.ENTER){if(handleEnter.call(this))throw new DlExStopFrameEvent;}this.__rte_keymap.r_foreach(function(kc){if(DlKeyboard.checkKey(ev,kc[0])){this.execCommand(kc[1]);throw new DlExStopFrameEvent;}},this);if(key==DlKeyboard.TAB){var tag=this.queryCommandValue("formatblock");if(tag=="pre"){this.insertText(this._tabChar,true);this.collapse(false);throw new DlExStopFrameEvent;}}else if(key==DlKeyboard.ENTER&&is_ie&&!ev.shiftKey){var tag=this.queryCommandValue("formatblock");if(tag=="pre"){var sel=this.getSelection(),r=this.getRange(sel);r.pasteHTML("<br/><div class='DynarchLIB-REMOVE-ME'></div>");throw new DlExStopFrameEvent;}}};function eventProxy(ev){ev||(ev=this.getIframeWin().event);var dev=new DlEvent(ev);if(dev.type=="oncontextmenu")DOM.stopEvent(ev);dev.origTarget=dev.target;var p1=dev.origPos=dev.pos;var p2=DOM.getPos(this.getIframeElement());dev.pos={x:p1.x+p2.x,y:p1.y+p2.y};dev.target=this.getElement();try{DlEvent._genericEventHandler(dev,ev);}catch(ex){if(ex instanceof DlExStopFrameEvent)DOM.stopEvent(ev);}if(/onMouseDown|onMouseUp|onKey/.test(dev.dl_type))this.callUpdateHooks(dev,ev);};function addIframeEvents(callback){var doc=this.getIframeDoc();this.__hasFrameEvents=true;DOM.addEvents(doc,FORWARD_EVENTS,this.__eventProxy);if(this.__pendingHTML){this.getIframeBody().innerHTML=this.__pendingHTML;this._onSetHTML();this.moveBOF();this.__pendingHTML=null;}this.__rte_onFocus=onFocus.$(this);this.__rte_onBlur=onBlur.$(this);if(is_ie){doc=this.getIframeElement();doc.onfocus=this.__rte_onFocus;}else{DOM.addEvent(doc,"focus",this.__rte_onFocus);}doc.onblur=this.__rte_onBlur;if(callback)callback.call(this);};function onDestroy(){var doc=this.getIframeDoc();DOM.removeEvents(doc,FORWARD_EVENTS,this.__eventProxy);if(is_ie){doc=this.getIframeElement();delete doc["onfocus"];doc.onfocus=null;}else{DOM.removeEvent(doc,"focus",this.__rte_onFocus);}delete doc["onblur"];doc.onblur=null;};function onFocus(){AC(this.getIframeDoc().documentElement,"DlRteFrame-Focused");BASE.focus.call(this);};function onBlur(){DC(this.getIframeDoc().documentElement,"DlRteFrame-Focused");BASE.blur.call(this,true);};})();(function(){DlSocket.inherits(DlEventProxy);function DlSocket(args){if(args){if(!args.host)args.host=document.domain;D.setDefaults(this,args);DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);this.addEventListener("onDestroy",onDestroy);DlEvent.atUnload(this.destroy.$(this));}};eval(Dynarch.EXPORT("DlSocket"));var DEFAULT_EVENTS=["onConnect","onRelease","onData"];var SOCKETS={};function onDestroy(){DlFlashUtils().getObject().DlSocket_destroy(this.id);delete SOCKETS[this.id];};D.DEFAULT_ARGS={_host:["host",null],_port:["port",null],_json:["json",false]};P.send=function(data){DlFlashUtils().getObject().DlSocket_send(this.id,data);};P.sendJSON=function(data){DlFlashUtils().getObject().DlSocket_send(this.id,DlJSON.encode(data));};P.connect=function(){this.id=DlFlashUtils().getObject().DlSocket_connect(this._host,this._port);SOCKETS[this.id]=this;};P.reconnect=function(){DlFlashUtils().getObject().DlSocket_reconnect(this.id);};P.disconnect=function(){DlFlashUtils().getObject().DlSocket_disconnect(this.id);};window.DlSocket_onConnect=function(id,status){SOCKETS[id].applyHooks("onConnect",[status]);};window.DlSocket_onData=function(id,data){data=DlFlashUtils.decodeString(data);var sok=SOCKETS[id];if(sok._json)data=DlJSON.decode(data);sok.applyHooks("onData",[data]);};window.DlSocket_onDisconnect=function(id,reason){SOCKETS[id].applyHooks("onRelease",[reason]);};})();(function(){DlSound.inherits(DlEventProxy);function DlSound(args){if(args){D.setDefaults(this,args);DlEventProxy.call(this);this.registerEvents(DEFAULT_EVENTS);this.addEventListener({onDestroy:onDestroy,onLoad:onLoad});this.id=DlFlashUtils().getObject().DlSound_create();if(this._volume!=null)this.setVolume(this._volume);if(this._pan!=null)this.setPan(this._pan);SOUNDS[this.id]=this;}};eval(Dynarch.EXPORT("DlSound"));D.DEFAULT_ARGS={_volume:["volume",null],_pan:["pan",null],_url:["url",null],_stream:["stream",false]};P.load=function(url,stream){if(url==null)url=this._url;if(stream==null)stream=this._stream;this.__fileLoaded=false;this.__loadCalled=true;DlFlashUtils().getObject().DlSound_load(this.id,this._url=url,this._stream=stream);};P.play=function(offset,loop){if(this.__fileLoaded){DlFlashUtils().getObject().DlSound_play(this.id,offset,loop);}else if(!this.__loadCalled){this.__shouldPlay=[offset,loop];this.load();}};P.stop=function(){DlFlashUtils().getObject().DlSound_stop(this.id);};P.getBytesLoaded=function(){return DlFlashUtils().getObject().DlSound_getBytesLoaded(this.id);};P.getBytesTotal=function(){return DlFlashUtils().getObject().DlSound_getBytesTotal(this.id);};P.getDuration=function(){return DlFlashUtils().getObject().DlSound_getDuration(this.id);};P.getPosition=function(){return DlFlashUtils().getObject().DlSound_getPosition(this.id);};P.setPan=function(pan){DlFlashUtils().getObject().DlSound_setPan(this.id,this._pan=pan);};P.setVolume=function(volume){DlFlashUtils().getObject().DlSound_setVolume(this.id,this._volume=volume);};P.getPan=function(){return this._pan;};P.getVolume=function(){return this._volume;};P.getURL=function(){return this._url;};var DEFAULT_EVENTS=["onLoad","onComplete"];var SOUNDS={};function onDestroy(){delete SOUNDS[this.id];};function onLoad(success){this.__fileLoaded=success;if(success&&this.__shouldPlay){this.play.apply(this,this.__shouldPlay);this.__shouldPlay=null;}};window.DlSound_onLoad=function(id,success){SOUNDS[id].applyHooks("onLoad",[success]);};window.DlSound_onSoundComplete=function(id){SOUNDS[id].callHooks("onComplete");};})();(function(){DlSpinner.inherits(DlEntry);function DlSpinner(args){if(args){args.validators=[new DlValidator(DlValidator.Number,args.minVal,args.maxVal,args.integer,args.decimals)];D.setDefaults(this,args);args.type="text";DlEntry.call(this,args);this._timer=null;this._timerStep=null;this._timerState=null;this._timerPos=null;}};eval(Dynarch.EXPORT("DlSpinner",true));var DEFAULT_EVENTS=["onSpin"];D.DEFAULT_ARGS={_step:["step",1],_size:["size",4],_value:["value",0],_minVal:["minVal",null],_maxVal:["maxVal",null],_decimals:["decimals",null],_integer:["integer",false]};P.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}];P._createElement=function(){this._no_gecko_bug=true;D.BASE._createElement.call(this);var table=this.getElement();var r1=table.rows[0].cells[0];r1.rowSpan=2;r1=r1.parentNode;var r2=CE("tr",null,null,r1.parentNode);var c1=CE("td",null,{className:"DlSpinner-Button DlSpinner-Button-Up"},r1);var c2=CE("td",null,{className:"DlSpinner-Button DlSpinner-Button-Down"},r2);this._buttonUp=new DlButton({parent:this,appendArgs:c1});this._buttonDown=new DlButton({parent:this,appendArgs:c2});};function onFocus(){this.select();};function onBlur(){this._clearTimer();};function onMouseWheel(ev){this._spinnerUpdateVal(ev.wheelDelta>0);throw new DlExStopEventBubbling;};function onKeyDown(ev){switch(ev.keyCode){case DlKeyboard.ARROW_DOWN:spinnerAct.call(this,{_direction:false});throw new DlExStopEventBubbling;break;case DlKeyboard.ARROW_UP:spinnerAct.call(this,{_direction:true});throw new DlExStopEventBubbling;break;}};function onKeyUp(ev){this._clearTimer();};function onChange(){var val=this.getValue();var min=val==this._maxVal;var max=val==this._minVal;this._buttonUp.disabled(min||!!this.readonly());this._buttonDown.disabled(max||!!this.readonly());if(min||max)this._clearTimer();};P._setListeners=function(){D.BASE._setListeners.call(this);this.registerEvents(DEFAULT_EVENTS);this.addEventListener({onFocus:onFocus,onBlur:onBlur,onMouseWheel:onMouseWheel,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onChange:onChange});};P.initDOM=function(){D.BASE.initDOM.call(this);this._setupSpinnerBtn(this._buttonUp,true);this._setupSpinnerBtn(this._buttonDown,false);};P.readonly=function(readonly){if(readonly!=null){this._buttonUp.disabled(readonly);this._buttonDown.disabled(readonly);}return D.BASE.readonly.apply(this,arguments);};P._spinnerUpdateVal=function(dir){if(!this._readonly){var val=new Number(this.getValue());var step=this._timerStep||this._step;val=dir?(val+step):(val-step);if(this._minVal!=null&&val<this._minVal)val=this._minVal;if(this._maxVal!=null&&val>this._maxVal)val=this._maxVal;this.setValue(val);this.applyHooks("onSpin",[val]);this.focus();this.select();if(this._timer){var p=++this._timerPos;if(this._timerState.length&&p==this._timerState[0].pos){var o=this._timerState.shift();this._clearTimer(true);this._timerStep=o.step;this._startTimer(dir,o.speed);}}}};function spinnerAct(b){this._spinnerUpdateVal(b._direction);(this._timerState=Dynarch.makeArray(this.intervals)).r_foreach(function(e){e.step*=this.step;},this);this._timerPos=0;this._startTimer(b._direction,250);throw new DlExStopEventBubbling;};function spinnerMouseUp(b){this._clearTimer();};P._clearTimer=function(restart){if(this._timer)clearInterval(this._timer);if(!restart){this._timerState=null;this._timerStep=null;this._timerPos=null;}this._timer=null;};P._startTimer=function(dir,timeout){if(this._timer)clearInterval(this._timer);this._timer=setInterval(this._spinnerUpdateVal.$(this,dir),timeout);};P._setupSpinnerBtn=function(b,up){b._direction=up;var mouseUp=spinnerMouseUp.$(this,b);b.addEventListener({onMouseDown:spinnerAct.$(this,b),onMouseUp:mouseUp});};})();(function(){DlStyleSheet.inherits(DlEventProxy);function DlStyleSheet(){DlEventProxy.call(this);this._init();};eval(Dynarch.EXPORT("DlStyleSheet",true));function cleanup(){this._s=null;this._el=null;};P.insertRule=function(sel,style,index){var s=this._s;if(index==null)index=this.getRules().length;if(typeof style=="object"){var tmp=[];for(var i in style)tmp.push(i+":"+style[i]);style=tmp.join(";");}else if(style instanceof Array){style=style.join(";");}if(is_ie){sel=sel.split(/\s*,\s*/);if(sel.length==1){s.addRule(sel,style,index);}else{var rule_id=ID();var a=this._ier[rule_id]=[];for(var i=0;i<sel.length;++i){s.addRule(sel[i],style,index+i);a.push(this.getRules()[index+i]);}return rule_id;}}else{s.insertRule(sel+"{"+style+"}",index);}return this.getRules()[index];};P.deleteRule=function(rule){if(is_ie&&typeof rule=="string"){this._ier[rule].foreach(this.deleteRule.$(this));delete this._ier[rule];}else{var rules=this.getRules();for(var i=rules.length;--i>=0;){if(rules[i]===rule){if(is_ie){this._s.removeRule(i);}else{this._s.deleteRule(i);}return i;}}}};P.modifyRule=function(rule,changes){if(is_ie&&typeof rule=="string"){this._ier[rule].foreach(function(r){this.modifyRule(r,changes);},this);}else{for(var i in changes){rule.style[i]=changes[i];}}};P.refresh=function(){var v=this.disabled();this.disabled(!v);this.disabled(v);};P.getRules=function(){return is_ie?this._s.rules:this._s.cssRules;};P.disabled=function(dis){var s=is_ie?this._s:this._el;if(dis!=null){s.disabled=dis;}return!!s.disabled;};P._init=function(){if(is_ie)this._ier={};this._el=CE("style",null,{type:"text/css"},document.getElementsByTagName("head")[0]);this._s=document.styleSheets[document.styleSheets.length-1];this.addEventListener("onDestroy",cleanup);};})();(function(){var BASE=DlTabs.inherits(DlContainer);function DlTabs(args){if(args){D.setDefaults(this,args);DlContainer.call(this,args);}};eval(Dynarch.EXPORT("DlTabs",true));var DEFAULT_EVENTS=["onChange"];D.DEFAULT_ARGS={_tabPos:["tabPos","top"]};function onNotebookChange(tabs,newIndex,oldIndex){var w=newIndex!=null?this._panes[newIndex]:null;w&&w._tab.checked(true);tabs.applyHooks("onChange",[newIndex,oldIndex]);};function onTabChange(btn){if(btn.checked())this._tabContent.showPane(btn.userData);};function onTabClick(ev){this.checked(true);throw new DlExStopEventProcessing();};P.addTab=function(w,title,pos){this._tabContent.appendWidget(w,pos);w._tab=new DlButton({label:title,parent:this._tabBar,group:this._tabGroup,type:DlButton.TYPE.TWOSTATE,data:this._tabContent.length()-1});w._tab.addEventListener("onClick",onTabClick,true);w.addEventListener("onDestroy",w._tab.destroy.$(w._tab));};P.getTabBar=function(){return this._tabBar;};P.getNotebook=function(){return this._tabContent;};P.getTabButton=function(index){return this.getNotebook().getPane(index)._tab;};P.getTabContent=P.getNotebook;P.initDOM=function(){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);break;}this.registerEvents(DEFAULT_EVENTS);this._tabContent.addEventListener("onChange",onNotebookChange.$(this._tabContent,this));this._tabGroup.addEventListener("onChange",onTabChange.$(this));AC(this.getElement(),"DlTabs-"+this._tabPos);};P.setTabPos=function(tabPos){var bar=this._tabBar.getElement();var content=this._tabContent.getElement();if(bar.parentNode)bar.parentNode.removeChild(bar);var pos=(tabPos=="top"||tabPos=="left")?pos=content:null;content.parentNode.insertBefore(bar,pos);AC(this.getElement(),"DlTabs-"+tabPos,"DlTabs-"+this._tabPos);this._tabPos=tabPos;};P.setTabAlign=function(tabAlign){return this._tabBar.setAlign(tabAlign);};P.setOuterSize=P.setSize=function(size){BASE.setSize.call(this,size);size=this.getInnerSize();var bar=this._tabBar.getSize();switch(this._tabPos){case "top":case "bottom":size.y-=bar.y;break;case "left":case "right":size.x-=bar.x;break;}this._tabContent.setSize(size);};P.showPane=function(index){return this._tabContent.showPane(index);};P.nextPane=function(){return this._tabContent.nextPane();};P.prevPane=function(){return this._tabContent.prevPane();};P.isFirstPane=function(){return this._tabContent.isFirstPane();};P.isLastPane=function(){return this._tabContent.isLastPane();};P.getCurrentPane=function(){return this._tabContent.getCurrentPane();};P.getCurrentPaneIndex=function(){return this._tabContent.getCurrentPaneIndex();};P._handle_focusKeys=function(ev){if(ev.shiftKey){if(ev.keyCode==DlKeyboard.PAGE_UP){this.prevPane();this.getCurrentPane()._tab.focus();DlException.stopEventBubbling();}else if(ev.keyCode==DlKeyboard.PAGE_DOWN){this.nextPane();this.getCurrentPane()._tab.focus();DlException.stopEventBubbling();}}else if(ev.keyCode==DlKeyboard.TAB&&this._tabBar.focusInside()){var w=this.getCurrentPane().getFirstFocusWidget();if(w){w.focus();DlException.stopEventBubbling();}}};})();DlTextUtils=(function(){var D,DOM=DynarchDomUtils,K=DlKeyboard,START_REGEXPS=[(/^(\s*[-*]+\s+)/),function(m){return[m," ".x(m[0].length),m[0].length];},(/^(\s*)([0-9]+)(\.\s+)/),function(m){return[function(){var n=parseInt(m[2],10)+1;return m[1]+n+m[3];}," ".x(m[0].length),m[0].length];},(/^(\s*)([a-z])(\)\s+)/i),function(m){return[function(){var n=String.fromCharCode(m[2].charCodeAt(0)+1);return m[1]+n+m[3];}," ".x(m[0].length),m[0].length];},(/^\s*([>|]\s*)*/),function(m){return[m,m[0],m[0].length,/\n\s*([>|]\s*)*/g,"\n"];},(/^\s+/),function(m){return[m,m[0],m[0].length];}];var K_UP_DOWN=[K.ARROW_UP,K.ARROW_DOWN].toHash(true);var ZERO=String.fromCharCode(0);function taKeyPress(ev){if(!ev)ev=window.event;var range=DOM.getSelectionRange(this),scroll={x:this.scrollLeft,y:this.scrollTop};function end(){this.scrollLeft=scroll.x;this.scrollTop=scroll.y;return DOM.stopEvent(ev);};if(ev.altKey&&ev.charCode==113){var val=D.fillText(this.value,72,range.start);this.value=val.text;DOM.setSelectionRange(this,val.pos,val.pos);return end.call(this);}if(ev.ctrlKey&&(ev.keyCode in K_UP_DOWN)){var isUp=ev.keyCode==K.ARROW_UP,p=D.getParagraph(this.value,isUp?range.start:range.end),pos;pos=(isUp?p.start-1:p.end+1).limit(0,this.length);DOM.setSelectionRange(this,ev.shiftKey?(isUp?range.end:range.start):pos,pos);return DOM.stopEvent(ev);}if(ev.altKey&&ev.keyCode==K.ENTER){var text=this.value,p=D.getParagraph(text,range.start),a=D.getFillPrefix(p.text),prefix=a[0];if(typeof prefix=="function")prefix=prefix(a);else prefix=prefix[0];text=text.substr(0,p.end)+"\n\n"+prefix+text.substr(p.end);this.value=text;DOM.setSelectionRange(this,p.end+2+prefix.length);return end.call(this);}};var RE_PARA=/\n([>|\s]*\n)+/g;function lastIndexOfRegexp(str,re,caret){var m,pos=-1;re.lastIndex=0;re.global=true;var last_post=-1;while(m=re.exec(str)){if(re.lastIndex>=caret)break;pos=re.lastIndex;if(pos==last_post){throw "Repeated! "+pos;}last_post=pos;}return pos;};function nextIndexOfRegexp(str,re,caret){re.lastIndex=caret;re.global=true;var m=re.exec(str);return m?m.index:null;};return D={getParagraph:function(text,pos){var start=lastIndexOfRegexp(text,RE_PARA,pos+1),end=nextIndexOfRegexp(text,RE_PARA,pos);if(start==-1)start=0;if(end==null)end=text.length;return{start:start,end:end,text:text.substring(start,end)};},getFillPrefix:function(para){var i=0,re,f,m;para=para.replace(/\x00/g,"");while(i<START_REGEXPS.length){re=START_REGEXPS[i++];f=START_REGEXPS[i++];re.lastIndex=0;if(m=re.exec(para))return f(m);}},fillParagraph:function(para,width,pos){para=para.substr(0,pos)+ZERO+para.substr(pos);var a=D.getFillPrefix(para),prefix=a[1],restPos=a[2];var before=para.substr(0,restPos);para=para.substr(restPos);if(a[3]){para=para.replace(a[3],function(s){return a[4]||"";});}para=para.replace(/\n/g," ").replace(/([^.?!])\s\s+/g,"$1 ");var re=new RegExp("(.{0,"+(width-prefix.length)+"})(\\s+|$)","g");var m,buf=[],lastPos=0,line;while(m=re.exec(para)){if(re.index!=lastPos)line=para.substring(lastPos,re.lastIndex);else line=m[1];lastPos=re.lastIndex;if(!/\S/.test(line))break;buf.push(line.trim(true));}para=before+buf.join("\n"+prefix);pos=para.indexOf(ZERO);if(pos>=0)para=para.substr(0,pos)+para.substr(pos+1);return{text:para,pos:pos};},fillText:function(text,width,pos){var p=D.getParagraph(text,pos);var before=text.substr(0,p.start),after=text.substr(p.end);var posInPara=pos-p.start;var ret=D.fillParagraph(p.text,width,posInPara);return{text:before+ret.text+after,pos:p.start+ret.pos};},emacsipateTextarea:function(ta){DOM.addEvent(ta,is_ie?"keydown":"keypress",taKeyPress);}}})();DlTooltip.inherits(DlPopup);function DlTooltip(args){if(args){args.zIndex=2000;args.focusable=false;DlPopup.call(this,args);this._mouseDiff={x:8,y:12};}};(function(){var BASE=DlTree.inherits(DlContainer);function DlTree(args){if(args){DlContainer.call(this,args);this.__treeItems=[];}};eval(Dynarch.EXPORT("DlTree",true));P.getItem=function(idx){return this.__treeItems[idx];};P.getItems=function(){return this.__treeItems;};P.appendWidget=function(w,pos){if(w instanceof DlTreeItem&&w.parent===this&&pos>w.getIndex()){--pos;}BASE.appendWidget.call(this,w,pos);};P.removeWidget=function(w){BASE.removeWidget.call(this,w);if(w instanceof DlTreeItem){var i=this.__treeItems.find(w);this.__treeItems.splice(i,1);var l=this.__treeItems.length;if(l==0){if(this.parent instanceof DlTreeItem)this.destroy();}else{if(i==0)this.__treeItems[i]._setFirstLast(true,null);if(i==l)this.__treeItems[i-1]._setFirstLast(null,true);}}};P._appendWidgetElement=function(w,pos){var a=this.__treeItems;var parent=this.getContentElement();if(pos==null){if(w instanceof DlTreeItem){var last=a.peek();last?last._setFirstLast(null,false):w._setFirstLast(true,null);a.push(w);w._setFirstLast(null,true);}parent.appendChild(w.getElement());}else{if(pos==a.length)return this._appendWidgetElement(w,null);var prev=a[pos];if(prev)prev._setFirstLast(false,pos==a.length-1);w._setFirstLast(pos==0,false);a.splice(pos,0,w);parent.insertBefore(w.getElement(),parent.childNodes[pos]);}};P.addSeparator=function(cls){CE("div",null,{className:cls||"DlTree-separator",innerHTML:"&nbsp;"},this.getElement());};})();(function(){var BASE=DlTreeItem.inherits(DlContainer);function DlTreeItem(args){if(args){DlTreeItem.setDefaults(this,args);DlContainer.call(this,args);this.setIconClass(this.__iconClass);this.__iconClass=null;}};eval(Dynarch.EXPORT("DlTreeItem",true));D.DEFAULT_ARGS={__label:["label",null],__iconClass:["iconClass",null],__itemClass:["itemClassName",null]};var DEFAULT_EVENTS=["onExpand","onCollapse","onLabelMouseDown"];var HTML=("<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 getTD(ev){var el=ev.target;try{while(el&&el.tagName.toLowerCase()!="td")el=el.parentNode;}catch(ex){el=null;}return el;};function onClick(ev){var td=getTD(ev);if(td&&/DlTreeItem-(Expander|Icon)/.test(td.className)){this.toggle();throw new DlExStopEventBubbling;}};function onDestroy(){var div=this.getSubtreeDiv();if(!window.DL_CLOSING)DOM.trash(div);DOM.removeEvent(this.getDivElement(),"mousedown",this.__onLabelMouseDown);};P._setFirstLast=function(isFirst,isLast){if(isFirst!=null){this.condClass(isFirst,"DlTreeItem-First");CC(this.getTableElement(),isFirst,"DlTreeItem-First");}if(isLast!=null){this.condClass(isLast,"DlTreeItem-Last");CC(this.getTableElement(),isLast,"DlTreeItem-Last");}};P.initDOM=function(){this.registerEvents(DEFAULT_EVENTS);BASE.initDOM.call(this);};P._setListeners=function(){BASE._setListeners.call(this);this.addEventListener({onMouseDown:onClick,onDestroy:onDestroy});};P._createElement=function(){BASE._createElement.call(this);this.getElement().innerHTML=HTML;if(this.__label)this.setContent(this.__label);this.setUnselectable();this.__onLabelMouseDown=this._onLabelMouseDown.$(this);DOM.addEvent(this.getDivElement(),"mousedown",this.__onLabelMouseDown);if(this.__itemClass)AC(this.getDivElement(),this.__itemClass);};P._onLabelMouseDown=function(ev){this.callHooks("onLabelMouseDown");};P.getDivElement=function(){return this.getElement().firstChild;};P.getTableElement=function(){return this.getElement().firstChild.firstChild;};P.getExpanderElement=function(){return this.getTableElement().rows[0].cells[0];};P.getIconElement=function(){return this.getTableElement().rows[0].cells[1];};P.getContentElement=function(){return this.getTableElement().rows[0].cells[2];};P.getSubtreeDiv=function(){return this.getElement().childNodes[1];};P.getSubtreeWidget=function(){return this._subtree;};P.getIndex=function(){return this.parent.__treeItems.find(this);};P.getParentItem=function(){return this.parent.parent;};P.addSubItem=function(item,pos){var tree=this.getSubtreeWidget();if(!tree&&!this._tree){tree=new DlTree({});this.setTree(tree);this.expand();}tree.appendWidget(item,pos);};P.setTree=function(tree,expand,timeout){if(this._tree&&(typeof this._tree!="function"))this.removeWidget(this._tree);this._tree=tree;if(tree!=null){if(typeof tree!="function"){this.appendWidget(tree,true);}else if(expand==null)expand=false;if(expand)this.expand(expand);else{this.getSubtreeDiv().style.display="none";this.updateExpanderState();}}if(timeout==null){this._subtreeNeverExpires=true;this._subtreeExpires=null;}else{this._subtreeNeverExpires=false;this._subtreeExpires=new Date().getTime()+timeout;}this.condClass(tree,"DlTreeItem-hasSubtree");this.updateExpanderState();};P.isExpanded=function(){return this.getSubtreeDiv().style.display!=="none";};P.toggle=function(){this.expand(!this.isExpanded());};P.getPath=function(){var path=[];var item=this.getParentItem();while(item instanceof DlTreeItem){path.push(item);item=item.getParentItem();}return path;};P.expandParents=function(expand){var item=this.getParentItem();while(item instanceof DlTreeItem){item.expand(expand);item=item.getParentItem();}};P.expand=function(expand,nohooks){if(expand==null)expand=true;var self=this;function cont(){self.getSubtreeDiv().style.display=expand?"block":"none";self.updateExpanderState();if(!nohooks)self.callHooks(expand?"onExpand":"onCollapse");};function cont2(tree,timeout){var tmp=self._tree;if(self._subtree)try{self._subtree.destroy();}catch(ex){}self._tree=tmp;if(timeout==null){self._subtreeNeverExpires=true;self._subtreeExpires=null;}else{self._subtreeNeverExpires=false;self._subtreeExpires=new Date().getTime()+timeout;}self.appendWidget(tree,true);cont();};if(expand!==this.isExpanded()){if(expand&&typeof this._tree=="function"){if(this._subtree){if(this._subtreeNeverExpires)cont();else{var time=new Date().getTime();if(this._subtreeExpires&&time<=this._subtreeExpires)cont();else this._tree(cont2,this);}}else this._tree(cont2,this);}else cont();}};P.setIconClass=function(iconClass){var e2=this.getIconElement();CC(e2,iconClass!=null,"DlTreeItem-Icon");if(this.iconClass){e2.innerHTML="";DC(e2,this.iconClass);}if(iconClass){e2.innerHTML="<div class='DlTree-IconWidth'>&nbsp;</div>";AC(e2,iconClass);}this.iconClass=iconClass;};P.updateExpanderState=function(){var div=this.getExpanderElement().firstChild;if(this._tree){var expanded=this.isExpanded();CC(div,expanded,"DlTreeItem-Arrow-Expanded","DlTreeItem-Arrow-Collapsed");CC(this.getTableElement(),expanded,"DlTreeItem-Table-Expanded","DlTreeItem-Table-Collapsed");}else{DC(div,"DlTreeItem-Arrow-Expanded");DC(div,"DlTreeItem-Arrow-Collapsed");this.delClass("DlTreeItem-hasSubtree");}};P._appendWidgetElement=function(w,subtree){var el=w.getElement(),t;if(w instanceof DlTreeItem){this.addSubItem(w,subtree);}else{t=(subtree||w instanceof DlTree)?this.getSubtreeDiv():this.getContentElement();if(subtree){this._subtree=w;AC(el,"DlTree-withLines");this.addClass("DlTreeItem-hasSubtree");}t.appendChild(el);}};P._removeWidgetElement=function(w){BASE._removeWidgetElement.call(this,w);if(!this.getSubtreeDiv().firstChild){this._tree=null;this._subtree=null;}this.updateExpanderState();};P._setFocusedStyle=function(focused){CC(this.getDivElement(),focused,"DlTreeItem-div-focus");};})();function DlType(name){if(name){this.name=name;DlType.TYPES[name]=this;}};DlType.TYPES={};DlType.prototype={getDisplayValue:function(val){return val;},compare:function(a,b){throw "No comparator for type: "+this.name;}};(function(){var BASE=DlUploadEntry.inherits(DlWidget);function DlUploadEntry(args){if(args){D.setDefaults(this,args);if(!(this._files instanceof Array))this._files=[this._files];DlWidget.call(this,args);this.registerEvents(DEFAULT_EVENTS);}};eval(Dynarch.EXPORT("DlUploadEntry",true));var DEFAULT_EVENTS=["onUploadStart","onUploadEnd","onChange"];D.DEFAULT_ARGS={_url:["url",null],_files:["files",["file"]],_params:["params",null]};P._createElement=function(){BASE._createElement.call(this);var iframe=CE("iframe",null,{frameBorder:0,marginHeight:0,marginWidth:0,allowTransparency:true,src:is_ie?"javascript:'';":"about:blank"},this.getElement());this.refNode("_iframe",iframe);};P.init=function(){var HTML=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(),"' />");var p=this._params;if(p){if(p instanceof Array)p=p.toHash("");for(var i in p)HTML("<input type='hidden' name='",i,"' value='",p[i],"' />");}this._files.foreach(function(name){HTML("<label class='upload'><input type='file' name='",name,"' /></label>");});HTML("</form></body></html>");var win=this._iframe.contentWindow;var doc=win.document;doc.open();doc.write(HTML.get());doc.close();this.refNode("_win",win);this.refNode("_doc",doc);this.refNode("_form",doc.getElementsByTagName("form")[0]);this._form.method="POST";this._form.encoding="multipart/form-data";var change_handler=onUploadChange.$(null,this);this._files.foreach(function(name){var field=this._form.elements.namedItem(name);field.onchange=change_handler;field.parentNode.onmousemove=onMouseMove;},this);};P.setParam=function(name,val){if(typeof name=="string"){var el=this.getField(name);if(!el){el=this._doc.createElement("input");el.type="hidden";el.name=name;this._form.appendChild(el);}el.value=val;}else for(var i in name)this.setParam(i,name[i]);};P.getParam=function(name){var el=this.getField(name);return el&&el.value;};P.getField=function(name){return this._form.elements.namedItem(name);};P.submit=function(){this.callHooks("onUploadStart");this._form.submit();};D.finishUpload=function(upload){if(!(upload instanceof DlUploadEntry))upload=DlWidget.getById(upload);if(upload){upload.init();upload.applyHooks("onUploadEnd",Array.$(arguments,1));}else throw("No such uploader: "+upload);};function onUploadChange(obj){obj.applyHooks("onChange",[this,this.name,this.value]);};function onMouseMove(ev){if(is_ie)ev=this.ownerDocument.parentWindow.event;this.firstChild.style.right=30-ev.clientX+"px";};})();DlException.defineException("DlValidatorException");DlValidatorException.MISMATCH=1;DlValidatorException.TOO_SMALL=2;DlValidatorException.TOO_BIG=3;(function(){function DlValidator(callback){if(callback){if(typeof callback=="string")callback=D[callback];this._callback=callback;this._args=arguments.length>1?Array.$(arguments,1):null;}};eval(Dynarch.EXPORT("DlValidator"));P.ok=function(data){if(typeof this._lastData!="undefined"&&this._lastData===data)return true;try{var args=[data].concat(this._args||Array.$(arguments,1));var val=this._callback.apply(this,args);this._lastData=data;this._lastValue=val;return true;}catch(ex){if(ex instanceof DlValidatorException){this._error=ex;return false;}else throw ex;}};P.getLastVal=function(){return this._lastValue;};P.getLastData=function(){return this._lastData;};P.getError=function(){return this._error;};D.Number=function(data,minVal,maxVal,integer,decimals){data=data.replace(/\s/g,"");var n=new Number(data);if(isNaN(n))throw new DlValidatorException("Value must be numeric",DlValidatorException.MISMATCH);if(integer&&n!=Math.round(n))throw new DlValidatorException("Value must be an integer",DlValidatorException.MISMATCH);if(minVal!=null&&n<minVal)throw new DlValidatorException("Value must be bigger than "+minVal,DlValidatorException.TOO_SMALL);if(maxVal!=null&&n>maxVal)throw new DlValidatorException("Value must be smaller than "+maxVal,DlValidatorException.TOO_BIG);if(decimals)n=n.toFixed(decimals);return n;};D.Email=function(data){if(!/^([^@\n\r]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i.test(data)){throw new DlValidatorException("That doesn't look like an email address",DlValidatorException.MISMATCH);}return data;};D.URL=function(data,args){if(!args)args={};if(!/^(https?|ftps?):\x2f\x2f/.test(data))throw new DlValidatorException("Value must be an absolute URL",DlValidatorException.MISMATCH);return data;};function findMonth(str){str=str.toLowerCase();function f(a){return a.foreach(function(n,i){if(n.toLowerCase().indexOf(str)==0)$RETURN(i);});};var mo=f(DlTEXTS._date_shortMonthNames)||f(DlTEXTS._date_monthNames);if(mo!=null)mo++;return mo;};D.Date=function(data,format,monthFirst){if(!/\S/.test(data))return "";if(!format)format="%Y-%m-%d";data=data.replace(/^\s+/,"").replace(/\s+$/,"");var today=new Date();var yr=null,mo=null,da=null,h=null,m=null,s=null;var b=data.match(/([0-9]{1,2}):([0-9]{1,2})(:[0-9]{1,2})?\s*(am|pm)?/i);if(b){h=parseInt(b[1],10);m=parseInt(b[2],10);s=b[3]?parseInt(b[3].substr(1),10):0;data=data.substring(0,b.index)+data.substr(b.index+b[0].length);if(b[4]){if(b[4].toLowerCase()=="pm"&&h<12)h+=12;else if(b[4].toLowerCase()=="am"&&h>=12)h-=12;}}var a=data.split(/\W+/);var mod=[];a.foreach(function(v){if(/^[0-9]{4}$/.test(v)){yr=parseInt(v,10);if(!mo&&!da)monthFirst=true;}else if(/^[0-9]{1,2}$/.test(v)){v=parseInt(v,10);if(v>=60){yr=v;}else if(v>=0&&v<=12){mod.push(v);}else if(v>=1&&v<=31){da=v;}}else{mo=findMonth(v);}});if(mod.length>=2){if(monthFirst){if(!mo)mo=mod.shift();if(!da)da=mod.shift();}else{if(!da)da=mod.shift();if(!mo)mo=mod.shift();}}else if(mod.length==1){if(!da)da=mod.shift();else if(!mo)mo=mod.shift();}if(!yr)yr=mod.length>0?mod.shift():today.getFullYear();if(yr<30)yr+=2000;else if(yr<99)yr+=1900;if(!mo)mo=today.getMonth()+1;if(yr&&mo&&da){this._date=new Date(yr,mo-1,da,h,m,s);}else{this._date=null;throw new DlValidatorException("Can't figure out this date",DlValidatorException.MISMATCH);}return this._date.print(format);};})();function DlConsole(){this._messages=[];DlConsole.INSTANCE=this;};DlConsole.prototype={log:function(str){str=str.printf.apply(str,Array.$(arguments,1));this._addMsg({str:str});},line:function(){this._addMsg({str:"&nbsp;",cls:"sep"});},CC:function(text,cn){var div=this.win.document.createElement("div");div.className=cn||"msg";div.innerHTML=text;this.win.document.body.appendChild(div);this.win.scrollTo(0,div.offsetTop+div.offsetHeight);if(this._last)DynarchDomUtils.delClass(this._last,"current");DynarchDomUtils.addClass(div,"current");this._last=div;},_addMsg:function(msg){this._init();if(!this.win)this._messages.push(msg);else this.CC(msg.str,msg.cls);},_init:function(){if(!this.win){window.open(Dynarch.getFileURL("html/dlconsole.html"),"DlConsole","height=400,width=600,menubar=0,toolbar=0,scrollbars=1");}},_loaded:function(win){this._last=null;this.win=win;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{var a=[];for(var i=0;i<arguments.length;++i)a.push(arguments[i]);console.log(name+" ["+a.join(", ")+"]");func.apply(this,arguments);}catch(ex){alert("Exception in "+name+"\n"+ex);throw ex;}};eval(name+" = f");}};if(!window.dlconsole){window.dlconsole=new DlConsole();}
