dhxmvp
Version:
A complete boilerplate for building online, offline and syncable MVP Single Page Applications using DHTMLX.
9 lines (8 loc) • 1.37 MB
JavaScript
/*
Product Name: dhtmlxSuite
Version: 5.0
Edition: Standard
License: content of this file is covered by GPL. Usage outside GPL terms is prohibited. To obtain Commercial or Enterprise license contact sales@dhtmlx.com
Copyright UAB Dinamenta http://www.dhtmlx.com
*/
if(typeof(window.dhx)=="undefined"){window.dhx=window.dhx4={version:"5.0",skin:null,skinDetect:function(a){return{10:"dhx_skyblue",20:"dhx_web",30:"dhx_terrace",40:"material"}[this.readFromCss(a+"_skin_detect")]||null},readFromCss:function(e,g,h){var c=document.createElement("DIV");c.className=e;if(document.body.firstChild!=null){document.body.insertBefore(c,document.body.firstChild)}else{document.body.appendChild(c)}if(typeof(h)=="string"){c.innerHTML=h}var a=c[g||"offsetWidth"];c.parentNode.removeChild(c);c=null;return a},lastId:1,newId:function(){return this.lastId++},zim:{data:{},step:5,first:function(){return 100},last:function(){var e=this.first();for(var c in this.data){e=Math.max(e,this.data[c])}return e},reserve:function(a){this.data[a]=this.last()+this.step;return this.data[a]},clear:function(a){if(this.data[a]!=null){this.data[a]=null;delete this.data[a]}}},s2b:function(a){if(typeof(a)=="string"){a=a.toLowerCase()}return(a==true||a==1||a=="true"||a=="1"||a=="yes"||a=="y"||a=="on")},s2j:function(s){var obj=null;dhx4.temp=null;try{eval("dhx4.temp="+s)}catch(e){dhx4.temp=null}obj=dhx4.temp;dhx4.temp=null;return obj},absLeft:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}return this.getOffset(a).left},absTop:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}return this.getOffset(a).top},_aOfs:function(a){var e=0,c=0;while(a){e=e+parseInt(a.offsetTop);c=c+parseInt(a.offsetLeft);a=a.offsetParent}return{top:e,left:c}},_aOfsRect:function(g){var l=g.getBoundingClientRect();var m=document.body;var c=document.documentElement;var a=window.pageYOffset||c.scrollTop||m.scrollTop;var h=window.pageXOffset||c.scrollLeft||m.scrollLeft;var j=c.clientTop||m.clientTop||0;var n=c.clientLeft||m.clientLeft||0;var o=l.top+a-j;var e=l.left+h-n;return{top:Math.round(o),left:Math.round(e)}},getOffset:function(a){if(a.getBoundingClientRect){return this._aOfsRect(a)}else{return this._aOfs(a)}},_isObj:function(a){return(a!=null&&typeof(a)=="object"&&typeof(a.length)=="undefined")},_copyObj:function(g){if(this._isObj(g)){var e={};for(var c in g){if(typeof(g[c])=="object"&&g[c]!=null){e[c]=this._copyObj(g[c])}else{e[c]=g[c]}}}else{var e=[];for(var c=0;c<g.length;c++){if(typeof(g[c])=="object"&&g[c]!=null){e[c]=this._copyObj(g[c])}else{e[c]=g[c]}}}return e},screenDim:function(){var a=(navigator.userAgent.indexOf("MSIE")>=0);var c={};c.left=document.body.scrollLeft;c.right=c.left+(window.innerWidth||document.body.clientWidth);c.top=Math.max((a?document.documentElement:document.getElementsByTagName("html")[0]).scrollTop,document.body.scrollTop);c.bottom=c.top+(a?Math.max(document.documentElement.clientHeight||0,document.documentElement.offsetHeight||0):window.innerHeight);return c},selectTextRange:function(h,l,c){h=(typeof(h)=="string"?document.getElementById(h):h);var a=h.value.length;l=Math.max(Math.min(l,a),0);c=Math.min(c,a);if(h.setSelectionRange){try{h.setSelectionRange(l,c)}catch(j){}}else{if(h.createTextRange){var g=h.createTextRange();g.moveStart("character",l);g.moveEnd("character",c-a);try{g.select()}catch(j){}}}},transData:null,transDetect:function(){if(this.transData==null){this.transData={transProp:false,transEv:null};var e={MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd",OTransition:"oTransitionEnd",msTransition:"transitionend",transition:"transitionend"};for(var c in e){if(this.transData.transProp==false&&document.documentElement.style[c]!=null){this.transData.transProp=c;this.transData.transEv=e[c]}}e=null}return this.transData},_xmlNodeValue:function(a){var e="";for(var c=0;c<a.childNodes.length;c++){e+=(a.childNodes[c].nodeValue!=null?a.childNodes[c].nodeValue.toString().replace(/^[\n\r\s]{0,}/,"").replace(/[\n\r\s]{0,}$/,""):"")}return e}};window.dhx4.isIE=(navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>=0);window.dhx4.isIE6=(window.XMLHttpRequest==null&&navigator.userAgent.indexOf("MSIE")>=0);window.dhx4.isIE7=(navigator.userAgent.indexOf("MSIE 7.0")>=0&&navigator.userAgent.indexOf("Trident")<0);window.dhx4.isIE8=(navigator.userAgent.indexOf("MSIE 8.0")>=0&&navigator.userAgent.indexOf("Trident")>=0);window.dhx4.isIE9=(navigator.userAgent.indexOf("MSIE 9.0")>=0&&navigator.userAgent.indexOf("Trident")>=0);window.dhx4.isIE10=(navigator.userAgent.indexOf("MSIE 10.0")>=0&&navigator.userAgent.indexOf("Trident")>=0&&window.navigator.pointerEnabled!=true);window.dhx4.isIE11=(navigator.userAgent.indexOf("Trident")>=0&&window.navigator.pointerEnabled==true);window.dhx4.isEdge=(navigator.userAgent.indexOf("Edge")>=0);window.dhx4.isOpera=(navigator.userAgent.indexOf("Opera")>=0);window.dhx4.isChrome=(navigator.userAgent.indexOf("Chrome")>=0)&&!window.dhx4.isEdge;window.dhx4.isKHTML=(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0)&&!window.dhx4.isEdge;window.dhx4.isFF=(navigator.userAgent.indexOf("Firefox")>=0);window.dhx4.isIPad=(navigator.userAgent.search(/iPad/gi)>=0);window.dhx4.dnd={evs:{},p_en:((window.dhx4.isIE||window.dhx4.isEdge)&&(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)),_mTouch:function(a){return(window.dhx4.isIE10&&a.pointerType==a.MSPOINTER_TYPE_MOUSE||window.dhx4.isIE11&&a.pointerType=="mouse"||window.dhx4.isEdge&&a.pointerType=="mouse")},_touchOn:function(a){if(a==null){a=document.body}a.style.touchAction=a.style.msTouchAction="";a=null},_touchOff:function(a){if(a==null){a=document.body}a.style.touchAction=a.style.msTouchAction="none";a=null}};if(window.navigator.pointerEnabled==true){window.dhx4.dnd.evs={start:"pointerdown",move:"pointermove",end:"pointerup"}}else{if(window.navigator.msPointerEnabled==true){window.dhx4.dnd.evs={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}}else{if(typeof(window.addEventListener)!="undefined"){window.dhx4.dnd.evs={start:"touchstart",move:"touchmove",end:"touchend"}}}}}if(typeof(window.dhx4.template)=="undefined"){window.dhx4.trim=function(a){return String(a).replace(/^\s{1,}/,"").replace(/\s{1,}$/,"")};window.dhx4.template=function(c,e,a){return c.replace(/#([a-z0-9_-]{1,})(\|([^#]*))?#/gi,function(){var l=arguments[1];var j=window.dhx4.trim(arguments[3]);var m=null;var h=[e[l]];if(j.length>0){j=j.split(":");var g=[];for(var n=0;n<j.length;n++){if(n>0&&g[g.length-1].match(/\\$/)!=null){g[g.length-1]=g[g.length-1].replace(/\\$/,"")+":"+j[n]}else{g.push(j[n])}}m=g[0];for(var n=1;n<g.length;n++){h.push(g[n])}}if(typeof(m)=="string"&&typeof(window.dhx4.template[m])=="function"){return window.dhx4.template[m].apply(window.dhx4.template,h)}if(l.length>0&&typeof(e[l])!="undefined"){if(a==true){return window.dhx4.trim(e[l])}return String(e[l])}return""})};window.dhx4.template.date=function(a,c){if(a!=null){if(a instanceof Date){return window.dhx4.date2str(a,c)}else{a=a.toString();if(a.match(/^\d*$/)!=null){return window.dhx4.date2str(new Date(parseInt(a)),c)}return a}}return""};window.dhx4.template.maxlength=function(c,a){return String(c).substr(0,a)};window.dhx4.template.number_format=function(g,h,e,a){var c=window.dhx4.template._parseFmt(h,e,a);if(c==false){return g}return window.dhx4.template._getFmtValue(g,c)};window.dhx4.template.lowercase=function(a){if(typeof(a)=="undefined"||a==null){a=""}return String(a).toLowerCase()};window.dhx4.template.uppercase=function(a){if(typeof(a)=="undefined"||a==null){a=""}return String(a).toUpperCase()};window.dhx4.template._parseFmt=function(l,e,a){var g=l.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/);if(g==null||g.length!=4){return false}var c={i_len:false,i_sep:(typeof(e)=="string"?e:","),d_len:false,d_sep:(typeof(a)=="string"?a:"."),s_bef:(typeof(g[1])=="string"?g[1]:""),s_aft:(typeof(g[3])=="string"?g[3]:"")};var j=g[2].split(".");if(j[1]!=null){c.d_len=j[1].length}var h=j[0].split(",");if(h.length>1){c.i_len=h[h.length-1].length}return c};window.dhx4.template._getFmtValue=function(value,fmt){var r=String(value).match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/);if(r!=null&&r.length==5){var v0="";if(r[1]!=null){v0+=r[1]}v0+=fmt.s_bef;if(fmt.i_len!==false){var i=0;var v1="";for(var q=r[2].length-1;q>=0;q--){v1=""+r[2].charAt(q)+v1;if(++i==fmt.i_len&&q>0){v1=fmt.i_sep+v1;i=0}}v0+=v1}else{v0+=r[2]}if(fmt.d_len!==false){if(r[4]==null){r[4]=""}while(r[4].length<fmt.d_len){r[4]+="0"}eval("dhx4.temp = new RegExp(/\\d{"+fmt.d_len+"}/);");var t1=(r[4]).match(dhx4.temp);if(t1!=null){v0+=fmt.d_sep+t1}dhx4.temp=t1=null}v0+=fmt.s_aft;return v0}return value}}if(typeof(window.dhx4.dateLang)=="undefined"){window.dhx4.dateLang="en";window.dhx4.dateStrings={en:{monthFullName:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShortName:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFullName:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShortName:["Su","Mo","Tu","We","Th","Fr","Sa"]}};window.dhx4.dateFormat={en:"%Y-%m-%d"};window.dhx4.date2str=function(j,g,a){if(g==null||typeof(g)=="undefined"){g=window.dhx4.dateFormat[window.dhx4.dateLang]}if(a==null||typeof(a)=="undefined"){a=window.dhx4.dateStrings[window.dhx4.dateLang]}if(j instanceof Date){var h=function(l){return(String(l).length==1?"0"+String(l):l)};var c=function(n){switch(n){case"%d":return h(j.getDate());case"%j":return j.getDate();case"%D":return a.dayShortName[j.getDay()];case"%l":return a.dayFullName[j.getDay()];case"%m":return h(j.getMonth()+1);case"%n":return j.getMonth()+1;case"%M":return a.monthShortName[j.getMonth()];case"%F":return a.monthFullName[j.getMonth()];case"%y":return h(j.getYear()%100);case"%Y":return j.getFullYear();case"%g":return(j.getHours()+11)%12+1;case"%h":return h((j.getHours()+11)%12+1);case"%G":return j.getHours();case"%H":return h(j.getHours());case"%i":return h(j.getMinutes());case"%s":return h(j.getSeconds());case"%a":return(j.getHours()>11?"pm":"am");case"%A":return(j.getHours()>11?"PM":"AM");case"%%":return"%";case"%u":return j.getMilliseconds();case"%P":if(window.dhx4.temp_calendar!=null&&window.dhx4.temp_calendar.tz!=null){return window.dhx4.temp_calendar.tz}var r=j.getTimezoneOffset();var o=Math.abs(Math.floor(r/60));var l=Math.abs(r)-o*60;return(r>0?"-":"+")+h(o)+":"+h(l);default:return n}};var e=String(g||window.dhx4.dateFormat).replace(/%[a-zA-Z]/g,c)}return(e||String(j))};window.dhx4.str2date=function(j,y,D){if(y==null||typeof(y)=="undefined"){y=window.dhx4.dateFormat[window.dhx4.dateLang]}if(D==null||typeof(D)=="undefined"){D=window.dhx4.dateStrings[window.dhx4.dateLang]}y=y.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g,"\\$&");var C=[];var n=[];y=y.replace(/%[a-z]/gi,function(e){switch(e){case"%d":case"%m":case"%y":case"%h":case"%H":case"%i":case"%s":n.push(e);return"(\\d{2})";case"%D":case"%l":case"%M":case"%F":n.push(e);return"([a-zéûä\u0430-\u044F\u0451]{1,})";case"%j":case"%n":case"%g":case"%G":n.push(e);return"(\\d{1,2})";case"%Y":n.push(e);return"(\\d{4})";case"%a":n.push(e);return"([a|p]m)";case"%A":n.push(e);return"([A|P]M)";case"%u":n.push(e);return"(\\d{1,6})";case"%P":n.push(e);return"([+-]\\d{1,2}:\\d{1,2})"}return e});var E=new RegExp(y,"i");var o=j.match(E);if(o==null||o.length-1!=n.length){return"Invalid Date"}for(var c=1;c<o.length;c++){C.push(o[c])}var g={"%y":1,"%Y":1,"%n":2,"%m":2,"%M":2,"%F":2,"%d":3,"%j":3,"%a":4,"%A":4,"%H":5,"%G":5,"%h":5,"%g":5,"%i":6,"%s":7,"%u":7,"%P":7};var s={};var m={};for(var c=0;c<n.length;c++){if(typeof(g[n[c]])!="undefined"){var h=g[n[c]];if(!s[h]){s[h]=[];m[h]=[]}s[h].push(C[c]);m[h].push(n[c])}}C=[];n=[];for(var c=1;c<=7;c++){if(s[c]!=null){for(var x=0;x<s[c].length;x++){C.push(s[c][x]);n.push(m[c][x])}}}var a=new Date();a.setDate(1);a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);var u=function(v,e){for(var r=0;r<e.length;r++){if(e[r].toLowerCase()==v){return r}}return -1};for(var c=0;c<C.length;c++){switch(n[c]){case"%d":case"%j":case"%n":case"%m":case"%Y":case"%H":case"%G":case"%i":case"%s":case"%u":if(!isNaN(C[c])){a[{"%d":"setDate","%j":"setDate","%n":"setMonth","%m":"setMonth","%Y":"setFullYear","%H":"setHours","%G":"setHours","%i":"setMinutes","%s":"setSeconds","%u":"setMilliseconds"}[n[c]]](Number(C[c])+(n[c]=="%m"||n[c]=="%n"?-1:0))}break;case"%M":case"%F":var l=u(C[c].toLowerCase(),D[{"%M":"monthShortName","%F":"monthFullName"}[n[c]]]);if(l>=0){a.setMonth(l)}break;case"%y":if(!isNaN(C[c])){var A=Number(C[c]);a.setFullYear(A+(A>50?1900:2000))}break;case"%g":case"%h":if(!isNaN(C[c])){var A=Number(C[c]);if(A<=12&&A>=0){a.setHours(A+(u("pm",C)>=0?(A==12?0:12):(A==12?-12:0)))}}break;case"%P":if(window.dhx4.temp_calendar!=null){window.dhx4.temp_calendar.tz=C[c]}break}}return a}}if(typeof(window.dhx4.ajax)=="undefined"){window.dhx4.ajax={cache:false,method:"get",parse:function(a){if(typeof a!=="string"){return a}a=a.replace(/^[\s]+/,"");if(window.DOMParser&&!dhx4.isIE){var c=(new window.DOMParser()).parseFromString(a,"text/xml")}else{if(window.ActiveXObject!==window.undefined){var c=new window.ActiveXObject("Microsoft.XMLDOM");c.async="false";c.loadXML(a)}}return c},xmltop:function(a,h,g){if(typeof h.status=="undefined"||h.status<400){xml=(!h.responseXML)?dhx4.ajax.parse(h.responseText||h):(h.responseXML||h);if(xml&&xml.documentElement!==null){try{if(!xml.getElementsByTagName("parsererror").length){return xml.getElementsByTagName(a)[0]}}catch(c){}}}if(g!==-1){dhx4.callEvent("onLoadXMLError",["Incorrect XML",arguments[1],g])}return document.createElement("DIV")},xpath:function(g,a){if(!a.nodeName){a=a.responseXML||a}if(dhx4.isIE){try{return a.selectNodes(g)||[]}catch(j){return[]}}else{var h=[];var l;var c=(a.ownerDocument||a).evaluate(g,a,null,XPathResult.ANY_TYPE,null);while(l=c.iterateNext()){h.push(l)}return h}},query:function(a){dhx4.ajax._call((a.method||"GET"),a.url,a.data||"",(a.async||true),a.callback,null,a.headers)},get:function(a,c){return this._call("GET",a,null,true,c)},getSync:function(a){return this._call("GET",a,null,false)},put:function(c,a,e){return this._call("PUT",c,a,true,e)},del:function(c,a,e){return this._call("DELETE",c,a,true,e)},post:function(c,a,e){if(arguments.length==1){a=""}else{if(arguments.length==2&&(typeof(a)=="function"||typeof(window[a])=="function")){e=a;a=""}else{a=String(a)}}return this._call("POST",c,a,true,e)},postSync:function(c,a){a=(a==null?"":String(a));return this._call("POST",c,a,false)},getLong:function(a,c){this._call("GET",a,null,true,c,{url:a})},postLong:function(c,a,e){if(arguments.length==2&&(typeof(a)=="function"||typeof(window[a]))){e=a;a=""}this._call("POST",c,a,true,e,{url:c,postData:a})},_call:function(a,c,e,h,l,o,g){var n=(window.XMLHttpRequest&&!dhx4.isIE?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"));var j=(navigator.userAgent.match(/AppleWebKit/)!=null&&navigator.userAgent.match(/Qt/)!=null&&navigator.userAgent.match(/Safari/)!=null);if(h==true){n.onreadystatechange=function(){if((n.readyState==4)||(j==true&&n.readyState==3)){if(n.status!=200||n.responseText==""){if(!dhx4.callEvent("onAjaxError",[{xmlDoc:n,filePath:c,async:h}])){return}}window.setTimeout(function(){if(typeof(l)=="function"){l.apply(window,[{xmlDoc:n,filePath:c,async:h}])}if(o!=null){if(typeof(o.postData)!="undefined"){dhx4.ajax.postLong(o.url,o.postData,l)}else{dhx4.ajax.getLong(o.url,l)}}l=null;n=null},1)}}}if(a=="GET"){c+=this._dhxr(c)}n.open(a,c,h);if(g!=null){for(var m in g){n.setRequestHeader(m,g[m])}}else{if(a=="POST"||a=="PUT"||a=="DELETE"){n.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}else{if(a=="GET"){e=null}}}n.setRequestHeader("X-Requested-With","XMLHttpRequest");n.send(e);if(h!=true){if((n.readyState==4)||(j==true&&n.readyState==3)){if(n.status!=200||n.responseText==""){dhx4.callEvent("onAjaxError",[{xmlDoc:n,filePath:c,async:h}])}}}return{xmlDoc:n,filePath:c,async:h}},_dhxr:function(a,c){if(this.cache!=true){if(a.match(/^[\?\&]$/)==null){a=(a.indexOf("?")>=0?"&":"?")}if(typeof(c)=="undefined"){c=true}return a+"dhxr"+new Date().getTime()+(c==true?"=1":"")}return""}}}if(typeof(window.dhx4._enableDataLoading)=="undefined"){window.dhx4._enableDataLoading=function(l,e,j,h,m){if(m=="clear"){for(var c in l._dhxdataload){l._dhxdataload[c]=null;delete l._dhxdataload[c]}l._loadData=null;l._dhxdataload=null;l.load=null;l.loadStruct=null;l=null;return}l._dhxdataload={initObj:e,xmlToJson:j,xmlRootTag:h,onBeforeXLS:null};l._loadData=function(u,v,w){if(arguments.length==2){w=v;v=null}var s=null;if(arguments.length==3){w=arguments[2]}if(typeof(u)=="string"){var r=u.replace(/^\s{1,}/,"").replace(/\s{1,}$/,"");var A=new RegExp("^<"+this._dhxdataload.xmlRootTag);if(A.test(r.replace(/^<\?xml[^\?]*\?>\s*/,""))){s=dhx4.ajax.parse(u);if(s!=null){s=this[this._dhxdataload.xmlToJson].apply(this,[s])}}if(s==null&&(r.match(/^[\s\S]*{[.\s\S]*}[\s\S]*$/)!=null||r.match(/^[\s\S]*\[[.\s\S]*\][\s\S]*$/)!=null)){s=dhx4.s2j(r)}if(s==null){this.callEvent("onXLS",[]);var o=[];if(typeof(this._dhxdataload.onBeforeXLS)=="function"){var r=this._dhxdataload.onBeforeXLS.apply(this,[u]);if(r!=null&&typeof(r)=="object"){if(r.url!=null){u=r.url}if(r.params!=null){for(var x in r.params){o.push(x+"="+encodeURIComponent(r.params[x]))}}}}var y=this;var n=function(a){var C=null;if((a.xmlDoc.getResponseHeader("Content-Type")||"").search(/xml/gi)>=0||(a.xmlDoc.responseText.replace(/^\s{1,}/,"")).match(/^</)!=null){C=y[y._dhxdataload.xmlToJson].apply(y,[a.xmlDoc.responseXML])}else{C=dhx4.s2j(a.xmlDoc.responseText)}if(C!=null){y[y._dhxdataload.initObj].apply(y,[C,u])}y.callEvent("onXLE",[]);if(w!=null){if(typeof(w)=="function"){w.apply(y,[])}else{if(typeof(window[w])=="function"){window[w].apply(y,[])}}}n=w=null;C=a=y=null};o=o.join("&")+(typeof(v)=="string"?"&"+v:"");if(dhx4.ajax.method=="post"){dhx4.ajax.post(u,o,n)}else{if(dhx4.ajax.method=="get"){dhx4.ajax.get(u+(o.length>0?(u.indexOf("?")>0?"&":"?")+o:""),n)}}return}}else{if(typeof(u.documentElement)=="object"||(typeof(u.tagName)!="undefined"&&typeof(u.getElementsByTagName)!="undefined"&&u.getElementsByTagName(this._dhxdataload.xmlRootTag).length>0)){s=this[this._dhxdataload.xmlToJson].apply(this,[u])}else{s=window.dhx4._copyObj(u)}}if(s!=null){this[this._dhxdataload.initObj].apply(this,[s])}if(w!=null){if(typeof(w)=="function"){w.apply(this,[])}else{if(typeof(window[w])=="function"){window[w].apply(this,[])}}w=null}};if(m!=null){var g={struct:"loadStruct",data:"load"};for(var c in m){if(m[c]==true){l[g[c]]=function(){return this._loadData.apply(this,arguments)}}}}l=null}}if(typeof(window.dhx4._eventable)=="undefined"){window.dhx4._eventable=function(a,c){if(c=="clear"){a.detachAllEvents();a.dhxevs=null;a.attachEvent=null;a.detachEvent=null;a.checkEvent=null;a.callEvent=null;a.detachAllEvents=null;a=null;return}a.dhxevs={data:{}};a.attachEvent=function(e,h){e=String(e).toLowerCase();if(!this.dhxevs.data[e]){this.dhxevs.data[e]={}}var g=window.dhx4.newId();this.dhxevs.data[e][g]=h;return g};a.detachEvent=function(j){for(var g in this.dhxevs.data){var h=0;for(var e in this.dhxevs.data[g]){if(e==j){this.dhxevs.data[g][e]=null;delete this.dhxevs.data[g][e]}else{h++}}if(h==0){this.dhxevs.data[g]=null;delete this.dhxevs.data[g]}}};a.checkEvent=function(e){e=String(e).toLowerCase();return(this.dhxevs.data[e]!=null)};a.callEvent=function(g,j){g=String(g).toLowerCase();if(this.dhxevs.data[g]==null){return true}var h=true;for(var e in this.dhxevs.data[g]){h=this.dhxevs.data[g][e].apply(this,j)&&h}return h};a.detachAllEvents=function(){for(var g in this.dhxevs.data){for(var e in this.dhxevs.data[g]){this.dhxevs.data[g][e]=null;delete this.dhxevs.data[g][e]}this.dhxevs.data[g]=null;delete this.dhxevs.data[g]}};a=null};dhx4._eventable(dhx4)}if(!window.dhtmlxValidation){dhtmlxValidation=function(){};dhtmlxValidation.prototype={isEmpty:function(a){return a==""},isNotEmpty:function(a){return(a instanceof Array?a.length>0:!a=="")},isValidBoolean:function(a){return !!a.toString().match(/^(0|1|true|false)$/)},isValidEmail:function(a){return !!a.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,5})$)/i)},isValidInteger:function(a){return !!a.toString().match(/(^-?\d+$)/)},isValidNumeric:function(a){return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/)},isValidAplhaNumeric:function(a){return !!a.toString().match(/^[_\-a-z0-9]+$/gi)},isValidDatetime:function(c){var a=c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);return a&&!!(a[1]<=9999&&a[2]<=12&&a[3]<=31&&a[4]<=59&&a[5]<=59&&a[6]<=59)||false},isValidDate:function(a){var c=a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/);return c&&!!(c[1]<=9999&&c[2]<=12&&c[3]<=31)||false},isValidTime:function(c){var a=c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);return a&&!!(a[1]<=24&&a[2]<=59&&a[3]<=59)||false},isValidIPv4:function(a){var c=a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);return c&&!!(c[1]<=255&&c[2]<=255&&c[3]<=255&&c[4]<=255)||false},isValidCurrency:function(a){return a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/)&&true||false},isValidSSN:function(a){return a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/)&&true||false},isValidSIN:function(a){return a.toString().match(/^\d{9}$/)&&true||false}};dhtmlxValidation=new dhtmlxValidation()}if(typeof(window.dhtmlx)=="undefined"){window.dhtmlx={extend:function(e,c){for(var g in c){if(!e[g]){e[g]=c[g]}}return e},extend_api:function(a,g,e){var c=window[a];if(!c){return}window[a]=function(l){if(l&&typeof l=="object"&&!l.tagName){var j=c.apply(this,(g._init?g._init(l):arguments));for(var h in dhtmlx){if(g[h]){this[g[h]](dhtmlx[h])}}for(var h in l){if(g[h]){this[g[h]](l[h])}else{if(h.indexOf("on")===0){this.attachEvent(h,l[h])}}}}else{var j=c.apply(this,arguments)}if(g._patch){g._patch(this)}return j||this};window[a].prototype=c.prototype;if(e){dhtmlx.extend(window[a].prototype,e)}},url:function(a){if(a.indexOf("?")!=-1){return"&"}else{return"?"}}}}function dhtmlDragAndDropObject(){if(window.dhtmlDragAndDrop){return window.dhtmlDragAndDrop}this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;window.dhtmlDragAndDrop=this;return this}dhtmlDragAndDropObject.prototype.removeDraggableItem=function(a){a.onmousedown=null;a.dragStarter=null;a.dragLanding=null};dhtmlDragAndDropObject.prototype.addDraggableItem=function(a,c){a.onmousedown=this.preCreateDragCopy;a.dragStarter=c;this.addDragLanding(a,c)};dhtmlDragAndDropObject.prototype.addDragLanding=function(a,c){a.dragLanding=c};dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(a){if((a||window.event)&&(a||event).button==2){return}if(window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false}if(window.dhtmlDragAndDrop.dragNode){window.dhtmlDragAndDrop.stopDrag(a)}window.dhtmlDragAndDrop.waitDrag=1;window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;window.dhtmlDragAndDrop.dragStartNode=this;window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;window.dhtmlDragAndDrop.downtime=new Date().valueOf();if((a)&&(a.preventDefault)){a.preventDefault();return false}return false};dhtmlDragAndDropObject.prototype.callDrag=function(g){if(!g){g=window.event}dragger=window.dhtmlDragAndDrop;if((new Date()).valueOf()-dragger.downtime<100){return}if(!dragger.dragNode){if(dragger.waitDrag){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode,g);if(!dragger.dragNode){return dragger.stopDrag()}dragger.dragNode.onselectstart=function(){return false};dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute()}else{return dragger.stopDrag(g,true)}}if(dragger.dragNode.parentNode!=window.document.body&&dragger.gldragNode){var a=dragger.gldragNode;if(dragger.gldragNode.old){a=dragger.gldragNode.old}a.parentNode.removeChild(a);var c=dragger.dragNode.pWindow;if(a.pWindow&&a.pWindow.dhtmlDragAndDrop.lastLanding){a.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(a.pWindow.dhtmlDragAndDrop.lastLanding)}if(_isIE){var j=document.createElement("Div");j.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=j.childNodes[0]}else{dragger.dragNode=dragger.dragNode.cloneNode(true)}dragger.dragNode.pWindow=window;dragger.gldragNode.old=dragger.dragNode;document.body.appendChild(dragger.dragNode);c.dhtmlDragAndDrop.dragNode=dragger.dragNode}dragger.dragNode.style.left=g.clientX+15+(dragger.fx?dragger.fx*(-1):0)+(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=g.clientY+3+(dragger.fy?dragger.fy*(-1):0)+(document.body.scrollTop||document.documentElement.scrollTop)+"px";if(!g.srcElement){var h=g.target}else{h=g.srcElement}dragger.checkLanding(h,g)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(h){if(window.name){var e=parent.frames[window.name].frameElement.offsetParent;var g=0;var c=0;while(e){g+=e.offsetLeft;c+=e.offsetTop;e=e.offsetParent}if((parent.dhtmlDragAndDrop)){var a=parent.dhtmlDragAndDrop.calculateFramePosition(1);g+=a.split("_")[0]*1;c+=a.split("_")[1]*1}if(h){return g+"_"+c}else{this.fx=g}this.fy=c}return"0_0"};dhtmlDragAndDropObject.prototype.checkLanding=function(c,a){if((c)&&(c.dragLanding)){if(this.lastLanding){this.lastLanding.dragLanding._dragOut(this.lastLanding)}this.lastLanding=c;this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding,this.dragStartNode,a.clientX,a.clientY,a);this.lastLanding_scr=(_isIE?a.srcElement:a.target)}else{if((c)&&(c.tagName!="BODY")){this.checkLanding(c.parentNode,a)}else{if(this.lastLanding){this.lastLanding.dragLanding._dragOut(this.lastLanding,a.clientX,a.clientY,a)}this.lastLanding=0;if(this._onNotFound){this._onNotFound()}}}};dhtmlDragAndDropObject.prototype.stopDrag=function(c,g){dragger=window.dhtmlDragAndDrop;if(!g){dragger.stopFrameRoute();var a=dragger.lastLanding;dragger.lastLanding=null;if(a){a.dragLanding._drag(dragger.dragStartNode,dragger.dragStartObject,a,(_isIE?event.srcElement:c.target))}}dragger.lastLanding=null;if((dragger.dragNode)&&(dragger.dragNode.parentNode==document.body)){dragger.dragNode.parentNode.removeChild(dragger.dragNode)}dragger.dragNode=0;dragger.gldragNode=0;dragger.fx=0;dragger.fy=0;dragger.dragStartNode=0;dragger.dragStartObject=0;document.body.onmouseup=dragger.tempDOMU;document.body.onmousemove=dragger.tempDOMM;dragger.tempDOMU=null;dragger.tempDOMM=null;dragger.waitDrag=0};dhtmlDragAndDropObject.prototype.stopFrameRoute=function(g){if(g){window.dhtmlDragAndDrop.stopDrag(1,1)}for(var a=0;a<window.frames.length;a++){try{if((window.frames[a]!=g)&&(window.frames[a].dhtmlDragAndDrop)){window.frames[a].dhtmlDragAndDrop.stopFrameRoute(window)}}catch(c){}}try{if((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=g)){parent.dhtmlDragAndDrop.stopFrameRoute(window)}}catch(c){}};dhtmlDragAndDropObject.prototype.initFrameRoute=function(g,h){if(g){window.dhtmlDragAndDrop.preCreateDragCopy();window.dhtmlDragAndDrop.dragStartNode=g.dhtmlDragAndDrop.dragStartNode;window.dhtmlDragAndDrop.dragStartObject=g.dhtmlDragAndDrop.dragStartObject;window.dhtmlDragAndDrop.dragNode=g.dhtmlDragAndDrop.dragNode;window.dhtmlDragAndDrop.gldragNode=g.dhtmlDragAndDrop.dragNode;window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;window.waitDrag=0;if(((!_isIE)&&(h))&&((!_isFF)||(_FFrv<1.8))){window.dhtmlDragAndDrop.calculateFramePosition()}}try{if((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=g)){parent.dhtmlDragAndDrop.initFrameRoute(window)}}catch(c){}for(var a=0;a<window.frames.length;a++){try{if((window.frames[a]!=g)&&(window.frames[a].dhtmlDragAndDrop)){window.frames[a].dhtmlDragAndDrop.initFrameRoute(window,((!g||h)?1:0))}}catch(c){}}};_isFF=false;_isIE=false;_isOpera=false;_isKHTML=false;_isMacOS=false;_isChrome=false;_FFrv=false;_KHTMLrv=false;_OperaRv=false;if(navigator.userAgent.indexOf("Macintosh")!=-1){_isMacOS=true}if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){_isChrome=true}if((navigator.userAgent.indexOf("Safari")!=-1)||(navigator.userAgent.indexOf("Konqueror")!=-1)){_KHTMLrv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari")+7,5));if(_KHTMLrv>525){_isFF=true;_FFrv=1.9}else{_isKHTML=true}}else{if(navigator.userAgent.indexOf("Opera")!=-1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6,3))}else{if(navigator.appName.indexOf("Microsoft")!=-1){_isIE=true;if((navigator.appVersion.indexOf("MSIE 8.0")!=-1||navigator.appVersion.indexOf("MSIE 9.0")!=-1||navigator.appVersion.indexOf("MSIE 10.0")!=-1||document.documentMode>7)&&document.compatMode!="BackCompat"){_isIE=8}}else{if(navigator.appName=="Netscape"&&navigator.userAgent.indexOf("Trident")!=-1){_isIE=8}else{_isFF=true;_FFrv=parseFloat(navigator.userAgent.split("rv:")[1])}}}}if(typeof(window.dhtmlxEvent)=="undefined"){function dhtmlxEvent(c,e,a){if(c.addEventListener){c.addEventListener(e,a,false)}else{if(c.attachEvent){c.attachEvent("on"+e,a)}}}}if(dhtmlxEvent.touchDelay==null){dhtmlxEvent.touchDelay=2000}if(typeof(dhtmlxEvent.initTouch)=="undefined"){dhtmlxEvent.initTouch=function(){var g;var h;var c,a;dhtmlxEvent(document.body,"touchstart",function(j){h=j.touches[0].target;c=j.touches[0].clientX;a=j.touches[0].clientY;g=window.setTimeout(e,dhtmlxEvent.touchDelay)});function e(){if(h){var j=document.createEvent("HTMLEvents");j.initEvent("dblclick",true,true);h.dispatchEvent(j);g=h=null}}dhtmlxEvent(document.body,"touchmove",function(j){if(g){if(Math.abs(j.touches[0].clientX-c)>50||Math.abs(j.touches[0].clientY-a)>50){window.clearTimeout(g);g=h=false}}});dhtmlxEvent(document.body,"touchend",function(j){if(g){window.clearTimeout(g);g=h=false}});dhtmlxEvent.initTouch=function(){}}}if(!window.dhtmlx){dhtmlx={}}dhtmlx.assert=function(c,a){if(!c){dhtmlx.error(a)}};dhtmlx.assert_enabled=function(){return false};dhtmlx.assert_event=function(j,e){if(!j._event_check){j._event_check={};j._event_check_size={}}for(var c in e){j._event_check[c.toLowerCase()]=e[c];var h=-1;for(var g in e[c]){h++}j._event_check_size[c.toLowerCase()]=h}};dhtmlx.assert_method_info=function(h,c,g,j){var a=[];for(var e=0;e<j.length;e++){a.push(j[e][0]+" : "+j[e][1]+"\n "+j[e][2].describe()+(j[e][3]?"; optional":""))}return h.name+"."+c+"\n"+g+"\n Arguments:\n - "+a.join("\n - ")};dhtmlx.assert_method=function(e,a){for(var c in a){dhtmlx.assert_method_process(e,c,a[c].descr,a[c].args,(a[c].min||99),a[c].skip)}};dhtmlx.assert_method_process=function(j,c,h,l,e,g){var a=j[c];if(!g){j[c]=function(){if(arguments.length!=l.length&&arguments.length<e){dhtmlx.log("warn","Incorrect count of parameters\n"+j[c].describe()+"\n\nExpecting "+l.length+" but have only "+arguments.length)}else{for(var m=0;m<l.length;m++){if(!l[m][3]&&!l[m][2](arguments[m])){dhtmlx.log("warn","Incorrect method call\n"+j[c].describe()+"\n\nActual value of "+(m+1)+" parameter: {"+(typeof arguments[m])+"} "+arguments[m])}}}return a.apply(this,arguments)}}j[c].describe=function(){return dhtmlx.assert_method_info(j,c,h,l)}};dhtmlx.assert_event_call=function(e,c,a){if(e._event_check){if(!e._event_check[c]){dhtmlx.log("warn","Not expected event call :"+c)}else{if(dhtmlx.isNotDefined(a)){dhtmlx.log("warn","Event without parameters :"+c)}else{if(e._event_check_size[c]!=a.length){dhtmlx.log("warn","Incorrect event call, expected "+e._event_check_size[c]+" parameter(s), but have "+a.length+" parameter(s), for "+c+" event")}}}}};dhtmlx.assert_event_attach=function(c,a){if(c._event_check&&!c._event_check[a]){dhtmlx.log("warn","Unknown event name: "+a)}};dhtmlx.assert_property=function(c,a){if(!c._settings_check){c._settings_check={}}dhtmlx.extend(c._settings_check,a)};dhtmlx.assert_check=function(e,c){if(typeof e=="object"){for(var a in e){dhtmlx.assert_settings(a,e[a],c)}}};dhtmlx.assert_settings=function(m,h,g){g=g||this._settings_check;if(g){if(!g[m]){return dhtmlx.log("warn","Unknown propery: "+m)}var l="";var c="";var a=false;for(var e=0;e<g[m].length;e++){var j=g[m][e];if(typeof j=="string"){continue}if(typeof j=="function"){a=a||j(h)}else{if(typeof j=="object"&&typeof j[1]=="function"){a=a||j[1](h);if(a&&j[2]){dhtmlx.assert_check(h,j[2])}}}if(a){break}}if(!a){dhtmlx.log("warn","Invalid configuration\n"+dhtmlx.assert_info(m,g)+"\nActual value: {"+(typeof h)+"} "+h)}}};dhtmlx.assert_info=function(c,j){var a=j[c];var h="";var g=[];for(var e=0;e<a.length;e++){if(typeof rule=="string"){h=a[e]}else{if(a[e].describe){g.push(a[e].describe())}else{if(a[e][1]&&a[e][1].describe){g.push(a[e][1].describe())}}}}return"Property: "+c+", "+h+" \nExpected value: \n - "+g.join("\n - ")};if(dhtmlx.assert_enabled()){dhtmlx.assert_rule_color=function(a){if(typeof a!="string"){return false}if(a.indexOf("#")!==0){return false}if(a.substr(1).replace(/[0-9A-F]/gi,"")!==""){return false}return true};dhtmlx.assert_rule_color.describe=function(){return"{String} Value must start from # and contain hexadecimal code of color"};dhtmlx.assert_rule_template=function(a){if(typeof a=="function"){return true}if(typeof a=="string"){return true}return false};dhtmlx.assert_rule_template.describe=function(){return"{Function},{String} Value must be a function which accepts data object and return text string, or a sting with optional template markers"};dhtmlx.assert_rule_boolean=function(a){if(typeof a=="boolean"){return true}return false};dhtmlx.assert_rule_boolean.describe=function(){return"{Boolean} true or false"};dhtmlx.assert_rule_object=function(a,c){if(typeof a=="object"){return true}return false};dhtmlx.assert_rule_object.describe=function(){return"{Object} Configuration object"};dhtmlx.assert_rule_string=function(a){if(typeof a=="string"){return true}return false};dhtmlx.assert_rule_string.describe=function(){return"{String} Plain string"};dhtmlx.assert_rule_htmlpt=function(a){return !!dhtmlx.toNode(a)};dhtmlx.assert_rule_htmlpt.describe=function(){return"{Object},{String} HTML node or ID of HTML Node"};dhtmlx.assert_rule_notdocumented=function(a){return false};dhtmlx.assert_rule_notdocumented.describe=function(){return"This options wasn't documented"};dhtmlx.assert_rule_key=function(c){var a=function(e){return c[e]};a.describe=function(){var g=[];for(var e in c){g.push(e)}return"{String} can take one of next values: "+g.join(", ")};return a};dhtmlx.assert_rule_dimension=function(a){if(a*1==a&&!isNaN(a)&&a>=0){return true}return false};dhtmlx.assert_rule_dimension.describe=function(){return"{Integer} value must be a positive number"};dhtmlx.assert_rule_number=function(a){if(typeof a=="number"){return true}return false};dhtmlx.assert_rule_number.describe=function(){return"{Integer} value must be a number"};dhtmlx.assert_rule_function=function(a){if(typeof a=="function"){return true}return false};dhtmlx.assert_rule_function.describe=function(){return"{Function} value must be a custom function"};dhtmlx.assert_rule_any=function(a){return true};dhtmlx.assert_rule_any.describe=function(){return"Any value"};dhtmlx.assert_rule_mix=function(e,c){var g=function(a){if(e(a)||c(a)){return true}return false};g.describe=function(){return e.describe()};return g}}dhtmlx.codebase="./";dhtmlx.copy=function(c){var a=dhtmlx.copy._function;a.prototype=c;return new a()};dhtmlx.copy._function=function(){};dhtmlx.extend=function(c,a){for(var e in a){c[e]=a[e]}if(dhtmlx.assert_enabled()&&a._assert){c._assert();c._assert=null}dhtmlx.assert(c,"Invalid nesting target");dhtmlx.assert(a,"Invalid nesting source");if(a._init){c._init()}return c};dhtmlx.proto_extend=function(){var j=arguments;var e=j[0];var c=[];for(var h=j.length-1;h>0;h--){if(typeof j[h]=="function"){j[h]=j[h].prototype}for(var g in j[h]){if(g=="_init"){c.push(j[h][g])}else{if(!e[g]){e[g]=j[h][g]}}}}if(j[0]._init){c.push(j[0]._init)}e._init=function(){for(var l=0;l<c.length;l++){c[l].apply(this,arguments)}};e.base=j[1];var a=function(l){this._init(l);if(this._parseSettings){this._parseSettings(l,this.defaults)}};a.prototype=e;e=j=null;return a};dhtmlx.bind=function(c,a){return function(){return c.apply(a,arguments)}};dhtmlx.require=function(a){if(!dhtmlx._modules[a]){dhtmlx.assert(dhtmlx.ajax,"load module is required");dhtmlx.exec(dhtmlx.ajax().sync().get(dhtmlx.codebase+a).responseText);dhtmlx._modules[a]=true}};dhtmlx._modules={};dhtmlx.exec=function(code){if(window.execScript){window.execScript(code)}else{window.eval(code)}};dhtmlx.methodPush=function(a,e,c){return function(){var g=false;g=a[e].apply(a,arguments);return g}};dhtmlx.isNotDefined=function(c){return typeof c=="undefined"};dhtmlx.delay=function(g,c,e,a){setTimeout(function(){var h=g.apply(c,e);g=c=e=null;return h},a||1)};dhtmlx.uid=function(){if(!this._seed){this._seed=(new Date).valueOf()}this._seed++;return this._seed};dhtmlx.toNode=function(a){if(typeof a=="string"){return document.getElementById(a)}return a};dhtmlx.toArray=function(a){return dhtmlx.extend((a||[]),dhtmlx.PowerArray)};dhtmlx.toFunctor=function(str){return(typeof(str)=="string")?eval(str):str};dhtmlx._events={};dhtmlx.event=function(g,e,a,c){g=dhtmlx.toNode(g);var h=dhtmlx.uid();dhtmlx._events[h]=[g,e,a];if(c){a=dhtmlx.bind(a,c)}if(g.addEventListener){g.addEventListener(e,a,false)}else{if(g.attachEvent){g.attachEvent("on"+e,a)}}return h};dhtmlx.eventRemove=function(c){if(!c){return}dhtmlx.assert(this._events[c],"Removing non-existing event");var a=dhtmlx._events[c];if(a[0].removeEventListener){a[0].removeEventListener(a[1],a[2],false)}else{if(a[0].detachEvent){a[0].detachEvent("on"+a[1],a[2])}}delete this._events[c]};dhtmlx.log=function(c,e,a){if(window.console&&console.log){c=c.toLowerCase();if(window.console[c]){window.console[c](e||"unknown error")}else{window.console.log(c+": "+e)}if(a){window.console.log(a)}}};dhtmlx.log_full_time=function(a){dhtmlx._start_time_log=new Date();dhtmlx.log("Info","Timing start ["+a+"]");window.setTimeout(function(){var c=new Date();dhtmlx.log("Info","Timing end ["+a+"]:"+(c.valueOf()-dhtmlx._start_time_log.valueOf())/1000+"s")},1)};dhtmlx.log_time=function(a){var e="_start_time_log"+a;if(!dhtmlx[e]){dhtmlx[e]=new Date();dhtmlx.log("Info","Timing start ["+a+"]")}else{var c=new Date();dhtmlx.log("Info","Timing end ["+a+"]:"+(c.valueOf()-dhtmlx[e].valueOf())/1000+"s");dhtmlx[e]=null}};dhtmlx.error=function(c,a){dhtmlx.log("error",c,a)};dhtmlx.EventSystem={_init:function(){this._events={};this._handlers={};this._map={}},block:function(){this._events._block=true},unblock:function(){this._events._block=false},mapEvent:function(a){dhtmlx.extend(this._map,a)},callEvent:function(e,h){if(this._events._block){return true}e=e.toLowerCase();dhtmlx.assert_event_call(this,e,h);var g=this._events[e.toLowerCase()];var a=true;if(dhtmlx.debug){dhtmlx.log("info","["+this.name+"] event:"+e,h)}if(g){for(var c=0;c<g.length;c++){if(g[c].apply(this,(h||[]))===false){a=false}}}if(this._map[e]&&!this._map[e].callEvent(e,h)){a=false}return a},attachEvent:function(c,a,g){c=c.toLowerCase();dhtmlx.assert_event_attach(this,c);g=g||dhtmlx.uid();a=dhtmlx.toFunctor(a);var e=this._events[c]||dhtmlx.toArray();e.push(a);this._events[c]=e;this._handlers[g]={f:a,t:c};return g},detachEvent:function(g){if(this._handlers[g]){var c=this._handlers[g].t;var a=this._handlers[g].f;var e=this._events[c];e.remove(a);delete this._handlers[g]}}};dhtmlx.PowerArray={removeAt:function(c,a){if(c>=0){this.splice(c,(a||1))}},remove:function(a){this.removeAt(this.find(a))},insertAt:function(c,e){if(!e&&e!==0){this.push(c)}else{var a=this.splice(e,(this.length-e));this[e]=c;this.push.apply(this,a)}},find:function(a){for(i=0;i<this.length;i++){if(a==this[i]){return i}}return -1},each:function(a,e){for(var c=0;c<this.length;c++){a.call((e||this),this[c])}},map:function(a,e){for(var c=0;c<this.length;c++){this[c]=a.call((e||this),this[c])}return this}};dhtmlx.env={};if(navigator.userAgent.indexOf("Opera")!=-1){dhtmlx._isOpera=true}else{dhtmlx._isIE=!!document.all;dhtmlx._isFF=!document.all;dhtmlx._isWebKit=(navigator.userAgent.indexOf("KHTML")!=-1);if(navigator.appVersion.indexOf("MSIE 8.0")!=-1&&document.compatMode!="BackCompat"){dhtmlx._isIE=8}if(navigator.appVersion.indexOf("MSIE 9.0")!=-1&&document.compatMode!="BackCompat"){dhtmlx._isIE=9}}dhtmlx.env={};(function(){dhtmlx.env.transform=false;dhtmlx.env.transition=false;var a={};a.names=["transform","transition"];a.transform=["transform","WebkitTransform","MozTransform","oTransform","msTransform"];a.transition=["transition","WebkitTransition","MozTransition","oTransition"];var g=document.createElement("DIV");var e;for(var c=0;c<a.names.length;c++){while(p=a[a.names[c]].pop()){if(typeof g.style[p]!="undefined"){dhtmlx.env[a.names[c]]=true}}}})();dhtmlx.env.transform_prefix=(function(){var a;if(dhtmlx._isOpera){a="-o-"}else{a="";if(dhtmlx._isFF){a="-moz-"}if(dhtmlx._isWebKit){a="-webkit-"}}return a})();dhtmlx.env.svg=(function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")})();dhtmlx.zIndex={drag:10000};dhtmlx.html={create:function(c,a,e){a=a||{};var g=document.createElement(c);for(var h in a){g.setAttribute(h,a[h])}if(a.style){g.style.cssText=a.style}if(a["class"]){g.className=a["class"]}if(e){g.innerHTML=e}return g},getValue:function(a){a=dhtmlx.toNode(a);if(!a){return""}return dhtmlx.isNotDefined(a.value)?a.innerHTML:a.value},remove:function(c){if(c instanceof Array){for(var a=0;a<c.length;a++){this.remove(c[a])}}else{if(c&&c.parentNode){c.parentNode.removeChild(c)}}},insertBefore:function(c,e,a){if(!c){return}if(e){e.parentNode.insertBefore(c,e)}else{a.appendChild(c)}},locate:function(c,h){c=c||event;var a=c.target||c.srcElement;while(a){if(a.getAttribute){var g=a.getAttribute(h);if(g){return g}}a=a.parentNode}return null},offset:function(g){if(g.getBoundingClientRect){var l=g.getBoundingClientRect();var m=document.body;var c=document.documentElement;var a=window.pageYOffset||c.scrollTop||m.scrollTop;var h=window.pageXOffset||c.scrollLeft||m.scrollLeft;var j=c.clientTop||m.clientTop||0;var n=c.clientLeft||m.clientLeft||0;var o=l.top+a-j;var e=l.left+h-n;return{y:Math.round(o),x:Math.round(e)}}else{var o=0,e=0;while(g){o=o+parseInt(g.offsetTop,10);e=e+parseInt(g.offsetLeft,10);g=g.offsetParent}return{y:o,x:e}}},pos:function(a){a=a||event;if(a.pageX||a.pageY){return{x:a.pageX,y:a.pageY}}var c=((dhtmlx._isIE)&&(document.compatMode!="BackCompat"))?document.documentElement:document.body;return{x:a.clientX+c.scrollLeft-c.clientLeft,y:a.clientY+c.scrollTop-c.clientTop}},preventEvent:function(a){if(a&&a.preventDefault){a.preventDefault()}dhtmlx.html.stopEvent(a)},stopEvent:function(a){(a||event).cancelBubble=true;return false},addCss:function(c,a){c.className+=" "+a},removeCss:function(c,a){c.className=c.className.replace(RegExp(a,"g"),"")}};(function(){var a=document.getElementsByTagName("SCRIPT");dhtmlx.assert(a.length,"Can't locate codebase");if(a.length){a=(a[a.length-1].getAttribute("src")||"").split("/");a.splice(a.length-1,1);dhtmlx.codebase=a.slice(0,a.length).join("/")+"/"}})();if(!dhtmlx.ui){dhtmlx.ui={}}dhtmlx.Destruction={_init:function(){dhtmlx.destructors.push(this)},destructor:function(){this.destructor=function(){};this._htmlmap=null;this._htmlrows=null;if(this._html){document.body.appendChild(this._html)}this._html=null;if(this._obj){this._obj.innerHTML="";this._obj._htmlmap=null}this._obj=this._dataobj=null;this.data=null;this._events=this._handlers={};if(this.render){this.render=function(){}}}};dhtmlx.destructors=[];dhtmlx.event(window,"unload",function(){if(dhtmlx.destructors){for(var e=0;e<dhtmlx.destructors.length;e++){dhtmlx.destructors[e].destructor()}dhtmlx.destructors=[]}for(var c in dhtmlx._events){var g=dhtmlx._events[c];if(g[0].removeEventListener){g[0].removeEventListener(g[1],g[2],false)}else{if(g[0].detachEvent){g[0].detachEvent("on"+g[1],g[2])}}delete dhtmlx._events[c]}});dhtmlx.ajax=function(a,c,e){if(arguments.length!==0){var g=new dhtmlx.ajax();if(e){g.master=e}g.get(a,null,c)}if(!this.getXHR){return new dhtmlx.ajax()}return this};dhtmlx.ajax.prototype={getXHR:function(){if(dhtmlx._isIE){return new ActiveXObject("Microsoft.xmlHTTP")}else{return new XMLHttpRequest()}},send:function(h,n,l){var c=this.getXHR();if(typeof l=="function"){l=[l]}if(typeof n=="object"){var j=[];for(var e in n){var m=n[e];if(m===null||m===dhtmlx.undefined){m=""}j.push(e+"="+encodeURIComponent(m))}n=j.join("&")}if(n&&!this.post){h=h+(h.indexOf("?")!=-1?"&":"?")+n;n=null}c.open(this.post?"POST":"GET",h,!this._sync);if(this.post){c.setRequestHeader("Content-type","application/x-www-form-urlencoded")}var g=this;c.onreadystatechange=function(){if(!c.readyState||c.readyState==4){if(l&&g){for(var a=0;a<l.length;a++){if(l[a]){l[a].call((g.master||g),c.responseText,c.responseXML,c)}}}g.master=null;l=g=null}};c.send(n||null);return c},get:function(a,e,c){this.post=false;return this.send(a,e,c)},post:function(a,e,c){this.post=true;return this.send(a,e,c)},sync:function(){this._sync=true;return this}};dhtmlx.AtomDataLoader={_init:function(a){this.data={};if(a){this._settings.datatype=a.datatype||"json";this._after_init.push(this._load_when_ready)}},_load_when_ready:function(){this._ready_for_data=true;if(this._settings.url){this.url_setter(this._settings.url)}if(this._settings.data){this.data_setter(this._settings.data)}},url_setter:function(a){if(!this._ready_for_data){return a}this.load(a,this._settings.datatype);return a},data_setter:function(a){if(!this._ready_for_data){return a}this.parse(a,this._settings.datatype);return true},load:function(a,c){this.callEvent("onXLS",[]);if(typeof c=="string"){this.data.driver=dhtmlx.DataDriver[c];c=arguments[2]}else{this.data.driver=dhtmlx.DataDriver[this._settings.datatype||"xml"]}if(window.dhx4){dhx4.ajax.get(a,dhtmlx.bind(function(g){var e=g.xmlDoc;var j=e.responseText;var h=e.responseXML;if(this._onLoad){this._onLoad.call(this,j,h,e)}if(c){c.call(this,j,h,e)}},this))}else{dhtmlx.ajax(a,[this._onLoad,c],this)}},parse:function(c,a){this.callEvent("onXLS",[]);this.data.driver=dhtmlx.DataDriver[a||"xml"];this._onLoad(c,null)},_onLoad:function(h,c,a){var e=this.data.driver;var g=e.getRecords(e.toObject(h,c))[0];this.data=(e?e.getDetails(g):h);this.callEvent("onXLE",[])},_check_data_feed:function(c){if(!this._settings.dataFeed||this._ignore_feed||!c){return true}var a=this._settings.dataFeed;if(typeof a=="function"){return a.call(this,(c.id||c),c)}a=a+(a.indexOf("?")==-1?"?":"&")+"action=get&id="+encodeURIComponent(c.id||c);this.callEvent("onXLS",[]);dhtmlx.ajax(a,function(g,e){this._ignore_feed=true;this.setValues(dhtmlx.DataDriver.json.toObject(g)[0]);this._ignore_feed=false;this.callEvent("onXLE",[])},this);return false}};dhtmlx.DataDriver={};dhtmlx.DataDriver.json={toObject:function(data){if(!data){data="[]"}if(typeof data=="string"){eval("dhtmlx.temp="+data);return dhtmlx.temp}return data},getRecords:function(a){if(a&&a.data){a=a.data}if(a&&!(a instanceof Array)){return[a]}return a},getDetails:function(a){return a},getInfo:function(a){return{_size:(a.total_count||0),_from:(a.pos||0),_key:(a.dhx_security)}}};dhtmlx.DataDriver.json_ext={toObject:function(data){if(!data){data="[]"}if(typeof data=="string"){var temp;eval("temp="+data);dhtmlx.temp=[];var header=temp.header;for(var i=0;i<temp.data.length;i++){var item={};for(var j=0;j<header.length;j++){if(typeof(temp.data[i][j])!="undefined"){item[header[j]]=temp.data[i][j]}}dhtmlx.temp.push(item)}return dhtmlx.temp}return data},getRecords:function(a){if(a&&!(a instanceof Array)){return[a]}return a},getDetails:function(a){return a},getInfo:function(a){return{_size:(a.total_count||0),_from:(a.pos||0)}}};dhtmlx.DataDriver.html={toObject:function(c){if(typeof c=="string"){var a=null;if(c.indexOf("<")==-1){a=dhtmlx.toNode(c)}if(!a){a=document.createElement("DIV");a.innerHTML=c}return a.getElementsByTagName(this.tag)}return c},getRecords:function(a){if(a.tagName){return a.childNodes}return a},getDetails:function(a){return dhtmlx.DataDriver.xml.tagToObject(a)},getInfo:function(a){return{_size:0,_from:0}},tag:"LI"};dhtmlx.DataDriver.jsarray={toObject:function(data){if(typeof data=="string"){eval("dhtmlx.temp="+data);return dhtmlx.temp}return data},getRecords:function(a){return a},getDetails:function(e){var a={};for(var c=0;c<e.length;c++){a["data"+c]=e[c]}return a},getInfo:function(a){return{_size:0,_from:0}}};dhtmlx.DataDriver.csv={toObject:function(a){return a},getRecords:function(a){return a.split(this.row)},getDetails:function(e){e=this.stringToArray(e);var a={};for(var c=0;c<e.length;c++){a["data"+c]=e[c]}return a},getInfo:function(a){return{_size:0,_from:0}},stringToArray:function(c){c=c.split(this.cell);for(var a=0;a<c.length;a++){c[a]=c[a].replace(/^[ \t\n\r]*(\"|)/g,"").replace(/(\"|)[ \t\n\r]*$/g,"")}return c},row:"\n",cell:","};dhtmlx.DataDriver.xml={toObject:function(c,a){if(a&&(a=this.checkResponse(c,a))){return a}if(typeof c=="string"){return this.fromString(c)}return c},getRecords:function(a){return this.xpath(a,this.records)},records:"/*/item",getDetails:function(a){return this.tagToObject(a,{})},getInfo:function(a){return{_size:(a.documentElement.getAttribute("total_count")||0),_from:(a.documentElement.getAttribute("pos")||0),_key:(a.documentElement.getAttribute("dhx_security"))}},xpath:function(h,o){if(window.XPathResult){var g=h;if(h.nodeName.indexOf("document")==-1){h=h.ownerDocument}var m=[];var c=h.evaluate(o,g,null,XPathResult.ANY_TYPE,null);var n=c.iterateNext();while(n){m.push(n);n=c.iterateNext()}return m}else{var l=true;try{i