/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
to use it in non-GPL project. Please contact sales@dhtmlx.com for details
*/
window.dhx||(dhx={});dhx.version="3.0";dhx.codebase="./";dhx.name="Core";dhx.copy=function(a){var b=dhx.copy.ah;b.prototype=a;return new b};dhx.copy.ah=function(){};dhx.extend=function(a,b,c){a.ec&&(a=a.ec[0]);for(var d in b)if(!a[d]||c)a[d]=b[d];b.defaults&&dhx.extend(a.defaults,b.defaults);b.$init&&b.$init.call(a);return a};
dhx.fullCopy=function(a){var b=a.length?[]:{};arguments.length>1&&(b=arguments[0],a=arguments[1]);for(var c in a)a[c]&&typeof a[c]=="object"&&!dhx.isDate(a[c])?(b[c]=a[c].length?[]:{},dhx.fullCopy(b[c],a[c])):b[c]=a[c];return b};dhx.single=function(a){var b=null,c=function(c){b||(b=new a({}));b.qf&&b.qf.apply(b,arguments);return b};return c};
dhx.protoUI=function(){var a=arguments,b=a[0].name,c=function(d){if(a){for(var e=[a[0]],f=1;f<a.length;f++)e[f]=a[f],e[f].ec&&(e[f]=e[f].call(dhx)),e[f].prototype&&e[f].prototype.name&&(dhx.ui[e[f].prototype.name]=e[f]);dhx.ui[b]=dhx.proto.apply(dhx,e);if(c.tb)for(f=0;f<c.tb.length;f++)dhx.Type(dhx.ui[b],c.tb[f]);c=a=null}return this!=dhx?new dhx.ui[b](d):dhx.ui[b]};c.ec=arguments;return dhx.ui[b]=c};
dhx.proto=function(){for(var a=arguments,b=a[0],c=!!b.$init,d=[],e=a.length-1;e>0;e--){if(typeof a[e]=="function")a[e]=a[e].prototype;a[e].$init&&d.push(a[e].$init);if(a[e].defaults){var f=a[e].defaults;if(!b.defaults)b.defaults={};for(var g in f)dhx.isUndefined(b.defaults[g])&&(b.defaults[g]=f[g])}if(a[e].type&&b.type)for(g in a[e].type)b.type[g]||(b.type[g]=a[e].type[g]);for(var h in a[e])b[h]||(b[h]=a[e][h])}c&&d.push(b.$init);b.$init=function(){for(var a=0;a<d.length;a++)d[a].apply(this,arguments)};
var i=function(a){this.$ready=[];this.$init(a);this.cb&&this.cb(a,this.defaults);for(var b=0;b<this.$ready.length;b++)this.$ready[b].call(this)};i.prototype=b;b=a=null;return i};dhx.bind=function(a,b){return function(){return a.apply(b,arguments)}};dhx.require=function(a){dhx.bf[a]||(dhx.exec(dhx.ajax().sync().get(dhx.codebase+a).responseText),dhx.bf[a]=!0)};dhx.bf={};dhx.exec=function(a){window.execScript?window.execScript(a):window.eval(a)};
dhx.wrap=function(a,b){return!a?b:function(){var c=a.apply(this,arguments);b.apply(this,arguments);return c}};dhx.isUndefined=function(a){return typeof a=="undefined"};dhx.delay=function(a,b,c,d){return window.setTimeout(function(){var d=a.apply(b,c||[]);a=b=c=null;return d},d||1)};dhx.uid=function(){if(!this.Dd)this.Dd=(new Date).valueOf();this.Dd++;return this.Dd};dhx.toNode=function(a){return typeof a=="string"?document.getElementById(a):a};
dhx.toArray=function(a){return dhx.extend(a||[],dhx.PowerArray,!0)};dhx.toFunctor=function(a){return typeof a=="string"?eval(a):a};dhx.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"};dhx.isDate=function(a){return a instanceof Date};dhx.s={};dhx.event=function(a,b,c,d){var a=dhx.toNode(a),e=dhx.uid();d&&(c=dhx.bind(c,d));dhx.s[e]=[a,b,c];a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c);return e};
dhx.eventRemove=function(a){if(a){var b=dhx.s[a];b[0].removeEventListener?b[0].removeEventListener(b[1],b[2],!1):b[0].detachEvent&&b[0].detachEvent("on"+b[1],b[2]);delete this.s[a]}};dhx.error=function(){if(dhx.debug!==!1)debugger};
dhx.EventSystem={$init:function(){this.s={};this.Ua={};this.ya={}},blockEvent:function(){this.s.Yd=!0},unblockEvent:function(){this.s.Yd=!1},mapEvent:function(a){dhx.extend(this.ya,a,!0)},on_setter:function(a){if(a)for(var b in a)typeof a[b]=="function"&&this.attachEvent(b,a[b])},callEvent:function(a,b){if(this.s.Yd)return!0;var a=a.toLowerCase(),c=this.s[a.toLowerCase()],d=!0;if(c)for(var e=0;e<c.length;e++)if(c[e].apply(this,b||[])===!1)d=!1;this.ya[a]&&!this.ya[a].callEvent(a,b)&&(d=!1);return d},
attachEvent:function(a,b,c){var a=a.toLowerCase(),c=c||dhx.uid(),b=dhx.toFunctor(b),d=this.s[a]||dhx.toArray();d.push(b);this.s[a]=d;this.Ua[c]={f:b,t:a};return c},detachEvent:function(a){if(this.Ua[a]){var b=this.Ua[a].t,c=this.Ua[a].f,d=this.s[b];d.remove(c);delete this.Ua[a]}},hasEvent:function(a){a=a.toLowerCase();return this.s[a]?!0:!1}};dhx.extend(dhx,dhx.EventSystem);
dhx.PowerArray={removeAt:function(a,b){a>=0&&this.splice(a,b||1)},remove:function(a){this.removeAt(this.find(a))},insertAt:function(a,b){if(!b&&b!==0)this.push(a);else{var c=this.splice(b,this.length-b);this[b]=a;this.push.apply(this,c)}},find:function(a){for(var b=0;b<this.length;b++)if(a==this[b])return b;return-1},each:function(a,b){for(var c=0;c<this.length;c++)a.call(b||this,this[c])},map:function(a,b){for(var c=0;c<this.length;c++)this[c]=a.call(b||this,this[c]);return this}};dhx.env={};
(function(){if(navigator.userAgent.indexOf("Mobile")!=-1)dhx.env.mobile=!0;if(dhx.env.mobile||navigator.userAgent.indexOf("iPad")!=-1||navigator.userAgent.indexOf("Android")!=-1)dhx.env.touch=!0;navigator.userAgent.indexOf("Opera")!=-1?dhx.env.isOpera=!0:(dhx.env.isIE=!!document.all,dhx.env.isFF=!document.all,dhx.env.isWebKit=navigator.userAgent.indexOf("KHTML")!=-1,dhx.env.isSafari=dhx.env.isWebKit&&navigator.userAgent.indexOf("Mac")!=-1);if(navigator.userAgent.toLowerCase().indexOf("android")!=
-1)dhx.env.isAndroid=!0;dhx.env.transform=!1;dhx.env.transition=!1;for(var a={names:["transform","transition"],transform:["transform","WebkitTransform","MozTransform","OTransform","msTransform"],transition:["transition","WebkitTransition","MozTransition","OTransition","msTransition"]},b=document.createElement("DIV"),c=0;c<a.names.length;c++)for(var d=a[a.names[c]],e=0;e<d.length;e++)if(typeof b.style[d[e]]!="undefined"){dhx.env[a.names[c]]=d[e];break}b.style[dhx.env.transform]="translate3d(0,0,0)";
dhx.env.translate=b.style[dhx.env.transform]?"translate3d":"translate";var f="",g=!1;dhx.env.isOpera&&(f="-o-",g="O");dhx.env.isFF&&(f="-Moz-");dhx.env.isWebKit&&(f="-webkit-");dhx.env.isIE&&(f="-ms-");dhx.env.transformCSSPrefix=f;dhx.env.transformPrefix=g||dhx.env.transformCSSPrefix.replace(/-/gi,"");dhx.env.transitionEnd=dhx.env.transformCSSPrefix=="-Moz-"?"transitionend":dhx.env.transformPrefix+"TransitionEnd"})();
dhx.env.svg=function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}();
dhx.html={index:function(a){for(var b=0;a=a.previousSibling;)b++;return b},addStyle:function(a){var b=document.createElement("style");b.setAttribute("type","text/css");b.setAttribute("media","screen");b.styleSheet?b.styleSheet.cssText=a:b.appendChild(document.createTextNode(a));document.getElementsByTagName("head")[0].appendChild(b)},create:function(a,b,c){var b=b||{},d=document.createElement(a),e;for(e in b)d.setAttribute(e,b[e]);if(b.style)d.style.cssText=b.style;if(b["class"])d.className=b["class"];
if(c)d.innerHTML=c;return d},getValue:function(a){a=dhx.toNode(a);return!a?"":dhx.isUndefined(a.value)?a.innerHTML:a.value},remove:function(a){if(a instanceof Array)for(var b=0;b<a.length;b++)this.remove(a[b]);else a&&a.parentNode&&a.parentNode.removeChild(a)},insertBefore:function(a,b,c){a&&(b&&b.parentNode?b.parentNode.insertBefore(a,b):c.appendChild(a))},locate:function(a,b){if(a.tagName)var c=a;else a=a||event,c=a.target||a.srcElement;for(;c;){if(c.getAttribute){var d=c.getAttribute(b);if(d)return d}c=
c.parentNode}return null},offset:function(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect(),c=document.body,d=document.documentElement,e=window.pageYOffset||d.scrollTop||c.scrollTop,f=window.pageXOffset||d.scrollLeft||c.scrollLeft,g=d.clientTop||c.clientTop||0,h=d.clientLeft||c.clientLeft||0,i=b.top+e-g,j=b.left+f-h;return{y:Math.round(i),x:Math.round(j)}}else{for(j=i=0;a;)i+=parseInt(a.offsetTop,10),j+=parseInt(a.offsetLeft,10),a=a.offsetParent;return{y:i,x:j}}},pos:function(a){a=a||
event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};var b=dhx.env.isIE&&document.compatMode!="BackCompat"?document.documentElement:document.body;return{x:a.clientX+b.scrollLeft-b.clientLeft,y:a.clientY+b.scrollTop-b.clientTop}},preventEvent:function(a){a&&a.preventDefault&&a.preventDefault();return dhx.html.stopEvent(a)},stopEvent:function(a){(a||event).cancelBubble=!0;return!1},addCss:function(a,b){a.className+=" "+b},removeCss:function(a,b){a.className=a.className.replace(RegExp(" "+b,"g"),"")}};
dhx.ready=function(a){this.si?a.call():this.zc.push(a)};dhx.zc=[];(function(){var a=document.getElementsByTagName("SCRIPT");if(a.length)a=(a[a.length-1].getAttribute("src")||"").split("/"),a.splice(a.length-1,1),dhx.codebase=a.slice(0,a.length).join("/")+"/";dhx.event(window,"load",function(){dhx.callEvent("onReady",[]);dhx.delay(function(){dhx.si=!0;for(var a=0;a<dhx.zc.length;a++)dhx.zc[a].call();dhx.zc=[]})})})();dhx.locale=dhx.locale||{};
dhx.ready(function(){dhx.event(document.body,"click",function(a){dhx.callEvent("onClick",[a||event])})});
(function(){var a=dhx.Touch={config:{longTouchDelay:1E3,scrollDelay:150,gravity:500,deltaStep:30,speed:"0ms",finish:1500,ellastic:!0},limit:function(b){a.Ve=b!==!1},disable:function(){a.Ra=!0},enable:function(){a.Ra=!1},$init:function(){a.$init=function(){};dhx.env.touch?(dhx.event(document.body,"touchstart",a.Sf),dhx.event(document.body,"touchmove",a.Pd),dhx.event(document.body,"touchend",a.Rf)):(a.lc=a.nh,dhx.event(document.body,"mousedown",a.Sf),dhx.event(document.body,"mousemove",a.Pd),dhx.event(document.body,
"mouseup",a.Rf),document.body.style.overflowX=document.body.style.overflowY="hidden");dhx.event(document.body,"dragstart",function(a){return dhx.html.preventEvent(a)});dhx.event(document.body,"touchstart",function(b){if(!a.Ra&&!a.Ve&&dhx.env.isSafari){if(b.srcElement.tagName){var c=b.srcElement.tagName.toLowerCase();if(c=="input"||c=="textarea"||c=="select"||c=="label")return!0;}a.ve=!0;return dhx.html.preventEvent(b)}});a.$b();a.C=[null,null]},$b:function(){a.F=a.K=a.Ka=null;a.R=a.S=a.D=this.Ze=null;a.Z={Jc:0,Kc:0,Kb:0};
if(a.cc)dhx.html.removeCss(a.cc,"dhx_touch"),a.cc=null;window.clearTimeout(a.Ye);a.ag=!0;a.Tb=!0;a.Ub=!0;a.Rd||a.gb()},Rf:function(b){if(a.F){if(a.R){var c=a.ed(a.S),d=c.e,e=c.f,f=a.config.finish,g=a.Ee(b,!0);if(g.Kb){var h=d+a.config.gravity*g.Jc/g.Kb,i=e+a.config.gravity*g.Kc/g.Kb,j=a.C[0]?a.bc(h,!1,!1,a.D.dx,a.D.px):d,k=a.C[1]?a.bc(i,!1,!1,a.D.dy,a.D.py):e,l=Math.max(Math.abs(j-d),Math.abs(k-e));l<150&&(f=f*l/150);if(j!=d||k!=e)f=Math.round(f*Math.max((j-d)/(h-d),(k-e)/(i-e)));var m={e:j,f:k},
n=dhx.ui.get(a.S);n&&n.$changeScroll&&n.$changeScroll(m);f=Math.max(100,f);d!=m.e||e!=m.f?(a.qa(a.S,m.e,m.f,f+"ms"),a.Hb&&a.Hb.kj(m.e,m.f,f+"ms"),a.Ff(m.e,m.f,f+"ms")):a.gb()}else a.gb()}else if(!this.Ze)if(a.Ub&&!a.Tb)a.kb("onSwipeX");else if(a.Tb&&!a.Ub)a.kb("onSwipeY");else if(dhx.env.isSafari&&a.ve){a.ve=!1;var o=a.F.target;dhx.delay(function(){var a=document.createEvent("MouseEvents");a.initEvent("click",!0,!0);o.dispatchEvent(a)})}a.kb("onTouchEnd");a.$b()}},Pd:function(b){if(a.F){var c=a.Ee(b);
a.kb("onTouchMove");if(a.R)a.Gf(c);else if(a.Tb=a.Vd(c.uj,"x",a.Tb),a.Ub=a.Vd(c.lb,"y",a.Ub),a.R){var d=a.dd("onBeforeScroll");if(d){var e={};d.callEvent("onBeforeScroll",[e]);if(e.update)a.config.speed=e.speed,a.config.scale=e.scale}a.xh(c)}return dhx.html.preventEvent(b)}},Gf:function(){if(a.S){var b=a.ed(a.S),c=b.e,d=b.f,e=a.Ka||a.F;if(a.C[0])b.e=a.bc(b.e-e.x+a.K.x,a.config.ellastic,b.e,a.D.dx,a.D.px);if(a.C[1])b.f=a.bc(b.f-e.y+a.K.y,a.config.ellastic,b.f,a.D.dy,a.D.py);a.qa(a.S,b.e,b.f,"0ms");
a.Hb&&a.Hb.kj(b.e,b.f,"0ms");a.Ff(b.e,b.f,"0ms")}},Ff:function(b,c,d){var e=a.D.px/a.D.dx*-b,f=a.D.py/a.D.dy*-c;a.C[0]&&a.qa(a.C[0],e,0,d);a.C[1]&&a.qa(a.C[1],0,f,d)},qa:function(b,c,d,e){a.Rd=!0;if(b){var f=a.config.translate||dhx.env.translate;b.style[dhx.env.transformPrefix+"Transform"]=f+"("+Math.round(c)+"px, "+Math.round(d)+"px"+(f=="translate3d"?", 0":"")+")";b.style[dhx.env.transformPrefix+"TransitionDuration"]=e}},ed:function(b){var c=window.getComputedStyle(b)[dhx.env.transformPrefix+"Transform"],
d;if(c=="none")d={e:0,f:0};else if(window.WebKitCSSMatrix)d=new WebKitCSSMatrix(c);else{var e=c.replace(/(matrix\()(.*)(\))/gi,"$2"),e=e.replace(/\s/gi,""),e=e.split(",");d={};for(var f="a,b,c,d,e,f".split(","),g=0;g<f.length;g++)d[f[g]]=parseInt(e[g],10)}a.Hb&&a.Hb.Fj(d);return d},bc:function(a,c,d,e,f){if(a===d)return a;var g=Math.abs(a-d),h=g/(a-d);if(a>0)return c?d+h*Math.sqrt(g):0;var i=e-f;return i+a<0?c?d-Math.sqrt(-(a-d)):-i:a},wh:function(b){if(!b.scroll_enabled){b.scroll_enabled=!0;b.parentNode.style.position=
"relative";var c=dhx.env.transformCSSPrefix;b.style.cssText+=c+"transition: "+c+"transform; "+c+"user-select:none; "+c+"transform-style:flat;";b.addEventListener(dhx.env.transitionEnd,a.gb,!1)}},xh:function(){a.R.indexOf("x")!=-1&&(a.C[0]=a.ie("x",a.D.dx,a.D.px,"width"));a.R.indexOf("y")!=-1&&(a.C[1]=a.ie("y",a.D.dy,a.D.py,"height"));a.wh(a.S);window.setTimeout(a.Gf,1)},ie:function(b,c,d,e){if(c-d<2)return a.qa(a.S,0,0,"0ms"),a.R=a.R.replace(b,""),"";var f=dhx.html.create("DIV",{"class":"dhx_scroll_"+
b},"");f.style[e]=Math.max(d*d/c-7,10)+"px";a.S.parentNode.appendChild(f);return f},Vd:function(b,c,d){if(b>a.config.deltaStep){if(a.ag&&(a.Mh(c),a.Xe(c),(a.R||"").indexOf(c)==-1))a.R="";return!1}return d},gb:function(){var b,c,d;if(d=dhx.ui.get(a.S||this))d.scrollState&&(c=d.scrollState(),b={e:c.x,f:c.y}),dhx.callEvent("onAfterScroll",[b]),d.callEvent&&d.callEvent("onAfterScroll",[b]);if(!a.R)dhx.html.remove(a.C),a.C=[null,null];a.Rd=!1},Mh:function(){window.clearTimeout(a.Ye);a.ag=!1},Nf:function(b){if(a.C[0]||
a.C[1])a.ej(b,a.C[0]?"x":"y");else return!0},Sf:function(b){if(!a.Ra)if(a.F=a.lc(b),a.Ve&&!a.Oe())a.Nf(b),a.F=null;else{a.kb("onTouchStart");if(a.Nf(b))a.Ye=window.setTimeout(a.Nh,a.config.longTouchDelay);var c=dhx.ui.get(b),d=b.target||event.srcElement;if(c&&c.touchable&&(!d.className||d.className.indexOf("dhx_view")!==0))a.cc=c.getNode(b),dhx.html.addCss(a.cc,"dhx_touch")}},Nh:function(){if(a.F)a.kb("onLongTouch"),dhx.callEvent("onClick",[a.F]),a.Ze=!0},ej:function(b,c){a.Xe(c);var d=a.C[0]||a.C[1];
if(d){var e=a.dd("onBeforeScroll");e&&e.callEvent("onBeforeScroll",[a.F,a.K])}if(d&&(!a.S||d.parentNode!=a.S.parentNode))a.$b(),a.gb(),a.F=a.lc(b);a.Pd(b)},Ee:function(b){a.Ka=a.K;a.K=a.lc(b);a.Z.uj=Math.abs(a.F.x-a.K.x);a.Z.lb=Math.abs(a.F.y-a.K.y);if(a.Ka)a.K.time-a.Ka.time<a.config.scrollDelay?(a.Z.Jc=a.Z.Jc/1.3+a.K.x-a.Ka.x,a.Z.Kc=a.Z.Kc/1.3+a.K.y-a.Ka.y):a.Z.Kc=a.Z.Jc=0,a.Z.Kb=a.Z.Kb/1.3+(a.K.time-a.Ka.time);return a.Z},ph:function(b){a.D={dx:b.offsetWidth,dy:b.offsetHeight,px:b.parentNode.offsetWidth,
py:b.parentNode.offsetHeight}},Oe:function(b){var c=a.F.target;if(!dhx.env.touch&&!dhx.env.transition&&!dhx.env.transform)return null;for(;c&&c.tagName!="BODY";){if(c.getAttribute){var d=c.getAttribute("touch_scroll");if(d&&(!b||d.indexOf(b)!=-1))return[c,d]}c=c.parentNode}return null},Xe:function(b){var c=this.Oe(b);if(c)a.R=c[1],a.S=c[0],a.ph(c[0]);return c},kb:function(b){dhx.callEvent(b,[a.F,a.K]);var c=a.dd(b);c&&c.callEvent(b,[a.F,a.K])},dd:function(b){var c=dhx.ui.get(a.F);if(!c)return null;
for(;c;){if(c.hasEvent&&c.hasEvent(b))return c;c=c.getParent()}return null},lc:function(b){if(!b.touches[0]){var c=a.K;c.time=new Date;return c}return{target:b.target,x:b.touches[0].pageX,y:b.touches[0].pageY,time:new Date}},nh:function(a){return{target:a.target,x:a.pageX,y:a.pageY,time:new Date}}};dhx.TouchEvents={$init:function(){this.attachEvent("onSwipeX",this.gj);this.attachEvent("onBeforeSelect",this.unSwipe);this.attachEvent("onAfterDelete",this.unSwipe)},gj:function(a){var c=this.locate(a);
c&&c!=this.Ma&&(this.unSwipe(),this.swipe(c))},swipe:function(a){this.Ma=a;this.item(this.Ma).$template="Swipe";this.refresh(this.Ma)},unSwipe:function(){if(this.Ma){var a=this.item(this.Ma);if(a)a.$template="",this.refresh(this.Ma);this.Ma=null}}};dhx.ready(function(){(dhx.env.touch||dhx.env.$touch)&&a.$init()})})();
dhx.DragControl={ga:dhx.toArray(["dummy"]),addDrop:function(a,b,c){a=dhx.toNode(a);a.dhx_drop=this.ye(b);if(c)a.dhx_master=!0},ye:function(a){var a=a||dhx.DragControl,b=this.ga.find(a);if(b<0)b=this.ga.length,this.ga.push(a);return b},addDrag:function(a,b){a=dhx.toNode(a);a.dhx_drag=this.ye(b);dhx.event(a,"mousedown",this.li,a)},li:function(a){dhx.DragControl.la&&(dhx.DragControl.rd(),dhx.DragControl.destroyDrag());dhx.DragControl.la=this;dhx.DragControl.Lf={x:a.pageX,y:a.pageY};dhx.DragControl.yf=
a;dhx.DragControl.rb=dhx.event(document.body,"mousemove",dhx.DragControl.cj);dhx.DragControl.sb=dhx.event(document.body,"mouseup",dhx.DragControl.rd);a.cancelBubble=!0;return!1},rd:function(){dhx.DragControl.rb=dhx.eventRemove(dhx.DragControl.rb);dhx.DragControl.sb=dhx.eventRemove(dhx.DragControl.sb)},cj:function(a){var b={x:a.pageX,y:a.pageY};if(!(Math.abs(b.x-dhx.DragControl.Lf.x)<5&&Math.abs(b.y-dhx.DragControl.Lf.y)<5)&&(dhx.DragControl.rd(),dhx.DragControl.createDrag(dhx.DragControl.yf)))dhx.DragControl.sendSignal("start"),
dhx.DragControl.rb=dhx.event(document.body,"mousemove",dhx.DragControl.df),dhx.DragControl.sb=dhx.event(document.body,"mouseup",dhx.DragControl.dj),dhx.DragControl.df(a)},dj:function(a){dhx.DragControl.rb=dhx.eventRemove(dhx.DragControl.rb);dhx.DragControl.sb=dhx.eventRemove(dhx.DragControl.sb);dhx.DragControl.yf=null;dhx.DragControl.P&&(dhx.DragControl.onDrop(dhx.DragControl.la,dhx.DragControl.P,this.rc,a),dhx.DragControl.onDragOut(dhx.DragControl.la,dhx.DragControl.P,null,a));dhx.DragControl.destroyDrag();
dhx.DragControl.sendSignal("stop")},df:function(a){var b=dhx.html.pos(a);dhx.DragControl.T.style.top=b.y+dhx.DragControl.top+"px";dhx.DragControl.T.style.left=b.x+dhx.DragControl.left+"px";dhx.DragControl.If?dhx.DragControl.If=!1:dhx.DragControl.ug(a.srcElement||a.target,a);a.cancelBubble=!0;return!1},ug:function(a,b){for(;a&&a.tagName!="BODY";){if(a.dhx_drop){if(this.P&&(this.P!=a||a.dhx_master))this.onDragOut(this.la,this.P,a,b);if(!this.P||this.P!=a||a.dhx_master)if(this.P=null,this.rc=this.onDragIn(dhx.DragControl.la,
a,b))this.P=a;return}a=a.parentNode}if(this.P)this.P=this.rc=this.onDragOut(this.la,this.P,null,b)},sendSignal:function(a){dhx.DragControl.active=a=="start"},getMaster:function(a){return this.ga[a.dhx_drag||a.dhx_drop]},getContext:function(){return this.fc},getNode:function(){return this.T},createDrag:function(a){var b=dhx.DragControl.la;dhx.DragControl.fc={};var c=this.ga[b.dhx_drag],d;if(c.onDragCreate){d=c.onDragCreate(b,a);if(!d)return!1;d.style.position="absolute";d.style.zIndex=dhx.ui.zIndex()}else{var e=
dhx.DragControl.onDrag(b,a);if(!e)return!1;d=document.createElement("DIV");d.innerHTML=e;d.className="dhx_drag_zone";document.body.appendChild(d)}d.onmousemove=dhx.DragControl.$i;if(!dhx.DragControl.fc.from)dhx.DragControl.fc={source:b,from:b};dhx.DragControl.T=d;return!0},$i:function(){dhx.DragControl.If=!0},destroyDrag:function(){var a=dhx.DragControl.la,b=this.ga[a.dhx_drag];if(b&&b.onDragDestroy)b.onDragDestroy(a,dhx.DragControl.T);else dhx.html.remove(dhx.DragControl.T);dhx.DragControl.rc=dhx.DragControl.la=
dhx.DragControl.P=dhx.DragControl.T=null},top:5,left:5,onDragIn:function(a,b,c){var d=this.ga[b.dhx_drop];if(d.onDragIn&&d!=this)return d.onDragIn(a,b,c);b.className+=" dhx_drop_zone";return b},onDragOut:function(a,b,c,d){var e=this.ga[b.dhx_drop];if(e.onDragOut&&e!=this)return e.onDragOut(a,b,c,d);b.className=b.className.replace("dhx_drop_zone","");return null},onDrop:function(a,b,c,d){var e=this.ga[b.dhx_drop];dhx.DragControl.fc.from=dhx.DragControl.getMaster(a);if(e.onDrop&&e!=this)return e.onDrop(a,
b,c,d);b.appendChild(a)},onDrag:function(a,b){var c=this.ga[a.dhx_drag];return c.onDrag&&c!=this?c.onDrag(a,b):"<div style='"+a.style.cssText+"'>"+a.innerHTML+"</div>"}};
dhx.DataMove={$init:function(){},copy:function(a,b,c,d){var e=this.item(a);if(e)return c&&(e=c.externalData(e)),c=c||this,c.add(c.externalData(e,d),b)},move:function(a,b,c,d){if(dhx.isArray(a))for(var e=0;e<a.length;e++){var f=(c||this).indexById(this.move(a[e],b,c,d?d[e]:null));a[e+1]&&(b=f+(this.indexById(a[e+1])<f?0:1))}else{var g=a;if(!(b<0)){var h=this.item(a);if(h){if(!c||c==this)this.data.move(this.indexById(a),b);else{if(!d||c.item(d))d=dhx.uid();g=c.add(c.externalData(h,d),b);this.remove(a)}return g}}}},
moveUp:function(a,b){return this.move(a,this.indexById(a)-(b||1))},moveDown:function(a,b){return this.moveUp(a,(b||1)*-1)},moveTop:function(a){return this.move(a,0)},moveBottom:function(a){return this.move(a,this.data.dataCount()-1)},externalData:function(a,b){var c=dhx.extend({},a);c.id=b||dhx.uid();c.$selected=c.$template=null;return c}};
dhx.Movable={move_setter:function(a){if(a)this.vc=dhx.copy(this.vc),this.vc.master=this,dhx.DragControl.addDrag(this.B,this.vc)},vc:{onDragCreate:function(a,b){var c=dhx.html.offset(a),d=dhx.html.pos(b);dhx.DragControl.top=c.y-d.y;dhx.DragControl.left=c.x-d.x;return dhx.toNode(this.master.h)},onDragDestroy:function(){dhx.DragControl.top=dhx.DragControl.left=5}}};
dhx.Scrollable={$init:function(a){if(a&&!a.scroll&&this.ei)return this.i=this.i||this.k;(this.i||this.k).appendChild(dhx.html.create("DIV",{"class":"dhx_scroll_cont"},""));this.i=(this.i||this.k).firstChild},scroll_setter:function(a){if(!a)return!1;dhx.Touch?(a=a=="x"?"x":a=="xy"?"xy":"y",this.i.setAttribute("touch_scroll",a),this.attachEvent&&this.attachEvent("onAfterRender",dhx.bind(this.ti,this)),this.nj=!0):this.i.parentNode.style.overflowY=a?"scroll":"";return a},scrollState:function(){var a=
this.i.offsetWidth-this.$view.offsetWidth,b=this.i.offsetHeight-this.$view.offsetHeight;if(dhx.Touch){var c=dhx.Touch.ed(this.i);return{x:-c.e,y:-c.f,xMax:a,yMax:b}}else return{x:this.i.parentNode.scrollLeft,y:this.i.parentNode.scrollTop,xMax:a,yMax:b}},scrollTo:function(a,b){dhx.Touch?(b=Math.max(0,Math.min(b,this.i.offsetHeight-this.r)),a=Math.max(0,Math.min(a,this.i.offsetWidth-this.m)),dhx.Touch.qa(this.i,-a,-b,this.g.scrollSpeed||"100ms")):(this.i.parentNode.scrollLeft=a,this.i.parentNode.scrollTop=
b)},ti:function(){if(this.g.scroll.indexOf("x")!=-1&&!this.qh)this.i.style.width=this.m+"px",this.i.style.width=this.i.scrollWidth+"px";dhx.Touch&&this.nj&&(dhx.Touch.$b(),dhx.Touch.gb(),dhx.Touch.qa(this.i,0,0,0))}};
dhx.MouseEvents={$init:function(){this.on_click&&dhx.event(this.k,"click",this.Uh,this);this.on_context&&dhx.event(this.k,"contextmenu",this.Vh,this);this.on_dblclick&&dhx.event(this.k,"dblclick",this.Wh,this);this.on_mouse_move&&(dhx.event(this.k,"mousemove",this.hf,this),dhx.event(this.k,dhx.env.isIE?"mouseleave":"mouseout",this.hf,this))},Uh:function(a){return this.yb(a,this.on_click,"ItemClick")},Wh:function(a){return this.yb(a,this.on_dblclick,"ItemDblClick")},Vh:function(a){if(this.yb(a,this.on_context,
"BeforeContextMenu"))return this.yb(a,{},"AfterContextMenu"),dhx.html.preventEvent(a)},hf:function(a){dhx.env.isIE&&(a=document.createEventObject(event));this.cf&&window.clearTimeout(this.cf);this.callEvent("onMouseMoving",[a]);this.cf=window.setTimeout(dhx.bind(function(){a.type=="mousemove"?this.$h(a):this.ai(a)},this),500)},$h:function(a){this.yb(a,this.on_mouse_move,"MouseMove")||this.callEvent("onMouseOut",[a||event])},ai:function(a){this.callEvent("onMouseOut",[a||event])},yb:function(a,b,c){for(var a=
a||event,d=a.target||a.srcElement,e="",f=null,g=!1;d&&d.parentNode;){if(!g&&d.getAttribute&&(f=d.getAttribute(this.G))){if(this.callEvent&&!this.callEvent("on"+c,[f,a,d]))return;g=!0}if(e=d.className)if(e=e.split(" "),e=e[0]||e[1],b[e]){var h=b[e].call(this,a,f||dhx.html.locate(a,this.G),d);if(typeof h!="undefined"&&h!==!0)return}d=d.parentNode}return g}};
(function(){var a={};dhx.Template=function(b){if(typeof b=="function")return b;if(a[b])return a[b];b=(b||"").toString();if(b.indexOf("->")!=-1)switch(b=b.split("->"),b[0]){case "html":b=dhx.html.getValue(b[1]);break;case "http":b=(new dhx.ajax).sync().get(b[1],{uid:dhx.uid()}).responseText}b=(b||"").toString();b=b.replace(/(\r\n|\n)/g,"\\n");b=b.replace(/(\")/g,'\\"');b=b.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"');b=b.replace(/\{common\.([^}\(]*)\}/g,"\"+(common.$1||'')+\"");
b=b.replace(/\{common\.([^\}\(]*)\(\)\}/g,'"+(common.$1?common.$1(obj,common):"")+"');b=b.replace(/\{obj\.([^}]*)\}/g,"\"+(obj.$1||'')+\"");b=b.replace(/#([$a-z0-9_\[\]]+)#/gi,"\"+(obj.$1||'')+\"");b=b.replace(/\{obj\}/g,'"+obj+"');b=b.replace(/\{-obj/g,"{obj");b=b.replace(/\{-common/g,"{common");b='return "'+b+'";';try{Function("obj","common",b)}catch(c){dhx.error("Invalid template:"+b)}return a[b]=Function("obj","common",b)};dhx.Template.empty=function(){return""};dhx.Template.bind=function(a){return dhx.bind(dhx.Template(a),
this)};dhx.Type=function(a,c){if(a.ec){if(!a.tb)a.tb=[];a.tb.push(c)}else{if(typeof a=="function")a=a.prototype;if(!a.types)a.types={"default":a.type},a.type.name="default";var d=c.name,e=a.type;d&&(e=a.types[d]=dhx.copy(c.baseType?a.types[c.baseType]:a.type));for(var f in c)e[f]=f.indexOf("template")===0?dhx.Template(c[f]):c[f];return d}}})();
dhx.Settings={$init:function(){this.g=this.config={}},define:function(a,b){return typeof a=="object"?this.mf(a):this.ke(a,b)},ke:function(a,b){var c=this[a+"_setter"];return this.g[a]=c?c.call(this,b,a):b},mf:function(a){if(a)for(var b in a)this.ke(b,a[b])},cb:function(a,b){var c={};b&&(c=dhx.extend(c,b));typeof a=="object"&&!a.tagName&&dhx.extend(c,a,!0);this.mf(c)},L:function(a,b){for(var c in b)switch(typeof a[c]){case "object":a[c]=this.L(a[c]||{},b[c]);break;case "undefined":a[c]=b[c]}return a}};
dhx.math={};dhx.math.Od="0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F".split(",");dhx.math.toHex=function(a,b){for(var a=parseInt(a,10),c="";a>0;)c=this.Od[a%16]+c,a=Math.floor(a/16);for(;c.length<b;)c="0"+c;return c};dhx.math.toFixed=function(a){return a<10?"0"+a:a};
dhx.Number={format:function(a,b){var b=b||dhx.i18n,a=parseFloat(a),c=a.toFixed(b.decimalSize).toString(),c=c.split("."),d="";if(b.groupSize){var e=b.groupSize,f=c[0].length;do{f-=e;var g=f>0?c[0].substr(f,e):c[0].substr(0,e+f),d=g+(d?b.groupDelimiter+d:"")}while(f>0)}else d=c[0];return b.decimalSize?d+b.decimalDelimeter+c[1]:d},numToStr:function(a){return function(b){return dhx.Number.format(b,a)}}};
dhx.Date={Locale:{month_full:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),month_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),day_full:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},weekStart:function(a){var b=a.getDay();this.config.start_on_monday&&(b===0?b=6:b--);return this.date_part(this.add(a,-1*b,"day"))},monthStart:function(a){a.setDate(1);return this.date_part(a)},
yearStart:function(a){a.setMonth(0);return this.month_start(a)},dayStart:function(a){return this.date_part(a)},dateToStr:function(a,b){a=a.replace(/%[a-zA-Z]/g,function(a){switch(a){case "%d":return'"+dhx.math.toFixed(date.getDate())+"';case "%m":return'"+dhx.math.toFixed((date.getMonth()+1))+"';case "%j":return'"+date.getDate()+"';case "%n":return'"+(date.getMonth()+1)+"';case "%y":return'"+dhx.math.toFixed(date.getFullYear()%100)+"';case "%Y":return'"+date.getFullYear()+"';case "%D":return'"+dhx.Date.Locale.day_short[date.getDay()]+"';
case "%l":return'"+dhx.Date.Locale.day_full[date.getDay()]+"';case "%M":return'"+dhx.Date.Locale.month_short[date.getMonth()]+"';case "%F":return'"+dhx.Date.Locale.month_full[date.getMonth()]+"';case "%h":return'"+dhx.math.toFixed((date.getHours()+11)%12+1)+"';case "%g":return'"+((date.getHours()+11)%12+1)+"';case "%G":return'"+date.getHours()+"';case "%H":return'"+dhx.math.toFixed(date.getHours())+"';case "%i":return'"+dhx.math.toFixed(date.getMinutes())+"';case "%a":return'"+(date.getHours()>11?"pm":"am")+"';
case "%A":return'"+(date.getHours()>11?"PM":"AM")+"';case "%s":return'"+dhx.math.toFixed(date.getSeconds())+"';case "%W":return'"+dhx.math.toFixed(dhx.Date.getISOWeek(date))+"';default:return a}});b===!0&&(a=a.replace(/date\.get/g,"date.getUTC"));return new Function("date",'return "'+a+'";')},strToDate:function(a,b){var c="var temp=date.split(/[^0-9a-zA-Z]+/g);",d=a.match(/%[a-zA-Z]/g),e,f,g;if(!dhx.Date.Locale.month_short_hash){g=dhx.Date.Locale.month_short;f=dhx.Date.Locale.month_short_hash={};
for(e=0;e<g.length;e++)f[g[e]]=e;g=dhx.Date.Locale.month_full;f=dhx.Date.Locale.month_full_hash={};for(e=0;e<g.length;e++)f[g[e]]=e}for(e=0;e<d.length;e++)switch(d[e]){case "%j":case "%d":c+="set[2]=temp["+e+"]||1;";break;case "%n":case "%m":c+="set[1]=(temp["+e+"]||1)-1;";break;case "%y":c+="set[0]=temp["+e+"]*1+(temp["+e+"]>50?1900:2000);";break;case "%g":case "%G":case "%h":case "%H":c+="set[3]=temp["+e+"]||0;";break;case "%i":c+="set[4]=temp["+e+"]||0;";break;case "%Y":c+="set[0]=temp["+e+"]||0;";
break;case "%a":case "%A":c+="set[3]=set[3]%12+((temp["+e+"]||'').toLowerCase()=='am'?0:12);";break;case "%s":c+="set[5]=temp["+e+"]||0;";break;case "%M":c+="set[1]=dhx.Date.Locale.month_short_hash[temp["+e+"]]||0;";break;case "%F":c+="set[1]=dhx.Date.Locale.month_full_hash[temp["+e+"]]||0;"}var h="set[0],set[1],set[2],set[3],set[4],set[5]";b&&(h=" Date.UTC("+h+")");return new Function("date","var set=[0,0,1,0,0,0]; "+c+" return new Date("+h+");")},getISOWeek:function(a){if(!a)return!1;var b=a.getDay();
b===0&&(b=7);var c=new Date(a.valueOf());c.setDate(a.getDate()+(4-b));var d=c.getFullYear(),e=Math.floor((c.getTime()-(new Date(d,0,1)).getTime())/864E5),f=1+Math.floor(e/7);return f},getUTCISOWeek:function(a){return this.getISOWeek(a)},add:function(a,b,c){var d=new Date(a.valueOf());switch(c){case "day":d.setDate(d.getDate()+b);break;case "week":d.setDate(d.getDate()+7*b);break;case "month":d.setMonth(d.getMonth()+b);break;case "year":d.setYear(d.getFullYear()+b);break;case "hour":d.setHours(d.getHours()+
b);break;case "minute":d.setMinutes(d.getMinutes()+b);break;default:dhx.Date.add[c](d,b,c)}return d},datePart:function(a){var b=this.copy(a);b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);return b},timePart:function(a){var b=this.copy(a);return(b.valueOf()/1E3-b.getTimezoneOffset()*60)%86400},copy:function(a){return new Date(a.valueOf())}};
dhx.i18n={dateMethods:["fullDateFormat","timeFormat","dateFormat","longDateFormat"],dateFormat:"%d.%m.%Y",timeFormat:"%H:%i",longDateFormat:"%l, %d %F %Y",fullDateFormat:"%d-%m-%Y %H:%i",groupDelimiter:".",groupSize:3,decimalDelimeter:",",decimalSize:2,numberFormat:dhx.Number.format,setLocale:function(){for(var a=dhx.i18n.dateMethods,b=0;b<a.length;b++){var c=a[b],d=dhx.i18n[c+"UTC"];dhx.i18n[c+"Str"]=dhx.Date.dateToStr(dhx.i18n[c],d);dhx.i18n[c+"Date"]=dhx.Date.strToDate(dhx.i18n[c],d)}}};dhx.i18n.setLocale("en");
dhx.format=function(a){a=a||{};this.$init(a)};
dhx.format.prototype={$init:function(a){this.g={};this.g.groupDelimiter=a.groupDelimiter||" ";this.g.groupNumber=a.groupNumber||3;this.g.decimalPoint=a.decimalPoint||",";this.g.fractNumber=a.fractNumber||5;this.g.dateFormat=a.dateFormat||"%Y/%m/%d";this.g.stringTemplate=a.stringTemplate||"{value}";this.Ej=dhx.Date.str_to_date(this.g.dateFormat);this.Gg=dhx.Date.date_to_str(this.g.dateFormat)},define:function(a,b){this.g[a]=b},format:function(a,b){b=b||this.formatAutoDefine(a);return this["format__"+
b]?this["format__"+b](a):a},formatAutoDefine:function(a){return typeof a=="number"||a instanceof Number?"number":a instanceof Date?"date":typeof a=="string"||a instanceof String?isNaN(parseFloat(a))?"string":"number":!1},format__number:function(a){var b="";typeof a=="number"||a instanceof Number||(a=parseFloat(a));var c=a.toFixed(this.g.fractNumber).toString(),c=c.split("."),d=this.add_delimiter_to_int(c[0]),e=this.str_reverse(this.add_delimiter_to_int(this.str_reverse(c[1])));return b=d+this.g.decimalPoint+
e},add_delimiter_to_int:function(a){for(var b=0,c="",d=a.length-1;d>=0;d--)c=a[d]+c,b++,b==this.g.groupNumber&&(c=this.g.groupDelimiter+c,b=0);return c},str_reverse:function(a){for(var b="",c=a.length-1;c>=0;c--)b+=a[c];return b},format__date:function(a){var b=this.Gg(a);return b},attachFormat:function(a,b){this["format__"+a]=b},format__string:function(a){var b=this.g.stringTemplate.replace("{value}",a);return b},format__bold:function(a){return typeof a=="string"||a instanceof String?a.bold():a}};
dhx.i18n.setLocale();
dhx.Destruction={$init:function(){dhx.destructors.push(this)},destructor:function(){this.destructor=function(){};if(this.j)for(var a=0;a<this.j.length;a++)this.j[a].destructor();if(this.pc){var b=dhx.ui.get(this.pc);b&&b.destructor()}delete dhx.ui.views[this.g.id];this.xa=this.u=null;this.T&&document.body.appendChild(this.T);this.T=null;if(this.k)this.k.innerHTML="",this.k.u=null;this.k=this.i=null;this.h&&this.h.parentNode&&this.h.parentNode.removeChild(this.h);this.data=null;this.s=this.Ua={}}};
dhx.destructors=[];dhx.event(window,"unload",function(){for(var a=0;a<dhx.destructors.length;a++)dhx.destructors[a].destructor();dhx.destructors=[];for(var b in dhx.s){var c=dhx.s[b];c[0].removeEventListener?c[0].removeEventListener(c[1],c[2],!1):c[0].detachEvent&&c[0].detachEvent("on"+c[1],c[2]);delete dhx.s[b]}});dhx.ajax=function(a,b,c){if(arguments.length!==0){var d=new dhx.ajax;if(c)d.master=c;return d.get(a,null,b)}return!this.getXHR?new dhx.ajax:this};dhx.ajax.count=0;
dhx.ajax.prototype={getXHR:function(){return dhx.env.isIE?new ActiveXObject("Microsoft.xmlHTTP"):new XMLHttpRequest},send:function(a,b,c){var d=this.getXHR();dhx.isArray(c)||(c=[c]);if(typeof b=="object"){var e=[],f;for(f in b){var g=b[f];if(g===null||g===dhx.undefined)g="";e.push(f+"="+encodeURIComponent(g))}b=e.join("&")}b&&!this.post&&(a=a+(a.indexOf("?")!=-1?"&":"?")+b,b=null);d.open(this.post?"POST":"GET",a,!this.ij);this.post&&d.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var h=this;d.onreadystatechange=function(){if(!d.readyState||d.readyState==4){dhx.ajax.count++;if(c&&h)for(var a=0;a<c.length;a++)if(c[a]){var b=c[a].success||c[a];if(d.status>=400||!d.status&&!d.responseText)b=c[a].error;b&&b.call(h.master||h,d.responseText,d.responseXML,d)}c=h=h.master=null}};d.send(b||null);return d},get:function(a,b,c){this.post=!1;return this.send(a,b,c)},post:function(a,b,c){this.post=!0;return this.send(a,b,c)},sync:function(){this.ij=!0;return this}};
dhx.send=function(a,b,c){var d=dhx.html.create("FORM",{action:a,method:c||"POST"},""),e;for(e in b){var f=dhx.html.create("INPUT",{type:"hidden",name:e,value:b[e]},"");d.appendChild(f)}d.style.display="none";document.body.appendChild(d);d.submit();document.body.removeChild(d)};
dhx.AtomDataLoader={$init:function(a){this.data={};if(a)this.g.datatype=a.datatype||"json",this.$ready.push(this.Kh)},Kh:function(){this.pf=!0;this.g.url&&this.url_setter(this.g.url);this.g.data&&this.data_setter(this.g.data)},url_setter:function(a){if(!this.pf)return a;this.load(a,this.g.datatype);return a},data_setter:function(a){if(!this.pf)return a;this.parse(a,this.g.datatype);return!0},load:function(a,b,c){if(a.$proxy)a.load(this,typeof b=="string"?b:"json");else{this.callEvent("onXLS",[]);
typeof b=="string"?(this.data.driver=dhx.DataDriver[b],b=c):this.data.driver=dhx.DataDriver.json;var d=[{success:this.yc,error:this.Xh}];b&&(dhx.isArray(b)?d.push.apply(d,b):d.push(b));return dhx.ajax(a,d,this)}},parse:function(a,b){this.callEvent("onXLS",[]);this.data.driver=dhx.DataDriver[b||"json"];this.yc(a,null)},yc:function(a,b){var c=this.data.driver,d=c.getRecords(c.toObject(a,b))[0];this.data=c?c.getDetails(d):a;this.callEvent("onXLE",[])},Xh:function(){this.callEvent("onXLE",[]);this.callEvent("onLoadingError",
arguments)},de:function(a){if(!this.g.dataFeed||this.Le||!a)return!0;var b=this.g.dataFeed;if(typeof b=="function")return b.call(this,a.id||a,a);b=b+(b.indexOf("?")==-1?"?":"&")+"action=get&id="+encodeURIComponent(a.id||a);this.callEvent("onXLS",[]);dhx.ajax(b,function(a){this.Le=!0;this.setValues(dhx.DataDriver.json.toObject(a)[0]);this.Le=!1;this.callEvent("onXLE",[])},this);return!1}};dhx.DataDriver={};
dhx.DataDriver.json={toObject:function(a){a||(a="[]");if(typeof a=="string")eval("dhx.temp="+a),a=dhx.temp;if(a.data){var b=a.data;b.pos=a.pos;b.total_count=a.total_count;a=b}return a},getRecords:function(a){return a&&!dhx.isArray(a)?[a]:a},getDetails:function(a){return a},getInfo:function(a){return{ib:a.total_count||0,Ea:a.pos||0}}};
dhx.DataDriver.html={toObject:function(a){if(typeof a=="string"){var b=null;a.indexOf("<")==-1&&(b=dhx.toNode(a));if(!b)b=document.createElement("DIV"),b.innerHTML=a;return b.getElementsByTagName(this.tag)}return a},getRecords:function(a){return a.tagName?a.childNodes:a},getDetails:function(a){return dhx.DataDriver.xml.tagToObject(a)},getInfo:function(){return{ib:0,Ea:0}},tag:"LI"};
dhx.DataDriver.jsarray={toObject:function(a){return typeof a=="string"?(eval("dhx.temp="+a),dhx.temp):a},getRecords:function(a){return a},getDetails:function(a){for(var b={},c=0;c<a.length;c++)b["data"+c]=a[c];return b},getInfo:function(){return{ib:0,Ea:0}}};
dhx.DataDriver.csv={toObject:function(a){return a},getRecords:function(a){return a.split(this.row)},getDetails:function(a){for(var a=this.stringToArray(a),b={},c=0;c<a.length;c++)b["data"+c]=a[c];return b},getInfo:function(){return{ib:0,Ea:0}},stringToArray:function(a){for(var a=a.split(this.cell),b=0;b<a.length;b++)a[b]=a[b].replace(/^[ \t\n\r]*(\"|)/g,"").replace(/(\"|)[ \t\n\r]*$/g,"");return a},row:"\n",cell:","};
dhx.DataDriver.xml={toObject:function(a,b){return b&&(b=this.checkResponse(a,b))?b:typeof a=="string"?this.fromString(a):a},getRecords:function(a){return this.xpath(a,this.records)},records:"/*/item",getDetails:function(a){return this.tagToObject(a,{})},getInfo:function(a){return{ib:a.documentElement.getAttribute("total_count")||0,Ea:a.documentElement.getAttribute("pos")||0}},xpath:function(a,b){if(window.XPathResult){var c=a;if(a.nodeName.indexOf("document")==-1)a=a.ownerDocument;for(var d=[],e=
a.evaluate(b,c,null,XPathResult.ANY_TYPE,null),f=e.iterateNext();f;)d.push(f),f=e.iterateNext();return d}else{var g=!0;try{typeof a.selectNodes=="undefined"&&(g=!1)}catch(h){}if(g)return a.selectNodes(b);else{var i=b.split("/").pop();return a.getElementsByTagName(i)}}},tagToObject:function(a,b){var b=b||{},c=!1,d=a.attributes;if(d&&d.length){for(var e=0;e<d.length;e++)b[d[e].name]=d[e].value;c=!0}for(var f=a.childNodes,g={},e=0;e<f.length;e++)if(f[e].nodeType==1){var h=f[e].tagName;typeof b[h]!="undefined"?
(dhx.isArray(b[h])||(b[h]=[b[h]]),b[h].push(this.tagToObject(f[e],{}))):b[f[e].tagName]=this.tagToObject(f[e],{});c=!0}if(!c)return this.nodeValue(a);b.value=b.value||this.nodeValue(a);return b},nodeValue:function(a){return a.firstChild?a.firstChild.data:""},fromString:function(a){if(window.DOMParser)return(new DOMParser).parseFromString(a,"text/xml");if(window.ActiveXObject){var b=new ActiveXObject("Microsoft.xmlDOM");b.loadXML(a);return b}dhx.error("Load from xml string is not supported")},checkResponse:function(a,
b){if(b&&b.firstChild&&b.firstChild.tagName!="parsererror")return b;var c=this.fromString(a.replace(/^[\s]+/,""));if(c)return c;dhx.error("xml can't be parsed",a)}};
dhx.DataLoader=dhx.proto({$init:function(a){a=a||"";this.nb=dhx.toArray();this.data=a.datastore||new dhx.DataStore;this.ud=this.data.attachEvent("onStoreLoad",dhx.bind(this.sg,this));this.data.attachEvent("onClearAll",dhx.bind(this.qg,this));this.data.feed=this.Yg},Yg:function(a,b,c){if(this.tc)return this.tc=[a,b,c];else this.tc=!0;var d=this.data.url;this.load(d+(d.indexOf("?")==-1?"?":"&")+(this.dataCount()?"continue=true&":"")+"start="+a+"&count="+b,[function(){var c=this.tc;this.tc=!1;typeof c==
"object"&&(c[0]!=a||c[1]!=b)&&this.data.feed.apply(this,c)},c])},load:function(a,b){var c=dhx.AtomDataLoader.load.apply(this,arguments);this.nb.push(c);if(!this.data.url)this.data.url=a},loadNext:function(a,b,c,d,e){this.g.datathrottle&&!e?(this.Pf&&window.clearTimeout(this.Pf),this.Pf=dhx.delay(function(){this.loadNext(a,b,c,d,!0)},this,0,this.g.datathrottle)):(!b&&b!==0&&(b=this.dataCount()),this.data.url=this.data.url||d,this.callEvent("onDataRequest",[b,a,c,d])&&this.data.url&&this.data.feed.call(this,
b,a,c))},yc:function(a,b,c){this.nb.remove(c);this.data.ki(this.data.driver.toObject(a,b));this.callEvent("onXLE",[]);if(this.ud)this.data.detachEvent(this.ud),this.ud=null},scheme_setter:function(a){this.data.scheme(a)},dataFeed_setter:function(a){this.data.attachEvent("onBeforeFilter",dhx.bind(function(a,c){if(this.g.dataFeed){var d={};if(a||c){if(typeof a=="function"){if(!c)return;a(c,d)}else d={text:c};this.clearAll();var e=this.g.dataFeed,f=[];if(typeof e=="function")return e.call(this,c,d);
for(var g in d)f.push("dhx_filter["+g+"]="+encodeURIComponent(d[g]));this.load(e+(e.indexOf("?")<0?"?":"&")+f.join("&"),this.g.datatype);return!1}}},this));return a},sg:function(){if(this.g.ready){var a=dhx.toFunctor(this.g.ready);a&&a.call&&a.apply(this,arguments)}},qg:function(){for(var a=0;a<this.nb.length;a++)this.nb[a].abort();this.nb=dhx.toArray()}},dhx.AtomDataLoader).prototype;
dhx.DataStore=function(){this.name="DataStore";dhx.extend(this,dhx.EventSystem);this.setDriver("xml");this.pull={};this.order=dhx.toArray()};
dhx.DataStore.prototype={setDriver:function(a){this.driver=dhx.DataDriver[a]},ki:function(a){this.callEvent("onParse",[this.driver,a]);this.A&&this.filter();var b=this.driver.getInfo(a),c=this.driver.getRecords(a),d=(b.Ea||0)*1,e=!0;if(d===0&&this.order[0])e=!1,d=this.order.length;for(var f=0,g=0;g<c.length;g++){var h=this.driver.getDetails(c[g]),i=this.id(h);this.pull[i]?e&&this.order[f+d]&&f++:(this.order[f+d]=i,f++);this.pull[i]=h;this.extraParser&&this.extraParser(h);this.Gb&&(this.Dc?this.Dc(h):
this.fb&&this.fb(h))}if(!this.order[b.ib-1])this.order[b.ib-1]=dhx.undefined;this.callEvent("onStoreLoad",[this.driver,a]);this.refresh()},id:function(a){return a.id||(a.id=dhx.uid())},changeId:function(a,b){this.pull[a]&&(this.pull[b]=this.pull[a]);this.pull[b].id=b;this.order[this.order.find(a)]=b;this.A&&(this.A[this.A.find(a)]=b);this.callEvent("onIdChange",[a,b]);this.Ad&&this.Ad(a,b);delete this.pull[a]},item:function(a){return this.pull[a]},update:function(a,b){this.fb&&this.fb(b);if(this.callEvent("onBeforeUpdate",
[a,b])===!1)return!1;this.pull[a]=b;this.refresh(a)},refresh:function(a){this.Jf||(a?this.callEvent("onStoreUpdated",[a,this.pull[a],"update"]):this.callEvent("onStoreUpdated",[null,null,null]))},silent:function(a,b){this.Jf=!0;a.call(b||this);this.Jf=!1},getRange:function(a,b){a=a?this.indexById(a):this.startOffset||0;b?b=this.indexById(b):(b=Math.min(this.endOffset||Infinity,this.dataCount()-1),b<0&&(b=0));if(a>b)var c=b,b=a,a=c;return this.getIndexRange(a,b)},getIndexRange:function(a,b){for(var b=
Math.min(b||Infinity,this.dataCount()-1),c=dhx.toArray(),d=a||0;d<=b;d++)c.push(this.item(this.order[d]));return c},dataCount:function(){return this.order.length},exists:function(a){return!!this.pull[a]},move:function(a,b){if(a<0||b<0)dhx.error("DataStore::move","Incorrect indexes");else{var c=this.idByIndex(a),d=this.item(c);this.order.removeAt(a);this.order.insertAt(c,Math.min(this.order.length,b));this.callEvent("onStoreUpdated",[c,d,"move"])}},scheme:function(a){this.Gb={};this.Dc=a.$init;this.fb=
a.$update;this.zf=a.$serialize;for(var b in a)b.substr(0,1)!="$"&&(this.Gb[b]=a[b])},sync:function(a,b,c){typeof b!="function"&&(c=b,b=null);if(a.name!="DataStore")a=a.data;var d=dhx.bind(function(){this.order=dhx.toArray([].concat(a.order));this.A=null;this.pull=a.pull;b&&this.silent(b);this.lf&&this.lf();c?c=!1:this.refresh()},this);a.attachEvent("onStoreUpdated",d);d()},add:function(a,b){if(this.Gb){var a=a||{},c;for(c in this.Gb)a[c]=a[c]||this.Gb[c];this.Dc?this.Dc(a):this.fb&&this.fb(a)}var d=
this.id(a),e=this.dataCount();if(dhx.isUndefined(b)||b<0)b=e;b>e&&(b=Math.min(this.order.length,b));if(this.callEvent("onBeforeAdd",[d,a,b])===!1)return!1;if(this.exists(d))return dhx.error("Not unique ID");this.pull[d]=a;this.order.insertAt(d,b);if(this.A){var f=this.A.length;!b&&this.order.length&&(f=0);this.A.insertAt(d,f)}this.callEvent("onafterAdd",[d,b]);this.callEvent("onStoreUpdated",[d,a,"add"]);return d},remove:function(a){if(dhx.isArray(a))for(var b=0;b<a.length;b++)this.remove(a[b]);else{if(this.callEvent("onBeforeDelete",
[a])===!1)return!1;if(!this.exists(a))return dhx.error("Not existing ID",a);var c=this.item(a);this.order.remove(a);this.A&&this.A.remove(a);delete this.pull[a];this.callEvent("onafterdelete",[a]);this.callEvent("onStoreUpdated",[a,c,"delete"])}},clearAll:function(){this.pull={};this.order=dhx.toArray();this.A=null;this.callEvent("onClearAll",[]);this.refresh()},idByIndex:function(a){return this.order[a]},indexById:function(a){var b=this.order.find(a);return b},next:function(a,b){return this.order[this.indexById(a)+
(b||1)]},first:function(){return this.order[0]},last:function(){return this.order[this.order.length-1]},previous:function(a,b){return this.order[this.indexById(a)-(b||1)]},sort:function(a,b,c){var d=a;typeof a=="function"?d={as:a,dir:b}:typeof a=="string"&&(d={by:a,dir:b,as:c});var e=[d.by,d.dir,d.as];if(this.callEvent("onbeforesort",e)){if(this.order.length){var f=dhx.sort.create(d),g=this.getRange(this.first(),this.last());g.sort(f);this.order=g.map(function(a){return this.id(a)},this)}this.refresh();
this.callEvent("onaftersort",e)}},filter:function(a,b,c){if(this.callEvent("onBeforeFilter",[a,b])){if(this.A&&!c)this.order=this.A,delete this.A;if(this.order.length){if(a){var d=a,b=b||"";typeof a=="string"&&(a=dhx.Template(a),b=b.toString().toLowerCase(),d=function(b,c){return a(b).toLowerCase().indexOf(c)!=-1});for(var e=dhx.toArray(),f=0;f<this.order.length;f++){var g=this.order[f];d(this.item(g),b)&&e.push(g)}if(!c||!this.A)this.A=this.order;this.order=e}this.refresh();this.callEvent("onAfterFilter",
[])}}},each:function(a,b){for(var c=0;c<this.order.length;c++)a.call(b||this,this.item(this.order[c]))},af:function(a,b){return function(){return a[b].apply(a,arguments)}},provideApi:function(a,b){b&&this.mapEvent({onbeforesort:a,onaftersort:a,onbeforeadd:a,onafteradd:a,onbeforedelete:a,onafterdelete:a,onbeforeupdate:a});for(var c="sort,add,remove,exists,idByIndex,indexById,item,update,refresh,dataCount,filter,next,previous,clearAll,first,last,serialize,sync".split(","),d=0;d<c.length;d++)a[c[d]]=
this.af(this,c[d])},serialize:function(){for(var a=this.order,b=[],c=0;c<a.length;c++){var d=this.pull[a[c]];if(this.zf&&(d=this.zf(d),d===!1))continue;b.push(d)}return b}};
dhx.sort={create:function(a){return dhx.sort.dir(a.dir,dhx.sort.by(a.by,a.as))},as:{"int":function(a,b){a*=1;b*=1;return a>b?1:a<b?-1:0},string_strict:function(a,b){a=a.toString();b=b.toString();return a>b?1:a<b?-1:0},string:function(a,b){a=a.toString().toLowerCase();b=b.toString().toLowerCase();return a>b?1:a<b?-1:0}},by:function(a,b){if(!a)return b;typeof b!="function"&&(b=dhx.sort.as[b||"string"]);a=dhx.Template(a);return function(c,d){return b(a(c),a(d))}},dir:function(a,b){return a=="asc"||!a?
b:function(a,d){return b(a,d)*-1}}};
dhx.BaseBind={bind:function(a,b,c){typeof a=="string"&&(a=dhx.ui.get(a));a.jd&&a.jd();this.jd&&this.jd();a.getBindData||dhx.extend(a,dhx.BindSource);if(!this.kg){var d=this.render;if(this.filter){var e=this.g.id;this.data.lf=function(){a.ob[e]=!1}}this.render=function(){if(!this.Me){this.Me=!0;var a=this.callEvent("onBindRequest");this.Me=!1;return d.apply(this,a===!1?arguments:[])}};if(this.getValue||this.getValues)this.save=function(){if(!this.validate||this.validate())a.setBindData(this.getValue?this.getValue:
this.getValues(),this.g.id)};this.kg=!0}a.addBind(this.g.id,b,c);var f=this.g.id;this.attachEvent(this.touchable?"onAfterRender":"onBindRequest",function(){return a.getBindData(f)});!this.g.dataFeed&&this.loadNext&&this.data.attachEvent("onStoreLoad",function(){a.ob[f]=!1});this.isVisible(this.g.id)&&this.refresh()}};
dhx.BindSource={$init:function(){this.Wb={};this.ob={};this.hd={};this.lg(this)},saveBatch:function(a){this.le=!0;a.call(this);this.le=!1;this.Ob()},setBindData:function(a,b){b&&(this.hd[b]=!0);if(this.setValue)this.setValue(a);else if(this.setValues)this.setValues(a);else{var c=this.getCursor();c&&(a=dhx.extend(this.item(c),a,!0),this.update(c,a))}this.callEvent("onBindUpdate",[a,b]);this.save&&this.save();b&&(this.hd[b]=!1)},getBindData:function(a,b){if(this.ob[a])return!1;var c=dhx.ui.get(a);c.isVisible(c.g.id)&&
(this.ob[a]=!0,this.Mc(c,this.Wb[a][0],this.Wb[a][1]),b&&c.filter&&c.refresh())},addBind:function(a,b,c){this.Wb[a]=[b,c]},lg:function(a){a.filter?dhx.extend(this,dhx.CollectionBind):a.setValue?dhx.extend(this,dhx.ValueBind):dhx.extend(this,dhx.RecordBind)},Ob:function(){if(!this.le)for(var a in this.Wb)this.hd[a]||(this.ob[a]=!1,this.getBindData(a,!0))},Xd:function(a,b,c){a.setValue?a.setValue(c?c[b]:c):a.filter?a.data.silent(function(){this.filter(b,c)}):!c&&a.clear?a.clear():a.de(c)&&a.setValues(dhx.copy(c));
a.callEvent("onBindApply",[c,b,this])}};dhx.DataValue=dhx.proto({name:"DataValue",isVisible:function(){return!0},$init:function(a){var b=(this.data=a)&&a.id?a.id:dhx.uid();this.g={id:b};dhx.ui.views[b]=this},setValue:function(a){this.data=a;this.callEvent("onChange",[a])},getValue:function(){return this.data},refresh:function(){this.callEvent("onBindRequest")}},dhx.EventSystem,dhx.BaseBind);
dhx.DataRecord=dhx.proto({name:"DataRecord",isVisible:function(){return!0},$init:function(a){this.data=a||{};var b=a&&a.id?a.id:dhx.uid();this.g={id:b};dhx.ui.views[b]=this},getValues:function(){return this.data},setValues:function(a){this.data=a;this.callEvent("onChange",[a])},refresh:function(){this.callEvent("onBindRequest")}},dhx.EventSystem,dhx.BaseBind,dhx.AtomDataLoader,dhx.Settings);
dhx.DataCollection=dhx.proto({name:"DataCollection",isVisible:function(){return!this.data.order.length&&!this.data.A&&!this.g.dataFeed?!1:!0},$init:function(a){this.data.provideApi(this,!0);var b=a&&a.id?a.id:dhx.uid();this.g.id=b;dhx.ui.views[b]=this;this.data.attachEvent("onStoreLoad",dhx.bind(function(){this.callEvent("onBindRequest",[])},this))},refresh:function(){this.callEvent("onBindRequest",[])}},dhx.EventSystem,dhx.DataLoader,dhx.BaseBind,dhx.Settings);
dhx.ValueBind={$init:function(){this.attachEvent("onChange",this.Ob)},Mc:function(a,b,c){var d=this.getValue()||"";c&&(d=c(d));if(a.setValue)a.setValue(d);else if(a.filter)a.data.silent(function(){this.filter(b,d)});else{var e={};e[b]=d;a.de(d)&&a.setValues(e)}a.callEvent("onBindApply",[d,b,this])}};dhx.RecordBind={$init:function(){this.attachEvent("onChange",this.Ob)},Mc:function(a,b){var c=this.getValues()||null;this.Xd(a,b,c)}};
dhx.CollectionBind={$init:function(){this.ua=null;this.attachEvent("onSelectChange",function(){var a=this.getSelected();this.setCursor(a?a.id||a:null)});this.attachEvent("onAfterCursorChange",this.Ob);this.data.attachEvent("onStoreUpdated",dhx.bind(function(a){a&&a==this.getCursor()&&this.Ob()},this));this.data.attachEvent("onClearAll",dhx.bind(function(){this.ua=null},this));this.data.attachEvent("onIdChange",dhx.bind(function(a,b){if(this.ua==a)this.ua=b},this))},setCursor:function(a){if(!(a==this.ua||
a!==null&&!this.item(a)))this.callEvent("onBeforeCursorChange",[this.ua]),this.ua=a,this.callEvent("onAfterCursorChange",[a])},getCursor:function(){return this.ua},Mc:function(a,b){var c=this.item(this.getCursor())||null;this.Xd(a,b,c)}};
dhx.AtomRender={sa:function(a){return this.g.template(a,this)},render:function(){if(this.isVisible(this.g.id)){if(!this.callEvent||this.callEvent("onBeforeRender",[this.data])){if(this.data)this.i.innerHTML=this.sa(this.data);this.callEvent&&this.callEvent("onAfterRender",[])}return!0}return!1},template_setter:dhx.Template};
dhx.SingleRender=dhx.proto({sa:function(a){var b=this.type;return(b.templateStart?b.templateStart(a,b):"")+b.template(a,b)+(b.templateEnd?b.templateEnd(a,b):"")},customize:function(a){dhx.Type(this,a)}},dhx.AtomRender);
dhx.ActiveContent={$init:function(a){if(a.activeContent){this.$ready.push(this.vh);this.Rb={};this.Sb={};this.mb={};this.Lc={};for(var b in a.activeContent)if(this[b]=this.jg(b),a.activeContent[b].earlyInit){var c=dhx.H;dhx.H=null;this[b].call(this,{},this,a.activeContent);dhx.H=c}}},vh:function(){if(this.filter){for(var a in this.g.activeContent)this.type[a]=this[a],this[a]=this.Lh(a);this.type.masterUI=this}},Lh:function(a){return function(b){for(var c=this.Lc[a],d=c.g.id,e=this.ca(b).getElementsByTagName("DIV"),
f=0;f<e.length;f++)if(e[f].getAttribute("view_id")==d){c.h=c.i=e[f];break}return c}},mh:function(a,b,c){return function(d){if(d)for(var e=d.target||d.srcElement;e;){if(e.getAttribute&&e.getAttribute("view_id")){a.i=a.h=a.$view=e;if(c.locate){var f=c.locate(e.parentNode),g=c.mb[b][f];a.g.value=g;a.g.$masterId=f}return e}e=e.parentNode}return a.h}},Vi:function(a,b){return function(c){var d=b.data;if(b.filter){var e=b.locate(this.h.parentNode),d=b.item(e);b.Sb[a][e]=this.h.outerHTML||(new XMLSerializer).serializeToString(this.h);
b.mb[a][e]=c}d[a]=c}},jg:function(a){return function(b,c,d){var e=c.Rb?c:c.masterUI;if(!e.Rb[a]){var f=document.createElement("DIV"),d=d||e.g.activeContent,g=dhx.ui(d[a],f);g.getNode=e.mh(g,a,e);g.attachEvent("onChange",e.Vi(a,e));e.Lc[a]=g;e.Rb[a]=f.innerHTML;e.Sb[a]={};e.mb[a]={}}e.filter&&b[a]!=e.mb[a]&&!dhx.isUndefined(b[a])&&(g=e.Lc[a],g.blockEvent(),g.setValue(b[a]),g.unblockEvent(),e.mb[a][b.id]=b[a],e.Sb[a][b.id]=g.h.outerHTML||(new XMLSerializer).serializeToString(g.h));return e.Sb[a][b.id]||
e.Rb[a]}}};dhx.IdSpace={$init:function(){var a=dhx.Ta;this.Da={};dhx.Ta=this;this.Tf={};this.getTopParent=dhx.bind(function(){return this},this);this.$ready.push(function(){dhx.Ta=a;for(var b in this.Da)this.Da[b].mapEvent&&!this.Da[b].ya.onitemclick&&this.Da[b].mapEvent({onbeforetabclick:this,onaftertabclick:this,onitemclick:this}),this.Da[b].getTopParent=this.getTopParent})},$$:function(a){return this.Da[a]},innerId:function(a){return this.Tf[a]}};
(function(){var a=[],b=dhx.ui;if(!dhx.ui)b=dhx.ui=function(c,d,e){dhx.Wf=!0;var f=c,f=dhx.toNode(c.container||d||document.body);f==document.body&&dhx.ui.we();var g=c.g||f&&f.j&&!e?c:b.Aa(c);f.appendChild?(f.appendChild(g.h),!g.setPosition&&f==document.body&&a.push(g),c.skipResize||g.adjust()):f.Eb?(g.getParent&&g.getParent()&&g.getParent().xd(g),f.Eb(g,e)):dhx.error("not existing parent:"+c.container);dhx.Wf=!1;return g};dhx.ui.scrollSize=dhx.env.touch?0:18;dhx.ui.Xf=function(a){return a+(this.ef[a]=
(this.ef[a]||0)+1)};dhx.ui.ef={};dhx.ui.we=function(){dhx.html.addStyle("html, body{ height:100%; }");dhx.ui.we=function(){}};dhx.ui.resize=function(){if(!dhx.ui.xe)for(var b=0;b<a.length;b++)a[b].adjust()};dhx.event(window,"resize",dhx.ui.resize);b.Vc={};b.delay=function(a){dhx.ui.Vc[a.id]=a};dhx.ui.zIndex=function(){return dhx.ui.vj++};dhx.ui.vj=1;b.Aa=function(){var a=dhx.html.create("DIV",{"class":"dhx_skin_settings"});document.body.appendChild(a);dhx.html.remove(a);b.Aa=b.rj;return b.Aa.apply(this,
arguments)};b.rj=function(a){if(a.view){var d=a.view;return new b[d](a)}else return a.rows||a.cols?new b.layout(a):a.cells?new b.multiview(a):a.template||a.content?new b.template(a):new b.view(a)};b.views={};b.get=function(a){if(!a)return null;if(b.views[a])return b.views[a];if(b.Vc[a])return dhx.ui(b.Vc[a]);var d=a;if(typeof a=="object"){if(a.g)return a;d=a.target||a.srcElement||a}return b.views[dhx.html.locate({target:dhx.toNode(d)},"view_id")]};if(dhx.isUndefined(window.$$))$$=b.get;dhx.protoUI({name:"baseview",
$init:function(a){if(!a.id)a.id=dhx.ui.Xf(this.name);this.H=dhx.H;dhx.H=null;this.$view=this.k=this.h=dhx.html.create("DIV",{"class":"dhx_view"})},defaults:{width:-1,height:-1,gravity:1},getNode:function(){return this.h},getParent:function(){return this.H||null},isVisible:function(a){if(this.g.hidden){if(a){if(!this.Va)this.Va=[],this.gd={};this.gd[a]||(this.gd[a]=!0,this.Va.push(a))}return!1}var b=this.getParent();return b?b.isVisible(a,this.g.id):!0},container_setter:function(){return!0},css_setter:function(a){this.h.className+=
" "+a;return a},id_setter:function(a){if(dhx.Ta&&dhx.Ta!=this){var b=a;dhx.Ta.Da[a]=this;a=dhx.ui.Xf(this.name);dhx.Ta.Tf[a]=b}dhx.ui.views[a]=this;this.h.setAttribute("view_id",a);return a},$setSize:function(a,b){if(this.Q&&this.Q[0]==a&&this.Q[1]==b)return!1;this.Q=[a,b];this.m=a;this.m=a-(this.g.scroll&&!dhx.Touch?dhx.ui.scrollSize:0);this.r=b;this.$width=this.m;this.$height=this.r;this.h.style.width=a+"px";this.h.style.height=b+"px";return!0},$getSize:function(){var a=this.g.width,b=this.g.height,
e,f;e=f=this.g.gravity;a==-1?a=0:(e=0,a+=this.g.scroll&&!dhx.Touch?dhx.ui.scrollSize:0);b==-1?b=0:f=0;return[e,a,f,b]},show:function(a){if(this.getParent()){var b=this.getParent();!a&&this.g.animate&&b.g.animate&&(a=dhx.extend(b.g.animate?dhx.extend({},b.g.animate):{},this.g.animate,!0));var e=arguments.length<2;if(e?b.hb:b.Wa)(e?b.hb:b.Wa).call(b,this,a)}},hidden_setter:function(a){a&&this.hide();return this.g.hidden},hide:function(){this.show(null,!0)},adjust:function(){var a=this.h;if(!this.H)a=
a.parentNode;if(!this.h.parentNode)return!1;var b=this.h.parentNode.offsetWidth,e=this.h.parentNode.offsetHeight,f=this.$getSize(),b=f[0]?Math.max(b,f[1]):f[1],e=f[2]?Math.max(e,f[3]):f[3];this.$setSize(b,e)},resize:function(a){if(!dhx.Pc){var b=this.$getSize(),e=b[1],f=b[3],g=this.Ih||this.Q;if(arguments.length==2){var h=!1;if(e>0&&g[0]!=e||a)this.g.width=e,h=!0;if(f>0&&g[1]!=f||a)this.g.height=f,h=!0;if(!h)return!1}var i=this.getParent();if(i)i.resizeChildren&&i.resizeChildren();else return this.$setSize(e||
g[0],f||g[1],!0),!1;return!0}}},dhx.Settings,dhx.Destruction,dhx.BaseBind);dhx.protoUI({name:"view",$init:function(a){this.k.style.borderWidth="1px";this.setValue&&dhx.Ja&&(dhx.Ja.elements[a.name||a.id]=this)},$getSize:function(){var a=this.g.n,b=dhx.ui.baseview.prototype.$getSize.call(this);if(!a)return b;var e=(a.left?0:1)+(a.right?0:1),f=(a.top?0:1)+(a.bottom?0:1);b[1]&&e&&(b[1]+=e);b[3]&&f&&(b[3]+=f);return b},$setSize:function(a,b){var e=this.g.n;this.Ih=[a,b];e?(a-=(e.left?0:1)+(e.right?0:1),
b-=(e.top?0:1)+(e.bottom?0:1)):this.k.style.borderWidth="0px";return dhx.ui.baseview.prototype.$setSize.call(this,a,b)}},dhx.ui.baseview)})();dhx.ui.view.call(dhx);
dhx.protoUI({name:"baselayout",$init:function(){this.$ready.push(this.U);this.i=this.k},rows_setter:function(a){this.p=1;this.je="";this.Y=a},cols_setter:function(a){this.p=0;this.je="left";this.Y=a},xd:function(a){dhx.PowerArray.removeAt.call(this.j,dhx.PowerArray.find.call(this.j,a));this.resizeChildren(!0)},Eb:function(a,b){if(dhx.isUndefined(b)){for(var c=0;c<this.j.length;c++)this.j[c].destructor();this.Y=a;this.U()}else{if(typeof b=="number"){if(b<0||b>this.j.length)b=this.j.length;var d=(this.j[b]||
{}).h;dhx.PowerArray.insertAt.call(this.j,a,b);dhx.html.insertBefore(a.h,d,this.i)}else{var e=dhx.ui.get(b),b=dhx.PowerArray.find.call(this.j,e);e.h.parentNode.insertBefore(a.h,e.h);e.destructor();this.j[b]=a}a.h.style.cssFloat=a.h.style.styleFloat=this.je;this.j[b].H=this}this.resizeChildren(!0)},reconstruct:function(){for(var a=0;a<this.j.length;a++)dhx.html.remove(this.j[a].h);this.U();this.$setSize(this.Q[0],this.Q[1])},Wa:function(a,b,c){if(!a.g.hidden)a.g.hidden=!0,dhx.html.remove(a.h),this.oc++,
!c&&!dhx.Wf&&this.resizeChildren(!0)},resizeChildren:function(){if(this.vb){var a=this.getParent();a&&a.resizeChildren&&a.resizeChildren();var b=this.$getSize(),c=this.vb[0],d=this.vb[1];this.La(c,d)}},index:function(a){if(a.g)a=a.g.id;for(var b=0;b<this.j.length;b++)if(this.j[b].g.id==a)return b;return-1},hb:function(a,b,c){if(a.g.hidden)a.g.hidden=!1,dhx.html.insertBefore(a.h,(this.j[this.index(a)+1]||{}).h,this.i||this.h),this.oc--,c||this.resizeChildren(!0)},showBatch:function(a){if(this.g.visibleBatch!=
a){this.g.visibleBatch=a;for(var b=[],c=0;c<this.j.length;c++)this.j[c].g.batch||b.push(this.j[c]),this.j[c].g.batch==a?b.push(this.j[c]):this.Wa(this.j[c],null,!0);for(c=0;c<b.length;c++)this.hb(b[c],null,!0);this.resizeChildren()}},U:function(a){a=this.Y||a;this.Y=null;this.j=[];this.h.style.verticalAlign="top";for(var b=0;b<a.length;b++){dhx.H=this;this.j[b]=dhx.ui.Aa(a[b],this);if(!this.p)this.j[b].h.style.cssFloat=this.j[b].h.style.styleFloat="left";if(this.g.visibleBatch&&this.g.visibleBatch!=
this.j[b].g.batch&&this.j[b].g.batch)this.j[b].g.hidden=!0;this.j[b].g.hidden||(this.i||this.k).appendChild(this.j[b].h)}},$getSize:function(){var a=0,b=0,c=0,d=0;this.ra=[];for(var e=0;e<this.j.length;e++)if(!this.j[e].g.hidden){var f=this.ra[e]=this.j[e].$getSize();this.p?(a=Math.max(a,f[1]),c=Math.max(c,f[0]),b+=f[3],d+=f[2]):(b=Math.max(b,f[3]),d=Math.max(d,f[2]),a+=f[1],c+=f[0])}this.uc=[c,a,d,b];if(this.g.height>-1)b=this.g.height,d=0;if(this.g.width>-1)a=this.g.width,c=0;this.p?(a&&(c=0),d&&
(b=0)):(b&&(d=0),c&&(a=0));return[c,a,d,b]},$setSize:function(a,b){this.vb=[a,b];dhx.ui.baseview.prototype.$setSize.call(this,a,b);this.La(a,b)},La:function(a,b){dhx.Pc=(dhx.Pc||0)+1;for(var c=a-this.uc[1],d=b-this.uc[3],e=this.uc[0],f=this.uc[2],g=this.j.length-1,h=0;h<this.j.length;h++)if(!this.j[h].g.hidden){if(this.p){var i=a,j;this.ra[h][2]?(j=Math.round(this.ra[h][2]*d/f),d-=j,f-=this.ra[h][2]):(j=this.ra[h][3],h==g&&d>0&&(j+=d))}else j=b,this.ra[h][0]?(i=Math.round(this.ra[h][0]*c/e),c-=i,
e-=this.ra[h][0]):(i=this.ra[h][1],h==g&&c>0&&(i+=c));this.j[h].$setSize(i,j)}dhx.Pc-=1},Aj:function(a,b){var c=this.index(a);return c==-1?null:this.j[c+b]},first:function(){return this.j[0]}},dhx.ui.baseview);
dhx.protoUI({name:"layout",$init:function(){this.oc=0},U:function(){this.h.className+=" dhx_layout_"+(this.g.type||"");if(this.g.margin)this.na=this.g.margin;if(this.g.padding)this.M=this.g.padding;var a=this.Y;if(!this.g.n)this.g.n={top:!0,left:!0,right:!0,bottom:!0};this.Wd(a);dhx.ui.baselayout.prototype.U.call(this,a);this.Td(a)},$getSize:function(){var a=dhx.ui.baselayout.prototype.$getSize.call(this),b=this.na*(this.j.length-this.oc-1);this.p?a[3]&&(a[3]+=b):a[1]&&(a[1]+=b);if(this.M&&(a[1]&&
(a[1]+=this.M*2),a[3]&&(a[3]+=this.M*2),this.na>-1)){var c=this.g.n;if(c){var d=(c.left?0:1)+(c.right?0:1),e=(c.top?0:1)+(c.bottom?0:1);a[1]&&d&&(a[1]+=d);a[3]&&e&&(a[3]+=e)}}return a},$setSize:function(a,b){this.vb=[a,b];var c;c=this.M&&this.na>0?dhx.ui.view.prototype.$setSize.call(this,a,b):dhx.ui.baseview.prototype.$setSize.call(this,a,b);this.La(this.m,this.r)},La:function(a,b){var c=this.na*(this.j.length-this.oc-1);this.p?(b-=c+this.M*2,a-=this.M*2):(a-=c+this.M*2,b-=this.M*2);return dhx.ui.baselayout.prototype.La.call(this,
a,b)},resizeChildren:function(a){if(a&&this.type!="clean"){for(var b=[],c=0;c<this.j.length;c++){var d=this.j[c];b[c]=d.g;var e=d.vb?"0px":"1px";d.h.style.borderTopWidth=d.h.style.borderBottomWidth=d.h.style.borderLeftWidth=d.h.style.borderRightWidth=e}this.Wd(b);this.Td(this.j)}dhx.ui.baselayout.prototype.resizeChildren.call(this)},Wd:function(a){if(this.M&&this.na)for(var b=0;b<a.length;b++)a[b].n={top:!1,left:!1,right:!1,bottom:!1};else{for(b=0;b<a.length;b++)a[b].n=dhx.copy(this.g.n);var c=!1;
this.g.type=="clean"&&(c=!0);if(this.p){for(b=1;b<a.length-1;b++)a[b].n.top=a[b].n.bottom=c;if(a.length>1){if(this.g.type!="head")a[0].n.bottom=c;a[a.length-1].n.top=c}}else{for(b=1;b<a.length-1;b++)a[b].n.left=a[b].n.right=c;if(a.length>1){if(this.g.type!="head")a[0].n.right=c;a[a.length-1].n.left=c}}}},Td:function(a){for(var b=0,c=0;c<a.length;c++){var d=this.j[c];if(d.g.hidden&&this.j[c+1])this.j[c+1].g.n=d.g.n,c==b&&b++;var e=d.g.n;if(e.top)d.h.style.borderTopWidth="0px";if(e.left)d.h.style.borderLeftWidth=
"0px";if(e.right)d.h.style.borderRightWidth="0px";if(e.bottom)d.h.style.borderBottomWidth="0px"}var f=this.p?"marginLeft":"marginTop",g=this.p?"marginTop":"marginLeft";if(this.M)for(c=0;c<a.length;c++)this.j[c].h.style[f]=this.M+"px";this.j[b].h.style[g]=(this.M||0)+"px";for(var h=b+1;h<a.length;h++)this.j[h].h.style[g]=this.na+"px"},type_setter:function(a){this.na=this.Oh[a];if((this.M=this.ji[a])&&this.na>0)this.k.style.borderWidth="1px";return a},Oh:{space:10,wide:4,clean:0,head:4,line:-1},ji:{space:10,
wide:0,clean:0,head:0,line:0},na:-1,M:0},dhx.ui.baselayout);dhx.ui.layout.call(dhx);
dhx.protoUI({name:"template",$init:function(){this.attachEvent("onXLE",this.render)},setValues:function(a){this.data=a;this.render()},defaults:{template:dhx.Template.empty,loading:!0},of:function(){if(!this.xc)this.render(),this.xc=!0},src_setter:function(a){this.xc=!0;this.callEvent("onXLS",[]);dhx.ajax(a,dhx.bind(function(a){this.g.template=dhx.Template(a);this.xc=!1;this.of();this.callEvent("onXLE",[])},this));return a},content_setter:function(a){if(a)this.xc=!0,this.i.appendChild(dhx.toNode(a))},
refresh:function(){this.render()},waitMessage_setter:function(a){dhx.extend(this,dhx.OverlayBox);return a},$setSize:function(a,b){dhx.ui.view.prototype.$setSize.call(this,a,b)&&this.of()},ei:!0},dhx.Scrollable,dhx.AtomDataLoader,dhx.AtomRender,dhx.EventSystem,dhx.ui.view);
dhx.protoUI({name:"iframe",defaults:{loading:!0},$init:function(){this.i=this.k;this.k.innerHTML="<iframe style='width:100%; height:100%' frameborder='0' src='about:blank'></iframe>"},load:function(a){this.src_setter(a)},src_setter:function(a){this.k.childNodes[0].src=a;this.callEvent("onXLS",[]);dhx.delay(this.Ui,this);return a},Ui:function(){try{dhx.event(this.getWindow(),"load",dhx.bind(function(){this.callEvent("onXLS",[])},this))}catch(a){this.callEvent("onXLE",[])}},getWindow:function(){return this.k.childNodes[0].contentWindow},
waitMessage_setter:function(a){dhx.extend(this,dhx.OverlayBox);return a}},dhx.ui.view,dhx.EventSystem);
dhx.OverlayBox={$init:function(){if(dhx.isUndefined(this.Ia)&&this.attachEvent)this.attachEvent("onXLS",this.showOverlay),this.attachEvent("onXLE",this.hideOverlay),this.Ia=null},showOverlay:function(a){if(!this.Ia)this.Ia=dhx.html.create("DIV",{"class":"dhx_loading_overlay"},a||""),dhx.html.insertBefore(this.Ia,this.h.firstChild,this.h)},hideOverlay:function(){if(this.Ia)dhx.html.remove(this.Ia),this.Ia=null}};
dhx.protoUI({name:"scrollview",defaults:{scroll:"x",scrollSpeed:"0ms"},$init:function(){this.h.className+=" dhx_scrollview"},content_setter:function(a){this.l=dhx.ui.Aa(a);this.l.H=this;this.i.appendChild(this.l.h)},body_setter:function(a){return this.content_setter(a)},$getSize:function(){this.Pa=this.l.$getSize();if(this.g.scroll=="x"&&this.Pa[3]>0)this.g.height=this.Pa[3];else if(this.g.scroll=="y"&&this.Pa[1]>0)this.g.width=this.Pa[1];return dhx.ui.view.prototype.$getSize.call(this)},$setSize:function(a,
b){if(dhx.ui.view.prototype.$setSize.call(this,a,b))this.l.$setSize(Math.max(this.Pa[1],this.m),Math.max(this.Pa[3],this.r)),this.i.style.width=this.l.m+"px",this.i.style.height=this.l.r+"px"},Eb:function(a){this.l.destructor();this.l=a;this.l.H=this;this.J.appendChild(this.l.h);this.resize()}},dhx.Scrollable,dhx.ui.view);
dhx.protoUI({name:"calendar",defaults:{date:null,startOnMonday:!0,navigation:!0,weekHeader:!1,weekNumber:!1,timeSelect:!1,skipEmptyWeeks:!0,cellHeight:36,minuteStep:15,hourStart:6,hourEnd:24,hourFormat:"%H",calendarHeader:"%F %Y",calendarDay:"%d",calendarWeekHeader:"W#",calendarWeek:"%W",width:300,height:300,selectedCss:"dhx_cal_selected_day"},skin:{monthHeaderHeight:40,weekHeaderHeight:22,timeSelectHeight:38},hourFormat_setter:dhx.Date.dateToStr,calendarHeader_setter:dhx.Date.dateToStr,calendarDay_setter:dhx.Date.dateToStr,
calendarHeader_setter:dhx.Date.dateToStr,calendarWeekHeader_setter:dhx.Date.dateToStr,calendarWeek_setter:dhx.Date.dateToStr,date_setter:function(a){typeof a=="string"&&(a=dhx.i18n.fullDateFormatDate(a));this.da=this.da||a;return a},$init:function(){this.Oa={};this.Nd=[];var a="%Y-%m-%d";this.be=dhx.Date.dateToStr(a);this.pg=dhx.Date.strToDate(a)},$getSize:function(){var a=this.g;if(a.cellHeight>0)a.height=this.oh();return dhx.ui.view.prototype.$getSize.call(this)},cellHeight_setter:function(a){return a==
"auto"?0:a},$setSize:function(a,b){dhx.ui.view.prototype.$setSize.call(this,a,b)&&this.render()},ze:function(){var a=this.g;if(!this.da)this.da=new Date;var b=new Date(this.da);b.setDate(1);var c=b.getDay();this.Rh=new Date(b);this.cg=a.startOnMonday?1:0;this.wc=(c-this.cg+7)%7;this.nd=32-(new Date(b.getFullYear(),b.getMonth(),32)).getDate();var d=42-this.wc-this.nd;this.zj=new Date(b.setDate(this.nd));this.V=a.skipEmptyWeeks?6-Math.floor(d/7):6;this.od=this.V*7-this.wc-this.nd;this.yj=new Date(b.setDate(b.getDate()+
d));this.He=this.skin.monthHeaderHeight+(a.weekHeader?this.skin.weekHeaderHeight:0)+(a.timeSelect?this.skin.timeSelectHeight:0)},oh:function(){this.ze();return this.He+this.V*this.g.cellHeight},dh:function(){this.ze();var a=this.g;this.qb=[];this.ta=[];var b=this.m;b+=1;for(var c=this.r,d=a.weekNumber?8:7,e=0;e<d;e++)this.ta[e]=Math.ceil(b/(d-e)),b-=this.ta[e];if(a.cellHeight<=0)for(var f=0;f<this.V;f++)this.qb[f]=Math.ceil((c-this.He)/(this.V-f)),c-=this.qb[f];else for(f=0;f<this.V;f++)this.qb[f]=
a.cellHeight},selectDate:function(a,b){this.define("date",a);var c=this.g;b&&this.showCalendar(c.date);var d=c.selectedCss;if(this.Oa[this.o])dhx.html.removeCss(this.Oa[this.o],d),this.o=null;var e=this.be(c.date);if(this.Oa[e])dhx.html.addCss(this.Oa[e],d),this.o=e;c.timeSelect&&this.Ni(a)},Ni:function(a){var b=this.g,c=this.Nd,a=a||b.date;if(c.length)c[0].value=Math.min(b.hourEnd,Math.max(a.getHours(),b.hourStart)),c[1].value=Math.floor(a.getMinutes()/b.minuteStep)*b.minuteStep},getSelectedDate:function(){var a=
this.g;return a.date?new Date(a.date):null},getVisibleDate:function(){return new Date(this.da)},setValue:function(a){this.selectDate(a,!0)},getValue:function(){return this.getSelectedDate()},showCalendar:function(a){typeof a=="string"&&(a=dhx.i18m.fullDateFormatDate(a));if(!a||!(a.getFullYear()==this.da.getFullYear()&&a.getMonth()==this.da.getMonth()))this.da=a||this.da,this.render(),this.resize()},refresh:function(){this.render()},render:function(){var a=this.g;if(this.isVisible(a.id)){this.callEvent("onBeforeRender",
[]);this.dh();var b="<div class='dhx_mini_calendar'><div class='dhx_cal_month'>"+a.calendarHeader(this.da);a.navigation&&(b+=this.Th());b+="</div>";a.weekHeader&&(b+="<div class='dhx_cal_header' style='height:"+this.skin.weekHeaderHeight+"px'>"+this.tj()+"</div>");b+="<div class='dhx_cal_body'>"+this.ng()+"</div>";a.timeSelect&&(b+="<div class='dhx_cal_time_select'>"+this.lj()+"</div>");b+="</div></div>";this.k.innerHTML=b;if(a.timeSelect){for(var c=this.k.getElementsByTagName("select"),d=this.Nd,
e=0;e<c.length;e++)d[e]=c[e];d[0].onchange=function(){a.date.setHours(this.value)};d[1].onchange=function(){a.date.setMinutes(this.value)}}this.Oa={};for(var f=this.k.getElementsByTagName("table"),g=f[f.length-1].getElementsByTagName("div"),e=0;e<g.length;e++)this.Oa[g[e].getAttribute("date")]=g[e];a.date&&this.selectDate(a.date,!1);this.callEvent("onAfterRender",[])}},tj:function(){var a=this.g,b="",c=a.startOnMonday?1:0,d=0,e=0;if(a.weekNumber){var e=1,f=a.calendarWeekHeader();b+="<div class='dhx_cal_week_header' style='width: "+
(this.ta[0]-2)+"px;' >"+f+"</div>";d+=this.ta[0]}for(var g=0;g<7;g++){var h=(c+g)%7,i=dhx.Date.Locale.day_short[h],j="dhx_cal_day_name",k=this.ta[g+e]-2;g==6&&(j+=" dhx_cal_day_name_last");h===0&&(j+=" dhx_sunday");h==6&&(j+=" dhx_saturday");b+="<div class='"+j+"' style='width: "+k+"px;' >"+i+"</div>";d+=this.ta[g+e]}return b},ng:function(){var a=this.g,b=0,c=dhx.Date.add(this.Rh,-this.wc,"day"),c=dhx.Date.datePart(c),d=0,e="";if(a.weekNumber){var d=1,f=dhx.Date.add(c,(this.cg+1)%2,"day");e+='<table class="dhx_week_numbers" cellspacing="0" cellpadding="0" style="float: left;"><tbody>';
for(var g=0;g<this.V;g++){var h=this.qb[g]-2,i=this.ta[0]-2,j=a.calendarWeek(f),k="dhx_cal_week_num";if(!a.skipEmptyWeeks&&(g==this.V-1&&this.od>=7||g==this.V-2&&this.od==14))k="dhx_next_month",j="";g==this.V-1&&(k+=" dhx_cal_day_num_bborder",h+=1);e+="<tr><td>";e+="<div class='"+k+"' style='width:"+i+"px; height:"+h+"px; line-height:"+h+"px;' >"+j+"</div>";e+="</td></tr>";f=dhx.Date.add(f,7,"day")}e+="</tbody></table>"}var l=dhx.Date.datePart(new Date);e+='<table cellspacing="0" cellpadding="0"><tbody>';
for(var m=this.V*7-1,g=0;g<this.V;g++){e+="<tr>";for(var n=0;n<7;n++){var o=a.calendarDay(c),p=this.be(c),k="dhx_cal_day_num";b<this.wc&&(k="dhx_prev_month",p=o="");b>m-this.od&&(k="dhx_next_month",p=o="");h=this.qb[g]-2;i=this.ta[n+d]-2;n==6&&(k+=" dhx_cal_day_num_rborder",i+=1);g==this.V-1&&(k+=" dhx_cal_day_num_bborder",h+=1);e+="<td>";l.valueOf()==c.valueOf()&&(k+=" dhx_cal_current_day");e+="<div class='"+k+"' style='width:"+i+"px; height:"+h+"px; line-height:"+h+"px;' date='"+p+"'>"+o+"</div>";
e+="</td>";c=dhx.Date.add(c,1,"day");b++}e+="</tr>"}e+="</tbody></table>";return e},lj:function(){for(var a=this.g,b="<select class='dhx_hour_select' onclick=''>",c=a.hourStart,d=a.hourEnd,e=dhx.Date.datePart(new Date),f=c;f<d;f++)e.setHours(f),b+="<option value='"+f+"'>"+a.hourFormat(e)+"</option>";b+="</select>";b+="<select class='dhx_minute_select' onclick=''>";for(var g=0;g<60;g+=a.minuteStep)b+="<option value='"+g+"'>"+dhx.math.toFixed(g)+"</option>";b+="</select>";return b},Th:function(){var a=
"<div class='dhx_cal_arrow dhx_cal_",b="_button'><div></div></div>";return a+"prev"+b+a+"next"+b},on_click:{dhx_cal_arrow:function(a,b,c){var d=c.className.match(/prev/i)?-1:1,e=new Date(this.da),f=new Date(e);f.setDate(1);f=dhx.Date.add(f,d,"month");this.callEvent("onBeforeMonthChange",[e,f])&&(this.showCalendar(f),this.selectDate(this.g.date,!1),this.callEvent("onAfterMonthChange",[f,e]))},dhx_cal_day_num:function(a,b,c){var d=c.getAttribute("date"),e=this.pg(d);if(this.g.timeSelect){var f=this.Nd;
e.setMinutes(f[0].value*60+f[1].value*1)}this.selectDate(e);this.callEvent("onDateSelect",[e]);this.callEvent("onChange",[e])}}},dhx.MouseEvents,dhx.Settings,dhx.EventSystem,dhx.Movable,dhx.ui.view);dhx.html.addMeta=function(a,b){document.getElementsByTagName("head").item(0).appendChild(dhx.html.create("meta",{name:a,content:b}))};
(function(){var a=function(){var a=!!(window.orientation%180);if(dhx.ui.orientation!==a)dhx.ui.orientation=a,dhx.callEvent("onRotate",[a])};dhx.ui.orientation=!!((dhx.isUndefined(window.orientation)?90:window.orientation)%180);dhx.event(window,"onorientationchange"in window?"orientationchange":"resize",a);dhx.ui.fullScreen=function(){if(dhx.env.touch){dhx.html.addMeta("apple-mobile-web-app-capable","yes");dhx.html.addMeta("viewport","initial-scale=1, maximum-scale=1, user-scalable=no");var b=document.body.offsetHeight||
document.body.scrollHeight,c=navigator.userAgent.indexOf("iPhone")!=-1,d=navigator.userAgent.indexOf("iPad")!=-1,e=c&&(b==356||b==208||b==306||b==158),f=function(){var a=0,b=0;if(c)dhx.ui.orientation?(a=480,b=e?268:300):(a=320,b=e?416:460);else if(dhx.env.isAndroid){document.body.style.width=document.body.style.height="1px";document.body.style.overflow="hidden";var d=window.outerWidth/window.innerWidth,a=window.outerWidth/d,b=window.outerHeight/d}else a=window.innerWidth,b=window.innerHeight;if(b)document.body.style.height=
b+"px",document.body.style.width=a+"px";dhx.ui.xe=!1;dhx.ui.resize();dhx.delay(function(){window.scrollTo(0,1)})},g=function(){dhx.ui.xe=!0;dhx.env.isSafari?f():dhx.delay(f,null,[],500)};dhx.attachEvent("onClick",function(a){a.target.tagName=="INPUT"||a.target.tagName=="TEXTAREA"||a.target.tagName=="SELECT"||(e&&window.innerHeight<416||!e&&window.innerHeight<window.outerHeight)&&window.scrollTo(0,1)});dhx.attachEvent("onRotate",g);a();dhx.delay(g)}}})();
dhx.CanvasMgr=function(a){var b=dhx.CanvasMgr.prototype.Zd;!b[a]&&document.getCSSCanvasContext&&(b[a]=!0,dhx.CanvasMgr.prototype[a](b))};
dhx.CanvasMgr.prototype={buttonGrd:["#fefefe","#e0e0e0","#e5e5e5","#e0e0e0",32],Zd:[],Qb:function(a,b,c,d,e){var f=document.getCSSCanvasContext("2d",d,18,c),g=f.createLinearGradient(0,0,0,c);g.addColorStop(0,a);g.addColorStop(1,b);f.fillStyle=g;f.strokeStyle="#93B0BA";f.lineWidth=2;e?(f.moveTo(0,0.5),f.lineTo(17.5,c/2+0.5),f.lineTo(0,c-0.5),f.lineTo(0,0.5)):(f.moveTo(18,0.5),f.lineTo(0.5,c/2+0.5),f.lineTo(18,c-0.5),f.lineTo(18,0.5));f.stroke();f.fill()},dhxArrowLeftT:function(){this.Qb(this.buttonGrd[2],
this.buttonGrd[3],this.buttonGrd[4],"dhxArrowLeftT")},dhxArrowRightT:function(){this.Qb(this.buttonGrd[2],this.buttonGrd[3],this.buttonGrd[4],"dhxArrowRightT",!0)},dhxArrowLeft:function(){this.Qb(this.buttonGrd[0],this.buttonGrd[1],this.buttonGrd[4],"dhxArrowLeft");dhx.CanvasMgr("dhxArrowLeftT")},dhxArrowRight:function(){this.Qb(this.buttonGrd[0],this.buttonGrd[1],this.buttonGrd[4],"dhxArrowRight",!0);dhx.CanvasMgr("dhxArrowRightT")}};
dhx.attachEvent("onClick",function(a){var b=dhx.ui.get(a);if(b&&b.touchable){b.getNode(a);var c=a.target||a.srcElement,d="",e=null,f=!1;if(!(c.className&&c.className.indexOf("dhx_view")===0)){for(;c&&c.parentNode;){if(c.getAttribute){if(c.getAttribute("view_id"))break;if(d=c.className)if(d=d.split(" "),d=d[0]||d[1],b.on_click[d]){var g=b.on_click[d].call(b,a,b.g.id,c);if(g===!1)return}}c=c.parentNode}if(b.g.click){var h=dhx.toFunctor(b.g.click);h&&h.call&&h.call(b,b.g.id,a)}if(b.g.multiview){var i=
dhx.ui.get(b.g.multiview);i&&i.show&&i.show()}if(b.g.popup){var j=dhx.ui.get(b.g.popup);j.g.master=b.g.id;j.show(b.getInput()||b.getNode(),j.l.g.align||"bottom",!0)}b.callEvent("onItemClick",[b.g.id,a])}}});dhx.skin={};dhx.skin.offset={button:10,roundbutton:10,defaultbutton:10,formbutton:10,prevbutton:28,nextbutton:28,bigbutton:28,bigroundbutton:28,slider:10};
dhx.protoUI({name:"button",touchable:!0,defaults:{template:"<input type='button' style='width:100%;' value='#label#'>",height:42,label:"label"},$init:function(a){var b=(a.type||"")+this.name;this.h.className+=" dhx_el_"+b;this.data=this.g;this.i=this.h;this.z=dhx.skin.offset[b]||0;a.type=="prev"&&dhx.CanvasMgr("dhxArrowLeft");a.type=="next"&&dhx.CanvasMgr("dhxArrowRight")},type_setter:function(a){if(this.Vf[a])this.g.template=dhx.Template(this.Vf[a])},Vf:{prev:"<div><div class='dhx_el_arrow'></div><input type='button' value='#label#' /></div>",
next:"<div><input type='button' value='#label#' /><div class='dhx_el_arrow'></div></div>"},$setSize:function(a,b){dhx.ui.view.prototype.$setSize.call(this,a,b)&&this.render()},I:function(a){this.g.label=a;(this.getInput()||{}).value=a},getValue:function(){return this.i.childNodes.length>0?this.kc():this.g.value},setValue:function(a){var b=this.g.value;this.g.value=a;if(this.i.childNodes.length>0)this.Cg=a,this.I(a),this.callEvent("onChange",[a,b])},focus:function(){this.getInput().focus()},kc:function(){return this.g.label||
""},getInput:function(){return this.i.getElementsByTagName("input")[0]},O:function(){return this.getInput()},W:function(){this.g.inputWidth?this.O().style.width=this.g.inputWidth-this.z+"px":this.O().style.width=this.m-this.z+"px"},render:function(){if(dhx.AtomRender.render.call(this)){this.W();if(this.g.align)switch(this.g.align){case "right":this.i.firstChild.style.cssFloat="right";break;case "center":this.i.firstChild.style.display="inline-block";this.i.firstChild.parentNode.style.textAlign="center";
break;case "middle":this.i.firstChild.style.marginTop=Math.round((this.r-40)/2)+"px";break;case "bottom":this.i.firstChild.style.marginTop=this.r-40+"px";break;case "left":this.i.firstChild.style.cssFloat="left"}this.Na&&this.Na(this.data);this.Cg!=this.g.value&&this.setValue(this.g.value)}},refresh:function(){this.render()},on_click:{mc:function(a,b){var c=dhx.html.locate(a,"button_id");if(c&&this.callEvent("onBeforeTabClick",[b,c])){this.g.selected=c;this.refresh();if(this.g.multiview){var d=dhx.ui.get(c);
d&&d.show&&d.show()}this.callEvent("onAfterTabClick",[b,c])}},dhx_all_segments:function(a,b){this.on_click.mc.call(this,a,b)},dhx_all_tabs:function(a,b){this.on_click.mc.call(this,a,b)},dhx_inp_counter_next:function(){this.next(this.g.step,this.g.min,this.g.max)},dhx_inp_counter_prev:function(){this.prev(this.g.step,this.g.min,this.g.max)},dhx_inp_toggle_left_off:function(){var a=this.g.options;this.setValue(a[0].value)},dhx_inp_toggle_right_off:function(){var a=this.g.options;this.setValue(a[1].value)},
dhx_inp_combo:function(a,b,c){c.focus()},dhx_inp_checkbox_border:function(){this.toggle()},dhx_inp_checkbox_label:function(){this.toggle()},dhx_inp_radio_border:function(a){var b=dhx.html.locate(a,"radio_id");this.setValue(b)},dhx_inp_radio_label:function(a,b,c){c=c.parentNode.getElementsByTagName("input")[0];return this.on_click.dhx_inp_radio_border.call(this,c,b,c)}},pb:function(a){for(var b=0;b<a.length;b++)if(typeof a[b]=="string")a[b]={value:a[b],label:a[b]};else if(a[b].value){if(!a[b].label)a[b].label=
a[b].value}else a[b].value=a[b].label},popup_setter:function(a){return this.pc=a}},dhx.ui.view,dhx.AtomRender,dhx.Settings,dhx.EventSystem);dhx.protoUI({name:"imagebutton",defaults:{template:"<span><img src='#src#'/>&nbsp;#label#</span>",label:""},W:function(){}},dhx.ui.button);dhx.protoUI({name:"label",defaults:{template:"<div>#label#</div>"},focus:function(){return!1},O:function(){return this.i.firstChild},I:function(a){this.g.label=a;this.i.firstChild.innerHTML=a},W:function(){}},dhx.ui.button);
dhx.protoUI({name:"icon",defaults:{template:"<div class='dhx_el_icon_#icon#'></div>",width:42},W:function(){}},dhx.ui.button);
dhx.protoUI({name:"segmented",defaults:{template:function(a,b){var c=a.options,d="",e;b.pb(c);if(!a.selected)a.selected=c[0].value;for(var f=0;f<c.length;f++)e=c[f].width||a.inputWidth?"width: "+((c[f].width||Math.round(a.inputWidth/c.length))-b.g.z)+"px;":"",d+="<div style='"+e+"' class='"+(a.selected==c[f].value?"selected ":"")+"segment_"+(f==c.length-1?"N":f>0?1:0)+"' button_id='"+c[f].value+"'>"+c[f].label+"</div>";return"<div class='dhx_all_segments'>"+d+"</div>"},z:28,zb:0},I:function(a){if(this.i&&
this.i.firstChild)for(var b=this.i.firstChild.childNodes,c=0;c<b.length;c++)if(dhx.html.locate(b[c],"button_id")==a)return this.on_click.mc.call(this,b[c],this.g.options[c]),!0},getValue:function(){return this.g.selected},W:function(){}},dhx.ui.button);
dhx.protoUI({name:"tabbar",defaults:{height:49,template:function(a,b){var c=a.options;b.pb(c);for(var d="",e,f=0;f<c.length;f++){var g="",h=c[f].src;c[f].value==a.selected&&(g="selected",h=c[f].srcSelected||c[f].src);c[f].css&&(g+=" "+c[f].css);e=a.optionWidth||c[f].width||a.inputWidth?"width: "+(a.optionWidth||c[f].width||Math.ceil(a.inputWidth/c.length)-b.g.z)+"px;":"";d+="<div class='"+g+"' button_id='"+c[f].value+"' style='"+e+"'>";d+=h?"<img src='"+h+"'/><span>"+c[f].label+"</span>":"<div style='height:26px'></div><span>"+
c[f].label+"</span>";d+="</div>"}return"<div class='dhx_all_tabs'>"+d+"</div>"},z:4}},dhx.ui.segmented);
dhx.protoUI({name:"text",gg:!0,Bd:function(a,b,c){c.labelPosition=="left"?a+=b:a=b+a;return"<div class='dhx_el_box'>"+a+"</div>"},Cb:function(a,b,c,d){var e=a.inputAlign||"left",f=a.labelAlign||"left",g=dhx.uid(),h="<label style='width: "+this.g.labelWidth+"px; text-align: "+f+";' onclick='' for='"+g+"' class='dhx_inp_label'>"+(a.label||"")+"</label>",i=this.g.inputWidth-this.g.labelWidth-18;a.iconCss&&(i-=a.iconWidth);i<0&&(i=0);h+=d?"<div class='dhx_inp_"+b+"' onclick='' style='width: "+i+"px; text-align: "+
e+";' >"+(a.text||a.value||"")+"</div>":"<input id='"+g+"' type='"+(a.type||this.name)+"' value='"+(a.text||a.value||"")+"' "+(c||a.readonly?"readonly='true' ":"")+(a.maxlength?"maxlength='"+a.maxlength+"' ":"")+(a.placeholder?"placeholder='"+a.placeholder+"' ":"")+" class='dhx_inp_"+b+"' style='width: "+i+"px; text-align: "+e+";' />";a.iconCss&&(h+="<div class='"+a.iconCss+"' style='width:"+a.iconWidth+"px'></div>");h+="</div>";return"<div class='dhx_el_box'>"+h+"</div>"},Bc:function(a,b){if(!a.label)return"";
var c=a.labelAlign||"left";return"<div class='dhx_inp_"+b+"_label' style='width: "+a.labelWidth+"px; text-align: "+c+";'>"+a.label+"</div>"},defaults:{template:function(a,b){return b.Cb(a,"text")},labelWidth:80,z:28,zb:0},type_setter:function(a){return a},W:function(){var a=this.g;a.inputWidth?(this.getInput().style.width=a.inputWidth-a.labelWidth-a.z-(a.iconCss?a.iconWidth:0)+"px",this.i.firstChild.style.width=a.inputWidth-a.z+"px"):this.O().style.width=this.m-a.labelWidth-a.z-a.zb-(a.iconCss?a.iconWidth:
0)+"px"},focus:function(){var a=this.i.getElementsByTagName("input")[0];a&&a.focus()},I:function(a){this.getInput().value=a},kc:function(){return this.getInput().value}},dhx.ui.button);
dhx.protoUI({name:"toggle",defaults:{template:function(a,b){var c=a.options;b.pb(c);var d=b.g.inputWidth/2||"auto",e=[c[0].width||d,c[1].width||d],f=b.Bc(a,"toggle"),g="<input type='button' style='width: "+e[0]+"px;' value='"+a.options[0].label+"' />";g+="<input type='button' style='width: "+e[1]+"px;' value='"+a.options[1].label+"'  />";return b.Bd(f,g,a)},label:"",labelWidth:0,z:20},W:function(){},Na:function(a){this.setValue(a.value)},ic:function(){return this.i.getElementsByTagName("input")},
I:function(a){var b=this.ic(),c=this.g.options;a==c[1].value?(b[0].className="dhx_inp_toggle_left_off",b[1].className="dhx_inp_toggle_right_on"):(b[0].className="dhx_inp_toggle_left_on",b[1].className="dhx_inp_toggle_right_off")},kc:function(){var a=this.ic(),b=this.g.options;return a[0].className=="dhx_inp_toggle_left_on"?b[0].value:b[1].value}},dhx.ui.text);
dhx.protoUI({name:"input",defaults:{attributes:["maxlength","disabled","placeholder"],template:function(a,b){var c='<input class="dhx_input_box"',d=b.g.attributes;if(d)for(var e=0;e<d.length;e++)a[d[e]]&&(c+=" "+d[e]+"='"+a[d[e]]+"'");b.g.inputAlign&&(c+=" style='text-align:"+b.g.inputAlign+";'");c+=" type='"+(a.type||"text")+"'";c+="/>";return c},z:28,labelWidth:0}},dhx.ui.text);
dhx.protoUI({name:"select",defaults:{template:function(a,b){var c=a.options;b.pb(c);var d="<select";a.disabled&&(d+=" disabled='true'");d+=">";for(var e=0;e<c.length;e++)d+="<option"+(c[e].selected?" selected='true'":"")+(c[e].value?" value='"+c[e].value+"'":"")+">"+c[e].label+"</option>";d+="</select>";return d},labelWidth:0,zb:0,z:10},ba:function(){dhx.event(this.getInput(),"change",function(){this.setValue(this.getValue())},this);this.ba=function(){}},Na:function(){this.ba()},getInput:function(){return this.i.firstChild}},
dhx.ui.text);
dhx.protoUI({name:"textarea",defaults:{template:function(a){return"<textarea class='dhx_inp_textarea' placeholder='"+(a.label||"")+"' style='' "+(a.readonly?"readonly='true' ":"")+">"+(a.value||"")+"</textarea>"},z:16},W:function(){this.g.inputWidth?this.O().style.width=this.g.inputWidth-this.g.z+"px":this.O().style.width=this.m-this.g.zb-this.g.z+"px";this.g.inputHeight?this.O().style.height=this.g.inputHeight+"px":this.O().style.height=this.r-12+"px"},getInput:function(){return this.i.firstChild},I:function(a){this.getInput().value=
a},kc:function(){return this.getInput().value}},dhx.ui.text);
dhx.protoUI({name:"counter",defaults:{template:function(a,b){var c=a.value||0,d=b.Bc(a,"counter"),e="<input type='button' class='dhx_inp_counter_prev' value='\u2014' />";e+="<div class='dhx_inp_counter_value' >"+c+"</div>";e+="<input type='button' class='dhx_inp_counter_next' value='+'/>";return b.Bd(d,e,a)},min:1,step:1,labelWidth:0,label:"",z:125},O:function(){return this.getInput().parentNode},getLabel:function(){return this.getInput().previousSibling||this.getInput().parentNode.lastChild},W:function(){if(this.g.label&&
!this.g.labelWidth){var a=this.getLabel();if(a)a.style.width=(this.g.inputWidth||this.m)-this.g.z-(this.g.counterWidth||20)+"px"}if(this.g.counterWidth)this.getInput().nextSibling.style.width=this.g.counterWidth+"px"},I:function(a){this.getInput().nextSibling.innerHTML=a},getValue:function(){return(this.g.value||0)*1},next:function(a,b,c){a=a||1;this.Mf(a,b,c)},prev:function(a,b,c){a=-1*(a||1);this.Mf(a,b,c)},Mf:function(a,b,c){var b=typeof b=="undefined"?-Infinity:b,c=typeof c=="undefined"?Infinity:
c,d=this.getValue()+a;d>=b&&d<=c&&this.setValue(d)}},dhx.ui.text);
dhx.protoUI({name:"checkbox",defaults:{template:function(a,b){var c=a.value?"dhx_inp_checkbox_on":"dhx_inp_checkbox_on dhx_hidden",d="<div class='dhx_inp_checkbox_border'><input type='button' class='"+c+"' value='&#x2713;' /></div>",e=b.Bc(a,"checkbox");return b.Bd(e,d,a)}},I:function(a){var b=this.getInput();b.className=!a||a=="0"?"dhx_inp_checkbox_on dhx_hidden":"dhx_inp_checkbox_on"},toggle:function(){this.setValue(!this.getValue())},getLabel:function(){var a=this.getInput().parentNode;return a.nextSibling||
a.previousSibling},getValue:function(){var a=this.g.value;return!a||a=="0"?0:1},O:function(){return this.getInput().parentNode.parentNode}},dhx.ui.counter);
dhx.protoUI({name:"radio",defaults:{template:function(a,b){b.pb(a.options);for(var c=[],d=0;d<a.options.length;d++){a.options[d].newline&&c.push("<div style='clear:both;'></div>");var e="<div radio_id='"+a.options[d].value+"' class='dhx_inp_radio_border'><input type='button' class='"+(a.options[d].value==a.value?"dhx_inp_radio_on":"dhx_inp_radio_on dhx_hidden")+"' value='' /></div>";a.label=a.options[d].label;var f=b.Bc(a,"radio");a.labelPosition=="left"?c.push(f+e):c.push(e+f)}return"<div class='dhx_all_radio'><div class='dhx_radio'>"+
c.join("</div><div class='dhx_radio'>")+"</div></div>"}},$getSize:function(){var a=dhx.ui.button.prototype.$getSize.call(this);if(this.g.options){for(var b=1,c=0;c<this.g.options.length;c++)this.g.options[c].newline&&b++;a[3]=Math.max(a[3],this.defaults.height*b)}return a},ic:function(){return this.i.getElementsByTagName("input")},W:function(){},I:function(a){for(var b=this.ic(),c=0;c<b.length;c++)b[c].className=b[c].parentNode.getAttribute("radio_id")==a?"dhx_inp_radio_on":"dhx_inp_radio_on dhx_hidden"},
getValue:function(){return this.g.value}},dhx.ui.text);
dhx.protoUI({name:"richselect",defaults:{template:function(a,b){return b.Cb(a,"list",!0,!0)},icon:!0,iconWidth:15,iconCss:"dhx_list_icon"},ba:function(a){a.popup||this.Tc("list",a);this.Df();this.ba=function(){}},options_setter:function(a){for(var b=this.g.data=[],c=0;c<a.length;c++){var d=a[c].id||a[c].value||a[c].label||a[c],e=a[c].label||a[c].value||a[c];b.push({id:d,value:e})}return a},Na:function(a){this.ba(a);if(!dhx.isUndefined(a.value)){this.setValue(a.value,{},a);var b=dhx.ui.get(a.popup.toString()),
c=b.l;c.attachEvent("onXLE",dhx.bind(function(){this.setValue(this.g.value,{},a)},this))}},Tc:function(a,b){var c=dhx.extend({},b);delete c.align;delete c.height;delete c.width;delete c.template;c.view=a;c.id=(b.id||b.name)+"_"+a;c.width=c.popupWidth||290;var d=dhx.uid(),e={id:d,view:"popup",body:c};dhx.ui(e).hide();this.pc=b.popup=d},Df:function(){var a=dhx.ui.get(this.g.popup);a.l.attachEvent("onItemClick",function(a){var c=dhx.ui.get(this.getParent().g.master);this.getParent().hide();c.setValue(a)})},
getInput:function(){return this.i.firstChild.childNodes[1]},getList:function(){var a=dhx.ui.get(this.g.popup);return a?a.l:null},I:function(a){var b=dhx.ui.get(this.g.popup).l,c=b.type?b.type.template(b.item(a)||a,b.type):a;this.g.value=a;this.g.text=c;this.name=="combo"?this.getInput().value=c.replace(/<[^>]*>/g,""):this.getInput().innerHTML=c},getValue:function(){return this.g.value}},dhx.ui.text);
dhx.protoUI({name:"combo",defaults:{template:function(a,b){return b.Cb(a,"combo")},filter:function(a,b){return a.value.toString().toLowerCase().indexOf(b.toLowerCase())===0?!0:!1}},ba:function(a){a.popup||this.Tc("list",a);this.Df();dhx.event(this.i,"keydown",function(b){var b=b||event,c=b.target||b.srcElement,d=dhx.ui.get(a.popup);window.clearTimeout(d.key_timer);var e=this;d.key_timer=window.setTimeout(function(){d.l.filter(function(a){return e.g.filter.apply(e,[a,c.value])});var a=dhx.ui.get(d.g.master);
a.g.value=d.l.dataCount()==1&&d.l.type.template(d.l.item(d.l.first()))==c.value?d.l.first():""},200);d.show(c,d.l.g.align||"bottom",!0)},this);this.ba=function(){}},Na:function(a){this.ba(a);dhx.isUndefined(a.value)||this.setValue(a.value)}},dhx.ui.richselect);
dhx.protoUI({name:"datepicker",defaults:{template:function(a,b){return b.Cb(a,"list",!0,!0)},stringResult:!1,icon:!0,iconWidth:14,iconCss:"dhx_calendar_icon"},ba:function(a){a.popup||this.Tc("calendar",a);var b=dhx.ui.get(a.popup);b.l.attachEvent("onDateSelect",function(a){var b=dhx.ui.get(this.getParent().g.master);this.getParent().hide();b.setValue(a)});b.attachEvent("onShow",dhx.bind(this.tf,b));this.getList().attachEvent("onAfterMonthChange",dhx.bind(this.tf,b));this.ba=function(){}},tf:function(){var a=
dhx.ui.get(this.g.master);a.getList().resize();this.blockEvent();this.show(a.getNode(),this.l.g.align||"bottom",!0);this.unblockEvent()},Na:function(a){this.ba(a);dhx.isUndefined(a.value)||this.setValue(a.value)},I:function(a){var b=dhx.ui.get(this.g.popup.toString()),c=b.l;typeof a=="string"&&a&&(a=(this.g.externalDateFormat||this.g.dateFormat||dhx.i18n.dateFormatDate)(a));c.selectDate(a,!0);this.g.value=a?c.config.date:"";this.g.text=this.getInput().innerHTML=a?(this.g.dateFormatStr||dhx.i18n.dateFormatStr)(this.g.value):
""},dateFormat_setter:function(a){this.g.dateFormatStr=dhx.Date.dateToStr(a);return dhx.Date.strToDate(a)},externalDateFormat_setter:function(a){this.g.externalDateFormatStr=dhx.Date.dateToStr(a);return dhx.Date.strToDate(a)},getValue:function(){return this.g.stringResult&&typeof this.g.value!="string"?this.g.value?(this.g.externalDateFormatStr||this.g.dateFormatStr||dhx.i18n.dateFormatStr)(this.g.value):"":this.g.value||null}},dhx.ui.richselect);
dhx.RenderStack={$init:function(){this.T=document.createElement("DIV");this.data.attachEvent("onIdChange",dhx.bind(this.Ad,this));this.attachEvent("onItemClick",this.rg);if(!this.types)this.types={"default":this.type},this.type.name="default";this.type=dhx.copy(this.types[this.type.name])},customize:function(a){dhx.Type(this,a)},type_setter:function(a){this.types[a]?(this.type=dhx.copy(this.types[a]),this.type.css&&(this.k.className+=" "+this.type.css)):this.customize(a);return a},template_setter:function(a){this.type.template=
dhx.Template(a)},sa:function(a){this.callEvent("onItemRender",[a]);return this.type.templateStart(a,this.type)+(a.$template?this.type["template"+a.$template]:this.type.template)(a,this.type)+this.type.templateEnd(a,this.type)},Hc:function(a){this.T.innerHTML=this.sa(a);return this.T.firstChild},Ad:function(a,b){var c=this.ca(a);c&&(c.setAttribute(this.G,b),this.u[b]=this.u[a],delete this.u[a])},rg:function(){if(this.g.click){var a=dhx.toFunctor(this.g.click);a&&a.call&&a.apply(this,arguments)}},ca:function(a){if(this.u)return this.u[a];
this.u={};for(var b=this.i.childNodes,c=0;c<b.length;c++){var d=b[c].getAttribute(this.G);d&&(this.u[d]=b[c])}return this.ca(a)},locate:function(a){return dhx.html.locate(a,this.G)},showItem:function(a){var b=this.ca(a);if(b&&this.scrollTo){var c=Math.max(0,b.offsetLeft-this.i.offsetLeft),d=Math.max(0,b.offsetTop-this.i.offsetTop);this.scrollTo(c,d);this.Bf&&this.Bf(a)}},render:function(a,b,c){if(this.isVisible(this.g.id))if(a){var d=this.ca(a);switch(c){case "update":if(!d)break;var e=this.u[a]=
this.Hc(b);dhx.html.insertBefore(e,d);dhx.html.remove(d);break;case "delete":if(!d)break;dhx.html.remove(d);delete this.u[a];break;case "add":e=this.u[a]=this.Hc(b);dhx.html.insertBefore(e,this.ca(this.data.next(a)),this.i);break;case "move":this.render(a,b,"delete");this.render(a,b,"add");break;default:dhx.error("Unknown render command: "+c)}}else if(this.callEvent("onBeforeRender",[this.data]))(this.Ci||this.i).innerHTML=this.data.getRange().map(this.sa,this).join(""),this.u=null,this.callEvent("onAfterRender",
[]),e=this.i.offsetHeight}};dhx.protoUI({name:"proto",$init:function(){this.data.provideApi(this,!0);this.i=this.k;this.data.attachEvent("onStoreUpdated",dhx.bind(function(){this.render.apply(this,arguments)},this))},$setSize:function(){dhx.ui.view.prototype.$setSize.apply(this,arguments)&&this.render()}},dhx.RenderStack,dhx.DataLoader,dhx.ui.view,dhx.EventSystem,dhx.Settings);
dhx.Values={$init:function(){this.elements={}},focus:function(a){a?this.elements[a].focus():this.first().focus()},setValues:function(a){if(this.isVisible(this.g.id)){this.Yf=dhx.copy(a);for(var b in this.elements)this.elements[b]&&!dhx.isUndefined(a[b])&&this.elements[b].setValue(a[b]);this.callEvent("onChange",[])}else this.Lb=a},getValues:function(){if(this.Lb)return this.Lb;var a=this.Yf?dhx.copy(this.Yf):{},b;for(b in this.elements)a[b]=this.elements[b].getValue();return a},clear:function(){var a=
{},b;for(b in this.elements)this.elements[b].gg&&(a[b]=this.elements[b].g.defaultValue||"");this.setValues(a)},yc:function(a,b){var c=this.data.driver,d=c.getRecords(c.toObject(a,b))[0];this.setValues(c?c.getDetails(d):a);this.callEvent("onXLE",[])},$e:function(a,b){a&&(this.ac(a,b),dhx.html.addCss(this.elements[a].i.firstChild,"invalid"))},ac:function(a){a&&this.elements[a].i.firstChild&&dhx.html.removeCss(this.elements[a].i.firstChild,"invalid")}};
dhx.ValidateData={$init:function(){this.s&&this.attachEvent("onChange",this.clearValidation)},clearValidation:function(){if(this.elements)for(var a in this.elements)this.ac(a)},validate:function(a){var b=!0,c=this.g.rules;if(c){!a&&this.getValues&&(a=this.getValues());c.$obj&&(b=b&&this.Qd(objrule,a,a,""));var d=c.$all;if(d)for(var e in a)b=b&&this.Qd(d,a[e],a,e);for(e in c)e.indexOf("$")!==0&&(b=b&&this.Qd(c[e],a[e],a,e))}return b},Qd:function(a,b,c,d){if(a.call(this,b,c,d))return this.callEvent("onValidationSuccess",
[d,c])&&this.ac&&this.ac(d,c),!0;else this.callEvent("onValidationError",[d,c])&&this.$e&&this.$e(d,c);return!1}};dhx.rules={isNumber:function(a){return parseFloat(a)==a},isNotEmpty:function(a){return a=="0"||a}};
dhx.protoUI({name:"toolbar",defaults:{type:"MainBar"},zi:!0,Uc:44,$init:function(a){this.k.style.borderWidth="1px";this.nf(a);this.$ready.push(function(){for(var a in this.elements){var c=this.elements[a];c.mapEvent&&c.mapEvent({onbeforetabclick:dhx.Ja,onaftertabclick:dhx.Ja,onitemclick:dhx.Ja})}dhx.Ja=null})},nf:function(a){this.k.className+=" dhx_toolbar";if(a.elements)this.Y=a.elements,this.p=!1;dhx.Ja=this},$getSize:function(){var a=dhx.ui.baselayout.prototype.$getSize.call(this);if(a[3]>0&&(!this.p||
!this.g.scroll))this.g.height=a[3];if(a[1]>0&&(this.p||!this.g.scroll))this.g.width=a[1];a=dhx.ui.view.prototype.$getSize.call(this);if(a[3]<=0&&this.Uc>0)a[3]=this.Uc,a[2]=0;return a},$setSize:function(a,b){dhx.ui.view.prototype.$setSize.apply(this,arguments);dhx.ui.baselayout.prototype.$setSize.call(this,this.m,this.r)},render:function(){if(this.isVisible(this.g.id)&&this.Lb)this.setValues(this.Lb),this.Lb=null},refresh:function(){this.render()},type_setter:function(a){this.k.className+=" dhx_"+
a.toLowerCase()}},dhx.Scrollable,dhx.AtomDataLoader,dhx.Values,dhx.ui.baselayout,dhx.ValidateData,dhx.EventSystem);dhx.keyPressTimeout=200;dhx.KeyEvents={$init:function(){dhx.event(this.k,"keyup",this.Yh,this)},Yh:function(a){var a=a||event,b=a.which||a.keyCode;this.callEvent(this.ha?"onEditKeyPress":"onKeyPress",[b,a.ctrlKey,a.shiftKey,a]);dhx.Pe&&window.clearTimeout(dhx.Pe);dhx.Pe=window.setTimeout(dhx.bind(this.Zh,this),dhx.keyPressTimeout)},Zh:function(){this.callEvent("onTimedKeyPress",[])}};
dhx.EditAbility={$init:function(){this.ub=this.ha=null;this.attachEvent("onEditKeyPress",function(a,b,c){a==13&&!c?this.stopEdit():a==27&&this.stopEdit(!0)});this.attachEvent("onBeforeRender",function(){this.stopEdit()});this.data.attachEvent("onClearAll",dhx.bind(function(){this.ub=this.ha=null},this))},isEdit:function(){return this.ha},edit:function(a){if(this.stopEdit(!1,a)&&this.callEvent("onBeforeEditStart",[a])){var b=this.data.item(a);if(!b.$template)b.$template="Edit",this.data.refresh(a),
this.ha=a,this.Ki(a),this.ub(!0,b),this.callEvent("onAfterEditStart",[a])}},stopEdit:function(a,b){if(!this.ha)return!0;if(this.ha==b)return!1;if(!this.callEvent("onBeforeEditStop",[this.ha]))return!1;var c=this.data.item(this.ha);c.$template=null;a||this.ub(!1,c);var d=this.ha;this.ub=this.ha=null;this.data.refresh(d);this.callEvent("onAfterEditStop",[d]);return!0},Ki:function(a){var b=this.ca(a),c="",d="",e=[];if(b){for(var f=b.getElementsByTagName("*"),g="",h=0;h<f.length;h++)if(f[h].nodeType==
1&&(g=f[h].getAttribute("bind")))c+="els["+e.length+"].value="+g+";",d+=g+"=els["+e.length+"].value;",e.push(f[h]),f[h].className+=" dhx_allow_selection",f[h].onselectstart=this.mg;f=null}c=Function("obj","els",c);d=Function("obj","els",d);this.ub=function(a,b){a?(c(b,e),e.length&&e[0].select&&e[0].select()):d(b,e)}},mg:function(a){return(a||event).cancelBubble=!0}};
dhx.SelectionModel={$init:function(){this.o=dhx.toArray();this.data.attachEvent("onStoreUpdated",dhx.bind(this.Fg,this));this.data.attachEvent("onStoreLoad",dhx.bind(this.Eg,this));this.data.attachEvent("onAfterFilter",dhx.bind(this.Dg,this));this.data.attachEvent("onIdChange",dhx.bind(this.rh,this))},rh:function(a,b){for(var c=this.o.length-1;c>=0;c--)this.o[c]==a&&(this.o[c]=b)},Dg:function(){for(var a=this.o.length-1;a>=0;a--){if(this.data.indexById(this.o[a])<0)var b=this.o[a];var c=this.item(b);
c&&delete c.$selected;this.o.splice(a,1);this.callEvent("onSelectChange",[b])}},Fg:function(a,b,c){if(c=="delete")this.o.remove(a);else if(!this.data.dataCount()&&!this.data.A)this.o=dhx.toArray()},Eg:function(){this.g.select&&this.data.each(function(a){a.$selected&&this.select(a.id)},this)},Ec:function(a,b,c){if(!c&&!this.callEvent("onBeforeSelect",[a,b]))return!1;this.data.item(a).$selected=b;c?c.push(a):(b?this.o.push(a):this.o.remove(a),this.wd(a));return!0},select:function(a,b,c){if(!a)return this.selectAll();
if(dhx.isArray(a))for(var d=0;d<a.length;d++)this.select(a[d],b,c);else if(this.data.exists(a)){if(c&&this.o.length)return this.selectAll(this.o[this.o.length-1],a);if(!b&&(this.o.length!=1||this.o[0]!=a))this.Hf=!0,this.unselectAll(),this.Hf=!1;this.isSelected(a)?b&&this.unselect(a):this.Ec(a,!0)&&this.callEvent("onAfterSelect",[a])}else dhx.error("Incorrect id in select command: "+a)},unselect:function(a){if(!a)return this.unselectAll();this.isSelected(a)&&this.Ec(a,!1)},selectAll:function(a,b){var c,
d=[];c=a||b?this.data.getRange(a||null,b||null):this.data.getRange();c.each(function(a){var b=this.data.item(a.id);b.$selected||(this.o.push(a.id),this.Ec(a.id,!0,d));return a.id},this);this.wd(d)},unselectAll:function(){var a=[];this.o.each(function(b){this.Ec(b,!1,a)},this);this.o=dhx.toArray();this.wd(a)},isSelected:function(a){return this.o.find(a)!=-1},getSelected:function(a){switch(this.o.length){case 0:return a?[]:"";case 1:return a?[this.o[0]]:this.o[0];default:return[].concat(this.o)}},Dh:function(a){return a.length>
100||a.length>this.data.dataCount/2},wd:function(a){typeof a!="object"&&(a=[a]);if(a.length){if(this.Dh(a))this.data.refresh();else for(var b=0;b<a.length;b++)this.render(a[b],this.data.item(a[b]),"update");this.Hf||this.callEvent("onSelectChange",[a])}}};
dhx.VirtualRenderStack={$init:function(){this.u={};this.i.style.overflowY="scroll";dhx.event(this.i,"scroll",dhx.bind(this.sf,this));dhx.event(window,"resize",dhx.bind(function(){this.render()},this));this.Nb=[];this.attachEvent("onItemRender",function(a){a.$template=="loading"&&this.Nb.push(this.data.id(a))})},ca:function(a){return this.u[a]},show:function(a){var b=this.Ce(),c=this.data.indexById(a),d=Math.floor(c/b.Yc)*b.lb;this.i.scrollTop=d},render:function(a,b,c){if(a){var d=this.ca(a);switch(c){case "update":if(!d)break;
var e=this.u[a]=this.Hc(b);dhx.html.insertBefore(e,d);dhx.html.remove(d);break;default:this.Ai()}}else if(this.callEvent("onBeforeRender",[this.data]))this.u={},this.sf(null,!0),this.$f=!1,this.callEvent("onAfterRender",[])},Ai:function(){if(!this.$f)this.$f=!0,window.setTimeout(dhx.bind(function(){this.render()},this),1)},Sc:function(a){var b=document.createElement("DIV");b.style.cssText="height:"+a+"px; width:100%; overflow:hidden;";return b},sf:function(a,b){this.Nb=[];var c=this.Ce();if(!this.i.firstChild||
b)this.i.innerHTML="",this.i.appendChild(this.Sc(c.Qh)),this.xa=[this.i.firstChild];for(var d=c.Ea;d<=c.fd;){for(;this.xa[d]&&this.xa[d].$g&&d<=c.fd;)d++;if(d>c.fd)break;for(var e=d;!this.xa[e];)e--;var f=this.xa[e],g=d*c.Yc+(this.data.min||0);if(g>(this.data.max||Infinity))break;var h=Math.min(g+c.Yc-1,this.data.max||Infinity),i=this.Sc(c.lb),j=this.data.getIndexRange(g,h);if(!j.length)break;i.innerHTML=j.map(this.sa,this).join("");for(var k=0;k<j.length;k++)this.u[this.data.idByIndex(g+k)]=i.childNodes[k];
var l=parseInt(f.style.height,10),m=(d-e)*c.lb,n=l-m-c.lb;dhx.html.insertBefore(i,m?f.nextSibling:f,this.i);this.xa[d]=i;i.$g=!0;if(m<=0&&n>0)f.style.height=n+"px",this.xa[d+1]=f;else if(m<0?dhx.html.remove(f):f.style.height=m+"px",n>0){var o=this.xa[d+1]=this.Sc(n);dhx.html.insertBefore(o,i.nextSibling,this.i)}d++}if(this.Nb.length){var p=this.indexById(this.Nb[0]),q=this.indexById(this.Nb.pop())+1;if(q>p){if(!this.callEvent("onDataRequest",[p,q-p]))return!1;this.data.feed.call(this,p,q-p)}}},Ce:function(){var a=
this.i.scrollTop,b=Math.max(this.i.scrollWidth,this.i.offsetWidth)-18,c=this.i.offsetHeight,d=this.type,e=this.$c(),f=Math.floor(b/e.x)||1,g=Math.floor(a/e.y),h=Math.ceil((c+a)/e.y)-1,i=this.data.max?this.data.max-this.data.min:this.data.dataCount(),j=Math.ceil(i/f)*e.y;return{Ea:g,fd:h,jb:a,Qh:j,lb:e.y,Yc:f}}};
dhx.protoUI({name:"dataview",$init:function(){this.k.className+=" dhx_dataview";this.data.provideApi(this,!0)},ea:function(){this.g.height!="auto"&&dhx.extend(this,dhx.VirtualRenderStack)},defaults:{edit:!1,select:"multiselect",type:"default",scroll:!0},G:"dhx_f_id",on_click:{dhx_dataview_item:function(a,b){this.stopEdit(!1,b)&&this.g.select&&(this.g.select=="multiselect"?this.select(b,a.ctrlKey,a.shiftKey):this.select(b))}},on_dblclick:{dhx_dataview_item:function(a,b){this.g.edit&&this.edit(b)}},
on_mouse_move:{},dragMarker:function(a){var b=this.ca(a.target);if(this.type.drag_marker){if(this.Wc)this.Wc.style.backgroundImage="",this.Wc.style.backgroundRepeat="";if(b)b.style.backgroundImage="url("+(dhx.image_path||"")+this.type.drag_marker+")",b.style.backgroundRepeat="no-repeat",this.Wc=b}if(b&&this.g.auto_scroll){var c=b.offsetTop,d=b.offsetHeight,e=this.i.scrollTop,f=this.i.offsetHeight;c-d>0&&c-d*0.75<e?e=Math.max(c-d,0):c+d/0.75>e+f&&(e+=d);this.i.scrollTop=e}return!0},type:{css:"default",
template:"<div style='padding:10px; white-space:nowrap; overflow:hidden;'>#value#</div>",templateEdit:dhx.Template("<div style='padding:10px; white-space:nowrap; overflow:hidden;'><textarea style='width:100%; height:100%;' bind='#text#'></textarea></div>"),templateLoading:dhx.Template("<div style='padding:10px; white-space:nowrap; overflow:hidden;'>Loading...</div>"),width:139,height:22,margin:"0",padding:10,border:1,widthSize:function(a,b){return b.width+(b.width>-1?"px":"")},heightSize:function(a,
b){return b.height+(b.height>-1?"px":"")},templateStart:dhx.Template("<div dhx_f_id='#id#' class='dhx_dataview_item dhx_dataview_{common.css}_item{obj.$selected?_selected:}' style='width:{common.widthSize()}; height:{common.heightSize()}; padding:{common.padding}px; margin:{common.margin}px; float:left; overflow:hidden;'>"),templateEnd:dhx.Template("</div>")},xCount_setter:function(a){var b=this.$c();this.i.style.width=b.x*a+(this.g.height!="auto"?18:0)+"px";return a},yCount_setter:function(a){var b=
this.$c();this.i.style.height=b.y*a+"px";return a},$c:function(){var a=this.type,b=(a.border||0)+(a.padding||0)*2+(a.margin||0)*2;return{x:a.width+b,y:a.height+b}}},dhx.MouseEvents,dhx.KeyEvents,dhx.SelectionModel,dhx.EditAbility,dhx.Scrollable,dhx.ui.proto);dhx.Type(dhx.ui.dataview,{name:"FreeSize",css:"FreeSize",width:"auto",height:"auto"});
dhx.animate=function(a,b){if(dhx.isArray(a))for(var c=0;c<a.length;c++){if(b.type=="slide"){if(b.subtype=="out"&&c===0)continue;if(b.subtype=="in"&&c==1)continue}if(b.type=="flip"){var d=dhx.copy(b);if(c===0)d.type="flipback";if(c==1)d.callback=null;dhx.animate(a[c],d)}else dhx.animate(a[c],b)}else{var e=dhx.toNode(a);e.nc?dhx.animate.end(e,b):dhx.animate.start(e,b)}};
dhx.animate.end=function(a,b){a.style[dhx.env.transformPrefix+"TransitionDuration"]="1ms";a.nc=null;dhx.Zf&&window.clearTimeout(dhx.Zf);dhx.Zf=dhx.delay(dhx.animate,dhx,[a,b],10)};dhx.animate.isSupported=function(){return dhx.env.transform&&dhx.env.transition&&!dhx.env.isOpera};
dhx.animate.formLine=function(a,b,c){var d=c.direction;b.parentNode.style.position="relative";b.style.position="absolute";a.style.position="absolute";d=="top"||d=="bottom"?(a.style.left="0px",a.style.top=(d=="top"?1:-1)*b.offsetHeight+"px"):(a.style.top="0px",a.style.left=(d=="left"?1:-1)*b.offsetWidth+"px");b.parentNode.appendChild(a);if(c.type=="slide"&&c.subtype=="out")a.style.left=0,a.style.top=0,b.parentNode.removeChild(b),a.parentNode.appendChild(b);return[a,b]};
dhx.animate.breakLine=function(a){dhx.html.remove(a[1]);dhx.animate.clear(a[0]);dhx.animate.clear(a[1]);a[0].style.position=""};dhx.animate.clear=function(a){a.style[dhx.env.transformPrefix+"Transform"]="";a.style[dhx.env.transformPrefix+"Transition"]="";a.style.top=a.style.left=""};dhx.animate.defaults={type:"slide",delay:"0",duration:"500",timing:"ease-in-out",x:0,y:0};
dhx.animate.start=function(a,b){typeof b=="string"&&(b={type:b});var b=dhx.Settings.L(b,dhx.animate.defaults),c=dhx.env.transformPrefix,d=a.nc=b;switch(d.type=="slide"&&d.direction){case "right":d.x=a.offsetWidth;break;case "left":d.x=-a.offsetWidth;break;case "top":d.y=-a.offsetHeight;break;default:d.y=a.offsetHeight}if(d.type=="flip"||d.type=="flipback"){var e=[0,0],f="scaleX";d.subtype=="vertical"?(e[0]=20,f="scaleY"):e[1]=20;if(d.direction=="right"||d.direction=="bottom")e[0]*=-1,e[1]*=-1}var g=
d.duration+"ms "+d.timing+" "+d.delay+"ms",h=c+"TransformStyle: preserve-3d;",i="",j="";switch(d.type){case "fade":i="opacity "+g;h="opacity: 0;";break;case "show":i="opacity "+g;h="opacity: 1;";break;case "flip":g=d.duration/2+"ms "+d.timing+" "+d.delay+"ms";j="skew("+e[0]+"deg, "+e[1]+"deg) "+f+"(0.00001)";i="all "+g;break;case "flipback":d.delay+=d.duration/2;g=d.duration/2+"ms "+d.timing+" "+d.delay+"ms";a.style[c+"Transform"]="skew("+-1*e[0]+"deg, "+-1*e[1]+"deg) "+f+"(0.00001)";a.style.left=
"0";j="skew(0deg, 0deg) "+f+"(1)";i="all "+g;break;case "slide":var k=d.x+"px",l=d.y+"px",j=dhx.env.translate+"("+k+", "+l+(dhx.env.translate=="translate3d"?", 0":"")+")",i=dhx.env.transformCSSPrefix+"transform "+g}dhx.delay(function(){a.style[c+"Transition"]=i;dhx.delay(function(){h&&(a.style.cssText+=h);j&&(a.style[c+"Transform"]=j);var b=!1,e=dhx.event(a,dhx.env.transitionEnd,function(c){a.nc=null;d.callback&&d.callback.call(d.master||window,a,d,c);b=!0;dhx.eventRemove(e)});window.setTimeout(function(){if(!b)a.nc=
null,d.callback&&d.callback.call(d.master||window,a,d),b=!0,dhx.eventRemove(e)},(d.duration*1+d.delay*1)*1.3)})})};
dhx.protoUI({name:"accordionitem",$init:function(a){this.h.innerHTML="<div dhx_ai_id='"+a.id+"'  class='dhx_accordionitem_header'><div class='dhx_accordionitem_button' ></div><div class='dhx_accordionitem_label' ></div></div><div class='dhx_accordionitem_body'></div>";this.k=this.h;this.B=this.k.childNodes[0];if(!a.header)this.B.style.display="none";this.Ge=this.k.childNodes[0].childNodes[1];this.Fe=this.k.childNodes[0].childNodes[0];this.J=this.k.childNodes[1];this.h.className+=" dhx_accordionitem";
this.$=this.l=null;this.j=!0;this.g.n=a.n||{top:1,bottom:1,left:1,right:1};this.$ready.push(this.og)},og:function(){var a=this.g.n;a&&(this.Xb(a.top,"borderTopWidth"),this.Xb(a.left,"borderLeftWidth"),this.Xb(a.right,"borderRightWidth"),this.Xb(a.bottom,"borderBottomWidth"));this.ii=this.g.width;this.hi=this.g.height},Xb:function(a,b){a&&(this.B.style[b]="0px",this.l.j||(this.l.h.style[b]="0px"))},xd:function(){this.l={destructor:function(){}}},Eb:function(a){this.l.destructor();this.l=a;this.l.H=
this;this.J.appendChild(this.l.h);this.resize()},G:"dhx_ai_id",body_setter:function(a){typeof a!="object"&&(a={template:a});a.n=dhx.copy(this.g.n);this.l=dhx.ui.Aa(a);this.l.H=this;this.J.appendChild(this.l.h);this.pc=this.l;return a},header_setter:function(a){a&&(a=dhx.Template(a));return a},headerAlt_setter:function(a){a&&(a=dhx.Template(a));return a},$getSize:function(){var a=this.l.$getSize(),b=0;this.getParent().p?this.g.collapsed?(a[3]=this.hc(),a[2]=0):b=this.g.headerHeight:this.g.collapsed?
(a[1]=this.hc(),a[0]=0):b=this.g.headerHeight;this.g.width=a[1]||this.ii;this.g.height=a[3]?a[3]+b:this.hi;if(a[0]||a[2])this.g.gravity=Math.max(a[0],a[2]);return dhx.ui.baseview.prototype.$getSize.call(this)},on_click:{dhx_accordionitem_header:function(a){this.Qf(a)},dhx_accordionitem_header_v:function(a){this.Qf(a)}},Qf:function(a){this.define("collapsed",!this.g.collapsed);dhx.callEvent("onClick",[this.g.id]);return dhx.html.preventEvent(a)},collapsed_setter:function(a){if(this.g.header!==!1){var b=
this.getParent();if(a)if(!b||b.tg(this))this.zg();else return!1;else this.Xg();(this.g.collapsed=a)||this.getParent().fg(this);this.refresh();this.resize();b.callEvent("onAfter"+(a?"Collapse":"Expand"),[this.g.id]);return a}},collapse:function(){this.define("collapsed",!0)},hide:function(){this.collapse()},expand:function(){this.define("collapsed",!1)},show:function(){this.expand()},Xg:function(){this.J.style.display="";dhx.html.removeCss(this.Fe,"collapsed");this.Q=null},zg:function(){var a=this.getParent().p;
if(this.g.headerAlt)this.Ge.innerHTML=this.g.headerAlt();this.J.style.display="none";dhx.html.addCss(this.Fe,"collapsed");this.Q=null},refresh:function(){var a=this.g[this.g.collapsed?"headerAlt":"header"]||this.g.header;if(a)this.Ge.innerHTML=a()},hc:function(){return this.g.collapsed?this.g.headerAltHeight:this.g.headerHeight},$setSize:function(a,b){if(dhx.ui.baseview.prototype.$setSize.call(this,a,b)){var a=this.m,b=this.r,c=this.hc()-(this.g.n.top?0:1);if(this.g.header){this.B.style.height=c+
"px";this.B.style.lineHeight=c+"px";this.B.style.width="auto";this.B.style[dhx.env.transform]="";if(this.g.n.left)this.B.style.borderLeftWidth="0px";if(this.g.n.right)this.B.style.borderRightWidth="0px";if(this.getParent().p||!this.g.collapsed)b-=this.hc();else if(this.g.collapsed){this.B.style.width=b-2+"px";this.B.style.borderLeftWidth=this.B.style.borderRightWidth="1px";var d=Math.floor(-b/2+a/2)-(a-this.g.headerAltHeight)/2;this.B.style[dhx.env.transform]="rotate(-90deg) translate("+d+"px, "+
d+"px)"}}this.g.collapsed||this.l.$setSize(a,b)}},defaults:{header:"",headerAlt:!1,body:"",headerHeight:42,headerAltHeight:42,collapsed:!0}},dhx.MouseEvents,dhx.EventSystem,dhx.ui.baseview);
dhx.protoUI({name:"accordion",$init:function(){},U:function(){for(var a=0;a<this.Y.length;a++)this.Y[a].view="accordionitem";dhx.ui.layout.prototype.U.call(this);for(a=0;a<this.j.length;a++)this.j[a].refresh()},fg:function(a){if(this.g.multi===!1)for(var b=0;b<this.j.length;b++)a!=this.j[b]&&!this.j[b].g.collapsed&&this.j[b].collapse()},tg:function(a){if(this.g.multi===!0)return!0;for(var b=0;b<this.j.length;b++)if(a!=this.j[b]&&!this.j[b].g.collapsed)return!0;return!1},Bj:function(){this.$getSize();
this.Q&&this.$setSize.apply(this,this.Q)},defaults:{multi:!1}},dhx.ui.layout,dhx.EventSystem);
dhx.TreeStore={$init:function(){this.branch={0:[]}},clearAll:function(){this.branch={0:[]};dhx.DataStore.prototype.clearAll.call(this)},prevSibling:function(a){var b=this.branch[this.item(a).$parent],c=dhx.PowerArray.find.call(b,a)-1;return c>=0?b[c]:null},nextSibling:function(a){var b=this.branch[this.item(a).$parent],c=dhx.PowerArray.find.call(b,a)+1;return c<b.length?b[c]:null},parent:function(a){return this.item(a).$parent},firstChild:function(a){var b=this.branch[a];return b&&b.length?b[0]:null},
hasChild:function(a,b){var c=this.branch[a];if(c&&c.length)for(var d=0;d<c.length;d++){if(c[d]==b)return!0;if(this.hasChild(c[d],b))return!0}return!1},branchIndex:function(a,b){var c=this.branch[a];return dhx.PowerArray.find.call(c,b)},extraParser:function(a,b,c){a.$parent=b||0;a.$level=c||1;this.branch[a.$parent]||(this.branch[a.$parent]=[]);this.branch[a.$parent].push(a.id);if(!a.item)return a.$count=0;dhx.isArray(a.item)?a.$count=a.item.length:(a.item=[a.item],a.$count=1);for(var d=0;d<a.item.length;d++){var e=
a.item[d];this.pull[this.id(e)]=e;this.extraParser(e,a.id,a.$level+1)}delete a.item},provideApi:function(a,b){for(var c="prevSibling,nextSibling,parent,firstChild,hasChild,branchIndex".split(","),d=0;d<c.length;d++)a[c[d]]=this.af(this,c[d]);dhx.DataStore.prototype.provideApi.call(this,a,b)},getTopRange:function(){return dhx.toArray([].concat(this.branch[0])).map(function(a){return this.item(a)},this)},eachChild:function(a,b){if(this.branch[a])return dhx.PowerArray.each.call(this.branch[a],b)},add:function(a,
b,c){this.branch[c||0]=this.order=dhx.toArray(this.branch[c||0]);(c=this.item(c||0))&&c.$count++;a.$count=0;a.$level=c?c.$level+1:1;a.$parent=c?c.id:0;return dhx.DataStore.prototype.add.call(this,a,b)},remove:function(a){var b=this.item(a),c=b.$parent||0;this.branch[c]=this.order=dhx.toArray(this.branch[c]);c&&this.item(c).$count--;return dhx.DataStore.prototype.remove.call(this,a)},serialize:function(a){for(var b=this.branch[a||0],c=[],d=0;d<b.length;d++){var e=this.pull[b[d]];if(e.$count)e=dhx.copy(e),
e.item=this.serialize(b[d]);c.push(e)}return c},groupBy:function(a,b,c,d,e){if(c===!0){var f={},g=dhx.copy(a),h=g.pop(),i={},j;for(j in b){var k=b[j],l=k[h];if(typeof i[l]==="undefined"){j=dhx.uid();var m={id:j,text:l,$count:0,$level:e,$parent:d};i[l]=j;f[j]=[];this.pull[j]=m;this.branch[d].push(j);this.branch[j]=[]}else j=i[l];f[j].push(k);g.length===0&&this.branch[j].push(k.id)}for(var n in f)this.pull[n].$count=f[n].length,g.length>0&&this.groupBy(g,f[n],!0,n,e+1)}else{var o=arguments,g=[];this.branch=
{0:[]};for(n=o.length-1;n>=0;n--)g.push(o[n]);this.groupBy(g,this.pull,!0,"0",0);this.refresh()}}};
dhx.CarouselPanel={Ab:function(){var a,b,c,d;a=this.g.panel;dhx.html.remove(this.ma);b="z-index:"+dhx.ui.zIndex()+";";if(a.align=="bottom"||a.align=="top")b+="height:"+a.size+"px; left:0px;",c=0,a.align=="bottom"&&(c=this.r-this.g.panel.size),b+="top:"+c+"px";else if(a.align=="right"||a.align=="left")b+="width:"+a.size+"px;top:0px;",d=0,a.align=="right"&&(d=this.m-this.g.panel.size),b+="left:"+d+"px";this.ma=dhx.html.create("DIV",{"class":"dhx_carousel_panel",style:b},"");this.h.appendChild(this.ma);
this.Ac()},Ac:function(){var a,b;b=this.g.panel;this.ma?this.xg():this.Ab();var c=this.j?this.j.length:this.data.order.length;if(c>1){for(var d=0;d<c;d++)a=dhx.html.create("DIV",{"class":"dhx_item dhx_carousel_"+(d==this.q?"active":"inactive"),style:b.align=="left"||b.align=="right"?"float:none;":""},""),this.ma.appendChild(a);var e=c*this.g.panel.itemSize;if(b.align=="bottom"||b.align=="top"){if(this.m)this.ma.style.left=(this.m-e)/2+this.h.scrollLeft+"px";this.ma.style.width=e+"px"}else this.ma.style.top=
(this.r-e)/2+this.h.scrollTop+"px"}},xg:function(){if(this.ma)for(var a=this.ma.childNodes,b=a.length-1;b>=0;b--)dhx.html.remove(a[b])}};
dhx.protoUI({name:"list",$init:function(){this.data.provideApi(this,!0)},defaults:{select:!1,scroll:!0},G:"dhx_l_id",on_click:{dhx_list_item:function(a,b){if(this.g.select)this.ab=!0,this.g.select=="multiselect"?this.select(b,a.ctrlKey,a.shiftKey):this.select(b),this.ab=!1}},$getSize:function(){if(this.type.width!="auto")this.g.width=this.type.width+(this.type.padding+this.type.margin)*2;if(this.g.yCount)this.g.height=(this.type.height+(this.type.padding+this.type.margin)*2+1)*(this.g.yCount=="auto"?
this.dataCount():this.g.yCount)-1;return dhx.ui.view.prototype.$getSize.call(this)},$setSize:function(){dhx.ui.view.prototype.$setSize.apply(this,arguments)},type:{css:"",widthSize:function(a,b){return b.width+(b.width>-1?"px":"")},heightSize:function(a,b){return b.height+(b.height>-1?"px":"")},template:dhx.Template("#value#"),width:"auto",height:22,margin:0,padding:10,border:1,templateStart:dhx.Template("<div dhx_l_id='#id#' class='dhx_list_item dhx_list_{common.css}_item{obj.$selected?_selected:}' style='width:{common.widthSize()}; height:{common.heightSize()}; padding:{common.padding}px; margin:{common.margin}px; overflow:hidden;'>"),
templateEnd:dhx.Template("</div>")}},dhx.MouseEvents,dhx.SelectionModel,dhx.Scrollable,dhx.ui.proto);
dhx.protoUI({name:"grouplist",defaults:{animate:{}},$init:function(){dhx.extend(this.data,dhx.TreeStore,!0);this.data.provideApi(this,!0);this.data.attachEvent("onClearAll",dhx.bind(this.gf,this));this.h.className+=" dhx_grouplist";this.gf()},gf:function(){this.ja=[];this.N=[]},on_click:{dhx_list_item:function(a,b){if(this.Ya)return!1;for(var c=0;c<this.N.length;c++)if(this.N[c]==b){for(var d=c;d<this.N.length;d++)this.data.item(this.N[d]).$template="";c?(this.ja=this.data.branch[this.N[c-1]],this.N.splice(c)):
(this.ja=this.data.branch[0],this.N=[]);this.Ne=!1;return this.render()}var e=this.item(b);if(e.$count)return this.Ne=!0,this.N.push(b),e.$template="Back",this.ja=this.data.branch[e.id],this.render();else if(this.g.select)this.ab=!0,this.g.select=="multiselect"?this.select(b,a.ctrlKey,a.shiftKey):this.select(b),this.ab=!1}},getOpenState:function(){return{parents:this.N,branch:this.ja}},render:function(a,b,c,d){if(this.Ya)return dhx.delay(this.render,this,arguments,100);for(var e=0;e<this.ja.length;e++)this.data.item(this.ja[e]).$template=
"";if(!this.ja.length)this.ja=this.data.branch[0];this.data.order=dhx.toArray([].concat(this.N).concat(this.ja));if(this.callEvent("onBeforeRender",[this.data])){if(this.ab||!this.i.innerHTML||!dhx.animate.isSupported()||!this.g.animate||this.oi==this.N.length)dhx.RenderStack.render.apply(this,arguments);else{var f=this.i.cloneNode(!1);f.innerHTML=this.data.getRange().map(this.sa,this).join("");var g=dhx.extend({},this.g.animate);g.direction=this.Ne?"left":"right";var h=dhx.animate.formLine(f,this.i,
g);g.master=this;g.callback=function(){this.i=f;dhx.animate.breakLine(h);this.u=g.master=g.callback=null;this.Ya=!1;this.callEvent("onAfterRender",[])};this.Ya=!0;dhx.animate(h,g)}this.oi=this.N.length}},templateBack_setter:function(a){this.type.templateBack=dhx.Template(a)},templateItem_setter:function(a){this.type.templateItem=dhx.Template(a)},templateGroup_setter:function(a){this.type.templateGroup=dhx.Template(a)},type:{template:function(a,b){return a.$count?b.templateGroup(a,b):b.templateItem(a,
b)},css:"group",templateStart:dhx.Template("<div dhx_l_id='#id#' class='dhx_list_item dhx_list{obj.$count?_group:_item}{obj.$template?_back:}{obj.$selected?_selected:}' style='width:{common.width}px; height:{common.height}px; padding:{common.padding}px; margin:{common.margin}px; overflow:hidden;'>"),templateBack:dhx.Template("&lt; #value#"),templateItem:dhx.Template("#value#"),templateGroup:dhx.Template("#value#"),templateEnd:function(a){var b="";a.$count&&(b+="<div class='dhx_arrow_icon'></div>");
b+="</div>";return b}},showItem:function(a){var b,c;if(a&&(b=this.item(a),c=b.$parent,b.$count))c=b.id;this.ja=this.data.branch[c||0];for(this.N=[];c;)this.item(c).$template="Back",this.N.unshift(c),c=this.item(c).$parent;this.ab=!0;this.render();this.ab=!1;dhx.RenderStack.showItem.call(this,a)}},dhx.ui.list);dhx.Type(dhx.ui.grouplist,{});
dhx.protoUI({name:"pagelist",defaults:{scroll:"x",panel:!1,scrollOffset:0},qh:!0,$init:function(a){this.h.className+=" dhx_pagelist";a.scroll=a.scroll=="y"?"y":"x";this.type.layout=a.scroll;this.attachEvent("onAfterRender",this.Qi);this.$ready.push(this.ea);this.q=0},ea:function(){if(this.g.scroll=="x")this.i.style.height="100%";this.type.layout=this.g.scroll},Qi:function(){if(this.g.scroll=="x")this.i.style.width=(this.type.width+(this.type.padding+this.type.margin)*2+this.type.border)*this.dataCount()+
"px";this.g.panel&&this.Ab()},panel_setter:function(a){a&&(this.h.className+=" hidden_scroll",a===!0&&(a={}),this.L(a,{size:16,itemSize:16,align:"bottom"}));return a},Bf:function(a){var b=this.indexById(a);if(typeof b!="undefined"&&this.g.panel)this.q=b,this.Ac()},getActive:function(){return this.q&&this.data.order[this.q]?this.data.order[this.q]:this.first()},$changeScroll:function(a){var b=(this.g.scroll=="y"?this.type.height:this.type.width)+(this.type.padding+this.type.margin)*2+this.type.border,
c=this.g.scroll=="y"?this.i.scrollHeight-this.r:this.i.scrollWidth-this.m,d;this.g.scroll=="y"?(d=Math.round(a.f/b),a.f=d*b,a.f=this.fe(a.f,c)):(d=Math.round(a.e/b),a.e=d*b,a.e=this.fe(a.e,c));this.q=-d;this.g.panel&&this.Ac();return!0},fe:function(a,b){var c=this.g.scrollOffset;if(c&&Math.abs(a)>c){var d=dhx.Touch.F[dhx.Touch.R]>dhx.Touch.K[dhx.Touch.R];b-Math.abs(a)>c&&(a+=d?c:1-c)}Math.abs(a)>b&&(a=-b);return a},$getSize:function(){if(this.g.scroll=="y"){if(this.type.width!="auto")this.g.width=
this.type.width+(this.type.padding+this.type.margin)*2+this.type.border;if(this.g.yCount)this.g.height=(this.type.height+(this.type.padding+this.type.margin)*2+this.type.border)*(this.g.yCount=="auto"?this.dataCount():this.g.yCount)}else if(this.type.height!="auto")this.g.height=this.type.height+(this.type.padding+this.type.margin)*2+this.type.border;return dhx.ui.view.prototype.$getSize.call(this)},$setSize:function(a,b){if(dhx.ui.view.prototype.$setSize.apply(this,arguments)){if(this.type.fullScreen)this.type.width=
this.m,this.type.height=this.r,this.type.padding=0,this.render();this.g.panel&&this.Ab()}},type:{templateStart:function(a,b){var c="dhx_list_item dhx_list_"+b.css+"_item"+(a.$selected?"_selected":""),d="width:"+b.width+"px; height:"+b.height+"px; padding:"+b.padding+"px; margin:"+b.margin+"px; overflow:hidden;"+(b.layout&&b.layout=="x"?"float:left;":"");return"<div dhx_l_id='"+a.id+"' class='"+c+"' style='"+d+"'>"}}},dhx.ui.list,dhx.CarouselPanel);
dhx.protoUI({name:"unitlist",defaults:{sort:{}},G:"dhx_item_id",uniteBy_setter:dhx.Template,sort_setter:function(a){typeof a!="object"&&(a={});this.L(a,{dir:"asc",as:"string"});return a},render:function(a,b,c){var d=this.g;if(this.isVisible(d.id)){if(!d.uniteBy)return!1;if(a){var e=this.ca(a);if(e&&c=="update"&&this.g.uniteBy.call(this,b)==this.item(a).$unitValue){var f=this.u[a]=this.Hc(b);dhx.html.insertBefore(f,e);dhx.html.remove(e);return}}if(this.callEvent("onBeforeRender",[this.data])){this.data.blockEvent();
this.data.sort({by:d.sort.by||this.type.template,dir:d.sort.dir,as:d.sort.as});this.data.unblockEvent();this.units=null;this.Ti();if(this.units)this.i.innerHTML=this.jh().map(this.sa,this).join(""),this.u=null;this.callEvent("onAfterRender",[])}}},getUnits:function(){var a=[];if(this.units)for(var b in this.units)a.push(b);return a},getUnitItems:function(a){return this.units?this.units[a]:null},sa:function(a){this.callEvent("onItemRender",[a]);return a.$unit?this.type.templateStartHeader(a,this.type)+
this.type.templateHeader.call(this,a.$unit)+this.type.templateEnd(a,this.type):this.type.templateStart(a,this.type)+(a.$template?this.type["template"+a.$template]:this.type.template)(a,this.type)+this.type.templateEnd(a,this.type)},jh:function(){var a,b,c,d;a=[];for(c in this.units){a.push({$unit:c});d=this.units[c];for(b=0;b<d.length;b++)a.push(this.item(d[b]))}return a},Ti:function(){var a=this;this.units={};this.data.each(function(b){var c=a.g.uniteBy.call(this,b);b.$unitValue=c;a.units[c]||(a.units[c]=
[]);a.units[c].push(b.id)})},type:{headerHeight:20,templateHeader:function(a){return a},templateStart:function(a,b){if(a.$unit)return b.templateStartHeader.apply(this,arguments);var c="dhx_list_item dhx_list_"+b.css+"_item"+(a.$selected?"_selected":""),d="width:"+b.width+"px; height:"+b.height+"px; padding:"+b.padding+"px; margin:"+b.margin+"px; overflow:hidden;"+(b.layout&&b.layout=="x"?"float:left;":"");return"<div dhx_item_id='"+a.id+"' class='"+c+"' style='"+d+"'>"},templateStartHeader:function(a,
b){var c="dhx_unit_header dhx_unit_"+b.css+"_header"+(a.$selected?"_selected":""),d="width:"+b.width+"px; height:"+b.headerHeight+"px; overflow:hidden;";return"<div dhx_unit_id='"+a.$unit+"' class='"+c+"' style='"+d+"'>"}}},dhx.ui.list);
dhx.protoUI({name:"multiview",defaults:{animate:{}},$init:function(){this.q=0;this.p=1;this.h.style.position="relative";this.h.className+=" dhx_multiview";this.fa=[]},hg:function(a,b){var c=dhx.ui.get(a);if(!c.Bb)c.Cc=[],c.Bb={};c.Bb[b]||(c.Bb[b]=!0,c.Cc.push(b))},zd:function(a){var b=dhx.ui.get(a);this.fa[this.fa.length-2]!=a?(this.fa.length==10&&this.fa.splice(0,1),this.fa.push(a)):this.fa.splice(this.fa.length-1,1);if(b.Bb){for(var c=0;c<b.Cc.length;c++)dhx.ui.get(b.Cc[c]).render();b.Cc=[];b.Bb=
{}}},Wa:function(){},U:function(a){for(var a=a||this.Y,b=0;b<a.length;b++)a[b].n=this.g.n||{top:1,bottom:1,left:1,right:1};dhx.ui.baselayout.prototype.U.call(this,a);for(b=1;b<this.j.length;b++)dhx.html.remove(this.j[b].h);for(b=0;b<a.length;b++){var c=this.j[b];if(!c.j||c.zi){var d=c.g.n;if(d.top)c.h.style.borderTopWidth="0px";if(d.left)c.h.style.borderLeftWidth="0px";if(d.right)c.h.style.borderRightWidth="0px";if(d.bottom)c.h.style.borderBottomWidth="0px"}}this.zd(this.getActive())},cells_setter:function(a){this.Y=
a},eh:function(a,b){return a<b?"right":"left"},hb:function(a,b){if(this.Ya)return dhx.delay(this.hb,this,[a],100);for(var c=-1,d=0;d<this.j.length;d++)if(this.j[d]==a){c=d;break}if(!(c<0||c==this.q)){var e=this.j[this.q]?this.j[this.q].config.id:null,f=this.j[c]?this.j[c].config.id:null;if((b||typeof b=="undefined")&&dhx.animate.isSupported()&&this.g.animate){var g=dhx.extend({},this.g.animate);g.direction=this.eh(c,this.q);var g=dhx.Settings.L(b||{},g),h=dhx.animate.formLine(this.j[c].h,this.j[this.q].h,
g);this.j[c].$getSize();this.j[c].$setSize(this.m,this.r);g.callback=function(){dhx.animate.breakLine(h);this.Ya=!1;g.master=g.callback=null};g.master=this;this.q=c;this.zd(this.getActive());dhx.animate(h,g);this.Ya=!0}else dhx.html.remove(this.j[this.q].h),this.q=c,this.j[this.q].$getSize(),this.j[this.q].$setSize(this.m,this.r),this.zd(this.getActive()),this.h.appendChild(this.j[d].h);this.callEvent("onViewChange",[e,f])}},$getSize:function(){var a=this.j[this.q].$getSize();if(this.g.height>-1)a[3]=
this.g.height,a[2]=0;if(this.g.width>-1)a[1]=this.g.width,a[0]=0;a[0]&&(a[1]=0);a[2]&&(a[3]=0);return a},$setSize:function(a,b){dhx.ui.baseview.prototype.$setSize.call(this,a,b);this.j[this.q].$setSize(a,b)},isVisible:function(a,b){return b&&b!=this.getActive()?(a&&this.hg(b,a),!1):dhx.ui.view.prototype.isVisible.call(this,a,this.g.id)},getActive:function(){return this.j.length?this.j[this.q].g.id:null},back:function(a){a=a||1;if(this.callEvent("onBeforeBack",[this.getActive(),a])&&this.fa.length>
a){var b=this.fa[this.fa.length-a-1];dhx.ui.get(b).show();return b}return null}},dhx.ui.baselayout,dhx.EventSystem);dhx.Modality={modal_setter:function(a){if(a){if(!this.$a){this.$a=dhx.html.create("div",{"class":"dhx_modal"});var b=this.g.zIndex||dhx.ui.zIndex();this.$a.style.zIndex=b-1;this.h.style.zIndex=b;document.body.appendChild(this.$a)}}else this.$a&&dhx.html.remove(this.$a),this.$a=null;return a}};
dhx.protoUI({name:"window",$init:function(a){this.h.innerHTML="<div class='dhx_win_content'><div class='dhx_win_head'></div><div class='dhx_win_body'></div></div>";this.k=this.h.firstChild;this.B=this.k.childNodes[0];this.i=this.J=this.k.childNodes[1];this.h.className+=" dhx_window";this.$=this.l=null;this.g.n={top:!1,left:!1,right:!1,bottom:!1};if(!a.id)a.id=dhx.uid()},zIndex_setter:function(a){return this.h.style.zIndex=a},xd:function(){this.rf();this.l={destructor:function(){}}},Eb:function(a){this.l.destructor();
this.l=a;this.l.H=this;this.J.appendChild(this.l.h);var b=this.l.h.style;b.borderTopWidth=b.borderBottomWidth=b.borderLeftWidth=b.borderRightWidth="1px";this.l.g.n=dhx.copy(this.g.n);this.resize(!0)},destructor:function(){this.l.destructor();this.$.destructor();dhx.Destruction.destructor.call(this)},show:function(a,b,c){this.g.hidden=!1;this.h.style.zIndex=this.g.zIndex||dhx.ui.zIndex();this.g.modal&&this.modal_setter(!0);var d,e,f;if(a){typeof a=="object"&&!a.tagName?(d={x:a.clientX-this.Q[0]/2,
y:a.clientY},e=this.Q[0],f=1):(a=dhx.toNode(a),d=dhx.html.offset(a));var g=document.body.offsetWidth,h=document.body.offsetHeight;e=e||a.offsetWidth;f=f||a.offsetHeight;var i=this.Q,j=6,k=6,l=6,c="top",m=0,n=0,o=0,p=0;g-d.x-e<i[0]&&b=="right"&&(b="bottom");b=="right"?(p=d.x+j+e,k=-f,c="left",m=Math.round(d.y+f/2),n=p-l):b=="left"?(p=d.x-j-i[0]-1,k=-f,c="right",m=Math.round(d.y+f/2),n=p+i[0]+1):(p=d.x<0?0:g-d.x>i[0]?d.x:g-j-i[0],n=Math.round(d.x+e/2),n>p+i[0]&&(n=p+i[0]/2));!i[1]||h-f-d.y-k>i[1]?(o=
f+d.y+k,m||(c="top",m=o-l)):(o=d.y-k-i[1],o<0?(o=0,c=="top"&&(c=!1)):m||(c="bottom",o--,m=o+i[1]+1));this.setPosition(p,o);c&&this.Ef&&this.Ef(c,n,m)}this.Yi=new Date;this.h.style.display="block";this.rf();this.callEvent("onShow",[])},rf:function(){if(this.Va){var a=this.g.hidden;this.g.hidden=!1;for(var b=0;b<this.Va.length;b++){var c=dhx.ui.get(this.Va[b]);c&&c.render()}this.Va=[];this.gd={};this.g.hidden=a}},hidden_setter:function(a){a?this.hide():this.show();return!!a},hide:function(){!this.g.hidden&&
!(new Date-this.Yi<100)&&(this.g.modal&&this.modal_setter(!1),this.g.position=="top"?dhx.animate(this.h,{type:"slide",x:0,y:0,duration:300,callback:this.Ie,master:this}):this.Ie())},Ie:function(){this.h.style.display="none";this.g.hidden=!0;this.callEvent("onHide",[])},close:function(){this.define("modal",!1);dhx.html.remove(this.h);this.destructor()},body_setter:function(a){typeof a!="object"&&(a={template:a});this.l=dhx.ui.Aa(a);this.l.H=this;this.J.appendChild(this.l.h);return a},head_setter:function(a){if(a===
!1)return a;typeof a!="object"&&(a={template:a,css:"dhx_alert_head"});this.$=dhx.ui.Aa(a);this.$.H=this;this.B.appendChild(this.$.h);return a},getBody:function(){return this.l},getHead:function(){return this.$},adjust:function(){return this.resize()},resizeChildren:function(){this.resize()},resize:function(){var a=this.$getSize();this.$setSize(a[1]||this.g.width,a[3]||this.g.height);this.Id(this.g.left,this.g.top)},Id:function(a,b){if(this.g.position){var c=Math.round((document.body.offsetWidth-this.g.width)/
2),d=Math.round((document.body.offsetHeight-this.g.height)/2);this.g.position=="top"&&(d=dhx.animate.isSupported()?-1*this.g.height:10);this.setPosition(c,d);this.g.position=="top"&&dhx.animate(this.h,{type:"slide",x:0,y:this.g.height,duration:300,callback:this.mj,master:this})}else this.setPosition(a,b)},mj:function(a){dhx.animate.clear(a);this.g.top=2;this.setPosition(this.g.left,this.g.top)},setPosition:function(a,b){this.h.style.top=b+"px";this.h.style.left=a+"px";this.g.left=a;this.g.top=b},
$getSize:function(){var a=this.l.$getSize();if(this.$){var b=this.$.$getSize();if(b[3])this.g.headHeight=b[3]}if(a[3])a[3]+=this.g.head!==!1?this.g.headHeight:0,this.g.height=a[3];if(a[1])this.g.width=a[1];if(a[0]||a[2])this.g.gravity=Math.max(a[0],a[2]);return dhx.ui.view.prototype.$getSize.call(this)},$setSize:function(a,b){if(dhx.ui.view.prototype.$setSize.call(this,a,b))a=this.m,b=this.r,this.g.head===!1?(this.B.style.display="none",this.l.$setSize(a,b)):(this.$.$setSize(a,this.g.headHeight),
this.l.$setSize(a,b-this.g.headHeight))},defaults:{headHeight:43,width:300,height:200,top:100,left:100,body:"",head:""}},dhx.ui.view,dhx.Movable,dhx.Modality,dhx.EventSystem);
dhx.protoUI({name:"popup",$init:function(){this.g.head=!1;dhx.event(this.k,"click",dhx.bind(this.yg,this));dhx.attachEvent("onClick",dhx.bind(this.Wa,this));this.attachEvent("onHide",this.Je)},yg:function(){this.Zi=new Date},Wa:function(){new Date-(this.Zi||0)>250&&this.hide()},$getSize:function(){var a=this.l.$getSize();if(a[3])this.g.height=a[3]+this.g.padding*2;if(a[1])this.g.width=a[1]+this.g.padding*2;if(a[0]||a[2])this.g.gravity=Math.max(a[0],a[2]);return dhx.ui.view.prototype.$getSize.call(this)},
close:function(){dhx.html.remove(this.eb);dhx.ui.window.prototype.close.call(this)},$setSize:function(a,b){if(dhx.ui.view.prototype.$setSize.call(this,a,b))a=this.m-this.g.padding*2,b=this.r-this.g.padding*2,this.k.style.padding=this.g.padding+"px",this.B.style.display="none",this.l.$setSize(a,b)},body_setter:function(a){a=dhx.ui.window.prototype.body_setter.call(this,a);this.l.g.n={top:!1,left:!1,right:!1,bottom:!1};return a},defaults:{padding:8},head_setter:null,Ef:function(a,b,c){this.Je();document.body.appendChild(this.eb=
dhx.html.create("DIV",{"class":"dhx_point_"+a},""));this.eb.style.zIndex=dhx.ui.zIndex();this.eb.style.top=c+"px";this.eb.style.left=b+"px"},Je:function(){this.eb=dhx.html.remove(this.eb)}},dhx.ui.window);
dhx.protoUI({name:"alert",defaults:{position:"center",head:{template:"Info",css:"dhx_alert_head"},height:170,modal:!0,callback:null,body:{type:"clean",rows:[{template:"<div class='dhx_alert_text'>#text#</div>",data:{text:"You have forgot to define the text :) "}},{view:"button",height:60,id:"dhx_alert_ok",type:"big",label:"Ok",click:function(){this.getParent().getParent().Oc(!0)}}]}},$init:function(){(!this.h.parentNode||!this.h.parentNode.tagName)&&document.body.appendChild(this.h);this.$ready.push(this.resize)},
qf:function(a){typeof a=="string"&&(a={title:this.defaults.head.template,message:a});dhx.extend(a,this.defaults);delete a.head;delete a.body;this.cb(a,{});this.resize();this.show()},title_setter:function(a){this.$.define("template",a);this.$.render()},message_setter:function(a){var b=this.l.j[0];b.data={text:a};b.render()},labelOk_setter:function(a){var b=this.l.j[1];b.config.label=a;b.render()},labelCancel_setter:function(a){var b=this.l.j[2];b.config.label=a;b.render()},Oc:function(a){this.hide();
this.g.callback&&dhx.toFunctor(this.g.callback).call(this,a,this.g.details)}},dhx.ui.window);dhx.alert=dhx.single(dhx.ui.alert);
dhx.protoUI({name:"confirm",defaults:{height:210,body:{type:"clean",rows:[{id:"dhx_confirm_message",template:"<div class='dhx_alert_text'>#text#</div>",data:{text:"You have forgot to define the text :) "}},{height:53,view:"button",type:"big",id:"dhx_confirm_ok",label:"Ok",click:function(){this.getParent().getParent().Oc(!0)}},{height:55,view:"button",type:"biground",id:"dhx_confirm_cancel",label:"Cancel",click:function(){this.getParent().getParent().Oc(!1)}}]}}},dhx.ui.alert);dhx.confirm=dhx.single(dhx.ui.confirm);
dhx.protoUI({name:"form",defaults:{scroll:!0},Uc:-1,nf:function(a){this.k.className+=" dhx_form";if(a.elements)this.Y=a.elements,this.p=!0;dhx.Ja=this},type_setter:function(){}},dhx.ui.toolbar);
dhx.protoUI({name:"googlemap",$init:function(a){if(!a.id)a.id=dhx.uid();this.h.innerHTML="<div class='dhx_map_content' style='width:100%;height:100%'></div>";this.k=this.h.firstChild;this.map=null;this.$ready.push(this.render)},render:function(){var a=this.g,b={zoom:a.zoom,center:a.center,mapTypeId:a.mapType};this.map=new google.maps.Map(this.k,b)},center_setter:function(a){typeof a!="object"&&(a={});this.L(a,{x:48.724,y:8.215});a=new google.maps.LatLng(a.x,a.y);this.map&&this.map.setCenter(a);return a},
mapType_setter:function(a){a=google.maps.MapTypeId[a];this.map&&this.map.setMapTypeId(a);return a},zoom_setter:function(a){this.map&&this.map.setZoom(a);return a},defaults:{zoom:5,center:{},mapType:"ROADMAP"},$setSize:function(){dhx.ui.view.prototype.$setSize.apply(this,arguments);google.maps.event.trigger(this.map,"resize")}},dhx.ui.view);
dhx.protoUI({name:"video",$init:function(a){if(!a.id)a.id=dhx.uid();this.$ready.push(this.yh)},yh:function(){var a=this.g;this.k=dhx.html.create("video",{"class":"dhx_view_video",style:"width:100%;height:100%;",src:a.src,autobuffer:"autobuffer"},"");if(a.poster)this.k.poster=a.poster;this.k.addEventListener&&this.k.addEventListener("click",function(a){return function(){a.play()}}(this.k),!1);if(a.controls)this.k.controls=!0;if(a.autoplay)this.k.autoplay=!0;this.h.appendChild(this.k)},getVideo:function(){return this.k},
defaults:{src:"",controls:!0,autoplay:!0}},dhx.ui.view);
dhx.protoUI({name:"grid",$init:function(){this.k.innerHTML="<div class='dhx_grid_header' style='width:100%;height:"+this.g.headerHeight+"px;'></div><div class='dhx_grid_body'></div>";this.k.className+=" dhx_grid";this.J=this.i=this.k.childNodes[1];dhx.extend(this,dhx.Scrollable);this.data.provideApi(this,!0);this.data.attachEvent("onStoreUpdated",dhx.bind(function(){this.render()},this));this.attachEvent("onBeforeRender",this.Bi);this.$ready.push(this.render);this.attachEvent("onAfterScroll",this.Li);
this.Ld=null},Li:function(a){if(this.g.scroll&&this.g.scroll.indexOf("x")!=-1&&dhx.Touch){var b=this.J.previousSibling.firstChild;dhx.Touch.qa(b,-a.e,0,"0ms")}},header_setter:function(a){this.J.previousSibling.style.display=a?"":"none";return a},defaults:{select:!0,type:"default",sorting:!0,header:!0,scroll:!0,headerHeight:42},G:"dhx_f_id",on_click:{dhx_grid_row:function(a,b){this.g.select&&(this.g.select=="multiselect"?this.select(b,a.ctrlKey,a.shiftKey):this.select(b))},dhx_grid_header:function(a,
b){if(this.g.sorting&&(b=dhx.html.locate(a,"column_id"),b!==null)){this.Ld=b;var c=this.g.fields[b].sort;this.sort(c);c.dir=c.dir=="desc"?"asc":"desc"}}},fields_setter:function(a){for(var b={},c=0;c<a.length;c++){if(typeof a[c].id=="undefined")a[c].id="f"+c;var d=a[c].id;this.L(a[c],{width:100,label:d,template:"#"+a[c].id+"#",css:this.type.css,sort:{by:"#"+d+"#",dir:"asc",as:"string"},align:"left"});a[c].template=dhx.Template(a[c].template);b[d]=a[c]}return this.type.fields=b},Bi:function(){if(this.g.header){var a=
this.g.fields,b=this.J.previousSibling,c="<table style='width:0px;height:100%' cellspacing='0' cellpadding='0'><tr>",d;for(d in a)c+=this.wi(a[d].label,a[d].width,d);c+="</tr></table>";b.innerHTML=c}},wi:function(a,b,c){var d="<td class='dhx_grid_header_td' ";dhx.isUndefined(c)||(d+="column_id='"+c+"'");d+="><div style='width:"+b+"px;'>"+(a===""?"&nbsp;":a);if(c&&c==this.Ld){var e=this.g.fields[this.Ld].sort.dir;d+="<div class='dhx_sort_"+e+"' style='left:"+(b-this.type.sortImgWidth)+"px'></div>"}d+=
"</div></td>";return d},$setSize:function(a,b){if(dhx.ui.view.prototype.$setSize.apply(this,arguments))this.J.style.height=this.r-(this.g.header?this.g.headerHeight:0)+"px",this.J.style.width=this.m+"px",this.J.previousSibling.style.width=this.m+"px"},type:{template:function(a,b){var c="",d;for(d in b.fields){var e=b.fields[d];c+="<td style='' class='dhx_td' ><div align='"+e.align+"' style='width:"+e.width+"px;height:"+b.height+"px;line-height:"+b.height+"px' class='dhx_cell "+e.css+"'>"+e.template(a)+
"</div></td>"}return c},align:"left",height:42,css:"",sortImgWidth:20,type:"text",templateStart:function(a,b){return"<table dhx_f_id='"+a.id+"' class='dhx_grid_row"+(a.$selected?"_selected":"")+" "+b.templateCss(a,b)+"' cellpadding='0' cellspacing='0'><tr>"},templateCss:dhx.Template(""),templateEnd:dhx.Template("</tr></table>")}},dhx.SelectionModel,dhx.MouseEvents,dhx.RenderStack,dhx.DataLoader,dhx.ui.view,dhx.EventSystem,dhx.Settings);dhx.Type(dhx.ui.grid,{name:"dummy"});
dhx.protoUI({name:"carousel",defaults:{scrollSpeed:"100"},$init:function(){this.h.className+=" dhx_carousel";this.h.appendChild(dhx.html.create("DIV",{"class":"dhx_scroll_carousel"},""));this.k=this.h.firstChild;this.i=null;this.q=0;this.$ready.push(this.ea)},ea:function(){this.k.setAttribute("touch_scroll",this.p?"y":"x")},$changeScroll:function(a){var b=this.p?this.r:this.m,c;this.p?(c=Math.round(a.f/b),a.f=c*b):(c=Math.round(a.e/b),a.e=c*b);this.q=-c;this.g.panel&&this.Ac();return!0},hb:function(a){var b,
c,d,e,f;c=-1;for(b=0;b<this.j.length;b++)if(this.j[b]==a){c=b;break}if(!(c<0||c==this.q))this.q=c,d=this.p?this.r:this.m,e=-(this.p?0:c*d),f=-(this.p?c*d:0),this.scrollTo(e,f),this.Ab()},scrollTo:function(a,b){dhx.Touch?dhx.Touch.qa(this.k,a,b,this.g.scrollSpeed||"100ms"):(this.k.parentNode.scrollLeft=-a,this.k.parentNode.scrollTop=-b)},panel_setter:function(a){this.L(a,{size:16,itemSize:16,align:"bottom"});return a},$getSize:function(){return dhx.ui.layout.prototype.$getSize.call(this)},$setSize:function(a,
b){var c=this.j.length,d=this.p?c:1,e=this.p?1:c;dhx.ui.view.prototype.$setSize.call(this,a,b);this.k.style.height=b*d+"px";this.k.style.width=a*e+"px";this.La(a*e,b*d);this.Ab()},getActive:function(){return this.j[this.q].g.id}},dhx.CarouselPanel,dhx.ui.baselayout,dhx.EventSystem);
dhx.notice=function(a){typeof a!="object"&&(a={message:a});a=dhx.Settings.L(a,{message:"Sample notice message.",css:"",width:240,delay:3500,top:9,right:9});dhx.notice.jb&&(a.top+=dhx.notice.jb);var b=dhx.html.create("div",{"class":"dhx_notice "+a.css},"<span class='dhx_notice_content'>"+a.message+"</span>");b.style.cssText="width:"+a.width+"px;top:"+a.top+"px; right:"+a.right+"px";document.body.appendChild(b);dhx.notice.jb=a.top+b.offsetHeight;dhx.delay(dhx.notice.wg,b,[dhx.notice.jb],a.delay)};
dhx.notice.wg=function(a){if(dhx.notice.jb==a)dhx.notice.jb=0;dhx.html.remove(this)};dhx.dp=function(a){if(typeof a=="object"&&a.g)a=a.g.id;if(dhx.dp.td[a])return dhx.dp.td[a];if(typeof a=="string"||typeof a=="number")a={master:dhx.ui.get(a)};var b=new dhx.DataProcessor(a);return dhx.dp.td[b.g.master.g.id]=b};dhx.dp.td={};
dhx.DataProcessor=dhx.proto({defaults:{autoupdate:!0,mode:"post"},$init:function(){this.ka=[];this.xj=[];this.ua=null;this.Xa=!1;this.name="DataProcessor";this.$ready.push(this.ea)},master_setter:function(a){var b=a;if(a.name!="DataStore")b=a.data;this.g.store=b;return a},ea:function(){this.g.store.attachEvent("onStoreUpdated",dhx.bind(this.jf,this));this.g.url&&this.g.url.$proxy&&this.attachEvent("onBeforeDataSend",dhx.bind(this.g.url.Fh,this.g.url))},ignore:function(a,b){var c=this.Xa;this.Xa=!0;
a.call(b||this);this.Xa=c},off:function(){this.Xa=!0},on:function(){this.Xa=!1},Bg:function(a){var b={},c;for(c in a)c.indexOf("$")!==0&&(b[c]=a[c]);return b},save:function(a,b){b=b||"update";this.jf(a,this.g.store.item(a),b)},jf:function(a,b,c){if(this.Xa===!0||!c)return!0;var d={id:a,data:this.Bg(b)};switch(c){case "update":d.operation="update";break;case "add":d.operation="insert";break;case "delete":d.operation="delete";break;default:return!0}if(d.operation!="delete"&&!this.validate(d.data))return!1;
this.vg(d)&&this.ka.push(d);this.g.autoupdate&&this.send();return!0},vg:function(a){for(var b=0;b<this.ka.length;b++){var c=this.ka[b];if(c.id==a.id){if(a.operation=="delete")c.operation=="insert"?this.ka.splice(b,1):c.operation="delete";c.data=a.data;return!1}}return!0},send:function(){this.Oi()},Oi:function(){if(this.g.url){for(var a=this.ka,b=[],c=0;c<a.length;c++){var d=a[c].id,e=a[c].operation;if(this.g.store.exists(d))a[c].data=dhx.fullCopy(this.g.store.item(d));this.callEvent("onBefore"+e,
[d,a[c].data])&&b.push(a[c])}if(b.length||this.g.url.$proxy)this.callEvent("onBeforeDataSend",[b])&&(this.g.url.$proxy?this.g.url.Ed(b,this.g.mode,this):this.Ed(this.g.url,this.Ic(b),this.g.mode))}},Ic:function(a){var b={};if(this.g.single)this.Pb(a[0].data,b,"",a[0].operation);else{for(var c=[],d=0;d<a.length;d++){var e=a[d];c.push(e.id);this.Pb(e.data,b,e.id+"_",e.operation)}b.ids=c.join(",")}return b},Pb:function(a,b,c,d){for(var e in a)e.indexOf("$")!==0&&(b[c+e]=a[e]);b[c+"!nativeeditor_status"]=
d},Ed:function(a,b,c){if(typeof a=="function")return a(b);a+=a.indexOf("?")==-1?"?":"&";a+="editing=true";dhx.ajax()[c](a,b,dhx.bind(this.sd,this))},sd:function(a,b,c){this.callEvent("onBeforeSync",[f,a,b,c]);for(var d=dhx.DataDriver.xml,b=d.toObject(a,d),e=d.xpath(b,"//action"),f=[],g=0;g<e.length;g++){var h=d.tagToObject(e[g]);f.push(h);for(var i=-1,j=0;j<this.ka.length;){this.ka[j].id==h.sid&&(i=j);break}if(!(h.type=="error"||h.type=="invalid")||this.callEvent("onDBError",[h,this.ka[i]]))i>=0&&
this.ka.splice(i,1),h.tid!=h.sid&&this.g.store.changeId(h.sid,h.tid),this.callEvent("onAfter"+h.type,[h])}this.callEvent("onAfterSync",[f,a,b,c])},escape:function(a){return this.g.escape?this.g.escape(a):encodeURIComponent(a)}},dhx.Settings,dhx.EventSystem,dhx.ValidateData);
dhx.jsonp=function(a,b,c,d){var e="dhx_jsonp_"+dhx.uid(),f=document.createElement("script");f.id=e;f.type="text/javascript";var g=document.getElementsByTagName("head")[0];b||(b={});b.jsonp="dhx.jsonp."+e;dhx.jsonp[e]=function(){c.apply(d||window,arguments);f.parentNode.removeChild(f);c=g=d=f=null;delete dhx.jsonp[e]};var h=[],i;for(i in b)h.push(i+"="+encodeURIComponent(b[i]));a+=(a.indexOf("?")==-1?"?":"&")+h.join("&");f.src=a;g.appendChild(f)};
dhx.Canvas={$init:function(){this.Zb=[]},mi:function(a){this.X=dhx.html.create("canvas",{width:a.offsetWidth||this.m,height:a.offsetHeight||this.r});a.appendChild(this.X);this.X.getContext||dhx.error("Canvas is not supported in the current browser");return this.X},getCanvas:function(a){return(this.X||this.mi(this.k)).getContext(a||"2d")},Di:function(){this.X&&(this.X.setAttribute("width",this.X.parentNode.offsetWidth),this.X.setAttribute("height",this.X.parentNode.offsetHeight))},renderText:function(a,
b,c,d,e){if(c){e&&(e=Math.max(e,0));b&&(b=Math.max(b,0));var f=dhx.html.create("DIV",{"class":"dhx_canvas_text"+(d?" "+d:""),style:"left:"+a+"px; top:"+b+"px;"},c);this.k.appendChild(f);this.Zb.push(f);if(e)f.style.width=e+"px";return f}},renderTextAt:function(a,b,c,d,e,f,g){var h=this.renderText.call(this,c,d,e,f,g);if(h){if(a)h.style.top=a=="middle"?parseInt(d-h.offsetHeight/2,10)+"px":d-h.offsetHeight+"px";if(b)h.style.left=b=="left"?c-h.offsetWidth+"px":parseInt(c-h.offsetWidth/2,10)+"px"}return h},
clearCanvas:function(){for(var a=0;a<this.Zb.length;a++)this.k.removeChild(this.Zb[a]);this.Zb=[];if(this.k.u)this.k.u.parentNode.removeChild(this.k.u),this.k.u=null;this.getCanvas().clearRect(0,0,this.X.offsetWidth,this.X.offsetHeight)}};
dhx.Group={$init:function(){this.attachEvent("onBeforeRender",function(a){this.g.sort&&(a.blockEvent(),a.sort(this.g.sort),a.unblockEvent())});this.attachEvent("onBeforeSort",function(){this.g.sort=null});this.data.attachEvent("onStoreLoad",dhx.bind(function(){this.g.group&&this.group(this.g.group,!1)},this));this.data.attachEvent("onClearAll",dhx.bind(function(){this.ungroup(!1)},this));dhx.extend(this.data,dhx.GroupStore)},group:function(a,b){this.data.ungroup(!1);this.data.group(a);b!==!1&&this.render()},
ungroup:function(a){this.data.ungroup();a!==!1&&this.render()},group_setter:function(a){return a},sort_setter:function(a){typeof a!="object"&&(a={by:a});this.L(a,{as:"string",dir:"asc"});return a}};
dhx.GroupStore={sum:function(a,b){var a=dhx.Template(a),b=b||this,c=0;b.each(function(b){c+=a(b)*1});return c},min:function(a,b){var a=dhx.Template(a),b=b||this,c=Infinity;b.each(function(b){a(b)*1<c&&(c=a(b)*1)});return c*1},max:function(a,b){var a=dhx.Template(a),b=b||this,c=-Infinity;b.each(function(b){a(b)*1>c&&(c=a(b)*1)});return c},Ud:function(a,b){a=dhx.Template(a);return a(b[0])},ungroup:function(){if(this.pd)this.order=this.pd,this.pull=this.ff,this.ff=this.pd=null;this.callEvent("onStoreUpdated",
[])},group:function(a){var b=dhx.Template(a.by);a.map[b]||(a.map[b]=[b,this.Ud]);var c={},d=[];this.each(function(a){var e=b(a);c[e]||(d.push({id:e}),c[e]=dhx.toArray());c[e].push(a)});for(var e in a.map){var f=a.map[e][1]||this.Ud;typeof f!="function"&&(f=this[f]);for(var g=0;g<d.length;g++)d[g][e]=f.call(this,a.map[e][0],c[d[g].id])}this.pd=this.order;this.ff=this.pull;this.order=dhx.toArray();this.pull={};for(g=0;g<d.length;g++){var h=this.id(d[g]);this.pull[h]=d[g];this.order.push(h)}this.callEvent("onStoreUpdated",
[])}};
dhx.color={Od:"0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F".split(","),toHex:function(a,b){for(var a=parseInt(a,10),c="";a>0;)c=this.Od[a%16]+c,a=Math.floor(a/16);for(;c.length<b;)c="0"+c;return c},hexToDec:function(a){return parseInt(a,16)},toRgb:function(a){var b,c,d,e;typeof a!="string"?(b=a[0],c=a[1],d=a[2]):a.indexOf("rgb")!=-1?(e=a.substr(a.indexOf("(")+1,a.lastIndexOf(")")-a.indexOf("(")-1).split(","),b=e[0],c=e[1],d=e[2]):(a.substr(0,1)=="#"&&(a=a.substr(1)),b=this.hexToDec(a.substr(0,2)),c=this.hexToDec(a.substr(2,2)),
d=this.hexToDec(a.substr(4,2)));b=parseInt(b,10)||0;c=parseInt(c,10)||0;d=parseInt(d,10)||0;if(b<0||b>255)b=0;if(c<0||c>255)c=0;if(d<0||d>255)d=0;return[b,c,d]},hsvToRgb:function(a,b,c){var d,e,f,g,h,i,j,k;d=Math.floor(a/60)%6;e=a/60-d;f=c*(1-b);g=c*(1-e*b);h=c*(1-(1-e)*b);k=j=i=0;switch(d){case 0:i=c;j=h;k=f;break;case 1:i=g;j=c;k=f;break;case 2:i=f;j=c;k=h;break;case 3:i=f;j=g;k=c;break;case 4:i=h;j=f;k=c;break;case 5:i=c,j=f,k=g}i=Math.floor(i*255);j=Math.floor(j*255);k=Math.floor(k*255);return[i,
j,k]},rgbToHsv:function(a,b,c){var d,e,f,g,h,i,j,k;d=a/255;e=b/255;f=c/255;g=Math.min(d,e,f);h=Math.max(d,e,f);j=0;i=h==0?0:1-g/h;k=h;h==g?j=0:h==d&&e>=f?j=60*(e-f)/(h-g)+0:h==d&&e<f?j=60*(e-f)/(h-g)+360:h==e?j=60*(f-d)/(h-g)+120:h==f&&(j=60*(d-e)/(h-g)+240);return[j,i,k]}};
dhx.HtmlMap=dhx.proto({$init:function(a){this.G="map_"+dhx.uid();this.Hh=a;this.ya=[]},addRect:function(a,b,c){this.he(a,"RECT",b,c)},addPoly:function(a,b){this.he(a,"POLY",b)},he:function(a,b,c,d){var e="";arguments.length==4&&(e="userdata='"+d+"'");this.ya.push("<area "+this.Hh+"='"+a+"' shape='"+b+"' coords='"+c.join()+"' "+e+"></area>")},addSector:function(a,b,c,d,e,f,g){var h=[];h.push(d);h.push(Math.floor(e*g));for(var i=b;i<c;i+=Math.PI/18)h.push(Math.floor(d+f*Math.cos(i))),h.push(Math.floor((e+
f*Math.sin(i))*g));h.push(Math.floor(d+f*Math.cos(c)));h.push(Math.floor((e+f*Math.sin(c))*g));h.push(d);h.push(Math.floor(e*g));return this.addPoly(a,h)},render:function(a){var b=dhx.html.create("DIV");b.style.cssText="position:absolute; width:100%; height:100%; top:0px; left:0px;";a.appendChild(b);var c=dhx.env.isIE?"":"src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='";b.innerHTML="<map id='"+this.G+"' name='"+this.G+"'>"+this.ya.join("\n")+
"</map><img "+c+" class='dhx_map_img' usemap='#"+this.G+"'>";a.u=b;this.ya=[]}});dhx.ui.tooltip=function(a){typeof a=="string"&&(a={template:a});dhx.extend(this,dhx.Settings);dhx.extend(this,dhx.SingleRender);this.cb(a,{type:"default",dy:0,dx:20});this.i=this.k=document.createElement("DIV");this.k.className="dhx_tooltip";dhx.html.insertBefore(this.k,document.body.firstChild)};
dhx.ui.tooltip.prototype={isVisible:function(){return!0},show:function(a,b){if(!this.Ra){if(this.data!=a)this.data=dhx.extend({},a),this.render(a);this.k.style.top=b.y+this.g.dy+"px";this.k.style.left=b.x+this.g.dx+"px";this.k.style.display="block"}},hide:function(){this.data=null;this.k.style.display="none"},disable:function(){this.Ra=!0},enable:function(){this.Ra=!1},type:{template:dhx.Template("{obj.id}"),templateStart:dhx.Template.empty,templateEnd:dhx.Template.empty}};
dhx.protoUI({name:"chart",$init:function(a){this.v=[this.g];this.md=[];this.k.className+=" dhx_chart";this.$ready.push(this.ea);a.preset&&this.definePreset(a);this.attachEvent("onLocateData",this.hj);this.data.provideApi(this,!0)},ea:function(){this.data.attachEvent("onStoreUpdated",dhx.bind(function(){this.render()},this))},defaults:{color:"RAINBOW",alpha:"1",label:!1,value:"{obj.value}",padding:{},type:"pie",lineColor:"#ffffff",cant:0.5,barWidth:30,labelWidth:100,line:{width:2,color:"#1293f8"},
item:{radius:3,borderColor:"#636363",borderWidth:1,color:"#ffffff",alpha:1,type:"r",shadow:!1},shadow:!0,gradient:!1,border:!0,labelOffset:20,origin:"auto"},G:"dhx_area_id",on_click:{},on_dblclick:{},on_mouse_move:{},$setSize:function(a,b){dhx.ui.view.prototype.$setSize.call(this,a,b)&&(this.Di(),this.render())},type_setter:function(a){if(typeof this.g.offset=="undefined")this.g.offset=!(a=="area"||a=="stackedArea");a=="radar"&&!this.g.yAxis&&this.define("yAxis",{});a=="scatter"&&(this.g.yAxis||this.define("yAxis",
{}),this.g.xAxis||this.define("xAxis",{}));return a},render:function(){var a;if(this.isVisible(this.g.id)&&this.callEvent("onBeforeRender",[this.data])){if(this.wb)for(a=0;a<this.md.length;a++)this.wb.removeChild(this.md[a]);this.md=[];this.clearCanvas();this.g.legend&&this.Og(this.getCanvas(),this.data.getRange(),this.m,this.r);var b=this.bh(this.m,this.r),c=new dhx.HtmlMap(this.G),d=this.g;for(a=0;a<this.v.length;a++)this.g=this.v[a],this["$render_"+this.g.type](this.getCanvas(),this.data.getRange(),
b.start,b.end,a,c);c.render(this.k);this.g=d}},series_setter:function(a){if(typeof a=="object"){this.cb(!a.length?a:a[0],{});for(var b=1;b<a.length;b++)this.addSeries(a[b])}return a},tooltip_setter:function(a){var b=a.template;dhx.extend(a,{template:dhx.bind(function(a){return dhx.Template(this.v[this.Ba].tooltip[0])(a)},this)},!0);var c=new dhx.ui.tooltip(a);this.attachEvent("onMouseMove",function(a,b){this.v[this.Ba]&&c==this.v[this.Ba].tooltip[1]&&c.show(this.item(a),dhx.html.pos(b))});this.attachEvent("onMouseOut",
function(){this.v[this.Ba]&&c==this.v[this.Ba].tooltip[1]&&c.hide()});this.attachEvent("onMouseMoving",function(){this.v[this.Ba]&&c==this.v[this.Ba].tooltip[1]&&c.hide()});return[b,c]},value_setter:dhx.Template,xValue_setter:dhx.Template,yValue_setter:function(a){this.define("value",a)},alpha_setter:dhx.Template,label_setter:dhx.Template,lineColor_setter:dhx.Template,pieInnerText_setter:dhx.Template,gradient_setter:function(a){typeof a!="function"&&a&&a===!0&&(a="light");return a},colormap:{RAINBOW:function(a){var b=
Math.floor(this.indexById(a.id)/this.dataCount()*1536);b==1536&&(b-=1);return this.qi[Math.floor(b/256)](b%256)}},color_setter:function(a){return this.colormap[a]||dhx.Template(a)},fill_setter:function(a){return!a||a==0?!1:dhx.Template(a)},definePreset:function(a){this.define("preset",a.preset);delete a.preset},preset_setter:function(a){var b,c,d;this.defaults=dhx.extend({},this.defaults);d=this.presets[a];if(typeof d=="object"){for(b in d)if(typeof d[b]=="object")if(!this.defaults[b]||typeof this.defaults[b]!=
"object")this.defaults[b]=dhx.extend({},d[b]);else for(c in this.defaults[b]=dhx.extend({},this.defaults[b]),d[b])this.defaults[b][c]=d[b][c];else this.defaults[b]=d[b];return a}return!1},legend_setter:function(a){if(!a){if(this.legendObj)this.legendObj.innerHTML="",this.legendObj=null;return!1}typeof a!="object"&&(a={template:a});this.L(a,{width:150,height:18,layout:"y",align:"left",valign:"bottom",template:"",marker:{type:"square",width:15,height:15,radius:3},margin:4,padding:3});a.template=dhx.Template(a.template);
return a},item_setter:function(a){typeof a!="object"&&(a={color:a,borderColor:a});this.L(a,dhx.extend({},this.defaults.item));a.alpha=dhx.Template(a.alpha);a.borderColor=dhx.Template(a.borderColor);a.color=dhx.Template(a.color);a.radius=dhx.Template(a.radius);return a},line_setter:function(a){typeof a!="object"&&(a={color:a});dhx.extend(this.defaults.line,a,!0);a=dhx.extend({},this.defaults.line);a.color=dhx.Template(a.color);return a},padding_setter:function(a){typeof a!="object"&&(a={left:a,right:a,
top:a,bottom:a});this.L(a,{left:50,right:20,top:35,bottom:40});return a},xAxis_setter:function(a){if(!a)return!1;typeof a!="object"&&(a={template:a});this.L(a,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",lines:!0});var b=["lineColor","template","lines"];this.ee(b,a);this.g.configXAxis=dhx.extend({},a);return a},yAxis_setter:function(a){this.L(a,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",lines:!0,bg:"#ffffff"});var b=["lineColor","template","lines","bg"];this.ee(b,
a);this.g.configYAxis=dhx.extend({},a);return a},ee:function(a,b){for(var c=0;c<a.length;c++)b[a[c]]=dhx.Template(b[a[c]])},Xc:function(a,b,c,d,e,f,g){var h=this.ue(a,b,c,d,e,f);this.te(a,b,c,d,g,h);return h},te:function(a,b,c,d,e,f){if(this.g.xAxis){var g=c.x-0.5,h=parseInt(f?f:d.y,10)+0.5,i=d.x,j,k=!0;this.w(a,g,h,i,h,this.g.xAxis.color,1);for(var l=0;l<b.length;l++){this.g.offset===!0?j=g+e/2+l*e:(j=l==b.length-1?i:g+l*e,k=!!l);j=parseInt(j,10)-0.5;var m=this.g.origin!="auto"&&this.g.type=="bar"&&
parseFloat(this.g.value(b[l]))<this.g.origin;this.Vg(j,h,b[l],k,m);(l||this.g.offset===!0)&&this.g.xAxis.lines.call(this,b[l])&&this.Wg(a,j,d.y,c.y,b[l])}this.renderTextAt(!0,!1,g,d.y+this.g.padding.bottom-3,this.g.xAxis.title,"dhx_axis_title_x",d.x-c.x);this.g.xAxis.lines.call(this,{})&&this.g.offset&&this.w(a,i+0.5,d.y,i+0.5,c.y+0.5,this.g.xAxis.lineColor.call({}),1)}},ue:function(a,b,c,d,e,f){var g,h={};if(this.g.yAxis){var i=c.x-0.5,j=d.y+0.5,k=c.y-0.5,l=d.y;this.g.yAxis.step&&(g=parseFloat(this.g.yAxis.step));
if(typeof this.g.configYAxis.step=="undefined"||typeof this.g.configYAxis.start=="undefined"||typeof this.g.configYAxis.end=="undefined")h=this.Nc(e,f),e=h.start,f=h.end,g=h.step,this.g.yAxis.end=f,this.g.yAxis.start=e;this.Cf(c,d);if(g!==0){if(f==e)return j;for(var m=(j-k)*g/(f-e),n=0,o=e;o<=f;o+=g){h.fixNum&&(o=parseFloat((new Number(o)).toFixed(h.fixNum)));var p=Math.floor(j-n*m)+0.5;!(o==e&&this.g.origin=="auto")&&this.g.yAxis.lines(o)&&this.w(a,i,p,d.x,p,this.g.yAxis.lineColor(o),1);o==this.g.origin&&
(l=p);var q=o;if(g<1)var s=Math.min(this.Za(g),e<=0?0:this.Za(e)),r=Math.pow(10,-s),o=q=Math.round(o*r)/r;this.renderText(0,p-5,this.g.yAxis.template(q.toString()),"dhx_axis_item_y",c.x-5);n++}this.w(a,i,j,i,k,this.g.yAxis.color,1);return l}}},Cf:function(a,b){var c="dhx_axis_title_y"+(dhx.Ah&&dhx.Ah!=9?" dhx_ie_filter":""),d=this.renderTextAt("middle",!1,0,parseInt((b.y-a.y)/2+a.y,10),this.g.yAxis.title,c);if(d)d.style.left=(dhx.env.transform?(d.offsetHeight-d.offsetWidth)/2+3:0)+"px"},Nc:function(a,
b){if(this.g.origin!="auto"&&this.g.origin<a)a=this.g.origin;var c,d,e;c=(b-a)/8||1;var f=Math.floor(this.Za(c)),g=Math.pow(10,f),h=c/g,h=h>5?10:5;c=parseInt(h,10)*g;if(c>Math.abs(a))d=a<0?-c:0;else{var i=Math.abs(a),j=Math.floor(this.Za(i)),k=i/Math.pow(10,j);d=Math.ceil(k*10)/10*Math.pow(10,j)-c;for(i>1&&c>0.1&&(d=Math.ceil(d));a<0?d<=a:d>=a;)d-=c;a<0&&(d=-d-2*c)}for(e=d;e<b;)e+=c,e=parseFloat((new Number(e)).toFixed(Math.abs(f)));return{start:d,end:e,step:c,fixNum:Math.abs(f)}},Sa:function(a,b){var c,
d,e=arguments.length&&a=="h"?this.g.configXAxis:this.g.configYAxis;if(e&&typeof e.end!="undefined"&&typeof e.start!="undefined"&&e.step)c=parseFloat(e.end),d=parseFloat(e.start);else if(c=this.data.max(this.v[0][b||"value"]),d=this.data.min(this.v[0][b||"value"]),this.v.length>1)for(var f=1;f<this.v.length;f++){var g=this.data.max(this.v[f][b||"value"]),h=this.data.min(this.v[f][b||"value"]);g>c&&(c=g);h<d&&(d=h)}return{max:c,min:d}},Za:function(a){var b="log";return Math.floor(Math[b](a)/Math.LN10)},
Vg:function(a,b,c,d,e){if(this.g.xAxis){var f=this.renderTextAt(e,d,a,b-(e?2:0),this.g.xAxis.template(c));f&&(f.className+=" dhx_axis_item_x")}},Wg:function(a,b,c,d,e){this.g.xAxis&&this.g.xAxis.lines&&this.w(a,b,c,b,d,this.g.xAxis.lineColor.call(this,e),1)},w:function(a,b,c,d,e,f,g){a.strokeStyle=f;a.lineWidth=g;a.beginPath();a.moveTo(b,c);a.lineTo(d,e);a.stroke();a.lineWidth=1},Ga:function(a,b){var c,d,e=1;if(b!=a){d=b-a;if(Math.abs(c)<1)for(;Math.abs(c)<1;)e*=10,d=c*e;c=d}else c=a;return[c,e]},
qi:[function(a){return"#FF"+dhx.color.toHex(a/2,2)+"00"},function(a){return"#FF"+dhx.color.toHex(a/2+128,2)+"00"},function(a){return"#"+dhx.color.toHex(255-a,2)+"FF00"},function(a){return"#00FF"+dhx.color.toHex(a,2)},function(a){return"#00"+dhx.color.toHex(255-a,2)+"FF"},function(a){return"#"+dhx.color.toHex(a,2)+"00FF"}],addSeries:function(a){var b=dhx.extend({},this.g);this.g=dhx.extend({},b);this.cb(a,{});this.v.push(this.g);this.g=b},hj:function(a,b){this.Ba=b.getAttribute("userdata")},Og:function(a,
b){var c,d,e,f,g,h,i,j=0,k=0;d=this.g.legend;i=this.g.legend.layout!="x"?"width:"+d.width+"px":"";this.wb&&this.wb.parentNode.removeChild(this.wb);this.wb=e=dhx.html.create("DIV",{"class":"dhx_chart_legend",style:"left:"+j+"px; top:"+k+"px;"+i},"");this.k.appendChild(e);g=[];if(d.values)for(c=0;c<d.values.length;c++)g.push(this.pe(e,d.values[c].text));else for(c=0;c<b.length;c++)g.push(this.pe(e,d.template(b[c])));if(e.offsetWidth===0)e.style.width="auto";h=e.offsetWidth;f=e.offsetHeight;this.g.legend.width=
h;this.g.legend.height=f;h<this.k.offsetWidth&&(d.layout=="x"&&d.align=="center"&&(j=(this.k.offsetWidth-h)/2),d.align=="right"&&(j=this.k.offsetWidth-h),d.margin&&d.align!="center"&&(j+=(d.align=="left"?1:-1)*d.margin));f<this.k.offsetHeight&&(d.valign=="middle"&&d.align!="center"&&d.layout!="x"?k=(this.k.offsetHeight-f)/2:d.valign=="bottom"&&(k=this.k.offsetHeight-f),d.margin&&d.valign!="middle"&&(k+=(d.valign=="top"?1:-1)*d.margin));e.style.left=j+"px";e.style.top=k+"px";a.save();for(c=0;c<g.length;c++){var l=
g[c],m=d.values?d.values[c].color:this.g.color.call(this,b[c]);this.Pg(a,l.offsetLeft+j,l.offsetTop+k,m,l.offsetHeight)}a.restore();g=null},pe:function(a,b){var c="";this.g.legend.layout=="x"&&(c="float:left;");var d=dhx.html.create("DIV",{style:c+"padding-left:"+(10+this.g.legend.marker.width)+"px","class":"dhx_chart_legend_item"},b);a.appendChild(d);return d},Pg:function(a,b,c,d,e){var f=this.g.legend.marker;a.strokeStyle=a.fillStyle=d;a.beginPath();if(f.type=="round"||!f.radius){a.lineWidth=f.height;
a.lineCap=f.type;b+=a.lineWidth/2+5;c+=e/2;a.moveTo(b,c);var g=b+f.width-f.height+1;a.lineTo(g,c)}else{a.lineWidth=1;var h,i;b+=5;c+=e/2-f.height/2;h=b+f.width/2;i=c+f.height/2;a.arc(b+f.radius,c+f.radius,f.radius,Math.PI,3*Math.PI/2,!1);a.lineTo(b+f.width-f.radius,c);a.arc(b+f.width-f.radius,c+f.radius,f.radius,-Math.PI/2,0,!1);a.lineTo(b+f.width,c+f.height-f.radius);a.arc(b+f.width-f.radius,c+f.height-f.radius,f.radius,0,Math.PI/2,!1);a.lineTo(b+f.radius,c+f.height);a.arc(b+f.radius,c+f.height-
f.radius,f.radius,Math.PI/2,Math.PI,!1);a.lineTo(b,c+f.radius)}a.stroke();a.fill()},bh:function(a,b){var c,d,e,f;c=this.g.padding.left;d=this.g.padding.top;e=a-this.g.padding.right;f=b-this.g.padding.bottom;if(this.g.legend){var g=this.g.legend,h=this.g.legend.width,i=this.g.legend.height;g.layout=="x"?g.valign=="center"?g.align=="right"?e-=h:g.align=="left"&&(c+=h):g.valign=="bottom"?f-=i:d+=i:g.align=="right"?e-=h:g.align=="left"&&(c+=h)}return{start:{x:c,y:d},end:{x:e,y:f}}},cd:function(a){var b,
c,d,e,f;if(this.g.yAxis&&typeof this.g.yAxis.end!="undefined"&&typeof this.g.yAxis.start!="undefined"&&this.g.yAxis.step)d=parseFloat(this.g.yAxis.end),e=parseFloat(this.g.yAxis.start);else{for(b=0;b<a.length;b++){a[b].$sum=0;a[b].$min=Infinity;for(c=0;c<this.v.length;c++)if(f=parseFloat(this.v[c].value(a[b])||0),!isNaN(f)&&(a[b].$sum+=f,f<a[b].$min))a[b].$min=f}d=-Infinity;e=Infinity;for(b=0;b<a.length;b++){if(a[b].$sum>d)d=a[b].$sum;if(a[b].$min<e)e=a[b].$min}e>0&&(e=0)}return{max:d,min:e}},Fc:function(a,
b,c,d,e,f,g,h){var i,j,k,l,m;f=="light"?(i=h=="x"?a.createLinearGradient(b,c,d,c):a.createLinearGradient(b,c,b,e),i.addColorStop(0,"#FFFFFF"),i.addColorStop(0.9,g),i.addColorStop(1,g),j=2):f=="falling"||f=="rising"?(i=h=="x"?a.createLinearGradient(b,c,d,c):a.createLinearGradient(b,c,b,e),k=dhx.color.toRgb(g),l=dhx.color.rgbToHsv(k[0],k[1],k[2]),l[1]*=0.5,m="rgb("+dhx.color.hsvToRgb(l[0],l[1],l[2])+")",f=="falling"?(i.addColorStop(0,m),i.addColorStop(0.7,g),i.addColorStop(1,g)):f=="rising"&&(i.addColorStop(0,
g),i.addColorStop(0.3,g),i.addColorStop(1,m)),j=0):(a.globalAlpha=0.37,j=0,i=h=="x"?a.createLinearGradient(b,e,b,c):a.createLinearGradient(b,c,d,c),i.addColorStop(0,"#9d9d9d"),i.addColorStop(0.3,"#e8e8e8"),i.addColorStop(0.45,"#ffffff"),i.addColorStop(0.55,"#ffffff"),i.addColorStop(0.7,"#e8e8e8"),i.addColorStop(1,"#9d9d9d"));return{gradient:i,offset:j}},Fa:function(a,b,c,d){a*=-1;b+=Math.cos(a)*d;c-=Math.sin(a)*d;return{x:b,y:c}}},dhx.Group,dhx.DataLoader,dhx.MouseEvents,dhx.Canvas,dhx.EventSystem,
dhx.ui.view);
dhx.extend(dhx.ui.chart,{$render_pie:function(a,b,c,d,e,f){this.yd(a,b,c,d,1,f)},yd:function(a,b,c,d,e,f){if(b.length){var g=this.ad(c,d),h=this.g.radius?this.g.radius:g.radius,i=this.data.max(this.g.value),j=this.kh(b),k=this.Be(j),l=this.Ae(j,k),m=this.g.x?this.g.x:g.x,n=this.g.y?this.g.y:g.y;e==1&&this.g.shadow&&this.eg(a,m,n,h);n/=e;var o=-Math.PI/2,p=[];a.scale(1,e);if(this.g.gradient){var q=e!=1?m+h/3:m,s=e!=1?n+h/3:n;this.Xi(a,m,n,h,q,s)}for(var r=0;r<b.length;r++)if(j[r]){a.strokeStyle=this.g.lineColor.call(this,
b[r]);a.beginPath();a.moveTo(m,n);p.push(o);alpha1=-Math.PI/2+l[r]-1.0E-4;a.arc(m,n,h,o,alpha1,!1);a.lineTo(m,n);var z=this.g.color.call(this,b[r]);a.fillStyle=z;a.fill();this.g.pieInnerText&&this.re(m,n,5*h/6,o,alpha1,e,this.g.pieInnerText(b[r],k),!0);this.g.label&&this.re(m,n,h+this.g.labelOffset,o,alpha1,e,this.g.label(b[r]));if(e!=1)this.ge(a,m,n,o,alpha1,h,!0),a.fillStyle="#000000",a.globalAlpha=0.2,this.ge(a,m,n,o,alpha1,h,!1),a.globalAlpha=1,a.fillStyle=z;f.addSector(b[r].id,o,alpha1,m,n,h,
e);o=alpha1}a.globalAlpha=0.8;for(var w,r=0;r<p.length;r++)w=this.Fa(p[r],m,n,h),this.w(a,m,n,w.x,w.y,this.g.lineColor.call(this,b[r]),2);if(e==1)a.lineWidth=2,a.strokeStyle="#ffffff",a.beginPath(),a.arc(m,n,h+1,0,2*Math.PI,!1),a.stroke();a.globalAlpha=1;a.scale(1,1/e)}},kh:function(a){for(var b=[],c=0;c<a.length;c++)b.push(parseFloat(this.g.value(a[c])||0));return b},Be:function(a){for(var b=0,c=0;c<a.length;c++)b+=a[c];return b},Ae:function(a,b){for(var c,d=[],e=0,b=b||this.Be(a),f=0;f<a.length;f++)c=
a[f],d[f]=Math.PI*2*(b?(c+e)/b:1/data.length),e+=c;return d},ad:function(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.x+c/2,f=a.y+d/2,g=Math.min(c/2,d/2);return{x:e,y:f,radius:g}},ge:function(a,b,c,d,e,f,g){a.lineWidth=1;if(d<=0&&e>=0||d>=0&&e<=Math.PI||Math.abs(d-Math.PI)>0.0030&&d<=Math.PI&&e>=Math.PI){d<=0&&e>=0&&(d=0,g=!1,this.se(a,b,c,f,d,e));if(d<=Math.PI&&e>=Math.PI)e=Math.PI,g=!1,this.se(a,b,c,f,d,e);var h=(this.g.pieHeight||Math.floor(f/4))/this.g.cant;a.beginPath();a.arc(b,c,f,d,e,!1);a.lineTo(b+f*
Math.cos(e),c+f*Math.sin(e)+h);a.arc(b,c+h,f,e,d,!0);a.lineTo(b+f*Math.cos(d),c+f*Math.sin(d));a.fill();g&&a.stroke()}},se:function(a,b,c,d,e,f){a.beginPath();a.arc(b,c,d,e,f,!1);a.stroke()},eg:function(a,b,c,d){a.globalAlpha=0.5;for(var e="#c4c4c4,#c6c6c6,#cacaca,#dcdcdc,#dddddd,#e0e0e0,#eeeeee,#f5f5f5,#f8f8f8".split(","),f=e.length-1;f>-1;f--)a.beginPath(),a.fillStyle=e[f],a.arc(b+1,c+1,d+f,0,Math.PI*2,!0),a.fill();a.globalAlpha=1},fh:function(a){a.addColorStop(0,"#ffffff");a.addColorStop(0.7,"#7a7a7a");
a.addColorStop(1,"#000000");return a},Xi:function(a,b,c,d,e,f){a.globalAlpha=1;a.beginPath();var g;typeof this.g.gradient!="function"?(g=a.createRadialGradient(e,f,d/4,b,c,d),g=this.fh(g)):g=this.g.gradient(g);a.fillStyle=g;a.arc(b,c,d,0,Math.PI*2,!0);a.fill();a.globalAlpha=0.7},re:function(a,b,c,d,e,f,g,h){var i=this.renderText(0,0,g,0,1);if(i){var j=i.scrollWidth;i.style.width=j+"px";j>a&&(j=a);var k=e-d<0.2?4:8;h&&(k=j/1.8);var l=d+(e-d)/2;c-=(k-8)/2;var m=-k,n=-8,o="right";if(l>=Math.PI/2&&l<
Math.PI||l<=3*Math.PI/2&&l>=Math.PI)m=-j-m+1,o="left";var p=0;!h&&f<1&&l>0&&l<Math.PI&&(p=(this.g.pieHeight||Math.floor(c/4))/f);var q=(b+Math.floor((c+p)*Math.sin(l)))*f+n,s=a+Math.floor((c+k/2)*Math.cos(l))+m,r=e<Math.PI/2+0.01,z=d<Math.PI/2;if(z&&r)s=Math.max(s,a+3),e-d<0.2&&(s=a);else if(!z&&!r)s=Math.min(s,a-j);else if(!h&&(l>=Math.PI/2&&l<Math.PI||l<=3*Math.PI/2&&l>=Math.PI))s+=j/3;i.style.top=q+"px";i.style.left=s+"px";i.style.width=j+"px";i.style.textAlign=o;i.style.whiteSpace="nowrap"}},
$render_pie3D:function(a,b,c,d,e,f){this.yd(a,b,c,d,this.g.cant,f)},$render_donut:function(a,b,c,d,e,f){if(b.length){this.yd(a,b,c,d,1,f);var g=this.g,h=this.ad(c,d),i=g.radius?g.radius:h.radius,j=g.innerRadius&&g.innerRadius<i?g.innerRadius:i/3,k=g.x?g.x:h.x,l=g.y?g.y:h.y;a.fillStyle="#ffffff";a.beginPath();a.arc(k,l,j,0,Math.PI*2,!0);a.fill()}}});
dhx.extend(dhx.ui.chart,{$render_bar:function(a,b,c,d,e,f){var g,h,i,j,k=d.y-c.y,l=!!this.g.yAxis,m=!!this.g.xAxis,n=this.Sa();g=n.max;h=n.min;var o=Math.floor((d.x-c.x)/b.length);!e&&(this.g.origin=="auto"||l)&&this.Xc(a,b,c,d,h,g,o);l&&(g=parseFloat(this.g.yAxis.end),h=parseFloat(this.g.yAxis.start));var p=this.Ga(h,g);j=p[0];i=p[1];var q=j?k/j:j;if(!l&&!(this.g.origin!="auto"&&m))var s=10,q=j?(k-s)/j:s;!e&&this.g.origin!="auto"&&!l&&this.g.origin>h&&this.te(a,b,c,d,o,d.y-q*(this.g.origin-h));var r=
parseInt(this.g.barWidth,10);this.v&&r*this.v.length+4>o&&(r=parseInt(o/this.v.length-4,10));var z=Math.floor((o-r*this.v.length)/2),w=typeof this.g.radius!="undefined"?parseInt(this.g.radius,10):Math.round(r/5),y=!1,t=this.g.gradient;t&&typeof t!="function"?(y=t,t=!1):t&&(t=a.createLinearGradient(0,d.y,0,c.y),this.g.gradient(t));m||this.w(a,c.x,d.y+0.5,d.x,d.y+0.5,"#000000",1);for(var x=0;x<b.length;x++){var v=parseFloat(this.g.value(b[x]||0));v>g&&(v=g);v-=h;v*=i;var u=c.x+z+x*o+(r+1)*e,A=d.y;if(v<
0||this.g.yAxis&&v===0&&!(this.g.origin!="auto"&&this.g.origin>h))this.renderTextAt(!0,!0,u+Math.floor(r/2),A,this.g.label(b[x]));else{!l&&!(this.g.origin!="auto"&&m)&&(v+=s/q);var B=t||this.g.color.call(this,b[x]);a.globalAlpha=this.g.alpha.call(this,b[x]);var C=this.Ig(a,c,u,A,r,h,w,q,v,B,t,y);y&&this.Kg(a,u,A,r,h,w,q,v,B,y);this.g.border&&this.Jg(a,u,A,r,h,w,q,v,B);a.globalAlpha=1;C[0]!=u?this.renderTextAt(!1,!0,u+Math.floor(r/2),C[1],this.g.label(b[x])):this.renderTextAt(!0,!0,u+Math.floor(r/
2),C[3],this.g.label(b[x]));f.addRect(b[x].id,[u,C[3],C[2],C[1]],e)}}},Rc:function(a,b,c,d,e,f,g){var h=this.g.xAxis,i=c;h&&this.g.origin!="auto"&&this.g.origin>g&&(c-=(this.g.origin-g)*e,i=c,d-=this.g.origin-g,d<0&&(d*=-1,a.translate(b+f,c),a.rotate(Math.PI),c=b=0),c-=0.5);return{value:d,x0:parseInt(b,10),y0:parseInt(c,10),start:i}},Ig:function(a,b,c,d,e,f,g,h,i,j,k,l){a.save();a.fillStyle=j;var m=this.Rc(a,c,d,i,h,e,f),n=this.Fd(a,m.x0,m.y0,e,g,h,m.value,this.g.border?1:0);k&&!l&&a.lineTo(m.x0+
(this.g.border?1:0),b.y);a.fill();a.restore();var o=m.x0,p=m.x0!=c?c+n[0]:n[0],q=m.x0!=c?m.start-n[1]:d,s=m.x0!=c?m.start:n[1];return[o,q,p,s]},Gd:function(a,b){var c,d;d=dhx.color.toRgb(b);c=dhx.color.rgbToHsv(d[0],d[1],d[2]);c[2]/=2;b="rgb("+dhx.color.hsvToRgb(c[0],c[1],c[2])+")";a.strokeStyle=b;if(a.globalAlpha==1)a.globalAlpha=0.9},Jg:function(a,b,c,d,e,f,g,h,i){var j;a.save();j=this.Rc(a,b,c,h,g,d,e);this.Gd(a,i);this.Fd(a,j.x0,j.y0,d,f,g,j.value,a.lineWidth/2,1);a.stroke();a.restore()},Kg:function(a,
b,c,d,e,f,g,h,i,j){a.save();var k=this.Rc(a,b,c,h,g,d,e),l=this.Fc(a,k.x0,k.y0,k.x0+d,k.y0-g*k.value+2,j,i,"y"),m=this.g.border?1:0;a.fillStyle=l.gradient;this.Fd(a,k.x0+l.offset,k.y0,d-l.offset*2,f,g,k.value,l.offset+m);a.fill();a.restore()},Fd:function(a,b,c,d,e,f,g,h,i){a.beginPath();var j=0;if(e>f*g){var k=(e-f*g)/e;k<=1&&k>=-1&&(j=-Math.acos(k)+Math.PI/2)}a.moveTo(b+h,c);var l=c-Math.floor(f*g)+e+(e?0:h);e<f*g&&a.lineTo(b+h,l);var m=b+e;e&&e>0&&a.arc(m,l,e-h,-Math.PI+j,-Math.PI/2,!1);var n=b+
d-e-(e?0:h),o=l-e+(e?h:0);a.lineTo(n,o);e&&e>0&&a.arc(n,l,e-h,-Math.PI/2,0-j,!1);var p=b+d-h;a.lineTo(p,c);i||a.lineTo(b+h,c);return[p,o]}});
dhx.extend(dhx.ui.chart,{$render_line:function(a,b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p;j=this.Yb(a,b,c,d,e);h=this.g;if(b.length){o=this.Ha(b[0],c,d,j);l=m=h.offset?c.x+j.cellWidth*0.5:c.x;for(i=1;i<=b.length;i++){n=i==b.length-1&&!h.offset?d.x:Math.floor(j.cellWidth*i)-0.5+l;if(b.length!=i){p=this.Ha(b[i],c,d,j);if(!p)continue;this.w(a,m,o,n,p,h.line.color.call(this,b[i-1]),h.line.width);if(h.line&&h.line.shadow)a.globalAlpha=0.3,this.w(a,m+2,o+h.line.width+8,n+2,p+h.line.width+8,"#eeeeee",h.line.width+
3),a.globalAlpha=1}this.gc(a,m,o,b[i-1],!!h.offset);k=parseInt(h.item.radius.call(this,b[i-1]),10)||2;g=h.eventRadius||k+1;f.addRect(b[i-1].id,[m-g,o-g,m+g,o+g],e);o=p;m=n}}},gc:function(a,b,c,d,e){var f=this.g.item,g=parseInt(f.radius.call(this,d),10);a.save();if(f.shadow){a.lineWidth=1;a.strokeStyle="#bdbdbd";a.fillStyle="#bdbdbd";for(var h=[0.1,0.2,0.3],i=h.length-1;i>=0;i--)a.globalAlpha=h[i],a.strokeStyle="#d0d0d0",a.beginPath(),this.Md(a,b,c+2*g/3,g+i+1,f.type),a.stroke();a.beginPath();a.globalAlpha=
0.3;a.fillStyle="#bdbdbd";this.Md(a,b,c+2*g/3,g+1,f.type);a.fill()}a.restore();a.lineWidth=f.borderWidth;a.fillStyle=f.color.call(this,d);a.strokeStyle=f.borderColor.call(this,d);a.globalAlpha=f.alpha.call(this,d);a.beginPath();this.Md(a,b,c,g+1,f.type);a.fill();a.stroke();a.globalAlpha=1;e&&this.renderTextAt(!1,!0,b,c-g-this.g.labelOffset,this.g.label.call(this,d))},Md:function(a,b,c,d,e){if(e&&(e=="square"||e=="s"))d*=Math.sqrt(2)/2,a.moveTo(b-d-a.lineWidth/2,c-d),a.lineTo(b+d,c-d),a.lineTo(b+d,
c+d),a.lineTo(b-d,c+d),a.lineTo(b-d,c-d);else if(e&&(e=="diamond"||e=="d")){var f=a.lineWidth>1?a.lineWidth*Math.sqrt(2)/4:0;a.moveTo(b,c-d);a.lineTo(b+d,c);a.lineTo(b,c+d);a.lineTo(b-d,c);a.lineTo(b+f,c-d-f)}else a.arc(b,c,d,0,Math.PI*2,!0)},Ha:function(a,b,c,d){var e=d.minValue,f=d.maxValue,g=d.unit,h=d.valueFactor,i=this.g.value(a),j=(parseFloat(i||0)-e)*h;this.g.yAxis||(j+=d.startValue/g);var k=c.y-Math.floor(g*j);if(j<0)k=c.y;if(i>f)k=b.y;if(i<e)k=c.y;return k},Yb:function(a,b,c,d,e){var f={},
g;f.totalHeight=d.y-c.y;f.cellWidth=Math.round((d.x-c.x)/(!this.g.offset?b.length-1:b.length));var h=!!this.g.yAxis,i=this.g.type.indexOf("stacked")!=-1?this.cd(b):this.Sa();f.maxValue=i.max;f.minValue=i.min;e||this.Xc(a,b,c,d,f.minValue,f.maxValue,f.cellWidth);if(h)f.maxValue=parseFloat(this.g.yAxis.end),f.minValue=parseFloat(this.g.yAxis.start);var j=this.Ga(f.minValue,f.maxValue);g=j[0];f.valueFactor=j[1];f.unit=g?f.totalHeight/g:10;f.startValue=0;if(!h&&(f.startValue=10,f.unit!=f.totalHeight))f.unit=
g?(f.totalHeight-f.startValue)/g:10;return f}});
dhx.extend(dhx.ui.chart,{$render_barH:function(a,b,c,d,e,f){var g,h,i,j,k=d.x-c.x,l=!!this.g.yAxis,m=!!this.g.xAxis,n=this.Sa("h");g=n.max;h=n.min;var o=Math.floor((d.y-c.y)/b.length);e||this.ne(a,b,c,d,h,g,o);l&&(g=parseFloat(this.g.xAxis.end),h=parseFloat(this.g.xAxis.start));var p=this.Ga(h,g);j=p[0];i=p[1];var q=j?k/j:10;if(!l)var s=10,q=j?(k-s)/j:10;var r=parseInt(this.g.barWidth,10);r*this.v.length+4>o&&(r=o/this.v.length-4);var z=Math.floor((o-r*this.v.length)/2),w=typeof this.g.radius!="undefined"?
parseInt(this.g.radius,10):Math.round(r/5),y=!1,t=this.g.gradient;t&&typeof t!="function"?(y=t,t=!1):t&&(t=a.createLinearGradient(c.x,c.y,d.x,c.y),this.g.gradient(t));var x=0;l||this.w(a,c.x-0.5,c.y,c.x-0.5,d.y,"#000000",1);for(var v=0;v<b.length;v++){var u=parseFloat(this.g.value(b[v]||0));u>g&&(u=g);u-=h;u*=i;var A=c.x,B=c.y+z+v*o+(r+1)*e;if(u<0&&this.g.origin=="auto"||this.g.xAxis&&u===0&&!(this.g.origin!="auto"&&this.g.origin>h))this.renderTextAt("middle","right",A+10,B+r/2+z,this.g.label(b[v]));
else{u<0&&this.g.origin!="auto"&&this.g.origin>h&&(u=0);l||(u+=s/q);var C=t||this.g.color.call(this,b[v]);this.g.border&&this.me(a,A,B,r,h,w,q,u,C);a.globalAlpha=this.g.alpha.call(this,b[v]);var D=this.Lg(a,c,A,B,r,h,w,q,u,C,t,y);y!=!1&&this.Mg(a,A,B,r,h,w,q,u,C,y);a.globalAlpha=1;D[3]==B?(this.renderTextAt("middle","left",D[0]-5,D[3]+Math.floor(r/2),this.g.label(b[v])),f.addRect(b[v].id,[D[0],D[3],D[2],D[3]+r],e)):(this.renderTextAt("middle",!1,D[2]+5,D[1]+Math.floor(r/2),this.g.label(b[v])),f.addRect(b[v].id,
[D[0],B,D[2],D[3]],e))}}},Ib:function(a,b,c,d,e,f,g,h,i){var j=0;if(e>f*g)var k=(e-f*g)/e,j=-Math.asin(k)+Math.PI/2;a.moveTo(b,c+h);var l=b+f*g-e-(e?0:h);e<f*g&&a.lineTo(l,c+h);var m=c+e;e&&e>0&&a.arc(l,m,e-h,-Math.PI/2+j,0,!1);var n=c+d-e-(e?0:h),o=l+e-(e?h:0);a.lineTo(o,n);var p=l;e&&e>0&&a.arc(p,n,e-h,0,Math.PI/2-j,!1);var q=c+d-h;a.lineTo(b,q);i||a.lineTo(b,c+h);return[o,q]},ne:function(a,b,c,d,e,f,g){var h=this.oe(a,b,c,d,e,f);this.Ng(a,b,c,d,g,h)},Ng:function(a,b,c,d,e,f){if(this.g.yAxis){var g,
h=parseInt(f?f:c.x,10)-0.5,i=d.y+0.5,j=c.y;this.w(a,h,i,h,j,this.g.yAxis.color,1);for(var k=0;k<b.length;k++){var l=this.g.origin!="auto"&&this.g.type=="barH"&&parseFloat(this.g.value(b[k]))<this.g.origin;g=j+e/2+k*e;this.renderTextAt("middle",l?!1:"left",l?h+5:h-5,g,this.g.yAxis.template(b[k]),"dhx_axis_item_y",l?0:h-10);this.g.yAxis.lines.call(this,b[k])&&this.w(a,c.x,g,d.x,g,this.g.yAxis.lineColor.call(this,b[k]),1)}this.w(a,c.x+0.5,j+0.5,d.x,j+0.5,this.g.yAxis.lineColor.call(this,{}),1);this.Cf(c,
d)}},oe:function(a,b,c,d,e,f){var g,h={},i=this.g.xAxis;if(i){var j=d.y+0.5,k=c.x-0.5,l=d.x-0.5,m=c.x;this.w(a,k,j,l,j,i.color,1);i.step&&(g=parseFloat(i.step));if(typeof this.g.configXAxis.step=="undefined"||typeof this.g.configXAxis.start=="undefined"||typeof this.g.configXAxis.end=="undefined")h=this.Nc(e,f),e=h.start,f=h.end,g=h.step,this.g.xAxis.end=f,this.g.xAxis.start=e,this.g.xAxis.step=g;if(g!==0){for(var n=(l-k)*g/(f-e),o=0,p=e;p<=f;p+=g){h.fixNum&&(p=parseFloat((new Number(p)).toFixed(h.fixNum)));
var q=Math.floor(k+o*n)+0.5;!(p==e&&this.g.origin=="auto")&&i.lines&&this.w(a,q,j,q,c.y,this.g.xAxis.lineColor.call(this,p),1);p==this.g.origin&&(m=q+1);this.renderTextAt(!1,!0,q,j+2,i.template(p.toString()),"dhx_axis_item_x");o++}this.renderTextAt(!0,!1,k,d.y+this.g.padding.bottom-3,this.g.xAxis.title,"dhx_axis_title_x",d.x-c.x);i.lines||this.w(a,k,c.y-0.5,l,c.y-0.5,this.g.xAxis.color,0.2);return m}}},Qc:function(a,b,c,d,e,f,g){var h=this.g.yAxis,i=b;h&&this.g.origin!="auto"&&this.g.origin>g&&(b+=
(this.g.origin-g)*e,i=b,d-=this.g.origin-g,d<0&&(d*=-1,a.translate(b,c+f),a.rotate(Math.PI),b=0.5,c=0),b+=0.5);return{value:d,x0:b,y0:c,start:i}},Lg:function(a,b,c,d,e,f,g,h,i,j,k,l){a.save();var m=this.Qc(a,c,d,i,h,e,f);a.fillStyle=j;a.beginPath();var n=this.Ib(a,m.x0,m.y0,e,g,h,m.value,this.g.border?1:0);k&&!l&&a.lineTo(b.x+total_width,m.y0+(this.g.border?1:0));a.fill();a.restore();var o=m.y0,p=m.y0!=d?d:n[1],q=m.y0!=d?m.start-n[0]:m.start,s=m.y0!=d?m.start:n[0];return[q,o,s,p]},me:function(a,b,
c,d,e,f,g,h,i){a.save();var j=this.Qc(a,b,c,h,g,d,e);a.beginPath();this.Gd(a,i);a.globalAlpha=0.9;this.Ib(a,j.x0,j.y0,d,f,g,j.value,a.lineWidth/2,1);a.stroke();a.restore()},Mg:function(a,b,c,d,e,f,g,h,i,j){a.save();var k=this.Qc(a,b,c,h,g,d,e),l=this.Fc(a,k.x0,k.y0+d,k.x0+g*k.value,k.y0,j,i,"x");a.fillStyle=l.gradient;a.beginPath();var m=this.Ib(a,k.x0,k.y0+l.offset,d-l.offset*2,f,g,k.value,l.offset);a.fill();a.globalAlpha=1;a.restore()}});
dhx.extend(dhx.ui.chart,{$render_stackedBar:function(a,b,c,d,e,f){var g,h,i,j,k=d.y-c.y,l=!!this.g.yAxis,m=!!this.g.xAxis,n=this.cd(b);g=n.max;h=n.min;var o=Math.floor((d.x-c.x)/b.length);e||this.Xc(a,b,c,d,h,g,o);l&&(g=parseFloat(this.g.yAxis.end),h=parseFloat(this.g.yAxis.start));var p=this.Ga(h,g);j=p[0];i=p[1];var q=j?k/j:10,s=parseInt(this.g.barWidth,10);if(s+(this.g.barOffset||4)>o)s=o-(this.g.barOffset||4);var r=Math.floor((o-s)/2),z=this.g.gradient?this.g.gradient:!1;m||this.w(a,c.x,d.y+0.5,
d.x,d.y+0.5,"#000000",1);for(var w=0;w<b.length;w++){var y=parseFloat(this.g.value(b[w]||0));if(y){e||(y-=h);y*=i;var t=c.x+r+w*o,x=d.y;e?x=b[w].$startY:b[w].$startY=x;if(!(x<c.y+1))if(y<0||this.g.yAxis&&y===0)this.renderTextAt(!0,!0,t+Math.floor(s/2),x,this.g.label(b[w]));else{var v=this.g.color.call(this,b[w]);a.globalAlpha=this.g.alpha.call(this,b[w]);a.fillStyle=this.g.color.call(this,b[w]);a.beginPath();var u=this.Jd(a,t-(this.g.border?0.5:0),x,s+(this.g.border?0.5:0),q,y,0,c.y);a.fill();if(z){a.save();
var A=this.Fc(a,t,x,t+s,u[1],z,v,"y");a.fillStyle=A.gradient;a.beginPath();u=this.Jd(a,t+A.offset,x,s-A.offset*2,q,y,this.g.border?1:0,c.y);a.fill();a.restore()}this.g.border&&(a.save(),this.Gd(a,v),a.beginPath(),this.Jd(a,t-0.5,x,s+1,q,y,0,c.y,1),a.stroke(),a.restore());a.globalAlpha=1;this.renderTextAt(!1,!0,t+Math.floor(s/2),u[1]+(x-u[1])/2-7,this.g.label(b[w]));f.addRect(b[w].id,[t,u[1],u[0],b[w].$startY||x],e);b[w].$startY=this.g.border?u[1]+1:u[1]}}else if(!b[w].$startY)b[w].$startY=d.y}},Jd:function(a,
b,c,d,e,f,g,h,i){a.moveTo(b,c);var j=c-e*f+g;j<h&&(j=h);a.lineTo(b,j);var k=b+d,l=j;a.lineTo(k,l);var m=b+d;a.lineTo(m,c);i||a.lineTo(b,c);return[m,l-2*g]}});
dhx.extend(dhx.ui.chart,{$render_stackedBarH:function(a,b,c,d,e,f){var g,h,i,j,k=d.x-c.x,l=!!this.g.yAxis,m=this.cd(b);g=m.max;h=m.min;var n=Math.floor((d.y-c.y)/b.length);e||this.ne(a,b,c,d,h,g,n);l&&(g=parseFloat(this.g.xAxis.end),h=parseFloat(this.g.xAxis.start));var o=this.Ga(h,g);j=o[0];i=o[1];var p=j?k/j:10;if(!l)var q=10,p=j?(k-q)/j:10;var s=parseInt(this.g.barWidth,10);s+4>n&&(s=n-4);var r=Math.floor((n-s)/2),z=0,w=!1,y=this.g.gradient;y&&(w=!0);l||this.w(a,c.x-0.5,c.y,c.x-0.5,d.y,"#000000",
1);for(var t=0;t<b.length;t++){if(!e)b[t].$startX=c.x;var x=parseFloat(this.g.value(b[t]||0));x>g&&(x=g);x-=h;x*=i;var v=c.x,u=c.y+r+t*n;e?v=b[t].$startX:b[t].$startX=v;if(x<0||this.g.yAxis&&x===0)this.renderTextAt("middle",!0,v+10,u+s/2,this.g.label(b[t]));else{l||(x+=q/p);var A=this.g.color.call(this,b[t]);a.globalAlpha=this.g.alpha.call(this,b[t]);a.fillStyle=this.g.color.call(this,b[t]);a.beginPath();var B=this.Ib(a,v,u,s,z,p,x,this.g.border?1:0);y&&!w&&a.lineTo(c.x+k,u+(this.g.border?1:0));a.fill();
if(w!=!1){var C=this.Fc(a,v,u+s,v,u,w,A,"x");a.fillStyle=C.gradient;a.beginPath();B=this.Ib(a,v,u,s,z,p,x,0);a.fill()}this.g.border&&this.me(a,v,u,s,h,z,p,x,A);a.globalAlpha=1;this.renderTextAt("middle",!0,b[t].$startX+(B[0]-b[t].$startX)/2-1,u+(B[1]-u)/2,this.g.label(b[t]));f.addRect(b[t].id,[b[t].$startX,u,B[0],B[1]],e);b[t].$startX=B[0]}}}});
dhx.extend(dhx.ui.chart,{$render_spline:function(a,b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,s,r,z,w;l=this.Yb(a,b,c,d,e);h=this.g;j=[];if(b.length){p=h.offset?c.x+l.cellWidth*0.5:c.x;for(i=0;i<b.length;i++)o=i==b.length-1&&!h.offset?d.x:!i?p:Math.floor(l.cellWidth*i)-0.5+p,r=this.Ha(b[i],c,d,l),j.push({x:o,y:r});n=this.ih(j);for(i=0;i<j.length;i++){q=j[i].x;z=j[i].y;if(i<j.length-1){s=j[i+1].x;w=j[i+1].y;for(k=q;k<s;k++)this.w(a,k,this.bd(k,q,i,n.a,n.b,n.c,n.d),k+1,this.bd(k+1,q,i,n.a,n.b,n.c,n.d),h.line.color(b[i]),
h.line.width);this.w(a,s-1,this.bd(k,q,i,n.a,n.b,n.c,n.d),s,w,h.line.color(b[i]),h.line.width)}this.gc(a,q,z,b[i],h.label(b[i]));m=parseInt(h.item.radius.call(this,b[i-1]),10)||2;g=h.eventRadius||m+1;f.addRect(b[i].id,[q-g,z-g,q+g,z+g],e)}}},ih:function(a){var b,c,d,e,f,g,h,i,j,k;b=[];m=[];k=a.length;for(c=0;c<k-1;c++)b[c]=a[c+1].x-a[c].x,m[c]=(a[c+1].y-a[c].y)/b[c];d=[];e=[];d[0]=0;d[1]=2*(b[0]+b[1]);e[0]=0;e[1]=6*(m[1]-m[0]);for(c=2;c<k-1;c++)d[c]=2*(b[c-1]+b[c])-b[c-1]*b[c-1]/d[c-1],e[c]=6*(m[c]-
m[c-1])-b[c-1]*e[c-1]/d[c-1];f=[];f[k-1]=f[0]=0;for(c=k-2;c>=1;c--)f[c]=(e[c]-b[c]*f[c+1])/d[c];g=[];h=[];i=[];j=[];for(c=0;c<k-1;c++)g[c]=a[c].y,h[c]=-b[c]*f[c+1]/6-b[c]*f[c]/3+(a[c+1].y-a[c].y)/b[c],i[c]=f[c]/2,j[c]=(f[c+1]-f[c])/(6*b[c]);return{a:g,b:h,c:i,d:j}},bd:function(a,b,c,d,e,f,g){return d[c]+(a-b)*(e[c]+(a-b)*(f[c]+(a-b)*g[c]))}});
dhx.extend(dhx.ui.chart,{$render_area:function(a,b,c,d,e,f){var g=this.Yb(a,b,c,d,e),h=this.g.eventRadius||Math.floor(g.cellWidth/2);if(b.length){a.globalAlpha=this.g.alpha.call(this,b[0]);a.fillStyle=this.g.color.call(this,b[0]);var i=this.Ha(b[0],c,d,g),j=this.g.offset?c.x+g.cellWidth*0.5:c.x;a.beginPath();a.moveTo(j,d.y);a.lineTo(j,i);f.addRect(b[0].id,[j-h,i-h,j+h,i+h],e);this.g.yAxis||this.renderTextAt(!1,!this.g.offset?!1:!0,j,i-this.g.labelOffset,this.g.label(b[0]));for(var k=1;k<b.length;k++){var l=
k==b.length-1?d.x:Math.floor(g.cellWidth*k)-0.5+j,m=this.Ha(b[k],c,d,g);a.lineTo(l,m);f.addRect(b[k].id,[l-h,m-h,l+h,m+h],e);this.g.yAxis||this.renderTextAt(!1,!this.g.offset&&k==b.length-1?"left":"center",l,m-this.g.labelOffset,this.g.label(b[k]))}a.lineTo(l,d.y);a.lineTo(j,d.y);a.fill()}},$render_stackedArea:function(a,b,c,d,e,f){var g=this.Yb(a,b,c,d,e),h=this.g.eventRadius||Math.floor(g.cellWidth/2),i=[],j;if(b.length){a.globalAlpha=this.g.alpha.call(this,b[0]);a.fillStyle=this.g.color.call(this,
b[0]);var k=e?b[0].$startY:d.y,l=this.g.offset?c.x+g.cellWidth*0.5:c.x,m=this.Ha(b[0],c,d,g)-(e?d.y-k:0);i[0]=m;a.beginPath();a.moveTo(l,k);a.lineTo(l,m);f.addRect(b[0].id,[l-h,m-h,l+h,m+h],e);this.g.yAxis||this.renderTextAt(!1,!0,l,m-this.g.labelOffset,this.g.label(b[0]));for(var n=1;n<b.length;n++){j=n==b.length-1?d.x:Math.floor(g.cellWidth*n)-0.5+l;var o=this.Ha(b[n],c,d,g)-(e?d.y-b[n].$startY:0);i[n]=o;a.lineTo(j,o);f.addRect(b[n].id,[j-h,o-h,j+h,o+h],e);this.g.yAxis||this.renderTextAt(!1,!0,
j,o-this.g.labelOffset,this.g.label(b[n]))}a.lineTo(j,k);if(e)for(n=b.length-1;n>=0;n--){j=n==b.length-1?d.x:Math.floor(g.cellWidth*n)-0.5+l;var p=b[n].$startY;a.lineTo(j,p)}else a.lineTo(l+Math.floor(g.cellWidth*(length-1))-0.5,k);a.lineTo(l,k);a.fill();for(n=0;n<b.length;n++)b[n].$startY=i[n]}}});
dhx.extend(dhx.ui.chart,{$render_radar:function(a,b,c,d,e,f){this.xi(a,b,c,d,e,f)},xi:function(a,b,c,d,e,f){if(b.length){for(var g=this.ad(c,d),h=this.g.radius?this.g.radius:g.radius,i=this.g.x?this.g.x:g.x,j=this.g.y?this.g.y:g.y,k=[],l=0;l<b.length;l++)k.push(1);var m=this.Ae(k,b.length);e||this.Qg(a,m,i,j,h,b);this.Rg(a,m,i,j,h,b,e,f)}},Rg:function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o,p,q,s,r,z,w,y,t,x,v,u,A,B;l=this.g;n=l.yAxis.start;o=l.yAxis.end;B=this.Ga(n,o);A=(w=B[0])?e/w:e/2;u=B[1];i=j=y=
-Math.PI/2;s=[];for(m=0;m<f.length;m++)v?x=v:(t=l.value(f[m]),x=v||(parseFloat(t||0)-n)*u),r=Math.floor(A*x),t=l.value(m!=f.length-1?f[m+1]:f[0]),v=(parseFloat(t||0)-n)*u,z=Math.floor(A*v),i=j,j=m!=f.length-1?y+b[m]-1.0E-4:y,p=q||this.Fa(i,c,d,r),q=this.Fa(j,c,d,z),k=l.eventRadius||parseInt(l.item.radius.call(this,f[m]),10)+l.item.borderWidth,h.addRect(f[m].id,[p.x-k,p.y-k,p.x+k,p.y+k],g),s.push(p);l.fill&&this.Zg(a,s,f);l.disableLines||this.fj(a,s,f);l.disableItems||this.Sg(a,s,f);s=null},Sg:function(a,
b,c){for(var d=0;d<b.length;d++)this.gc(a,b[d].x,b[d].y,c[d])},Zg:function(a,b,c){var d,e;a.globalAlpha=this.g.alpha.call(this,{});a.beginPath();for(var f=0;f<b.length;f++)a.fillStyle=this.g.fill.call(this,c[f]),d=b[f],e=b[f+1]||b[0],f||a.moveTo(d.x,d.y),a.lineTo(e.x,e.y);a.fill();a.globalAlpha=1},fj:function(a,b,c){for(var d,e,f=0;f<b.length;f++)d=b[f],e=b[f+1]||b[0],this.w(a,d.x,d.y,e.x,e.y,this.g.line.color.call(this,c[f]),this.g.line.width)},Qg:function(a,b,c,d,e,f){var g=this.g.yAxis,h=this.g.xAxis,
i=g.start,j=g.end,k=g.step,l={},m=this.g.configYAxis;if(typeof m.step=="undefined"||typeof m.start=="undefined"||typeof m.end=="undefined"){var n=this.Sa(),l=this.Nc(n.min,n.max),i=l.start,j=l.end,k=l.step;g.end=j;g.start=i}var o=[],p,q,s,r=0,z=e*k/(j-i),w,y;k<1&&(w=Math.min(this.Za(k),i<=0?0:this.Za(i)),y=Math.pow(10,-w));var t=[];for(p=j;p>=i;p-=k){l.fixNum&&(p=parseFloat((new Number(p)).toFixed(l.fixNum)));o.push(Math.floor(r*z)+0.5);y&&(p=Math.round(p*y)/y);var x=d-e+o[o.length-1];this.renderTextAt("middle",
"left",c,x,g.template(p.toString()),"dhx_axis_item_y dhx_radar");if(b.length<2){this.qe(a,"arc",c,d,e-o[o.length-1],-Math.PI/2,3*Math.PI/2,p);return}var v=-Math.PI/2,u=v,A;for(q=0;q<b.length;q++)p==j&&t.push(u),A=v+b[q]-1.0E-4,this.qe(a,m.lineShape||"line",c,d,e-o[o.length-1],u,A,p,q,f[p]),u=A;r++}for(p=0;p<t.length;p++)s=this.Fa(t[p],c,d,e),this.w(a,c,d,s.x,s.y,h?h.lineColor.call(this,f[p]):"#cfcfcf",h&&h.lineWidth?h.lineWidth.call(this,f[p]):1),this.Tg(a,c,d,e,t[p],h?h.template.call(this,f[p]):
"&nbsp;")},qe:function(a,b,c,d,e,f,g,h,i){var j,k;if(e<0)return!1;j=this.Fa(f,c,d,e);k=this.Fa(g,c,d,e);var l=this.g.yAxis;if(l.bg)a.beginPath(),a.moveTo(c,d),b=="arc"?a.arc(c,d,e,f,g,!1):(a.lineTo(j.x,j.y),a.lineTo(k.x,k.y)),a.fillStyle=l.bg(h,i),a.moveTo(c,d),a.fill(),a.closePath();if(l.lines(h,i))a.lineWidth=1,a.beginPath(),b=="arc"?a.arc(c,d,e,f,g,!1):(a.moveTo(j.x,j.y),a.lineTo(k.x,k.y)),a.strokeStyle=l.lineColor(h,i),a.stroke()},Tg:function(a,b,c,d,e,f){var g=this.renderText(0,0,f,"dhx_axis_radar_title"),
h=g.offsetWidth,i=g.offsetHeight,j=0.0010,k=this.Fa(e,b,c,d+5),l=0,m=0;if(e<0||e>Math.PI)m=-i;e>Math.PI/2&&(l=-h);if(Math.abs(e+Math.PI/2)<j||Math.abs(e-Math.PI/2)<j)l=-h/2;else if(Math.abs(e)<j||Math.abs(e-Math.PI)<j)m=-i/2;g.style.top=k.y+m+"px";g.style.left=k.x+l+"px";g.style.width=h+"px";g.style.whiteSpace="nowrap"}});
dhx.extend(dhx.ui.chart,{$render_scatter:function(a,b,c,d,e,f){if(!this.g.xValue)return null;var g=this.Sa(),h=this.Sa("h","xValue");e||(this.ue(a,b,c,d,g.min,g.max),this.oe(a,b,c,d,h.min,h.max));for(var g={min:this.g.yAxis.start,max:this.g.yAxis.end},h={min:this.g.xAxis.start,max:this.g.xAxis.end},i=this.hh(a,b,c,d,h,g),j=0;j<b.length;j++)this.Ug(a,f,c,d,i,h,g,b[j],e)},hh:function(a,b,c,d,e,f){var g={};g.totalHeight=d.y-c.y;g.totalWidth=d.x-c.x;this.$d(g,e.min,e.max,g.totalWidth,"X");this.$d(g,f.min,
f.max,g.totalHeight,"Y");return g},Ug:function(a,b,c,d,e,f,g,h,i){var j=this.ae(e,d,c,f,h,"X"),k=this.ae(e,c,d,g,h,"Y");this.gc(a,j,k,h,1);var l=this.g,m=l.eventRadius||Math.floor(l.item.radius+1);b.addRect(h.id,[j-m,k-m,j+m,k+m],i)},ae:function(a,b,c,d,e,f){var g=this.g[f=="X"?"xValue":"value"].call(this,e),h=a["valueFactor"+f],i=(parseFloat(g||0)-d.min)*h,j=a["unit"+f],k=c[f.toLowerCase()]-(f=="X"?-1:1)*Math.floor(j*i);i<0&&(k=c[f.toLowerCase()]);g>d.max&&(k=b[f.toLowerCase()]);g<d.min&&(k=c[f.toLowerCase()]);
return k},$d:function(a,b,c,d,e){var f=this.Ga(b,c),e=e||"";a["relValue"+e]=f[0];a["valueFactor"+e]=f[1];a["unit"+e]=a["relValue"+e]?d/a["relValue"+e]:10}});
dhx.extend(dhx.ui.chart,{presets:{simple:{item:{borderColor:"#ffffff",color:"#2b7100",shadow:!1,borderWidth:2},line:{color:"#8ecf03",width:2}},plot:{color:"#1293f8",item:{borderColor:"#636363",borderWidth:1,color:"#ffffff",type:"r",shadow:!1},line:{color:"#1293f8",width:2}},diamond:{color:"#b64040",item:{borderColor:"#b64040",color:"#b64040",type:"d",radius:3,shadow:!0},line:{color:"#ff9000",width:2}},point:{color:"#fe5916",disableLines:!0,fill:!1,disableItems:!1,item:{color:"#feb916",borderColor:"#fe5916",
radius:2,borderWidth:1,type:"r"},alpha:1},line:{line:{color:"#3399ff",width:2},item:{color:"#ffffff",borderColor:"#3399ff",radius:2,borderWidth:2,type:"d"},fill:!1,disableItems:!1,disableLines:!1,alpha:1},area:{fill:"#3399ff",line:{color:"#3399ff",width:1},disableItems:!0,alpha:0.2,disableLines:!1},round:{item:{radius:3,borderColor:"#3f83ff",borderWidth:1,color:"#3f83ff",type:"r",shadow:!1,alpha:0.6}},square:{item:{radius:3,borderColor:"#447900",borderWidth:2,color:"#69ba00",type:"s",shadow:!1,alpha:1}},
column:{color:"RAINBOW",gradient:!1,barWidth:45,radius:0,alpha:1,border:!0},stick:{barWidth:5,gradient:!1,color:"#67b5c9",radius:2,alpha:1,border:!1},alpha:{color:"#b9a8f9",barWidth:70,gradient:"falling",radius:0,alpha:0.5,border:!0}}});
dhx.protoUI({name:"slider",defaults:{min:0,max:100,step:1,labelWidth:80,template:function(a,b){var c="<div class='dhx_slider_label' style='width:"+(a.labelWidth-20)+"px'>"+a.label+"</div>";c+="<div class='dhx_el_slider'   onclick=''>";c+="<div class='dhx_slider_title'></div>";c+="<div class='dhx_slider_bar'></div>";c+="<div class='dhx_slider_bar_empty'></div>";if(a.options&&!b.g.stepless)for(var d=0;d<a.options.length;d++)c+="<div class='dhx_slider_line'></div>";c+="<div class='dhx_slider_handle'><div class='dhx_slider_inside_handle'></div></div>";
c+="</div>";return c}},W:function(){var a=(this.g.inputWidth||this.m-this.z)-this.g.labelWidth,b=this.i.childNodes[1];b.style.width=a+"px";this.Vb=a-this.z;b.childNodes[1].style.width=this.Vb+"px";if(!this.g.options){var c=[];this.g.stepless=!0;for(var d=this.g.min;d<=this.g.max;d+=this.g.step)c.push({value:d,label:""});this.define("options",c)}var e=this.g.options;this.Kd=(this.Vb-20)/(e.length>1?e.length-1:1);this.Ue={};this.Qe={};for(d=0;d<e.length;d++){if(!this.g.stepless)b.childNodes[d+3].style.left=
14+this.Kd*d+"px";this.Ue[e[d].value]=5+this.Kd*d;this.Qe[e[d].value]=e[d].label}typeof this.g.value!="undefined"?this.I(this.g.value):this.I(e[0].value)},I:function(a){var b=this.Ue[a]||0;this.vd(b);this.aj=b},getValue:function(){return this.g.value},vd:function(a){var b=this.Te(a);if(b!==null){this.ld=b;var c=this.i.childNodes[1];c.childNodes[0].innerHTML=this.Qe[b];c.lastChild.style.left=a+"px";c.childNodes[2].style.left=a+"px";c.childNodes[2].style.width=this.Vb-a+7+"px"}},Te:function(a){if(a<
0||a>this.Vb)return null;var b=Math.round(a/this.Kd),b=Math.min(b,this.g.options.length-1);return this.g.options[b].value},$init:function(){this.attachEvent("onTouchStart",this.di);this.attachEvent("onTouchMove",this.ci);this.attachEvent("onTouchEnd",this.kf);this.attachEvent("onItemClick",function(a,b){if(!this.Se||new Date-this.Se>250){var c=dhx.html.pos(b),d=dhx.html.offset(this.i.childNodes[1]),e=c.x-d.x-10;if(e>0)this.Gc=!0,this.vd(e),this.kf()}})},di:function(a){this.Gc=a.target.className==
"dhx_slider_handle"||a.target.className=="dhx_slider_inside_handle"},ci:function(a,b){if(this.Gc){var c,d;c=this.aj-(a.x-b.x);this.vd(c);d=this.Te(c);this.callEvent("onSlideStep",[this.ld])}},kf:function(){if(this.Gc&&(this.Gc=null,this.Se=new Date,this.setValue(this.ld),this.g.slide)){var a=dhx.toFunctor(this.g.slide);a&&a.call&&a.call(this,this.g.id,this.ld)}},setSliderTitle:function(a){this.i.childNodes[1].childNodes[0].innerHTML=a}},dhx.ui.button);
dhx.protoUI({name:"resizearea",defaults:{dir:"x"},$init:function(a){var b=a.dir||"x",c=dhx.toNode(a.container),d=b=="x"?"width":"height";this.qc=b=="x"?"left":"top";this.h=dhx.html.create("DIV",{"class":"dhx_resize_area dhx_dir_"+b});this.va=dhx.html.create("DIV",{"class":"dhx_resize_handle_"+b});this.bb=dhx.html.create("DIV",{"class":"dhx_resize_origin_"+b});a[d]&&(this.bb.style[d]=a[d]+(a.border?1:0)+"px",this.va.style[d]=a[d]+"px");this.Sh=dhx.event(c,"mousemove",this.fi,this);this.qj=dhx.event(document.body,
"mouseup",this.gi,this);this.va.style[this.qc]=this.bb.style[this.qc]=a.start+"px";this.bb.style[this.qc]=a.start+"px";c.appendChild(this.h);c.appendChild(this.va);c.appendChild(this.bb)},gi:function(){this.callEvent("onResizeEnd",[this.sc]);dhx.eventRemove(this.Sh);dhx.eventRemove(this.qj);dhx.html.remove(this.h);dhx.html.remove(this.va);dhx.html.remove(this.bb);this.g.initEvent=this.h=this.va=this.bb=null},fi:function(a){var b=a.pageX,c=a.pageY;this.sc=(this.g.dir=="x"?b:c)+this.g.start-this.g.eventPos;
this.va.style[this.qc]=this.sc+"px";this.callEvent("onResize",[this.sc])}},dhx.EventSystem,dhx.Settings);
dhx.protoUI({name:"resizer",$init:function(){this.$ready.push(this.Si)},Si:function(){if(this.getParent()){var a=this.gh();this.Cd=!1;dhx.event(this.h,"mousedown",this.Fi,this);dhx.event(document.body,"mouseup",this.wf,this);this.Ei=a;this.za=a=="x"?"width":"height";this.g[this.za]<1&&this.define(this.za,5);this.h.className+=" dhx_resizer_"+a;this.h.innerHTML="<div class='dhx_resizer_content'></div>"}},Fi:function(a){a=a||event;this.Cd=!0;this.xf={x:a.pageX,y:a.pageY};this.oa=[];if(!this.jc()[0])return this.wf();
this.Ji(a)},wf:function(){this.xf=this.Cd=!1},Ji:function(a){var b,c,d,e,f,g,a=a||event;c=this.Ei;b=this.jc()[0];this.getParent().h.style.position="relative";e=dhx.html.offset(this.h);f=dhx.html.offset(this.getParent().h);g=e[c]-f[c];d=dhx.html.offset(b.$view)[c]-dhx.html.offset(this.getParent().$view)[c];this.pa=[c,b,g,d];this.Fb=new dhx.ui.resizearea({container:this.getParent().h,dir:c,eventPos:this.xf[c],start:g,height:this.$height,width:this.$width,border:1});this.Fb.attachEvent("onResizeEnd",
dhx.bind(this.Gi,this));this.Fb.attachEvent("onResize",dhx.bind(this.Ii,this))},gh:function(){return this.getParent().p?"y":"x"},Ii:function(){var a,b,c,d,e,f,g,h,i,j;if(this.pa){a=this.jc();e=this.pa[0];d=this.Fb.sc-this.pa[2];i=this.uf(a,e,d);j=a[0]["$"+this.za]+a[1]["$"+this.za];g=e=="y"?["minHeight","maxHeight"]:["minWidth","maxWidth"];for(f=0;f<2;f++)b=a[f].g,c=f?-d:d,c>0&&b[g[1]]&&b[g[1]]<=i[f]||c<0&&b[g[0]]&&b[g[0]]>=i[f]?(this.oa[f]=c>0?b[g[1]]:b[g[0]],h=this.vf(a,e),this.Fb.va.style[e=="y"?
"top":"left"]=this.pa[3]+h[0]+"px"):i[f]<2?this.Fb.va.style[e=="y"?"top":"left"]=this.pa[3]+f*j+1+"px":this.oa[f]=null}},jc:function(){var a,b;a=this.getParent().j;for(b=0;b<a.length;b++)if(a[b]==this)return[a[b-1],a[b+1]]},Gi:function(a){var b,c,d,e,f;this.Cj=null;if(this.pa){c=this.pa[0];d=a-this.pa[2];b=this.jc();if(b[0]&&b[1]){f=this.Hi(b,c,d);for(e=0;e<2;e++)this.ri(b[e],f[e])}this.pa=!1}this.Cd=!1;this.oa=null},ri:function(a,b){a.define(this.za,b);a.resize()},vf:function(a){var b,c,d;d=a[0]["$"+
this.za]+a[1]["$"+this.za];this.oa[0]?(b=this.oa[0],c=d-b):this.oa[1]&&(c=this.oa[1],b=d-c);return[b,c]},uf:function(a,b,c){for(var d=[],e=0;e<2;e++)d[e]=a[e]["$"+this.za]+(e?-1:1)*c;return d},Hi:function(a,b,c){var d,e,f;if(this.oa[0]||this.oa[1])e=this.vf(a,b);else{e=this.uf(a,b,c);for(d=0;d<2;d++)e[d]<0&&(f=e[0]+e[1],e[d]=1,e[1-d]=f-1)}return e}},dhx.MouseEvents,dhx.ui.view);window.dhx||(dhx={});if(!dhx.storage)dhx.storage={};
dhx.storage.local={put:function(a,b){a&&window.JSON&&window.localStorage&&window.localStorage.setItem(a,window.JSON.stringify(b))},get:function(a){if(a&&window.JSON&&window.localStorage){var b=window.localStorage.getItem(a);return!b?null:dhx.DataDriver.json.toObject(b)}else return null},remove:function(a){a&&window.JSON&&window.localStorage&&window.localStorage.remove(a)}};
dhx.storage.session={put:function(a,b){a&&window.JSON&&window.sessionStorage&&window.sessionStorage.setItem(a,window.JSON.stringify(b))},get:function(a){if(a&&window.JSON&&window.sessionStorage){var b=window.sessionStorage.getItem(a);return!b?null:dhx.DataDriver.json.toObject(b)}else return null},remove:function(a){a&&window.JSON&&window.sessionStorage&&window.sessionStorage.remove(a)}};
dhx.storage.cookie={put:function(a,b,c,d){if(a&&window.JSON)document.cookie=a+"="+window.JSON.stringify(b)+(d&&d instanceof Date?";expires="+d.toUTCString():"")+(c?";domain="+c:"")},De:function(a){for(var b=document.cookie.split(";"),c="",d="",e="",f=!1,g=0;g<b.length;g++){c=b[g].split("=");d=c[0].replace(/^\s+|\s+$/g,"");if(d==a)return f=!0,c.length>1&&(e=unescape(c[1].replace(/^\s+|\s+$/g,""))),e;c=null;d=""}return null},get:function(a){if(a&&window.JSON){var b=this.De(a);return!b?null:dhx.DataDriver.json.toObject(b)}else return null},
remove:function(a,b){if(a&&this.De(a))document.cookie=a+"="+(b?";domain="+b:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"}};
dhx.proxy=dhx.proto({$init:function(a){typeof a==="string"&&(a={url:a,storage:dhx.storage.local});this.g=a;this.name="DataProxy";this.$proxy=!0;this.$progress=!1;this.$ready.push(this.ea);this.Qa=[]},ea:function(){this.Db();return!0},load:function(a,b){var c=a;c&&(a=c);if(this.Db())this.Qa.push({dest:a,driver:b});else{var d=this;dhx.ajax(this.g.url,{error:function(c,f,g){d.restore(a,b,c,f,g)},success:function(c,f,g){d.callEvent("onProxySuccess",[c,f,g]);d.Mb({"load;data":c,"load;driver":b});a.parse(c,
b)}})}},restore:function(a,b,c,d,e){var c=c||"",d=d||null,e=e||null,f=this.wa("load;data");this.callEvent("onProxyError",[c,d,e,f]);f!==null&&a.parse(f,b)},Mb:function(a){var b=this.g.storage.get(this.g.url);b===null&&(b={});for(var c in a){for(var d=c,e=a[c],f=d.split(";"),g=b,h=0;h<f.length-1;h++)typeof g[f[h]]==="undefined"&&(g[f[h]]={}),g=g[f[h]];g[f[f.length-1]]=e}this.g.storage.put(this.g.url,b)},wa:function(a){var b=this.g.storage.get(this.g.url);if(b===null)return null;if(typeof a==="undefined")return b;
for(var c=a.split(";"),d=0;d<c.length-1;d++)if(typeof b[c[d]])b=b[c[d]];else return null;return b[c[c.length-1]]},Ed:function(a,b,c){var d=c.Ic(a),e=this.g.url;if(typeof e=="function")return e(d);e+=e.indexOf("?")==-1?"?":"&";e+="editing=true";var f=this;dhx.ajax()[b](e,d,{success:function(a,b,d){c.sd(a,b,d);f.Db()},error:function(d,e,i){f.Gh(a,c,b);c.sd(d,e,i);c.ka=[]}});this.pi(a)},Gh:function(a,b,c){var d=this.wa("dp");d||(d={post:[],get:[]});if(!d.post)d.post=[];if(!d.get)d.get=[];d[c]=this.Eh(d[c],
a);this.Mb({dp:d});for(var e=0;e<a.length;e++){var f=a[e];b.callEvent("onAddToProxy",[f.id,f])}},Eh:function(a,b){for(var c={},d=-1,e=0;e<a.length;e++)if(typeof a[e]=="object"){c=a[e];d=e;break}for(var f=c.ids||"",e=0;e<b.length;e++){var g=b[e],g=this.Ic([g]),h=g.ids;if(f.indexOf(g.ids)==-1)f+=(f===""?"":",")+h;else{var i=c[h+"_!nativeeditor_status"],j=g[h+"_!nativeeditor_status"],j=this.pj(i,j);g[h+"_!nativeeditor_status"]=j}for(var k in g)c[k]=g[k];if(g[h+"_!nativeeditor_status"]=="unset"){f=f.split(",");
for(k=0;k<f.length;)f[k]==h?f.splice(k,1):k++;f=f.join(",");c=this.vi(c,h)}}c.ids=f;this.Ch(c)?d>=0&&a.splice(d,1):d>=0?a[d]=c:a.push(c);return a},pj:function(a,b){switch(a){case "insert":if(b=="update")return"insert";if(b=="insert")return"insert";if(b=="delete")return"unset";case "update":break;case "delete":if(b=="update")return"update";if(b=="insert")return"update";if(b=="delete")return"delete"}return b},vi:function(a,b){var c=0,d;for(d in a)d.indexOf(b+"_")===0?delete a[d]:c++;return a},Ch:function(a){for(var b in a)if(b!==
"ids")return!1;return!0},pi:function(a){var b=this.wa("load;data"),c=this.wa("load;driver");if(c==="json"&&b!==null){try{b="dhx.temp = "+b,eval(b),b=dhx.temp}catch(d){}for(var e=!dhx.isUndefined(b.data)?b.data:b,f=0;f<a.length;f++){var g=this.sh(a[f].id,e),h=a[f],i;for(i in h.data)i.substr(0,1)=="$"&&delete h.data[i];if(a[f].operation=="insert"&&g!==null)a[f].operation="update";switch(a[f].operation){case "delete":g!==null&&e.splice(g,1);break;case "insert":e.push(a[f].data);break;default:if(g!==
null)e[g]=a[f].data}}b=window.JSON.stringify(b);this.Mb({"load;data":b})}},sh:function(a,b){for(var c=0;c<b.length;c++)if(b[c].id==a)return c;return null},Fh:function(a){var b=this.wa("dp");if(b){for(var c={},d=0;d<a.length;d++)c[a[d].id]=!0;for(d=0;d<b.length;d++)typeof c[b[d].id]==="undefined"&&(a.push(b[d]),c[b[d].id]=!0)}},get:function(a,b){this.Af(a,b,"get")},post:function(a,b){this.Af(a,b,"post")},Af:function(a,b,c){b&&typeof b=="function"&&(b={success:b,error:b});var d=this;dhx.ajax()[c](this.g.url,
a,{error:function(e,f,g){var h=d.wa();h===null&&(h={});typeof h[c]=="undefined"&&(h[c]=[]);h[c].push(a);d.Mb(h);b&&b.error(e,f,g)},success:function(a,c,g){b&&b.success(a,c,g);d.Db()}})},Db:function(){if(this.$progress)return!0;var a=this.wa(),b=(a=a&&a.dp?a.dp:{})&&a.get?a.get:[],c=this,d=b.length>0?"get":"post",a=typeof a[d]!=="undefined"?a[d]:[];if(typeof a[0]!=="undefined"){this.$progress=!0;var e=a=a[0];this[d](a,{success:function(a,b,e){var i=c.wa().dp[d];i.splice(0,1);var j={dp:{}};j.dp[d]=
i;c.Mb(j);c.callEvent("onRequestEnd",[a,b,e]);c.$progress=!1;i.length===0?c.We(!0):c.Db()},error:function(){c.$progress=!1;c.We(!1)}});return!0}return!1},We:function(a){for(var b=0;b<this.Qa.length;b++)a?this.load(this.Qa[b].dest,this.Qa[b].driver):this.restore(this.Qa[b].dest,this.Qa[b].driver)},Ic:function(a){var b={};if(this.g.single)this.Pb(a[0].data,b,"",a[0].operation);else{for(var c=[],d=0;d<a.length;d++){var e=a[d];c.push(e.id);this.Pb(e.data,b,e.id+"_",e.operation)}b.ids=c.join(",")}return b},
Pb:function(a,b,c,d){for(var e in a)e.indexOf("$")!==0&&(b[c+e]=a[e]);b[c+"!nativeeditor_status"]=d}},dhx.EventSystem);
dhx.history={Ca:!1,s:[],aa:{},xb:{},Dj:function(a,b){if(!window.history||!window.history.state||!window.history.state.active)return!1;var c=dhx.history.Kf(window.history.state.active);return c[0]===a&&c[1]===b?!0:!1},Kf:function(a){return!a||!a.split("___")?[]:a.split("___")},kd:function(a,b){return a+"___"+b},Mi:function(){var a=[],b;for(b in dhx.ui.views)dhx.ui.views[b].name=="multiview"&&a.push(b);return a},Ph:function(){for(var a in dhx.ui.views)this.Bh(dhx.ui.views[a])&&this.sj(dhx.ui.views[a])},
sj:function(a){this.s.push({view:a.config.id,event:a.attachEvent("onBeforeTabClick",function(a,c){dhx.history.Jb={tabbar:a,id:c};window.setTimeout(function(){delete dhx.history.Jb},100);return!0})})},Bh:function(a){return a.name=="tabbar"||a.on_click&&a.on_click.mc?!0:!1},jj:function(a,b){if(dhx.history.xb)for(var c in dhx.history.xb)if(dhx.history.xb[c]==a){var d=c;if(d&&$$(d)){var e=$$(d).g.multiview;$$(d).g.multiview=!1;for(c in $$(d).config.options)b==$$(d).config.options[c].value&&$$(d).I(b);
$$(d).g.multiview=e}}},Jh:function(a){if(a&&a.active){var b=dhx.history.Kf(a.active);$$(b[0]).dc=!0;$$(b[0]).show();delete $$(b[0]).dc;$$(b[1]).dc=!0;$$(b[1]).show();delete $$(b[1]).dc}},ig:function(){return!this.Ca?(this.Ca=dhx.event(window,"popstate",function(a){if(dhx.history.active())dhx.history.Jh(a.state);else return!0}),!0):!1},lh:function(a){var b=[];if(!a||a.length===0)b=this.Mi();else for(var c=0;c<a.length;c++)b.push(a[c]);return b},start:function(){this.Ca||this.oj(arguments);dhx.history.dg=
!0},stop:function(){dhx.history.dg=!1},active:function(){return!!dhx.history.dg},oj:function(a){if(!window.history)return!1;this.Ca||this.Ph();this.ig();for(var b=this.lh(a),c=0;c<b.length;c++)if((typeof b[c]=="string"||typeof b[c]=="number")&&$$(b[c]))this.s.push({view:b[c],event:$$(b[c]).attachEvent("onViewChange",function(a,b){if(dhx.history.Jb){var f=typeof dhx.history.Jb.tabbar=="string"?dhx.history.Jb.tabbar:dhx.history.Jb.tabbar.value;dhx.history.xb[f]=c}dhx.history.jj(c,b);if(!$$(b).dc&&!dhx.history.skip&&
dhx.history.active()){if(!dhx.history.Ke&&!dhx.history.aa[a]){var g=dhx.history.Ke=!0;window.history.pushState(!dhx.history.aa[a]?{active:dhx.history.kd(this.config.id,a)}:{},window.title+" "+this.config.id+"-"+a)}!dhx.history.aa[b]&&!dhx.history.aa[b]?window.history.pushState(!dhx.history.aa[b]?{active:dhx.history.kd(this.config.id,b)}:{},window.title+" "+this.config.id+"-"+b):!g&&!dhx.history.aa[a]&&window.history.pushState(!dhx.history.aa[a]?{active:dhx.history.kd(this.config.id,a)}:{},window.title+
" "+this.config.id+"-"+a)}delete dhx.history.skip})}),this.s.push({view:b[c],event:$$(b[c]).attachEvent("onBeforeBack",function(a,b){return dhx.history.active()?(dhx.history.skip=!0,window.history.go(-b),!1):!0})});return!0},ignore:function(){if(arguments&&arguments.length)for(var a=0;a<arguments.length;a++)this.aa[arguments[a]]=!0},unignore:function(a){a&&this.aa[a]&&delete this.aa[a]},reset:function(){if(!window.history)return!1;if(dhx.history.Ca)dhx.eventRemove(dhx.history.Ca),dhx.history.Ca=!1;
dhx.history.Ke=!1;for(var a=0;a<dhx.history.s.length;a++)$$(dhx.history.s[a].view).detachEvent(dhx.history.s[a].event);dhx.history.s=[];dhx.history.aa={};dhx.history.xb={};return!0}};dhx.env.$touch=!0;
dhx.protoUI({name:"dayevents",defaults:{hourFormat:"%H",hourClock:12,firstHour:0,lastHour:24,timeScaleWidth:45,timeScaleHeight:30,scroll:!0,scaleBorder:1,eventOffset:5,width:"auto",date:new Date},$init:function(a){this.name="DayEvents";this.i.style.position="relative";this.data.provideApi(this,!0);this.data.attachEvent("onStoreUpdated",dhx.bind(this.render,this));this.attachEvent("onBeforeRender",function(){this.yi();this.type.color=this.config.color;this.type.textColor=this.config.textColor;this.Ci=
this.i.firstChild;this.ni();if(window.scheduler&&scheduler.templates)this.type.template=scheduler.templates.day_event,this.type.templateCss=scheduler.templates.event_class});if(window.scheduler)a.hourFormat=scheduler.config.scale_hour,a.timeScaleWidth=scheduler.xy.scale_width,a.timeScaleHeight=scheduler.xy.scale_height*2},yi:function(){for(var a="<div></div>",b=this.config.firstHour;b<this.config.lastHour;b++)a+=this.hourScaleItem(b);this.i.innerHTML=a},G:"dhx_l_id",on_click:{},hourScaleItem:function(a){var b=
scheduler.config.hour_date.toLowerCase().indexOf("a")!=-1,c="00",d="30";b&&(a===0&&(c="AM"),a==12&&(c="PM"),a=(a+11)%12+1);this.config.hourFormat.indexOf("H")!=-1&&(a=dhx.math.toFixed(a));var e="",f=this.config.timeScaleWidth,g=this.config.timeScaleHeight,h=Math.floor(this.config.timeScaleWidth/2),i=Math.floor(g/2),j=i-this.config.scaleBorder,k=this.m-this.config.scaleBorder-this.config.timeScaleWidth;e+="<div style='width: 100%; height:"+g+"px;' class='dhx_dayevents_scale_item'>";e+="<div class='dhx_dayevents_scale_hour' style='width:"+
h+"px; height:"+g+"px;line-height:"+g+"px;'>"+a+"</div>";e+="<div class='dhx_dayevents_scale_minute'  style='width:"+h+"px'>";e+="<div class='dhx_dayevents_scale_top' style='width:"+h+"px;line-height:"+i+"px'>"+c+"</div>";e+="<div class='dhx_dayevents_scale_bottom' style='width:"+h+"px;line-height:"+j+"px'>"+d+"</div>";e+="</div>";e+="<div class='dhx_dayevents_scale_event'  style='width:"+k+"px'>";e+="<div class='dhx_dayevents_scale_top' style='height:"+i+"px;width:"+k+"px'></div>";e+="<div class='dhx_dayevents_scale_bottom' style='width: "+
k+"px;height:"+j+"px; '></div>";e+="</div>";e+="</div>";return e},type:{templateStart:dhx.Template("<div dhx_l_id='#id#' class='dhx_dayevents_event_item {common.templateCss()}' style='left:#$left#px;top:#$top#px;width:#$width#px;height:#$height#px;padding:{common.padding}px;overflow:hidden; background-color:{common.templateColor()} ;color:{common.templateTextColor()};'>"),template:"#text#",templateEnd:dhx.Template("</div>"),templateCss:dhx.Template(""),templateColor:dhx.Template("#color#"),templateTextColor:function(a){return a.fontColor?
a.fontColor:a.textColor?a.textColor:""},padding:2},ni:function(){var a=this.data.getRange(),b=[],c,d,e,f,g;for(d=0;d<a.length;d++){c=a[d];for(c.$inner=!1;b.length&&b[b.length-1].end_date.valueOf()<=c.start_date.valueOf();)b.splice(b.length-1,1);g=!1;for(e=0;e<b.length;e++)if(b[e].end_date.valueOf()<=c.start_date.valueOf()){g=!0;c.$sorder=b[e].$sorder;b.splice(e,1);c.$inner=!0;break}if(b.length)b[b.length-1].$inner=!0;if(!g)if(b.length)if(b.length<=b[b.length-1].$sorder){if(b[b.length-1].$sorder)for(e=
0;e<b.length;e++){g=!1;for(f=0;f<b.length;f++)if(b[f].$sorder==e){g=!0;break}if(!g){c.$sorder=e;break}}else c.$sorder=0;c.$inner=!0}else{g=b[0].$sorder;for(e=1;e<b.length;e++)if(b[e].$sorder>g)g=b[e].$sorder;c.$sorder=g+1;c.$inner=!1}else c.$sorder=0;b.push(c);if(b.length>(b.max_count||0))b.max_count=b.length}for(d=0;d<a.length;d++)a[d].$count=b.max_count,this.Id(a[d])},Id:function(a){var b=this.config.date.getValue?this.config.date.getValue():this.config.date,c=dhx.Date.copy(a.start_date),d=dhx.Date.copy(a.end_date),
e=c.getHours(),f=d.getHours();dhx.Date.datePart(c).valueOf()>dhx.Date.datePart(d).valueOf()&&(d=c);dhx.Date.datePart(c).valueOf()<dhx.Date.datePart(b).valueOf()&&(c=dhx.Date.datePart(b));dhx.Date.datePart(d).valueOf()>dhx.Date.datePart(b).valueOf()&&(d=dhx.Date.datePart(b),d.setMinutes(0),d.setHours(this.config.lastHour));if(e<this.config.firstHour||f>=this.config.lastHour)e<this.config.firstHour&&(c.setHours(this.config.firstHour),c.setMinutes(0)),f>=this.config.lastHour&&(d.setMinutes(0),d.setHours(this.config.lastHour));
var g=Math.floor((this.m-this.config.timeScaleWidth-this.config.eventOffset)/a.$count);a.$left=a.$sorder*g+this.config.timeScaleWidth+this.config.eventOffset;a.$inner||(g*=a.$count-a.$sorder);a.$width=g-this.config.eventOffset-this.type.padding*2;var h=c.getHours()*60+c.getMinutes(),i=d.getHours()*60+d.getMinutes()||this.config.lastHour*60;a.$top=Math.round((h-this.config.firstHour*60)*(this.config.timeScaleHeight+1)/60);a.$height=Math.max(10,(i-h)*(this.config.timeScaleHeight+1)/60-2)-this.type.padding*
2},$setSize:function(a,b){dhx.ui.view.prototype.$setSize.call(this,a,b)&&this.render()}},dhx.MouseEvents,dhx.SelectionModel,dhx.Scrollable,dhx.RenderStack,dhx.DataLoader,dhx.ui.view,dhx.EventSystem,dhx.Settings);if(!window.scheduler)window.scheduler={config:{},templates:{},xy:{},locale:{}};if(!scheduler.locale)scheduler.locale={};
scheduler.locale.labels={list_tab:"List",day_tab:"Day",month_tab:"Month",icon_today:"Today",icon_save:"Save",icon_done:"Done",icon_delete:"Delete event",icon_cancel:"Cancel",icon_edit:"Edit",icon_back:"Back",icon_close:"Close form",icon_yes:"Yes",icon_no:"No",confirm_closing:"Your changes will be lost, are your sure ?",confirm_deleting:"The event will be deleted permanently, are you sure?",label_event:"Event",label_start:"Start",label_end:"End",label_details:"Notes",label_from:"from",label_to:"to",
label_allday:"All day",label_time:"Time"};scheduler.config={init_date:new Date,form_date:"%d-%m-%Y %H:%i",form_all_day:"%d-%m-%Y",xml_date:"%Y-%m-%d %H:%i",item_date:"%d.%m.%Y",multi_day:"%l, %d %F %Y",header_date:"%d.%m.%Y",hour_date:"%H:%i",scale_hour:"%H",calendar_date:"%F %Y",form_rules:{end_date:function(a,b){return b.start_date.valueOf()<a.valueOf()}},views:[],tab_views:[],server_utc:!1};
scheduler.xy={confirm_height:231,confirm_width:250,scale_width:45,scale_height:15,list_tab:54,day_tab:54,month_tab:68,icon_today:72,icon_save:100,icon_done:100,icon_cancel:100,icon_edit:100,icon_back:100,list_height:42,month_list_height:42};
scheduler.templates={selected_event:function(a){var b="",c="",d="",e=a.start_date,f=a.end_date;if(!e)return b;b+="<div  class='selected_event "+scheduler.templates.event_class(a)+"' style='"+(a.color?"background-color:"+a.color+";":"")+(a.fontColor||a.textColor?"color:"+(a.fontColor||a.textColor):"")+"'>";b+="<div class='event_title'>"+a.text+"</div>";if(dhx.Date.datePart(e).valueOf()==dhx.Date.datePart(f).valueOf()){var g=dhx.i18n.dateFormatStr(e),c=dhx.i18n.timeFormatStr(e),d=dhx.i18n.timeFormatStr(f);
b+="<div class='event_text'>"+g+"</div>";b+="<div class='event_text'>"+scheduler.locale.labels.label_from+" "+c+" "+scheduler.locale.labels.label_to+" "+d+"</div>"}else{var h=dhx.i18n.longDateFormatStr(e),i=dhx.i18n.longDateFormatStr(f);dhx.Date.datePart(e).valueOf()==e.valueOf()&&dhx.Date.datePart(f).valueOf()==f.valueOf()||(c=dhx.i18n.timeFormatStr(e)+" ",d=dhx.i18n.timeFormatStr(f)+" ");b+="<div class='event_text'>"+scheduler.locale.labels.label_from+" "+c+h+"</div>";b+="<div class='event_text'>"+
scheduler.locale.labels.label_to+" "+d+i+"</div>"}a.details&&a.details!==""&&(b+="<div class='event_title'>"+scheduler.locale.labels.label_details+"</div>",b+="<div class='event_text'>"+a.details+"</div>");b+="</div>";return b},calendar_event:function(a){return a+"<div class='day_with_events'></div>"},event_date:function(a){if(a.start_date)a=a.start_date;return dhx.i18n.dateFormatStr(a)},event_time:function(a){var b=a.start_date,c=a.end_date;return dhx.Date.datePart(b).valueOf()==b.valueOf()&&dhx.Date.datePart(c).valueOf()==
c.valueOf()?scheduler.locale.labels.label_allday:dhx.i18n.timeFormatStr(b)},event_marker:function(a){return"<div class='dhx_event_marker' "+(a.color?"style='background-color:"+a.color+"'":"")+"></div>"},event_title:function(a,b){return"<div class='dhx_event_overall "+b.eventClass(a,b)+"'><div class='dhx_day_title'>"+b.dateStart(a.start_date)+"</div><div><div class='dhx_event_time'>"+b.timeStart(a)+"</div>"+b.marker(a,b)+"<div class='dhx_event_text' "+(a.textColor?"style='color:"+a.textColor:"")+"'>"+
a.text+"</div></div></div>"},month_event_title:function(a,b){return"<div class='"+b.eventClass(a,b)+"'>"+b.marker(a,b)+"<div class='dhx_event_time'>"+b.timeStart(a)+"</div><div class='dhx_event_text' "+(a.textColor?"style='color:"+a.textColor:"")+"'>"+a.text+"</div></div>"},day_event:function(a){return a.text},new_event_data:function(){var a=dhx.Date.add(new Date,1,"hour").getHours(),b=dhx.Date.copy(this.coreData.getValue());b.setHours(a);var c=dhx.Date.add(b,1,"hour");return{start_date:b,end_date:c}},
event_class:dhx.Template("")};
dhx.protoUI({name:"datetext",defaults:{iconWidth:25},Cb:function(a,b){var c=a.inputAlign||"left",d=a.labelAlign||"left",e=dhx.uid(),f="<label class='dhx_inp_label' style='width: "+this.g.labelWidth+"px; text-align: "+d+";' onclick='' for='"+e+"'>"+(a.label||"")+"</label>",g=this.g.inputWidth-this.g.labelWidth-40;g<0&&(g=0);f+="<div class='dhx_inp_"+b+"' onclick='' style='width: "+g+"px; text-align: "+c+";' >"+(a.text||a.value||"")+"</div>";f+="<div class='dhx_arrow_icon'></div>";return"<div class='dhx_el_box' style='position:relative'>"+
f+"</div>"},I:function(a){this.g.value=a||"";var b=this.g.dateFormatStr||dhx.i18n.dateFormatStr;this.g.text=this.O().innerHTML=typeof this.g.value=="object"?b(this.g.value):this.g.value},dateFormat_setter:function(a){this.g.dateFormatStr=dhx.Date.dateToStr(a);return dhx.Date.strToDate(a)},getValue:function(){return this.g.value||null},W:function(){var a=this.g;this.O().style.width=this.$width-a.labelWidth-a.z-a.zb-a.iconWidth+"px"},O:function(){return this.i.firstChild.childNodes[1]}},dhx.ui.text);
dhx.ready(function(){dhx.callEvent("onBeforeSchedulerInit",[]);if(scheduler.locale&&scheduler.locale.date)dhx.Date.Locale=scheduler.locale.date;var a=scheduler.config,b=scheduler.locale.labels,c=scheduler.templates;if(!a.form)a.form=[{view:"text",label:b.label_event,name:"text"},{view:"datetext",label:b.label_start,id:"start_date",name:"start_date",dateFormat:a.form_date},{view:"datetext",label:b.label_end,id:"end_date",name:"end_date",dateFormat:a.form_date},{view:"toggle",id:"allDay",label:"",options:[{value:"0",
label:b.label_time},{value:"1",label:b.label_allday}],align:"right",value:"0"},{view:"textarea",label:b.label_details,name:"details",height:150}];if(!a.calendar_hour){var d=a.hour_date.match(/%[h,H]/gi),e=a.hour_date.match(/%[a,A]/gi);a.calendar_hour=d[0]+(e?" "+e[0]:"")}if(!a.bottom_toolbar)a.bottom_toolbar=[{view:"button",id:"today",label:b.icon_today,inputWidth:scheduler.xy.icon_today,align:"left",width:scheduler.xy.icon_today+6},{view:"segmented",id:"buttons",selected:"list",align:"center",multiview:!0,
options:[{value:"list",label:b.list_tab,width:scheduler.xy.list_tab},{value:"day",label:b.day_tab,width:scheduler.xy.day_tab},{value:"month",label:b.month_tab,width:scheduler.xy.month_tab}]},{view:"button",css:"add",id:"add",align:"right",label:"&nbsp;+&nbsp;",inputWidth:42,width:50},{view:"label",label:"",inputWidth:42,width:50,batch:"readonly"}];if(!a.day_toolbar)a.day_toolbar=[{view:"label",id:"prev",align:"left",label:"<div class='dhx_cal_prev_button'><div></div></div>"},{view:"label",id:"date",
align:"center",width:200},{view:"label",id:"next",align:"right",label:"<div class='dhx_cal_next_button'><div></div></div>"}];if(!a.selected_toolbar)a.selected_toolbar=[{view:"button",inputWidth:scheduler.xy.icon_back,css:"cancel",id:"back",align:"left",label:b.icon_back},{view:"button",inputWidth:scheduler.xy.icon_edit,id:"edit",align:"right",label:b.icon_edit}];if(!a.form_toolbar)a.form_toolbar=[{view:"button",inputWidth:scheduler.xy.icon_cancel,id:"cancel",css:"cancel",align:"left",label:b.icon_cancel},
{view:"button",inputWidth:scheduler.xy.icon_save,id:"save",align:"right",label:b.icon_save}];if(!a.date_toolbar)a.date_toolbar=[{view:"button",width:scheduler.xy.icon_cancel,id:"cancel_date",css:"cancel",align:"left",label:b.icon_cancel},{view:"label",id:"datetype",align:"center"},{view:"button",width:scheduler.xy.icon_done,id:"done",align:"right",label:b.icon_done}];var f={cssNoEvents:"no_events",padding:0,width:"auto",timeStart:c.event_time,marker:c.event_marker,eventClass:c.event_class};scheduler.types=
{event_list:dhx.extend({name:"EventsList",css:"events",height:scheduler.xy.list_height,dateStart:c.event_date,template:c.event_title},f),day_event_list:dhx.extend({name:"DayEventsList",css:"day_events",height:scheduler.xy.month_list_height,template:c.month_event_title},f)};dhx.Type(dhx.ui.list,scheduler.types.event_list);dhx.Type(dhx.ui.list,scheduler.types.day_event_list);dhx.DataDriver.scheduler={records:"/*/event"};dhx.extend(dhx.DataDriver.scheduler,dhx.DataDriver.xml);var g=[{id:"list",view:"list",
type:"EventsList",startDate:new Date},{id:"day",rows:[{id:"dayBar",view:"toolbar",css:"dhx_topbar",elements:a.day_toolbar},{id:"dayList",view:"dayevents"}]},{id:"month",rows:[{id:"calendar",view:"calendar",dayWithEvents:c.calendar_event,calendarHeader:a.calendar_date,width:0},{id:"calendarDayEvents",view:"list",type:"DayEventsList"}]}].concat(a.tab_views),h={view:"button",height:44,label:b.icon_delete,id:"delete",type:"form",css:"delete"};if(screen.width>500)h.width=300,h={type:"clean",cols:[{},h,
{}]};var i=[{rows:[{view:"multiview",id:"tabViews",cells:g},{view:"toolbar",id:"bottomBar",type:"SchedulerBar",visibleBatch:"default",elements:a.bottom_toolbar}]},{id:"event",animate:{type:"slide",subtype:"in",direction:"top"},type:"clean",rows:[{id:"eventBar",view:"toolbar",type:"TopBar",css:"single_event",elements:a.selected_toolbar},{id:"eventTemplate",view:"template",template:c.selected_event},h,{view:"template",height:20}]},{id:"form",rows:[{id:"editBar",view:"toolbar",type:"TopBar",elements:a.form_toolbar},
{id:"editForm",view:"form",elements:a.form,rules:a.form_rules}]},{id:"formdate",rows:[{id:"dateBar",view:"toolbar",type:"TopBar",elements:a.date_toolbar},{id:"dateForm",rows:[{view:"calendar",css:"form_calendar",id:"formCalendar",width:-1,height:-1,hourFormat:a.calendar_hour,timeSelect:1,hourStart:0},{view:"template",css:"form_template"}]}]}].concat(a.views);dhx.protoUI({name:"scheduler",defaults:{rows:[{view:"multiview",id:"views",cells:i}],color:"#color#",textColor:"#textColor#"},$init:function(){this.name=
"Scheduler";this.h.className+=" dhx_scheduler";dhx.i18n.dateFormat=a.item_date;dhx.i18n.formDate=a.form_date;dhx.i18n.formAllDayFormat=a.form_all_day;dhx.i18n.timeFormat=a.hour_date;dhx.i18n.fullDateFormat=a.xml_date;dhx.i18n.fullDateFormatUTC=a.server_utc;dhx.i18n.longDateFormat=a.multi_day;dhx.i18n.headerFormatStr=dhx.Date.dateToStr(a.header_date);dhx.i18n.dateMethods=dhx.i18n.dateMethods.concat(["formDate","formAllDayFormat"]);dhx.i18n.setLocale();this.data.provideApi(this);this.data.scheme({$init:function(a){if(typeof a.start_date==
"string")a.start_date=dhx.i18n.fullDateFormatDate(a.start_date);if(typeof a.end_date=="string")a.end_date=dhx.i18n.fullDateFormatDate(a.end_date)}});this.$ready.push(this.th);dhx.callEvent("onAfterSchedulerInit",[this])},syncData:function(a,b,c){for(var d=this.getEvents(b,c),e=a.data.pull={},f=a.data.order=[],g=0;g<d.length;g++){var h=d[g].id;f.push(h);e[h]=d[g]}},Of:function(){this.syncData(this.$$("list"),scheduler.config.init_date,null);this.$$("list").render();this.coreData.callEvent("onChange",
[])},getTodayEvents:function(){var a=this.getTopParent(),b=dhx.Date.datePart(a.coreData.getValue()),c=dhx.Date.add(b,1,"day");a.syncData(this,b,c)},Ri:function(){if(this.isVisible()){var a=this.getTopParent(),b=dhx.Date.datePart(dhx.Date.copy(this.getVisibleDate()));b.setDate(1);var c=dhx.Date.add(b,1,"month");a.Zc={};for(var d=a.getEvents(b,c);b<c;){for(var e=dhx.Date.add(b,1,"day"),f=0;f<d.length;f++)d[f].start_date<e&&d[f].end_date>b&&(a.Zc[b.valueOf()]=!0);b=e}}},th:function(){this.uh();this.zh();
this.coreData=new dhx.DataValue;this.coreData.setValue(a.init_date);this.$$("dayList").define("date",this.coreData);this.selectedEvent=new dhx.DataRecord;this.config.readonly?this.define("readonly",this.config.readonly):a.readonly&&this.define("readonly",!0);if(this.config.save){var c=dhx.dp({master:this,url:this.config.save});c.attachEvent("onBeforeDataSend",this.bi)}this.$$("date")&&this.$$("date").bind(this.coreData,null,dhx.i18n.headerFormatStr);this.data.attachEvent("onStoreUpdated",this.bj);
this.data.attachEvent("onStoreUpdated",dhx.bind(this.Of,this));this.$$("dayList").define("dataFeed",this.getTodayEvents);this.$$("dayList").bind(this.coreData);this.$$("calendarDayEvents").define("dataFeed",this.getTodayEvents);this.$$("calendarDayEvents").bind(this.coreData);this.$$("calendar").bind(this.coreData);this.$$("calendar").attachEvent("onBeforeRender",this.Ri);this.coreData.attachEvent("onChange",dhx.bind(function(){this.$$("calendar").render()},this));this.data.attachEvent("onIdChange",
dhx.bind(function(){this.Of()},this));this.$$("eventTemplate").bind(this);this.$$("editForm").bind(this);this.$$("list").attachEvent("onItemClick",dhx.bind(this.qd,this));this.$$("dayList").attachEvent("onItemClick",dhx.bind(this.qd,this));this.$$("calendarDayEvents").attachEvent("onItemClick",dhx.bind(this.qd,this));this.dateField=new dhx.DataValue;this.dateField.setValue("start_date");this.$$("datetype").bind(this.dateField,null,function(a){return a=="start_date"?b.label_start:b.label_end})},qd:function(a){this.Re=
(a||"").toString().split("#");this.Re[1]&&this.setCursor(null);this.setCursor(this.Re[0]);this.$$("event").show()},bj:function(){this.blockEvent();this.sort(function(a,b){return a.start_date<b.start_date?-1:1});this.unblockEvent()},zh:function(){this.$$("calendar").attachEvent("onDateSelect",dhx.bind(function(a){this.setDate(a)},this));this.$$("calendar").attachEvent("onAfterMonthChange",dhx.bind(function(a){var b=new Date;a.getMonth()===b.getMonth()&&a.getYear()===b.getYear()?a=b:a.setDate(1);this.setDate(a)},
this));var a=this.$$("calendar").config.calendarDay;this.$$("calendar").config.calendarDay=dhx.bind(function(b){var c=a(b);return this.Zc&&this.Zc[b.valueOf()]?this.$$("calendar").config.dayWithEvents(c):c},this)},getEvents:function(a,b){b||(b=new Date(9999,0,1));for(var c=[],d=this.data.getRange(),e=0;e<d.length;e++)d[e].start_date<b&&d[e].end_date>a&&c.push(d[e]);return c},setDate:function(a,b,c){a=a?dhx.Date.datePart(a):this.coreData.getValue();b&&(a=dhx.Date.add(a,b,c));this.coreData.setValue(a)},
uh:function(){this.attachEvent("onItemClick",function(a){var c=this.innerId(a);switch(c){case "today":this.setDate(new Date);break;case "add":this.Sd();break;case "prev":this.setDate(null,-1,"day");break;case "next":this.setDate(null,
1,"day");break;case "edit":this.$$("delete")&&this.$$("delete").show();this.define("editEvent",!0);this.$$("form").show();this.Hd();break;case "cancel_date":case "back":this.$$("views").back();break;case "cancel":this.callEvent("onAfterCursorChange",[this.getCursor()]);this.$$("views").back();break;case "save":if(this.$$("editForm").validate()){if(this.g.editEvent)this.$$("editForm").save();else{var e=this.$$("editForm").getValues();e.id=dhx.uid();if(e.details&&this.Uf(e.text)===""&&this.Uf(e.details)!==
"")e.text=e.details;this.add(e);this.setCursor(e.id)}this.setDate();this.$$("views").back()}break;case "delete":this.Hg();break;case "start_date":case "end_date":this.$$(c).name=="datetext"&&this.Wi(c);break;case "done":var f=this.dateField.getValue(),g=this.$$("formCalendar").getValue();this.$$(f).setValue(g);this.Hd();this.$$("views").back();this.$$("editForm").validate();break;case "allDay":this.Pi()}});this.attachEvent("onAfterTabClick",function(a,b){this.$$(b).show()});this.attachEvent("onBeforeTabClick",
function(a,b){return this.Ag(b)})},readonly_setter:function(a){this.$$("add")&&(a?(this.$$("bottomBar").showBatch("readonly"),this.$$("add").hide(),this.$$("edit").hide(),this.$$("delete").hide()):(this.$$("bottomBar").showBatch("default"),this.$$("add").show(),this.$$("edit").show(),this.$$("delete").show()));return a},wj:function(){this.dataCount()?this.h.className=this.h.className.replace(RegExp(this.type.cssNoEvents,"g"),""):this.h.className+=" "+this.type.cssNoEvents},Hg:function(){var a=this;
dhx.confirm({height:scheduler.xy.confirm_height,width:scheduler.xy.confirm_width,title:b.icon_delete,message:b.confirm_deleting,callback:function(b){b&&(a.remove(a.getCursor()),a.setDate(),a.$$("views").back(1))},labelOk:b.icon_yes,labelCancel:b.icon_no,css:"confirm",header:!1})},Sd:function(){this.define("editEvent",!1);this.$$("form").show();this.$$("editForm").clear();this.$$("editForm").setValues(c.new_event_data.call(this));this.Hd()},eventDefaultDate:function(){},Ag:function(a){if(this.innerId(this.$$("views").getActive())==
"form"){var c=this;a!="today"&&dhx.confirm({height:scheduler.xy.confirm_height,width:scheduler.xy.confirm_width,title:b.icon_close,message:b.confirm_closing,callback:function(b){b&&(c.$$(a).show(),c.$$("buttons").setValue(a))},labelOk:b.icon_yes,labelCancel:b.icon_no,css:"confirm"});return!1}return!0},bi:function(a){var b,c;for(b=0;b<a.length;b++)c=a[b].data,c.start_date=dhx.i18n.fullDateFormatStr(c.start_date),c.end_date=dhx.i18n.fullDateFormatStr(c.end_date)},Wi:function(a){this.dateField.setValue(a);
this.$$("editForm").elements.allDay&&this.$$("formCalendar").define("timeSelect",this.$$("editForm").elements.allDay.getValue()=="0");this.$$("formdate").show();dhx.delay(function(){this.$$("formCalendar").resize();this.$$("formCalendar").selectDate(this.$$(a).getValue(),!0)},this)},ce:function(a){return a.valueOf()==dhx.Date.datePart(a).valueOf()},Pi:function(){for(var a=this.$$("allDay").getValue()=="1"?dhx.i18n.formAllDayFormatStr:dhx.i18n.formDateStr,b=this.$$("editForm").elements,c=[this.$$("start_date"),
this.$$("end_date")],d=0;d<2;d++)c[d].config.dateFormatStr=a,b.allDay.getValue()!="1"&&c[d].setValue(this.ia[d]);if(b.allDay.getValue()=="1"){c[0].setValue(dhx.Date.datePart(this.ia[0]));var e=dhx.Date.datePart(this.ia[1]);e.valueOf()<=c[0].getValue().valueOf()&&(e=dhx.Date.add(e,1,"day"));c[1].setValue(e)}},Hd:function(){this.ia=[];var a=this.$$("editForm").elements;this.ia[0]=this.$$("start_date").getValue();this.ia[1]=this.$$("end_date").getValue();var b=this.ce(this.ia[0])&&this.ce(this.ia[1])&&
this.ia[1].valueOf()>this.ia[0].valueOf()?"1":"0";if(a.allDay){a.allDay.setValue(b);for(var c=a.allDay.getValue()=="1"?dhx.i18n.formAllDayFormatStr:dhx.i18n.formDateStr,d=[this.$$("start_date"),this.$$("end_date")],e=0;e<2;e++)d[e].config.dateFormatStr=c,d[e].setValue(this.ia[e])}},Uf:function(a){a=a.replace(/^ */g,"");return a=a.replace(/ *$/g,"")}},dhx.IdSpace,dhx.DataLoader,dhx.ui.layout,dhx.EventSystem,dhx.Settings)});
