reservation plugin - unbound request (unclean
[unfold.git] / portal / static / unbound_reservation_static / js / dhtmlx.js
diff --git a/portal/static/unbound_reservation_static/js/dhtmlx.js b/portal/static/unbound_reservation_static/js/dhtmlx.js
new file mode 100644 (file)
index 0000000..4a2cef1
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+Product Name: dhtmlxSuite 
+Version: 4.2 
+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.dhx4)=="undefined"){window.dhx4={version:"4.2",skin:null,skinDetect:function(a){return{10:"dhx_skyblue",20:"dhx_web",30:"dhx_terrace"}[this.readFromCss(a+"_skin_detect")]||null},readFromCss:function(g,j){var c=document.createElement("DIV");c.className=g;if(document.body.firstChild!=null){document.body.insertBefore(c,document.body.firstChild)}else{document.body.appendChild(c)}var a=c[j||"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 g=this.first();for(var c in this.data){g=Math.max(g,this.data[c])}return g},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")},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 g=0,c=0;while(a){g=g+parseInt(a.offsetTop);c=c+parseInt(a.offsetLeft);a=a.offsetParent}return{top:g,left:c}},_aOfsRect:function(j){var n=j.getBoundingClientRect();var o=document.body;var c=document.documentElement;var a=window.pageYOffset||c.scrollTop||o.scrollTop;var l=window.pageXOffset||c.scrollLeft||o.scrollLeft;var m=c.clientTop||o.clientTop||0;var q=c.clientLeft||o.clientLeft||0;var r=n.top+a-m;var g=n.left+l-q;return{top:Math.round(r),left:Math.round(g)}},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(j){if(this._isObj(j)){var g={};for(var c in j){if(typeof(j[c])=="object"&&j[c]!=null){g[c]=this._copyObj(j[c])}else{g[c]=j[c]}}}else{var g=[];for(var c=0;c<j.length;c++){if(typeof(j[c])=="object"&&j[c]!=null){g[c]=this._copyObj(j[c])}else{g[c]=j[c]}}}return g},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(j,m,c){j=(typeof(j)=="string"?document.getElementById(j):j);var a=j.value.length;m=Math.max(Math.min(m,a),0);c=Math.min(c,a);if(j.setSelectionRange){try{j.setSelectionRange(m,c)}catch(l){}}else{if(j.createTextRange){var g=j.createTextRange();g.moveStart("character",m);g.moveEnd("character",c-a);try{g.select()}catch(l){}}}},transData:null,transDetect:function(){if(this.transData==null){this.transData={transProp:false,transEv:null};var g={MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd",OTransition:"oTransitionEnd",msTransition:"transitionend",transition:"transitionend"};for(var c in g){if(this.transData.transProp==false&&document.documentElement.style[c]!=null){this.transData.transProp=c;this.transData.transEv=g[c]}}g=null}return this.transData},_xmlNodeValue:function(a){var g="";for(var c=0;c<a.childNodes.length;c++){g+=(a.childNodes[c].nodeValue!=null?a.childNodes[c].nodeValue.toString().replace(/^[\n\r\s]{0,}/,"").replace(/[\n\r\s]{0,}$/,""):"")}return g}};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.isOpera=(navigator.userAgent.indexOf("Opera")>=0);window.dhx4.isChrome=(navigator.userAgent.indexOf("Chrome")>=0);window.dhx4.isKHTML=(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0);window.dhx4.isFF=(navigator.userAgent.indexOf("Firefox")>=0);window.dhx4.isIPad=(navigator.userAgent.search(/iPad/gi)>=0)}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,g,a){return c.replace(/#([a-z0-9_-]{1,})(\|([^#]*))?#/gi,function(){var n=arguments[1];var m=window.dhx4.trim(arguments[3]);var o=null;var l=[g[n]];if(m.length>0){m=m.split(":");var j=[];for(var r=0;r<m.length;r++){if(r>0&&j[j.length-1].match(/\\$/)!=null){j[j.length-1]=j[j.length-1].replace(/\\$/,"")+":"+m[r]}else{j.push(m[r])}}o=j[0];for(var r=1;r<j.length;r++){l.push(j[r])}}if(typeof(o)=="string"&&typeof(window.dhx4.template[o])=="function"){return window.dhx4.template[o].apply(window.dhx4.template,l)}if(n.length>0&&typeof(g[n])!="undefined"){if(a==true){return window.dhx4.trim(g[n])}return String(g[n])}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(j,l,g,a){var c=window.dhx4.template._parseFmt(l,g,a);if(c==false){return j}return window.dhx4.template._getFmtValue(j,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(n,g,a){var j=n.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/);if(j==null||j.length!=4){return false}var c={i_len:false,i_sep:(typeof(g)=="string"?g:","),d_len:false,d_sep:(typeof(a)=="string"?a:"."),s_bef:(typeof(j[1])=="string"?j[1]:""),s_aft:(typeof(j[3])=="string"?j[3]:"")};var m=j[2].split(".");if(m[1]!=null){c.d_len=m[1].length}var l=m[0].split(",");if(l.length>1){c.i_len=l[l.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(m,j,a){if(j==null||typeof(j)=="undefnied"){j=window.dhx4.dateFormat[window.dhx4.dateLang]}if(a==null||typeof(a)=="undefnied"){a=window.dhx4.dateStrings[window.dhx4.dateLang]}if(m instanceof Date){var l=function(n){return(String(n).length==1?"0"+String(n):n)};var c=function(o){switch(o){case"%d":return l(m.getDate());case"%j":return m.getDate();case"%D":return a.dayShortName[m.getDay()];case"%l":return a.dayFullName[m.getDay()];case"%m":return l(m.getMonth()+1);case"%n":return m.getMonth()+1;case"%M":return a.monthShortName[m.getMonth()];case"%F":return a.monthFullName[m.getMonth()];case"%y":return l(m.getYear()%100);case"%Y":return m.getFullYear();case"%g":return(m.getHours()+11)%12+1;case"%h":return l((m.getHours()+11)%12+1);case"%G":return m.getHours();case"%H":return l(m.getHours());case"%i":return l(m.getMinutes());case"%s":return l(m.getSeconds());case"%a":return(m.getHours()>11?"pm":"am");case"%A":return(m.getHours()>11?"PM":"AM");case"%%":return"%";case"%u":return m.getMilliseconds();case"%P":if(window.dhx4.temp_calendar!=null&&window.dhx4.temp_calendar.tz!=null){return window.dhx4.temp_calendar.tz}var r=m.getTimezoneOffset();var q=Math.abs(Math.floor(r/60));var n=Math.abs(r)-q*60;return(r>0?"-":"+")+l(q)+":"+l(n);default:return o}};var g=String(j||window.dhx4.dateFormat).replace(/%[a-zA-Z]/g,c)}return(g||String(m))};window.dhx4.str2date=function(l,A,E){if(A==null||typeof(A)=="undefnied"){A=window.dhx4.dateFormat[window.dhx4.dateLang]}if(E==null||typeof(E)=="undefnied"){E=window.dhx4.dateStrings[window.dhx4.dateLang]}A=A.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g,"\\$&");var D=[];var o=[];A=A.replace(/%[a-z]/gi,function(q){switch(q){case"%d":case"%m":case"%y":case"%h":case"%H":case"%i":case"%s":o.push(q);return"(\\d{2})";case"%D":case"%l":case"%M":case"%F":o.push(q);return"([a-zéûä\u0430-\u044F\u0451]{1,})";case"%j":case"%n":case"%g":case"%G":o.push(q);return"(\\d{1,2})";case"%Y":o.push(q);return"(\\d{4})";case"%a":o.push(q);return"([am|pm])";case"%A":o.push(q);return"([AM|PM])";case"%u":o.push(q);return"(\\d{1,6})";case"%P":o.push(q);return"([+-]\\d{1,2}:\\d{1,2})"}return q});var F=new RegExp(A,"i");var s=l.match(F);if(s==null||s.length-1!=o.length){return"Invalid Date"}for(var c=1;c<s.length;c++){D.push(s[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 u={};var n={};for(var c=0;c<o.length;c++){if(typeof(g[o[c]])!="undefined"){var j=g[o[c]];if(!u[j]){u[j]=[];n[j]=[]}u[j].push(D[c]);n[j].push(o[c])}}D=[];o=[];for(var c=1;c<=7;c++){if(u[c]!=null){for(var y=0;y<u[c].length;y++){D.push(u[c][y]);o.push(n[c][y])}}}var a=new Date();a.setDate(1);a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);var x=function(w,r){for(var v=0;v<r.length;v++){if(r[v].toLowerCase()==w){return v}}return -1};for(var c=0;c<D.length;c++){switch(o[c]){case"%d":case"%j":case"%n":case"%m":case"%Y":case"%H":case"%G":case"%i":case"%s":case"%u":if(!isNaN(D[c])){a[{"%d":"setDate","%j":"setDate","%n":"setMonth","%m":"setMonth","%Y":"setFullYear","%H":"setHours","%G":"setHours","%i":"setMinutes","%s":"setSeconds","%u":"setMilliseconds"}[o[c]]](Number(D[c])+(o[c]=="%m"||o[c]=="%n"?-1:0))}break;case"%M":case"%F":var m=x(D[c].toLowerCase(),E[{"%M":"monthShortName","%F":"monthFullName"}[o[c]]]);if(m>=0){a.setMonth(m)}break;case"%y":if(!isNaN(D[c])){var C=Number(D[c]);a.setFullYear(C+(C>50?1900:2000))}break;case"%g":case"%h":if(!isNaN(D[c])){var C=Number(D[c]);if(C<=12&&C>=0){a.setHours(C+(x("pm",D)>=0?(C==12?0:12):(C==12?-12:0)))}}break;case"%P":if(window.dhx4.temp_calendar!=null){window.dhx4.temp_calendar.tz=D[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,j,g){if(typeof j.status=="undefined"||j.status<400){xml=(!j.responseXML)?dhx4.ajax.parse(j.responseText||j):(j.responseXML||j);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(l){return[]}}else{var j=[];var m;var c=(a.ownerDocument||a).evaluate(g,a,null,XPathResult.ANY_TYPE,null);while(m=c.iterateNext()){j.push(m)}return j}},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,g){return this._call("PUT",c,a,true,g)},del:function(c,a,g){return this._call("DELETE",c,a,true,g)},post:function(c,a,g){if(arguments.length==1){a=""}else{if(arguments.length==2&&(typeof(a)=="function"||typeof(window[a])=="function")){g=a;a=""}else{a=String(a)}}return this._call("POST",c,a,true,g)},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,g){if(arguments.length==2&&(typeof(a)=="function"||typeof(window[a]))){g=a;a=""}this._call("POST",c,a,true,g,{url:c,postData:a})},_call:function(a,c,g,l,n,r,j){var q=(window.XMLHttpRequest&&!dhx4.isIE?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"));var m=(navigator.userAgent.match(/AppleWebKit/)!=null&&navigator.userAgent.match(/Qt/)!=null&&navigator.userAgent.match(/Safari/)!=null);if(l==true){q.onreadystatechange=function(){if((q.readyState==4)||(m==true&&q.readyState==3)){if(q.status!=200||q.responseText==""){if(!dhx4.callEvent("onAjaxError",[q])){return}}window.setTimeout(function(){if(typeof(n)=="function"){n.apply(window,[{xmlDoc:q,filePath:c,async:l}])}if(r!=null){if(typeof(r.postData)!="undefined"){dhx4.ajax.postLong(r.url,r.postData,n)}else{dhx4.ajax.getLong(r.url,n)}}n=null;q=null},1)}}}if(a=="GET"&&this.cache!=true){c+=(c.indexOf("?")>=0?"&":"?")+"dhxr"+new Date().getTime()+"=1"}q.open(a,c,l);if(j!=null){for(var o in j){q.setRequestHeader(o,j[o])}}else{if(a=="POST"||a=="PUT"||a=="DELETE"){q.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}else{if(a=="GET"){g=null}}}q.setRequestHeader("X-Requested-With","XMLHttpRequest");q.send(g);return{xmlDoc:q,filePath:c,async:l}}}}if(typeof(window.dhx4._enableDataLoading)=="undefined"){window.dhx4._enableDataLoading=function(n,g,m,l,o){if(o=="clear"){for(var c in n._dhxdataload){n._dhxdataload[c]=null;delete n._dhxdataload[c]}n._loadData=null;n._dhxdataload=null;n.load=null;n.loadStruct=null;n=null;return}n._dhxdataload={initObj:g,xmlToJson:m,xmlRootTag:l,onBeforeXLS:null};n._loadData=function(v,w,x){if(arguments.length==2){x=w;w=null}var u=null;if(arguments.length==3){x=arguments[2]}if(typeof(v)=="string"){var s=v.replace(/^\s{1,}/,"").replace(/\s{1,}$/,"");var C=new RegExp("^<"+this._dhxdataload.xmlRootTag);if(C.test(s.replace(/^<\?xml[^\?]*\?>\s*/,""))){u=dhx4.ajax.parse(v);if(u!=null){u=this[this._dhxdataload.xmlToJson].apply(this,[u])}}if(u==null&&(s.match(/^\{.*\}$/)!=null||s.match(/^\[.*\]$/)!=null)){u=dhx4.s2j(s)}if(u==null){this.callEvent("onXLS",[]);var r=[];if(typeof(this._dhxdataload.onBeforeXLS)=="function"){var s=this._dhxdataload.onBeforeXLS.apply(this,[v]);if(s!=null&&typeof(s)=="object"){if(s.url!=null){v=s.url}if(s.params!=null){for(var y in s.params){r.push(y+"="+encodeURIComponent(s.params[y]))}}}}var A=this;var q=function(a){var D=null;if((a.xmlDoc.getResponseHeader("Content-Type")||"").search(/xml/gi)>=0||(a.xmlDoc.responseText.replace(/^\s{1,}/,"")).match(/^</)!=null){D=A[A._dhxdataload.xmlToJson].apply(A,[a.xmlDoc.responseXML])}else{D=dhx4.s2j(a.xmlDoc.responseText)}if(D!=null){A[A._dhxdataload.initObj].apply(A,[D,v])}A.callEvent("onXLE",[]);if(x!=null){if(typeof(x)=="function"){x.apply(A,[])}else{if(typeof(window[x])=="function"){window[x].apply(A,[])}}}q=x=null;D=a=A=null};r=r.join("&")+(typeof(w)=="string"?"&"+w:"");if(dhx4.ajax.method=="post"){dhx4.ajax.post(v,r,q)}else{if(dhx4.ajax.method=="get"){dhx4.ajax.get(v+(r.length>0?(v.indexOf("?")>0?"&":"?")+r:""),q)}}return}}else{if(typeof(v.documentElement)=="object"||(typeof(v.tagName)!="undefined"&&typeof(v.getElementsByTagName)!="undefined"&&v.getElementsByTagName(this._dhxdataload.xmlRootTag).length>0)){u=this[this._dhxdataload.xmlToJson].apply(this,[v])}else{u=window.dhx4._copyObj(v)}}if(u!=null){this[this._dhxdataload.initObj].apply(this,[u])}if(x!=null){if(typeof(x)=="function"){x.apply(this,[])}else{if(typeof(window[x])=="function"){window[x].apply(this,[])}}x=null}};if(o!=null){var j={struct:"loadStruct",data:"load"};for(var c in o){if(o[c]==true){n[j[c]]=function(){return this._loadData.apply(this,arguments)}}}}n=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(g,l){g=String(g).toLowerCase();if(!this.dhxevs.data[g]){this.dhxevs.data[g]={}}var j=window.dhx4.newId();this.dhxevs.data[g][j]=l;return j};a.detachEvent=function(m){for(var j in this.dhxevs.data){var l=0;for(var g in this.dhxevs.data[j]){if(g==m){this.dhxevs.data[j][g]=null;delete this.dhxevs.data[j][g]}else{l++}}if(l==0){this.dhxevs.data[j]=null;delete this.dhxevs.data[j]}}};a.checkEvent=function(g){g=String(g).toLowerCase();return(this.dhxevs.data[g]!=null)};a.callEvent=function(j,m){j=String(j).toLowerCase();if(this.dhxevs.data[j]==null){return true}var l=true;for(var g in this.dhxevs.data[j]){l=this.dhxevs.data[j][g].apply(this,m)&&l}return l};a.detachAllEvents=function(){for(var j in this.dhxevs.data){for(var g in this.dhxevs.data[j]){this.dhxevs.data[j][g]=null;delete this.dhxevs.data[j][g]}this.dhxevs.data[j]=null;delete this.dhxevs.data[j]}};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,4})$)/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(g,c){for(var j in c){if(!g[j]){g[j]=c[j]}}return g},extend_api:function(a,j,g){var c=window[a];if(!c){return}window[a]=function(n){if(n&&typeof n=="object"&&!n.tagName){var m=c.apply(this,(j._init?j._init(n):arguments));for(var l in dhtmlx){if(j[l]){this[j[l]](dhtmlx[l])}}for(var l in n){if(j[l]){this[j[l]](n[l])}else{if(l.indexOf("on")===0){this.attachEvent(l,n[l])}}}}else{var m=c.apply(this,arguments)}if(j._patch){j._patch(this)}return m||this};window[a].prototype=c.prototype;if(g){dhtmlx.extend(window[a].prototype,g)}},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 l=document.createElement("Div");l.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=l.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 j=g.target}else{j=g.srcElement}dragger.checkLanding(j,g)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(l){if(window.name){var g=parent.frames[window.name].frameElement.offsetParent;var j=0;var c=0;while(g){j+=g.offsetLeft;c+=g.offsetTop;g=g.offsetParent}if((parent.dhtmlDragAndDrop)){var a=parent.dhtmlDragAndDrop.calculateFramePosition(1);j+=a.split("_")[0]*1;c+=a.split("_")[1]*1}if(l){return j+"_"+c}else{this.fx=j}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,j){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)&&(j))&&((!_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||j)?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,g,a){if(c.addEventListener){c.addEventListener(g,a,false)}else{if(c.attachEvent){c.attachEvent("on"+g,a)}}}}if(dhtmlxEvent.touchDelay==null){dhtmlxEvent.touchDelay=2000}if(typeof(dhtmlxEvent.initTouch)=="undefined"){dhtmlxEvent.initTouch=function(){var j;var l;var c,a;dhtmlxEvent(document.body,"touchstart",function(m){l=m.touches[0].target;c=m.touches[0].clientX;a=m.touches[0].clientY;j=window.setTimeout(g,dhtmlxEvent.touchDelay)});function g(){if(l){var m=document.createEvent("HTMLEvents");m.initEvent("dblclick",true,true);l.dispatchEvent(m);j=l=null}}dhtmlxEvent(document.body,"touchmove",function(m){if(j){if(Math.abs(m.touches[0].clientX-c)>50||Math.abs(m.touches[0].clientY-a)>50){window.clearTimeout(j);j=l=false}}});dhtmlxEvent(document.body,"touchend",function(m){if(j){window.clearTimeout(j);j=l=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(m,g){if(!m._event_check){m._event_check={};m._event_check_size={}}for(var c in g){m._event_check[c.toLowerCase()]=g[c];var l=-1;for(var j in g[c]){l++}m._event_check_size[c.toLowerCase()]=l}};dhtmlx.assert_method_info=function(l,c,j,m){var a=[];for(var g=0;g<m.length;g++){a.push(m[g][0]+" : "+m[g][1]+"\n   "+m[g][2].describe()+(m[g][3]?"; optional":""))}return l.name+"."+c+"\n"+j+"\n Arguments:\n - "+a.join("\n - ")};dhtmlx.assert_method=function(g,a){for(var c in a){dhtmlx.assert_method_process(g,c,a[c].descr,a[c].args,(a[c].min||99),a[c].skip)}};dhtmlx.assert_method_process=function(m,c,l,n,g,j){var a=m[c];if(!j){m[c]=function(){if(arguments.length!=n.length&&arguments.length<g){dhtmlx.log("warn","Incorrect count of parameters\n"+m[c].describe()+"\n\nExpecting "+n.length+" but have only "+arguments.length)}else{for(var o=0;o<n.length;o++){if(!n[o][3]&&!n[o][2](arguments[o])){dhtmlx.log("warn","Incorrect method call\n"+m[c].describe()+"\n\nActual value of "+(o+1)+" parameter: {"+(typeof arguments[o])+"} "+arguments[o])}}}return a.apply(this,arguments)}}m[c].describe=function(){return dhtmlx.assert_method_info(m,c,l,n)}};dhtmlx.assert_event_call=function(g,c,a){if(g._event_check){if(!g._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(g._event_check_size[c]!=a.length){dhtmlx.log("warn","Incorrect event call, expected "+g._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(g,c){if(typeof g=="object"){for(var a in g){dhtmlx.assert_settings(a,g[a],c)}}};dhtmlx.assert_settings=function(o,l,j){j=j||this._settings_check;if(j){if(!j[o]){return dhtmlx.log("warn","Unknown propery: "+o)}var n="";var c="";var a=false;for(var g=0;g<j[o].length;g++){var m=j[o][g];if(typeof m=="string"){continue}if(typeof m=="function"){a=a||m(l)}else{if(typeof m=="object"&&typeof m[1]=="function"){a=a||m[1](l);if(a&&m[2]){dhtmlx.assert_check(l,m[2])}}}if(a){break}}if(!a){dhtmlx.log("warn","Invalid configuration\n"+dhtmlx.assert_info(o,j)+"\nActual value: {"+(typeof l)+"} "+l)}}};dhtmlx.assert_info=function(c,m){var a=m[c];var l="";var j=[];for(var g=0;g<a.length;g++){if(typeof rule=="string"){l=a[g]}else{if(a[g].describe){j.push(a[g].describe())}else{if(a[g][1]&&a[g][1].describe){j.push(a[g][1].describe())}}}}return"Property: "+c+", "+l+" \nExpected value: \n - "+j.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(g){return c[g]};a.describe=function(){var j=[];for(var g in c){j.push(g)}return"{String} can take one of next values: "+j.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(g,c){var j=function(a){if(g(a)||c(a)){return true}return false};j.describe=function(){return g.describe()};return j}}dhtmlx.version="3.0";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 g in a){c[g]=a[g]}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 m=arguments;var g=m[0];var c=[];for(var l=m.length-1;l>0;l--){if(typeof m[l]=="function"){m[l]=m[l].prototype}for(var j in m[l]){if(j=="_init"){c.push(m[l][j])}else{if(!g[j]){g[j]=m[l][j]}}}}if(m[0]._init){c.push(m[0]._init)}g._init=function(){for(var n=0;n<c.length;n++){c[n].apply(this,arguments)}};g.base=m[1];var a=function(n){this._init(n);if(this._parseSettings){this._parseSettings(n,this.defaults)}};a.prototype=g;g=m=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,g,c){return function(){var j=false;j=a[g].apply(a,arguments);return j}};dhtmlx.isNotDefined=function(c){return typeof c=="undefined"};dhtmlx.delay=function(j,c,g,a){setTimeout(function(){var l=j.apply(c,g);j=c=g=null;return l},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(j,g,a,c){j=dhtmlx.toNode(j);var l=dhtmlx.uid();dhtmlx._events[l]=[j,g,a];if(c){a=dhtmlx.bind(a,c)}if(j.addEventListener){j.addEventListener(g,a,false)}else{if(j.attachEvent){j.attachEvent("on"+g,a)}}return l};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,g,a){if(window.console&&console.log){c=c.toLowerCase();if(window.console[c]){window.console[c](g||"unknown error")}else{window.console.log(c+": "+g)}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 g="_start_time_log"+a;if(!dhtmlx[g]){dhtmlx[g]=new Date();dhtmlx.log("Info","Timing start ["+a+"]")}else{var c=new Date();dhtmlx.log("Info","Timing end ["+a+"]:"+(c.valueOf()-dhtmlx[g].valueOf())/1000+"s");dhtmlx[g]=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(g,l){if(this._events._block){return true}g=g.toLowerCase();dhtmlx.assert_event_call(this,g,l);var j=this._events[g.toLowerCase()];var a=true;if(dhtmlx.debug){dhtmlx.log("info","["+this.name+"] event:"+g,l)}if(j){for(var c=0;c<j.length;c++){if(j[c].apply(this,(l||[]))===false){a=false}}}if(this._map[g]&&!this._map[g].callEvent(g,l)){a=false}return a},attachEvent:function(c,a,j){c=c.toLowerCase();dhtmlx.assert_event_attach(this,c);j=j||dhtmlx.uid();a=dhtmlx.toFunctor(a);var g=this._events[c]||dhtmlx.toArray();g.push(a);this._events[c]=g;this._handlers[j]={f:a,t:c};return j},detachEvent:function(j){if(this._handlers[j]){var c=this._handlers[j].t;var a=this._handlers[j].f;var g=this._events[c];g.remove(a);delete this._handlers[j]}}};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,g){if(!g&&g!==0){this.push(c)}else{var a=this.splice(g,(this.length-g));this[g]=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,g){for(var c=0;c<this.length;c++){a.call((g||this),this[c])}},map:function(a,g){for(var c=0;c<this.length;c++){this[c]=a.call((g||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 j=document.createElement("DIV");var g;for(var c=0;c<a.names.length;c++){while(p=a[a.names[c]].pop()){if(typeof j.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,g){a=a||{};var j=document.createElement(c);for(var l in a){j.setAttribute(l,a[l])}if(a.style){j.style.cssText=a.style}if(a["class"]){j.className=a["class"]}if(g){j.innerHTML=g}return j},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,g,a){if(!c){return}if(g){g.parentNode.insertBefore(c,g)}else{a.appendChild(c)}},locate:function(c,j){c=c||event;var a=c.target||c.srcElement;while(a){if(a.getAttribute){var g=a.getAttribute(j);if(g){return g}}a=a.parentNode}return null},offset:function(j){if(j.getBoundingClientRect){var n=j.getBoundingClientRect();var o=document.body;var c=document.documentElement;var a=window.pageYOffset||c.scrollTop||o.scrollTop;var l=window.pageXOffset||c.scrollLeft||o.scrollLeft;var m=c.clientTop||o.clientTop||0;var q=c.clientLeft||o.clientLeft||0;var r=n.top+a-m;var g=n.left+l-q;return{y:Math.round(r),x:Math.round(g)}}else{var r=0,g=0;while(j){r=r+parseInt(j.offsetTop,10);g=g+parseInt(j.offsetLeft,10);j=j.offsetParent}return{y:r,x:g}}},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 g=0;g<dhtmlx.destructors.length;g++){dhtmlx.destructors[g].destructor()}dhtmlx.destructors=[]}for(var c in dhtmlx._events){var j=dhtmlx._events[c];if(j[0].removeEventListener){j[0].removeEventListener(j[1],j[2],false)}else{if(j[0].detachEvent){j[0].detachEvent("on"+j[1],j[2])}}delete dhtmlx._events[c]}});dhtmlx.ajax=function(a,c,g){if(arguments.length!==0){var j=new dhtmlx.ajax();if(g){j.master=g}j.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(l,q,n){var c=this.getXHR();if(typeof n=="function"){n=[n]}if(typeof q=="object"){var m=[];for(var g in q){var o=q[g];if(o===null||o===dhtmlx.undefined){o=""}m.push(g+"="+encodeURIComponent(o))}q=m.join("&")}if(q&&!this.post){l=l+(l.indexOf("?")!=-1?"&":"?")+q;q=null}c.open(this.post?"POST":"GET",l,!this._sync);if(this.post){c.setRequestHeader("Content-type","application/x-www-form-urlencoded")}var j=this;c.onreadystatechange=function(){if(!c.readyState||c.readyState==4){if(n&&j){for(var a=0;a<n.length;a++){if(n[a]){n[a].call((j.master||j),c.responseText,c.responseXML,c)}}}j.master=null;n=j=null}};c.send(q||null);return c},get:function(a,g,c){this.post=false;return this.send(a,g,c)},post:function(a,g,c){this.post=true;return this.send(a,g,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.xml}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(l,c,a){var g=this.data.driver;var j=g.getRecords(g.toObject(l,c))[0];this.data=(g?g.getDetails(j):l);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(j,g){this._ignore_feed=true;this.setValues(dhtmlx.DataDriver.json.toObject(j)[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 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(g){var a={};for(var c=0;c<g.length;c++){a["data"+c]=g[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(g){g=this.stringToArray(g);var a={};for(var c=0;c<g.length;c++){a["data"+c]=g[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(j,q){if(window.XPathResult){var g=j;if(j.nodeName.indexOf("document")==-1){j=j.ownerDocument}var n=[];var c=j.evaluate(q,g,null,XPathResult.ANY_TYPE,null);var o=c.iterateNext();while(o){n.push(o);o=c.iterateNext()}return n}else{var m=true;try{if(typeof(j.selectNodes)=="undefined"){m=false}}catch(l){}if(m){return j.selectNodes(q)}else{var a=q.split("/").pop();return j.getElementsByTagName(a)}}},tagToObject:function(g,q){q=q||{};var l=false;var j=g.attributes;if(j&&j.length){for(var n=0;n<j.length;n++){q[j[n].name]=j[n].value}l=true}var c=g.childNodes;var o={};for(var n=0;n<c.length;n++){if(c[n].nodeType==1){var m=c[n].tagName;if(typeof q[m]!="undefined"){if(!(q[m] instanceof Array)){q[m]=[q[m]]}q[m].push(this.tagToObject(c[n],{}))}else{q[c[n].tagName]=this.tagToObject(c[n],{})}l=true}}if(!l){return this.nodeValue(g)}q.value=this.nodeValue(g);return q},nodeValue:function(a){if(a.firstChild){return a.firstChild.wholeText||a.firstChild.data}return""},fromString:function(c){if(window.DOMParser&&!dhtmlx._isIE){return(new DOMParser()).parseFromString(c,"text/xml")}if(window.ActiveXObject){var a=new ActiveXObject("Microsoft.xmlDOM");a.loadXML(c);return a}dhtmlx.error("Load from xml string is not supported")},checkResponse:function(j,g){if(g&&(g.firstChild&&g.firstChild.tagName!="parsererror")){return g}var c=this.fromString(j.replace(/^[\s]+/,""));if(c){return c}dhtmlx.error("xml can't be parsed",j)}};dhtmlx.DataLoader={_init:function(a){a=a||"";this.name="DataStore";this.data=(a.datastore)||(new dhtmlx.DataStore());this._readyHandler=this.data.attachEvent("onStoreLoad",dhtmlx.bind(this._call_onready,this))},load:function(a,c){dhtmlx.AtomDataLoader.load.apply(this,arguments);if(!this.data.feed){this.data.feed=function(j,g){if(this._load_count){return this._load_count=[j,g]}else{this._load_count=true}this.load(a+((a.indexOf("?")==-1)?"?":"&")+"posStart="+j+"&count="+g,function(){var l=this._load_count;this._load_count=false;if(typeof l=="object"){this.data.feed.apply(this,l)}})}}},_onLoad:function(g,c,a){this.data._parse(this.data.driver.toObject(g,c));this.callEvent("onXLE",[]);if(this._readyHandler){this.data.detachEvent(this._readyHandler);this._readyHandler=null}},dataFeed_setter:function(a){this.data.attachEvent("onBeforeFilter",dhtmlx.bind(function(n,m){if(this._settings.dataFeed){var l={};if(!n&&!l){return}if(typeof n=="function"){if(!m){return}n(m,l)}else{l={text:m}}this.clearAll();var c=this._settings.dataFeed;if(typeof c=="function"){return c.call(this,m,l)}var j=[];for(var g in l){j.push("dhx_filter["+g+"]="+encodeURIComponent(l[g]))}this.load(c+(c.indexOf("?")<0?"?":"&")+j.join("&"),this._settings.datatype);return false}},this));return a},_call_onready:function(){if(this._settings.ready){var a=dhtmlx.toFunctor(this._settings.ready);if(a&&a.call){a.apply(this,arguments)}}}};dhtmlx.DataStore=function(){this.name="DataStore";dhtmlx.extend(this,dhtmlx.EventSystem);this.setDriver("xml");this.pull={};this.order=dhtmlx.toArray()};dhtmlx.DataStore.prototype={setDriver:function(a){dhtmlx.assert(dhtmlx.DataDriver[a],"incorrect DataDriver");this.driver=dhtmlx.DataDriver[a]},_parse:function(m){this.callEvent("onParse",[this.driver,m]);if(this._filter_order){this.filter()}var n=this.driver.getInfo(m);if(n._key){dhtmlx.security_key=n._key}var l=this.driver.getRecords(m);var q=(n._from||0)*1;if(q===0&&this.order[0]){q=this.order.length}var c=0;for(var g=0;g<l.length;g++){var a=this.driver.getDetails(l[g]);var o=this.id(a);if(!this.pull[o]){this.order[c+q]=o;c++}this.pull[o]=a;if(this.extraParser){this.extraParser(a)}if(this._scheme){if(this._scheme.$init){this._scheme.$update(a)}else{if(this._scheme.$update){this._scheme.$update(a)}}}}for(var g=0;g<n._size;g++){if(!this.order[g]){var o=dhtmlx.uid();var a={id:o,$template:"loading"};this.pull[o]=a;this.order[g]=o}}this.callEvent("onStoreLoad",[this.driver,m]);this.refresh()},id:function(a){return a.id||(a.id=dhtmlx.uid())},changeId:function(c,a){dhtmlx.assert(this.pull[c],"Can't change id, for non existing item: "+c);this.pull[a]=this.pull[c];this.pull[a].id=a;this.order[this.order.find(c)]=a;if(this._filter_order){this._filter_order[this._filter_order.find(c)]=a}this.callEvent("onIdChange",[c,a]);if(this._render_change_id){this._render_change_id(c,a)}},get:function(a){return this.item(a)},set:function(c,a){return this.update(c,a)},item:function(a){return this.pull[a]},update:function(c,a){if(this._scheme&&this._scheme.$update){this._scheme.$update(a)}if(this.callEvent("onBeforeUpdate",[c,a])===false){return false}this.pull[c]=a;this.refresh(c)},refresh:function(a){if(this._skip_refresh){return}if(a){this.callEvent("onStoreUpdated",[a,this.pull[a],"update"])}else{this.callEvent("onStoreUpdated",[null,null,null])}},silent:function(a){this._skip_refresh=true;a.call(this);this._skip_refresh=false},getRange:function(j,g){if(j){j=this.indexById(j)}else{j=this.startOffset||0}if(g){g=this.indexById(g)}else{g=Math.min((this.endOffset||Infinity),(this.dataCount()-1));if(g<0){g=0}}if(j>g){var c=g;g=j;j=c}return this.getIndexRange(j,g)},getIndexRange:function(j,g){g=Math.min((g||Infinity),this.dataCount()-1);var a=dhtmlx.toArray();for(var c=(j||0);c<=g;c++){a.push(this.item(this.order[c]))}return a},dataCount:function(){return this.order.length},exists:function(a){return !!(this.pull[a])},move:function(a,j){if(a<0||j<0){dhtmlx.error("DataStore::move","Incorrect indexes");return}var g=this.idByIndex(a);var c=this.item(g);this.order.removeAt(a);this.order.insertAt(g,Math.min(this.order.length,j));this.callEvent("onStoreUpdated",[g,c,"move"])},scheme:function(a){this._scheme=a},sync:function(l,j,a){if(typeof j!="function"){a=j;j=null}if(dhtmlx.debug_bind){this.debug_sync_master=l;dhtmlx.log("[sync] "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id+" <= "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id)}var g=l;if(l.name!="DataStore"){l=l.data}var c=dhtmlx.bind(function(o,m,n){if(n!="update"||j){o=null}if(!o){this.order=dhtmlx.toArray([].concat(l.order));this._filter_order=null;this.pull=l.pull;if(j){this.silent(j)}if(this._on_sync){this._on_sync()}}if(dhtmlx.debug_bind){dhtmlx.log("[sync:request] "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id+" <= "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id)}if(!a){this.refresh(o)}else{a=false}},this);l.attachEvent("onStoreUpdated",c);this.feed=function(n,m){g.loadNext(m,n)};c()},add:function(l,a){if(this._scheme){l=l||{};for(var c in this._scheme){l[c]=l[c]||this._scheme[c]}if(this._scheme){if(this._scheme.$init){this._scheme.$update(l)}else{if(this._scheme.$update){this._scheme.$update(l)}}}}var m=this.id(l);var j=this.dataCount();if(dhtmlx.isNotDefined(a)||a<0){a=j}if(a>j){dhtmlx.log("Warning","DataStore:add","Index of out of bounds");a=Math.min(this.order.length,a)}if(this.callEvent("onBeforeAdd",[m,l,a])===false){return false}if(this.exists(m)){return dhtmlx.error("Not unique ID")}this.pull[m]=l;this.order.insertAt(m,a);if(this._filter_order){var g=this._filter_order.length;if(!a&&this.order.length){g=0}this._filter_order.insertAt(m,g)}this.callEvent("onafterAdd",[m,a]);this.callEvent("onStoreUpdated",[m,l,"add"]);return m},remove:function(g){if(g instanceof Array){for(var a=0;a<g.length;a++){this.remove(g[a])}return}if(this.callEvent("onBeforeDelete",[g])===false){return false}if(!this.exists(g)){return dhtmlx.error("Not existing ID",g)}var c=this.item(g);this.order.remove(g);if(this._filter_order){this._filter_order.remove(g)}delete this.pull[g];this.callEvent("onafterdelete",[g]);this.callEvent("onStoreUpdated",[g,c,"delete"])},clearAll:function(){this.pull={};this.order=dhtmlx.toArray();this.feed=null;this._filter_order=null;this.callEvent("onClearAll",[]);this.refresh()},idByIndex:function(a){if(a>=this.order.length||a<0){dhtmlx.log("Warning","DataStore::idByIndex Incorrect index")}return this.order[a]},indexById:function(c){var a=this.order.find(c);return a},next:function(c,a){return this.order[this.indexById(c)+(a||1)]},first:function(){return this.order[0]},last:function(){return this.order[this.order.length-1]},previous:function(c,a){return this.order[this.indexById(c)-(a||1)]},sort:function(m,c,a){var g=m;if(typeof m=="function"){g={as:m,dir:c}}else{if(typeof m=="string"){g={by:m,dir:c,as:a}}}var l=[g.by,g.dir,g.as];if(!this.callEvent("onbeforesort",l)){return}if(this.order.length){var n=dhtmlx.sort.create(g);var j=this.getRange(this.first(),this.last());j.sort(n);this.order=j.map(function(o){return this.id(o)},this)}this.refresh();this.callEvent("onaftersort",l)},filter:function(l,j){if(!this.callEvent("onBeforeFilter",[l,j])){return}if(this._filter_order){this.order=this._filter_order;delete this._filter_order}if(!this.order.length){return}if(l){var c=l;j=j||"";if(typeof l=="string"){l=dhtmlx.Template.fromHTML(l);j=j.toString().toLowerCase();c=function(o,n){return l(o).toLowerCase().indexOf(n)!=-1}}var g=dhtmlx.toArray();for(var a=0;a<this.order.length;a++){var m=this.order[a];if(c(this.item(m),j)){g.push(m)}}this._filter_order=this.order;this.order=g}this.refresh();this.callEvent("onAfterFilter",[])},each:function(g,c){for(var a=0;a<this.order.length;a++){g.call((c||this),this.item(this.order[a]))}},provideApi:function(j,c){this.debug_bind_master=j;if(c){this.mapEvent({onbeforesort:j,onaftersort:j,onbeforeadd:j,onafteradd:j,onbeforedelete:j,onafterdelete:j,onbeforeupdate:j})}var g=["get","set","sort","add","remove","exists","idByIndex","indexById","item","update","refresh","dataCount","filter","next","previous","clearAll","first","last","serialize"];for(var a=0;a<g.length;a++){j[g[a]]=dhtmlx.methodPush(this,g[a])}if(dhtmlx.assert_enabled()){this.assert_event(j)}},serialize:function(){var g=this.order;var a=[];for(var c=0;c<g.length;c++){a.push(this.pull[g[c]])}return a}};dhtmlx.sort={create:function(a){return dhtmlx.sort.dir(a.dir,dhtmlx.sort.by(a.by,a.as))},as:{"int":function(g,c){g=g*1;c=c*1;return g>c?1:(g<c?-1:0)},string_strict:function(g,c){g=g.toString();c=c.toString();return g>c?1:(g<c?-1:0)},string:function(g,c){g=g.toString().toLowerCase();c=c.toString().toLowerCase();return g>c?1:(g<c?-1:0)}},by:function(c,a){if(!c){return a}if(typeof a!="function"){a=dhtmlx.sort.as[a||"string"]}c=dhtmlx.Template.fromHTML(c);return function(j,g){return a(c(j),c(g))}},dir:function(c,a){if(c=="asc"){return a}return function(j,g){return a(j,g)*-1}}};dhtmlx.KeyEvents={_init:function(){dhtmlx.event(this._obj,"keypress",this._onKeyPress,this)},_onKeyPress:function(c){c=c||event;var a=c.which||c.keyCode;this.callEvent((this._edit_id?"onEditKeyPress":"onKeyPress"),[a,c.ctrlKey,c.shiftKey,c])}};dhtmlx.MouseEvents={_init:function(){if(this.on_click){dhtmlx.event(this._obj,"click",this._onClick,this);dhtmlx.event(this._obj,"contextmenu",this._onContext,this)}if(this.on_dblclick){dhtmlx.event(this._obj,"dblclick",this._onDblClick,this)}if(this.on_mouse_move){dhtmlx.event(this._obj,"mousemove",this._onMouse,this);dhtmlx.event(this._obj,(dhtmlx._isIE?"mouseleave":"mouseout"),this._onMouse,this)}},_onClick:function(a){return this._mouseEvent(a,this.on_click,"ItemClick")},_onDblClick:function(a){return this._mouseEvent(a,this.on_dblclick,"ItemDblClick")},_onContext:function(a){var c=dhtmlx.html.locate(a,this._id);if(c&&!this.callEvent("onBeforeContextMenu",[c,a])){return dhtmlx.html.preventEvent(a)}},_onMouse:function(a){if(dhtmlx._isIE){a=document.createEventObject(event)}if(this._mouse_move_timer){window.clearTimeout(this._mouse_move_timer)}this.callEvent("onMouseMoving",[a]);this._mouse_move_timer=window.setTimeout(dhtmlx.bind(function(){if(a.type=="mousemove"){this._onMouseMove(a)}else{this._onMouseOut(a)}},this),500)},_onMouseMove:function(a){if(!this._mouseEvent(a,this.on_mouse_move,"MouseMove")){this.callEvent("onMouseOut",[a||event])}},_onMouseOut:function(a){this.callEvent("onMouseOut",[a||event])},_mouseEvent:function(m,l,c){m=m||event;var a=m.target||m.srcElement;var g="";var n=null;var j=false;while(a&&a.parentNode){if(!j&&a.getAttribute){n=a.getAttribute(this._id);if(n){if(a.getAttribute("userdata")){this.callEvent("onLocateData",[n,a])}if(!this.callEvent("on"+c,[n,m,a])){return}j=true}}g=a.className;if(g){g=g.split(" ");g=g[0]||g[1];if(l[g]){return l[g].call(this,m,n||dhtmlx.html.locate(m,this._id),a)}}a=a.parentNode}return j}};dhtmlx.Settings={_init:function(){this._settings=this.config={}},define:function(c,a){if(typeof c=="object"){return this._parseSeetingColl(c)}return this._define(c,a)},_define:function(c,a){dhtmlx.assert_settings.call(this,c,a);var g=this[c+"_setter"];return this._settings[c]=g?g.call(this,a):a},_parseSeetingColl:function(g){if(g){for(var c in g){this._define(c,g[c])}}},_parseSettings:function(g,a){var c=dhtmlx.extend({},a);if(typeof g=="object"&&!g.tagName){dhtmlx.extend(c,g)}this._parseSeetingColl(c)},_mergeSettings:function(a,g){for(var c in g){switch(typeof a[c]){case"object":a[c]=this._mergeSettings((a[c]||{}),g[c]);break;case"undefined":a[c]=g[c];break;default:break}}return a},_parseContainer:function(c,a,g){if(typeof c=="object"&&!c.tagName){c=c.container}this._obj=this.$view=dhtmlx.toNode(c);if(!this._obj&&g){this._obj=g(c)}dhtmlx.assert(this._obj,"Incorrect html container");this._obj.className+=" "+a;this._obj.onselectstart=function(){return false};this._dataobj=this._obj},_set_type:function(a){if(typeof a=="object"){return this.type_setter(a)}dhtmlx.assert(this.types,"RenderStack :: Types are not defined");dhtmlx.assert(this.types[a],"RenderStack :: Inccorect type name",a);this.type=dhtmlx.extend({},this.types[a]);this.customize()},customize:function(a){if(a){dhtmlx.extend(this.type,a)}this.type._item_start=dhtmlx.Template.fromHTML(this.template_item_start(this.type));this.type._item_end=this.template_item_end(this.type);this.render()},type_setter:function(a){this._set_type(typeof a=="object"?dhtmlx.Type.add(this,a):a);return a},template_setter:function(a){return this.type_setter({template:a})},css_setter:function(a){this._obj.className+=" "+a;return a}};dhtmlx.Template={_cache:{},empty:function(){return""},setter:function(a){return dhtmlx.Template.fromHTML(a)},obj_setter:function(c){var a=dhtmlx.Template.setter(c);var g=this;return function(){return a.apply(g,arguments)}},fromHTML:function(a){if(typeof a=="function"){return a}if(this._cache[a]){return this._cache[a]}a=(a||"").toString();a=a.replace(/[\r\n]+/g,"\\n");a=a.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"');a=a.replace(/\{common\.([^}\(]*)\}/g,'"+common.$1+"');a=a.replace(/\{common\.([^\}\(]*)\(\)\}/g,'"+(common.$1?common.$1(obj):"")+"');a=a.replace(/\{obj\.([^}]*)\}/g,'"+obj.$1+"');a=a.replace(/#([a-z0-9_]+)#/gi,'"+obj.$1+"');a=a.replace(/\{obj\}/g,'"+obj+"');a=a.replace(/\{-obj/g,"{obj");a=a.replace(/\{-common/g,"{common");a='return "'+a+'";';return this._cache[a]=Function("obj","common",a)}};dhtmlx.Type={add:function(g,c){if(!g.types&&g.prototype.types){g=g.prototype}if(dhtmlx.assert_enabled()){this.assert_event(c)}var a=c.name||"default";this._template(c);this._template(c,"edit");this._template(c,"loading");g.types[a]=dhtmlx.extend(dhtmlx.extend({},(g.types[a]||this._default)),c);return a},_default:{css:"default",template:function(){return""},template_edit:function(){return""},template_loading:function(){return"..."},width:150,height:80,margin:5,padding:0},_template:function(g,a){a="template"+(a?("_"+a):"");var c=g[a];if(c&&(typeof c=="string")){if(c.indexOf("->")!=-1){c=c.split("->");switch(c[0]){case"html":c=dhtmlx.html.getValue(c[1]).replace(/\"/g,'\\"');break;case"http":c=new dhtmlx.ajax().sync().get(c[1],{uid:(new Date()).valueOf()}).responseText;break;default:break}}g[a]=dhtmlx.Template.fromHTML(c)}}};dhtmlx.SingleRender={_init:function(){},_toHTML:function(a){return this.type._item_start(a,this.type)+this.type.template(a,this.type)+this.type._item_end},render:function(){if(!this.callEvent||this.callEvent("onBeforeRender",[this.data])){if(this.data){this._dataobj.innerHTML=this._toHTML(this.data)}if(this.callEvent){this.callEvent("onAfterRender",[])}}}};dhtmlx.ui.Tooltip=function(a){this.name="Tooltip";this.version="3.0";if(dhtmlx.assert_enabled()){this._assert()}if(typeof a=="string"){a={template:a}}dhtmlx.extend(this,dhtmlx.Settings);dhtmlx.extend(this,dhtmlx.SingleRender);this._parseSettings(a,{type:"default",dy:0,dx:20});this._dataobj=this._obj=document.createElement("DIV");this._obj.className="dhx_tooltip";dhtmlx.html.insertBefore(this._obj,document.body.firstChild)};dhtmlx.ui.Tooltip.prototype={show:function(a,c){if(this._disabled){return}if(this.data!=a){this.data=a;this.render(a)}this._obj.style.top=c.y+this._settings.dy+"px";this._obj.style.left=c.x+this._settings.dx+"px";this._obj.style.display="block"},hide:function(){this.data=null;this._obj.style.display="none"},disable:function(){this._disabled=true},enable:function(){this._disabled=false},types:{"default":dhtmlx.Template.fromHTML("{obj.id}")},template_item_start:dhtmlx.Template.empty,template_item_end:dhtmlx.Template.empty};dhtmlx.AutoTooltip={tooltip_setter:function(c){var a=new dhtmlx.ui.Tooltip(c);this.attachEvent("onMouseMove",function(j,g){a.show(this.get(j),dhtmlx.html.pos(g))});this.attachEvent("onMouseOut",function(j,g){a.hide()});this.attachEvent("onMouseMoving",function(j,g){a.hide()});return a}};dhtmlx.compat=function(a,c){if(dhtmlx.compat[a]){dhtmlx.compat[a](c)}};if(!dhtmlx.attaches){dhtmlx.attaches={}}dhtmlx.attaches.attachAbstract=function(c,a){var l=document.createElement("DIV");l.id="CustomObject_"+dhtmlx.uid();l.style.width="100%";l.style.height="100%";l.cmp="grid";document.body.appendChild(l);this.attachObject(l.id);a.container=l.id;var j=this.vs[this.av];j.grid=new window[c](a);j.gridId=l.id;j.gridObj=l;j.grid.setSizes=function(){if(this.resize){this.resize()}else{this.render()}};var g="_viewRestore";return this.vs[this[g]()].grid};dhtmlx.attaches.attachDataView=function(a){return this.attachAbstract("dhtmlXDataView",a)};dhtmlx.attaches.attachChart=function(a){return this.attachAbstract("dhtmlXChart",a)};dhtmlx.compat.layout=function(){};function dhtmlXCellObject(g,a){this.cell=document.createElement("DIV");this.cell.className="dhx_cell"+(a||"");this._idd=g;this._isCell=true;this.conf={borders:true,idx:{},css:a||"",idx_data:{cont:"dhx_cell_cont",pr1:"dhx_cell_progress_bar",pr2:"dhx_cell_progress_img",menu:"dhx_cell_menu",toolbar:"dhx_cell_toolbar",ribbon:"dhx_cell_ribbon",sb:"dhx_cell_statusbar",cover:"dhx_cell_cover"},ofs_nodes:{t:{},b:{}}};this.dataNodes={};this.views={};var c=document.createElement("DIV");c.className="dhx_cell_cont"+this.conf.css;this.cell.appendChild(c);c=null;this._updateIdx=function(){for(var j in this.conf.idx){this.conf.idx[j]=null;delete this.conf.idx[j]}for(var n=0;n<this.cell.childNodes.length;n++){var l=this.cell.childNodes[n].className;for(var j in this.conf.idx_data){var m=new RegExp(this.conf.idx_data[j]);if(l.match(m)!=null){this.conf.idx[j]=n}}}this.callEvent("_onIdxUpdated",[])};this._adjustAttached=function(){for(var j in this.dataNodes){if(this.dataNodes[j]!=null&&typeof(this.dataNodes[j].setSizes)=="function"){this.dataNodes[j].setSizes()}}if(this.dataObj!=null&&typeof(this.dataObj.setSizes)=="function"){if(this.dataType=="layout"&&typeof(window.dhtmlXLayoutCell)!="undefined"&&this instanceof window.dhtmlXLayoutCell&&this.dataObj._getMainInst()!=this.layout._getMainInst()){this.dataObj.setSizes();return}this.dataObj.setSizes.apply(this.dataObj,arguments)}};this._setSize=function(u,r,v,n,o,q,l,m){if(this.conf.size==null){this.conf.size={}}if(m==null){m={}}var A={left:"x",top:"y",width:"w",height:"h"};this.conf.size.x=u;this.conf.size.y=r;this.conf.size.w=Math.max(v,0);this.conf.size.h=Math.max(n,0);for(var s in A){var j=(m[s]||s);this.cell.style[j]=this.conf.size[A[s]]+"px"}this.callEvent("_onSetSize",[]);if(q!==true){this._adjustCont(o,l)}else{this._adjustAttached(o)}this._adjustProgress()};this._adjustCont=function(q,n){var o=this.cell.childNodes[this.conf.idx.cont];var m=0;for(var j in this.conf.ofs_nodes.t){var l=this.conf.ofs_nodes.t[j];m+=(l=="func"?this[j]():(l==true?this.cell.childNodes[this.conf.idx[j]].offsetHeight:0))}var r=0;for(var j in this.conf.ofs_nodes.b){var l=this.conf.ofs_nodes.b[j];r+=(l=="func"?this[j]():(l==true?this.cell.childNodes[this.conf.idx[j]].offsetHeight:0))}o.style.left="0px";o.style.top=m+"px";if(!this.conf.cells_cont){this.conf.cells_cont={};o.style.width=this.cell.offsetWidth+"px";o.style.height=Math.max(this.cell.offsetHeight-m-r,0)+"px";this.conf.cells_cont.w=parseInt(o.style.width)-o.offsetWidth;this.conf.cells_cont.h=parseInt(o.style.height)-o.offsetHeight}o.style.left="0px";o.style.top=m+"px";o.style.width=Math.max(this.cell.offsetWidth+this.conf.cells_cont.w,0)+"px";o.style.height=Math.max(this.conf.size.h-m-r+this.conf.cells_cont.h,0)+"px";o=null;this._adjustAttached(q);if(n=="expand"&&this.dataType=="editor"&&this.dataObj!=null){this.dataObj._prepareContent(true)}};this._mtbUpdBorder=function(){var l=["menu","toolbar","ribbon"];for(var n=0;n<l.length;n++){if(this.conf.idx[l[n]]!=null){var o=this.cell.childNodes[this.conf.idx[l[n]]];var m="dhx_cell_"+l[n]+"_no_borders";var j="dhx_cell_"+l[n]+"_def";o.className=o.className.replace(new RegExp(this.conf.borders?m:j),this.conf.borders?j:m);o=null}}};this._resetSizeState=function(){this.conf.cells_cont=null};this.conf.view="def";this.conf.views_loaded={};this.conf.views_loaded[this.conf.view]=true;this._viewSave=function(m){this.views[m]={borders:this.conf.borders,ofs_nodes:{t:{},b:{}},url_data:this.conf.url_data,dataType:this.dataType,dataObj:this.dataObj,cellCont:[],dataNodes:{},dataNodesCont:{}};var n=this.cell.childNodes[this.conf.idx.cont];while(n.childNodes.length>0){this.views[m].cellCont.push(n.firstChild);n.removeChild(n.firstChild)}n=null;this.dataType=null;this.dataObj=null;this.conf.url_data=null;for(var l in this.dataNodes){for(var j in this.conf.ofs_nodes){if(typeof(this.conf.ofs_nodes[j][l])!="undefined"){this.views[m].ofs_nodes[j][l]=this.conf.ofs_nodes[j][l];this.conf.ofs_nodes[j][l]=null;delete this.conf.ofs_nodes[j][l]}}this.views[m].dataNodesCont[l]=this.cell.childNodes[this.conf.idx[l]];this.cell.removeChild(this.cell.childNodes[this.conf.idx[l]]);this.views[m].dataNodes[l]=this.dataNodes[l];this.dataNodes[l]=null;delete this.dataNodes[l];this._updateIdx()}this.callEvent("_onViewSave",[m])};this._viewRestore=function(m){if(this.views[m]==null){return}this.dataObj=this.views[m].dataObj;this.dataType=this.views[m].dataType;this.conf.url_data=this.views[m].url_data;for(var n=0;n<this.views[m].cellCont.length;n++){this.cell.childNodes[this.conf.idx.cont].appendChild(this.views[m].cellCont[n])}for(var l in this.views[m].dataNodes){this.dataNodes[l]=this.views[m].dataNodes[l];if(l=="menu"){this.cell.insertBefore(this.views[m].dataNodesCont[l],this.cell.childNodes[this.conf.idx.toolbar||this.conf.idx.cont])}if(l=="toolbar"){this.cell.insertBefore(this.views[m].dataNodesCont[l],this.cell.childNodes[this.conf.idx.cont])}if(l=="sb"){this.cell.appendChild(this.views[m].dataNodesCont[l])}this._updateIdx()}for(var l in this.views[m].ofs_nodes){for(var j in this.views[m].ofs_nodes[l]){this.conf.ofs_nodes[l][j]=this.views[m].ofs_nodes[l][j]}}if(this.conf.borders!=this.views[m].borders){this[this.views[m].borders?"_showBorders":"_hideBorders"](true)}if(this.dataType=="url"&&this.conf.url_data!=null&&this.conf.url_data.ajax==false&&this.conf.url_data.post_data!=null){this.reloadURL()}this.callEvent("_onViewRestore",[m]);this._viewDelete(m)};this._viewDelete=function(m){if(this.views[m]==null){return}this.views[m].borders=null;for(var l in this.views[m].ofs_nodes){for(var j in this.views[m].ofs_nodes[l]){this.views[m].ofs_nodes[l][j]=null}this.views[m].ofs_nodes[l]=null}this.views[m].dataType=null;this.views[m].dataObj=null;this.views[m].url_data=null;for(var n=0;n<this.views[m].cellCont.length;n++){this.views[m].cellCont[n]=null}this.views[m].cellCont=null;for(var l in this.views[m].dataNodes){this.views[m].dataNodes[l]=null;this.views[m].dataNodesCont[l]=null}this.views[m].dataNodes=this.views[m].dataNodesCont=null;this.views[m]=null;delete this.views[m]};window.dhx4._eventable(this);this._updateIdx();return this}dhtmlXCellObject.prototype.showView=function(a){if(this.conf.view==a){return false}this._viewSave(this.conf.view);this._viewRestore(a);this._updateIdx();this._adjustCont();this.conf.view=a;var c=(typeof(this.conf.views_loaded[this.conf.view])=="undefined");this.conf.views_loaded[this.conf.view]=true;return c};dhtmlXCellObject.prototype.getViewName=function(){return this.conf.view};dhtmlXCellObject.prototype.unloadView=function(j){if(j==this.conf.view){var l=this.conf.unloading;this.conf.unloading=true;if(typeof(this.detachMenu)=="function"){this.detachMenu()}if(typeof(this.detachToolbar)=="function"){this.detachToolbar()}if(typeof(this.detachRibbon)=="function"){this.detachRibbon()}this.detachStatusBar();this._detachObject(null,true);this.conf.unloading=l;if(!this.conf.unloading){this._adjustCont(this._idd)}return}if(this.views[j]==null){return}var g=this.views[j];for(var c in g.dataNodes){if(typeof(g.dataNodes[c].unload)=="function"){g.dataNodes[c].unload()}g.dataNodes[c]=null;g.dataNodesCont[c]=null}if(g.dataType=="url"){if(g.cellCont!=null&&g.cellCont[0]!="null"){this._detachURLEvents(g.cellCont[0])}}else{if(g.dataObj!=null){if(typeof(g.dataObj.unload)=="function"){g.dataObj.unload()}else{if(typeof(g.dataObj.destructor)=="function"){g.dataObj.destructor()}}g.dataObj=null}}g=null;this._viewDelete(j);if(typeof(this.conf.views_loaded[j])!="undefined"){delete this.conf.views_loaded[j]}};dhtmlXCellObject.prototype.getId=function(){return this._idd};dhtmlXCellObject.prototype.progressOn=function(){if(this.conf.progress==true){return}this.conf.progress=true;var c=document.createElement("DIV");c.className=this.conf.idx_data.pr1;var a=document.createElement("DIV");a.className=this.conf.idx_data.pr2;if(this.conf.idx.cover!=null){this.cell.insertBefore(a,this.cell.childNodes[this.conf.idx.cover])}else{this.cell.appendChild(a)}this.cell.insertBefore(c,a);c=a=null;this._updateIdx();this._adjustProgress()};dhtmlXCellObject.prototype.progressOff=function(){if(this.conf.progress!=true){return}this.cell.childNodes[this.conf.idx.pr2].parentNode.removeChild(this.cell.childNodes[this.conf.idx.pr2]);this.cell.childNodes[this.conf.idx.pr1].parentNode.removeChild(this.cell.childNodes[this.conf.idx.pr1]);this.conf.progress=false;this._updateIdx()};dhtmlXCellObject.prototype._adjustProgress=function(){if(this.conf.idx.pr1==null){return}if(!this.conf.pr){this.conf.pr={}}var c=this.cell.childNodes[this.conf.idx.pr1];var a=this.cell.childNodes[this.conf.idx.pr2];if(!this.conf.pr.ofs){a.style.width=c.offsetWidth+"px";a.style.height=c.offsetHeight+"px";this.conf.pr.ofs={w:a.offsetWidth-a.clientWidth,h:a.offsetHeight-a.clientHeight}}a.style.width=c.offsetWidth-this.conf.pr.ofs.w+"px";a.style.height=c.offsetHeight-this.conf.pr.ofs.h+"px";c=a=null};dhtmlXCellObject.prototype._showCellCover=function(){if(this.conf.cover==true){return}this.conf.cover=true;var a=document.createElement("DIV");a.className=this.conf.idx_data.cover;this.cell.appendChild(a);a=null;this._updateIdx()};dhtmlXCellObject.prototype._hideCellCover=function(){if(this.conf.cover!=true){return}this.cell.removeChild(this.cell.childNodes[this.conf.idx.cover]);this._updateIdx();this.conf.cover=false};dhtmlXCellObject.prototype._showBorders=function(a){if(this.conf.borders){return}this.conf.borders=true;this.cell.childNodes[this.conf.idx.cont].className="dhx_cell_cont"+this.conf.css;this.conf.cells_cont=null;this._mtbUpdBorder();this.callEvent("_onBorderChange",[true]);if(a!==true){this._adjustCont(this._idd)}};dhtmlXCellObject.prototype._hideBorders=function(a){if(!this.conf.borders){return}this.conf.borders=false;this.cell.childNodes[this.conf.idx.cont].className="dhx_cell_cont"+this.conf.css+" dhx_cell_cont_no_borders";this.conf.cells_cont=null;this._mtbUpdBorder();this.callEvent("_onBorderChange",[false]);if(a!==true){this._adjustCont(this._idd)}};dhtmlXCellObject.prototype._getWidth=function(){return this.cell.offsetWidth};dhtmlXCellObject.prototype._getHeight=function(){return this.cell.offsetHeight};dhtmlXCellObject.prototype.showInnerScroll=function(){this.cell.childNodes[this.conf.idx.cont].style.overflow="auto"};dhtmlXCellObject.prototype._unload=function(){this.conf.unloading=true;this.callEvent("_onCellUnload",[]);this.progressOff();this.unloadView(this.conf.view);this.dataNodes=null;this.cell.parentNode.removeChild(this.cell);this.cell=null;window.dhx4._eventable(this,"clear");for(var c in this.views){this.unloadView(c)}this.conf=null;for(var c in this){this[c]=null}};dhtmlXCellObject.prototype.attachObject=function(j,g){if(window.dhx4.s2b(g)&&!(typeof(window.dhtmlXWindowsCell)!="undefined"&&(this instanceof window.dhtmlXWindowsCell))){g=false}if(typeof(j)=="string"){j=document.getElementById(j)}if(j.parentNode==this.cell.childNodes[this.conf.idx.cont]){j=null;return}if(g){j.style.display="";var a=j.offsetWidth;var c=j.offsetHeight}this._attachObject(j);this.dataType="obj";j.style.display="";j=null;if(g){this._adjustByCont(a,c)}};dhtmlXCellObject.prototype.appendObject=function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(a.parentNode==this.cell.childNodes[this.conf.idx.cont]){a=null;return}if(!this.conf.append_mode){this.cell.childNodes[this.conf.idx.cont].style.overflow="auto";this.conf.append_mode=true}this._attachObject(a,null,null,true);this.dataType="obj";a.style.display="";a=null};dhtmlXCellObject.prototype.detachObject=function(c,a){this._detachObject(null,c,a)};dhtmlXCellObject.prototype.getAttachedStatusBar=function(){return this.dataNodes.sb};dhtmlXCellObject.prototype.getAttachedObject=function(){return this.dataObj};dhtmlXCellObject.prototype.attachURL=function(c,r,g){if(g==true){g={}}var j=(typeof(g)!="undefined"&&g!=false&&g!=null);if(!this.conf.url_data){this.conf.url_data={}}this.conf.url_data.url=c;this.conf.url_data.ajax=(r==true);this.conf.url_data.post_data=(g==true?{}:(g||null));if(r==true){var q=this;if(j){var l="";for(var o in g){l+="&"+encodeURIComponent(o)+"="+encodeURIComponent(g[o])}dhx4.ajax.post(c,l,function(a){q.attachHTMLString("<div style='position:relative;width:100%;height:100%;overflow:auto;'>"+a.xmlDoc.responseText+"</div>");if(typeof(q._doOnFrameContentLoaded)=="function"){q._doOnFrameContentLoaded()}q.dataType="url-ajax";q=a=null})}else{dhx4.ajax.get(c,function(a){q.attachHTMLString("<div style='position:relative;width:100%;height:100%;overflow:auto;'>"+a.xmlDoc.responseText+"</div>");if(typeof(q._doOnFrameContentLoaded)=="function"){q._doOnFrameContentLoaded()}q.dataType="url-ajax";q=a=null})}}else{if(this.dataType=="url"){var m=this.getFrame()}else{var m=document.createElement("IFRAME");m.frameBorder=0;m.border=0;m.style.width="100%";m.style.height="100%";m.style.position="relative";this._attachObject(m);this.dataType="url";this._attachURLEvents()}if(j){var n=(typeof(this.conf.url_data.post_ifr)=="undefined");this.conf.url_data.post_ifr=true;if(n){this._attachURLEvents()}m.src="about:blank"}else{m.src=c+(window.dhx4.ajax.cache!=true?(c.indexOf("?")>=0?"&":"?")+"dhxr"+new Date().getTime():"")}m=null}m=null};dhtmlXCellObject.prototype.reloadURL=function(){if(!(this.dataType=="url"||this.dataType=="url-ajax")){return}if(this.conf.url_data==null){return}this.attachURL(this.conf.url_data.url,this.conf.url_data.ajax,this.conf.url_data.post_data)};dhtmlXCellObject.prototype.attachHTMLString=function(str){this._attachObject(null,null,str);var z=str.match(/<script[^>]*>[^\f]*?<\/script>/g)||[];for(var i=0;i<z.length;i++){var s=z[i].replace(/<([\/]{0,1})script[^>]*>/gi,"");if(s){if(window.execScript){window.execScript(s)}else{window.eval(s)}}}};dhtmlXCellObject.prototype.attachScheduler=function(a,n,c,j){j=j||window.scheduler;var l=false;if(c){var m=document.getElementById(c);if(m){l=true}}if(!l){var g=c||'<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div><div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div><div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>';var m=document.createElement("DIV");m.id="dhxSchedObj_"+new Date().getTime();m.style.width="100%";m.style.height="100%";m.style.position="relative";m.style.overflow="hidden";m.className="dhx_cal_container";m.innerHTML='<div class="dhx_cal_navline"><div class="dhx_cal_prev_button">&nbsp;</div><div class="dhx_cal_next_button">&nbsp;</div><div class="dhx_cal_today_button"></div><div class="dhx_cal_date"></div>'+g+'</div><div class="dhx_cal_header"></div><div class="dhx_cal_data"></div>'}this._attachObject(m);this.dataType="scheduler";this.dataObj=j;this.dataObj.setSizes=function(){this.update_view()};j.init(m.id,a,n);m=null;this.callEvent("_onContentAttach",[]);return this.dataObj};dhtmlXCellObject.prototype.attachMap=function(a){var c=document.createElement("DIV");c.id="GMapsObj_"+this._genStr(12);c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(!a){a={center:new google.maps.LatLng(40.719837,-73.992348),zoom:11,mapTypeId:google.maps.MapTypeId.ROADMAP}}this.dataType="maps";this.dataObj=new google.maps.Map(c,a);this.dataObj.setSizes=function(){google.maps.event.trigger(this,"resize")};c=null;this.callEvent("_onContentAttach",[]);return this.dataObj};dhtmlXCellObject.prototype._createNode_sb=function(n,j,m,a,l){if(typeof(l)!="undefined"){n=l}else{var c=j||{};var o=(typeof(c.text)=="string"&&c.text.length>0?c.text:"&nbsp;");var g=(typeof(c.height)=="number"?c.height:false);var n=document.createElement("DIV");n.className="dhx_cell_statusbar_def";n.innerHTML="<div class='"+(c.paging==true?"dhx_cell_statusbar_paging":"dhx_cell_statusbar_text")+"'>"+o+"</div>";if(g!=false){n.firstChild.style.height=n.firstChild.style.lineHeight=g+"px"}}if(this.conf.idx.pr1!=null){this.cell.insertBefore(n,this.cell.childNodes[this.conf.idx.pr1])}else{this.cell.appendChild(n)}this.conf.ofs_nodes.b.sb=true;this._updateIdx();this._adjustCont(this._idd);return n};dhtmlXCellObject.prototype.attachStatusBar=function(a){if(this.dataNodes.sb){return}if(a!=null&&window.dhx4.s2b(a.paging)==true){a.height=null}if(this.conf.skin=="dhx_skyblue"&&typeof(window.dhtmlXWindowsCell)!="undefined"&&(this instanceof dhtmlXWindowsCell)){this.cell.childNodes[this.conf.idx.cont].className+=" dhx_cell_statusbar_attached"}this.dataNodes.sb=this._attachObject("sb",a);this.dataNodes.sb.setText=function(c){this.childNodes[0].innerHTML=c};this.dataNodes.sb.getText=function(){return this.childNodes[0].innerHTML};this.dataNodes.sb.onselectstart=function(c){return false};return this.dataNodes.sb};dhtmlXCellObject.prototype.detachStatusBar=function(){if(!this.dataNodes.sb){return}if(this.conf.skin=="dhx_skyblue"&&typeof(window.dhtmlXWindowsCell)!="undefined"&&(this instanceof dhtmlXWindowsCell)){this.cell.childNodes[this.conf.idx.cont].className=this.cell.childNodes[this.conf.idx.cont].className.replace(/\s{0,}dhx_cell_statusbar_attached/,"")}this.dataNodes.sb.setText=this.dataNodes.sb.getText=this.dataNodes.sb.onselectstart=null;this.dataNodes.sb=null;delete this.dataNodes.sb;this._detachObject("sb")};dhtmlXCellObject.prototype.showStatusBar=function(){this._mtbShowHide("sb","")};dhtmlXCellObject.prototype.hideStatusBar=function(){this._mtbShowHide("sb","none")};dhtmlXCellObject.prototype._mtbShowHide=function(c,a){if(!this.dataNodes[c]){return}this.cell.childNodes[this.conf.idx[c]].style.display=a;this._adjustCont()};dhtmlXCellObject.prototype.getFrame=dhtmlXCellObject.prototype._getFrame=function(){if(this.dataType!="url"){return null}return this.cell.childNodes[this.conf.idx.cont].firstChild};dhtmlXCellObject.prototype._genStr=function(){if(!this._genStrId){this._genStrId=new Date().getTime()}return this._genStrId++};dhtmlXCellObject.prototype._attachURLEvents=function(){if(this.dataType!="url"){return}var g=this;var c=this._idd;var a=this.cell.childNodes[this.conf.idx.cont].firstChild;if(typeof(this._doOnFrameMouseDown)!="function"){this._doOnFrameMouseDown=function(j){g.callEvent("_onContentMouseDown",[c,j||event])}}if(typeof(window.addEventListener)=="function"){a.onload=function(){try{if(typeof(g._doOnFrameMouseDown)=="function"){this.contentWindow.document.body.addEventListener("mousedown",g._doOnFrameMouseDown,false)}}catch(j){}try{if(typeof(g._doOnFrameContentLoaded)=="function"){g._doOnFrameContentLoaded()}}catch(j){}}}else{a.onreadystatechange=function(j){if(this.readyState=="complete"){try{if(typeof(g._doOnFrameMouseDown)=="function"){this.contentWindow.document.body.attachEvent("onmousedown",g._doOnFrameMouseDown)}}catch(l){}try{if(typeof(g._doOnFrameContentLoaded)=="function"){g._doOnFrameContentLoaded()}}catch(l){}}}}};dhtmlXCellObject.prototype._doOnFrameContentLoaded=function(){if(this.conf.url_data.post_ifr==true){var m=this.getFrame().contentWindow.document;var l=m.createElement("FORM");l.method="POST";l.action=this.conf.url_data.url;m.body.appendChild(l);var g={};if(window.dhx4.ajax.cache!=true){g["dhxr"+new Date().getTime()]="1"}for(var c in this.conf.url_data.post_data){g[c]=this.conf.url_data.post_data[c]}for(var c in g){var j=m.createElement("INPUT");j.type="hidden";j.name=c;j.value=g[c];l.appendChild(j);j=null}this.conf.url_data.post_ifr=false;l.submit()}else{this.callEvent("_onContentLoaded",[this._idd])}};dhtmlXCellObject.prototype._detachURLEvents=function(a){if(a==null){if(this.dataType!="url"){return}a=this.cell.childNodes[this.conf.idx.cont].firstChild}if(typeof(window.addEventListener)=="function"){a.onload=null;try{a.contentWindow.document.body.removeEventListener("mousedown",this._doOnFrameMouseDown,false)}catch(c){}}else{a.onreadystatechange=null;try{a.contentWindow.document.body.detachEvent("onmousedown",this._doOnFrameMouseDown)}catch(c){}}a=null};dhtmlXCellObject.prototype._attachObject=function(l,c,j,a,g){if(typeof(l)=="string"&&{menu:1,toolbar:1,ribbon:1,sb:1}[l]==1){return this["_createNode_"+l].apply(this,arguments)}if(a!=true){this._detachObject(null,true,null)}if(typeof(j)=="string"){this.cell.childNodes[this.conf.idx.cont].innerHTML=j}else{this.cell.childNodes[this.conf.idx.cont].appendChild(l)}l=null};dhtmlXCellObject.prototype._detachObject=function(l,c,a){this.callEvent("_onBeforeContentDetach",[]);if(l=="menu"||l=="toolbar"||l=="ribbon"||l=="sb"){var j=this.cell.childNodes[this.conf.idx[l]];j.parentNode.removeChild(j);j=null;this.conf.ofs_nodes[l=="sb"?"b":"t"][l]=false;this._updateIdx();if(!this.conf.unloading){this._adjustCont(this._idd)}return}if(c==true){a=false}else{if(typeof(a)=="undefined"){a=document.body}else{if(typeof(a)=="string"){a=document.getElementById(a)}}}if(a===false){if(this.dataType=="url"){this._detachURLEvents()}else{if(this.dataObj!=null){if(typeof(this.dataObj.unload)=="function"){this.dataObj.unload()}else{if(typeof(this.dataObj.destructor)=="function"){this.dataObj.destructor()}}}}}var j=this.cell.childNodes[this.conf.idx.cont];while(j.childNodes.length>0){if(a===false){j.removeChild(j.lastChild)}else{j.firstChild.style.display="none";a.appendChild(j.firstChild)}}if(this.conf.append_mode){j.style.overflow="";this.conf.append_mode=false}var g=(this.dataType=="tabbar");this.dataObj=null;this.dataType=null;a=j=null;if(this.conf.unloading!=true&&g){this.showHeader(true);this._showBorders()}};dhtmlXCellObject.prototype._attachFromCell=function(c){this.detachObject(true);var j="layout";if(typeof(window.dhtmlXWindowsCell)!="undefined"&&this instanceof window.dhtmlXWindowsCell){j="window"}if(typeof(window.dhtmlXWindowsCell)!="undefined"&&c instanceof window.dhtmlXWindowsCell&&c.wins.w[c._idd].conf.parked){c.wins._winCellSetOpacity(c._idd,"open",false)}if(typeof(window.dhtmlXAccordionCell)!="undefined"&&c instanceof window.dhtmlXAccordionCell&&c.conf.opened==false){c._cellSetOpacity("open",false)}for(var g in c.dataNodes){this._attachObject(g,null,null,null,c.cell.childNodes[c.conf.idx[g]]);this.dataNodes[g]=c.dataNodes[g];c.dataNodes[g]=null;c.conf.ofs_nodes[g=="sb"?"b":"t"][g]=false;c._updateIdx()}this._mtbUpdBorder();if(c.dataType!=null&&c.dataObj!=null){this.dataType=c.dataType;this.dataObj=c.dataObj;while(c.cell.childNodes[c.conf.idx.cont].childNodes.length>0){this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild)}c.dataType=null;c.dataObj=null;if(this.dataType=="grid"){if(j=="window"&&this.conf.skin=="dhx_skyblue"){this.dataObj.entBox.style.border="1px solid #a4bed4";this.dataObj._sizeFix=0}else{this.dataObj.entBox.style.border="0px solid white";this.dataObj._sizeFix=2}}}else{while(c.cell.childNodes[c.conf.idx.cont].childNodes.length>0){this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild)}}this.conf.view=c.conf.view;c.conf.view="def";for(var g in c.views){this.views[g]=c.views[g];c.views[g]=null;delete c.views[g]}c._updateIdx();c._adjustCont();this._updateIdx();this._adjustCont();if(c.conf.progress==true){c.progressOff();this.progressOn()}else{this.progressOff()}if(j=="window"&&this.wins.w[this._idd].conf.parked){this.wins._winCellSetOpacity(this._idd,"close",false)}};function dhtmlXCellTop(j,c){if(arguments.length==0||typeof(j)=="undefined"){return}var a=this;this.dataNodes={};this.conf.ofs={t:0,b:0,l:0,r:0};this.conf.ofs_nodes={t:{},b:{}};this.conf.progress=false;this.conf.fs_mode=false;this.conf.fs_tm=null;this.conf.fs_resize=false;if(j==document.body){this.conf.fs_mode=true;this.base=j;if(this.base==document.body){var g={dhx_skyblue:{t:2,b:2,l:2,r:2},dhx_web:{t:8,b:8,l:8,r:8},dhx_terrace:{t:9,b:9,l:8,r:8}};this.conf.ofs=(g[this.conf.skin]!=null?g[this.conf.skin]:g.dhx_skyblue)}}else{this.base=(typeof(j)=="string"?document.getElementById(j):j)}this.base.className+=" "+this.conf.css+"_base_"+this.conf.skin;this.cont=document.createElement("DIV");this.cont.className=this.conf.css+"_cont";this.base.appendChild(this.cont);if(c!=null){this.setOffsets(c,false)}else{if(this.base._ofs!=null){this.setOffsets(this.base._ofs,false);this.base._ofs=null;try{delete this.base._ofs}catch(l){}}}this._adjustCont=function(){var o=this.conf.ofs.t;for(var n in this.conf.ofs_nodes.t){o+=(this.conf.ofs_nodes.t[n]==true?this.dataNodes[n].offsetHeight:0)}var m=this.conf.ofs.b;for(var n in this.conf.ofs_nodes.b){m+=(this.conf.ofs_nodes.b[n]==true?this.dataNodes[n].offsetHeight:0)}this.cont.style.left=this.conf.ofs.l+"px";this.cont.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px";this.cont.style.top=o+"px";this.cont.style.height=this.base.offsetHeight-o-m+"px"};this._setBaseSkin=function(m){this.base.className=this.base.className.replace(new RegExp(this.conf.css+"_base_"+this.conf.skin,"gi"),this.conf.css+"_base_"+m)};this._initFSResize=function(){if(this.conf.fs_resize==true){return}this._doOnResizeStart=function(){window.clearTimeout(a.conf.fs_tm);a.conf.fs_tm=window.setTimeout(a._doOnResizeEnd,200)};this._doOnResizeEnd=function(){a.setSizes()};if(typeof(window.addEventListener)=="function"){window.addEventListener("resize",this._doOnResizeStart,false)}else{window.attachEvent("onresize",this._doOnResizeStart)}this.conf.fs_resize=true};if(this.conf.fs_mode==true){this._initFSResize()}this._unloadTop=function(){this._mtbUnload();this.detachHeader();this.detachFooter();if(this.conf.fs_mode==true){if(typeof(window.addEventListener)=="function"){window.removeEventListener("resize",this._doOnResizeStart,false)}else{window.detachEvent("onresize",this._doOnResizeStart)}}this.base.removeChild(this.cont);var m=new RegExp("s{0,}"+this.conf.css+"_base_"+this.conf.skin,"gi");this.base.className=this.base.className.replace(m,"");this.cont=this.base=null;a=null};j=null}dhtmlXCellTop.prototype.setOffsets=function(m,l){var j=false;for(var c in m){var g=c.charAt(0);if(typeof(this.conf.ofs[g])!="undefined"&&!isNaN(m[c])){this.conf.ofs[g]=parseInt(m[c]);j=true}}if(l!==false&&typeof(this.setSizes)=="function"&&j==true){this.setSizes()}};dhtmlXCellTop.prototype.attachMenu=function(a){if(this.dataNodes.menu!=null){return}this.dataNodes.menuObj=document.createElement("DIV");this.dataNodes.menuObj.className="dhxcelltop_menu";this.base.insertBefore(this.dataNodes.menuObj,this.dataNodes.toolbarObj||this.dataNodes.ribbonObj||this.cont);if(typeof(a)!="object"||a==null){a={}}a.skin=this.conf.skin;a.parent=this.dataNodes.menuObj;this.dataNodes.menu=new dhtmlXMenuObject(a);this.dataNodes.menuEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.menuObj.style.display=="none"){return}this.dataNodes.menuObj.style.left=this.conf.ofs.l+"px";this.dataNodes.menuObj.style.marginTop=(this.dataNodes.haObj!=null?0:this.conf.ofs.t)+"px";this.dataNodes.menuObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.conf.ofs_nodes.t.menuObj=true;this.setSizes();a.parnt=null;a=null;return this.dataNodes.menu};dhtmlXCellTop.prototype.detachMenu=function(){if(this.dataNodes.menu==null){return}this.dataNodes.menu.unload();this.dataNodes.menu=null;this.dataNodes.menuObj.parentNode.removeChild(this.dataNodes.menuObj);this.dataNodes.menuObj=null;this.detachEvent(this.dataNodes.menuEv);this.dataNodes.menuEv=null;delete this.dataNodes.menu;delete this.dataNodes.menuObj;delete this.dataNodes.menuEv;this.conf.ofs_nodes.t.menuObj=false;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachToolbar=function(a){if(!(this.dataNodes.ribbon==null&&this.dataNodes.toolbar==null)){return}this.dataNodes.toolbarObj=document.createElement("DIV");this.dataNodes.toolbarObj.className="dhxcelltop_toolbar";this.base.insertBefore(this.dataNodes.toolbarObj,this.cont);this.dataNodes.toolbarObj.appendChild(document.createElement("DIV"));if(typeof(a)!="object"||a==null){a={}}a.skin=this.conf.skin;a.parent=this.dataNodes.toolbarObj.firstChild;this.dataNodes.toolbar=new dhtmlXToolbarObject(a);this.dataNodes.toolbarEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.toolbarObj.style.display=="none"){return}this.dataNodes.toolbarObj.style.left=this.conf.ofs.l+"px";this.dataNodes.toolbarObj.style.marginTop=(this.dataNodes.haObj!=null||this.dataNodes.menuObj!=null?0:this.conf.ofs.t)+"px";this.dataNodes.toolbarObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.dataNodes.toolbar._masterCell=this;this.dataNodes.toolbar.attachEvent("_onIconSizeChange",function(){this._masterCell.setSizes()});this.conf.ofs_nodes.t.toolbarObj=true;this.setSizes();a.parnt=null;a=null;return this.dataNodes.toolbar};dhtmlXCellTop.prototype.detachToolbar=function(){if(this.dataNodes.toolbar==null){return}this.dataNodes.toolbar._masterCell=null;this.dataNodes.toolbar.unload();this.dataNodes.toolbar=null;this.dataNodes.toolbarObj.parentNode.removeChild(this.dataNodes.toolbarObj);this.dataNodes.toolbarObj=null;this.detachEvent(this.dataNodes.toolbarEv);this.dataNodes.toolbarEv=null;this.conf.ofs_nodes.t.toolbarObj=false;delete this.dataNodes.toolbar;delete this.dataNodes.toolbarObj;delete this.dataNodes.toolbarEv;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachRibbon=function(a){if(!(this.dataNodes.ribbon==null&&this.dataNodes.toolbar==null)){return}this.dataNodes.ribbonObj=document.createElement("DIV");this.dataNodes.ribbonObj.className="dhxcelltop_ribbon";this.base.insertBefore(this.dataNodes.ribbonObj,this.cont);this.dataNodes.ribbonObj.appendChild(document.createElement("DIV"));if(typeof(a)!="object"||a==null){a={}}a.skin=this.conf.skin;a.parent=this.dataNodes.ribbonObj.firstChild;this.dataNodes.ribbon=new dhtmlXRibbon(a);this.dataNodes.ribbonEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.ribbonObj.style.display=="none"){return}this.dataNodes.ribbonObj.style.left=this.conf.ofs.l+"px";this.dataNodes.ribbonObj.style.marginTop=(this.dataNodes.haObj!=null||this.dataNodes.menuObj!=null?0:this.conf.ofs.t)+"px";this.dataNodes.ribbonObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px";this.dataNodes.ribbon.setSizes()});this.conf.ofs_nodes.t.ribbonObj=true;var c=this;this.dataNodes.ribbon.attachEvent("_onHeightChanged",function(){c.setSizes()});this.setSizes();a.parnt=null;a=null;return this.dataNodes.ribbon};dhtmlXCellTop.prototype.detachRibbon=function(){if(this.dataNodes.ribbon==null){return}this.dataNodes.ribbon.unload();this.dataNodes.ribbon=null;this.dataNodes.ribbonObj.parentNode.removeChild(this.dataNodes.ribbonObj);this.dataNodes.ribbonObj=null;this.detachEvent(this.dataNodes.ribbonEv);this.dataNodes.ribbonEv=null;this.conf.ofs_nodes.t.ribbonObj=false;delete this.dataNodes.ribbon;delete this.dataNodes.ribbonObj;delete this.dataNodes.ribbonEv;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachStatusBar=function(a){if(this.dataNodes.sbObj){return}if(typeof(a)=="undefined"){a={}}this.dataNodes.sbObj=document.createElement("DIV");this.dataNodes.sbObj.className="dhxcelltop_statusbar";if(this.cont.nextSibling!=null){this.base.insertBefore(this.dataNodes.sbObj,this.cont.nextSibling)}else{this.base.appendChild(this.dataNodes.sbObj)}this.dataNodes.sbObj.innerHTML="<div class='dhxcont_statusbar'>"+(typeof(a.text)=="string"&&a.text.length>0?a.text:"&nbsp;")+"</div>";if(typeof(a.height)=="number"){this.dataNodes.sbObj.firstChild.style.height=this.dataNodes.sbObj.firstChild.style.lineHeight=a.height+"px"}this.dataNodes.sbObj.setText=function(c){this.childNodes[0].innerHTML=c};this.dataNodes.sbObj.getText=function(){return this.childNodes[0].innerHTML};this.dataNodes.sbObj.onselectstart=function(c){return false};this.dataNodes.sbEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.sbObj.style.display=="none"){return}this.dataNodes.sbObj.style.left=this.conf.ofs.l+"px";this.dataNodes.sbObj.style.bottom=(this.dataNodes.faObj!=null?this.dataNodes.faObj.offsetHeight:0)+this.conf.ofs.t+"px";this.dataNodes.sbObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.conf.ofs_nodes.b.sbObj=true;this.setSizes();return this.dataNodes.sbObj};dhtmlXCellTop.prototype.detachStatusBar=function(){if(!this.dataNodes.sbObj){return}this.dataNodes.sbObj.setText=this.dataNodes.sbObj.getText=this.dataNodes.sbObj.onselectstart=null;this.dataNodes.sbObj.parentNode.removeChild(this.dataNodes.sbObj);this.dataNodes.sbObj=null;this.detachEvent(this.dataNodes.sbEv);this.dataNodes.sbEv=null;this.conf.ofs_nodes.b.sbObj=false;delete this.dataNodes.sb;delete this.dataNodes.sbObj;delete this.dataNodes.sbEv;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.showMenu=function(){this._mtbShowHide("menuObj","")};dhtmlXCellTop.prototype.hideMenu=function(){this._mtbShowHide("menuObj","none")};dhtmlXCellTop.prototype.showToolbar=function(){this._mtbShowHide("toolbarObj","")};dhtmlXCellTop.prototype.hideToolbar=function(){this._mtbShowHide("toolbarObj","none")};dhtmlXCellTop.prototype.showRibbon=function(){this._mtbShowHide("ribbonObj","")};dhtmlXCellTop.prototype.hideRibbon=function(){this._mtbShowHide("ribbonObj","none")};dhtmlXCellTop.prototype.showStatusBar=function(){this._mtbShowHide("sbObj","")};dhtmlXCellTop.prototype.hideStatusBar=function(){this._mtbShowHide("sbObj","none")};dhtmlXCellTop.prototype._mtbShowHide=function(c,a){if(this.dataNodes[c]==null){return}this.dataNodes[c].style.display=a;this.setSizes()};dhtmlXCellTop.prototype._mtbUnload=function(c,a){this.detachMenu();this.detachToolbar();this.detachStatusBar();this.detachRibbon()};dhtmlXCellTop.prototype.getAttachedMenu=function(){return this.dataNodes.menu};dhtmlXCellTop.prototype.getAttachedToolbar=function(){return this.dataNodes.toolbar};dhtmlXCellTop.prototype.getAttachedRibbon=function(){return this.dataNodes.ribbon};dhtmlXCellTop.prototype.getAttachedStatusBar=function(){return this.dataNodes.sbObj};dhtmlXCellTop.prototype.progressOn=function(){if(this.conf.progress){return}this.conf.progress=true;var c=document.createElement("DIV");c.className="dhxcelltop_progress";this.base.appendChild(c);var a=document.createElement("DIV");a.className="dhxcelltop_progress_img";this.base.appendChild(a);c=a=null};dhtmlXCellTop.prototype.progressOff=function(){if(!this.conf.progress){return}var j={dhxcelltop_progress:true,dhxcelltop_progress_img:true};for(var g=0;g<this.base.childNodes.length;g++){if(typeof(this.base.childNodes[g].className)!="undefined"&&j[this.base.childNodes[g].className]==true){j[this.base.childNodes[g].className]=this.base.childNodes[g]}}for(var c in j){if(j[c]!=true){this.base.removeChild(j[c])}j[c]=null}this.conf.progress=false;j=null};dhtmlXCellTop.prototype.attachHeader=function(c,a){if(this.dataNodes.haObj!=null){return}if(typeof(c)!="object"){c=document.getElementById(c)}this.dataNodes.haObj=document.createElement("DIV");this.dataNodes.haObj.className="dhxcelltop_hdr";this.dataNodes.haObj.style.height=(a||c.offsetHeight)+"px";this.base.insertBefore(this.dataNodes.haObj,this.dataNodes.menuObj||this.dataNodes.toolbarObj||this.cont);this.dataNodes.haObj.appendChild(c);c.style.visibility="visible";c=null;this.dataNodes.haEv=this.attachEvent("_onSetSizes",function(){this.dataNodes.haObj.style.left=this.conf.ofs.l+"px";this.dataNodes.haObj.style.marginTop=this.conf.ofs.t+"px";this.dataNodes.haObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.conf.ofs_nodes.t.haObj=true;this.setSizes()};dhtmlXCellTop.prototype.detachHeader=function(){if(!this.dataNodes.haObj){return}while(this.dataNodes.haObj.childNodes.length>0){this.dataNodes.haObj.lastChild.style.visibility="hidden";document.body.appendChild(this.dataNodes.haObj.lastChild)}this.dataNodes.haObj.parentNode.removeChild(this.dataNodes.haObj);this.dataNodes.haObj=null;this.detachEvent(this.dataNodes.haEv);this.dataNodes.haEv=null;this.conf.ofs_nodes.t.haObj=false;delete this.dataNodes.haEv;delete this.dataNodes.haObj;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachFooter=function(g,a){if(this.dataNodes.faObj!=null){return}if(typeof(g)!="object"){g=document.getElementById(g)}this.dataNodes.faObj=document.createElement("DIV");this.dataNodes.faObj.className="dhxcelltop_ftr";this.dataNodes.faObj.style.height=(a||g.offsetHeight)+"px";var c=(this.dataNodes.sbObj||this.cont);if(this.base.lastChild==c){this.base.appendChild(this.dataNodes.faObj)}else{this.base.insertBefore(this.dataNodes.faObj,c.nextSibling)}this.dataNodes.faEv=this.attachEvent("_onSetSizes",function(){this.dataNodes.faObj.style.left=this.conf.ofs.l+"px";this.dataNodes.faObj.style.bottom=this.conf.ofs.b+"px";this.dataNodes.faObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.dataNodes.faObj.appendChild(g);g.style.visibility="visible";c=g=null;this.conf.ofs_nodes.b.faObj=true;this.setSizes()};dhtmlXCellTop.prototype.detachFooter=function(){if(!this.dataNodes.faObj){return}while(this.dataNodes.faObj.childNodes.length>0){this.dataNodes.faObj.lastChild.style.visibility="hidden";document.body.appendChild(this.dataNodes.faObj.lastChild)}this.dataNodes.faObj.parentNode.removeChild(this.dataNodes.faObj);this.dataNodes.faObj=null;this.detachEvent(this.dataNodes.faEv);this.dataNodes.faEv=null;this.conf.ofs_nodes.b.faObj=false;delete this.dataNodes.faEv;delete this.dataNodes.faObj;if(!this.conf.unloading){this.setSizes()}};function dhtmlXCalendarObject(m,u){this.i={};var g=null;if(typeof(m)=="string"){var j=document.getElementById(m)}else{var j=m}if(j&&typeof(j)=="object"&&j.tagName&&String(j.tagName).toLowerCase()!="input"){g=j}j=null;if(typeof(m)!="object"||!m.length){m=[m]}for(var c=0;c<m.length;c++){if(typeof(m[c])=="string"){m[c]=(document.getElementById(m[c])||null)}if(m[c]!=null&&m[c].tagName&&String(m[c].tagName).toLowerCase()=="input"){this.i[window.dhx4.newId()]={input:m[c]}}else{if(!(m[c] instanceof Array)&&m[c] instanceof Object&&(m[c].input!=null||m[c].button!=null)){if(m[c].input!=null&&typeof(m[c].input)=="string"){m[c].input=document.getElementById(m[c].input)}if(m[c].button!=null&&typeof(m[c].button)=="string"){m[c].button=document.getElementById(m[c].button)}this.i[window.dhx4.newId()]=m[c]}}m[c]=null}this.conf={skin:(u||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhtmlxcalendar")||"dhx_skyblue"),zi:window.dhx4.newId(),touch:!window.dhx4.isIE,ws_first:true};this.setSkin=function(q,a){if(this.conf.skin==q&&!a){return}this.conf.skin=q;this.base.className="dhtmlxcalendar_"+this.conf.skin;this._ifrSize()};this.base=document.createElement("DIV");this.base.style.display="none";this.base.appendChild(document.createElement("DIV"));if(g!=null){this._hasParent=true;g.appendChild(this.base);g=null}else{document.body.appendChild(this.base)}this.setParent=function(a){if(this._hasParent){if(typeof(a)=="object"){a.appendChild(this.base)}else{if(typeof(a)=="string"){document.getElementById(a).appendChild(this.base)}}}};this.setSkin(this.conf.skin,true);this.base.onclick=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}a.cancelBubble=true};this.base.onmousedown=function(){return false};if(this.conf.touch){this.base.ontouchstart=this.base.onclick}this.loadUserLanguage=function(y){if(!this.langData[y]){return}this.lang=y;this.setWeekStartDay(this.langData[this.lang].weekstart);this.setDateFormat(this.langData[this.lang].dateformat||"%Y-%m-%d");if(this.msCont){var x=0;for(var v=0;v<this.msCont.childNodes.length;v++){for(var a=0;a<this.msCont.childNodes[v].childNodes.length;a++){this.msCont.childNodes[v].childNodes[a].innerHTML=this.langData[this.lang].monthesSNames[x++]}}}};this.contMonth=document.createElement("DIV");this.contMonth.className="dhtmlxcalendar_month_cont";this.contMonth.onselectstart=function(a){a=a||event;a.cancelBubble=true;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};this.base.firstChild.appendChild(this.contMonth);var n=document.createElement("UL");n.className="dhtmlxcalendar_line";this.contMonth.appendChild(n);var s=document.createElement("LI");s.className="dhtmlxcalendar_cell dhtmlxcalendar_month_hdr";s.innerHTML="<div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left' onmouseover='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left_hover\";' onmouseout='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left\";'></div><span></span><div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right' onmouseover='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right_hover\";' onmouseout='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right\";'></div>";n.appendChild(s);var l=this;s.onclick=function(w){w=w||event;if(w.type=="touchstart"&&w.preventDefault!=null){w.preventDefault()}var q=(w.target||w.srcElement);if(q.className&&q.className.indexOf("dhtmlxcalendar_month_arrow")===0){l._hideSelector();var v=(q.parentNode.firstChild==q?-1:1);var a=new Date(l._activeMonth);l._drawMonth(new Date(l._activeMonth.getFullYear(),l._activeMonth.getMonth()+v,1,0,0,0,0));l._evOnArrowClick([a,new Date(l._activeMonth)]);return}if(q.className&&q.className=="dhtmlxcalendar_month_label_month"){w.cancelBubble=true;l._showSelector("month",Math.round(q.offsetLeft+q.offsetWidth/2),q.offsetTop+q.offsetHeight+2,"selector_month",true);return}if(q.className&&q.className=="dhtmlxcalendar_month_label_year"){w.cancelBubble=true;l._showSelector("year",Math.round(q.offsetLeft+q.offsetWidth/2),q.offsetTop+q.offsetHeight+2,"selector_year",true);return}l._hideSelector()};if(this.conf.touch==true){s.ontouchstart=s.onclick}this.contDays=document.createElement("DIV");this.contDays.className="dhtmlxcalendar_days_cont";this.base.firstChild.appendChild(this.contDays);this.setWeekStartDay=function(a){if(a==0){a=7}this._wStart=Math.min(Math.max((isNaN(a)?1:a),1),7);this._drawDaysOfWeek()};this._drawDaysOfWeek=function(){if(this.contDays.childNodes.length==0){var y=document.createElement("UL");y.className="dhtmlxcalendar_line";this.contDays.appendChild(y)}else{var y=this.contDays.firstChild}var v=this._wStart;var x=this.langData[this.lang].daysSNames;x.push(String(this.langData[this.lang].daysSNames[0]).valueOf());for(var A=0;A<8;A++){if(y.childNodes[A]==null){var a=document.createElement("LI");y.appendChild(a)}else{var a=y.childNodes[A]}if(A==0){a.className="dhtmlxcalendar_cell_wn";a.innerHTML="<div class='dhtmlxcalendar_label'>"+(this.langData[this.lang].weekname||"w")+"</div>"}else{a.className="dhtmlxcalendar_cell"+(v>=6?" dhtmlxcalendar_day_weekday_cell":"")+(A==1?"_first":"");a.innerHTML=x[v];if(++v>7){v=1}}}if(this._activeMonth!=null){this._drawMonth(this._activeMonth)}};this._wStart=this.langData[this.lang].weekstart;this.setWeekStartDay(this._wStart);this.contDates=document.createElement("DIV");this.contDates.className="dhtmlxcalendar_dates_cont";this.base.firstChild.appendChild(this.contDates);this.contDates.onclick=function(y){y=y||event;if(y.type=="touchstart"&&y.preventDefault!=null){y.preventDefault()}var q=(y.target||y.srcElement);if(q.parentNode!=null&&q.parentNode._date!=null){q=q.parentNode}if(q._date!=null&&!q._css_dis){var w=l._activeDate.getHours();var v=l._activeDate.getMinutes();var x=q._date;if(l.checkEvent("onBeforeChange")){if(!l.callEvent("onBeforeChange",[new Date(q._date.getFullYear(),q._date.getMonth(),q._date.getDate(),w,v)])){return}}if(l._activeDateCell!=null){l._activeDateCell._css_date=false;l._updateCellStyle(l._activeDateCell._q,l._activeDateCell._w)}var a=(l._activeDate.getFullYear()+"_"+l._activeDate.getMonth()!=x.getFullYear()+"_"+x.getMonth());l._nullDate=false;l._activeDate=new Date(x.getFullYear(),x.getMonth(),x.getDate(),w,v);l._activeDateCell=q;l._activeDateCell._css_date=true;l._activeDateCell._css_hover=false;l._updateCellStyle(l._activeDateCell._q,l._activeDateCell._w);if(a){l._drawMonth(l._activeDate)}if(l._activeInp&&l.i[l._activeInp]&&l.i[l._activeInp].input!=null){l.i[l._activeInp].input.value=l._dateToStr(new Date(l._activeDate.getTime()))}if(!l._hasParent){if(y.type=="touchstart"){window.setTimeout(function(){l._hide()},400)}else{l._hide()}}l._evOnClick([new Date(l._activeDate.getTime())])}};if(this.conf.touch==true){this.contDates.ontouchstart=this.contDates.onclick}this.contDates.onmouseover=function(q){q=q||event;var a=(q.target||q.srcElement);if(a.parentNode!=null&&a.parentNode._date!=null){a=a.parentNode}if(a._date!=null){if(l._lastHover==a||a._css_hover){return}a._css_hover=true;l._updateCellStyle(a._q,a._w);l._lastHover=a;l._evOnMouseOver([new Date(a._date.getFullYear(),a._date.getMonth(),a._date.getDate(),0,0,0,0),q]);a=null}};this.contDates.onmouseout=function(a){l._clearDayHover(a||event)};this._lastHover=null;this._clearDayHover=function(a){if(!this._lastHover){return}this._lastHover._css_hover=false;this._updateCellStyle(this._lastHover._q,this._lastHover._w);l._evOnMouseOut([new Date(this._lastHover._date.getFullYear(),this._lastHover._date.getMonth(),this._lastHover._date.getDate(),0,0,0,0),a]);this._lastHover=null};for(var c=0;c<6;c++){var n=document.createElement("UL");n.className="dhtmlxcalendar_line";this.contDates.appendChild(n);for(var r=0;r<=7;r++){var s=document.createElement("LI");if(r==0){s.className="dhtmlxcalendar_cell_wn"}else{s.className="dhtmlxcalendar_cell"}n.appendChild(s)}}this.contTime=document.createElement("DIV");this.contTime.className="dhtmlxcalendar_time_cont";this.base.firstChild.appendChild(this.contTime);this.showTime=function(){this.contTime.style.display="";this._ifrSize()};this.hideTime=function(){this.contTime.style.display="none";this._ifrSize()};var n=document.createElement("UL");n.className="dhtmlxcalendar_line";this.contTime.appendChild(n);var s=document.createElement("LI");s.className="dhtmlxcalendar_cell dhtmlxcalendar_time_hdr";s.innerHTML="<div class='dhtmlxcalendar_time_img'></div><span class='dhtmlxcalendar_label_hours'></span><span class='dhtmlxcalendar_label_colon'> : </span><span class='dhtmlxcalendar_label_minutes'></span>";n.appendChild(s);s.onclick=function(v){v=v||event;if(v.type=="touchstart"&&v.preventDefault!=null){v.preventDefault()}var a=(v.target||v.srcElement);if(a.tagName!=null&&a.tagName.toLowerCase()=="span"&&a._par==true&&a.parentNode!=null){a=a.parentNode}if(a.className&&a.className=="dhtmlxcalendar_label_hours"){v.cancelBubble=true;var q=l.contMonth.offsetHeight+l.contDays.offsetHeight+l.contDates.offsetHeight+a.offsetTop;l._showSelector("hours",Math.round(a.offsetLeft+a.offsetWidth/2),q-2,"selector_hours",true);return}if(a.className&&a.className=="dhtmlxcalendar_label_minutes"){v.cancelBubble=true;if(l._minutesInterval==1){var w=l.getFormatedDate("%i");a.innerHTML="<span class='dhtmlxcalendar_selected_date'>"+w.charAt(0)+"</span>"+w.charAt(1);a.firstChild._par=true;l._selectorMode=1}var q=l.contMonth.offsetHeight+l.contDays.offsetHeight+l.contDates.offsetHeight+a.offsetTop;l._showSelector("minutes",Math.round(a.offsetLeft+a.offsetWidth/2),q-2,"selector_minutes",true);return}l._hideSelector()};if(this.conf.touch==true){s.ontouchstart=s.onclick}this._activeMonth=null;this._activeDate=new Date();this._activeDateCell=null;this.setDate=function(q){window.dhx4.temp_calendar={tz:null};this._nullDate=(typeof(q)=="undefined"||q===""||!q);if(!(q instanceof Date)){q=this._strToDate(String(q||""));if(q=="Invalid Date"){q=new Date()}else{this.conf.tz=window.dhx4.temp_calendar.tz}window.dhx4.temp_calendar=null}if(this.conf.tz==null){this.conf.tz=window.dhx4.date2str(q,"%P")}var a=q.getTime();if(this._isOutOfRange(a)){return}this._activeDate=new Date(a);this._drawMonth(this._nullDate?new Date():this._activeDate);this._updateVisibleHours();this._updateVisibleMinutes()};this.getDate=function(v){if(this._nullDate){return null}var a=new Date(this._activeDate.getTime());if(v){window.dhx4.temp_calendar={tz:this.conf.tz};var q=this._dateToStr(a);window.dhx4.temp_calendar=null;return q}return a};this._drawMonth=function(H){if(!(H instanceof Date)){return}if(isNaN(H.getFullYear())){H=new Date(this._activeMonth.getFullYear(),this._activeMonth.getMonth(),1,0,0,0,0)}this._activeMonth=new Date(H.getFullYear(),H.getMonth(),1,0,0,0,0);this._activeDateCell=null;var E=new Date(this._activeMonth.getTime());var x=E.getDay();var K=x-this._wStart;if(K<0){K=K+7}E.setDate(E.getDate()-K);var N=H.getMonth();var O=new Date(this._activeDate.getFullYear(),this._activeDate.getMonth(),this._activeDate.getDate(),0,0,0,0).getTime();var C=0;for(var v=0;v<6;v++){var F=this._wStart;for(var M=0;M<=7;M++){if(M==0){var L=this.getWeekNumber(new Date(E.getFullYear(),E.getMonth(),E.getDate()+C,0,0,0,0));if(L>=52&&this.conf.ws_first==true&&this._activeMonth.getMonth()==0){var A=this.getWeekNumber(new Date(E.getFullYear(),E.getMonth(),E.getDate()+C+7,0,0,0,0));if(A<L&&A>1){L=1}}this.contDates.childNodes[v].childNodes[M].innerHTML="<div class='dhtmlxcalendar_label'>"+L+"</div>"}else{var a=new Date(E.getFullYear(),E.getMonth(),E.getDate()+C,0,0,0,0);if(a.getHours()!=0){var D=(a.getHours()>12?24-a.getHours():a.getHours());a.setTime(a.getTime()+60*60*1000*D)}var J=a.getDay();var y=a.getTime();var I="dhtmlxcalendar_label";if(this._tipData[y]!=null){if(this._tipData[y].usePopup&&typeof(window.dhtmlXPopup)=="function"){this.contDates.childNodes[v].childNodes[M].removeAttribute("title");this._initTooltipPopup()}else{this.contDates.childNodes[v].childNodes[M].setAttribute("title",this._tipData[y].text)}if(this._tipData[y].showIcon){I+=" dhtmlxcalendar_label_title"}}else{this.contDates.childNodes[v].childNodes[M].removeAttribute("title")}this.contDates.childNodes[v].childNodes[M].innerHTML="<div class='"+I+"'>"+a.getDate()+"</div>";this.contDates.childNodes[v].childNodes[M]._date=new Date(y);this.contDates.childNodes[v].childNodes[M]._q=v;this.contDates.childNodes[v].childNodes[M]._w=M;this.contDates.childNodes[v].childNodes[M]._css_month=(a.getMonth()==N);this.contDates.childNodes[v].childNodes[M]._css_date=(!this._nullDate&&y==O);this.contDates.childNodes[v].childNodes[M]._css_weekend=(F>=6);this.contDates.childNodes[v].childNodes[M]._css_dis=this._isOutOfRange(y);this.contDates.childNodes[v].childNodes[M]._css_holiday=(this._holidays[y]==true);this._updateCellStyle(v,M);if(y==O){this._activeDateCell=this.contDates.childNodes[v].childNodes[M]}if(++F>7){F=1}C++}}}this.contMonth.firstChild.firstChild.childNodes[1].innerHTML=this._buildMonthHdr(H)};this._updateCellStyle=function(y,a){var x=this.contDates.childNodes[y].childNodes[a];var v="dhtmlxcalendar_cell dhtmlxcalendar_cell";v+=(x._css_month?"_month":"");v+=(x._css_date?"_date":"");v+=(x._css_weekend?"_weekend":"");v+=(x._css_holiday?"_holiday":"");v+=(x._css_dis?"_dis":"");v+=(x._css_hover&&!x._css_dis?"_hover":"");x.className=v;x=null};this._minutesInterval=5;this._initSelector=function(E,y){if(!this._selCover){this._selCover=document.createElement("DIV");this._selCover.className="dhtmlxcalendar_selector_cover";this.base.firstChild.appendChild(this._selCover)}if(!this._sel){this._sel=document.createElement("DIV");this._sel.className="dhtmlxcalendar_selector_obj";this.base.firstChild.appendChild(this._sel);this._sel.appendChild(document.createElement("TABLE"));this._sel.firstChild.className="dhtmlxcalendar_selector_table";this._sel.firstChild.cellSpacing=0;this._sel.firstChild.cellPadding=0;this._sel.firstChild.border=0;this._sel.firstChild.appendChild(document.createElement("TBODY"));this._sel.firstChild.firstChild.appendChild(document.createElement("TR"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.childNodes[0].className="dhtmlxcalendar_selector_cell_left";this._sel.firstChild.firstChild.firstChild.childNodes[1].className="dhtmlxcalendar_selector_cell_middle";this._sel.firstChild.firstChild.firstChild.childNodes[2].className="dhtmlxcalendar_selector_cell_right";this._sel.firstChild.firstChild.firstChild.childNodes[0].innerHTML="&nbsp;";this._sel.firstChild.firstChild.firstChild.childNodes[2].innerHTML="&nbsp;";this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseover=function(){this.className="dhtmlxcalendar_selector_cell_left dhtmlxcalendar_selector_cell_left_hover"};this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseout=function(){this.className="dhtmlxcalendar_selector_cell_left"};this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseover=function(){this.className="dhtmlxcalendar_selector_cell_right dhtmlxcalendar_selector_cell_right_hover"};this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseout=function(){this.className="dhtmlxcalendar_selector_cell_right"};this._sel.onmouseover=function(w){w=w||event;var q=(w.target||w.srcElement);if(q._cell===true){if(l._selHover!=q){l._clearSelHover()}if(String(q.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi)!=null){q.className+=" dhtmlxcalendar_selector_cell_hover";l._selHover=q}}};this._sel.onmouseout=function(){l._clearSelHover()};this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick=function(q){q=q||event;if(q.type=="touchstart"&&q.preventDefault!=null){q.preventDefault()}q.cancelBubble=true;l._scrollYears(-1)};this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick=function(q){q=q||event;if(q.type=="touchstart"&&q.preventDefault!=null){q.preventDefault()}q.cancelBubble=true;l._scrollYears(1)};if(this.conf.touch==true){this._sel.firstChild.firstChild.firstChild.childNodes[0].ontouchstart=this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick;this._sel.firstChild.firstChild.firstChild.childNodes[2].ontouchstart=this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick}this._sel._ta={};this._selHover=null;this._sel.appendChild(document.createElement("DIV"));this._sel.lastChild.className="dhtmlxcalendar_selector_obj_arrow"}if(this._sel._ta[E]==true){return}if(E=="month"){this._msCells={};this.msCont=document.createElement("DIV");this.msCont.className="dhtmlxcalendar_area_"+y;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont);var v=0;for(var a=0;a<4;a++){var D=document.createElement("UL");D.className="dhtmlxcalendar_selector_line";this.msCont.appendChild(D);for(var F=0;F<3;F++){var H=document.createElement("LI");H.innerHTML=this.langData[this.lang].monthesSNames[v];H.className="dhtmlxcalendar_selector_cell";D.appendChild(H);H._month=v;H._cell=true;this._msCells[v++]=H}}this.msCont.onclick=function(w){w=w||event;if(w.type=="touchstart"&&w.preventDefault!=null){w.preventDefault()}w.cancelBubble=true;var q=(w.target||w.srcElement);if(q._month!=null){l._hideSelector();l._updateActiveMonth();l._drawMonth(new Date(l._activeMonth.getFullYear(),q._month,1,0,0,0,0));l._doOnSelectorChange()}};if(this.conf.touch==true){this.msCont.ontouchstart=this.msCont.onclick}}if(E=="year"){this._ysCells={};this.ysCont=document.createElement("DIV");this.ysCont.className="dhtmlxcalendar_area_"+y;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont);for(var a=0;a<4;a++){var D=document.createElement("UL");D.className="dhtmlxcalendar_selector_line";this.ysCont.appendChild(D);for(var F=0;F<3;F++){var H=document.createElement("LI");H.className="dhtmlxcalendar_selector_cell";H._cell=true;D.appendChild(H)}}this.ysCont.onclick=function(w){w=w||event;if(w.type=="touchstart"&&w.preventDefault!=null){w.preventDefault()}w.cancelBubble=true;var q=(w.target||w.srcElement);if(q._year!=null){l._hideSelector();l._drawMonth(new Date(q._year,l._activeMonth.getMonth(),1,0,0,0,0));l._doOnSelectorChange()}};if(this.conf.touch==true){this.ysCont.ontouchstart=this.ysCont.onclick}}if(E=="hours"){this._hsCells={};this.hsCont=document.createElement("DIV");this.hsCont.className="dhtmlxcalendar_area_"+y;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont);var v=0;for(var a=0;a<4;a++){var D=document.createElement("UL");D.className="dhtmlxcalendar_selector_line";this.hsCont.appendChild(D);for(var F=0;F<6;F++){var H=document.createElement("LI");H.innerHTML=this._fixLength(v,2);H.className="dhtmlxcalendar_selector_cell";D.appendChild(H);H._hours=v;H._cell=true;this._hsCells[v++]=H}}this.hsCont.onclick=function(w){w=w||event;if(w.type=="touchstart"&&w.preventDefault!=null){w.preventDefault()}w.cancelBubble=true;var q=(w.target||w.srcElement);if(q._hours!=null){l._hideSelector();l._activeDate.setHours(q._hours);l._updateActiveHours();l._updateVisibleHours();l._doOnSelectorChange();l.callEvent("onTimeChange",[new Date(l._activeDate.getTime())])}};if(this.conf.touch==true){this.hsCont.ontouchstart=this.hsCont.onclick}}if(E=="minutes"){var C=4;var x=3;var A=2;if(this._minutesInterval==1){if(this._selectorMode==1){C=2;x=3;A=1}else{C=2;x=5;A=1;y+="5"}}if(this._minutesInterval==10){C=2}if(this._minutesInterval==15){C=1;x=4;y+="4"}this._rsCells={};this.rsCont=document.createElement("DIV");this.rsCont.className="dhtmlxcalendar_area_"+y;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont);var v=0;for(var a=0;a<C;a++){var D=document.createElement("UL");D.className="dhtmlxcalendar_selector_line";this.rsCont.appendChild(D);for(var F=0;F<x;F++){var H=document.createElement("LI");H.innerHTML=(A>1?this._fixLength(v,A):v);H.className="dhtmlxcalendar_selector_cell";D.appendChild(H);H._minutes=v;H._cell=true;this._rsCells[v]=H;v+=this._minutesInterval}}this.rsCont.onclick=function(I){I=I||event;if(I.type=="touchstart"&&I.preventDefault!=null){I.preventDefault()}I.cancelBubble=true;var w=(I.target||I.srcElement);if(w._minutes!=null){if(l._minutesInterval==1){var q=l.getFormatedDate("%i");if(l._selectorMode==1){q=w._minutes.toString()+q.charAt(1)}else{q=q.charAt(0)+w._minutes.toString()}l._activeDate.setMinutes(Number(q));l.callEvent("onTimeChange",[new Date(l._activeDate.getTime())]);l._hideSelector();if(l._selectorMode==1){l._updateVisibleMinutes(true);l._selectorMode=2;l._showSelector("minutes",l._sel._x,l._sel._y,"selector_minutes",true);l._updateActiveMinutes();return}else{l._selectorMode=1}}else{l._hideSelector();l._activeDate.setMinutes(w._minutes);l._updateActiveMinutes();l.callEvent("onTimeChange",[new Date(l._activeDate.getTime())])}l._updateVisibleMinutes();l._doOnSelectorChange()}};if(this.conf.touch==true){this.rsCont.ontouchstart=this.rsCont.onclick}}this._sel._ta[E]=true};this._showSelector=function(A,q,C,w,a){if(a===true&&this._sel!=null&&this._isSelectorVisible()&&A==this._sel._t){this._hideSelector();return}if(this.conf.skin=="dhx_terrace"){q+=12}if(!this._sel||!this._sel._ta[A]){this._initSelector(A,w)}if(A!=this._sel._t&&this._sel._t=="minutes"&&this._minutesInterval==1){this.contTime.firstChild.firstChild.childNodes[3].innerHTML=this.getFormatedDate("%i")}this._sel._x=q;this._sel._y=C;this._sel.style.visibility="hidden";this._sel.style.display="";this._selCover.style.width=this.base.offsetWidth-2+"px";this._selCover.style.top=this.contMonth.offsetHeight+"px";this._selCover.style.height=this.contDates.offsetHeight+this.contDays.offsetHeight-1+"px";this._selCover.style.display="";this._sel._t=A;this._sel.className="dhtmlxcalendar_selector_obj dhtmlxcalendar_"+w;this._sel.childNodes[0].firstChild.firstChild.childNodes[0].style.display=this._sel.childNodes[0].firstChild.firstChild.childNodes[2].style.display=(A=="year"?"":"none");var v=Math.max(0,q-Math.round(this._sel.offsetWidth/2));if(v+this._sel.offsetWidth>this._sel.parentNode.offsetWidth){v=this._sel.parentNode.offsetWidth-this._sel.offsetWidth}this._sel.style.left=v+"px";if(A=="hours"||A=="minutes"){this._sel.style.top=C-this._sel.offsetHeight+"px"}else{this._sel.style.top=C+"px"}this._sel.childNodes[1].style.width=this._sel.childNodes[0].offsetWidth+"px";this._sel.style.visibility="visible";this._doOnSelectorShow(A)};this._doOnSelectorShow=function(a){if(a=="month"){this._updateActiveMonth()}if(a=="year"){this._updateYearsList(this._activeMonth)}if(a=="hours"){this._updateActiveHours()}if(a=="minutes"){this._updateActiveMinutes()}};this._hideSelector=function(a){if(!this._sel){return}this._sel.style.display="none";this._sel.style.visible="hidden";this._selCover.style.display="none";if(this._sel._t=="minutes"&&this._minutesInterval==1){this.contTime.firstChild.firstChild.childNodes[3].innerHTML=this.getFormatedDate("%i");this._unloadSelector("minutes")}};this._isSelectorVisible=function(){if(!this._sel){return false}return(this._sel.style.display!="none")};this._doOnSelectorChange=function(a){this.callEvent("onChange",[new Date(this._activeMonth.getFullYear(),this._activeMonth.getMonth(),this._activeDate.getDate(),this._activeDate.getHours(),this._activeDate.getMinutes(),this._activeDate.getSeconds()),a===true])};this._clearSelHover=function(){if(!this._selHover){return}this._selHover.className=String(this._selHover.className.replace(/dhtmlxcalendar_selector_cell_hover/gi,""));this._selHover=null};this._unloadSelector=function(v){if(!this._sel){return}if(!this._sel._ta[v]){return}if(v=="month"){this.msCont.onclick=this.msCont.ontouchstart=null;this._msActive=null;for(var q in this._msCells){this._msCells[q]._cell=null;this._msCells[q]._month=null;this._msCells[q].parentNode.removeChild(this._msCells[q]);this._msCells[q]=null}this._msCells=null;while(this.msCont.childNodes.length>0){this.msCont.removeChild(this.msCont.lastChild)}this.msCont.parentNode.removeChild(this.msCont);this.msCont=null}if(v=="year"){this.ysCont.onclick=this.ysCont.ontouchstart=null;for(var q in this._ysCells){this._ysCells[q]._cell=null;this._ysCells[q]._year=null;this._ysCells[q].parentNode.removeChild(this._ysCells[q]);this._ysCells[q]=null}this._ysCells=null;while(this.ysCont.childNodes.length>0){this.ysCont.removeChild(this.ysCont.lastChild)}this.ysCont.parentNode.removeChild(this.ysCont);this.ysCont=null}if(v=="hours"){this.hsCont.onclick=this.hsCont.ontouchstart=null;this._hsActive=null;for(var q in this._hsCells){this._hsCells[q]._cell=null;this._hsCells[q]._hours=null;this._hsCells[q].parentNode.removeChild(this._hsCells[q]);this._hsCells[q]=null}this._hsCells=null;while(this.hsCont.childNodes.length>0){this.hsCont.removeChild(this.hsCont.lastChild)}this.hsCont.parentNode.removeChild(this.hsCont);this.hsCont=null}if(v=="minutes"){this.rsCont.onclick=this.rsCont.ontouchstart=null;this._rsActive=null;for(var q in this._rsCells){this._rsCells[q]._cell=null;this._rsCells[q]._minutes=null;this._rsCells[q].parentNode.removeChild(this._rsCells[q]);this._rsCells[q]=null}this._rsCells=null;while(this.rsCont.childNodes.length>0){this.rsCont.removeChild(this.rsCont.lastChild)}this.rsCont.parentNode.removeChild(this.rsCont);this.rsCont=null}this._sel._ta[v]=null};this.setMinutesInterval=function(a){if(!(a==1||a==5||a==10||a==15)){return}this._minutesInterval=a;this._unloadSelector("minutes")};this._updateActiveMonth=function(){if(typeof(this._msActive)!="undefined"&&typeof(this._msCells[this._msActive])!="undefined"){this._msCells[this._msActive].className="dhtmlxcalendar_selector_cell"}this._msActive=this._activeMonth.getMonth();this._msCells[this._msActive].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"};this._updateActiveYear=function(){var a=this._activeMonth.getFullYear();if(this._ysCells[a]){this._ysCells[a].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"}};this._updateYearsList=function(C){for(var x in this._ysCells){this._ysCells[x]=null;delete this._ysCells[x]}var y=12*Math.floor(C.getFullYear()/12);for(var A=0;A<4;A++){for(var v=0;v<3;v++){this.ysCont.childNodes[A].childNodes[v].innerHTML=y;this.ysCont.childNodes[A].childNodes[v]._year=y;this.ysCont.childNodes[A].childNodes[v].className="dhtmlxcalendar_selector_cell";this._ysCells[y++]=this.ysCont.childNodes[A].childNodes[v]}}this._updateActiveYear()};this._scrollYears=function(a){var v=(a<0?this.ysCont.firstChild.firstChild._year:this.ysCont.lastChild.lastChild._year)+a;var q=new Date(v,this._activeMonth.getMonth(),1,0,0,0,0);this._updateYearsList(q)};this._updateActiveHours=function(){if(typeof(this._hsActive)!="undefined"&&typeof(this._hsCells[this._hsActive])!="undefined"){this._hsCells[this._hsActive].className="dhtmlxcalendar_selector_cell"}this._hsActive=this._activeDate.getHours();this._hsCells[this._hsActive].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"};this._updateVisibleHours=function(){this.contTime.firstChild.firstChild.childNodes[1].innerHTML=this._fixLength(this._activeDate.getHours(),2)};this._updateActiveMinutes=function(){if(this._rsActive!=null&&typeof(this._rsActive)!="undefined"&&typeof(this._rsCells[this._rsActive])!="undefined"){this._rsCells[this._rsActive].className="dhtmlxcalendar_selector_cell"}if(this._minutesInterval==1){this._rsActive=(this.getFormatedDate("%i").toString()).charAt(this._selectorMode==1?0:1)}else{this._rsActive=this._activeDate.getMinutes()}if(typeof(this._rsCells[this._rsActive])!="undefined"){this._rsCells[this._rsActive].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"}};this._updateVisibleMinutes=function(q){var a=this._fixLength(this._activeDate.getMinutes(),2).toString();if(q==true){a=a.charAt(0)+"<span class='dhtmlxcalendar_selected_date'>"+a.charAt(1)+"</span>"}this.contTime.firstChild.firstChild.childNodes[3].innerHTML=a;if(q==true){this.contTime.firstChild.firstChild.childNodes[3].lastChild._par=true}};this._fixLength=function(a,q){while(String(a).length<q){a="0"+String(a)}return a};this._dateFormat="";this._dateFormatRE=null;this.setDateFormat=function(x){var w={};if(this._strToDate!=null){for(var q in this.i){if(this.i[q].input!=null&&this.i[q].input.value.length>0){var y=this._strToDate(this.i[q].input.value,this._dateFormat||this.langData[this.lang].dateformat||"%Y-%m-%d");if(y instanceof Date){w[q]=y}}}}this._dateFormat=x;var v=String(this._dateFormat).replace(/%[a-zA-Z]+/g,function(a){var A=a.replace(/%/,"");switch(A){case"n":case"h":case"j":case"g":case"G":return"\\d{1,2}";case"m":case"d":case"H":case"i":case"s":case"y":return"\\d{2}";case"Y":return"\\d{4}";case"M":return"("+l.langData[l.lang].monthesSNames.join("|").toLowerCase()+"){1,}";case"F":return"("+l.langData[l.lang].monthesFNames.join("|").toLowerCase()+"){1,}";case"D":return"[a-z]{2}";case"a":case"A":return"AM|PM";case"u":return"\\d{1,6}";case"P":return"[\\+\\-]\\d{1,2}\\:\\d{1,2}"}return a});this._dateFormatRE=new RegExp(v,"i");for(var q in w){this.i[q].input.value=this._dateToStr(w[q])}w=null};this.setDateFormat(this.langData[this.lang].dateformat||"%Y-%m-%d");this._updateDateStr=function(q){if(!this._dateFormatRE||!q.match(this._dateFormatRE)){return}if(q==this.getFormatedDate()){return}var a=this._strToDate(q);if(!(a instanceof Date)){return}if(this.checkEvent("onBeforeChange")){if(!this.callEvent("onBeforeChange",[new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds())])){if(this.i!=null&&this._activeInp!=null&&this.i[this._activeInp]!=null&&this.i[this._activeInp].input!=null){this.i[this._activeInp].input.value=this.getFormatedDate()}return}}this._nullDate=false;this._activeDate=a;this._drawMonth(this._nullDate?new Date():this._activeDate);this._updateVisibleMinutes();this._updateVisibleHours();if(this._sel&&this._isSelectorVisible()){this._doOnSelectorShow(this._sel._t)}this._doOnSelectorChange(true)};this.showMonth=function(a){if(typeof(a)=="string"){a=this._strToDate(a)}if(!(a instanceof Date)){return}this._drawMonth(a)};this.setFormatedDate=function(x,y,q,w){var v=this._strToDate(y,x);if(w){return v}this.setDate(v)};this.getFormatedDate=function(q,a){if(!(a&&a instanceof Date)){if(this._nullDate){return""}a=new Date(this._activeDate)}return this._dateToStr(a,q)};this.getWeekNumber=function(y){if(typeof(y)=="string"){y=this._strToDate(y)}if(!(y instanceof Date)){return"Invalid Date"}if(typeof(this._ftDay)=="undefined"){this._ftDay=4}var H=this._wStart;var x=H+7;var F=4;var v=new Date(y.getFullYear(),0,1,0,0,0,0);var w=v.getDay();if(w==0){w=7}if(F<H){F+=7;w+=7}var D=0;if(w>=H&&w<=F){}else{D=1}var C=w-H;var E=new Date(y.getFullYear(),0,1-C+D*7,0,0,0,0);var J=604800000;var q=new Date(y.getFullYear(),y.getMonth(),y.getDate()+1,0,0,0,0);var I=Math.ceil((q.getTime()-E.getTime())/J);if(I==0){var A=new Date(y.getFullYear(),y.getMonth(),y.getDate(),0,0,0,0);var a=A.getDay()-this._wStart;if(a<0){a=a+7}A.setDate(A.getDate()-a);I=this.getWeekNumber(A)}return I};this.showWeekNumbers=function(){this.base.firstChild.className="dhtmlxcalendar_wn"};this.hideWeekNumbers=function(){this.base.firstChild.className=""};this.show=function(v){if(!v&&this._hasParent){this._show();return}if(typeof(v)=="object"&&typeof(v._dhtmlxcalendar_uid)!="undefined"&&this.i[v._dhtmlxcalendar_uid]==v){this._show(v._dhtmlxcalendar_uid);return}if(typeof(v)=="undefined"){for(var q in this.i){if(!v){v=q}}}if(!v){return}this._show(v)};this.hide=function(){if(this._isVisible()){this._hide()}};this.isVisible=function(){return this._isVisible()};this._activeInp=null;this.pos="bottom";this.setPosition=function(a,q){this._px=null;this._py=null;if(a=="right"||a=="bottom"){this.pos=a}else{this.pos="int";if(typeof(a)!="undefined"&&!isNaN(a)){this.base.style.left=a+"px";this._px=a}if(typeof(q)!="undefined"&&!isNaN(q)){this.base.style.top=q+"px";this._py=q}this._ifrSize()}};this._show=function(A,a){if(a===true&&this._activeInp==A&&this._isVisible()){this._hide();return}this.base.style.visibility="hidden";this.base.style.display="";if(!A){if(this._px&&this._py){this.base.style.left=this._px+"px";this.base.style.top=this._py+"px"}else{this.base.style.left="0px";this.base.style.top="0px"}}else{if(this.base.className.indexOf("dhtmlxcalendar_in_input")==-1){this.base.className+=" dhtmlxcalendar_in_input"}var w=(this.i[A].input||this.i[A].button);var q=(navigator.appVersion.indexOf("MSIE")!=-1);var x=Math.max((q?document.documentElement:document.getElementsByTagName("html")[0]).scrollTop,document.body.scrollTop);var v=x+(q?Math.max(document.documentElement.clientHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0):window.innerHeight);if(this.pos=="right"){this.base.style.left=this._getLeft(w)+w.offsetWidth+"px";this.base.style.top=Math.min(this._getTop(w),v-this.base.offsetHeight)+"px"}else{if(this.pos=="bottom"){var y=this._getTop(w)+w.offsetHeight+1;if(y+this.base.offsetHeight>v){y=this._getTop(w)-this.base.offsetHeight}this.base.style.left=this._getLeft(w)+"px";this.base.style.top=y+"px"}else{this.base.style.left=(this._px||0)+"px";this.base.style.top=(this._py||0)+"px"}}this._activeInp=A;w=null}this._hideSelector();this.base.style.visibility="visible";this.base.style.zIndex=window.dhx4.zim.reserve(this.conf.zi);this._ifrSize();if(this._ifr){this._ifr.style.display=""}this.callEvent("onShow",[])};this._hide=function(){this._hideSelector();this.base.style.display="none";window.dhx4.zim.clear(this.conf.zi);if(this.base.className.indexOf("dhtmlxcalendar_in_input")>=0){this.base.className=this.base.className.replace(/\s{0,}dhtmlxcalendar_in_input/gi,"")}this._activeInp=null;if(this._ifr){this._ifr.style.display="none"}this.callEvent("onHide",[])};this._isVisible=function(){return(this.base.style.display!="none")};this._getLeft=function(a){return this._posGetOffset(a).left};this._getTop=function(a){return this._posGetOffset(a).top};this._posGetOffsetSum=function(a){var v=0,q=0;while(a){v=v+parseInt(a.offsetTop);q=q+parseInt(a.offsetLeft);a=a.offsetParent}return{top:v,left:q}};this._posGetOffsetRect=function(w){var A=w.getBoundingClientRect();var C=document.body;var q=document.documentElement;var a=window.pageYOffset||q.scrollTop||C.scrollTop;var x=window.pageXOffset||q.scrollLeft||C.scrollLeft;var y=q.clientTop||C.clientTop||0;var D=q.clientLeft||C.clientLeft||0;var E=A.top+a-y;var v=A.left+x-D;return{top:Math.round(E),left:Math.round(v)}};this._posGetOffset=function(a){return this[a.getBoundingClientRect?"_posGetOffsetRect":"_posGetOffsetSum"](a)};this._rangeActive=false;this._rangeFrom=null;this._rangeTo=null;this._rangeSet={};this.setInsensitiveDays=function(w){var a=this._extractDates(w);for(var v=0;v<a.length;v++){this._rangeSet[new Date(a[v].getFullYear(),a[v].getMonth(),a[v].getDate(),0,0,0,0).getTime()]=true}this._drawMonth(this._activeMonth)};this.clearInsensitiveDays=function(){this._clearRangeSet();this._drawMonth(this._activeMonth)};this._holidays={};this.setHolidays=function(v){if(v==null){this._clearHolidays()}else{if(v!=null){var a=this._extractDates(v);for(var w=0;w<a.length;w++){this._holidays[new Date(a[w].getFullYear(),a[w].getMonth(),a[w].getDate(),0,0,0,0).getTime()]=true}}}this._drawMonth(this._activeMonth)};this._extractDates=function(x){if(typeof(x)=="string"||x instanceof Date){x=[x]}var v=[];for(var y=0;y<x.length;y++){if(typeof(x[y])=="string"){var A=x[y].split(",");for(var a=0;a<A.length;a++){v.push(this._strToDate(A[a]))}}else{if(x[y] instanceof Date){v.push(x[y])}}}return v};this._clearRange=function(){this._rangeActive=false;this._rangeType=null;this._rangeFrom=null;this._rangeTo=null};this._clearRangeSet=function(){for(var q in this._rangeSet){this._rangeSet[q]=null;delete this._rangeSet[q]}};this._clearHolidays=function(){for(var q in this._holidays){this._holidays[q]=null;delete this._holidays[q]}};this._isOutOfRange=function(q){if(this._rangeSet[q]==true){return true}if(this._rangeActive){if(this._rangeType=="in"&&(q<this._rangeFrom||q>this._rangeTo)){return true}if(this._rangeType=="out"&&(q>=this._rangeFrom&&q<=this._rangeTo)){return true}if(this._rangeType=="from"&&q<this._rangeFrom){return true}if(this._rangeType=="to"&&q>this._rangeTo){return true}}var a=new Date(q);if(this._rangeWeek){if(this._rangeWeekData[a.getDay()]===true){return true}}if(this._rangeMonth){if(this._rangeMonthData[a.getDate()]===true){return true}}if(this._rangeYear){if(this._rangeYearData[a.getMonth()+"_"+a.getDate()]===true){return true}}return false};this.clearSensitiveRange=function(){this._clearRange();this._drawMonth(this._activeMonth)};this.setSensitiveRange=function(w,v,a){var q=false;if(w!=null&&v!=null){if(!(w instanceof Date)){w=this._strToDate(w)}if(!(v instanceof Date)){v=this._strToDate(v)}if(w.getTime()>v.getTime()){return}this._rangeFrom=new Date(w.getFullYear(),w.getMonth(),w.getDate(),0,0,0,0).getTime();this._rangeTo=new Date(v.getFullYear(),v.getMonth(),v.getDate(),0,0,0,0).getTime();this._rangeActive=true;this._rangeType="in";q=true}if(!q&&w!=null&&v==null){if(!(w instanceof Date)){w=this._strToDate(w)}this._rangeFrom=new Date(w.getFullYear(),w.getMonth(),w.getDate(),0,0,0,0).getTime();this._rangeTo=null;if(a===true){this._rangeFrom++}this._rangeActive=true;this._rangeType="from";q=true}if(!q&&w==null&&v!=null){if(!(v instanceof Date)){v=this._strToDate(v)}this._rangeFrom=null;this._rangeTo=new Date(v.getFullYear(),v.getMonth(),v.getDate(),0,0,0,0).getTime();if(a===true){this._rangeTo--}this._rangeActive=true;this._rangeType="to";q=true}if(q){this._drawMonth(this._activeMonth)}};this.setInsensitiveRange=function(q,a){if(q!=null&&a!=null){if(!(q instanceof Date)){q=this._strToDate(q)}if(!(a instanceof Date)){a=this._strToDate(a)}if(q.getTime()>a.getTime()){return}this._rangeFrom=new Date(q.getFullYear(),q.getMonth(),q.getDate(),0,0,0,0).getTime();this._rangeTo=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0).getTime();this._rangeActive=true;this._rangeType="out";this._drawMonth(this._activeMonth);return}if(q!=null&&a==null){this.setSensitiveRange(null,q,true);return}if(q==null&&a!=null){this.setSensitiveRange(a,null,true);return}};this.disableDays=function(A,y){if(A=="week"){if(typeof(y)!="object"&&typeof(y.length)=="undefined"){y=[y]}if(!this._rangeWeekData){this._rangeWeekData={}}for(var v in this._rangeWeekData){this._rangeWeekData[v]=false;delete this._rangeWeekData[v]}for(var x=0;x<y.length;x++){this._rangeWeekData[y[x]]=true;if(y[x]==7){this._rangeWeekData[0]=true}}this._rangeWeek=true}if(A=="month"){if(typeof(y)!="object"&&typeof(y.length)=="undefined"){y=[y]}if(!this._rangeMonthData){this._rangeMonthData={}}for(var v in this._rangeMonthData){this._rangeMonthData[v]=false;delete this._rangeMonthData[v]}for(var x=0;x<y.length;x++){this._rangeMonthData[y[x]]=true}this._rangeMonth=true}if(A=="year"){var w=this._extractDates(y);if(!this._rangeYearData){this._rangeYearData={}}for(var v in this._rangeYearData){this._rangeYearData[v]=false;delete this._rangeYearData[v]}for(var x=0;x<w.length;x++){this._rangeYearData[w[x].getMonth()+"_"+w[x].getDate()]=true}this._rangeYear=true}this._drawMonth(this._activeMonth)};this.enableDays=function(a){if(a=="week"){this._rangeWeek=false}if(a=="month"){this._rangeMonth=false}if(a=="year"){this._rangeYear=false}this._drawMonth(this._activeMonth)};this._tipData={};this._tipTM=null;this._tipTMTime=400;this._tipEvs=false;this._tipPopup=null;this._tipCellDate=null;this._tipCellDim=null;this.setTooltip=function(w,A,C,a){var x=this._extractDates(w);for(var y=0;y<x.length;y++){var v=new Date(x[y].getFullYear(),x[y].getMonth(),x[y].getDate(),0,0,0,0).getTime();this._tipData[v]={text:A,showIcon:C,usePopup:a}}this._drawMonth(this._activeMonth)};this.clearTooltip=function(v){var w=this._extractDates(v);for(var x=0;x<w.length;x++){var a=new Date(w[x].getFullYear(),w[x].getMonth(),w[x].getDate(),0,0,0,0).getTime();this._tipData[a]=null;delete this._tipData[a]}this._drawMonth(this._activeMonth)};this._initTooltipPopup=function(){if(this._tipEvs){return}this.attachEvent("onMouseOver",function(q){var a=new Date(q.getFullYear(),q.getMonth(),q.getDate(),0,0,0,0).getTime();if(this._tipData[a]!=null){if(this._tipTM){window.clearTimeout(this._tipTM)}this._tipCellDate=q;this._tipCellDim=this.getCellDimension(q);this._tipText=this._tipData[a].text;this._tipTM=window.setTimeout(this._showTooltipPopup,this._tipTMTime)}});this.attachEvent("onMouseOut",this._hideTooltipPopup);this._tipEvs=true};this._showTooltipPopup=function(A,a,C,q,v){if(!l._tipPopup){l._tipPopup=new dhtmlXPopup({mode:"top"})}l._tipPopup.attachHTML(l._tipText);l._tipPopup.show(l._tipCellDim.x,l._tipCellDim.y,l._tipCellDim.w,l._tipCellDim.h);l.callEvent("onPopupShow",[l._tipCellDate])};this._hideTooltipPopup=function(){if(this._tipTM){window.clearTimeout(this._tipTM)}if(this._tipPopup!=null&&this._tipPopup.isVisible()){this._tipPopup.hide();this.callEvent("onPopupHide",[this._tipCellDate])}};this.getPopup=function(){return this._tipPopup};this.getCellDimension=function(x){if(typeof(x)=="string"){x=this._strToDate(x)}if(!(x instanceof Date)){return null}var y=new Date(x.getFullYear(),x.getMonth(),x.getDate(),0,0,0,0).getTime();var v=null;for(var A=0;A<this.contDates.childNodes.length;A++){for(var a=0;a<this.contDates.childNodes[A].childNodes.length;a++){var C=this.contDates.childNodes[A].childNodes[a];if(C._date!=null&&C._date.getTime()==y){v={x:this._getLeft(C),y:this._getTop(C),w:C.offsetWidth,h:C.offsetHeight}}C=null}}return v};this._updateFromInput=function(a){if(this._nullInInput&&((a.value).replace(/\s/g,"")).length==0){if(this.checkEvent("onBeforeChange")){if(!this.callEvent("onBeforeChange",[null])){if(this.i!=null&&this._activeInp!=null&&this.i[this._activeInp]!=null&&this.i[this._activeInp].input!=null){this.i[this._activeInp].input.value=this.getFormatedDate()}return}}this.setDate(null)}else{this._updateDateStr(a.value)}a=null};this._doOnClick=function(q){q=q||event;var a=(q.target||q.srcElement);if(a._dhtmlxcalendar_uid&&a._dhtmlxcalendar_uid!=l._activeInp&&l._isVisible()&&l._activeInp){l._hide();return}if(!a._dhtmlxcalendar_uid||!l.i[a._dhtmlxcalendar_uid]){if(l._isSelectorVisible()){l._hideSelector()}else{if(!l._hasParent&&l._isVisible()){l._hide()}}}};this._doOnKeyDown=function(a){a=a||event;if(a.keyCode==27||a.keyCode==13){if(l._isSelectorVisible()){l._hideSelector()}else{if(l._isVisible()&&!l._hasParent){l._hide()}}}};this._doOnInpClick=function(q){q=q||event;if(q.type=="touchstart"&&q.preventDefault!=null){q.preventDefault()}var a=(q.target||q.srcElement);if(!a._dhtmlxcalendar_uid){return}if(!l._listenerEnabled){l._updateFromInput(a)}l._show(a._dhtmlxcalendar_uid,true)};this._doOnInpKeyUp=function(q){q=q||event;var a=(q.target||q.srcElement);if(q.keyCode==13||!a._dhtmlxcalendar_uid){return}if(!l._listenerEnabled){l._updateFromInput(a)}};this._doOnBtnClick=function(q){q=q||event;if(q.type=="touchstart"&&q.preventDefault!=null){q.preventDefault()}var a=(q.target||q.srcElement);if(!a._dhtmlxcalendar_uid){return}if(l.i[a._dhtmlxcalendar_uid].input!=null){l._updateFromInput(l.i[a._dhtmlxcalendar_uid].input)}l._show(a._dhtmlxcalendar_uid,true)};this._doOnUnload=function(){if(l&&l.unload){l.unload()}};if(typeof(window.addEventListener)=="function"){document.body.addEventListener("click",l._doOnClick,false);window.addEventListener("keydown",l._doOnKeyDown,false);window.addEventListener("unload",l._doOnUnload,false);if(this.conf.touch==true){document.body.addEventListener("touchstart",l._doOnClick,false)}}else{document.body.attachEvent("onclick",l._doOnClick);document.body.attachEvent("onkeydown",l._doOnKeyDown);window.attachEvent("onunload",l._doOnUnload)}this.attachObj=function(v){var q=window.dhx4.newId();if(typeof(v)=="string"){this.i[q]={input:document.getElementById(v)}}else{if(typeof(v.tagName)!="undefined"){this.i[q]={input:v}}else{if(typeof(v)=="object"&&(v.input!=null||v.button!=null)){this.i[q]={};if(v.input!=null){this.i[q].input=(typeof(v.input)=="string"?document.getElementById(v.input):v.input)}if(v.button!=null){this.i[q].button=(typeof(v.button)=="string"?document.getElementById(v.button):v.button)}}}}this._attachEventsToObject(q);return q};this.detachObj=function(w){var v=null;if(this.i[w]!=null){v=w}else{if(typeof(w)=="string"){w=document.getElementById(w);v=w._dhtmlxcalendar_uid}else{if(typeof(w.tagName)!="undefined"){v=w._dhtmlxcalendar_uid}else{if(typeof(w)=="object"&&(w.input!=null||w.button!=null)){if(v==null&&w.input!=null){v=(typeof(w.input)=="string"?document.getElementById(w.input):w.input)._dhtmlxcalendar_uid}if(v==null&&w.button!=null){v=(typeof(w.button)=="string"?document.getElementById(w.button):w.button)._dhtmlxcalendar_uid}}}}}if(v!=null&&this.i[v]!=null){this._detachEventsFromObject(v);for(var q in this.i[q]){this.i[v][q]._dhtmlxcalendar_uid=null;this.i[v][q]=null;delete this.i[v][q]}this.i[v]=null;delete this.i[v];return true}return false};this._attachEventsToObject=function(q){if(this.i[q].button!=null){this.i[q].button._dhtmlxcalendar_uid=q;if(typeof(window.addEventListener)=="function"){this.i[q].button.addEventListener("click",l._doOnBtnClick,false);if(this.conf.touch==true){this.i[q].button.addEventListener("touchstart",l._doOnBtnClick,false)}}else{this.i[q].button.attachEvent("onclick",l._doOnBtnClick)}}else{if(this.i[q].input!=null){this.i[q].input._dhtmlxcalendar_uid=q;if(typeof(window.addEventListener)=="function"){this.i[q].input.addEventListener("click",l._doOnInpClick,false);this.i[q].input.addEventListener("keyup",l._doOnInpKeyUp,false);if(this.conf.touch==true){this.i[q].input.addEventListener("touchstart",l._doOnInpClick,false)}}else{this.i[q].input.attachEvent("onclick",l._doOnInpClick);this.i[q].input.attachEvent("onkeyup",l._doOnInpKeyUp)}}}};this._detachEventsFromObject=function(q){if(this.i[q].button!=null){if(typeof(window.addEventListener)=="function"){this.i[q].button.removeEventListener("click",l._doOnBtnClick,false);if(this.conf.touch==true){this.i[q].button.removeEventListener("touchstart",l._doOnBtnClick,false)}}else{this.i[q].button.detachEvent("onclick",l._doOnBtnClick)}}else{if(this.i[q].input!=null){if(typeof(window.addEventListener)=="function"){this.i[q].input.removeEventListener("click",l._doOnInpClick,false);this.i[q].input.removeEventListener("keyup",l._doOnInpKeyUp,false);if(this.conf.touch==true){this.i[q].input.removeEventListener("touchstart",l._doOnInpClick,false)}}else{this.i[q].input.detachEvent("onclick",l._doOnInpClick);this.i[q].input.detachEvent("onkeyup",l._doOnInpKeyUp)}}}};this.enableListener=function(a){if(!a){return}if(typeof(window.addEventListener)=="function"){a.addEventListener("focus",l._listenerEvFocus,false);a.addEventListener("blur",l._listenerEvBlur,false)}else{a.attachEvent("onfocus",l._listenerEvFocus);a.attachEvent("onblur",l._listenerEvBlur)}a=null};this.disableListener=function(a){if(!a){return}a._f0=false;if(this._tmListener){window.clearTimeout(this._tmListener)}if(typeof(window.addEventListener)=="function"){a.removeEventListener("focus",l._listenerEvFocus,false);a.removeEventListener("blur",l._listenerEvBlur,false)}else{a.detachEvent("onfocus",l._listenerEvFocus);a.detachEvent("onblur",l._listenerEvBlur)}a=null};this._startListener=function(a){if(this._tmListener){window.clearTimeout(this._tmListener)}if(typeof(a._v1)=="undefined"){a._v1=a.value}if(a._v1!=a.value){this._updateFromInput(a);a._v1=a.value}if(a._f0){this._tmListener=window.setTimeout(function(){l._startListener(a)},100)}};this._listenerEvFocus=function(q){q=q||event;var a=q.target||q.srcElement;a._f0=true;l._startListener(a);a=null};this._listenerEvBlur=function(q){q=q||event;var a=q.target||q.srcElement;a._f0=false;a=null};for(var o in this.i){this._attachEventsToObject(o)}window.dhx4._eventable(this);this._evOnArrowClick=function(a){return this.callEvent("onArrowClick",a)};this._evOnClick=function(a){return this.callEvent("onClick",a)};this._evOnMouseOut=function(a){return this.callEvent("onMouseOut",a)};this._evOnMouseOver=function(a){return this.callEvent("onMouseOver",a)};this.unload=function(){this._activeDate=null;this._activeDateCell=null;this._activeInp=null;this._activeMonth=null;this._dateFormat=null;this._dateFormatRE=null;this._lastHover=null;if(this._tmListener){window.clearTimeout(this._tmListener)}this._tmListener=null;if(typeof(window.addEventListener)=="function"){document.body.removeEventListener("click",l._doOnClick,false);window.removeEventListener("keydown",l._doOnKeyDown,false);window.removeEventListener("unload",l._doOnUnload,false);if(this.conf.touch==true){document.body.removeEventListener("touchstart",l._doOnClick,false)}}else{document.body.detachEvent("onclick",l._doOnClick);document.body.detachEvent("onkeydown",l._doOnKeyDown);window.detachEvent("onunload",l._doOnKeyDown)}this._doOnClick=null;this._doOnKeyDown=null;this._doOnUnload=null;for(var q in this.i){this.i[q]._dhtmlxcalendar_uid=null;this._detachEventsFromObject(q);this.disableListener(this.i[q].input);this.i[q]=null;delete this.i[q]}this.i=null;this._doOnInpClick=null;this._doOnInpKeyUp=null;window.dhx4._eventable(this,"clear");this.contMonth.onselectstart=null;this.contMonth.firstChild.firstChild.onclick=null;this.contMonth.firstChild.firstChild.ontouchstart=null;this.contMonth.firstChild.firstChild.firstChild.onmouseover=null;this.contMonth.firstChild.firstChild.firstChild.onmouseout=null;this.contMonth.firstChild.firstChild.lastChild.onmouseover=null;this.contMonth.firstChild.firstChild.lastChild.onmouseout=null;while(this.contMonth.firstChild.firstChild.childNodes.length>0){this.contMonth.firstChild.firstChild.removeChild(this.contMonth.firstChild.firstChild.lastChild)}this.contMonth.firstChild.removeChild(this.contMonth.firstChild.firstChild);this.contMonth.removeChild(this.contMonth.firstChild);this.contMonth.parentNode.removeChild(this.contMonth);this.contMonth=null;while(this.contDays.firstChild.childNodes.length>0){this.contDays.firstChild.removeChild(this.contDays.firstChild.lastChild)}this.contDays.removeChild(this.contDays.firstChild);this.contDays.parentNode.removeChild(this.contDays);this.contDays=null;this.contDates.onclick=null;this.contDates.ontouchstart=null;this.contDates.onmouseover=null;this.contDates.onmouseout=null;while(this.contDates.childNodes.length>0){while(this.contDates.lastChild.childNodes.length>0){this.contDates.lastChild.lastChild._css_date=null;this.contDates.lastChild.lastChild._css_month=null;this.contDates.lastChild.lastChild._css_weekend=null;this.contDates.lastChild.lastChild._css_hover=null;this.contDates.lastChild.lastChild._date=null;this.contDates.lastChild.lastChild._q=null;this.contDates.lastChild.lastChild._w=null;this.contDates.lastChild.removeChild(this.contDates.lastChild.lastChild)}this.contDates.removeChild(this.contDates.lastChild)}this.contDates.parentNode.removeChild(this.contDates);this.contDates=null;this.contTime.firstChild.firstChild.onclick=null;this.contTime.firstChild.firstChild.ontouchstart=null;while(this.contTime.firstChild.firstChild.childNodes.length>0){this.contTime.firstChild.firstChild.removeChild(this.contTime.firstChild.firstChild.lastChild)}this.contTime.firstChild.removeChild(this.contTime.firstChild.firstChild);this.contTime.removeChild(this.contTime.firstChild);this.contTime.parentNode.removeChild(this.contTime);this.contTime=null;this._lastHover=null;this._unloadSelector("month");this._unloadSelector("year");this._unloadSelector("hours");this._unloadSelector("minutes");if(this._selCover){this._selCover.parentNode.removeChild(this._selCover);this._selCover=null}if(this._sel){for(var q in this._sel._ta){this._sel._ta[q]=null}this._sel._ta=null;this._sel._t=null;this._sel.onmouseover=null;this._sel.onmouseout=null;while(this._sel.firstChild.firstChild.firstChild.childNodes.length>0){this._sel.firstChild.firstChild.firstChild.lastChild.onclick=null;this._sel.firstChild.firstChild.firstChild.lastChild.onmouseover=null;this._sel.firstChild.firstChild.firstChild.lastChild.onmouseout=null;this._sel.firstChild.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild.lastChild)}this._sel.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild);this._sel.firstChild.removeChild(this._sel.firstChild.firstChild);while(this._sel.childNodes.length>0){this._sel.removeChild(this._sel.lastChild)}this._sel.parentNode.removeChild(this._sel);this._sel=null}this.base.onclick=null;this.base.onmousedown=null;this.base.ontouchstart=null;this.base.onmouseout=null;this.base.parentNode.removeChild(this.base);this.base=null;this._clearDayHover=null;this._clearSelHover=null;this._doOnSelectorChange=null;this._doOnSelectorShow=null;this._drawMonth=null;this._fixLength=null;this._getLeft=null;this._getTop=null;this._ifrSize=null;this._hide=null;this._hideSelector=null;this._initSelector=null;this._isSelectorVisible=null;this._isVisible=null;this._posGetOffset=null;this._posGetOffsetRect=null;this._posGetOffsetSum=null;this._scrollYears=null;this._show=null;this._showSelector=null;this._strToDate=null;this._updateActiveHours=null;this._updateActiveMinutes=null;this._updateActiveMonth=null;this._updateActiveYear=null;this._updateCellStyle=null;this._updateDateStr=null;this._updateVisibleHours=null;this._updateVisibleMinutes=null;this._updateYearsList=null;this.enableIframe=null;this.hide=null;this.hideTime=null;this.setDate=null;this.setDateFormat=null;this.setYearsRange=null;this.show=null;this.showTime=null;this.unload=null;if(this._tipPopup!=null){this._tipPopup.unload();this._tipPopup=null}for(var q in this){delete this[q]}q=l=null};this.setDate(this._activeDate);return this}dhtmlXCalendarObject.prototype.lang="en";dhtmlXCalendarObject.prototype.langData={en:{dateformat:"%Y-%m-%d",hdrformat:"%F %Y",monthesFNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthesSNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],daysFNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysSNames:["Su","Mo","Tu","We","Th","Fr","Sa"],weekstart:1,weekname:"w"}};dhtmlXCalendarObject.prototype._buildMonthHdr=function(l){var c=this;var j=function(m){return(String(m).length==1?"0"+String(m):m)};var a=function(m,n){return"<span class='dhtmlxcalendar_month_label_"+m+"'>"+n+"</span>"};var g=String(this.langData[this.lang].hdrformat||("%F %Y")).replace(/%[a-z]/gi,function(m){switch(m){case"%m":return a("month",j(l.getMonth()+1));case"%n":return a("month",l.getMonth()+1);case"%M":return a("month",c.langData[c.lang].monthesSNames[l.getMonth()]);case"%F":return a("month",c.langData[c.lang].monthesFNames[l.getMonth()]);case"%y":return a("year",j(l.getYear()%100));case"%Y":return a("year",l.getFullYear());case"%%":return"%";default:return m}});c=j=a=null;return g};dhtmlXCalendarObject.prototype.enableIframe=function(a){if(a==true){if(!this._ifr){this._ifr=document.createElement("IFRAME");this._ifr.frameBorder=0;this._ifr.border=0;this._ifr.setAttribute("src","javascript:false;");this._ifr.className="dhtmlxcalendar_ifr";this._ifr.onload=function(){this.onload=null;this.contentWindow.document.open("text/html","replace");this.contentWindow.document.write("<html><head><style>html,body{width:100%;height:100%;overflow:hidden;margin:0px;}</style></head><body</body></html>")};this.base.parentNode.insertBefore(this._ifr,this.base);this._ifrSize()}}else{if(this._ifr){this._ifr.parentNode.removeChild(this._ifr);this._ifr=null}}};dhtmlXCalendarObject.prototype._ifrSize=function(){if(this._ifr){this._ifr.style.left=this.base.style.left;this._ifr.style.top=this.base.style.top;this._ifr.style.width=this.base.offsetWidth+"px";this._ifr.style.height=this.base.offsetHeight+"px"}};dhtmlxCalendarObject=dhtmlXCalendarObject;dhtmlXCalendarObject.prototype._dateStrings=function(){var a=this.langData[this.lang];return{monthFullName:a.monthesFNames,monthShortName:a.monthesSNames,dayFullName:a.daysFNames,dayShortName:a.daysSNames}};dhtmlXCalendarObject.prototype._strToDate=function(c,a){return window.dhx4.str2date(c,a||this._dateFormat,this._dateStrings())};dhtmlXCalendarObject.prototype._dateToStr=function(c,a){return window.dhx4.date2str(c,a||this._dateFormat,this._dateStrings())};window.dhtmlxDblCalendarObject=window.dhtmlXDoubleCalendarObject=window.dhtmlXDoubleCalendar=function(c){var a=this;this.leftCalendar=new dhtmlXCalendarObject(c);this.leftCalendar.hideTime();this.rightCalendar=new dhtmlXCalendarObject(c);this.rightCalendar.hideTime();this.leftCalendar.attachEvent("onClick",function(g){a._updateRange("rightCalendar",g,null);a._evOnClick(["left",g])});this.rightCalendar.attachEvent("onClick",function(g){a._updateRange("leftCalendar",null,g);a._evOnClick(["right",g])});this.leftCalendar.attachEvent("onBeforeChange",function(g){return a._evOnBeforeChange(["left",g])});this.rightCalendar.attachEvent("onBeforeChange",function(g){return a._evOnBeforeChange(["right",g])});this.show=function(){this.leftCalendar.show();this.rightCalendar.base.style.marginLeft=this.leftCalendar.base.offsetWidth-1+"px";this.rightCalendar.show()};this.hide=function(){this.leftCalendar.hide();this.rightCalendar.hide()};this.setDateFormat=function(g){this.leftCalendar.setDateFormat(g);this.rightCalendar.setDateFormat(g)};this.setDates=function(j,g){if(j!=null){this.leftCalendar.setDate(j)}if(g!=null){this.rightCalendar.setDate(g)}this._updateRange()};this._updateRange=function(g,l,j){if(arguments.length==3){(g=="leftCalendar"?this.leftCalendar:this.rightCalendar).setSensitiveRange(l,j)}else{this.leftCalendar.setSensitiveRange(null,this.rightCalendar.getDate());this.rightCalendar.setSensitiveRange(this.leftCalendar.getDate(),null)}};this.getFormatedDate=function(){return this.leftCalendar.getFormatedDate.apply(this.leftCalendar,arguments)};this.unload=function(){window.dhx4._eventable(this,"clear");this.leftCalendar.unload();this.rightCalendar.unload();this.leftCalendar=this.rightCalendar=null;this._updateRange=null;this._evOnClick=null;this._evOnBeforeChange=null;this.show=null;this.hide=null;this.setDateFormat=null;this.setDates=null;this.getFormatedDate=null;this.unload=null;a=null};this._evOnClick=function(g){return this.callEvent("onClick",g)};this._evOnBeforeChange=function(g){return this.callEvent("onBeforeChange",g)};window.dhx4._eventable(this);return this};function dhtmlXCombo(m,s,g,o,l){var n=this;var j=null;var u=null;if(typeof(m)=="object"&&!m.tagName){j=m;m=j.parent;g=j.width;s=j.name;o=j.mode;u=j.skin}this.cont=(typeof(m)=="string"?document.getElementById(m):m);this.conf={skin:null,form_name:s||"dhxcombo",combo_width:(parseInt(g)||this.cont.offsetWidth||120)-(dhx4.isFF||dhx4.isIE||dhx4.isChrome||dhx4.isOpera?2:0),combo_image:false,combo_focus:false,opts_type:(typeof(o)=="string"&&typeof(this.modes[o])!="undefined"?o:"option"),opts_count:8,opts_count_min:3,opts_width:null,item_h:null,list_zi_id:window.dhx4.newId(),allow_free_text:true,allow_empty_value:true,enabled:true,img_path:"",img_def:"",img_def_dis:true,template:{input:"#text#",option:"#text#"},f_func:null,f_mode:false,f_url:false,f_cache:false,f_cache_data:{},f_dyn:false,f_dyn_end:false,f_mask:"",f_ac:true,f_ac_text:"",f_server_tm:null,f_server_last:"",f_loading:false,s_tm:null,s_time:200,s_mode:"select",last_hover:null,last_selected:null,last_match:null,last_text:"",last_value:"",tm_hover:null,tm_confirm_blur:null,clear_click:false,clear_blur:false,clear_bsp:false,clear_key:false,sp:{dhx_skyblue:{list_ofs:1,hdr_ofs:1,scr_ofs:1},dhx_web:{list_ofs:0,hdr_ofs:1,scr_ofs:0},dhx_terrace:{list_ofs:1,hdr_ofs:1,scr_ofs:1}},col_w:null};this.conf.combo_image=(this.modes[this.conf.opts_type].image==true);this.t={};this.base=document.createElement("DIV");this.base.style.width=this.conf.combo_width+"px";this.base.innerHTML="<input type='text' class='dhxcombo_input' style='width:"+(this.conf.combo_width-24-(this.conf.combo_image?23:0))+"px;"+(this.conf.combo_image?"margin-left:23px;":"")+"' autocomplete='off'><input type='hidden' value=''><input type='hidden' value='false'><div class='dhxcombo_select_button'><div class='dhxcombo_select_img'></div></div>"+(this.conf.combo_image?"<div class='dhxcombo_top_image'>"+this.modes[this.conf.opts_type].getTopImage(null,this.conf.enabled)+"</div>":"");this.cont.appendChild(this.base);this.list=document.createElement("DIV");this.list._listId=window.dhx4.newId();this.list.style.display="none";document.body.insertBefore(this.list,document.body.firstChild);this._doOnListScroll=function(){if(n.conf.s_tm!=null){window.clearTimeout(n.conf.s_tm)}n.conf.s_tm=window.setTimeout(n._doOnListScrollAction,n.conf.s_time)};this._doOnListScrollAction=function(){n.conf.s_tm=null;if(n.conf.s_mode=="scroll"&&n.list.scrollHeight-n.list.scrollTop-10<n.list.clientHeight){n._subloadRequest()}};if(typeof(window.addEventListener)=="function"){this.list.addEventListener("scroll",this._doOnListScroll,false)}else{this.list.attachEvent("onscroll",this._doOnListScroll)}this.setSkin(u||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxcombo")||"dhx_skyblue");this._updateTopImage=function(a){if(!this.conf.combo_image){return}if(a!=null){this.base.lastChild.innerHTML=this.t[a].obj.getTopImage(this.t[a].item,this.conf.enabled)}else{this.base.lastChild.innerHTML=this.modes[this.conf.opts_type].getTopImage(null,this.conf.enabled)}};this._filterOpts=function(C){if(this.conf.f_server_tm){window.clearTimeout(this.conf.f_server_tm)}var x=String(this.base.firstChild.value).replace(new RegExp(this.conf.f_ac_text+"$","i"),"");if(this.conf.f_server_last==x.toLowerCase()){this._checkForMatch();return}if(this.conf.f_url!=null&&this.checkEvent("onDynXLS")){this.conf.f_server_last=x.toLowerCase();this.callEvent("onDynXLS",[x]);return}if(this.conf.f_url!=null){if(x.length==0){this.conf.f_server_last=x.toLowerCase();this.clearAll();return}if(this.conf.f_cache==true&&this.conf.f_cache_data[x]!=null){this.clearAll();this.conf.f_server_last=x.toLowerCase();for(var w=0;w<this.conf.f_cache_data[x].data.length;w++){this.load(this.conf.f_cache_data[x].data[w])}if(this.conf.f_dyn){this.conf.f_dyn_end=this.conf.f_cache_data[x].dyn_end;this.conf.f_mask=this.conf.f_cache_data[x].mask}if(C!==true){this._showList(true);this._checkForMatch()}}else{this.conf.f_server_tm=window.setTimeout(function(){n.conf.f_server_last=x.toLowerCase();n.conf.f_mask=x;var q="mask="+encodeURIComponent(x);if(n.conf.f_dyn){q+="&pos=0";n.conf.f_dyn_end=false}var a=function(J){if(n.conf.f_cache){if(!n.conf.f_cache_data[x]){n.conf.f_cache_data[x]={data:[],dyn_end:false,mask:x}}n.conf.f_cache_data[x].data.push(J.xmlDoc.responseXML)}n.clearAll();n.load(J.xmlDoc.responseXML);var I=(n.base.offsetWidth>0&&n.base.offsetHeight>0);if(I==true&&n.conf.enabled==true&&n.conf.combo_focus==true&&C!==true){if(n.conf.f_ac&&n.conf.f_mode=="start"&&n.conf.clear_bsp==false&&n.list.firstChild!=null){var H=n.list.firstChild._optId;var K=String(n.t[H].obj.getText(n.list.firstChild,true));if(String(K).toLowerCase().indexOf(String(x).toLowerCase())===0){n.base.firstChild.value=K;n._selectRange(x.length,K.length)}}n._showList(true);n._checkForMatch()}a=null};if(window.dhx4.ajax.method=="post"){window.dhx4.ajax.post(n.conf.f_url,q,a)}else{if(window.dhx4.ajax.method=="get"){window.dhx4.ajax.get(n.conf.f_url+(String(n.conf.f_url).indexOf("?")>=0?"&":"?")+q,a)}}},200)}}else{this.conf.f_server_last=x.toLowerCase();var v=(x.length==0?true:new RegExp((this.conf.f_mode=="start"?"^":"")+String(x).replace(/[\\\^\$\*\+\?\.\(\)\|\{\}\[\]]/gi,"\\$&"),"i"));var y=null;for(var D in this.t){var F=false;if(v!==true){if(this.conf.f_func!=null){var A=this._getOption(this.t[D].item._optId,w);F=(this.conf.f_func.apply(window,[x,A])==true)}else{var E=this.t[D].obj.getText(this.t[D].item,true);F=(v.test(E)==true)}}if(v===true||F==true){this.t[D].item.style.display="";if(y==null&&x.length>0){y=String(this.t[D].obj.getText(this.t[D].item,true))}}else{this.t[D].item.style.display="none"}}if(this.conf.f_ac&&this.conf.f_mode=="start"&&this.conf.clear_bsp==false&&y!=null){this.conf.f_ac_text=y.replace(new RegExp("^"+x,"i"),"");this.base.firstChild.value=y;this._selectRange(this.conf.f_server_last.length,this.base.firstChild.value.length)}if(this.conf.f_mode=="between"&&this.conf.clear_bsp==true){this._checkForMatch(true)}if(C!==true){this._showList(true);this._checkForMatch()}}};this._initObj=function(a){if(typeof(a.template)!="undefined"){this.setTemplate(a.template)}if(a.add!=true&&this.conf.f_loading!=true){this.clearAll(false)}this.addOption(a.options)};this._xmlToObj=function(Q,y,x){var D={add:false,options:[]};var K=(y==true?Q:Q.getElementsByTagName("complete"));if(K.length>0){if(window.dhx4.s2b(K[0].getAttribute("add"))==true){D.add=true}var J=K[0].childNodes;for(var H=0;H<J.length;H++){if(typeof(J[H].tagName)!="undefined"){if(String(J[H].tagName).toLowerCase()=="template"){var P={};for(var C=0;C<J[H].childNodes.length;C++){var I=J[H].childNodes[C];if(I.tagName!=null){var L=I.tagName;if(typeof(this.conf.template[L])!="undefined"){P[L]=window.dhx4._xmlNodeValue(I)}if(L=="columns"){for(var N=0;N<I.childNodes.length;N++){var A=I.childNodes[N];if(A.tagName!=null&&A.tagName=="column"){var F={};for(var O in {width:1,css:1,header:1,option:1}){if(A.getAttribute(O)!=null){F[O]=A.getAttribute(O)}}for(var O in {header:1,option:1}){var M=A.getElementsByTagName(O);if(M[0]!=null&&M[0].firstChild!=null){F[O]=window.dhx4._xmlNodeValue(M[0])}}if(P.columns==null){P.columns=[]}P.columns.push(F)}A=null}}}I=null}this.setTemplate(P)}if(String(J[H].tagName).toLowerCase()=="option"){var E=false;if(y==true){E=(D.options.length==x)}else{E=window.dhx4.s2b(J[H].getAttribute("selected"))}var v={value:J[H].getAttribute("value"),text:window.dhx4._xmlNodeValue(J[H]),selected:E,checked:window.dhx4.s2b(J[H].getAttribute("checked"))};for(var O in {img:1,img_dis:1,img_src:1,img_src_dis:1,css:1}){if(J[H].getAttribute(O)!=null){v[O]=J[H].getAttribute(O)}}for(var C=0;C<J[H].childNodes.length;C++){if(J[H].childNodes[C].tagName!=null&&String(J[H].childNodes[C].tagName).toLowerCase()=="text"){v.text={};var I=J[H].childNodes[C];for(var N=0;N<I.childNodes.length;N++){if(I.childNodes[N].tagName!=null){v.text[I.childNodes[N].tagName]=window.dhx4._xmlNodeValue(I.childNodes[N])}}}}D.options.push(v)}}}K=J=null}return D};window.dhx4._enableDataLoading(this,"_initObj","_xmlToObj","complete",{data:true});window.dhx4._eventable(this);this._getNearItem=function(v,q){var a=null;while(v!=null){v=v[q<0?"previousSibling":"nextSibling"];if(a==null&&v!=null&&v.style.display==""&&v._optId!=null){a=v;v=null}}return a};this.setName(this.conf.form_name);this._doOnListMouseMove=function(q){q=q||event;var a=q.target||q.srcElement;while(a!=null&&a!=this){if(typeof(a._optId)!="undefined"){if(n.conf.tm_hover){window.clearTimeout(n.conf.tm_hover)}n._setSelected(a._optId)}a=a.parentNode}a=null};this._doOnListMouseDown=function(a){a=a||event;a.cancelBubble=true;n.conf.clear_click=true;window.setTimeout(function(){n.base.firstChild.focus()},1)};this._doOnListMouseUp=function(v){v=v||event;var a=v.target||v.srcElement;while(a!=null&&a!=this){if(typeof(a._optId)!="undefined"){var q=true;if(typeof(n.t[a._optId].obj.optionClick)=="function"&&n.t[a._optId].obj.optionClick(a,v,n)!==true){q=false}if(q){n._setSelected(a._optId,null,true);n._confirmSelect("click")}}a=a.parentNode}a=null};this._doOnListMouseOut=function(a){if(n.conf.tm_hover){window.clearTimeout(n.conf.tm_hover)}n.conf.tm_hover=window.setTimeout(function(){var q=n.conf.last_match||n.conf.last_selected;if(n.conf.last_match==null&&n.t[q]!=null){if(n.base.firstChild.value!=n.t[q].obj.getText(n.t[q].item,true)){q=null}}n._setSelected(q,null,true)},1)};this._doOnBaseMouseDown=function(x){if(!n.conf.enabled){return}n.conf.clear_click=true;x=x||event;var q=x.target||x.srcElement;if(q!=this.firstChild){window.setTimeout(function(){n.base.firstChild.focus()},1);var w=q;while(w!=this&&w!=null){if(w==this.lastChild){if(typeof(n.modes[n.conf.opts_type].topImageClick)=="function"){var v=(n.conf.last_hover||n.conf.last_selected);var a=(v!=null?n.t[v].item:null);if(n.modes[n.conf.opts_type].topImageClick(a,n)!==true){v=a=null;return}}w=null}else{w=w.parentNode}}}if(n._isListVisible()){n._hideList()}else{if(q!=this.firstChild){n.conf.clear_blur=true}n._showList();n._setSelected(n.conf.last_selected,true,true)}q=null};this._doOnBodyMouseDown=function(){if(n.conf.clear_click){n.conf.clear_click=false;return}n._confirmSelect("blur")};this._doOnInputFocus=function(){n.conf.clear_blur=false;if(n.conf.tm_confirm_blur){window.clearTimeout(n.conf.tm_confirm_blur)}if(n.conf.combo_focus==false){n.conf.combo_focus=true;n.callEvent("onFocus",[])}};this._doOnInputBlur=function(){if(n.conf.clear_blur==true){n.conf.clear_blur=false;return}if(n.conf.tm_confirm_blur){window.clearTimeout(n.conf.tm_confirm_blur)}n.conf.tm_confirm_blur=window.setTimeout(function(){if(n.conf.clear_click==false){n._confirmSelect("blur");n.conf.combo_focus=false;n.callEvent("onBlur",[])}},20)};this._doOnInputKeyUp=function(a){a=a||event;if(n.conf.f_mode!=false){n.conf.clear_bsp=(a.keyCode==8||a.keyCode==46);n._filterOpts();return}else{n._checkForMatch()}};this._doOnInputKeyDown=function(a){a=a||event;if((a.keyCode==38||a.keyCode==40)&&!a.ctrlKey&&!a.shiftKey&&!a.altKey){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}a.cancelBubble=true;n._keyOnUpDown(a.keyCode==38?-1:1)}if(a.keyCode==113){if(!n._isListVisible()){n._showList();if(n.base.firstChild.value==n.conf.last_text){n._setSelected(n.conf.last_selected,true,true);n.base.firstChild.value=n.conf.last_text;n.conf.f_server_last=n.base.firstChild.value.toLowerCase()}else{n.conf.f_server_last=n.base.firstChild.value.toLowerCase();if(n.conf.f_mode==false){n._checkForMatch()}}}else{}}if(a.keyCode==27){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}a.cancelBubble=true;n._cancelSelect()}if(a.keyCode==13){if(a.preventDefault){a.preventDefault()}n._confirmSelect("kbd")}n.conf.clear_key=true;n.callEvent("onKeyPressed",[a.keyCode||a.charCode])};this._doOnInputKeyPress=function(a){if(n.conf.clear_key){n.conf.clear_key=false;return}a=a||event;n.callEvent("onKeyPressed",[a.keyCode||a.charCode])};this._keyOnUpDown=function(a){var q=null;if(this.conf.last_hover){q=this.t[this.conf.last_hover].item}else{if(this.conf.last_selected){q=this.t[this.conf.last_selected].item}}if(!q&&this._getListVisibleCount()==0){return}if(q!=null&&q.style.display!=""){q=null}this._showList();if(q!=null){if(this.t[q._optId].obj.isSelected(q)){q=this._getNearItem(q,a)}}else{q=this.list.firstChild;if(q.style.display!=""){q=this._getNearItem(q,1)}}if(q==null){return}this._setSelected(q._optId,true,true);if(this.conf.f_mode==false){this.base.firstChild.value=this.t[q._optId].obj.getText(q,true)}else{var v=String(this.t[q._optId].obj.getText(q,true));if(this.conf.f_mode=="start"&&this.conf.f_ac==true){if(v.toLowerCase().indexOf(this.conf.f_server_last)===0){this.conf.f_ac_text=v.substring(this.conf.f_server_last.length,v.length);this.base.firstChild.value=v;this._selectRange(this.conf.f_server_last.length,this.base.firstChild.value.length)}else{this.base.firstChild.value=v;this.conf.f_server_last=this.base.firstChild.value.toLowerCase();this._selectRange(0,this.base.firstChild.value.length)}}else{this.base.firstChild.value=v;this.conf.f_server_last=this.base.firstChild.value.toLowerCase()}}q=null};this.conf.evs_nodes=[{node:document.body,evs:{mousedown:"_doOnBodyMouseDown"}},{node:this.base,evs:{mousedown:"_doOnBaseMouseDown"}},{node:this.base.firstChild,evs:{keyup:"_doOnInputKeyUp",keydown:"_doOnInputKeyDown",keypress:"_doOnInputKeyPress",focus:"_doOnInputFocus",blur:"_doOnInputBlur"}},{node:this.list,evs:{mousemove:"_doOnListMouseMove",mousedown:"_doOnListMouseDown",mouseup:"_doOnListMouseUp",mouseout:"_doOnListMouseOut"}}];for(var c=0;c<this.conf.evs_nodes.length;c++){for(var r in this.conf.evs_nodes[c].evs){if(typeof(window.addEventListener)=="function"){this.conf.evs_nodes[c].node.addEventListener(r,this[this.conf.evs_nodes[c].evs[r]],false)}else{this.conf.evs_nodes[c].node.attachEvent("on"+r,this[this.conf.evs_nodes[c].evs[r]])}}}this.unload=function(){this.clearAll();this.t=null;for(var w=0;w<this.conf.evs_nodes.length;w++){for(var v in this.conf.evs_nodes[w].evs){if(typeof(window.addEventListener)=="function"){this.conf.evs_nodes[w].node.removeEventListener(v,this[this.conf.evs_nodes[w].evs[v]],false)}else{this.conf.evs_nodes[w].node.detachEvent("on"+v,this[this.conf.evs_nodes[w].evs[v]])}this.conf.evs_nodes[w].evs[v]=null;delete this.conf.evs_nodes[w].evs[v]}this.conf.evs_nodes[w].node=null;this.conf.evs_nodes[w].evs=null;delete this.conf.evs_nodes[w].node;delete this.conf.evs_nodes[w].evs;this.conf.evs_nodes[w]=null}window.dhx4._eventable(this,"clear");window.dhx4._enableDataLoading(this,null,null,null,"clear");this._mcDetachHeader();this.DOMelem_input=this.DOMelem_button=this.DOMlist=this.DOMelem=this.DOMParent=null;for(var v in this.conf){this.conf[v]=null;delete this.conf[v]}this.conf=null;if(typeof(window.addEventListener)=="function"){this.list.removeEventListener("scroll",this._doOnListScroll,false)}else{this.list.detachEvent("onscroll",this._doOnListScroll)}this.base.parentNode.removeChild(this.base);this.list.parentNode.removeChild(this.list);this.base=this.list=this.cont=null;this.modes=null;for(var v in this){if(typeof(this[v])=="function"){this[v]=null}}n=null};this.DOMelem_input=this.base.firstChild;this.DOMelem_button=this.base.childNodes[this.base.childNodes.length-(this.conf.combo_image?2:1)];this.DOMlist=this.list;this.DOMelem=this.base;this.DOMParent=m;m=null;if(j!=null){if(j.filter!=null){if(typeof(j.filter)=="string"){this.enableFilteringMode(true,j.filter,window.dhx4.s2b(j.filter_cache),window.dhx4.s2b(j.filter_sub_load))}else{this.enableFilteringMode(true)}}if(j.image_path!=null){this.setImagePath(j.image_path)}if(j.default_image!=null||j.default_image_dis!=null){this.setDefaultImage(j.default_image,j.default_image_dis)}if(j.items||j.options){this.addOption(j.items||j.options)}if(j.xml||j.json){this.load(j.xml||j.json)}if(typeof(j.readonly)!="undefined"){this.readonly(j.readonly)}j=null}return this}function dhtmlXComboFromSelect(g){if(typeof(g)=="string"){g=document.getElementById(g)}var c=g.offsetWidth;var r=g.getAttribute("name")||null;var j=document.createElement("SPAN");g.parentNode.insertBefore(j,g);var m=g.getAttribute("mode")||g.getAttribute("opt_type")||"option";var l=new dhtmlXCombo(j,r,c,m);j=null;var o=g.getAttribute("imagePath");if(o){l.setImagePath(o)}var q=g.getAttribute("defaultImage");var n=g.getAttribute("defaultImageDis");if(window.dhx4.s2b(n)==true){n=true}if(q!=null||n!=null){l.setDefaultImage(q,n)}var a=l._xmlToObj([g],true,g.selectedIndex);if(a.options.length>0){l.addOption(a.options)}a=null;g.parentNode.removeChild(g);g=null;return l}dhtmlXCombo.prototype.setName=function(a){this.conf.form_name=a;this.base.childNodes[1].name=a;this.base.childNodes[2].name=a.replace(/(\[.*)?$/,"_new_value$1")};dhtmlXCombo.prototype.readonly=function(a){if(window.dhx4.s2b(a)){this.base.firstChild.setAttribute("readOnly","true")}else{this.base.firstChild.removeAttribute("readOnly")}};dhtmlXCombo.prototype.setPlaceholder=function(a){if(typeof(a)=="undefined"||a==null){a=""}this.base.firstChild.setAttribute("placeholder",String(a))};dhtmlXCombo.prototype.setTemplate=function(g){for(var c in g){if(typeof(this.conf.template[c])!="undefined"){this.conf.template[c]=String(g[c])}}if(g.columns!=null){this._mcMakeTemplate(g.columns)}else{this._mcDetachHeader()}for(var c in this.t){this.t[c].obj.setText(this.t[c].item,this.t[c].item._conf.text)}this._confirmSelect()};dhtmlXCombo.prototype.setSkin=function(a){if(a==this.conf.skin){return}this.conf.skin=a;this.base.className="dhxcombo_"+this.conf.skin+(this.conf.enabled?"":" dhxcombo_disabled");this.list.className="dhxcombolist_"+this.conf.skin+(this.hdr!=null?" dhxcombolist_multicolumn":"");if(this.hdr!=null){this.hdr.className="dhxcombolist_"+this.conf.skin+" dhxcombolist_hdr"}};dhtmlXCombo.prototype.getInput=function(){return this.base.firstChild};dhtmlXCombo.prototype.getButton=function(){return this.base.childNodes[this.base.childNodes.length-(this.conf.combo_image?2:1)]};dhtmlXCombo.prototype.getList=function(){return this.list};dhtmlXCombo.prototype.getBase=function(){return this.base};dhtmlXCombo.prototype.getParent=function(){return this.DOMParent};dhtmlXCombo.prototype.forEachOption=function(a){for(var c=0;c<this.list.childNodes.length;c++){a.apply(window,[this._getOption(this.list.childNodes[c]._optId,c)])}};dhtmlXCombo.prototype.setFocus=function(){if(this.conf.enabled){this.base.firstChild.focus()}};dhtmlXCombo.prototype.setFontSize=function(a,c){if(a!=null){this.base.firstChild.style.fontSize=a}if(c!=null){this.list.style.fontSize=c}};dhtmlXCombo.prototype.getOption=function(l){var m=null;var g=null;for(var j=0;j<this.list.childNodes.length;j++){if(m==null){var c=this.list.childNodes[j]._optId;if(this.t[c].obj.getValue(this.t[c].item)==l){m=c;g=j}}}return(m==null?null:this._getOption(m,g))};dhtmlXCombo.prototype.getOptionByIndex=function(a){if(a<0){return null}if(this.list.childNodes[a]==null){return null}return this._getOption(this.list.childNodes[a]._optId,a)};dhtmlXCombo.prototype.getOptionByLabel=function(l){var m=null;var g=null;for(var j=0;j<this.list.childNodes.length;j++){if(m==null){var c=this.list.childNodes[j]._optId;if(this.t[c].obj.getText(this.t[c].item,true)==l){m=c;g=j}}}return(m==null?null:this._getOption(m,g))};dhtmlXCombo.prototype.getSelectedIndex=function(){return this._getOptionProp(this.conf.last_selected,"index",-1)};dhtmlXCombo.prototype.getSelectedText=function(){return this._getOptionProp(this.conf.last_selected,"text","")};dhtmlXCombo.prototype.getSelectedValue=function(){return this._getOptionProp(this.conf.last_selected,"value",null)};dhtmlXCombo.prototype.getActualValue=function(){return this.base.childNodes[1].value};dhtmlXCombo.prototype.getComboText=function(){return this.base.childNodes[0].value};dhtmlXCombo.prototype.getIndexByValue=function(c){var a=this.getOption(c);return(a!=null?a.index:-1)};dhtmlXCombo.prototype.setComboText=function(a){if(this.conf.allow_free_text!=true){return}this.unSelectOption();this.conf.last_text=this.base.firstChild.value=a;this.conf.f_server_last=this.base.firstChild.value.toLowerCase()};dhtmlXCombo.prototype.setComboValue=function(c){var a=this.getOption(c);if(a!=null){this.selectOption(a.index)}else{this.conf.last_value=c;this.base.childNodes[1].value=this.conf.last_value;this.base.childNodes[2].value="true"}};dhtmlXCombo.prototype.selectOption=function(c,g,a){if(c<0||c>=this.list.childNodes.length){return}var j=this.list.childNodes[c]._optId;this._setSelected(j,this._isListVisible(),true);this._confirmSelect("script")};dhtmlXCombo.prototype.unSelectOption=function(){if(this.conf.last_hover!=null){this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item,false);this.conf.last_hover=null}this.base.firstChild.value="";if(this.conf.f_mode!=false){this._filterOpts(true)}this._hideList();this._updateTopImage(null);this._confirmSelect("script")};dhtmlXCombo.prototype.confirmValue=function(){this._confirmSelect("script")};dhtmlXCombo.prototype.enable=function(a){a=(typeof(a)=="undefined"?true:window.dhx4.s2b(a));if(this.conf.enabled==a){return}this.conf.enabled=a;if(a){this.base.className="dhxcombo_"+this.conf.skin;this.base.firstChild.removeAttribute("disabled")}else{this._hideList();this.base.className="dhxcombo_"+this.conf.skin+" dhxcombo_disabled";this.base.firstChild.setAttribute("disabled","true")}this._updateTopImage(this.conf.last_selected)};dhtmlXCombo.prototype.disable=function(a){a=(typeof(a)=="undefined"?true:window.dhx4.s2b(a));this.enable(!a)};dhtmlXCombo.prototype.isEnabled=function(){return(this.conf.enabled==true)};dhtmlXCombo.prototype.show=function(a){if(typeof(a)=="undefined"){a=true}else{a=window.dhx4.s2b(a)}this.base.style.display=(a==true?"":"none")};dhtmlXCombo.prototype.hide=function(a){if(typeof(a)=="undefined"){a=true}this.show(!a)};dhtmlXCombo.prototype.isVisible=function(){return(this.base.style.display=="")};dhtmlXCombo.prototype.setFilterHandler=function(a){if(typeof(a)=="function"){this.conf.f_func=a;this.conf.f_mode=true;this.conf.f_dyn=this.conf.f_cache=this.conf.f_url=null}else{if(typeof(a)=="string"&&typeof(window[a])=="function"){this.conf.f_func=window[a];this.conf.f_mode=true;this.conf.f_dyn=this.conf.f_cache=this.conf.f_url=null}else{this.conf.f_func=null}}};dhtmlXCombo.prototype.enableFilteringMode=function(j,c,a,g){if(j==true||j=="between"){this.conf.f_mode=(j==true?"start":"between");if(c!=null){this.conf.f_url=c;this.conf.f_cache=window.dhx4.s2b(a);this.conf.f_dyn=window.dhx4.s2b(g)}else{this.conf.f_url=null;this.conf.f_cache=false;this.conf.f_dyn=false}}else{this.conf.f_mode=false;this.conf.f_url=null;this.conf.f_cache=false;this.conf.f_dyn=false}};dhtmlXCombo.prototype.filter=function(g,a){for(var j=0;j<this.list.childNodes.length;j++){var c=g.apply(window,[this._getOption(this.list.childNodes[j]._optId,j)]);this.list.childNodes[j].style.display=(c===true?"":"none")}if(typeof(a)=="undefined"||a==true){this._showList(true)}};dhtmlXCombo.prototype.sort=function(g){var a=[];for(var c=0;c<this.list.childNodes.length;c++){var j=this.list.childNodes[c]._optId;a.push([j,this._getOption(j,c)])}if(g=="asc"||g=="desc"){k=true;a.sort(function(m,l){m=m[1].text_option.toLowerCase();l=l[1].text_option.toLowerCase();var n=(g=="asc"?1:-1);return(m>l?n:-1*n)})}else{if(typeof(g)=="function"||typeof(window[g])=="function"){if(typeof(window[g])=="function"){g=window[g]}a.sort(function(m,l){return g.apply(window,[m[1],l[1]])})}}while(this.list.childNodes.length>0){this.list.removeChild(this.list.lastChild)}for(var c=0;c<a.length;c++){this.list.appendChild(this.t[a[c][0]].item)}};dhtmlXCombo.prototype.enableAutocomplete=function(a){if(typeof(a)=="undefined"){a=true}else{a=window.dhx4.s2b(a)}this.conf.f_ac=a};dhtmlXCombo.prototype.disableAutocomplete=function(a){if(typeof(a)=="undefined"){a=true}else{a=window.dhx4.s2b(a)}this.enableAutocomplete(!a)};dhtmlXCombo.prototype.allowFreeText=function(a){this.conf.allow_free_text=(typeof(a)=="undefined"?true:window.dhx4.s2b(a))};dhtmlXCombo.prototype._checkForMatch=function(j){var a=window.dhx4.trim(this.base.firstChild.value).toLowerCase();var l=null;var c=this.list.firstChild;while(c!=null){if(c.style.display==""&&c._optId!=null){var g=window.dhx4.trim(this.t[c._optId].obj.getText(c,true)).toLowerCase();if(a==g){l=c._optId;c=null}}if(c!=null){c=c.nextSibling}}if(this.conf.last_match==null){if(l!=null){this._setSelected(l,true,true);this.conf.last_match=l}else{if(this.conf.f_mode!="between"||j==true){this._setSelected(null,true,true);this.conf.last_match=null}}}else{if(l!=null){if(l!=this.conf.last_match){this._setSelected(l,true,true);this.conf.last_match=l}}else{this._setSelected(null,true,true);this.conf.last_match=null}}};dhtmlXCombo.prototype._selectRange=function(c,a){if(this.conf.combo_focus==true){window.dhx4.selectTextRange(this.base.firstChild,c,a)}};dhtmlXCombo.prototype.openSelect=function(){if(!this._isListVisible()){this._showList()}};dhtmlXCombo.prototype.closeAll=function(){this._hideList()};dhtmlXCombo.prototype._showList=function(a){if(this._getListVisibleCount()==0){if(a&&this._isListVisible()){this._hideList()}return}if(this._isListVisible()){this._checkListHeight();return}this.list.style.zIndex=window.dhx4.zim.reserve(this.conf.list_zi_id);if(this.hdr!=null){this.hdr.style.zIndex=Number(this.list.style.zIndex)+1}this.list.style.visibility="hidden";this.list.style.display="";if(this.hdr!=null){this.hdr.style.visibility=this.list.style.visibility;this.hdr.style.display=this.list.style.display}var c=(this.hdr!=null?this.hdr.offsetHeight:0);this.list.style.width=Math.max(this.conf.opts_width||this.conf.col_w||0,this.conf.combo_width)+"px";this.list.style.top=window.dhx4.absTop(this.base)+c+this.base.offsetHeight-1+"px";this.list.style.left=window.dhx4.absLeft(this.base)+"px";if(this.hdr!=null){this.hdr.style.width=this.list.style.width;this.hdr.style.left=this.list.style.left;this.hdr.style.top=parseInt(this.list.style.top)-c+"px"}this._checkListHeight();this.list.style.visibility="visible";if(this.hdr!=null){this.hdr.style.visibility="visible"}this.callEvent("onOpen",[])};dhtmlXCombo.prototype._hideList=function(){if(!this._isListVisible()){return}window.dhx4.zim.clear(this.conf.list_zi_id);this.list.style.display="none";if(this.hdr!=null){this.hdr.style.display="none"}this.conf.clear_click=false;this.callEvent("onClose",[])};dhtmlXCombo.prototype._isListVisible=function(){return(this.list.style.display=="")};dhtmlXCombo.prototype._getListVisibleCount=function(){var a=0;for(var c=0;c<this.list.childNodes.length;c++){a+=(this.list.childNodes[c].style.display==""?1:0)}return a};dhtmlXCombo.prototype._checkListHeight=function(){if(!this._isListVisible()){return}if(this.conf.item_h==null){var q=this.list.firstChild;while(q!=null){if(q.style.display==""){this.conf.item_h=q.offsetHeight+(this.hdr!=null?-1:0);q=null}else{q=q.nextSibling}}q=null}var r=window.dhx4.screenDim();var m=window.dhx4.absTop(this.base);var c=this.base.offsetHeight;var a=(this.hdr!=null?this.hdr.offsetHeight:0);var g=Math.max(0,Math.floor((m+a-r.top)/this.conf.item_h));var o=Math.max(0,Math.floor((r.bottom-(m+c+a))/this.conf.item_h));var u=this._getListVisibleCount();if(o<Math.min(this.conf.opts_count_min,u)&&g>o){o=null}var n=Math.min((o==null?g:o),this.conf.opts_count,u);var j=(n<u?(n*this.conf.item_h)+"px":"");var l=this.conf.sp[this.conf.skin][this.hdr!=null?"hdr_ofs":"list_ofs"];this.list.style.height=j;this.list.style.top=(o==null?m-this.list.offsetHeight+l:m+c+a-l)+"px";if(this.hdr!=null){this.hdr.style.top=(o==null?m-a-this.list.offsetHeight+l:m+c-l)+"px"}};dhtmlXCombo.prototype._scrollToItem=function(l){var j=this.t[l].item.offsetTop;var g=j+this.t[l].item.offsetHeight;var c=this.list.scrollTop;var a=c+this.list.clientHeight;if(j<c){this.list.scrollTop=j+(this.hdr!=null?1:0)}else{if(g>a){this.list.scrollTop=g-this.list.clientHeight+(this.hdr!=null?-this.conf.sp[this.conf.skin].scr_ofs:0)}}};dhtmlXCombo.prototype._setSelected=function(g,c,a){if(a){this._updateTopImage(g)}if(g!=null&&this.conf.last_hover==g){if(c){this._scrollToItem(g)}return}if(this.conf.last_hover!=null){this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item,false);this.conf.last_hover=null;if(g==null){this.callEvent("onSelectionChange",[])}}if(g!=null){this.t[g].obj.setSelected(this.t[g].item,true);this.conf.last_hover=g;this.callEvent("onSelectionChange",[]);if(this.conf.s_mode=="select"&&this.t[g].item==this.t[g].item.parentNode.lastChild){this._subloadRequest()}if(c){this._scrollToItem(g)}}};dhtmlXCombo.prototype._subloadRequest=function(){if(this.conf.f_url!=null&&this.conf.f_dyn==true&&this.conf.f_dyn_end==false){var g="mask="+encodeURIComponent(this.conf.f_mask)+"&pos="+this.list.childNodes.length;var a=this;var c=function(l){if(a.conf.f_cache){a.conf.f_cache_data[a.conf.f_mask].data.push(l.xmlDoc.responseXML)}var j=a.list.childNodes.length;a.conf.f_loading=true;a.load(l.xmlDoc.responseXML);a.conf.f_loading=false;if(j==a.list.childNodes.length){a.conf.f_dyn_end=true;if(a.conf.f_cache){a.conf.f_cache_data[a.conf.f_mask].dyn_end=true}}c=a=null};if(window.dhx4.ajax.method=="post"){window.dhx4.ajax.post(this.conf.f_url,g,c)}else{if(window.dhx4.ajax.method=="get"){window.dhx4.ajax.get(this.conf.f_url+(String(this.conf.f_url).indexOf("?")>=0?"&":"?")+g,c)}}}};dhtmlXCombo.prototype.addOption=function(m,n,c,a,j){var g=null;if(!(m instanceof Array)){var o=this._renderOption({value:m,text:n,css:c,img:a});if(g==null&&window.dhx4.s2b(j)==true){g=o}}else{for(var l=0;l<m.length;l++){if(typeof(m[l])=="undefined"){continue}if(m[l] instanceof Array){o=this._renderOption({value:m[l][0],text:m[l][1],css:m[l][2],img:m[l][3]});if(g==null&&window.dhx4.s2b(m[l][4])==true){g=o}}else{var o=this._renderOption(m[l]);if(g==null&&window.dhx4.s2b(m[l].selected)==true){g=o}}}}if(g!=null){this._setSelected(g,this._isListVisible(),true);this._confirmSelect("onInit")}};dhtmlXCombo.prototype.updateOption=function(a,g,c,j){var l=this._getOptionId(a);if(l==null){return}this.t[l].obj.update(this.t[l].item,{value:g,text:c,css:j});if(this.conf.last_selected==l){this.conf.last_text=this.base.firstChild.value=this.t[l].obj.getText(this.t[l].item,true);this.conf.f_server_last=this.base.firstChild.value.toLowerCase()}};dhtmlXCombo.prototype.deleteOption=function(j){for(var c in this.t){var g=this.t[c].obj.getValue(this.t[c].item);if(g==j){this._removeOption(c)}}if(this._isListVisible()){this._showList(true)}};dhtmlXCombo.prototype.clearAll=function(c){c=(typeof(c)=="undefined"?true:window.dhx4.s2b(c));for(var g in this.t){this._removeOption(g)}if(this.conf.tm_hover){window.clearTimeout(this.conf.tm_hover)}this.conf.last_hover=null;this.conf.last_selected=null;this.list.scrollTop=0;if(c==true){this._hideList()}};dhtmlXCombo.prototype._renderOption=function(j){var l=window.dhx4.newId();var g=document.createElement("DIV");g._optId=l;g._tpl=this.conf.template;if(typeof(j.img)=="undefined"&&typeof(j.img_src)!="undefined"){j.img=j.img_src;delete j.img_src}if(typeof(j.img_dis)=="undefined"&&typeof(j.img_src_dis)!="undefined"){j.img_dis=j.img_src_dis;delete j.img_src_dis}j.img_path=this.conf.img_path;j.img_def=this.conf.img_def;j.img_def_dis=this.conf.img_def_dis;this.list.appendChild(g);var c=(this._isListVisible()&&window.dhx4.isFF==true);if(c==true){var a=this.list.scrollTop;this.list.scrollTop-=1}if(this.hdr!=null){j.multicol=true}this.t[g._optId]={obj:this.modes[this.conf.opts_type].render(g,j),item:g,conf:{type:this.conf.opts_type}};g=null;if(c==true){this.list.scrollTop+=1}return l};dhtmlXCombo.prototype._removeOption=function(a){this.t[a].obj.destruct(this.t[a].item);this.t[a].obj=null;this.t[a].item.parentNode.removeChild(this.t[a].item);this.t[a].item=null;this.t[a].conf=null;this.t[a]=null;delete this.t[a];if(this.conf.last_hover==a){this.conf.last_hover=null}if(this.conf.last_selected==a){this.conf.last_selected=null;this._confirmSelect("onDelete")}};dhtmlXCombo.prototype._confirmSelect=function(c){var a=false;if(this.conf.f_server_tm){window.clearTimeout(this.conf.f_server_tm)}if(this.conf.last_hover!=null){a=a||(this.conf.last_value!=this._getOptionValue(this.conf.last_hover));this.conf.last_match=this.conf.last_selected=this.conf.last_hover;this.conf.last_value=this._getOptionValue(this.conf.last_selected);this.conf.last_text=this.base.firstChild.value=this.t[this.conf.last_selected].obj.getText(this.t[this.conf.last_selected].item,true);this.conf.f_server_last=this.base.firstChild.value.toLowerCase();this.base.childNodes[1].value=this.conf.last_value;this.base.childNodes[2].value="false"}else{if(this.conf.allow_free_text||(this.base.firstChild.value==""&&this.conf.allow_empty_value)){a=a||(this.conf.last_text!=this.base.firstChild.value);this.conf.last_match=this.conf.last_value=this.conf.last_selected=null;this.conf.last_text=this.base.firstChild.value;this.conf.f_server_last=this.base.firstChild.value.toLowerCase();this.base.childNodes[1].value=this.conf.last_text;this.base.childNodes[2].value="true"}else{this._cancelSelect();this._updateTopImage(this.conf.last_selected);return}}if(this.conf.f_ac&&this.conf.f_mode=="start"){this.conf.f_ac_text="";if(c!="blur"){this._selectRange(this.base.firstChild.value.length,this.base.firstChild.value.length)}}this._hideList();if(a==true&&c!="onInit"&&c!="onDelete"){this.callEvent("onChange",[this.conf.last_value,this.conf.last_text])}};dhtmlXCombo.prototype._cancelSelect=function(){this._hideList();this.base.firstChild.value=this.conf.last_text;if(this.conf.f_mode!=false){this._filterOpts(true)}};dhtmlXCombo.prototype._getOption=function(n,j){if(!this.t[n]){return null}if(typeof(j)=="undefined"){j=-1}if(j<0){for(var m=0;m<this.list.childNodes.length;m++){if(j<0&&this.list.childNodes[m]._optId==n){j=m}}}var l={value:this.t[n].obj.getValue(this.t[n].item),text:this.t[n].obj.getText(this.t[n].item),text_input:this.t[n].obj.getText(this.t[n].item,true),text_option:this.t[n].obj.getText(this.t[n].item,null,true),css:this.t[n].obj.getCss(this.t[n].item),selected:(n==this.conf.last_selected),index:j};if(typeof(this.t[n].obj.getExtraData)=="function"){var g=this.t[n].obj.getExtraData(this.t[n].item);for(var c in g){if(typeof(l[c])=="undefined"){l[c]=g[c]}}}return l};dhtmlXCombo.prototype._getOptionProp=function(j,g,c){if(j!=null){var a=this._getOption(j);if(a!=null){return a[g]}}return c};dhtmlXCombo.prototype._getOptionId=function(c){var j=null;for(var a=0;a<this.list.childNodes.length;a++){if(j==null){var g=this.list.childNodes[a]._optId;if(c==this.t[g].obj.getValue(this.t[g].item)){j=g}}}return j};dhtmlXCombo.prototype._getOptionValue=function(a){return this._getOptionProp(a,"value",null)};dhtmlXCombo.prototype.setSize=function(a){this.conf.combo_width=parseInt(a)-(dhx4.isFF||dhx4.isIE||dhx4.isChrome||dhx4.isOpera?2:0);this.base.style.width=Math.max(0,this.conf.combo_width)+"px";this._adjustBase()};dhtmlXCombo.prototype._adjustBase=function(){this.base.firstChild.style.width=Math.max(0,(this.conf.combo_width-24-(this.conf.combo_image?23:0)))+"px";this.base.firstChild.style.marginLeft=(this.conf.combo_image?"23px":"0px")};dhtmlXCombo.prototype.setOptionWidth=function(a){this.conf.opts_width=(parseInt(a)||null)};dhtmlXCombo.prototype.setOptionIndex=function(g,a){if(isNaN(a)||a<0){return}var j=this.getOption(g);if(j==null){return}if(a==j.index){return}var c=this.list.childNodes[j.index];c.parentNode.removeChild(c);if(this.list.childNodes[a]!=null){this.list.insertBefore(c,this.list.childNodes[a])}else{this.list.appendChild(c)}c=null};dhtmlXCombo.prototype.getOptionsCount=function(){return this.list.childNodes.length};dhtmlXCombo.prototype._mcMakeTemplate=function(o){var l="";var j="";this.conf.col_w=0;for(var m=0;m<o.length;m++){var a=Number(parseInt(o[m].width)||50);var g=(o[m].css||"");var n=(m==0&&window.dhx4.isIE6==true?"_first":"");j+="<div class='dhxcombo_cell"+n+" "+g+"' style='width:"+a+"px;'><div class='dhxcombo_cell_text'>"+(o[m].option||"&nbsp;")+"</div></div>";l+="<div class='dhxcombo_hdrcell"+n+" "+g+"' style='width:"+a+"px;'><div class='dhxcombo_hdrcell_text'>"+(o[m].header||"&nbsp;")+"</div></div>";this.conf.col_w+=a+1}var a=500;var c=document.createElement("DIV");c.style.position="absolute";c.style.top="10px";c.style.left=-a*2+"px";c.style.width=a+"px";c.style.height="50px";c.style.overflowY="scroll";c.innerHTML="<div>&nbsp;</div>";document.body.appendChild(c);this.conf.col_w+=a-c.firstChild.offsetWidth+10;c.parentNode.removeChild(c);c=null;this.conf.template.option=j;this._mcAttachHeader(l);this.list.className+=" dhxcombolist_multicolumn"};dhtmlXCombo.prototype._mcAttachHeader=function(a){if(this.hdr==null){this.hdr=document.createElement("DIV");this.hdr.className="dhxcombolist_"+this.conf.skin+" dhxcombolist_hdr";this.hdr.style.display="none";this.list.parentNode.insertBefore(this.hdr,this.list);if(typeof(window.addEventListener)=="function"){this.hdr.addEventListener("mousedown",this._doOnListMouseDown,false)}else{this.hdr.attachEvent("onmousedown",this._doOnListMouseDown)}if(this.conf.opts_type=="checkbox"&&this.conf.combo_image==true){this.conf.combo_image=false;if(this.base.lastChild.className.match(/dhxcombo_top_image/)!=null){this.base.removeChild(this.base.lastChild)}this._adjustBase()}}this.hdr.innerHTML="<div class='dhxcombo_hdrtext'>"+a+"</div>"};dhtmlXCombo.prototype._mcDetachHeader=function(){if(this.hdr!=null){if(typeof(window.addEventListener)=="function"){this.hdr.removeEventListener("mousedown",this._doOnListMouseDown,false)}else{this.hdr.detachEvent("onmousedown",this._doOnListMouseDown)}this.hdr.parentNode.removeChild(this.hdr);this.hdr=null}this.conf.col_w=null;this.conf.item_h=null};dhtmlXCombo.prototype.modes={};dhtmlXCombo.prototype.doWithItem=function(a,n,l,g){var m=(a>=0&&a<this.list.childNodes.length?this.list.childNodes[a]._optId:null);if(m==null){return null}if(typeof(this.t[m].obj[n])!="function"){return null}var j=[this.t[m].item];for(var c=2;c<arguments.length;c++){j.push(arguments[c])}return this.t[m].obj[n].apply(this.t[m].obj,j)};function dhtmlXComboExtend(j,g){for(var c in dhtmlXCombo.prototype.modes[g]){if(typeof(dhtmlXCombo.prototype.modes[j][c])=="undefined"){dhtmlXCombo.prototype.modes[j][c]=dhtmlXCombo.prototype.modes[g][c]}}}dhtmlXCombo.prototype.modes.option={image:false,option_css:"dhxcombo_option_text",render:function(a,c){a._conf={value:c.value,css:""};a.className="dhxcombo_option";a.innerHTML="<div class='"+this.option_css+"'>&nbsp;</div>";if(c.css!=null){a.lastChild.style.cssText=c.css;a._conf.css=c.css}this.setText(a,c.text);return this},destruct:function(a){a._conf=null},update:function(a,c){a._conf.value=c.value;a._conf.css=c.css;a.lastChild.style.cssText=c.css;this.setText(a,c.text)},setText:function(c,g){c._conf.text=g;var a=(typeof(g)=="object"?window.dhx4.template(c._tpl.option,c._conf.text,true):window.dhx4.trim(c._conf.text||""));c.lastChild.innerHTML=(a.length==0?"&nbsp;":a)},getText:function(g,a,c){if(window.dhx4.s2b(a)&&typeof(g._conf.text)=="object"){return window.dhx4.template(g._tpl.input,g._conf.text,true)}if(window.dhx4.s2b(c)&&typeof(g._conf.text)=="object"){return window.dhx4.template(g._tpl.option,g._conf.text,true)}return g._conf.text},getValue:function(a){return a._conf.value},getCss:function(a){return a._conf.css},setSelected:function(a,c){a.className="dhxcombo_option"+(c?" dhxcombo_option_selected":"")},isSelected:function(a){return String(a.className).indexOf("dhxcombo_option_selected")>=0},getExtraData:function(a){return{type:"option"}}};dhtmlXCombo.prototype.modes.checkbox={image:true,image_css:"dhxcombo_checkbox dhxcombo_chbx_#state#",option_css:"dhxcombo_option_text dhxcombo_option_text_chbx",render:function(a,c){if(this.image_css_regexp==null){this.image_css_regexp=new RegExp(this.image_css.replace("#state#","\\d*"))}a._conf={value:c.value,css:"",checked:window.dhx4.s2b(c.checked)};a.className="dhxcombo_option";if(c.multicol==true){c.text.checkbox="<div class='"+String(this.image_css).replace("#state#",(a._conf.checked?"1":"0"))+"'></div>&nbsp;";a.innerHTML="<div class='"+dhtmlXCombo.prototype.modes.option.option_css+"'></div>"}else{a.innerHTML="<div class='"+String(this.image_css).replace("#state#",(a._conf.checked?"1":"0"))+"'></div><div class='"+this.option_css+"'>&nbsp;</div>"}if(c.css!=null){a.lastChild.style.cssText+=c.css;a._conf.css=c.css}this.setText(a,c.text);return this},setChecked:function(c,g){c._conf.checked=window.dhx4.s2b(g);var a=String(this.image_css).replace("#state#",(c._conf.checked?"1":"0"));this._changeChbxCss(c.childNodes,a)},_changeChbxCss:function(a,c){for(var g=0;g<a.length;g++){if(a[g].tagName!=null&&a[g].className!=null&&a[g].className.match(this.image_css_regexp)!=null){a[g].className=c}else{if(a[g].childNodes.length>0){this._changeChbxCss(a[g].childNodes,c)}}}},isChecked:function(a){return(a._conf.checked==true)},getExtraData:function(a){return{type:"checkbox",checked:a._conf.checked}},optionClick:function(j,g,l){var c=true;var a=(g.target||g.srcElement);while(c==true&&a!=null&&a!=j&&a.className!=null){if(a.className.match(this.image_css_regexp)!=null){if(l.callEvent("onCheck",[j._conf.value,!j._conf.checked])===true){this.setChecked(j,!this.isChecked(j))}c=false}else{a=a.parentNode}}a=l=j=null;return c},getTopImage:function(c,a){return""},topImageClick:function(a,c){return true}};dhtmlXComboExtend("checkbox","option");dhtmlXCombo.prototype.setChecked=function(a,c){this.doWithItem(a,"setChecked",c)};dhtmlXCombo.prototype.getChecked=function(a){var c=[];for(var g=0;g<this.list.childNodes.length;g++){if(this.isChecked(g)){c.push(this._getOptionProp(this.list.childNodes[g]._optId,"value",""))}}return c};dhtmlXCombo.prototype.isChecked=function(a){return this.doWithItem(a,"isChecked")};dhtmlXCombo.prototype.modes.image={image:true,image_css:"dhxcombo_image",option_css:"dhxcombo_option_text dhxcombo_option_text_image",render:function(a,c){a._conf={value:c.value,css:""};a.className="dhxcombo_option";a.innerHTML="<div class='"+this.image_css+"'></div><div class='"+this.option_css+"'>&nbsp;</div>";if(c.css!=null){a.lastChild.style.cssText+=c.css;a._conf.css=c.css}this.setText(a,c.text);this.setImage(a,c.img,c.img_dis,c.img_path,c.img_def,c.img_def_dis);return this},update:function(a,c){a._conf.value=c.value;a._conf.css=c.css;a.lastChild.style.cssText=c.css;this.setText(a,c.text);this.setImage(a,c.img,c.img_dis,c.img_path,c.img_def,c.img_def_dis)},setImage:function(g,a,l,m,j,c){if(a!=null&&a.length>0){a=m+a}else{if(j!=null&&j.length>0){a=m+j}else{a=null}}if(l!=null&&l.length>0){l=m+l}else{if(c!=null&&c.length>0){l=m+c}else{if(c==true){l=a}else{l=null}}}g._conf.img=a;g._conf.img_dis=l;g.firstChild.style.backgroundImage=(a!=null?"url("+a+")":"none")},getExtraData:function(a){return{type:"image"}},getTopImage:function(j,g){var c=(g?"img":"img_dis");if(j!=null&&j._conf[c]!=null){return"<div class='"+this.image_css+"' style='background-image:url("+j._conf[c]+");'></div>"}return""}};dhtmlXComboExtend("image","option");dhtmlXCombo.prototype.setDefaultImage=function(a,c){if(a!=null){this.conf.img_def=a}if(c!=null){this.conf.img_def_dis=c}};dhtmlXCombo.prototype.setImagePath=function(a){this.conf.img_path=a};function dhtmlXColorPicker(o){if(!(this instanceof dhtmlXColorPicker)){return new dhtmlXColorPicker(o)}dhx4._eventable(this);var m=this,j=undefined,n=null,g,a,c;this._nodes=[];this.activeNode=null;this._inputListenerId=null;this.base=null;this._globalNode=null;this.memory=null;this.skin=null;this.conf={cp_id:dhx4.newId(),x:0,y:0,c:0,indent:2,position:"right",customColors:false,selectedColor:null,hide:false,hideOnSelect:false,lang:"en",closeable:true};this.value={red:-1,blue:-1,green:-1,hue:-1,sat:-1,lum:-1};this._initMoveSelection=function(l){l=l||event;if(typeof(window.addEventListener)=="function"){m._controllerNodes.colorArea.addEventListener("mousemove",m._setMoveSelection,false);document.body.addEventListener("mouseup",m._cleanMoveSelection,false)}else{m._controllerNodes.colorArea.attachEvent("onmousemove",m._setMoveSelection);document.body.attachEvent("onmouseup",m._cleanMoveSelection)}m._setMoveSelection(l,m._controllerNodes.colorArea);return false};this._cleanMoveSelection=function(){if(typeof(window.removeEventListener)=="function"){m._controllerNodes.colorArea.removeEventListener("mousemove",m._setMoveSelection,false);document.body.removeEventListener("mouseup",m._cleanMoveSelection,false)}else{m._controllerNodes.colorArea.detachEvent("onmousemove",m._setMoveSelection);document.body.detachEvent("onmouseup",m._cleanMoveSelection)}return false};this._setMoveSelection=function(l){l=l||event;var q=m._getOffsetPosition(l,m._controllerNodes.colorArea);if(m._controllerNodes.fr_cover){setTimeout(function(){m._setColorAreaXY(q.x,q.y);m._setColorByXYC()},0)}else{m._setColorAreaXY(q.x,q.y);m._setColorByXYC()}return false};this._initMoveContrast=function(l){l=l||event;if(typeof(window.addEventListener)=="function"){document.body.addEventListener("mousemove",m._setMoveContrast,false);document.body.addEventListener("mouseup",m._cleanMoveContrast,false)}else{document.body.attachEvent("onmousemove",m._setMoveContrast);document.body.attachEvent("onmouseup",m._cleanMoveContrast)}m._setMoveContrast(l,m._controllerNodes.contrastArea)};this._cleanMoveContrast=function(){if(typeof(window.removeEventListener)=="function"){document.body.removeEventListener("mousemove",m._setMoveContrast,false);document.body.removeEventListener("mouseup",m._cleanMoveContrast,false)}else{document.body.detachEvent("onmousemove",m._setMoveContrast);document.body.detachEvent("onmouseup",m._cleanMoveContrast)}};this._setMoveContrast=function(l){l=l||event;var q=m._getOffsetPosition(l,m._controllerNodes.contrastArea);m._setContrastY(q.y);m._setColorByXYC(true)};this._doOnSelectColor=function(){var l=m.colorAIP.rgb2hex({r:m.value.red,g:m.value.green,b:m.value.blue});if(m.activeNode!=null){if(m.activeNode.valueCont){m.activeNode.valueCont.value=l}if(m.activeNode.valueColor){m.activeNode.valueColor.style.backgroundColor=l}}if(m.base._dhx_remove||m.conf.hideOnSelect){m.hide()}m.callEvent("onSelect",[l,((m.activeNode)?m.activeNode.node:null)])};this._doOnCancel=function(){if(m.callEvent("onCancel",[((m.activeNode)?m.activeNode.node:null)])==true&&m.conf.closeable==true){m.hide()}};this._doOnFocusByInput=function(){var q=(this!=window)?this:event.srcElement;var l=(m.activeNode&&m.activeNode.valueCont&&m.activeNode.valueCont==q)?m.activeNode:m._getNodeByValueCont(q);m.activeNode=l;if(l&&l==m.activeNode){m._initListenerInput()}};this._doOnBlurByInput=function(){var q=(this!=window)?this:event.srcElement;var l=(m.activeNode&&m.activeNode.valueCont&&m.activeNode.valueCont==q)?m.activeNode:m._getNodeByValueCont(q);if(l&&l==m.activeNode){m._removeListenerInput()}};this._doOnClickByNode=function(q){q=q||event;var l=(this!=window)?this:event.srcElement;m.activeNode=(m.activeNode.node!=l)?m._getNodeByElement(l):m.activeNode;if(!m.isVisible()){m.show()}};this.saveColor=function(){m.memory.setValue(m.value)};this._onSelectMemoryEl=function(q){var l;m._refreshCoordinatesByHSL(q.value.hue,q.value.sat,q.value.lum);for(l in q.value){m.value[l]=q.value[l]}m._refreshContrast();m._refreshInputValues();m._refreshColorValue()};this._doOnClickByBody=function(r){r=r||event;var l=true,q=r.target||r.srcElement;if(m._isBaseNode(q)){l=false}if(l&&m.activeNode&&(m.activeNode.node==q||m.activeNode.valueCont==q)){l=false}if(l){m.hide()}};this._doOnChangeHSL=function(){var r=parseInt(m._controllerNodes.hue.value),q=parseInt(m._controllerNodes.sat.value),l=parseInt(m._controllerNodes.lum.value),s;if(isNaN(r)||r>359||r<0){m._controllerNodes.hue.value=m.value.hue}else{m.value.hue=r}if(isNaN(q)||q>100||q<0){m._controllerNodes.sat.value=m.value.sat}else{m.value.sat=q}if(isNaN(l)||l>100||l<0){m._controllerNodes.lum.value=m.value.lum}else{m.value.lum=l}s=m.colorAIP.hsl2rgb(m.value.hue,m.value.sat/100,m.value.lum/100);m.value.red=Math.round(255*s.r);m.value.green=Math.round(255*s.g);m.value.blue=Math.round(255*s.b);m._refreshCoordinatesByHSL(m.value.hue,m.value.sat,m.value.lum);m._refreshContrast();m._refreshInputValues();m._refreshColorValue()};this._doOnChangeRGB=function(){var s=parseInt(m._controllerNodes.red.value),r=parseInt(m._controllerNodes.green.value),l=parseInt(m._controllerNodes.blue.value),q;if(isNaN(s)||s>255||s<0){m._controllerNodes.red.value=m.value.red}else{m.value.red=s}if(isNaN(r)||r>255||r<0){m._controllerNodes.green.value=m.value.green}else{m.value.green=r}if(isNaN(l)||l>255||l<0){m._controllerNodes.blue.value=m.value.blue}else{m.value.blue=l}q=m.colorAIP.rgb2hsl(m.value.red/255,m.value.green/255,m.value.blue/255);m.value.hue=Math.round(q.h);m.value.sat=Math.round(q.s*100);m.value.lum=Math.round(q.l*100);m._refreshCoordinatesByHSL(m.value.hue,m.value.sat,m.value.lum);m._refreshContrast();m._refreshInputValues();m._refreshColorValue()};this._doOnChangeHSV=function(){m._controllerNodes.hsv.value=m.setColor(m._controllerNodes.hsv.value)};this._checkType=function(q){var l;if(q instanceof Array){l=m._checkType(q[0]);switch(l){case"string":return"array_string";break;case"input":case"textarea":return"array_input";break;case"object":return"array_object";break;default:return undefined}}else{if(q==undefined){return null}else{if(typeof(q)=="string"){return"string"}else{if(q.tagName&&q.tagName.toLowerCase()=="input"){return"input"}else{if(q.tagName&&q.tagName.toLowerCase()=="textarea"){return"textarea"}else{if(q.tagName){return"container"}else{if(typeof(q)=="object"){return"object"}else{return undefined}}}}}}}};this._initByObject=function(l){if(l.parent&&l.parent.tagName){m.base=l.parent}else{if(typeof(l.parent)=="string"){m.base=document.getElementById(l.parent)}else{m.base=document.createElement("div");m.base._dhx_remove=true}}if(l.color){m.conf.selectedColor=l.color}if(typeof(l.closeable)!="undefined"){this.conf.closeable=dhx4.s2b(l.closeable)}if(l.custom_colors){this._tempInitCC=function(){var s,r;this.initMemoryColors();this.conf.customColors=true;if(l.custom_colors instanceof Array){r=l.custom_colors.length;for(s=0;s<r;s++){this.setCustomColors(l.custom_colors[s])}}if(this.base.parentNode){this.showMemory()}delete this._tempInitCC}}if(l.hide){m.conf.hide=true}if(l.input){m._addNode(l.input,l.target_color,l.target_value)}var q=l.skin||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxcolorpicker")||"dhx_skyblue";m.setSkin(q);if(l.colors){m.initMemoryColors();m.conf.customColors=true}if(l.link){m._addNode(l.link)}};this.unload=function(){var s,q,r;if(this.isVisible()){this.hide()}this.destructMemory();q=this._nodes.length;for(s=0;s<q;s++){this._detachEventsFromNode(this._nodes[s]);for(r in this._nodes[s]){this._nodes[s][r]=null}delete this._nodes[s]}this._nodes=null;if(!this.base._dhx_remove){this.base.className=this.base.className.replace(/\s?dhtmlxcp_\S*/,"")}else{delete this.base._dhx_remove}if(typeof(window.addEventListener)=="function"){this._controllerNodes.colorArea.removeEventListener("mousedown",this._initMoveSelection,false);this._controllerNodes.colorArea.removeEventListener("dblclick",this._doOnSelectColor,false);this._controllerNodes.contrastArea.removeEventListener("mousedown",this._initMoveContrast,false);this._controllerNodes.button_save.removeEventListener("click",this._doOnSelectColor,false);this._controllerNodes.button_cancel.removeEventListener("click",this._doOnCancel,false);this._controllerNodes.hue.removeEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.sat.removeEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.lum.removeEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.red.removeEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.green.removeEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.blue.removeEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.hsv.removeEventListener("change",this._doOnChangeHSV,false)}else{this._controllerNodes.colorArea.detachEvent("onmousedown",this._initMoveSelection);this._controllerNodes.colorArea.detachEvent("ondblclick",this._doOnSelectColor);this._controllerNodes.contrastArea.detachEvent("onmousedown",this._initMoveContrast);this._controllerNodes.button_save.detachEvent("onclick",this._doOnSelectColor);this._controllerNodes.button_cancel.detachEvent("onclick",this._doOnCancel);this._controllerNodes.hue.detachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.sat.detachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.lum.detachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.red.detachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.green.detachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.blue.detachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.hsv.detachEvent("onchange",this._doOnChangeHSV)}if(this._controllerNodes.fr_cover){if(this._controllerNodes.fr_cover.parentNode){this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover)}delete this._controllerNodes.fr_cover}dhx4.zim.clear(this.conf.cp_id);dhx4._eventable(this,"clear");for(r in this){this[r]=null}m=null,n=null,c=null};j=this._checkType(o);switch(j){case"object":m._initByObject(o);break;case"input":case"textarea":m._initByObject({});this._addNode(o);break;case"string":n=document.getElementById(o);return new dhtmlXColorPicker(n);break;case"container":m._initByObject({parent:o});break;case null:m._initByObject({});break;case"array_string":case"array_input":m._initByObject({});a=o.length;for(g=0;g<a;g++){this._addNode(o[g])}break;case"array_object":m._initByObject({});a=o.length;for(g=0;g<a;g++){c=this._addNode(o[g].input,o[g].target_color,o[g].target_value).conf;c.customColors=(o[g].custom_colors!=undefined)?dhx4.s2b(o[g].custom_colors):c.customColors;c.selectedColor=(o[g].color!=undefined)?o[g].color:c.selectedColor}break}this.base.innerHTML="<div class='dhxcp_g_area'><div class='dhxcp_sub_area'><div class='dhxcp_g_color_area'><div class='dhxcp_color_selector'><div class='dhxcp_v_line'></div><div class='dhxcp_h_line'></div></div><div class='dhxcp_contrast_area'><div class='dhxcp_h_line'></div></div></div><div class='dhxcp_g_input_area'><div class='dhxcp_value_cont'><div class='dhxcp_value_color'></div><input type='text' class='dhxcp_value'/></div><table class='dhxcp_inputs_cont' cellpadding='0' cellspacing='0' border='0'><tr><td class='dhxcp_label_hsl'>"+this.i18n[this.conf.lang].labelHue+"</td><td class='dhxcp_input_hsl'><input type='text' class='dhxcp_input_hsl'/></td><td class='dhxcp_label_rgb'>"+this.i18n[this.conf.lang].labelRed+"</td><td class='dhxcp_input_rgb'><input type='text' class='dhxcp_input_rgb'/></td></tr><tr><td class='dhxcp_label_hsl'>"+this.i18n[this.conf.lang].labelSat+"</td><td class='dhxcp_input_hsl'><input type='text' class='dhxcp_input_hsl'/></td><td class='dhxcp_label_rgb'>"+this.i18n[this.conf.lang].labelGreen+"</td><td class='dhxcp_input_rgb'><input type='text' class='dhxcp_input_rgb'/></td></tr><tr><td class='dhxcp_label_hsl'>"+this.i18n[this.conf.lang].labelLum+"</td><td class='dhxcp_input_hsl'><input type='text' class='dhxcp_input_hsl'/></td><td class='dhxcp_label_rgb'>"+this.i18n[this.conf.lang].labelBlue+"</td><td class='dhxcp_input_rgb'><input type='text' class='dhxcp_input_rgb'/></td></tr></table></div><div class='dhxcp_g_memory_area'></div><div class='dhxcp_buttons_area'><button class='dhx_button_save'>"+this.i18n[this.conf.lang].btnSelect+"</button><button class='dhx_button_cancel'>"+this.i18n[this.conf.lang].btnCancel+"</button></div></div>";"</div>";this._globalNode=this.base.firstChild;this._controllerNodes={colorArea:this._globalNode.firstChild.firstChild.firstChild,v_line:this._globalNode.firstChild.firstChild.firstChild.childNodes[0],h_line:this._globalNode.firstChild.firstChild.firstChild.childNodes[1],contrastArea:this._globalNode.firstChild.firstChild.childNodes[1],contrast_line:this._globalNode.firstChild.firstChild.childNodes[1].firstChild,color:this._globalNode.firstChild.childNodes[1].childNodes[0].firstChild,hsv:this._globalNode.firstChild.childNodes[1].childNodes[0].childNodes[1],hue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[1].firstChild,sat:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[1].firstChild,lum:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[1].firstChild,red:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[3].firstChild,green:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[3].firstChild,blue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[3].firstChild,memory_block:this._globalNode.firstChild.childNodes[2],button_save:this._globalNode.firstChild.childNodes[3].firstChild,button_cancel:this._globalNode.firstChild.childNodes[3].childNodes[1]};this._labelNodes={labelHue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].firstChild,labelSat:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].firstChild,labelLum:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].firstChild,labelRed:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[2],labelGreen:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[2],labelBlue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[2],btnAddColor:null,btnSelect:this._globalNode.firstChild.childNodes[3].firstChild,btnCancel:this._globalNode.firstChild.childNodes[3].childNodes[1]};if(typeof(this._tempInitCC)=="function"){this._tempInitCC()}if(typeof(window.addEventListener)=="function"){this._controllerNodes.colorArea.addEventListener("mousedown",this._initMoveSelection,false);this._controllerNodes.colorArea.addEventListener("dblclick",this._doOnSelectColor,false);this._controllerNodes.contrastArea.addEventListener("mousedown",this._initMoveContrast,false);this._controllerNodes.button_save.addEventListener("click",this._doOnSelectColor,false);this._controllerNodes.button_cancel.addEventListener("click",this._doOnCancel,false);this._controllerNodes.hue.addEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.sat.addEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.lum.addEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.red.addEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.green.addEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.blue.addEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.hsv.addEventListener("change",this._doOnChangeHSV,false)}else{this._controllerNodes.colorArea.attachEvent("onmousedown",this._initMoveSelection);this._controllerNodes.colorArea.attachEvent("ondblclick",this._doOnSelectColor);this._controllerNodes.contrastArea.attachEvent("onmousedown",this._initMoveContrast);this._controllerNodes.button_save.attachEvent("onclick",this._doOnSelectColor);this._controllerNodes.button_cancel.attachEvent("onclick",this._doOnCancel);this._controllerNodes.hue.attachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.sat.attachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.lum.attachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.red.attachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.green.attachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.blue.attachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.hsv.attachEvent("onchange",this._doOnChangeHSV)}this.setColor(this.conf.selectedColor||"#ffffff");if(this._nodes.length){for(var g=0;g<this._nodes.length;g++){this._attachEventsToNode(this._nodes[g])}}if(this.conf.hide){this.hide()}if(typeof(this._cpInitFRM)=="function"){this._cpInitFRM()}}dhtmlXColorPicker.prototype.linkTo=function(c,g,j){if(arguments.length==1){g=j=c}var a;c=c||null;j=j||null;if(typeof(g)=="string"){g=document.getElementById(g)}a=this._addNode(g,c,j);if(a){this._attachEventsToNode(a)}return a};dhtmlXColorPicker.prototype._isBaseNode=function(a){if(a==this.base){return true}if(a.parentElement==document.body){return false}else{if(!a.parentElement){return false}else{return this._isBaseNode(a.parentElement)}}};dhtmlXColorPicker.prototype._hasInput=function(g){var c,a,j=false;a=this._nodes.length;for(c=0;c<a;c++){if(this._nodes[c].valueCont==g){j=true;break}}return j};dhtmlXColorPicker.prototype._findNodesByArray=function(m){var g,a,c,j=[];a=m.length;for(g=0;g<a;g++){if(typeof(m[g])=="string"){c=document.getElementById(m[g])}else{c=m[g]}if(c){this._addNode(c)}}};dhtmlXColorPicker.prototype._addNode=function(l,n,m){var c,j,g,a;if(typeof(l)=="string"){c=document.getElementById(l)}else{c=l}if(typeof(n)=="string"){n=document.getElementById(n)}if(typeof(m)=="string"){m=document.getElementById(m)}if(!c){return null}if(dhx4.s2b(c.getAttribute("colorbox"))){j=document.createElement("div");j.style.width=c.offsetWidth+"px";j.style.height=c.offsetHeight+"px";c.style.width=c.offsetWidth-(c.offsetHeight+8)+"px";c.parentNode.insertBefore(j,c);j.style.position="relative";g=document.createElement("div");j.appendChild(c);j.appendChild(g);g.className="dhxcp_colorBox";c.className+=" dhxcp_colorInput";g.style.width=g.style.height=c.offsetHeight+"px"}a={node:c,valueColor:(n!=undefined)?n:g||c,valueCont:(m!=undefined)?m:c,conf:{customColors:(c.getAttribute("customcolors")!=null)?dhx4.s2b(c.getAttribute("customcolors")):null,selectedColor:c.getAttribute("selectedcolor")}};this._nodes.push(a);if(!this.activeNode){this.activeNode=a}return a};dhtmlXColorPicker.prototype.getNode=function(g){var a=null,c=null;if(typeof(g)=="string"){a=document.getElementById(g)}else{a=g}if(a.tagName!=undefined){c=this._getNodeByElement(a)}return c};dhtmlXColorPicker.prototype._getNodeByElement=function(g){var j=null,c,a;a=this._nodes.length;for(c=0;c<a;c++){if(this._nodes[c].node==g){j=this._nodes[c]}}return j};dhtmlXColorPicker.prototype._getNodeByValueCont=function(g){var j=null,c,a;a=this._nodes.length;for(c=0;c<a;c++){if(this._nodes[c].valueCont&&this._nodes[c].valueCont==g){j=this._nodes[c]}}return j};dhtmlXColorPicker.prototype.initMemoryColors=function(){var c=this;this._controllerNodes.memory_block.innerHTML="<div class='dhxcp_memory_button_cont'><button class='dhxcp_save_to_memory'><div class='dhxcp_label_bm'>"+this.i18n[this.conf.lang].btnAddColor+"</div></button></div><div class='dhxcp_memory_els_cont'><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a></div>";this.memory=new this.Memory(this._controllerNodes.memory_block.childNodes[1]);this.memory.onSelect=this._onSelectMemoryEl;this.memory.onSave=function(j){var g=c.colorAIP.rgb2hex({r:j.red,g:j.green,b:j.blue});c.callEvent("onSaveColor",[g])};var a=this._controllerNodes.memory_block.childNodes[0].firstChild;this._labelNodes.btnAddColor=this._controllerNodes.memory_block.childNodes[0].firstChild.firstChild;if(typeof(window.addEventListener)=="function"){a.addEventListener("click",this.saveColor,false)}else{a.attachEvent("onclick",this.saveColor)}};dhtmlXColorPicker.prototype._refreshCoordinatesByHSL=function(n,m,c){var a,j,g;a=Math.round((this.configColorArea.maxX-this.configColorArea.minX)*n/359)+this.configColorArea.minX;j=Math.round((this.configColorArea.maxY-this.configColorArea.minY)*(100-c)/100)+this.configColorArea.minY;g=Math.round((this.configColorArea.maxY-this.configColorArea.minY)*(100-m)/100)+this.configColorArea.minY;this._setColorAreaXY(a,j);this._setContrastY(g)};dhtmlXColorPicker.prototype._parseColor=function(g){if(g instanceof Array){var c={r:parseInt(g[0]),g:parseInt(g[1]),b:parseInt(g[2])}}else{if(typeof(g)=="string"){g=g.replace(/\s/g,"");if(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i.test(g)){var a=g.match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i);var c={r:parseInt(a[1]),g:parseInt(a[2]),b:parseInt(a[3])}}else{var c=this.colorAIP.hex2rgb(g)}}}return c};dhtmlXColorPicker.prototype.setColor=function(m){var c=this.colorAIP.rgb2hex({r:this.value.red,g:this.value.green,b:this.value.blue});var g=this._parseColor(m);var l=(g instanceof Object);l=l&&(0<=g.r&&g.r<=255);l=l&&(0<=g.g&&g.g<=255);l=l&&(0<=g.b&&g.b<=255);if(!l){return c}var j=this.colorAIP.rgb2hex({r:g.r,g:g.g,b:g.b});if(j==c){return c}this.value.red=g.r;this.value.green=g.g;this.value.blue=g.b;var a=this.colorAIP.rgb2hsl(g.r/255,g.g/255,g.b/255);this.value.hue=Math.round(a.h);this.value.sat=Math.round(a.s*100);this.value.lum=Math.round(a.l*100);this._refreshCoordinatesByHSL(this.value.hue,this.value.sat,this.value.lum);this._refreshContrast();this._refreshInputValues();this._refreshColorValue();return j};dhtmlXColorPicker.prototype.getSelectedColor=function(){return[this.colorAIP.rgb2hex({r:this.value.red,g:this.value.green,b:this.value.blue}),[this.value.red,this.value.green,this.value.blue],[this.value.hue,this.value.sat,this.value.lum]]};dhtmlXColorPicker.prototype._attachEventsToNode=function(a){if(typeof(window.addEventListener)=="function"){a.node.addEventListener("click",this._doOnClickByNode,false)}else{a.node.attachEvent("onclick",this._doOnClickByNode)}if(a.valueCont&&a.valueCont.tagName.toLowerCase()=="input"){if(typeof(window.addEventListener)=="function"){a.valueCont.addEventListener("focus",this._doOnFocusByInput,false);a.valueCont.addEventListener("blur",this._doOnBlurByInput,false)}else{a.valueCont.attachEvent("onfocus",this._doOnFocusByInput);a.valueCont.attachEvent("onblur",this._doOnBlurByInput)}}};dhtmlXColorPicker.prototype._detachEventsFromNode=function(a){if(typeof(window.addEventListener)=="function"){a.node.removeEventListener("click",this._doOnClickByNode,false)}else{a.node.detachEvent("onclick",this._doOnClickByNode)}if(a.valueCont&&a.valueCont.tagName.toLowerCase()=="input"){if(typeof(window.addEventListener)=="function"){a.valueCont.removeEventListener("focus",this._doOnFocusByInput,false);a.valueCont.removeEventListener("blur",this._doOnBlurByInput,false)}else{a.valueCont.detachEvent("onfocus",this._doOnFocusByInput);a.valueCont.detachEvent("onblur",this._doOnBlurByInput)}}};dhtmlXColorPicker.prototype.show=function(c){var a=false;if(c!=undefined){this.activeNode=this.getNode(c)||this.activeNode}if(this.activeNode&&this.activeNode.valueCont&&this.activeNode.valueCont.value){this.setColor(this.activeNode.valueCont.value)}if(this.activeNode){a=(this.activeNode.conf.customColors!=null?this.activeNode.conf.customColors:this.conf.customColors);this.setColor(this.activeNode.conf.selectedColor)}else{a=this.conf.customColors}if(a){this.showMemory()}else{this.hideMemory()}if(this.base._dhx_remove){this.base.firstChild.style.zIndex=dhx4.zim.reserve(this.conf.cp_id);this.base.style.visibility="hidden";if(document.body.firstChild){document.body.insertBefore(this.base,document.body.firstChild)}else{document.body.appendChild(this.base)}this._refreshPosition();this.base.style.visibility="visible";if(typeof(window.addEventListener)=="function"){document.body.addEventListener("mousedown",this._doOnClickByBody,false)}else{document.body.attachEvent("onmousedown",this._doOnClickByBody)}}else{this.base.appendChild(this._globalNode)}if(this._controllerNodes.fr_cover){this.base.insertBefore(this._controllerNodes.fr_cover,this._globalNode)}this.callEvent("onShow",[((this.activeNode)?this.activeNode.node:null)])};dhtmlXColorPicker.prototype.setPosition=function(c,l){var j=null;var a=parseInt(c);var g=parseInt(l);if(isNaN(a)){j=({right:"right",bottom:"bottom"}[c.toLowerCase()]?c:null)}if(this.base._dhx_remove){if(j==null){}else{this.conf.position=j;this._refreshPosition(j)}}else{if(isNaN(a)||isNaN(g)){}else{this._globalNode.style.left=a+"px";this._globalNode.style.top=g+"px";if(this._controllerNodes.fr_cover){this._controllerNodes.fr_cover.style.left=this._globalNode.style.left;this._controllerNodes.fr_cover.style.top=this._globalNode.style.top}}}};dhtmlXColorPicker.prototype._initListenerInput=function(){var a=this;this._inputListenerId=this._inputListenerId||setInterval(function(){a._refreshValueByInput()},70)};dhtmlXColorPicker.prototype._removeListenerInput=function(){if(this._inputListenerId){clearInterval(this._inputListenerId);this._inputListenerId=null}};dhtmlXColorPicker.prototype._refreshValueByInput=function(){var c=this.activeNode.valueCont.value,a=this.getSelectedColor()[0];if(this._inputListenerId){if(/^#[\da-f]{6}$/i.test(c)&&c!=a){this.setColor(c);this.callEvent("onSelect",[c,this.activeNode.node])}}};dhtmlXColorPicker.prototype._refreshPosition=function(c){if(this.activeNode==null){return}var o=dhx4.absTop(this.activeNode.node);var a=dhx4.absLeft(this.activeNode.node);var j=dhx4.screenDim();var g=this._globalNode.offsetWidth;var l=this._globalNode.offsetHeight;var n=0;c=c||this.conf.position;switch(c){case"bottom":var n=o+this.activeNode.node.offsetHeight+this.conf.indent;var m=a;if(m+g>j.left+j.right){m=a+this.activeNode.node.offsetWidth-g}if(m<j.left){m=a}if(n+l>j.top+j.bottom){n=o-l-this.conf.indent}if(n-j.top<0){n=j.top+this.conf.indent}this._globalNode.style.top=n+"px";this._globalNode.style.left=m+"px";break;default:var m=a+this.activeNode.node.offsetWidth+this.conf.indent;n=o;if(c=="right"){if(m+g>j.left+j.right){m=a-g-this.conf.indent}if(m<j.left){m=a+this.activeNode.node.offsetWidth+this.conf.indent}}if(j.bottom-(n+l)<=0){n=o+this.activeNode.node.offsetHeight-l}if(n-j.top<0){n=j.top+this.conf.indent}this._globalNode.style.left=m+"px";this._globalNode.style.top=n+"px"}if(this._controllerNodes.fr_cover){this._controllerNodes.fr_cover.style.left=this._globalNode.style.left;this._controllerNodes.fr_cover.style.top=this._globalNode.style.top}};dhtmlXColorPicker.prototype.isVisible=function(){var a=false;if(this.base._dhx_remove){a=this.base.parentNode==document.body}else{a=this._globalNode.parentNode==this.base}return a};dhtmlXColorPicker.prototype.hide=function(){if(this.base._dhx_remove){if(this.base.parentNode){this.base.parentNode.removeChild(this.base);dhx4.zim.clear(this.conf.cp_id);if(typeof(window.addEventListener)=="function"){document.body.removeEventListener("mousedown",this._doOnClickByBody,false)}else{document.body.detachEvent("onmousedown",this._doOnClickByBody)}}}else{if(this.isVisible()==false){return}this.base.removeChild(this._globalNode)}if(this._controllerNodes.fr_cover&&this._controllerNodes.fr_cover.parentNode){this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover)}if(this.callEvent!=undefined){this.callEvent("onHide",[((this.activeNode)?this.activeNode.node:null)])}};dhtmlXColorPicker.prototype.configColorArea={minX:1,maxX:209,minY:1,maxY:119};dhtmlXColorPicker.prototype._skinCollection={dhx_skyblue:true,dhx_web:true,dhx_terrace:true};dhtmlXColorPicker.prototype.i18n={en:{labelHue:"Hue",labelSat:"Sat",labelLum:"Lum",labelRed:"Red",labelGreen:"Green",labelBlue:"Blue",btnAddColor:"Save the color",btnSelect:"Select",btnCancel:"Cancel"}};dhtmlXColorPicker.prototype.loadUserLanguage=function(a){if(typeof(this._mergeLangModules)=="function"){this._mergeLangModules()}this.conf.lang=a;this._refreshLanguage()};dhtmlXColorPicker.prototype._refreshLanguage=function(){var a,c=this.i18n[this.conf.lang];for(a in c){if(this._labelNodes[a]){this._labelNodes[a].innerHTML=c[a]}}};dhtmlXColorPicker.prototype._setColorAreaXY=function(a,g){var c=this.configColorArea;a=parseInt(a);if(c.minX>a){this.conf.x=c.minX}else{if(a>c.maxX){this.conf.x=c.maxX}else{if(!isNaN(a)){this.conf.x=a}}}g=parseInt(g);if(c.minY>g){this.conf.y=c.minY}else{if(g>c.maxY){this.conf.y=c.maxY}else{if(!isNaN(g)){this.conf.y=g}}}this._refreshLines()};dhtmlXColorPicker.prototype._setColorByXYC=function(c){c=c||false;this.value.hue=Math.round((359*(this.conf.x-this.configColorArea.minX))/(this.configColorArea.maxX-this.configColorArea.minX));this.value.lum=Math.round(100-(100*(this.conf.y-this.configColorArea.minY))/(this.configColorArea.maxY-this.configColorArea.minY));this.value.sat=Math.round(100-(100*(this.conf.c-this.configColorArea.minY))/(this.configColorArea.maxY-this.configColorArea.minY));var a=this.colorAIP.hsl2rgb(this.value.hue,this.value.sat/100,this.value.lum/100);this.value.red=Math.round(255*a.r);this.value.green=Math.round(255*a.g);this.value.blue=Math.round(255*a.b);if(!c){this._refreshContrast()}this._refreshInputValues();this._refreshColorValue()};dhtmlXColorPicker.prototype._setContrastY=function(c){var a=this.configColorArea;c=parseInt(c);if(!isNaN(c)){this.conf.c=Math.min(Math.max(a.minY,c),a.maxY)}this._refreshContrastLine()};dhtmlXColorPicker.prototype._refreshInputValues=function(){this._controllerNodes.hue.value=this.value.hue;this._controllerNodes.sat.value=this.value.sat;this._controllerNodes.lum.value=this.value.lum;this._controllerNodes.red.value=this.value.red;this._controllerNodes.green.value=this.value.green;this._controllerNodes.blue.value=this.value.blue};dhtmlXColorPicker.prototype._refreshColorValue=function(){this._controllerNodes.color.style.backgroundColor="rgb("+[this.value.red,this.value.green,this.value.blue].join(", ")+")";var a=this.colorAIP.rgb2hex({r:this.value.red,g:this.value.green,b:this.value.blue});this._controllerNodes.hsv.value=a;this.callEvent("onChange",[a])};dhtmlXColorPicker.prototype._refreshContrast=function(){var j=this.colorAIP.hsl2rgb(this.value.hue,0,this.value.lum/100);var l=this.colorAIP.hsl2rgb(this.value.hue,1,this.value.lum/100);var g=this._checkIeVersion();if(g&&g<=9){var m=this._controllerNodes.contrastArea.firstChild;if(m==this._controllerNodes.contrast_line){m=document.createElement("div");m.className+="dhxcp_ie_gradient";this._controllerNodes.contrastArea.appendChild(m);this._controllerNodes.contrastArea.appendChild(this._controllerNodes.contrast_line)}var c=this.colorAIP.rgb2hex({r:Math.round(255*j.r),g:Math.round(255*j.g),b:Math.round(255*j.b)});var a=this.colorAIP.rgb2hex({r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b)});m.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr='"+a+"', endColorstr='"+c+"', GradientType=0)"}else{j=[Math.round(255*j.r),Math.round(255*j.g),Math.round(255*j.b)];l=[Math.round(255*l.r),Math.round(255*l.g),Math.round(255*l.b)];this._controllerNodes.contrastArea.style.backgroundImage="linear-gradient(to top, rgb("+j.join(",")+"), rgb("+l.join(",")+"))"}};dhtmlXColorPicker.prototype._refreshLines=function(){this._controllerNodes.v_line.style.left=this.conf.x+"px";this._controllerNodes.h_line.style.top=this.conf.y+"px"};dhtmlXColorPicker.prototype._refreshContrastLine=function(){this._controllerNodes.contrast_line.style.top=this.conf.c+"px"};dhtmlXColorPicker.prototype._getOffsetPosition=function(j,a){var c={x:NaN,y:NaN},g=j.target||j.srcElement;if(g==a){c.x=(j.offsetX!=undefined)?j.offsetX:j.layerX;c.y=(j.offsetY!=undefined)?j.offsetY:j.layerY}else{if(g==this._controllerNodes.v_line){c.y=(j.offsetY!=undefined)?j.offsetY:j.layerY}else{c.x=(j.offsetX!=undefined)?j.offsetX:j.layerX}}return c};dhtmlXColorPicker.prototype.colorAIP={hex2rgb:function(c){var a=c.match(/^(#)([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(a!=null){return{r:parseInt("0x"+a[2]),g:parseInt("0x"+a[3]),b:parseInt("0x"+a[4])}}else{return null}},rgb2hex:function(l){var j=parseInt(l.r),c=parseInt(l.g),a=parseInt(l.b);j=j||0,c=c||0,a=a||0;return"#"+((j)?((j<16)?"0"+j.toString(16):j.toString(16)):"00")+((c)?((c<16)?"0"+c.toString(16):c.toString(16)):"00")+((a)?((a<16)?"0"+a.toString(16):a.toString(16)):"00")},rgb2hsl:function(q,o,j){var n,m,c;var a=Math.max(q,o,j),l=Math.min(q,o,j);c=0.5*(a+l);if(a==l){n=0}else{if(a==q){n=60*(o-j)/(a-l);if(o<j){n+=360}}else{if(a==o){n=60*(j-q)/(a-l)+120}else{n=60*(q-o)/(a-l)+240}}}if(c==0||a==l){m=0}else{if(c<=0.5){m=0.5*(a-l)/c}else{m=0.5*(a-l)/(1-c)}}return{h:n,s:m,l:c}},hsl2rgb:function(q,g,n){var l,m,o;var c=[],a=[];if(n<=0.5){l=n*(1+g)}else{l=n+g-(n*g)}m=2*n-l;o=q/360;c.push(o+1/3);c.push(o);c.push(o-1/3);for(var j=0;j<3;j++){if(c[j]<0){c[j]+=1}else{if(c[j]>1){c[j]-=1}}if(c[j]<1/6){a.push(m+(l-m)*6*c[j])}else{if(c[j]<0.5){a.push(l)}else{if(c[j]<2/3){a.push(m+(l-m)*(2/3-c[j])*6)}else{a.push(m)}}}}return{r:a[0],g:a[1],b:a[2]}}};dhtmlXColorPicker.prototype._checkIeVersion=function(){var a;var c=navigator.userAgent.match(/(MSIE)\s(\d\.\d)/i);a=(c&&c[2])?parseInt(c[2]):null;return a};dhtmlXColorPicker.prototype.setCustomColors=function(){if(this.memory==null){this.initMemoryColors();this.conf.customColors=true}var j,g,n,c,m,a;g=arguments.length;for(j=0;j<g;j++){if(arguments[j] instanceof Array){n=this._rgb2value(arguments[j][0],arguments[j][1],arguments[j][2]);this.memory.setValue(n,null,false);continue}else{if(typeof(arguments[j])=="string"){c=arguments[j].match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i);if(c instanceof Array){n=this._rgb2value(c[1],c[2],c[3]);this.memory.setValue(n,null,false);continue}c=arguments[j].match(/(#[\da-f]{6})/ig);if(c instanceof Array){a=c.length;for(m=0;m<a;m++){n=this._hex2value(c[m]);this.memory.setValue(n,null,false)}}}}}};dhtmlXColorPicker.prototype.getCustomColors=function(){var c=[];if(this.memory!=null&&this.conf.customColors==true){for(var g=0;g<this.memory.controllers.length;g++){var a=this.memory.controllers[g].value;c.push(this.colorAIP.rgb2hex({r:a.red,g:a.green,b:a.blue}))}}return c};dhtmlXColorPicker.prototype._rgb2value=function(l,j,a){var c=this.colorAIP.rgb2hsl(l/255,j/255,a/255);return{red:l,green:j,blue:a,hue:Math.round(c.h),sat:Math.round(c.s*100),lum:Math.round(c.l*100)}};dhtmlXColorPicker.prototype._hex2value=function(g){var c,a;c=this.colorAIP.hex2rgb(g);a=this.colorAIP.rgb2hsl(c.r/255,c.g/255,c.b/255);return{red:c.r,green:c.g,blue:c.b,hue:Math.round(a.h),sat:Math.round(a.s*100),lum:Math.round(a.l*100)}};dhtmlXColorPicker.prototype.showMemory=function(){if(this.memory==null){this.initMemoryColors()}if(!this._globalNode.className.match(/dhxcp_add_memory/)){this._globalNode.className+=" dhxcp_add_memory"}this.conf.customColors=true};dhtmlXColorPicker.prototype.hideMemory=function(){if(this.memory!=null){this._globalNode.className=this._globalNode.className.replace(/\sdhxcp_add_memory/,"")}this.conf.customColors=false};dhtmlXColorPicker.prototype.setSkin=function(l){l=l.toLowerCase();var g,c=-1,a,j="dhtmlxcp";g=this.base.className.match(/\S\w+/ig);if(g instanceof Array){for(a in this._skinCollection){if(c==-1){c=this._indexOf(g,j+"_"+a)}else{break}}c=(c==-1)?g.length:c}else{g=[];c=0}g[c]=j+"_"+l;this.base.className=g.join(" ");this.skin=l};dhtmlXColorPicker.prototype.hideOnSelect=function(a){a=dhx4.s2b(a);this.conf.hideOnSelect=a};dhtmlXColorPicker.prototype._indexOf=function(a,j){var g,c,m=-1;c=a.length;for(g=c;g>=0;g--){if(a[g]==j){m=g;break}}return m};dhtmlXColorPicker.prototype.destructMemory=function(){if(this.memory==null){return}this.hideMemory();var a=this._controllerNodes.memory_block.childNodes[0].firstChild;this._labelNodes.btnAddColor=null;if(typeof(window.addEventListener)=="function"){a.removeEventListener("click",this.saveColor,false)}else{a.detachEvent("onclick",this.saveColor)}this.memory.remove();this._controllerNodes.memory_block.innerHTML="";this.memory=null};dhtmlXColorPicker.prototype.Memory=function(g){var c=this,a=null,j={red:255,blue:255,green:255,hue:0,sat:0,lum:100};this.select=function(){var m=(this!=window)?this:event.srcElement;var l=l||m.dhxpc_memory;if(a!=null){c.unSelect()}a=l;l.domElement.className+=" dhxcp_memory_el_select";if(typeof(c.onSelect)=="function"){c.onSelect(l)}};this.onSelect=null;this.onSave=null;this._createMemoryController=function(l){var m={domElement:l,value:dhx4._copyObj(j)};l.dhxpc_memory=m;if(typeof(window.addEventListener)=="function"){l.addEventListener("click",c.select,false)}else{l.attachEvent("onclick",c.select)}return m};this._findMemoryControllers=function(r){var o=r.getElementsByTagName("a"),n,m,q=[];m=o.length;for(n=0;n<m;n++){q.push(this._createMemoryController(o[n]))}return q};this.controllers=this._findMemoryControllers(g);this.unSelect=function(){if(a){a.domElement.className=a.domElement.className.replace(/\s.*$/i,"")}a=null};this.setActiveNext=function(){var n=null,m;if(a==null){a=this.controllers[0]}else{n=this.getIndex(a);m=this.controllers.length;this.unSelect();a=(n+1<m)?this.controllers[n+1]:this.controllers[0]}a.domElement.className+=" dhxcp_memory_el_next";return a};this.setValue=function(m,l,n){a=l||a;if(a==null){a=this.controllers[0]}a.value.red=m.red;a.value.blue=m.blue;a.value.green=m.green;a.value.hue=m.hue;a.value.sat=m.sat;a.value.lum=m.lum;a.domElement.style.backgroundColor="rgb("+[m.red,m.green,m.blue].join(", ")+")";this.setActiveNext();if((n!=false)&&(typeof(this.onSave)=="function")){this.onSave(m)}};this.clean=function(){var m=this.controllers.length,o;for(var n=0;n<m;n++){o=this.controllers[n];o.value=dhx4._copyObj(j);o.domElement.style.backgroundColor="rgb("+[j.red,j.green,j.blue].join(", ")+")"}this.unSelect();a=this.controllers[0]};this.getIndex=function(o){var n,m,q=-1;m=this.controllers.length;for(n=0;n<m;n++){if(this.controllers[n]==o){q=n;break}}return q};this.remove=function(){var n,m;m=this.controllers.length;for(n=0;n<m;n++){if(typeof(window.addEventListener)=="function"){this.controllers[n].domElement.removeEventListener("click",this.select,false)}else{this.controllers[n].domElement.detachEvent("onclick",this.select)}delete this.controllers[n].domElement.dhxpc_memory}delete this.onSelect;delete this.controllers;delete this.onSave}};if(window.dhx4.isIE6){dhtmlXColorPicker.prototype._cpInitFRM=function(){var a;if(!this._controllerNodes.fr_cover){a=document.createElement("IFRAME");a.className="dhxcp_frm";a.border=0;a.frameBorder=0;this._controllerNodes.fr_cover=a}if(!this.base._dhx_remove){this.base.insertBefore(a,this._globalNode)}}}function dhtmlXSlider(c){var a=this;this.conf={size:null,skin:null,vertical:false,min:0,max:99,value:0,step:1,decimals:0,margin:2,border:1,inverse:false,disabled:false,tooltip:false,visible:true,linkTo:undefined};this._attachedNode={};this._movingInitialValues=null;this.base=null;if(arguments.length>1){return new dhtmlXSlider(this._renderArgumets(arguments))}else{if(typeof(c)=="string"||(typeof(c)=="object"&&c.tagName)){return new dhtmlXSlider({parent:c})}}if(typeof(c.parent)=="string"){this.base=document.getElementById(c.parent)}else{this.base=c.parent}this._mergeConfig(this._readAttFormNode(this.base));this._mergeConfig(c);this._detectDecimals();if(this.conf.size==null||this.conf.size==undefined){if(this.conf.vertical){this.conf.size=this.base.offsetHeight}else{this.conf.size=this.base.offsetWidth}}var g=this.conf.skin||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxslider")||"dhx_skyblue";this.setSkin(g);this.base.innerHTML="<div class='dhxsl_container'><div class='dhxsl_track'></div><div class='dhxsl_runner'></div></div>";this._nodes={cont:this.base.firstChild,track:this.base.firstChild.firstChild,runner:this.base.firstChild.childNodes[1]};this._nodes.cont.onmousedown=this._nodes.track.onmousedown=this._nodes.cont.onselectstart=this._nodes.track.onselectstart=function(j){j=j||event;if(typeof(j.preventDefault)=="function"){j.preventDefault()}else{j.returnValue=false}return false};this.conf.value=this._normalize(this.conf.value);this._setOrient(this.conf.vertical);this.setSize(this.conf.size);this._initMover=function(l){l=l||event;if(typeof(l.preventDefault)=="function"){l.preventDefault()}a._nodes.runner.className="dhxsl_runner dhxsl_runner_actv";var j=(l.type=="mousedown"?"client":"page")+(a.conf.vertical?"Y":"X");a._movingInitialValues={};a._movingInitialValues.value=a.conf.value;a._movingInitialValues.coord=(typeof(l[j])!="undefined"?l[j]:l.touches[0][j]);if(a.conf.disabled==false){if(typeof(window.addEventListener)=="function"){window.addEventListener("mousemove",a._move,false);window.addEventListener("mouseup",a._cleanMove,false);window.addEventListener("touchmove",a._move,false);window.addEventListener("touchend",a._cleanMove,false)}else{document.body.attachEvent("onmousemove",a._move);document.body.attachEvent("onmouseup",a._cleanMove)}}a.callEvent("_onRunnerMouseDown",[]);return false};this._move=function(q){q=q||event;if(typeof(q.preventDefault)=="function"){q.preventDefault()}var n=(q.type=="mousemove"?"client":"page")+(a.conf.vertical?"Y":"X");var o=(a.conf.vertical)?a._nodes.runner.offsetHeight:a._nodes.runner.offsetWidth;var l=a.conf.max-a.conf.min;var j=(typeof(q[n])!="undefined"?q[n]:q.touches[0][n]);var m=a._movingInitialValues.value+(j-a._movingInitialValues.coord)*l/(a.conf.size-o)*(a.conf.inverse?-1:1);a.setValue(m,true)};this._cleanMove=function(j){if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousemove",a._move,false);window.removeEventListener("mouseup",a._cleanMove,false);window.removeEventListener("touchmove",a._move,false);window.removeEventListener("touchend",a._cleanMove,false)}else{document.body.detachEvent("onmousemove",a._move);document.body.detachEvent("onmouseup",a._cleanMove)}a._movingInitialValues=null;a._nodes.runner.className=a._nodes.runner.className.replace(/\s{0,}dhxsl_runner_actv/gi,"");a.callEvent("onSlideEnd",[a.conf.value]);a.callEvent("_onRunnerMouseUp",[])};this._doOnSetValue=function(o){if(a._movingInitialValues!=null){return false}o=o||event;if(typeof(o.preventDefault)=="function"){o.preventDefault()}var n=(a.conf.vertical)?(o.offsetY||o.layerY):(o.offsetX||o.layerX);var m=(a.conf.vertical)?a._nodes.runner.offoffsetHeightsetHe:a._nodes.runner.offsetWidth;var j=a.conf.max-a.conf.min;var l=n*j/(a.conf.size)+a.conf.min;a.setValue(l,true);if(a._movingInitialValues==null){a._initMover(o)}return false};this._doOnChangeInput=function(l){l=l||event;var j=l.target||l.srcElement;a.setValue(j.value)};this._doOnKeyDown=function(l){l=l||event;var j=l.target||l.srcElement;if(l.keyCode==13){a.setValue(j.value)}};this._attachEvents(this._nodes);this.unload=function(){dhx4._eventable(this,"clear");this._detachNode();this._detachEvents(this._nodes);this.base.removeChild(this._nodes.cont);this._nodes.cont.onmousedown=this._nodes.track.onmousedown=this._nodes.cont.onselectstart=this._nodes.track.onselectstart=null;delete this._nodes.cont;delete this._nodes.track;delete this._nodes.max;delete this._nodes.min;delete this._nodes.runner;if(/\s?dhtmlxslider_\S*/.test(this.base.className)){this.base.className=this.base.className.replace(/\s?dhtmlxslider_\S*/,"")}for(var j in this){this[j]=null}a=null};dhx4._eventable(this);if(this.conf.disabled){this.disable()}if(this.conf.tooltip){this.enableTooltip()}if(!this.conf.visible){this.hide()}if(this.conf.linkTo){this.linkTo(this.conf.linkTo)}return this}dhtmlXSlider.prototype._setOrient=function(a){a=a||false;if(/\s?dhxsl_cont_hr/i.test(this._nodes.cont.className)){this._nodes.cont.className=this._nodes.cont.className.replace(/\s?dhxsl_cont_hr/i,"")}if(/\s?dhxsl_cont_vr/i.test(this._nodes.cont.className)){this._nodes.cont.className=this._nodes.cont.className.replace(/\s?dhxsl_cont_vr/i,"")}if(a){this._nodes.cont.className+=" dhxsl_cont_vr"}else{this._nodes.cont.className+=" dhxsl_cont_hr"}};dhtmlXSlider.prototype._attachEvents=function(a){if(typeof(window.addEventListener)=="function"){a.runner.addEventListener("mousedown",this._initMover,false);a.runner.addEventListener("touchstart",this._initMover,false);a.cont.addEventListener("mousedown",this._doOnSetValue,false);a.cont.addEventListener("touchstart",this._doOnSetValue,false)}else{a.runner.attachEvent("onmousedown",this._initMover);a.cont.attachEvent("onmousedown",this._doOnSetValue)}};dhtmlXSlider.prototype._detachEvents=function(a){if(typeof(window.addEventListener)=="function"){a.runner.removeEventListener("mousedown",this._initMover,false);a.runner.removeEventListener("touchstart",this._initMover,false);a.cont.removeEventListener("mousedown",this._doOnSetValue,false);a.cont.removeEventListener("touchstart",this._doOnSetValue,false)}else{a.runner.detachEvent("onmousedown",this._initMover);a.cont.detachEvent("onmousedown",this._doOnSetValue)}};dhtmlXSlider.prototype._mergeConfig=function(c){for(var a in c){switch(a.toLowerCase()){case"min":case"max":case"size":case"step":case"value":case"inverse":this.conf[a]=c[a];break;case"tooltip":case"visible":case"vertical":case"disabled":this.conf[a]=dhx4.s2b(c[a]);break;case"parent":continue;break;default:this.conf[a]=c[a]}}};dhtmlXSlider.prototype._readAttFormNode=function(j){var n=j.attributes,a=n.length,g,m={},c;for(g=0;g<a;g++){c=n[g];switch(c.name.toLowerCase()){case"size":case"min":case"max":case"value":case"step":m[c.name]=c.value;break;case"skin":m.skin=c.value;break;case"vertical":case"disabled":case"visible":m[c.name]=dhx4.s2b(c.value);break;case"linkto":m.linkTo=c.value;break;case"tooltip":m.tooltip=dhx4.s2b(c.value);break}}return m};dhtmlXSlider.prototype._renderArgumets=function(a){var j={},g,c;c=a.length;for(g=0;g<c;g++){switch(g){case 0:j.parent=a[g];break;case 1:j.size=a[g];break;case 2:j.skin=a[g];break;case 3:j.vertical=a[g];break;case 4:j.min=a[g];break;case 5:j.max=a[g];break;case 6:j.value=a[g];break;case 7:j.step=a[g];break}}return j};dhtmlXSlider.prototype._skinCollection={dhx_skyblue:true,dhx_web:true,dhx_terrace:true};dhtmlXSlider.prototype._indexOf=function(a,j){var g,c,m=-1;c=a.length;for(g=c;g>=0;g--){if(a[g]==j){m=g;break}}return m};dhtmlXSlider.prototype._refreshRunner=function(){var a,c;if(this.conf.vertical){a=this._nodes.cont.offsetHeight-this._nodes.runner.offsetHeight;c=this._getCoord(a);this._nodes.runner.style.top=c+this.conf.border+"px";this._nodes.runner.style.left=Math.round((this._nodes.cont.offsetWidth-this._nodes.runner.offsetWidth)/2)+"px"}else{a=this._nodes.cont.offsetWidth-this._nodes.runner.offsetWidth;c=this._getCoord(a);this._nodes.runner.style.left=c+this.conf.border+"px";this._nodes.runner.style.top=Math.round((this._nodes.cont.offsetHeight-this._nodes.runner.offsetHeight)/2)+"px"}};dhtmlXSlider.prototype._setValueByCoord=function(j){var a=dhx4.absLeft(this._nodes.cont),l=dhx4.absTop(this._nodes.cont),g,c;if(this.conf.vertical){c=(j.y-l-this._nodes.runner.offsetHeight/2)/(this._nodes.cont.offsetHeight-this._nodes.runner.offsetHeight)}else{c=(j.x-a-this._nodes.runner.offsetWidth/2)/(this._nodes.cont.offsetWidth-this._nodes.runner.offsetWidth)}g=(this.conf.max-this.conf.min)*c+this.conf.min;this.setValue(g,true)};dhtmlXSlider.prototype._getCoord=function(a){var g=(this.conf.inverse?this._inverseValue(this.conf.value):this.conf.value);var c=(g-this.conf.min)/(this.conf.max-this.conf.min);return Math.round(a*c)};dhtmlXSlider.prototype._normalize=function(c){c=Number(c);c=Math.round(c/this.conf.step)*this.conf.step;var a=Math.pow(10,this.conf.decimals);c=Math.round(c*a)/a;c=Math.max(this.conf.min,Math.min(this.conf.max,c));return c};dhtmlXSlider.prototype._attachNode=function(c){var a=c.tagName.toLowerCase();if(!a){return}this._attachedNode.node=c;switch(a){case"input":case"select":if(typeof(window.addEventListener)=="function"){c.addEventListener("change",this._doOnChangeInput,false);c.addEventListener("keydown",this._doOnKeyDown,false)}else{c.attachEvent("onchange",this._doOnChangeInput);c.attachEvent("onkeydown",this._doOnKeyDown)}this._attachedNode.setValue=function(m,g){m=String(m);if(g>0){var j=m.match(/\.\d{1,}$/);if(j!=null){g=Math.max(g-j[0].length+1)}m+=(m.indexOf(".")<0?".":"");for(var l=0;l<g;l++){m+="0"}}this.node.value=m};break;default:this._attachedNode.setValue=function(g){this.node.innerHTML=g}}this._attachedNode.setValue(this.conf.value,this.conf.decimals)};dhtmlXSlider.prototype._detachNode=function(){var c=this._attachedNode.node;if(!c){return}var a=c.tagName;switch(a){case"input":case"select":if(typeof(window.addEventListener)=="function"){c.removeEventListener("change",this._doOnChangeInput,false);c.removeEventListener("keydown",this._doOnChangeInput,false)}else{c.detachEvent("change",this._doOnChangeInput);c.detachEvent("keydown",this._doOnChangeInput)}break}delete this._attachedNode.node;delete this._attachedNode.setValue};dhtmlXSlider.prototype._detectDecimals=function(){var a=this.conf.step.toString().match(/\.(\d*)$/);this.conf.decimals=(a!=null?a[1].length:0)};dhtmlXSlider.prototype.setSize=function(a){if(!isNaN(a)){if(this.conf.vertical){if(this._nodes.cont.style.width){delete this._nodes.cont.style.width}this._nodes.cont.style.height=a-this.conf.margin+"px"}else{if(this._nodes.cont.style.height){delete this._nodes.cont.style.height}this._nodes.cont.style.width=a-this.conf.margin+"px"}this._refreshRunner()}};dhtmlXSlider.prototype.setSkin=function(l){l=l.toLowerCase();var g,c=-1,a,j="dhtmlxslider";g=this.base.className.match(/\S\w+/ig);if(g instanceof Array){for(a in this._skinCollection){if(c==-1){c=this._indexOf(g,j+"_"+a)}else{break}}c=(c==-1)?g.length:c}else{g=[];c=0}g[c]=j+"_"+l;this.base.className=g.join(" ");this.conf.skin=l;if(this._nodes){this._refreshRunner()}};dhtmlXSlider.prototype.setValue=function(a,c){c=c||false;if(!isNaN(a)){a=this._normalize(a);if(this.conf.value!=a){this.conf.value=a;this._refreshRunner();if(this.conf.tooltip){this._nodes.cont.title=a}if(c){this.callEvent("onChange",[a,this])}}}if(typeof(this._attachedNode.setValue)=="function"){this._attachedNode.setValue(this.conf.value,this.conf.decimals)}};dhtmlXSlider.prototype.getValue=function(){return this.conf.value};dhtmlXSlider.prototype._inverseValue=function(){return this.conf.max+this.conf.min-this.conf.value};dhtmlXSlider.prototype.disable=function(g){g=(g==false)?false:true;var c=null;if(g){for(var a in this._nodes){if(a=="cont"){continue}c=new RegExp("\\s?dhxsl_"+a+"_dis","i");if(!c.test(this._nodes[a].className)){this._nodes[a].className+=" dhxsl_"+a+"_dis"}}this.conf.disabled=true}else{this.enable()}};dhtmlXSlider.prototype.enable=function(){var c;for(var a in this._nodes){if(a=="cont"){continue}c=new RegExp("\\s?dhxsl_"+a+"_dis","i");if(c.test(this._nodes[a].className)){this._nodes[a].className=this._nodes[a].className.replace(c,"")}}this.conf.disabled=false};dhtmlXSlider.prototype.isEnabled=function(){return !this.conf.disabled};dhtmlXSlider.prototype.disableTooltip=function(){this._nodes.cont.removeAttribute("title");this.conf.tooltip=false};dhtmlXSlider.prototype.enableTooltip=function(a){if(typeof(a)=="undefined"){a=true}else{a=dhx4.s2b(a)}if(a){this._nodes.cont.title=this.conf.value;this.conf.tooltip=true}else{this.disableTooltip()}};dhtmlXSlider.prototype.setMax=function(a){if(!isNaN(a)&&this.conf.min<a){this.conf.max=a;this.setValue(this.conf.value)}};dhtmlXSlider.prototype.getMax=function(){return this.conf.max};dhtmlXSlider.prototype.setMin=function(a){if(!isNaN(a)&&this.conf.max>a){this.conf.min=a;this.setValue(this.conf.value)}};dhtmlXSlider.prototype.getMin=function(){return this.conf.min};dhtmlXSlider.prototype.setStep=function(a){var c=this.conf.max-this.conf.min;if(!isNaN(a)&&a<c){this.conf.step=a;this._detectDecimals();this.setValue(this.conf.value)}};dhtmlXSlider.prototype.getStep=function(){return this.conf.step};dhtmlXSlider.prototype.show=function(){if(/\s?dhxsl_hidden/i.test(this._nodes.cont.className)){this._nodes.cont.className=this._nodes.cont.className.replace(/\s?dhxsl_hidden/i,"")}this.conf.visible=true};dhtmlXSlider.prototype.hide=function(){if(!/\s?dhxsl_hidden/i.test(this._nodes.cont.className)){this._nodes.cont.className+=" dhxsl_hidden"}this.conf.visible=false};dhtmlXSlider.prototype.isVisible=function(){return this.conf.visible};dhtmlXSlider.prototype.linkTo=function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(this._attachedNode.node){this._detachNode()}this._attachNode(a)};function dhtmlXPopup(g){var j=this;this.conf=g||{};g=null;this.mode=(this.conf.mode||"bottom");this.conf.zi=window.dhx4.newId();this.conf.context=(this.conf.context==null?true:window.dhx4.s2b(this.conf.context));this.conf.IE6_display_fix=(this.conf.IE6_display_fix==null?false:window.dhx4.s2b(this.conf.IE6_display_fix));this.conf.last_p_click=this.conf.last_body_click=null;this.p=document.createElement("DIV");this.p.style.display="none";this.p.innerHTML="<div class='dhx_popup_area"+(window.dhx4.isIE?" dhx_popup_area_ie":"")+"'><table cellspacing='0' cellpadding='0' border='0' class='dhx_popup_table'><tbody></tbody></table></div><div class='dhx_popup_arrow dhx_popup_arrow_"+this.mode+"'></div>";document.body.appendChild(this.p);this.p.oncontextmenu=function(a){if(j.conf.context==false){a=a||event;a.returnValue=false;return false}};this.skinParams={dhx_terrace:{t0:19,t1:9,t2:19,t3:9},dhx_skyblue:{t0:12,t1:9,t2:12,t3:9},dhx_web:{t0:12,t1:9,t2:12,t3:9}};this.p.ontouchstart=this.p.onclick=function(m){m=m||event;var l=(j.conf.last_p_click!=null&&j.conf.last_p_click!=m.type);j.conf.last_p_click=m.type;if(l==true){return}j._clearClick=true;if(j._nodeObj!=null){j.callEvent("onContentClick",[]);return true}var a=(m.target||m.srcElement);var n=null;while(a!=j.p&&a!=null){if(typeof(a._idd)!="undefined"&&!a._isSeparator){n=a._idd;a=null}else{a=a.parentNode}}a=null;if(n!=null){j.callEvent("onClick",[n]);if(j!=null&&j.isVisible!=null&&j.isVisible()&&j.callEvent("onBeforeHide",["select",m,n])===true){m.cancelBubble=true;j.hide()}}};this.separator="DHXSEP_"+window.dhx4.newId();this.tpl=[];this._setTemplate=function(a){this.tpl=a.split(",")};this.show=function(l){var a=null;if(arguments.length==1){if(!l){l=this.conf.id[0]}else{if(!this._idExists(l)){return}}if(this.conf.toolbar){a=this.conf.toolbar._getItemDim(l)}if(this.conf.ribbon){a=this.conf.ribbon._getItemDim(l)}if(this.conf.form){a=this.conf.form._getItemDim(l)}}else{if(arguments.length==4){this._clearClick=true;a={left:arguments[0],top:arguments[1],width:arguments[2],height:arguments[3]};l=null}}if(!a){return}this.p.style.visibility="hidden";this.p.style.display="";this._setPos(a);this.p.style.zIndex=window.dhx4.zim.reserve(this.conf.zi);this.p.style.visibility="visible";this._lastId=l;this.callEvent("onShow",[l])};this._setPos=function(I,n){var v=I.left;var s=I.top;var C=I.width;var L=I.height;this._posData={left:v,top:s,width:C,height:L};var N=window.dhx4.screenDim();var F=n||this.mode;if(typeof(n)=="undefined"){n=false}var P={top:(s-this.p.offsetHeight)-N.top,bottom:N.bottom-(s+L+this.p.offsetHeight),left:v-this.p.offsetWidth-N.left,right:N.right-(v+C+this.p.offsetWidth)};if(!n&&P[F]<0){var J=this._getAvailPos(F,P);if(J!==false){this._setPos(I,J);return}}if(F=="top"||F=="bottom"){var D=this.skinParams[this.conf.skin].t2;var A=this.skinParams[this.conf.skin].t3;var r=Math.round(this.p.offsetWidth/2);var a=Math.round(this.p.lastChild.offsetWidth/2);if(v<N.left){var M=Math.min(v+C,N.left);C=v+C-M;v=M}if(v+C>N.right){C=N.right-v}var u=Math.round(v+C/2);var m=u-r;var K=u-D-a;var q=u+a+D-this.p.offsetWidth;if(m<N.left-A){m=Math.min(N.left-A,K)}else{if(m+this.p.offsetWidth>N.right+A){m=Math.max(q,N.right+A-this.p.offsetWidth)}}this.p.style.left=m+"px";this.p.style.top=(F=="top"?s-this.p.offsetHeight:s+L)+"px";u=u-m-a;this.p.lastChild.className="dhx_popup_arrow dhx_popup_arrow_"+F;this.p.lastChild.style.top=(F=="top"?this.p.offsetHeight-this.p.lastChild.offsetHeight:0)+"px";this.p.lastChild.style.left=u+"px"}if(F=="left"||F=="right"){var D=this.skinParams[this.conf.skin].t0;var A=this.skinParams[this.conf.skin].t1;var o=Math.round(this.p.offsetHeight/2);var S=Math.round(this.p.lastChild.offsetHeight/2);if(s<N.top){var l=Math.min(s+L,N.top);L=s+L-l;s=l}if(s+L>N.bottom){L=N.bottom-s}var u=Math.round(s+L/2);var H=u-o;var Q=u-D-S;var O=u+S+D-this.p.offsetHeight;if(H<N.top-A){H=Math.min(N.top-A,Q)}else{if(H+this.p.offsetHeight>N.bottom+A){H=Math.max(O,N.bottom+A-this.p.offsetHeight)}}this.p.style.left=(F=="left"?v-this.p.offsetWidth:v+C)+"px";this.p.style.top=H+"px";u=u-H-S;this.p.lastChild.className="dhx_popup_arrow dhx_popup_arrow_"+F;this.p.lastChild.style.left=(F=="left"?this.p.offsetWidth-this.p.lastChild.offsetWidth:0)+"px";this.p.lastChild.style.top=u+"px"}if(this._IEDisp&&this._nodeId!=null){var E=document.getElementById(this._nodeId);if(this.conf.IE6_display_fix==true){E.style.visibility="hidden"}window.setTimeout(function(){E.style.visibility="visible";E=null},1)}};this._getAvailPos=function(s,r){var m={top:["bottom","right","left"],bottom:["top","right","left"],left:["right","bottom","top"],right:["left","bottom","top"]};var n=null;for(var o=0;o<m[s].length;o++){if(n==null&&r[m[s][o]]>0){n=m[s][o]}}if(n==null){n="bottom";for(var l in r){if(r[l]>r[n]){n=l}}}if(n==s){return false}return n};this._repaint=function(){if(this.isVisible()){this._setPos(this._posData)}};this.clear=function(){if(this._nodeObj){if(window.dhx4.isIE&&typeof(window.dhtmlXLayoutObject)!="undefined"&&this._nodeObj instanceof dhtmlXLayoutObject){this.p.onmousedown=null}if(this._nodeObj.unload){this._nodeObj.unload()}else{if(this._nodeObj.destruct){this._nodeObj.destruct()}}this._nodeObj=this._nodeId=null;if(this._nodeObjEv!=null){for(var l=0;l<this._nodeObjEv.length;l++){this.detachEvent(this._nodeObjEv[l])}this._nodeObjEv=null}}if(this._IEHoverInited){this._IEHoverClear()}var a=this.p.firstChild.firstChild.firstChild;while(a.childNodes.length>0){a.removeChild(a.lastChild)}a=null;this.itemData={}};this.hide=function(){if(this.p.style.display!="none"){this.p.style.display="none";window.dhx4.zim.clear(this.conf.zi);var a=this._lastId;this._lastId=null;this.callEvent("onHide",[a]);this.conf.last_p_click=this.conf.last_body_click=null}};this.isVisible=function(){return(this.p.style.display=="")};this.itemData={};this.getItemData=function(a){if(!a){return this.itemData}if(this.itemData[a]){return this.itemData[a]}return{}};this.setSkin=function(a){this.conf.skin=a;this.p.className="dhx_popup_"+this.conf.skin;if(this._nodeObj!=null&&typeof(this._nodeObj.setSkin)=="function"){this._nodeObj.setSkin(this.conf.skin)}this._repaint()};this.attachList=function(m,u){this._setTemplate(m);this.clear();var n=this.p.firstChild.firstChild.firstChild;for(var s=0;s<u.length;s++){var o=document.createElement("TR");if(u[s]!=this.separator){if(typeof(u[s].id)=="undefined"||u[s].id==null){o._idd=window.dhx4.newId();while(this.itemData[o._idd]!=null){o._idd=window.dhx4.newId()}}else{o._idd=u[s].id}this.itemData[o._idd]=u[s]}n.appendChild(o);if(u[s]==this.separator){o.className="dhx_popup_sep";o._isSeparator=true;var v=document.createElement("TD");v.className="dhx_popup_sep";v.colSpan=this.tpl.length;v.innerHTML="<div class='dhx_popup_sep'>&nbsp;</div>";o.appendChild(v);v=null}else{for(var a=0;a<this.tpl.length;a++){var l="dhx_popup_td";if(this._IEFirstLast&&(this.tpl.length==1||a==0||a==this.tpl.length-1)){if(this.tpl.length==1){l+=" dhx_popup_td_single"}else{l+=(a==0?" dhx_popup_td_first":" dhx_popup_td_last")}}var v=document.createElement("TD");v.className=l;v.innerHTML=u[s][this.tpl[a]]||"&nbsp;";o.appendChild(v);v=null}if(this._IEHover){o._IEHover=true;if(!this._IEHoverInited){this._IEHoverInit()}}}o=null}n=null;this._repaint()};this._attachNode=function(n,m){this.clear();this._nodeId="dhxpopup_node_"+window.dhx4.newId();var a=this.p.firstChild.firstChild.firstChild;var l=document.createElement("TR");l.className="dhxnode";a.appendChild(l);var o=document.createElement("TD");o.className="dhx_popup_td";o.innerHTML="<div id='"+this._nodeId+"' style='position:relative;'></div>";if(m.width){o.firstChild.style.width=m.width+"px"}if(m.height){o.firstChild.style.height=m.height+"px"}l.appendChild(o);o=l=a=null;if(typeof(this["_attach_init_"+n])=="function"){this["_attach_init_"+n](m);this._enableIEVFix()}this._repaint();return this._nodeObj};this.unload=function(){if(typeof(window.addEventListener)=="function"){window.removeEventListener("touchstart",this._doOnClick,false);window.removeEventListener("click",this._doOnClick,false);window.removeEventListener("keyup",this._doOnKeyUp,false);window.removeEventListener("unload",this._doOnUnload,false)}else{document.body.detachEvent("onclick",this._doOnClick,false);document.body.detachEvent("onkeyup",this._doOnKeyUp,false);document.body.detachEvent("onunload",this._doOnUnload,false)}this.clear();if(this.conf.toolbarEvent!=null&&this.conf.toolbar!=null){if(this.conf.toolbar.detachEvent!=null){this.conf.toolbar.detachEvent(this.conf.toolbarEvent)}else{this.conf.toolbar._getItemDim=null}}if(this.conf.ribbonEvent!=null&&this.conf.ribbon!=null){if(this.conf.ribbon.detachEvent!=null){this.conf.ribbon.detachEvent(this.conf.ribbonEvent)}else{this.conf.ribbon._getItemDim=null}}if(this.conf.slider!=null){for(var m=0;m<this.conf.slider_events.length;m++){this.conf.slider.detachEvent(this.conf.slider_events[m])}this.conf.slider_events=null;this._sliderShow=this._sliderHide=null;this.conf.slider=null}window.dhx4._eventable(this,"clear");this.p.onclick=this.p.ontouchstart=this.p.oncontextmenu=null;this.p.parentNode.removeChild(this.p);this.p=null;for(var l in this.conf){this.conf[l]=null}for(var l in this){this[l]=null}j=null};window.dhx4._eventable(this);this._doOnClick=function(s){s=s||event;var a=(j.conf.last_body_click!=null&&j.conf.last_body_click!=s.type);j.conf.last_body_click=s.type;if(a==true){return}if(j._clearClick==true){j._clearClick=false;return}if(j.conf.form!=null){var m;var u=(s.target||s.srcElement);if((u.tagName||"").toLowerCase()=="option"){u=u.parentNode}if(u.className!=null&&u.className.search("dhxform")>=0){if(u.parentNode!=null&&u.parentNode.parentNode!=null&&u.parentNode.parentNode._idd!=null){m=u.parentNode.parentNode._idd;if(u.parentNode.parentNode._type=="ra"){m=[u.parentNode.parentNode._group,u.parentNode.parentNode._value]}}}else{var o=true;var q=false;while(o&&!q){var n=(u.className||"").toLowerCase();if(n.length>0){q=(n=="dhxform_btn"||n.search(/dhxeditor_inside/gi)>=0||n=="dhxcombo_input"||n.search(/dhxcombolist/gi)>=0)}u=u.parentNode;o=(u!=null)}if(q){return}}u=null;if(m!=null&&j._idExists(m)){return}}if(typeof(window.dhtmlXForm)!="undefined"&&j._nodeObj instanceof window.dhtmlXForm){var v={};var n=0;var l=j._nodeObj;l.forEachItem(function(r){if(l.getItemType(r)=="combo"){v[l.getCombo(r).list._listId]=true;n++}});l=null;if(n>0){var u=(s.target||s.srcElement);var o=true;var q=false;while(o==true&&q!=true){var n=(u.className||"").toLowerCase();if(n.length>0&&n.search(/^dhxcombolist/gi)>=0&&u._listId!=null&&v[u._listId]==true){q=true;u=null}else{u=u.parentNode;o=(u!=null)}}if(q==true){return}}}if(j.isVisible()&&j.callEvent("onBeforeHide",["click",s])===true){j.hide()}};this._doOnKeyUp=function(a){a=a||event;if(a.keyCode==27){if(j.isVisible()&&j.callEvent("onBeforeHide",["esc",a])===true){j.hide()}}};this._doOnUnload=function(){j.unload()};if(typeof(window.addEventListener)=="function"){window.addEventListener("touchstart",this._doOnClick,false);window.addEventListener("click",this._doOnClick,false);window.addEventListener("keyup",this._doOnKeyUp,false);window.addEventListener("unload",this._doOnUnload,false)}else{document.body.attachEvent("onclick",this._doOnClick,false);document.body.attachEvent("onkeyup",this._doOnKeyUp,false);document.body.attachEvent("onunload",this._doOnUnload,false)}this._idExists=function(m){var a=false;for(var l=0;l<this.conf.id.length;l++){if(this.conf.id[l] instanceof Array){a=a||(this.conf.id[l][0]==m[0]&&this.conf.id[l][1]==m[1])}else{a=a||this.conf.id[l]==m}}return a};this._IEDisp=(window.dhx4.isIE6||document.compatMode!="CSS1Compat");this._IEHover=(window.dhx4.isIE6==true);if(this._IEHover){this._IEHoverInit=function(){this.p.onmouseover=function(){var a=event.srcElement;while(a!=this&&a._IEHover!=true){a=a.parentNode}if(a._IEHover){if(j._IEHoverTM){window.clearTimeout(j._IEHoverTM)}if(j._lastIEHover==a){return}j._IEHoverRender(a);a=null}};this.p.onmouseout=function(){if(j._IEHoverTM){window.clearTimeout(j._IEHoverTM)}j._IEHoverTM=window.setTimeout(function(){j._IEHoverRender(null)},1)};this._IEHoverRender=function(a){if(this._lastIEHover!=null){if(this._lastIEHover.className.search(/tr_hover/gi)>=0){this._lastIEHover.className=this._lastIEHover.className.replace(/\s{0,}tr_hover/gi,"");this._lastIEHover=null}}if(a!=null&&a.className.search(/tr_hover/gi)<0){a.className+=" tr_hover";j._lastIEHover=a}};this._IEHoverInited=true};this._IEHoverClear=function(){this.p.onmouseover=null;this.p.onmouseout=null;this._IEHoverInited=false}}this._IEFirstLast=(window.dhx4.isIE6||window.dhx4.isIE7||window.dhx4.isIE8);this._enableIEVFix=function(){if(window.dhx4.isIE6||window.dhx4.isIE7){var l=this.attachEvent("onHide",function(){document.getElementById(this._nodeId).style.visibility="hidden"});var a=this.attachEvent("onShow",function(){document.getElementById(this._nodeId).style.visibility="visible"});if(this._nodeObjEv==null){this._nodeObjEv=[]}this._nodeObjEv.push(l,a)}};if(typeof(window.dhtmlXToolbarObject)!="undefined"&&this.conf.toolbar!=null&&this.conf.toolbar instanceof window.dhtmlXToolbarObject&&this.conf.id!=null){if(!(this.conf.id instanceof Array)){this.conf.id=[this.conf.id]}this.skinParent=this.conf.toolbar.conf.skin;this._doOnToolbarClick=function(l){for(var a=0;a<j.conf.id.length;a++){if(l==j.conf.id[a]){if(l!=j._lastId){j.show(l);j._clearClick=true}}}};if(typeof(dhtmlXToolbarObject.prototype._getItemDim)=="undefined"){dhtmlXToolbarObject.prototype._getItemDim=function(m){var a=this.objPull[this.idPrefix+m];var l={left:window.dhx4.absLeft(a.obj),top:window.dhx4.absTop(a.obj),width:a.obj.offsetWidth+(a.arw?a.arw.offsetWidth:0),height:a.obj.offsetHeight};a=null;return l}}this.conf.toolbarEvent=this.conf.toolbar.attachEvent("onClick",this._doOnToolbarClick)}if(typeof(window.dhtmlXRibbon)!="undefined"&&this.conf.ribbon!=null&&this.conf.ribbon instanceof window.dhtmlXRibbon&&this.conf.id!=null){if(!(this.conf.id instanceof Array)){this.conf.id=[this.conf.id]}this.skinParent=this.conf.ribbon.conf.skin;this._doOnRibbonClick=function(l){for(var a=0;a<j.conf.id.length;a++){if(l==j.conf.id[a]){if(l!=j._lastId){j.show(l);j._clearClick=true}}}};if(typeof(dhtmlXRibbon.prototype._getItemDim)=="undefined"){dhtmlXRibbon.prototype._getItemDim=function(m){var a=this._items[m].base;var l={left:window.dhx4.absLeft(a),top:window.dhx4.absTop(a),width:a.offsetWidth,height:a.offsetHeight};a=null;return l}}this.conf.ribbonEvent=this.conf.ribbon.attachEvent("_showPopup",this._doOnRibbonClick)}if(typeof(window.dhtmlXForm)!="undefined"&&this.conf.form!=null&&this.conf.form instanceof window.dhtmlXForm&&this.conf.id!=null){if(!(this.conf.id instanceof Array)){this.conf.id=[this.conf.id]}if(!this.conf.mode){this.mode="right"}this.skinParent=this.conf.form.skin;if(typeof(dhtmlXForm.prototype._getItemDim)=="undefined"){dhtmlXForm.prototype._getItemDim=function(a,l){return this.doWithItem(a,"_getDim")};for(var c in {input:1,password:1,select:1,multiselect:1,checkbox:1,radio:1,button:1,combo:1,btn2state:1,calendar:1,colorpicker:1,editor:1}){if(dhtmlXForm.prototype.items[c]!=null){dhtmlXForm.prototype.items[c]._getDim=function(l){var a=l;if({ta:true,pw:true,se:true,calendar:true,colorpicker:1,editor:true}[l._type]){a=l.childNodes[l._ll?1:0].childNodes[0]}if({ch:true,ra:true,btn2state:true}[l._type]){a=l.childNodes[l._ll?1:0].childNodes[1]}if({bt:true}[l._type]){a=l.firstChild}if({combo:true}[l._type]){a=l._combo.DOMParent.firstChild}var m={left:window.dhx4.absLeft(a),top:window.dhx4.absTop(a),width:a.offsetWidth,height:a.offsetHeight};a=null;return m}}}}}if(typeof(window.dhtmlXSlider)!="undefined"&&this.conf.slider!=null&&this.conf.slider instanceof window.dhtmlXSlider){if(!this.conf.mode){this.mode="top"}this.conf.slider_tm=null;this._sliderShow=function(){if(j.conf.slider_tm){window.clearTimeout(j.conf.slider_tm)}var a=j.conf.slider._nodes.runner;var l={left:window.dhx4.absLeft(a),top:window.dhx4.absTop(a),width:a.offsetWidth,height:a.offsetHeight};j.show(l.left,l.top,l.width,l.height)};this._sliderHide=function(){j.conf.slider_tm=window.setTimeout(function(){j.hide()},200)};this.conf.slider_events=[this.conf.slider.attachEvent("_onRunnerMouseDown",this._sliderShow),this.conf.slider.attachEvent("_onRunnerMouseUp",this._sliderHide),this.conf.slider.attachEvent("onChange",this._sliderShow)]}this.setSkin(this.skinParent||this.conf.skin||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhx_popup")||"dhx_skyblue");return this}dhtmlXPopup.prototype.attachObject=function(a){return this._attachNode("object",{obj:a})};dhtmlXPopup.prototype._attach_init_object=function(a){this._nodeObj=(typeof(a.obj)=="string"?document.getElementById(a.obj):a.obj);a.obj=null;document.getElementById(this._nodeId).appendChild(this._nodeObj);this._nodeObj.style.display="";this._nodeObj.style.visibility="visible"};dhtmlXPopup.prototype.attachHTML=function(a){return this._attachNode("html",{html:a})};dhtmlXPopup.prototype._attach_init_html=function(a){document.getElementById(this._nodeId).innerHTML=a.html;this._nodeObj={text:a.html}};dhtmlXPopup.prototype.attachForm=function(c,a){return this._attachNode("form",{struct:c,width:a})};dhtmlXPopup.prototype._attach_init_form=function(c){var a=this;this._nodeObj=new dhtmlXForm(this._nodeId,c.struct);this._nodeObj.setSkin(this.conf.skin);this._nodeObj.attachEvent("_onBeforeEditorAccess",function(){a._clearClick=true});if(this.conf.editorEv!=null&&this.checkEvent(this.conf.editorEv)==false){this.conf.editorEv=null}if(dhtmlXForm.prototype.items.editor!=null&&this.conf.editorEv==null){this.conf.editorEv=this.attachEvent("onShow",function(){var l=dhtmlXForm.prototype.items.editor.editor;for(var g in l){var m=l[g].base;var j=false;while(m!=null){if(m==this.p){j=true;m=null}else{m=m.parentNode}}m=null;if(j==true){l[g].cell.conf.cells_cont=null;l[g].setSizes()}}l=null;this.detachEvent(this.conf.editorEv);this.conf.editorEv=null});if(this._nodeObjEv==null){this._nodeObjEv=[]}this._nodeObjEv.push(this.conf.editorEv)}};dhtmlXPopup.prototype.attachCalendar=function(){return this._attachNode("calendar",{})};dhtmlXPopup.prototype._attach_init_calendar=function(a){this._nodeObj=new dhtmlXCalendarObject(this._nodeId);this._nodeObj.setSkin(this.conf.skin);this._nodeObj.show()};dhtmlXPopup.prototype.attachGrid=function(c,a){return this._attachNode("grid",{width:c||400,height:a||200})};dhtmlXPopup.prototype._attach_init_grid=function(){this._nodeObj=new dhtmlXGridObject(this._nodeId);this._nodeObj.setSkin(this.conf.skin)};dhtmlXPopup.prototype.attachTree=function(g,c,a){return this._attachNode("tree",{width:g||400,height:c||200,rootId:a||0})};dhtmlXPopup.prototype._attach_init_tree=function(a){this._nodeObj=new dhtmlXTreeObject(this._nodeId,"100%","100%",(a.rootId))};dhtmlXPopup.prototype.attachLayout=function(c,a,g){return this._attachNode("layout",{width:c||400,height:a||200,pattern:g||"3L"})};dhtmlXPopup.prototype._attach_init_layout=function(a){this._nodeObj=new dhtmlXLayoutObject(this._nodeId,a.pattern,this.conf.skin)};dhtmlXPopup.prototype.attachAccordion=function(g,a,c){return this._attachNode("accordion",{width:g||400,height:a||200,conf:c||{}})};dhtmlXPopup.prototype._attach_init_accordion=function(a){a.conf.parent=this._nodeId;a.conf.skin=this.conf.skin;this._nodeObj=new dhtmlXAccordion(a.conf)};dhtmlXPopup.prototype.attachTabbar=function(g,a,c){if(typeof(c)=="string"){c={mode:c}}else{if(typeof(c)!="object"||c==null){c={}}}return this._attachNode("tabbar",{width:g||400,height:a||200,conf:c})};dhtmlXPopup.prototype._attach_init_tabbar=function(a){a.conf.parent=this._nodeId;a.conf.skin=this.conf.skin;this._nodeObj=new dhtmlXTabBar(a.conf)};dhtmlXPopup.prototype.attachSidebar=function(g,a,c){if(c==null){c={}}return this._attachNode("tabbar",{width:g||400,height:a||200,conf:c})};dhtmlXPopup.prototype._attach_init_tabbar=function(a){a.conf.parent=this._nodeId;a.conf.skin=this.conf.skin;this._nodeObj=new dhtmlXSideBar(a.conf)};dhtmlXPopup.prototype.attachEditor=function(g,a,c){return this._attachNode("editor",{width:g||400,height:a||200,conf:c||{}})};dhtmlXPopup.prototype._attach_init_editor=function(c){document.getElementById(this._nodeId).className="dhxeditor_"+this.conf.skin;c.conf.parent=this._nodeId;if(c.conf.skin==null){c.conf.skin=this.conf.skin}this._nodeObj=new dhtmlXEditor(c.conf);var a=this.attachEvent("onShow",function(){if(this._nodeObj instanceof window.dhtmlXEditor){this._nodeObj.setSizes()}});if(this._nodeObjEv==null){this._nodeObjEv=[]}this._nodeObjEv.push(a)};dhtmlXPopup.prototype.attachColorPicker=function(a){if(typeof(a)!="object"||a==null){a={}}return this._attachNode("colorpicker",{conf:a})};dhtmlXPopup.prototype._attach_init_colorpicker=function(a){a.conf.skin=this.conf.skin;a.conf.parent=this._nodeId;this._nodeObj=new dhtmlXColorPicker(a.conf)};function dhtmlXMenuObject(l,m){var j=this;this.conf={skin:(m||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxmenu")||"dhx_skyblue"),mode:"web",align:"left",is_touched:false,selected:-1,last_click:-1,fixed_pos:false,rtl:false,icons_path:"",arrow_ff_fix:(navigator.userAgent.indexOf("MSIE")>=0&&document.compatMode=="BackCompat"),live_id:window.dhx4.newId(),tags:{root:"menu",item:"item",text_ext:"itemtext",userdata:"userdata",tooltip:"tooltip",hotkey:"hotkey",href:"href"},autoload:{},hide_tm:{},top_mode:true,top_tmtime:200,v_enabled:false,v:{x1:null,x2:null,y1:null,y2:null},dir_toplv:"bottom",dir_sublv:"right",auto_overflow:false,overflow_limit:0,of_utm:null,of_utime:20,of_ustep:3,of_dtm:null,of_dtime:20,of_dstep:3,tm_sec:400,tm_handler:null,dload:false,dload_url:"",dload_icon:false,dload_params:{action:"loadMenu"},dload_pid:"parentId",tl_botmarg:1,tl_rmarg:0,tl_ofsleft:1,context:false,ctx_zoneid:false,ctx_autoshow:true,ctx_autohide:true,ctx_hideall:true,ctx_zones:{},ctx_baseid:null,selected_sub:[],opened_poly:[]};if(typeof(l)=="object"&&l!=null&&typeof(l.tagName)=="undefined"){if(l.icons_path!=null||l.icon_path!=null){this.conf.icons_path=(l.icons_path||l.icon_path)}if(l.skin!=null){this.conf.skin=l.skin}if(l.visible_area){this.conf.v_enabled=true;this.conf.v={x1:l.visible_area.x1,x2:l.visible_area.x2,y1:l.visible_area.y1,y2:l.visible_area.y2}}for(var g in {json:1,xml:1,items:1,top_text:1,align:1,open_mode:1,overflow:1,dynamic:1,dynamic_icon:1,context:1,onload:1,onclick:1,oncheckboxclick:1,onradioclick:1}){if(l[g]!=null){this.conf.autoload[g]=l[g]}}l=l.parent}if(l==null){this.base=document.body}else{var c=(typeof(l)=="string"?document.getElementById(l):l);if(c!=null){this.base=c;if(!this.base.id){this.base.id=(new Date()).valueOf()}this.base.className+=" dhtmlxMenu_"+this.conf.skin+"_Middle dir_left";this.base._autoSkinUpdate=true;if(this.base.oncontextmenu){this.base._oldContextMenuHandler=this.base.oncontextmenu}this.conf.ctx_baseid=this.base.id;this.base.onselectstart=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};this.base.oncontextmenu=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false}}else{this.base=document.body}}this.idPrefix="";this.topId="dhxWebMenuTopId";this.idPull={};this.itemPull={};this.userData={};this.radio={};this.setSkin=function(o){var q=this.conf.skin;this.conf.skin=o;switch(this.conf.skin){case"dhx_skyblue":case"dhx_web":this.conf.tl_botmarg=2;this.conf.tl_rmarg=1;this.conf.tl_ofsleft=1;break;case"dhx_terrace":this.conf.tl_botmarg=0;this.conf.tl_rmarg=0;this.conf.tl_ofsleft=0;break}if(this.base._autoSkinUpdate){this.base.className=this.base.className.replace("dhtmlxMenu_"+q+"_Middle","")+" dhtmlxMenu_"+this.conf.skin+"_Middle"}for(var n in this.idPull){this.idPull[n].className=String(this.idPull[n].className).replace(q,this.conf.skin)}};this.setSkin(this.conf.skin);this._addSubItemToSelected=function(o,n){var a=true;for(var r=0;r<this.conf.selected_sub.length;r++){if((this.conf.selected_sub[r][0]==o)&&(this.conf.selected_sub[r][1]==n)){a=false}}if(a==true){this.conf.selected_sub.push(new Array(o,n))}return a};this._removeSubItemFromSelected=function(r,o){var a=new Array();var n=false;for(var s=0;s<this.conf.selected_sub.length;s++){if((this.conf.selected_sub[s][0]==r)&&(this.conf.selected_sub[s][1]==o)){n=true}else{a[a.length]=this.conf.selected_sub[s]}}if(n==true){this.conf.selected_sub=a}return n};this._getSubItemToDeselectByPolygon=function(r){var a=new Array();for(var s=0;s<this.conf.selected_sub.length;s++){if(this.conf.selected_sub[s][1]==r){a[a.length]=this.conf.selected_sub[s][0];a=a.concat(this._getSubItemToDeselectByPolygon(this.conf.selected_sub[s][0]));var o=true;for(var n=0;n<this.conf.opened_poly.length;n++){if(this.conf.opened_poly[n]==this.conf.selected_sub[s][0]){o=false}}if(o==true){this.conf.opened_poly[this.conf.opened_poly.length]=this.conf.selected_sub[s][0]}this.conf.selected_sub[s][0]=-1;this.conf.selected_sub[s][1]=-1}}return a};this._hidePolygon=function(a){if(this.idPull["polygon_"+a]!=null){if(this.idPull["polygon_"+a]._zId!=null){window.dhx4.zim.clear(this.idPull["polygon_"+a]._zId)}if(typeof(this._menuEffect)!="undefined"&&this._menuEffect!==false){this._hidePolygonEffect("polygon_"+a)}else{if(this.idPull["polygon_"+a].style.display=="none"){return}this.idPull["polygon_"+a].style.display="none";if(this.idPull["arrowup_"+a]!=null){this.idPull["arrowup_"+a].style.display="none"}if(this.idPull["arrowdown_"+a]!=null){this.idPull["arrowdown_"+a].style.display="none"}this._updateItemComplexState(a,true,false);if(window.dhx4.isIE6&&this.idPull["polygon_"+a+"_ie6cover"]!=null){this.idPull["polygon_"+a+"_ie6cover"].style.display="none"}}a=String(a).replace(this.idPrefix,"");if(a==this.topId){a=null}this.callEvent("onHide",[a]);if(a!=null&&this.conf.skin=="dhx_terrace"&&this.itemPull[this.idPrefix+a].parent==this.idPrefix+this.topId){this._improveTerraceButton(this.idPrefix+a,true)}}};this._showPolygon=function(I,o){var N=this._countVisiblePolygonItems(I);if(N==0){return}var J="polygon_"+I;if((this.idPull[J]!=null)&&(this.idPull[I]!=null)){if(this.conf.top_mode&&this.conf.mode=="web"&&!this.conf.context){if(!this.idPull[I]._mouseOver&&o==this.conf.dir_toplv){return}}if(!this.conf.fixed_pos){this._autoDetectVisibleArea()}var K=0;var M=0;var P=null;var E=null;if(this.idPull[J]._zId==null){this.idPull[J]._zId=window.dhx4.newId()}this.idPull[J]._zInd=window.dhx4.zim.reserve(this.idPull[J]._zId);this.idPull[J].style.visibility="hidden";this.idPull[J].style.left="0px";this.idPull[J].style.top="0px";this.idPull[J].style.display="";this.idPull[J].style.zIndex=this.idPull[J]._zInd;if(this.conf.auto_overflow){if(this.idPull[J].childNodes[1].childNodes[0].offsetHeight>this.conf.v.y1+this.conf.v.y2){var D=Math.floor((this.conf.v.y2-this.conf.v.y1-35)/24);this.conf.overflow_limit=D}else{this.conf.overflow_limit=0;if(this.idPull["arrowup_"+I]!=null){this._removeUpArrow(String(I).replace(this.idPrefix,""))}if(this.idPull["arrowdown_"+I]!=null){this._removeDownArrow(String(I).replace(this.idPrefix,""))}}}if(this.conf.overflow_limit>0&&this.conf.overflow_limit<N){if(this.idPull["arrowup_"+I]==null){this._addUpArrow(String(I).replace(this.idPrefix,""))}if(this.idPull["arrowdown_"+I]==null){this._addDownArrow(String(I).replace(this.idPrefix,""))}P=this.idPull["arrowup_"+I];P.style.display="none";E=this.idPull["arrowdown_"+I];E.style.display="none"}if(this.conf.overflow_limit>0){if(this.conf.overflow_limit<N){this.idPull[J].childNodes[1].style.height=24*this.conf.overflow_limit+"px";P.style.width=E.style.width=this.idPull[J].childNodes[1].style.width=this.idPull[J].childNodes[1].childNodes[0].offsetWidth+"px";this.idPull[J].childNodes[1].scrollTop=0;P.style.display="";K=P.offsetHeight;E.style.display="";M=E.offsetHeight}else{this.idPull[J].childNodes[1].style.height="";this.idPull[J].childNodes[1].style.width=""}}if(this.itemPull[I]!=null){var A="polygon_"+this.itemPull[I]["parent"]}else{if(this.conf.context){var A=this.idPull[this.idPrefix+this.topId]}}var a=(this.idPull[I].tagName!=null?window.dhx4.absLeft(this.idPull[I]):this.idPull[I][0]);var O=(this.idPull[I].tagName!=null?window.dhx4.absTop(this.idPull[I]):this.idPull[I][1]);var n=(this.idPull[I].tagName!=null?this.idPull[I].offsetWidth:0);var q=(this.idPull[I].tagName!=null?this.idPull[I].offsetHeight:0);var v=0;var u=0;var C=this.idPull[J].offsetWidth;var L=this.idPull[J].childNodes[1].offsetHeight+K+M;if(o=="bottom"){if(this.conf.rtl){v=a+(n!=null?n:0)-C}else{if(this.conf.align=="right"){v=a+n-C}else{v=a-1+(o==this.conf.dir_toplv?this.conf.tl_rmarg:0)}}u=O-1+q+this.conf.tl_botmarg}if(o=="right"){v=a+n-1;u=O+2}if(o=="left"){v=a-this.idPull[J].offsetWidth+2;u=O+2}if(o=="top"){v=a-1;u=O-L+2}if(this.conf.fixed_pos){var H=65536;var F=65536}else{var H=(this.conf.v.x2!=null?this.conf.v.x2:0);var F=(this.conf.v.y2!=null?this.conf.v.y2:0);if(H==0){if(window.innerWidth){H=window.innerWidth;F=window.innerHeight}else{H=document.body.offsetWidth;F=document.body.scrollHeight}}}if(v+C>H&&!this.conf.rtl){v=a-C+2}if(v<this.conf.v.x1&&this.conf.rtl){v=a+n-2}if(v<0){v=0}if(u+L>F&&this.conf.v.y2!=null){u=Math.max(O+q-L+2,(this.conf.v_enabled?this.conf.v.y1+2:2));if(this.conf.context&&this.idPrefix+this.topId==I&&E!=null){u=u-2}if(this.itemPull[I]!=null&&!this.conf.context){if(this.itemPull[I]["parent"]==this.idPrefix+this.topId){u=u-this.base.offsetHeight}}}this.idPull[J].style.left=v+"px";this.idPull[J].style.top=u+"px";if(typeof(this._menuEffect)!="undefined"&&this._menuEffect!==false){this._showPolygonEffect(J)}else{this.idPull[J].style.visibility="";if(this.conf.overflow_limit>0&&this.conf.overflow_limit<N){this.idPull[J].childNodes[1].scrollTop=0;this._checkArrowsState(I)}if(window.dhx4.isIE6){var s=J+"_ie6cover";if(this.idPull[s]==null){var r=document.createElement("IFRAME");r.className="dhtmlxMenu_IE6CoverFix_"+this.conf.skin;r.frameBorder=0;r.setAttribute("src","javascript:false;");document.body.insertBefore(r,document.body.firstChild);this.idPull[s]=r}this.idPull[s].style.left=v+"px";this.idPull[s].style.top=u+"px";this.idPull[s].style.width=this.idPull[J].offsetWidth+"px";this.idPull[s].style.height=this.idPull[J].offsetHeight+"px";this.idPull[s].style.zIndex=this.idPull[J].style.zIndex-1;this.idPull[s].style.display=""}}I=String(I).replace(this.idPrefix,"");if(I==this.topId){I=null}this.callEvent("onShow",[I]);if(I!=null&&this.conf.skin=="dhx_terrace"&&this.itemPull[this.idPrefix+I].parent==this.idPrefix+this.topId){this._improveTerraceButton(this.idPrefix+I,false)}}};this._redistribSubLevelSelection=function(s,r){while(this.conf.opened_poly.length>0){this.conf.opened_poly.pop()}var a=this._getSubItemToDeselectByPolygon(r);this._removeSubItemFromSelected(-1,-1);for(var n=0;n<a.length;n++){if((this.idPull[a[n]]!=null)&&(a[n]!=s)){if(this.itemPull[a[n]]["state"]=="enabled"){this.idPull[a[n]].className="sub_item"}}}for(var n=0;n<this.conf.opened_poly.length;n++){if(this.conf.opened_poly[n]!=r){this._hidePolygon(this.conf.opened_poly[n])}}if(this.itemPull[s]["state"]=="enabled"){this.idPull[s].className="sub_item_selected";if(this.itemPull[s]["complex"]&&this.conf.dload&&(this.itemPull[s]["loaded"]=="no")){if(this.conf.dload_icon==true){this._updateLoaderIcon(s,true)}this.itemPull[s].loaded="get";var o=s.replace(this.idPrefix,"");this._dhxdataload.onBeforeXLS=function(){var u={params:{}};u.params[this.conf.dload_pid]=o;for(var q in this.conf.dload_params){u.params[q]=this.conf.dload_params[q]}return u};this.loadStruct(this.conf.dload_url)}if(this.itemPull[s]["complex"]||(this.conf.dload&&(this.itemPull[s]["loaded"]=="yes"))){if((this.itemPull[s]["complex"])&&(this.idPull["polygon_"+s]!=null)){this._updateItemComplexState(s,true,true);this._showPolygon(s,this.conf.dir_sublv)}}this._addSubItemToSelected(s,r);this.conf.selected=s}};this._doOnClick=function(n,x,r){this.conf.last_click=n;if(this.itemPull[this.idPrefix+n]["href_link"]!=null&&this.itemPull[this.idPrefix+n].state=="enabled"){var s=document.createElement("FORM");var v=String(this.itemPull[this.idPrefix+n]["href_link"]).split("?");s.action=v[0];if(v[1]!=null){var o=String(v[1]).split("&");for(var a=0;a<o.length;a++){var w=String(o[a]).split("=");var u=document.createElement("INPUT");u.type="hidden";u.name=(w[0]||"");u.value=(w[1]||"");s.appendChild(u)}}if(this.itemPull[this.idPrefix+n]["href_target"]!=null){s.target=this.itemPull[this.idPrefix+n]["href_target"]}s.style.display="none";document.body.appendChild(s);s.submit();if(s!=null){document.body.removeChild(s);s=null}return}if(x.charAt(0)=="c"){return}if(x.charAt(1)=="d"){return}if(x.charAt(2)=="s"){return}if(this.checkEvent("onClick")){this.callEvent("onClick",[n,this.conf.ctx_zoneid,r])}else{if((x.charAt(1)=="d")||(this.conf.mode=="win"&&x.charAt(2)=="t")){return}}if(this.conf.context&&this._isContextMenuVisible()&&this.conf.ctx_autohide){this._hideContextMenu()}else{if(this._clearAndHide){this._clearAndHide()}}};this._doOnTouchMenu=function(a){if(this.conf.is_touched==false){this.conf.is_touched=true;if(this.checkEvent("onTouch")){this.callEvent("onTouch",[a])}}};this._searchMenuNode=function(o,s){var a=new Array();for(var r=0;r<s.length;r++){if(typeof(s[r])=="object"){if(s[r].length==5){if(typeof(s[r][0])!="object"){if((s[r][0].replace(this.idPrefix,"")==o)&&(r==0)){a=s}}}var n=this._searchMenuNode(o,s[r]);if(n.length>0){a=n}}}return a};this._getMenuNodes=function(q){var n=new Array;for(var o in this.itemPull){if(this.itemPull[o]["parent"]==q){n[n.length]=o}}return n};this._genStr=function(a){var n="";var r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var o=0;o<a;o++){n+=r.charAt(Math.round(Math.random()*(r.length-1)))}return n};this.getItemType=function(a){a=this.idPrefix+a;if(this.itemPull[a]==null){return null}return this.itemPull[a]["type"]};this.forEachItem=function(o){for(var n in this.itemPull){o(String(n).replace(this.idPrefix,""))}};this._clearAndHide=function(){j.conf.selected=-1;j.conf.last_click=-1;while(j.conf.opened_poly.length>0){j.conf.opened_poly.pop()}for(var a=0;a<j.conf.selected_sub.length;a++){var n=j.conf.selected_sub[a][0];if(j.idPull[n]!=null){if(j.itemPull[n]["state"]=="enabled"){if(j.idPull[n].className=="sub_item_selected"){j.idPull[n].className="sub_item"}if(j.idPull[n].className=="dhtmlxMenu_"+j.conf.skin+"_TopLevel_Item_Selected"){if(j.itemPull[n]["cssNormal"]!=null){j.idPull[n].className=j.itemPull[n]["cssNormal"]}else{j.idPull[n].className="dhtmlxMenu_"+j.conf.skin+"_TopLevel_Item_Normal"}}}}j._hidePolygon(n)}j.conf.is_touched=false;if(j.conf.context&&j.conf.ctx_hideall){j._hidePolygon(j.idPrefix+j.topId)}};this._showSubLevelItem=function(n,a){if(document.getElementById("arrow_"+this.idPrefix+n)!=null){document.getElementById("arrow_"+this.idPrefix+n).style.display=(a?"none":"")}if(document.getElementById("image_"+this.idPrefix+n)!=null){document.getElementById("image_"+this.idPrefix+n).style.display=(a?"none":"")}if(document.getElementById(this.idPrefix+n)!=null){document.getElementById(this.idPrefix+n).style.display=(a?"":"none")}};this._hideSubLevelItem=function(a){this._showSubLevelItem(a,true)};this.idPrefix=this._genStr(12)+"_";this._bodyClick=function(a){a=a||event;if(a.button==2||(window.dhx4.isOpera&&a.ctrlKey==true)){return}if(j.conf.context){if(j.conf.ctx_autohide&&(!window.dhx4.isOpera||(j._isContextMenuVisible()&&window.dhx4.isOpera))){j._hideContextMenu()}}else{if(j._clearAndHide){j._clearAndHide()}}};this._bodyContext=function(o){o=o||event;var n=String((o.srcElement||o.target).className);if(n.search("dhtmlxMenu")!=-1&&n.search("SubLevelArea")!=-1){return}var a=true;var q=o.target||o.srcElement;while(q!=null){if(q.id!=null){if(j.isContextZone(q.id)){a=false}}if(q==document.body){a=false}q=q.parentNode}if(a){j.hideContextMenu()}};if(typeof(window.addEventListener)!="undefined"){window.addEventListener("click",this._bodyClick,false);window.addEventListener("contextmenu",this._bodyContext,false)}else{document.body.attachEvent("onclick",this._bodyClick);document.body.attachEvent("oncontextmenu",this._bodyContext)}this.unload=function(){window.dhx4._eventable(this,"clear");dhtmlXMenuObject.prototype.liveInst[this.conf.live_id]=null;try{delete dhtmlXMenuObject.prototype.liveInst[this.conf.live_id]}catch(o){}this.conf.live_id=null;if(typeof(window.addEventListener)=="function"){window.removeEventListener("click",this._bodyClick,false);window.removeEventListener("contextmenu",this._bodyContext,false)}else{document.body.detachEvent("onclick",this._bodyClick);document.body.detachEvent("oncontextmenu",this._bodyContext)}this._bodyClick=null;this._bodyContext=null;this.removeItem(this.idPrefix+this.topId,true);this.itemPull=null;this.idPull=null;if(this.conf.context){for(var n in this.conf.ctx_zones){this.removeContextZone(n)}}if(this.cont!=null){this.cont.className="";this.cont.parentNode.removeChild(this.cont);this.cont=null}if(this.base!=null){if(!this.conf.context){this.base.className=""}if(!this.conf.context){this.base.oncontextmenu=(this.base._oldContextMenuHandler||null)}this.base.onselectstart=null;this.base=null}for(var n in this){this[n]=null}j=null};dhtmlXMenuObject.prototype.liveInst[this.conf.live_id]=this;window.dhx4._enableDataLoading(this,"_initObj","_xmlToJson",this.conf.tags.root,{struct:true});window.dhx4._eventable(this);if(window.dhx4.s2b(this.conf.autoload.context)==true){this.renderAsContextMenu()}if(this.conf.autoload.dynamic!=null){this.enableDynamicLoading(this.conf.autoload.dynamic,window.dhx4.s2b(this.conf.autoload.dynamic_icon))}else{if(this.conf.autoload.items!=null){this.loadStruct(this.conf.autoload.items,this.conf.autoload.onload)}else{if(this.conf.autoload.json!=null){this.loadStruct(this.conf.autoload.json,this.conf.autoload.onload)}else{if(this.conf.autoload.xml!=null){this.loadStruct(this.conf.autoload.xml,this.conf.autoload.onload)}}}}for(var g in {onclick:1,oncheckboxclick:1,onradioclick:1}){if(this.conf.autoload[g]!=null){if(typeof(this.conf.autoload[g])=="function"){this.attachEvent(g,this.conf.autoload[g])}else{if(typeof(window[this.conf.autoload[g]])=="function"){this.attachEvent(g,window[this.conf.autoload[g]])}}}}if(this.conf.autoload.top_text!=null){this.setTopText(this.conf.autoload.top_text)}if(this.conf.autoload.align!=null){this.setAlign(this.conf.autoload.align)}if(this.conf.autoload.open_mode!=null){this.setOpenMode(this.conf.autoload.open_mode)}if(this.conf.autoload.overflow!=null){this.setOverflowHeight(this.conf.autoload.overflow)}for(var g in this.conf.autoload){this.conf.autoload[g]=null;delete this.conf.autoload[g]}this.conf.autoload=null;return this}dhtmlXMenuObject.prototype._init=function(){if(this._isInited==true){return}if(this.conf.dload){this._dhxdataload.onBeforeXLS=function(){var g={params:{}};for(var c in this.conf.dload_params){g.params[c]=this.conf.dload_params[c]}return g};this.loadStruct(this.conf.dload_url)}else{this._initTopLevelMenu();this._isInited=true}};dhtmlXMenuObject.prototype._countVisiblePolygonItems=function(m){var j=0;for(var c in this.itemPull){var g=this.itemPull[c]["parent"];var l=this.itemPull[c]["type"];if(this.idPull[c]!=null){if(g==m&&(l=="item"||l=="radio"||l=="checkbox")&&this.idPull[c].style.display!="none"){j++}}}return j};dhtmlXMenuObject.prototype._redefineComplexState=function(c){if(this.idPrefix+this.topId==c){return}if((this.idPull["polygon_"+c]!=null)&&(this.idPull[c]!=null)){var a=this._countVisiblePolygonItems(c);if((a>0)&&(!this.itemPull[c]["complex"])){this._updateItemComplexState(c,true,false)}if((a==0)&&(this.itemPull[c]["complex"])){this._updateItemComplexState(c,false,false)}}};dhtmlXMenuObject.prototype._updateItemComplexState=function(l,g,j){if((!this.conf.context)&&(this._getItemLevelType(l.replace(this.idPrefix,""))=="TopLevel")){this.itemPull[l]["complex"]=g;return}if((this.idPull[l]==null)||(this.itemPull[l]==null)){return}this.itemPull[l]["complex"]=g;if(l==this.idPrefix+this.topId){return}var a=null;var c=this.idPull[l].childNodes[this.conf.rtl?0:2];if(c.childNodes[0]){if(String(c.childNodes[0].className).search("complex_arrow")===0){a=c.childNodes[0]}}if(this.itemPull[l]["complex"]){if(a==null){a=document.createElement("DIV");a.className="complex_arrow";a.id="arrow_"+l;while(c.childNodes.length>0){c.removeChild(c.childNodes[0])}c.appendChild(a)}if(this.conf.dload&&(this.itemPull[l].loaded=="get")&&this.conf.dload_icon){if(a.className!="complex_arrow_loading"){a.className="complex_arrow_loading"}}else{a.className="complex_arrow"}return}if((!this.itemPull[l]["complex"])&&(a!=null)){c.removeChild(a);if(this.itemPull[l]["hotkey_backup"]!=null&&this.setHotKey){this.setHotKey(l.replace(this.idPrefix,""),this.itemPull[l]["hotkey_backup"])}}};dhtmlXMenuObject.prototype._getItemLevelType=function(a){return(this.itemPull[this.idPrefix+a]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea")};dhtmlXMenuObject.prototype.setIconsPath=function(a){this.conf.icons_path=a};dhtmlXMenuObject.prototype._updateItemImage=function(g,j){g=this.idPrefix+g;var o=this.itemPull[g]["type"];if(o=="checkbox"||o=="radio"){return}var l=(this.itemPull[g]["parent"]==this.idPrefix+this.topId&&!this.conf.context);var m=null;if(l){for(var a=0;a<this.idPull[g].childNodes.length;a++){try{if(this.idPull[g].childNodes[a].className=="dhtmlxMenu_TopLevel_Item_Icon"){m=this.idPull[g].childNodes[a]}}catch(n){}}}else{try{var m=this.idPull[g].childNodes[this.conf.rtl?2:0].childNodes[0]}catch(n){}if(!(m!=null&&typeof(m.className)!="undefined"&&m.className=="sub_icon")){m=null}}var s=this.itemPull[g][(this.itemPull[g]["state"]=="enabled"?"imgen":"imgdis")];if(s.length>0){if(m!=null){m.src=this.conf.icons_path+s}else{if(l){var m=document.createElement("IMG");m.className="dhtmlxMenu_TopLevel_Item_Icon";m.src=this.conf.icons_path+s;m.border="0";m.id="image_"+g;if(!this.conf.rtl&&this.idPull[g].childNodes.length>0){this.idPull[g].insertBefore(m,this.idPull[g].childNodes[0])}else{this.idPull[g].appendChild(m)}}else{var m=document.createElement("IMG");m.className="sub_icon";m.src=this.conf.icons_path+s;m.border="0";m.id="image_"+g;var r=this.idPull[g].childNodes[this.conf.rtl?2:0];while(r.childNodes.length>0){r.removeChild(r.childNodes[0])}r.appendChild(m)}}}else{if(m!=null){var c=m.parentNode;c.removeChild(m);c.innerHTML="&nbsp;";c=m=null}}};dhtmlXMenuObject.prototype._getAllParents=function(m){var g=new Array();for(var c in this.itemPull){if(this.itemPull[c]["parent"]==m){g[g.length]=this.itemPull[c]["id"];if(this.itemPull[c]["complex"]){var j=this._getAllParents(this.itemPull[c]["id"]);for(var l=0;l<j.length;l++){g[g.length]=j[l]}}}}return g};dhtmlXMenuObject.prototype._autoDetectVisibleArea=function(){if(this.conf.v_enabled){return}var a=window.dhx4.screenDim();this.conf.v.x1=a.left;this.conf.v.x2=a.right;this.conf.v.y1=a.top;this.conf.v.y2=a.bottom};dhtmlXMenuObject.prototype.getItemPosition=function(l){l=this.idPrefix+l;var j=-1;if(this.itemPull[l]==null){return j}var a=this.itemPull[l]["parent"];var g=(this.idPull["polygon_"+a]!=null?this.idPull["polygon_"+a].tbd:this.cont);for(var c=0;c<g.childNodes.length;c++){if(g.childNodes[c]==this.idPull["separator_"+l]||g.childNodes[c]==this.idPull[l]){j=c}}return j};dhtmlXMenuObject.prototype.setItemPosition=function(n,m){n=this.idPrefix+n;if(this.idPull[n]==null){return}var c=(this.itemPull[n]["parent"]==this.idPrefix+this.topId);var a=this.idPull[n];var j=this.getItemPosition(n.replace(this.idPrefix,""));var g=this.itemPull[n]["parent"];var l=(this.idPull["polygon_"+g]!=null?this.idPull["polygon_"+g].tbd:this.cont);l.removeChild(l.childNodes[j]);if(m<0){m=0}if(c&&m<1){m=1}if(m<l.childNodes.length){l.insertBefore(a,l.childNodes[m])}else{l.appendChild(a)}};dhtmlXMenuObject.prototype.getParentId=function(a){a=this.idPrefix+a;if(this.itemPull[a]==null){return null}return((this.itemPull[a]["parent"]!=null?this.itemPull[a]["parent"]:this.topId).replace(this.idPrefix,""))};dhtmlXMenuObject.prototype.hide=function(){this._clearAndHide()};dhtmlXMenuObject.prototype.clearAll=function(){this.removeItem(this.idPrefix+this.topId,true);this._isInited=false;this.idPrefix=this._genStr(12)+"_";this.itemPull={}};if(typeof(dhtmlXMenuObject.prototype.liveInst)=="undefined"){dhtmlXMenuObject.prototype.liveInst={}}dhtmlXMenuObject.prototype._redistribTopLevelSelection=function(j,c){var a=this._getSubItemToDeselectByPolygon("parent");this._removeSubItemFromSelected(-1,-1);for(var g=0;g<a.length;g++){if(a[g]!=j){this._hidePolygon(a[g])}if((this.idPull[a[g]]!=null)&&(a[g]!=j)){this.idPull[a[g]].className=this.idPull[a[g]].className.replace(/Selected/g,"Normal")}}if(this.itemPull[this.idPrefix+j]["state"]=="enabled"){this.idPull[this.idPrefix+j].className="dhtmlxMenu_"+this.conf.skin+"_TopLevel_Item_Selected";this._addSubItemToSelected(this.idPrefix+j,"parent");this.conf.selected=(this.conf.mode=="win"?(this.conf.selected!=-1?j:this.conf.selected):j);if((this.itemPull[this.idPrefix+j]["complex"])&&(this.conf.selected!=-1)){this._showPolygon(this.idPrefix+j,this.conf.dir_toplv)}}};dhtmlXMenuObject.prototype._initTopLevelMenu=function(){this.conf.dir_toplv="bottom";this.conf.dir_sublv=(this.conf.rtl?"left":"right");if(this.conf.context){this.idPull[this.idPrefix+this.topId]=new Array(0,0);this._addSubMenuPolygon(this.idPrefix+this.topId,this.idPrefix+this.topId)}else{var a=this._getMenuNodes(this.idPrefix+this.topId);for(var c=0;c<a.length;c++){if(this.itemPull[a[c]]["type"]=="item"){this._renderToplevelItem(a[c],null)}if(this.itemPull[a[c]]["type"]=="separator"){this._renderSeparator(a[c],null)}}}};dhtmlXMenuObject.prototype._renderToplevelItem=function(o,n){var l=this;var a=document.createElement("DIV");a.id=o;if(this.itemPull[o]["state"]=="enabled"&&this.itemPull[o]["cssNormal"]!=null){a.className=this.itemPull[o]["cssNormal"]}else{a.className="dhtmlxMenu_"+this.conf.skin+"_TopLevel_Item_"+(this.itemPull[o]["state"]=="enabled"?"Normal":"Disabled")}if(this.itemPull[o]["title"]!=""){var j=document.createElement("DIV");j.className="top_level_text";j.innerHTML=this.itemPull[o]["title"];a.appendChild(j)}if(this.itemPull[o]["tip"].length>0){a.title=this.itemPull[o]["tip"]}if((this.itemPull[o]["imgen"]!="")||(this.itemPull[o]["imgdis"]!="")){var g=this.itemPull[o][(this.itemPull[o]["state"]=="enabled")?"imgen":"imgdis"];if(g){var c=document.createElement("IMG");c.border="0";c.id="image_"+o;c.src=this.conf.icons_path+g;c.className="dhtmlxMenu_TopLevel_Item_Icon";if(a.childNodes.length>0&&!this.conf.rtl){a.insertBefore(c,a.childNodes[0])}else{a.appendChild(c)}}}a.onselectstart=function(m){m=m||event;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}return false};a.oncontextmenu=function(m){m=m||event;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}return false};if(!this.cont){this.cont=document.createElement("DIV");this.cont.dir="ltr";this.cont.className=(this.conf.align=="right"?"align_right":"align_left");this.base.appendChild(this.cont)}if(n!=null){n++;if(n<0){n=0}if(n>this.cont.childNodes.length-1){n=null}}if(n!=null){this.cont.insertBefore(a,this.cont.childNodes[n])}else{this.cont.appendChild(a)}this.idPull[a.id]=a;if(this.itemPull[o]["complex"]&&(!this.conf.dload)){this._addSubMenuPolygon(this.itemPull[o]["id"],this.itemPull[o]["id"])}a.onmouseover=function(){if(l.conf.mode=="web"){window.clearTimeout(l.conf.tm_handler)}var m=l._getSubItemToDeselectByPolygon("parent");l._removeSubItemFromSelected(-1,-1);for(var s=0;s<m.length;s++){if(m[s]!=this.id){l._hidePolygon(m[s])}if((l.idPull[m[s]]!=null)&&(m[s]!=this.id)){if(l.itemPull[m[s]]["cssNormal"]!=null){l.idPull[m[s]].className=l.itemPull[m[s]]["cssNormal"]}else{if(l.idPull[m[s]].className=="sub_item_selected"){l.idPull[m[s]].className="sub_item"}l.idPull[m[s]].className=l.idPull[m[s]].className.replace(/Selected/g,"Normal")}}}if(l.itemPull[this.id]["state"]=="enabled"){this.className="dhtmlxMenu_"+l.conf.skin+"_TopLevel_Item_Selected";l._addSubItemToSelected(this.id,"parent");l.conf.selected=(l.conf.mode=="win"?(l.conf.selected!=-1?this.id:l.conf.selected):this.id);if(l.conf.dload){if(l.itemPull[this.id].loaded=="no"){this._dynLoadTM=new Date().getTime();l.itemPull[this.id].loaded="get";var u=this.id.replace(l.idPrefix,"");l._dhxdataload.onBeforeXLS=function(){var v={params:{}};v.params[this.conf.dload_pid]=u;for(var q in this.conf.dload_params){v.params[q]=this.conf.dload_params[q]}return v};l.loadStruct(l.conf.dload_url)}if(l.conf.top_mode&&l.conf.mode=="web"&&!l.conf.context){this._mouseOver=true}}if((!l.conf.dload)||(l.conf.dload&&(!l.itemPull[this.id]["loaded"]||l.itemPull[this.id]["loaded"]=="yes"))){if((l.itemPull[this.id]["complex"])&&(l.conf.selected!=-1)){if(l.conf.top_mode&&l.conf.mode=="web"&&!l.conf.context){this._mouseOver=true;var r=this.id;this._menuOpenTM=window.setTimeout(function(){l._showPolygon(r,l.conf.dir_toplv)},l.conf.top_tmtime)}else{l._showPolygon(this.id,l.conf.dir_toplv)}}}}l._doOnTouchMenu(this.id.replace(l.idPrefix,""))};a.onmouseout=function(){if(!((l.itemPull[this.id]["complex"])&&(l.conf.selected!=-1))&&(l.itemPull[this.id]["state"]=="enabled")){if(l.itemPull[this.id]["cssNormal"]!=null){a.className=l.itemPull[this.id]["cssNormal"]}else{a.className="dhtmlxMenu_"+l.conf.skin+"_TopLevel_Item_Normal"}}if(l.conf.mode=="web"){window.clearTimeout(l.conf.tm_handler);l.conf.tm_handler=window.setTimeout(function(){l._clearAndHide()},l.conf.tm_sec,"JavaScript")}if(l.conf.top_mode&&l.conf.mode=="web"&&!l.conf.context){this._mouseOver=false;window.clearTimeout(this._menuOpenTM)}};a.onclick=function(u){if(l.conf.mode=="web"){window.clearTimeout(l.conf.tm_handler)}if(l.conf.mode!="web"&&l.itemPull[this.id]["state"]=="disabled"){return}u=u||event;u.cancelBubble=true;if(u.preventDefault){u.preventDefault()}else{u.returnValue=false}if(l.conf.mode=="win"){if(l.itemPull[this.id]["complex"]){if(l.conf.selected==this.id){l.conf.selected=-1;var r=false}else{l.conf.selected=this.id;var r=true}if(r){l._showPolygon(this.id,l.conf.dir_toplv)}else{l._hidePolygon(this.id)}}}var m=(l.itemPull[this.id]["complex"]?"c":"-");var v=(l.itemPull[this.id]["state"]!="enabled"?"d":"-");var q={ctrl:u.ctrlKey,alt:u.altKey,shift:u.shiftKey};l._doOnClick(this.id.replace(l.idPrefix,""),m+v+"t",q);return false};if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXMenuObject.prototype._addSubMenuPolygon=function(n,m){var c=this._renderSublevelPolygon(n,m);var a=this._getMenuNodes(m);for(g=0;g<a.length;g++){if(this.itemPull[a[g]]["type"]=="separator"){this._renderSeparator(a[g],null)}else{this._renderSublevelItem(a[g],null)}}if(n==m){var l="topLevel"}else{var l="subLevel"}for(var g=0;g<a.length;g++){if(this.itemPull[a[g]]["complex"]){this._addSubMenuPolygon(n,this.itemPull[a[g]]["id"])}}};dhtmlXMenuObject.prototype._renderSublevelPolygon=function(l,j){var c=document.createElement("DIV");c.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_Polygon "+(this.conf.rtl?"dir_right":"");c.dir="ltr";c.oncontextmenu=function(m){m=m||event;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}m.cancelBubble=true;return false};c.id="polygon_"+j;c.onclick=function(m){m=m||event;m.cancelBubble=true};c.style.display="none";document.body.insertBefore(c,document.body.firstChild);c.innerHTML='<div style="position:relative;"></div><div style="position: relative; overflow:hidden;"></div><div style="position:relative;"></div>';var g=document.createElement("TABLE");g.className="dhtmlxMebu_SubLevelArea_Tbl";g.cellSpacing=0;g.cellPadding=0;g.border=0;var a=document.createElement("TBODY");g.appendChild(a);c.childNodes[1].appendChild(g);c.tbl=g;c.tbd=a;this.idPull[c.id]=c;if(this.sxDacProc!=null){this.idPull["sxDac_"+j]=new this.sxDacProc(c,c.className);if(window.dhx4.isIE){this.idPull["sxDac_"+j]._setSpeed(this.dacSpeedIE);this.idPull["sxDac_"+j]._setCustomCycle(this.dacCyclesIE)}else{this.idPull["sxDac_"+j]._setSpeed(this.dacSpeed);this.idPull["sxDac_"+j]._setCustomCycle(this.dacCycles)}}return c};dhtmlXMenuObject.prototype._renderSublevelItem=function(a,r){var o=this;var q=document.createElement("TR");q.className=(this.itemPull[a]["state"]=="enabled"?"sub_item":"sub_item_dis");var n=document.createElement("TD");n.className="sub_item_icon";var s=this.itemPull[a][(this.itemPull[a]["state"]=="enabled"?"imgen":"imgdis")];if(s!=""){var w=this.itemPull[a]["type"];if(w=="checkbox"||w=="radio"){var l=document.createElement("DIV");l.id="image_"+this.itemPull[a]["id"];l.className="sub_icon "+s;n.appendChild(l)}if(!(w=="checkbox"||w=="radio")){var l=document.createElement("IMG");l.id="image_"+this.itemPull[a]["id"];l.className="sub_icon";l.src=this.conf.icons_path+s;n.appendChild(l)}}else{n.innerHTML="&nbsp;"}var m=document.createElement("TD");m.className="sub_item_text";if(this.itemPull[a]["title"]!=""){var v=document.createElement("DIV");v.className="sub_item_text";v.innerHTML=this.itemPull[a]["title"];m.appendChild(v)}else{m.innerHTML="&nbsp;"}var j=document.createElement("TD");j.className="sub_item_hk";if(this.itemPull[a]["complex"]){var c=document.createElement("DIV");c.className="complex_arrow";c.id="arrow_"+this.itemPull[a]["id"];j.appendChild(c)}else{if(this.itemPull[a]["hotkey"].length>0&&!this.itemPull[a]["complex"]){var g=document.createElement("DIV");g.className="sub_item_hk";g.innerHTML=this.itemPull[a]["hotkey"];j.appendChild(g)}else{j.innerHTML="&nbsp;"}}q.appendChild(this.conf.rtl?j:n);q.appendChild(m);q.appendChild(this.conf.rtl?n:j);q.id=this.itemPull[a]["id"];q.parent=this.itemPull[a]["parent"];if(this.itemPull[a]["tip"].length>0){q.title=this.itemPull[a]["tip"]}q.onselectstart=function(x){x=x||event;if(x.preventDefault){x.preventDefault()}else{x.returnValue=false}return false};q.onmouseover=function(x){if(o.conf.hide_tm[this.id]){window.clearTimeout(o.conf.hide_tm[this.id])}if(o.conf.mode=="web"){window.clearTimeout(o.conf.tm_handler)}if(!this._visible){o._redistribSubLevelSelection(this.id,this.parent)}this._visible=true};q.onmouseout=function(){if(o.conf.mode=="web"){if(o.conf.tm_handler){window.clearTimeout(o.conf.tm_handler)}o.conf.tm_handler=window.setTimeout(function(){if(o&&o._clearAndHide){o._clearAndHide()}},o.conf.tm_sec,"JavaScript")}var x=this;if(o.conf.hide_tm[this.id]){window.clearTimeout(o.conf.hide_tm[this.id])}o.conf.hide_tm[this.id]=window.setTimeout(function(){x._visible=false},50)};q.onclick=function(y){if(!o.checkEvent("onClick")&&o.itemPull[this.id]["complex"]){return}y=y||event;y.cancelBubble=true;if(y.preventDefault){y.preventDefault()}else{y.returnValue=false}tc=(o.itemPull[this.id]["complex"]?"c":"-");td=(o.itemPull[this.id]["state"]=="enabled"?"-":"d");var x={ctrl:y.ctrlKey,alt:y.altKey,shift:y.shiftKey};switch(o.itemPull[this.id]["type"]){case"checkbox":o._checkboxOnClickHandler(this.id.replace(o.idPrefix,""),tc+td+"n",x);break;case"radio":o._radioOnClickHandler(this.id.replace(o.idPrefix,""),tc+td+"n",x);break;case"item":o._doOnClick(this.id.replace(o.idPrefix,""),tc+td+"n",x);break}return false};var u=this.idPull["polygon_"+this.itemPull[a]["parent"]];if(r!=null){r++;if(r<0){r=0}if(r>u.tbd.childNodes.length-1){r=null}}if(r!=null&&u.tbd.childNodes[r]!=null){u.tbd.insertBefore(q,u.tbd.childNodes[r])}else{u.tbd.appendChild(q)}this.idPull[q.id]=q};dhtmlXMenuObject.prototype._renderSeparator=function(c,n){var a=(this.conf.context?"SubLevelArea":(this.itemPull[c]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea"));if(a=="TopLevel"&&this.conf.context){return}var l=this;if(a!="TopLevel"){var m=document.createElement("TR");m.className="sub_sep";var g=document.createElement("TD");g.colSpan="3";m.appendChild(g)}var j=document.createElement("DIV");j.id="separator_"+c;j.className=(a=="TopLevel"?"top_sep":"sub_sep");j.onselectstart=function(r){r=r||event;if(r.preventDefault){r.preventDefault()}else{r.returnValue=false}};j.onclick=function(s){s=s||event;s.cancelBubble=true;var r={ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey};l._doOnClick(this.id.replace("separator_"+l.idPrefix,""),"--s",r)};if(a=="TopLevel"){if(n!=null){n++;if(n<0){n=0}if(this.cont.childNodes[n]!=null){this.cont.insertBefore(j,this.cont.childNodes[n])}else{this.cont.appendChild(j)}}else{var q=this.cont.childNodes[this.cont.childNodes.length-1];if(String(q).search("TopLevel_Text")==-1){this.cont.appendChild(j)}else{this.cont.insertBefore(j,q)}}this.idPull[j.id]=j}else{var o=this.idPull["polygon_"+this.itemPull[c]["parent"]];if(n!=null){n++;if(n<0){n=0}if(n>o.tbd.childNodes.length-1){n=null}}if(n!=null&&o.tbd.childNodes[n]!=null){o.tbd.insertBefore(m,o.tbd.childNodes[n])}else{o.tbd.appendChild(m)}g.appendChild(j);this.idPull[j.id]=m}};dhtmlXMenuObject.prototype.addNewSeparator=function(a,c){c=this.idPrefix+(c!=null?c:this._genStr(24));var g=this.idPrefix+this.getParentId(a);this._addItemIntoGlobalStrorage(c,g,"","separator",false,"","");this._renderSeparator(c,this.getItemPosition(a))};dhtmlXMenuObject.prototype._initObj=function(u,v,n){if(!(u instanceof Array)){n=u.parentId;if(n!=null&&String(n).indexOf(this.idPrefix)!==0){n=this.idPrefix+String(n)}u=u.items}for(var g=0;g<u.length;g++){if(typeof(u[g].id)=="undefined"||u[g].id==null){u[g].id=this._genStr(24)}if(u[g].text==null){u[g].text=""}if(String(u[g].id).indexOf(this.idPrefix)!==0){u[g].id=this.idPrefix+String(u[g].id)}var j={type:"item",tip:"",hotkey:"",state:"enabled",imgen:"",imgdis:""};for(var w in j){if(typeof(u[g][w])=="undefined"){u[g][w]=j[w]}}if(u[g].imgen==""&&u[g].img!=null){u[g].imgen=u[g].img}if(u[g].imgdis==""&&u[g].img_disabled!=null){u[g].imgdis=u[g].img_disabled}if(u[g].title==null&&u[g].text!=null){u[g].title=u[g].text}if(u[g].href!=null){if(u[g].href.link!=null){u[g].href_link=u[g].href.link}if(u[g].href.target!=null){u[g].href_target=u[g].href.target}}if(u[g].userdata!=null){for(var w in u[g].userdata){this.userData[u[g].id+"_"+w]=u[g].userdata[w]}}if(typeof(u[g].enabled)!="undefined"&&window.dhx4.s2b(u[g].enabled)==false){u[g].state="disabled"}else{if(typeof(u[g].disabled)!="undefined"&&window.dhx4.s2b(u[g].disabled)==true){u[g].state="disabled"}}if(typeof(u[g].parent)=="undefined"){u[g].parent=(n!=null?n:this.idPrefix+this.topId)}if(u[g].type=="checkbox"){u[g].checked=window.dhx4.s2b(u[g].checked);u[g].imgen=u[g].imgdis="chbx_"+(u[g].checked?"1":"0")}if(u[g].type=="radio"){u[g].checked=window.dhx4.s2b(u[g].checked);u[g].imgen=u[g].imgdis="rdbt_"+(u[g].checked?"1":"0");if(typeof(u[g].group)=="undefined"||u[g].group==null){u[g].group=this._genStr(24)}if(this.radio[u[g].group]==null){this.radio[u[g].group]=[]}this.radio[u[g].group].push(u[g].id)}this.itemPull[u[g].id]=u[g];if(u[g].items!=null&&u[g].items.length>0){this.itemPull[u[g].id].complex=true;this._initObj(u[g].items,true,u[g].id)}else{if(this.conf.dload&&u[g].complex==true){this.itemPull[u[g].id].loaded="no"}}this.itemPull[u[g].id].items=null}if(v!==true){if(this.conf.dload==true){if(n==null){this._initTopLevelMenu()}else{this._addSubMenuPolygon(n,n);if(this.conf.selected==n){var s=(this.itemPull[n].parent==this.idPrefix+this.topId);var c=(s&&!this.conf.context?this.conf.dir_toplv:this.conf.dir_sublv);var l=false;if(s&&this.conf.top_mode&&this.conf.mode=="web"&&!this.conf.context){var x=this.idPull[n];if(x._mouseOver==true){var m=this.conf.top_tmtime-(new Date().getTime()-x._dynLoadTM);if(m>1){var r=n;var o=this;x._menuOpenTM=window.setTimeout(function(){o._showPolygon(r,c);o=r=null},m);l=true}}}if(!l){this._showPolygon(n,c)}}this.itemPull[n].loaded="yes";if(this.conf.dload_icon==true){this._updateLoaderIcon(n,false)}}}else{this._init()}}};dhtmlXMenuObject.prototype._xmlToJson=function(l,j){var n=[];if(j==null){var o=l.getElementsByTagName(this.conf.tags.root);if(o==null||(o!=null&&o.length==0)){return{items:[]}}o=o[0]}else{o=l}if(o.getAttribute("parentId")!=null){j=this.idPrefix+o.getAttribute("parentId")}for(var c=0;c<o.childNodes.length;c++){if(typeof(o.childNodes[c].tagName)!="undefined"&&String(o.childNodes[c].tagName).toLowerCase()==this.conf.tags.item){var a=o.childNodes[c];var v={id:this.idPrefix+(a.getAttribute("id")||this._genStr(24)),title:a.getAttribute("text")||"",imgen:a.getAttribute("img")||"",imgdis:a.getAttribute("imgdis")||"",tip:"",hotkey:"",type:a.getAttribute("type")||"item"};if(a.getAttribute("cssNormal")!=null){v.cssNormal=a.getAttribute("cssNormal")}if(v.type=="checkbox"){v.checked=a.getAttribute("checked")}if(v.type=="radio"){v.checked=a.getAttribute("checked");v.group=a.getAttribute("group")}v.state="enabled";if(a.getAttribute("enabled")!=null&&window.dhx4.s2b(a.getAttribute("enabled"))==false){v.state="disabled"}else{if(a.getAttribute("disabled")!=null&&window.dhx4.s2b(a.getAttribute("disabled"))==true){v.state="disabled"}}v.parent=(j!=null?j:this.idPrefix+this.topId);if(this.conf.dload){v.complex=(a.getAttribute("complex")!=null);if(v.complex){v.loaded="no"}}else{var g=this._xmlToJson(a,v.id);v.items=g.items;v.complex=(v.items.length>0)}for(var s=0;s<a.childNodes.length;s++){if(typeof(a.childNodes[s].tagName)!="undefined"){var u=String(a.childNodes[s].tagName||"").toLowerCase();if(u==this.conf.tags.userdata){var m=a.childNodes[s];if(m.getAttribute("name")!=null){this.userData[v.id+"_"+m.getAttribute("name")]=(m.firstChild!=null&&m.firstChild.nodeValue!=null?m.firstChild.nodeValue:"")}}if(u==this.conf.tags.text_ext){v.title=a.childNodes[s].firstChild.nodeValue}if(u==this.conf.tags.tooltip){v.tip=a.childNodes[s].firstChild.nodeValue}if(u==this.conf.tags.hotkey){v.hotkey=a.childNodes[s].firstChild.nodeValue}if(u==this.conf.tags.href&&v.type=="item"){v.href_link=a.childNodes[s].firstChild.nodeValue;if(a.childNodes[s].getAttribute("target")!=null){v.href_target=a.childNodes[s].getAttribute("target")}}}}n.push(v)}}var a={parentId:j,items:n};return a};dhtmlXMenuObject.prototype.enableDynamicLoading=function(a,c){this.conf.dload=true;this.conf.dload_url=a;this.conf.dload_sign=(String(this.conf.dload_url).search(/\?/)==-1?"?":"&");this.conf.dload_icon=c;this._init()};dhtmlXMenuObject.prototype._updateLoaderIcon=function(j,g){if(this.idPull[j]==null){return}if(String(this.idPull[j].className).search("TopLevel_Item")>=0){return}var c=(this.conf.rtl?0:2);if(!this.idPull[j].childNodes[c]){return}if(!this.idPull[j].childNodes[c].childNodes[0]){return}var a=this.idPull[j].childNodes[c].childNodes[0];if(String(a.className).search("complex_arrow")===0){a.className="complex_arrow"+(g?"_loading":"")}};dhtmlXMenuObject.prototype.addNewSibling=function(j,l,a,c,g,o){var n=this.idPrefix+(l!=null?l:this._genStr(24));var m=this.idPrefix+(j!=null?this.getParentId(j):this.topId);this._addItemIntoGlobalStrorage(n,m,a,"item",c,g,o);if((m==this.idPrefix+this.topId)&&(!this.conf.context)){this._renderToplevelItem(n,this.getItemPosition(j))}else{this._renderSublevelItem(n,this.getItemPosition(j))}};dhtmlXMenuObject.prototype.addNewChild=function(n,m,j,a,c,g,l){if(n==null){if(this.conf.context){n=this.topId}else{this.addNewSibling(n,j,a,c,g,l);if(m!=null){this.setItemPosition(j,m)}return}}j=this.idPrefix+(j!=null?j:this._genStr(24));if(this.setHotKey){this.setHotKey(n,"")}n=this.idPrefix+n;this._addItemIntoGlobalStrorage(j,n,a,"item",c,g,l);if(this.idPull["polygon_"+n]==null){this._renderSublevelPolygon(n,n)}this._renderSublevelItem(j,m-1);this._redefineComplexState(n)};dhtmlXMenuObject.prototype.removeItem=function(j,m,l){if(!m){j=this.idPrefix+j}var n=null;if(j!=this.idPrefix+this.topId){if(this.itemPull[j]==null){return}if(this.idPull["polygon_"+j]&&this.idPull["polygon_"+j]._tmShow){window.clearTimeout(this.idPull["polygon_"+j]._tmShow)}var v=this.itemPull[j]["type"];if(v=="separator"){var u=this.idPull["separator_"+j];if(this.itemPull[j]["parent"]==this.idPrefix+this.topId){u.onclick=null;u.onselectstart=null;u.id=null;u.parentNode.removeChild(u)}else{u.childNodes[0].childNodes[0].onclick=null;u.childNodes[0].childNodes[0].onselectstart=null;u.childNodes[0].childNodes[0].id=null;u.childNodes[0].removeChild(u.childNodes[0].childNodes[0]);u.removeChild(u.childNodes[0]);u.parentNode.removeChild(u)}this.idPull["separator_"+j]=null;this.itemPull[j]=null;delete this.idPull["separator_"+j];delete this.itemPull[j];u=null}else{n=this.itemPull[j]["parent"];var u=this.idPull[j];u.onclick=null;u.oncontextmenu=null;u.onmouseover=null;u.onmouseout=null;u.onselectstart=null;u.id=null;while(u.childNodes.length>0){u.removeChild(u.childNodes[0])}u.parentNode.removeChild(u);this.idPull[j]=null;this.itemPull[j]=null;delete this.idPull[j];delete this.itemPull[j];u=null}v=null}for(var r in this.itemPull){if(this.itemPull[r]["parent"]==j){this.removeItem(r,true,true)}}var s=new Array(j);if(n!=null&&!l){if(this.idPull["polygon_"+n]!=null){if(this.idPull["polygon_"+n].tbd.childNodes.length==0){s.push(n);this._updateItemComplexState(n,false,false)}}}for(var c=0;c<s.length;c++){if(this.idPull["polygon_"+s[c]]){var g=this.idPull["polygon_"+s[c]];g.onclick=null;g.oncontextmenu=null;g.tbl.removeChild(g.tbd);g.tbd=null;g.childNodes[1].removeChild(g.tbl);g.tbl=null;g.id=null;g.parentNode.removeChild(g);g=null;if(window.dhx4.isIE6){var o="polygon_"+s[c]+"_ie6cover";if(this.idPull[o]!=null){document.body.removeChild(this.idPull[o]);delete this.idPull[o]}}if(this.idPull["arrowup_"+j]!=null&&this._removeArrow){this._removeArrow("arrowup_"+j)}if(this.idPull["arrowdown_"+j]!=null&&this._removeArrow){this._removeArrow("arrowdown_"+j)}this.idPull["polygon_"+s[c]]=null;delete this.idPull["polygon_"+s[c]]}}s=null;if(this.conf.skin=="dhx_terrace"&&arguments.length==1){this._improveTerraceSkin()}};dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage=function(o,a,g,n,j,c,m){var l={id:o,title:g,imgen:(c!=null?c:""),imgdis:(m!=null?m:""),type:n,state:(j==true?"disabled":"enabled"),parent:a,complex:false,hotkey:"",tip:""};this.itemPull[l.id]=l};dhtmlXMenuObject.prototype.renderAsContextMenu=function(){this.conf.context=true;if(this.base._autoSkinUpdate==true){this.base.className=this.base.className.replace("dhtmlxMenu_"+this.conf.skin+"_Middle","");this.base._autoSkinUpdate=false}if(this.conf.ctx_baseid!=null){this.addContextZone(this.conf.ctx_baseid)}};dhtmlXMenuObject.prototype.addContextZone=function(c){if(c==document.body){c="document.body."+this.idPrefix;var j=document.body}else{if(typeof(c)=="string"){var j=document.getElementById(c)}else{var j=c}}var m=false;for(var g in this.conf.ctx_zones){m=m||(g==c)||(this.conf.ctx_zones[g]==j)}if(m==true){return false}this.conf.ctx_zones[c]=j;var l=this;if(window.dhx4.isOpera){this.operaContext=function(a){l._doOnContextMenuOpera(a,l)};j.addEventListener("mouseup",this.operaContext,false)}else{if(j.oncontextmenu!=null&&!j._oldContextMenuHandler){j._oldContextMenuHandler=j.oncontextmenu}j.oncontextmenu=function(n){for(var a in dhtmlXMenuObject.prototype.liveInst){if(a!=l.conf.live_id){if(dhtmlXMenuObject.prototype.liveInst[a].context){dhtmlXMenuObject.prototype.liveInst[a]._hideContextMenu()}}}n=n||event;n.cancelBubble=true;if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}l._doOnContextBeforeCall(n,this);return false}}};dhtmlXMenuObject.prototype._doOnContextMenuOpera=function(g,a){for(var c in dhtmlXMenuObject.prototype.liveInst){if(c!=a.conf.live_id){if(dhtmlXMenuObject.prototype.liveInst[c].context){dhtmlXMenuObject.prototype.liveInst[c]._hideContextMenu()}}}g.cancelBubble=true;if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}if(g.button==0&&g.ctrlKey==true){a._doOnContextBeforeCall(g,this)}return false};dhtmlXMenuObject.prototype.removeContextZone=function(a){if(!this.isContextZone(a)){return false}if(a==document.body){a="document.body."+this.idPrefix}var c=this.conf.ctx_zones[a];if(window.dhx4.isOpera){c.removeEventListener("mouseup",this.operaContext,false)}else{c.oncontextmenu=(c._oldContextMenuHandler!=null?c._oldContextMenuHandler:null);c._oldContextMenuHandler=null}try{this.conf.ctx_zones[a]=null;delete this.conf.ctx_zones[a]}catch(g){}return true};dhtmlXMenuObject.prototype.isContextZone=function(a){if(a==document.body&&this.conf.ctx_zones["document.body."+this.idPrefix]!=null){return true}var c=false;if(this.conf.ctx_zones[a]!=null){if(this.conf.ctx_zones[a]==document.getElementById(a)){c=true}}return c};dhtmlXMenuObject.prototype._isContextMenuVisible=function(){if(this.idPull["polygon_"+this.idPrefix+this.topId]==null){return false}return(this.idPull["polygon_"+this.idPrefix+this.topId].style.display=="")};dhtmlXMenuObject.prototype._showContextMenu=function(c,g,a){this._clearAndHide();if(this.idPull["polygon_"+this.idPrefix+this.topId]==null){return false}window.clearTimeout(this.conf.tm_handler);this.idPull[this.idPrefix+this.topId]=new Array(c,g);this._showPolygon(this.idPrefix+this.topId,"bottom");this.callEvent("onContextMenu",[a])};dhtmlXMenuObject.prototype._hideContextMenu=function(){if(this.idPull["polygon_"+this.idPrefix+this.topId]==null){return false}this._clearAndHide();this._hidePolygon(this.idPrefix+this.topId)};dhtmlXMenuObject.prototype._doOnContextBeforeCall=function(l,n){this.conf.ctx_zoneid=n.id;this._clearAndHide();this._hideContextMenu();var j=(l.srcElement||l.target);var c=(window.dhx4.isIE||window.dhx4.isOpera||window.dhx4.isKHTML?l.offsetX:l.layerX);var a=(window.dhx4.isIE||window.dhx4.isOpera||window.dhx4.isKHTML?l.offsetY:l.layerY);var m=window.dhx4.absLeft(j)+c;var g=window.dhx4.absTop(j)+a;if(this.checkEvent("onBeforeContextMenu")){if(this.callEvent("onBeforeContextMenu",[n.id,l])){if(this.conf.ctx_autoshow){this._showContextMenu(m,g,n.id);this.callEvent("onAfterContextMenu",[n.id,l])}}}else{if(this.conf.ctx_autoshow){this._showContextMenu(m,g,n.id);this.callEvent("onAfterContextMenu",[n.id])}}};dhtmlXMenuObject.prototype.showContextMenu=function(a,c){this._showContextMenu(a,c,false)};dhtmlXMenuObject.prototype.hideContextMenu=function(){this._hideContextMenu()};dhtmlXMenuObject.prototype.setAutoShowMode=function(a){this.conf.ctx_autoshow=(a==true?true:false)};dhtmlXMenuObject.prototype.setAutoHideMode=function(a){this.conf.ctx_autohide=(a==true?true:false)};dhtmlXMenuObject.prototype.setContextMenuHideAllMode=function(a){this.conf.ctx_hideall=(a==true?true:false)};dhtmlXMenuObject.prototype.getContextMenuHideAllMode=function(){return this.conf.ctx_hideall};dhtmlXMenuObject.prototype._improveTerraceSkin=function(){for(var g in this.itemPull){if(this.itemPull[g].parent==this.idPrefix+this.topId&&this.idPull[g]!=null){var l=false;var j=false;if(this.idPull[g].parentNode.firstChild==this.idPull[g]){l=true}if(this.idPull[g].parentNode.lastChild==this.idPull[g]){j=true}for(var c in this.itemPull){if(this.itemPull[c].type=="separator"&&this.itemPull[c].parent==this.idPrefix+this.topId){if(this.idPull[g].nextSibling==this.idPull["separator_"+c]){j=true}if(this.idPull[g].previousSibling==this.idPull["separator_"+c]){l=true}}}this.idPull[g].style.borderLeftWidth=(l?"1px":"0px");this.idPull[g].style.borderTopLeftRadius=this.idPull[g].style.borderBottomLeftRadius=(l?"3px":"0px");this.idPull[g].style.borderTopRightRadius=this.idPull[g].style.borderBottomRightRadius=(j?"3px":"0px");this.idPull[g]._bl=l;this.idPull[g]._br=j}}};dhtmlXMenuObject.prototype._improveTerraceButton=function(c,a){if(a){this.idPull[c].style.borderBottomLeftRadius=(this.idPull[c]._bl?"3px":"0px");this.idPull[c].style.borderBottomRightRadius=(this.idPull[c]._br?"3px":"0px")}else{this.idPull[c].style.borderBottomLeftRadius="0px";this.idPull[c].style.borderBottomRightRadius="0px"}};if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype._createNode_menu=function(l,c,j,a,g){if(typeof(g)!="undefined"){l=g}else{l=document.createElement("DIV");l.className="dhx_cell_menu_"+(this.conf.borders?"def":"no_borders");l.appendChild(document.createElement("DIV"))}this.cell.insertBefore(l,this.cell.childNodes[this.conf.idx.toolbar||this.conf.idx.cont]);this.conf.ofs_nodes.t.menu=true;this._updateIdx();return l};dhtmlXCellObject.prototype.attachMenu=function(a){if(this.dataNodes.menu){return}this.callEvent("_onBeforeContentAttach",["menu"]);if(typeof(a)=="undefined"){a={}}if(typeof(a.skin)=="undefined"){a.skin=this.conf.skin}a.parent=this._attachObject("menu").firstChild;this.dataNodes.menu=new dhtmlXMenuObject(a);this._adjustCont(this._idd);a.parent=null;a=null;this.callEvent("_onContentAttach",[]);return this.dataNodes.menu};dhtmlXCellObject.prototype.detachMenu=function(){if(!this.dataNodes.menu){return}this.dataNodes.menu.unload();this.dataNodes.menu=null;delete this.dataNodes.menu;this._detachObject("menu")};dhtmlXCellObject.prototype.showMenu=function(){this._mtbShowHide("menu","")};dhtmlXCellObject.prototype.hideMenu=function(){this._mtbShowHide("menu","none")};dhtmlXCellObject.prototype.getAttachedMenu=function(){return this.dataNodes.menu}}dhtmlXMenuObject.prototype.setItemEnabled=function(a){this._changeItemState(a,"enabled",this._getItemLevelType(a))};dhtmlXMenuObject.prototype.setItemDisabled=function(a){this._changeItemState(a,"disabled",this._getItemLevelType(a))};dhtmlXMenuObject.prototype.isItemEnabled=function(a){return(this.itemPull[this.idPrefix+a]!=null?(this.itemPull[this.idPrefix+a]["state"]=="enabled"):false)};dhtmlXMenuObject.prototype._changeItemState=function(m,l,c){var g=false;var a=this.idPrefix+m;if((this.itemPull[a]!=null)&&(this.idPull[a]!=null)){if(this.itemPull[a]["state"]!=l){this.itemPull[a]["state"]=l;if(this.itemPull[a]["parent"]==this.idPrefix+this.topId&&!this.conf.context){this.idPull[a].className="dhtmlxMenu_"+this.conf.skin+"_TopLevel_Item_"+(this.itemPull[a]["state"]=="enabled"?"Normal":"Disabled")}else{this.idPull[a].className="sub_item"+(this.itemPull[a]["state"]=="enabled"?"":"_dis")}this._updateItemComplexState(this.idPrefix+m,this.itemPull[this.idPrefix+m]["complex"],false);this._updateItemImage(m,c);if((this.idPrefix+this.conf.last_click==a)&&(c!="TopLevel")){this._redistribSubLevelSelection(a,this.itemPull[a]["parent"])}if(c=="TopLevel"&&!this.conf.context){}}}return g};dhtmlXMenuObject.prototype.getItemText=function(a){return(this.itemPull[this.idPrefix+a]!=null?this.itemPull[this.idPrefix+a]["title"]:"")};dhtmlXMenuObject.prototype.setItemText=function(l,j){l=this.idPrefix+l;if((this.itemPull[l]!=null)&&(this.idPull[l]!=null)){this._clearAndHide();this.itemPull[l]["title"]=j;if(this.itemPull[l]["parent"]==this.idPrefix+this.topId&&!this.conf.context){var g=null;for(var a=0;a<this.idPull[l].childNodes.length;a++){try{if(this.idPull[l].childNodes[a].className=="top_level_text"){g=this.idPull[l].childNodes[a]}}catch(c){}}if(String(this.itemPull[l]["title"]).length==""||this.itemPull[l]["title"]==null){if(g!=null){g.parentNode.removeChild(g)}}else{if(!g){g=document.createElement("DIV");g.className="top_level_text";if(this.conf.rtl&&this.idPull[l].childNodes.length>0){this.idPull[l].insertBefore(g,this.idPull[l].childNodes[0])}else{this.idPull[l].appendChild(g)}}g.innerHTML=this.itemPull[l]["title"]}}else{var g=null;for(var a=0;a<this.idPull[l].childNodes[1].childNodes.length;a++){if(String(this.idPull[l].childNodes[1].childNodes[a].className||"")=="sub_item_text"){g=this.idPull[l].childNodes[1].childNodes[a]}}if(String(this.itemPull[l]["title"]).length==""||this.itemPull[l]["title"]==null){if(g){g.parentNode.removeChild(g);g=null;this.idPull[l].childNodes[1].innerHTML="&nbsp;"}}else{if(!g){g=document.createElement("DIV");g.className="sub_item_text";this.idPull[l].childNodes[1].innerHTML="";this.idPull[l].childNodes[1].appendChild(g)}g.innerHTML=this.itemPull[l]["title"]}}}};dhtmlXMenuObject.prototype.loadFromHTML=function(g,m,j){var c=this.conf.tags.item;this.conf.tags.item="div";var l=(typeof(g)=="string"?document.getElementById(g):g);var a=this._xmlToJson(l,this.idPrefix+this.topId);this._initObj(a);this.conf.tags.item=c;if(m){l.parentNode.removeChild(l)}l=objOd=null;if(onload!=null){if(typeof(j)=="function"){j()}else{if(typeof(window[j])=="function"){window[j]()}}}};dhtmlXMenuObject.prototype.hideItem=function(a){this._changeItemVisible(a,false)};dhtmlXMenuObject.prototype.showItem=function(a){this._changeItemVisible(a,true)};dhtmlXMenuObject.prototype.isItemHidden=function(c){var a=null;if(this.idPull[this.idPrefix+c]!=null){a=(this.idPull[this.idPrefix+c].style.display=="none")}return a};dhtmlXMenuObject.prototype._changeItemVisible=function(g,c){var a=this.idPrefix+g;if(this.itemPull[a]==null){return}if(this.itemPull[a]["type"]=="separator"){a="separator_"+a}if(this.idPull[a]==null){return}this.idPull[a].style.display=(c?"":"none");this._redefineComplexState(this.itemPull[this.idPrefix+g]["parent"])};dhtmlXMenuObject.prototype.setUserData=function(g,a,c){this.userData[this.idPrefix+g+"_"+a]=c};dhtmlXMenuObject.prototype.getUserData=function(c,a){return(this.userData[this.idPrefix+c+"_"+a]!=null?this.userData[this.idPrefix+c+"_"+a]:null)};dhtmlXMenuObject.prototype.setOpenMode=function(a){this.conf.mode=(a=="win"?"win":"web")};dhtmlXMenuObject.prototype.setWebModeTimeout=function(a){this.conf.tm_sec=(!isNaN(a)?a:400)};dhtmlXMenuObject.prototype.getItemImage=function(c){var a=new Array(null,null);c=this.idPrefix+c;if(this.itemPull[c]["type"]=="item"){a[0]=this.itemPull[c]["imgen"];a[1]=this.itemPull[c]["imgdis"]}return a};dhtmlXMenuObject.prototype.setItemImage=function(g,a,c){if(this.itemPull[this.idPrefix+g]["type"]!="item"){return}this.itemPull[this.idPrefix+g]["imgen"]=a;this.itemPull[this.idPrefix+g]["imgdis"]=c;this._updateItemImage(g,this._getItemLevelType(g))};dhtmlXMenuObject.prototype.clearItemImage=function(a){this.setItemImage(a,"","")};dhtmlXMenuObject.prototype.setVisibleArea=function(c,a,j,g){this.conf.v_enabled=true;this.conf.v.x1=c;this.conf.v.x2=a;this.conf.v.y1=j;this.conf.v.y2=g};dhtmlXMenuObject.prototype.setTooltip=function(c,a){c=this.idPrefix+c;if(!(this.itemPull[c]!=null&&this.idPull[c]!=null)){return}this.idPull[c].title=(a.length>0?a:null);this.itemPull[c]["tip"]=a};dhtmlXMenuObject.prototype.getTooltip=function(a){if(this.itemPull[this.idPrefix+a]==null){return null}return this.itemPull[this.idPrefix+a]["tip"]};dhtmlXMenuObject.prototype.setTopText=function(a){if(this.conf.context){return}if(this._topText==null){this._topText=document.createElement("DIV");this._topText.className="dhtmlxMenu_TopLevel_Text_"+(this.conf.rtl?"left":(this.conf.align=="left"?"right":"left"));this.base.appendChild(this._topText)}this._topText.innerHTML=a};dhtmlXMenuObject.prototype.setAlign=function(a){if(this.conf.align==a){return}if(a=="left"||a=="right"){this.conf.align=a;if(this.cont){this.cont.className=(this.conf.align=="right"?"align_right":"align_left")}if(this._topText!=null){this._topText.className="dhtmlxMenu_TopLevel_Text_"+(this.conf.align=="left"?"right":"left")}}};dhtmlXMenuObject.prototype.setHref=function(g,a,c){if(this.itemPull[this.idPrefix+g]==null){return}this.itemPull[this.idPrefix+g]["href_link"]=a;if(c!=null){this.itemPull[this.idPrefix+g]["href_target"]=c}};dhtmlXMenuObject.prototype.clearHref=function(a){if(this.itemPull[this.idPrefix+a]==null){return}delete this.itemPull[this.idPrefix+a]["href_link"];delete this.itemPull[this.idPrefix+a]["href_target"]};dhtmlXMenuObject.prototype.getCircuit=function(c){var a=new Array(c);while(this.getParentId(c)!=this.topId){c=this.getParentId(c);a[a.length]=c}return a.reverse()};dhtmlXMenuObject.prototype._getCheckboxState=function(a){if(this.itemPull[this.idPrefix+a]==null){return null}return this.itemPull[this.idPrefix+a]["checked"]};dhtmlXMenuObject.prototype._setCheckboxState=function(c,a){if(this.itemPull[this.idPrefix+c]==null){return}this.itemPull[this.idPrefix+c]["checked"]=a};dhtmlXMenuObject.prototype._updateCheckboxImage=function(c){if(this.idPull[this.idPrefix+c]==null){return}this.itemPull[this.idPrefix+c]["imgen"]="chbx_"+(this._getCheckboxState(c)?"1":"0");this.itemPull[this.idPrefix+c]["imgdis"]=this.itemPull[this.idPrefix+c]["imgen"];try{this.idPull[this.idPrefix+c].childNodes[(this.conf.rtl?2:0)].childNodes[0].className="sub_icon "+this.itemPull[this.idPrefix+c]["imgen"]}catch(a){}};dhtmlXMenuObject.prototype._checkboxOnClickHandler=function(j,a,c){if(a.charAt(1)=="d"){return}if(this.itemPull[this.idPrefix+j]==null){return}var g=this._getCheckboxState(j);if(this.checkEvent("onCheckboxClick")){if(this.callEvent("onCheckboxClick",[j,g,this.conf.ctx_zoneid,c])){this.setCheckboxState(j,!g)}}else{this.setCheckboxState(j,!g)}if(this.checkEvent("onClick")){this.callEvent("onClick",[j])}};dhtmlXMenuObject.prototype.setCheckboxState=function(c,a){this._setCheckboxState(c,a);this._updateCheckboxImage(c)};dhtmlXMenuObject.prototype.getCheckboxState=function(a){return this._getCheckboxState(a)};dhtmlXMenuObject.prototype.addCheckbox=function(o,j,q,r,s,a,l){if(this.conf.context&&j==this.topId){}else{if(this.itemPull[this.idPrefix+j]==null){return}if(o=="child"&&this.itemPull[this.idPrefix+j]["type"]!="item"){return}}var m="chbx_"+(a?"1":"0");var g=m;if(o=="sibling"){var c=this.idPrefix+(r!=null?r:this._genStr(24));var n=this.idPrefix+this.getParentId(j);this._addItemIntoGlobalStrorage(c,n,s,"checkbox",l,m,g);this.itemPull[c]["checked"]=a;this._renderSublevelItem(c,this.getItemPosition(j))}else{var c=this.idPrefix+(r!=null?r:this._genStr(24));var n=this.idPrefix+j;this._addItemIntoGlobalStrorage(c,n,s,"checkbox",l,m,g);this.itemPull[c]["checked"]=a;if(this.idPull["polygon_"+n]==null){this._renderSublevelPolygon(n,n)}this._renderSublevelItem(c,q-1);this._redefineComplexState(n)}};dhtmlXMenuObject.prototype.setHotKey=function(m,a){m=this.idPrefix+m;if(!(this.itemPull[m]!=null&&this.idPull[m]!=null)){return}if(this.itemPull[m]["parent"]==this.idPrefix+this.topId&&!this.conf.context){return}if(this.itemPull[m]["complex"]){return}var c=this.itemPull[m]["type"];if(!(c=="item"||c=="checkbox"||c=="radio")){return}var l=null;try{if(this.idPull[m].childNodes[this.conf.rtl?0:2].childNodes[0].className=="sub_item_hk"){l=this.idPull[m].childNodes[this.conf.rtl?0:2].childNodes[0]}}catch(j){}if(a.length==0){this.itemPull[m]["hotkey_backup"]=this.itemPull[m]["hotkey"];this.itemPull[m]["hotkey"]="";if(l!=null){l.parentNode.removeChild(l)}}else{this.itemPull[m]["hotkey"]=a;this.itemPull[m]["hotkey_backup"]=null;if(l==null){l=document.createElement("DIV");l.className="sub_item_hk";var g=this.idPull[m].childNodes[this.conf.rtl?0:2];while(g.childNodes.length>0){g.removeChild(g.childNodes[0])}g.appendChild(l)}l.innerHTML=a}};dhtmlXMenuObject.prototype.getHotKey=function(a){if(this.itemPull[this.idPrefix+a]==null){return null}return this.itemPull[this.idPrefix+a]["hotkey"]};dhtmlXMenuObject.prototype._clearAllSelectedSubItemsInPolygon=function(a){var g=this._getSubItemToDeselectByPolygon(a);for(var c=0;c<this.conf.opened_poly.length;c++){if(this.conf.opened_poly[c]!=a){this._hidePolygon(this.conf.opened_poly[c])}}for(var c=0;c<g.length;c++){if(this.idPull[g[c]]!=null&&this.itemPull[g[c]]["state"]=="enabled"){this.idPull[g[c]].className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_Item_Normal"}}};dhtmlXMenuObject.prototype._checkArrowsState=function(j){var c=this.idPull["polygon_"+j].childNodes[1];var g=this.idPull["arrowup_"+j];var a=this.idPull["arrowdown_"+j];if(c.scrollTop==0){g.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_ArrowUp_Disabled"}else{g.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_ArrowUp"+(g.over?"_Over":"")}if(c.scrollTop+c.offsetHeight<c.scrollHeight){a.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_ArrowDown"+(a.over?"_Over":"")}else{a.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_ArrowDown_Disabled"}c=g=a=null};dhtmlXMenuObject.prototype._addUpArrow=function(j){var c=this;var g=document.createElement("DIV");g.pId=this.idPrefix+j;g.id="arrowup_"+this.idPrefix+j;g.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_ArrowUp";g.over=false;g.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false};g.oncontextmenu=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false};g.onmouseover=function(){if(c.conf.mode=="web"){window.clearTimeout(c.conf.tm_handler)}c._clearAllSelectedSubItemsInPolygon(this.pId);if(this.className=="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowUp_Disabled"){return}this.className="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowUp_Over";this.over=true;c._canScrollUp=true;c._doScrollUp(this.pId,true)};g.onmouseout=function(){if(c.conf.mode=="web"){window.clearTimeout(c.conf.tm_handler);c.conf.tm_handler=window.setTimeout(function(){c._clearAndHide()},c.conf.tm_sec,"JavaScript")}this.over=false;c._canScrollUp=false;if(this.className=="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowUp_Disabled"){return}this.className="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowUp";window.clearTimeout(c.conf.of_utm)};g.onclick=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}l.cancelBubble=true;return false};var a=this.idPull["polygon_"+this.idPrefix+j];a.childNodes[0].appendChild(g);this.idPull[g.id]=g;a=g=null};dhtmlXMenuObject.prototype._addDownArrow=function(j){var c=this;var g=document.createElement("DIV");g.pId=this.idPrefix+j;g.id="arrowdown_"+this.idPrefix+j;g.className="dhtmlxMenu_"+this.conf.skin+"_SubLevelArea_ArrowDown";g.over=false;g.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false};g.oncontextmenu=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false};g.onmouseover=function(){if(c.conf.mode=="web"){window.clearTimeout(c.conf.tm_handler)}c._clearAllSelectedSubItemsInPolygon(this.pId);if(this.className=="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowDown_Disabled"){return}this.className="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowDown_Over";this.over=true;c._canScrollDown=true;c._doScrollDown(this.pId,true)};g.onmouseout=function(){if(c.conf.mode=="web"){window.clearTimeout(c.conf.tm_handler);c.conf.tm_handler=window.setTimeout(function(){c._clearAndHide()},c.conf.tm_sec,"JavaScript")}this.over=false;c._canScrollDown=false;if(this.className=="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowDown_Disabled"){return}this.className="dhtmlxMenu_"+c.conf.skin+"_SubLevelArea_ArrowDown";window.clearTimeout(c.conf.of_dtm)};g.onclick=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}l.cancelBubble=true;return false};var a=this.idPull["polygon_"+this.idPrefix+j];a.childNodes[2].appendChild(g);this.idPull[g.id]=g;a=g=null};dhtmlXMenuObject.prototype._removeUpArrow=function(c){var a="arrowup_"+this.idPrefix+c;this._removeArrow(a)};dhtmlXMenuObject.prototype._removeDownArrow=function(c){var a="arrowdown_"+this.idPrefix+c;this._removeArrow(a)};dhtmlXMenuObject.prototype._removeArrow=function(a){var c=this.idPull[a];c.onselectstart=null;c.oncontextmenu=null;c.onmouseover=null;c.onmouseout=null;c.onclick=null;if(c.parentNode){c.parentNode.removeChild(c)}c=null;this.idPull[a]=null;try{delete this.idPull[a]}catch(g){}};dhtmlXMenuObject.prototype._isArrowExists=function(a){if(this.idPull["arrowup_"+a]!=null&&this.idPull["arrowdown_"+a]!=null){return true}return false};dhtmlXMenuObject.prototype._doScrollUp=function(m,j){var a=this.idPull["polygon_"+m].childNodes[1];if(this._canScrollUp&&a.scrollTop>0){var g=false;var l=a.scrollTop-this.conf.of_ustep;if(l<0){g=true;l=0}a.scrollTop=l;if(!g){var c=this;this.conf.of_utm=window.setTimeout(function(){c._doScrollUp(m,false);c=null},this.conf.of_utime)}else{j=true}}else{this._canScrollUp=false;this._checkArrowsState(m)}if(j){this._checkArrowsState(m)}};dhtmlXMenuObject.prototype._doScrollDown=function(m,j){var a=this.idPull["polygon_"+m].childNodes[1];if(this._canScrollDown&&a.scrollTop+a.offsetHeight<=a.scrollHeight){var g=false;var l=a.scrollTop+this.conf.of_dstep;if(l+a.offsetHeight>=a.scrollHeight){g=true;l=a.scrollHeight-a.offsetHeight}a.scrollTop=l;if(!g){var c=this;this.conf.of_dtm=window.setTimeout(function(){c._doScrollDown(m,false);c=null},this.conf.of_dtime)}else{j=true}}else{this._canScrollDown=false;this._checkArrowsState(m)}if(j){this._checkArrowsState(m)}};dhtmlXMenuObject.prototype._countPolygonItems=function(m){var j=0;for(var c in this.itemPull){var g=this.itemPull[c]["parent"];var l=this.itemPull[c]["type"];if(g==this.idPrefix+m&&(l=="item"||l=="radio"||l=="checkbox")){j++}}return j};dhtmlXMenuObject.prototype.setOverflowHeight=function(j){if(j==="auto"){this.conf.overflow_limit=0;this.conf.auto_overflow=true;return}if(this.conf.overflow_limit==0&&j<=0){return}this._clearAndHide();if(this.conf.overflow_limit>=0&&j>0){this.conf.overflow_limit=j;return}if(this.conf.overflow_limit>0&&j<=0){for(var g in this.itemPull){if(this._isArrowExists(g)){var c=String(g).replace(this.idPrefix,"");this._removeUpArrow(c);this._removeDownArrow(c);this.idPull["polygon_"+g].childNodes[1].style.height=""}}this.conf.overflow_limit=0;return}};dhtmlXMenuObject.prototype._getRadioImgObj=function(g){try{var a=this.idPull[this.idPrefix+g].childNodes[(this.conf.rtl?2:0)].childNodes[0]}catch(c){var a=null}return a};dhtmlXMenuObject.prototype._setRadioState=function(j,g){var c=this._getRadioImgObj(j);if(c!=null){var a=this.itemPull[this.idPrefix+j];a.checked=g;a.imgen="rdbt_"+(a.checked?"1":"0");a.imgdis=a.imgen;c.className="sub_icon "+a.imgen}};dhtmlXMenuObject.prototype._radioOnClickHandler=function(j,a,c){if(a.charAt(1)=="d"||this.itemPull[this.idPrefix+j]["group"]==null){return}var g=this.itemPull[this.idPrefix+j]["group"];if(this.checkEvent("onRadioClick")){if(this.callEvent("onRadioClick",[g,this.getRadioChecked(g),j,this.conf.ctx_zoneid,c])){this.setRadioChecked(g,j)}}else{this.setRadioChecked(g,j)}if(this.checkEvent("onClick")){this.callEvent("onClick",[j])}};dhtmlXMenuObject.prototype.getRadioChecked=function(j){var m=null;for(var g=0;g<this.radio[j].length;g++){var l=this.radio[j][g].replace(this.idPrefix,"");var a=this._getRadioImgObj(l);if(a!=null){var c=(a.className).match(/rdbt_1$/gi);if(c!=null){m=l}}}return m};dhtmlXMenuObject.prototype.setRadioChecked=function(c,j){if(this.radio[c]==null){return}for(var a=0;a<this.radio[c].length;a++){var g=this.radio[c][a].replace(this.idPrefix,"");this._setRadioState(g,(g==j))}};dhtmlXMenuObject.prototype.addRadioButton=function(q,l,r,s,u,v,a,m){if(this.conf.context&&l==this.topId){}else{if(this.itemPull[this.idPrefix+l]==null){return}if(q=="child"&&this.itemPull[this.idPrefix+l]["type"]!="item"){return}}var g=this.idPrefix+(s!=null?s:this._genStr(24));var n="rdbt_"+(a?"1":"0");var c=n;if(q=="sibling"){var o=this.idPrefix+this.getParentId(l);this._addItemIntoGlobalStrorage(g,o,u,"radio",m,n,c);this._renderSublevelItem(g,this.getItemPosition(l))}else{var o=this.idPrefix+l;this._addItemIntoGlobalStrorage(g,o,u,"radio",m,n,c);if(this.idPull["polygon_"+o]==null){this._renderSublevelPolygon(o,o)}this._renderSublevelItem(g,r-1);this._redefineComplexState(o)}var j=(v!=null?v:this._genStr(24));this.itemPull[g]["group"]=j;if(this.radio[j]==null){this.radio[j]=new Array()}this.radio[j][this.radio[j].length]=g;if(a==true){this.setRadioChecked(j,String(g).replace(this.idPrefix,""))}};dhtmlXMenuObject.prototype.serialize=function(){var a="<menu>"+this._readLevel(this.idPrefix+this.topId)+"</menu>";return a};dhtmlXMenuObject.prototype._readLevel=function(j){var l="";for(var q in this.itemPull){if(this.itemPull[q]["parent"]==j){var c="";var g="";var s="";var o=String(this.itemPull[q]["id"]).replace(this.idPrefix,"");var n="";var r=(this.itemPull[q]["title"]!=""?' text="'+this.itemPull[q]["title"]+'"':"");var m="";if(this.itemPull[q]["type"]=="item"){if(this.itemPull[q]["imgen"]!=""){c=' img="'+this.itemPull[q]["imgen"]+'"'}if(this.itemPull[q]["imgdis"]!=""){g=' imgdis="'+this.itemPull[q]["imgdis"]+'"'}if(this.itemPull[q]["hotkey"]!=""){s="<hotkey>"+this.itemPull[q]["hotkey"]+"</hotkey>"}}if(this.itemPull[q]["type"]=="separator"){n=' type="separator"'}else{if(this.itemPull[q]["state"]=="disabled"){m=' enabled="false"'}}if(this.itemPull[q]["type"]=="checkbox"){n=' type="checkbox"'+(this.itemPull[q]["checked"]?' checked="true"':"")}if(this.itemPull[q]["type"]=="radio"){n=' type="radio" group="'+this.itemPull[q]["group"]+'" '+(this.itemPull[q]["checked"]?' checked="true"':"")}l+="<item id='"+o+"'"+r+n+c+g+m+">";l+=s;if(this.itemPull[q]["complex"]){l+=this._readLevel(q)}l+="</item>"}}return l};dhtmlXMenuObject.prototype.enableEffect=function(g,l,j){this._menuEffect=(g=="opacity"||g=="slide"||g=="slide+"?g:false);this._pOpStyleIE=(navigator.userAgent.search(/MSIE\s[678]\.0/gi)>=0);for(var c in this.idPull){if(c.search(/polygon/)===0){this._pOpacityApply(c,(this._pOpStyleIE?100:1));this.idPull[c].style.height=""}}this._pOpMax=(typeof(l)=="undefined"?100:l)/(this._pOpStyleIE?1:100);this._pOpStyleName=(this._pOpStyleIE?"filter":"opacity");this._pOpStyleValue=(this._pOpStyleIE?"progid:DXImageTransform.Microsoft.Alpha(Opacity=#)":"#");this._pSlSteps=(this._pOpStyleIE?10:20);this._pSlTMTimeMax=j||50};dhtmlXMenuObject.prototype._showPolygonEffect=function(a){this._pShowHide(a,true)};dhtmlXMenuObject.prototype._hidePolygonEffect=function(a){this._pShowHide(a,false)};dhtmlXMenuObject.prototype._pOpacityApply=function(a,c){this.idPull[a].style[this._pOpStyleName]=String(this._pOpStyleValue).replace("#",c||this.idPull[a]._op)};dhtmlXMenuObject.prototype._pShowHide=function(a,c){if(!this.idPull){return}if(this.idPull[a]._tmShow!=null){if((this.idPull[a]._step_h>0&&c==true)||(this.idPull[a]._step_h<0&&c==false)){return}window.clearTimeout(this.idPull[a]._tmShow);this.idPull[a]._tmShow=null;this.idPull[a]._max_h=null}if(c==false&&(this.idPull[a].style.visibility=="hidden"||this.idPull[a].style.display=="none")){return}if(c==true&&this.idPull[a].style.display=="none"){this.idPull[a].style.visibility="hidden";this.idPull[a].style.display=""}if(this.idPull[a]._max_h==null){this.idPull[a]._max_h=parseInt(this.idPull[a].offsetHeight);this.idPull[a]._h=(c==true?0:this.idPull[a]._max_h);this.idPull[a]._step_h=Math.round(this.idPull[a]._max_h/this._pSlSteps)*(c==true?1:-1);if(this.idPull[a]._step_h==0){return}this.idPull[a]._step_tm=Math.round(this._pSlTMTimeMax/this._pSlSteps);if(this._menuEffect=="slide+"||this._menuEffect=="opacity"){this.idPull[a].op_tm=this.idPull[a]._step_tm;this.idPull[a].op_step=(this._pOpMax/this._pSlSteps)*(c==true?1:-1);if(this._pOpStyleIE){this.idPull[a].op_step=Math.round(this.idPull[a].op_step)}this.idPull[a]._op=(c==true?0:this._pOpMax);this._pOpacityApply(a)}else{this.idPull[a]._op=(this._pOpStyleIE?100:1);this._pOpacityApply(a)}if(this._menuEffect.search(/slide/)===0){this.idPull[a].style.height="0px"}this.idPull[a].style.visibility="visible"}this._pEffectSet(a,this.idPull[a]._h+this.idPull[a]._step_h)};dhtmlXMenuObject.prototype._pEffectSet=function(g,c){if(!this.idPull){return}if(this.idPull[g]._tmShow){window.clearTimeout(this.idPull[g]._tmShow)}this.idPull[g]._h=Math.max(0,Math.min(c,this.idPull[g]._max_h));if(this._menuEffect.search(/slide/)===0){this.idPull[g].style.height=this.idPull[g]._h+"px"}c+=this.idPull[g]._step_h;if(this._menuEffect=="slide+"||this._menuEffect=="opacity"){this.idPull[g]._op=Math.max(0,Math.min(this._pOpMax,this.idPull[g]._op+this.idPull[g].op_step));this._pOpacityApply(g)}if((this.idPull[g]._step_h>0&&c<=this.idPull[g]._max_h)||(this.idPull[g]._step_h<0&&c>=0)){var a=this;this.idPull[g]._tmShow=window.setTimeout(function(){a._pEffectSet(g,c)},this.idPull[g]._step_tm)}else{if(this._menuEffect.search(/slide/)===0){this.idPull[g].style.height=""}if(this.idPull[g]._step_h<0){this.idPull[g].style.visibility="hidden"}if(this._menuEffect=="slide+"||this._menuEffect=="opacity"){this.idPull[g]._op=(this.idPull[g]._step_h<0?(this._pOpStyleIE?100:1):this._pOpMax);this._pOpacityApply(g)}this.idPull[g]._tmShow=null;this.idPull[g]._h=null;this.idPull[g]._max_h=null;this.idPull[g]._step_tm=null}};function dhtmlXRibbon(j){var g=this,c,a;this.conf={type:"ribbon",icons_path:(j&&j.icons_path)?j.icons_path:"",arrows_mode:(j&&j.arrows_mode)?j.arrows_mode:null,skin:"dhx_skyblue"};this._eventHandlers={};this._base=null;this._items={};this._tabbar=null;this.childIds=[];if(typeof(j)=="string"){a=j}else{if(j&&j.tagName){a=j}else{if(j&&j.parent){if(j.parent.tagName||typeof(j.parent)=="string"){a=j.parent}}}}this._doOnHighlight0=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].mouseover)=="function"){if(g.items[m.type].mouseover(m,g,o)!=true){return false}}if(!/dhxrb_highlight0/.test(l.className)){l.className+=" dhxrb_highlight0"}};this._doOffHighlight0=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].mouseout)=="function"){if(g.items[m.type].mouseout(m,g,o)!=true){return false}}if(/dhxrb_highlight1/.test(l.className)){l.className=l.className.replace(/\s?dhxrb_highlight1/,"")}if(/dhxrb_highlight0/.test(l.className)){l.className=l.className.replace(/\s?dhxrb_highlight0/,"")}};this._doOnHighlight1=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}g.callEvent("_showPopup",[m.id]);if(g.items[m.type]&&typeof(g.items[m.type].mousedown)=="function"){if(g.items[m.type].mousedown(m,g,o)!=true){return false}}if(!/dhxrb_highlight1/.test(l.className)){l.className+=" dhxrb_highlight1"}};this._doOffHighlight1=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].mouseup)=="function"){if(g.items[m.type].mouseup(m,g,o)!=true){return false}}if(/dhxrb_highlight1/.test(l.className)){l.className=l.className.replace(/\s?dhxrb_highlight1/,"")}};this._doOnClick=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].click)=="function"){g.items[m.type].click(m,g,o)}};this._doOnFocus=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}g.callEvent("_showPopup",[m.id]);if(g.items[m.type]&&typeof(g.items[m.type].focus)=="function"){g.items[m.type].focus(m,g,o)}};this._doOnBlur=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].blur)=="function"){g.items[m.type].blur(m,g,o)}};this._doOnChange=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].change)=="function"){g.items[m.type].change(m,g,o)}};this._doOnKeydown=function(o){o=o||event;var n=o.target||o.srcElement;var l=g._findItemByNode(n);var m=g._items[l._dhx_ribbonId];if(m.conf.disable){return}if(g.items[m.type]&&typeof(g.items[m.type].keydown)=="function"){g.items[m.type].keydown(m,g,o)}};this._tabCustomApi={enable:function(o,n){var m=null,l=null;n=n||false;if(n!=true){m=g._items[this._idd];for(l in m.childIds){l=parseInt(l);g.enable(m.childIds[l])}}return g._tabOriginalApi.enable.apply(this,[o])},disable:function(o,n){var m=null,l=null;if(n!=false){m=g._items[this._idd];for(l in m.childIds){l=parseInt(l);g.disable(m.childIds[l])}}return g._tabOriginalApi.disable.apply(this,[o])},close:function(n){var m=g._items[this._idd],l;g._removeTab(m);g._tabOriginalApi.close.apply(this,[n]);for(l in g._tabOriginalApi){this[l]=null}}};this._attachEventTabbar=function(){this._tabbar.attachEvent("onSelect",function(){return g.callEvent("onSelect",arguments)});this._tabbar.attachEvent("onTabClick",function(){return g.callEvent("onTabClick",arguments)});this._tabbar.attachEvent("onTabClose",function(){return g.callEvent("onTabClose",arguments)})};if(typeof(a)=="string"){this._base=document.getElementById(a)}else{if(a&&a.tagName){this._base=a}else{this._base=document.createElement("div");this._base._dhx_remove=true;if(document.body.firstChild){document.body.insertBefore(this._base,document.body.firstChild)}else{document.body.appendChild(this._base)}}}c=dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||dhx4.skinDetect("dhtmlxribbon")||"dhx_skyblue";if(typeof(j)=="object"&&j.skin){c=j.skin}this.setSkin(c);dhx4._eventable(this);dhx4._enableDataLoading(this,"_renderData","_xmlToJson","ribbon",{struct:true});this.attachEvent("_onHeightChanged",function(){this.conf.inited=true});this._base.className+=" dhxrb_without_tabbar";this._base.innerHTML="<div class='dhxrb_background_area'></div>";if(j!=null){if(j.json){this.loadStruct(j.json,j.onload)}else{if(j.xml){this.loadStruct(j.xml,j.onload)}else{this._renderData(j)}}}this.unload=function(){var m=null,l=[];for(m in this.childIds){m=parseInt(m);l.push(this.childIds[m])}dhx4._enableDataLoading(this,null,null,null,"clear");dhx4._eventable(this,"clear");for(m in l){m=parseInt(m);if(this._items[l[m]].type=="tab"){this.tabs(l[m]).close(false)}else{this.removeItem(l[m])}}if(this._tabbar){this._tabbar.unload();this._tabbar=null}this._base.innerHTML="";if(this._base._dhx_remove){this._base.parentNode.removeChild(this._base)}else{this._base.className=this._base.className.replace(/\s?(dhtmlx|dhxrb)(\S*)/ig,"")}for(m in this){this[m]=null}g=null}}dhtmlXRibbon.prototype.setSizes=function(){if(this._tabbar!=null&&typeof(this.setSizes)=="function"){this._tabbar.setSizes()}};dhtmlXRibbon.prototype._renderData=function(c){var a=this._base.firstChild;if(c!=null){this.conf.icons_path=c.icons_path||this.conf.icons_path;if(c.tabs instanceof Array){this._base.className=this._base.className.replace(/\s?dhxrb_without_tabbar/i,"");a.className="dhxrb_with_tabbar";this._tabbar=new dhtmlXTabBar(a);this._attachEventTabbar();this._tabbar.setSkin(this.conf.skin);if(this.conf.arrows_mode!=null){this._tabbar.setArrowsMode(this.conf.arrows_mode)}this.childIds=this._appendTabs(c.tabs)}else{if(c.items instanceof Array){if(!/\s?dhxrb_without_tabbar/i.test(this._base.className)){this._base.className+=" dhxrb_without_tabbar"}if(/\s?dhxrb_background_area/i.test(a.className)){a.className="dhxrb_background_area"}a.innerHTML="<div class='dhxrb_g_area'></div>";this.childIds=this._appendBlocks(c.items,a.firstChild)}}this.callEvent("_onHeightChanged",[])}};dhtmlXRibbon.prototype._xmlToJson=function(c){var a=c.lastChild||null,j={},g=[];if(a&&a.tagName=="ribbon"){g=this._convertXmlNodeListIntoObject(a.childNodes)}if(g[0]&&g[0].type&&g[0].type.toLowerCase()=="block"){j.items=g}else{j.tabs=g}return j};dhtmlXRibbon.prototype._convertXmlNodeListIntoObject=function(c){var g,a,m=[],j;a=c.length;for(g=0;g<a;g++){j=this._covertXmlNodeToObject(c[g]);if(j){m.push(j)}}return m};dhtmlXRibbon.prototype._covertXmlNodeToObject=function(j){if(!j||!j.tagName||!(j.tagName.toLowerCase()=="item"||j.tagName.toLowerCase()=="tab")){return null}var g,a,c=j.attributes,m={};a=c.length;for(g=0;g<a;g++){switch(c[g].name){case"isbig":m.isbig=dhx4.s2b(c[g].value);break;case"state":m.state=dhx4.s2b(c[g].value);break;default:m[c[g].name]=c[g].value}}if(j.childNodes.length){if(j.getAttribute("type")=="buttonCombo"||j.getAttribute("type")=="buttonSelect"){m.data=j}else{if(j.tagName.toLowerCase()=="tab"){m.items=this._convertXmlNodeListIntoObject(j.childNodes)}else{m.list=this._convertXmlNodeListIntoObject(j.childNodes)}}}return m};dhtmlXRibbon.prototype._appendTabs=function(m){var c,a,g,j=[];a=m.length;for(c=0;c<a;c++){g=this._addTab(m[c]);if(m[c].items instanceof Array){g.childIds=this._appendBlocks(m[c].items,g.base,g)}j.push(g.id)}return j};dhtmlXRibbon.prototype._addTab=function(g){var a,j,c={conf:{active:false,text:"",width:null,position:null,disable:false},base:document.createElement("div"),type:"tab",childIds:[]};for(a in g){if(a=="items"){continue}c.conf[a]=g[a]}if(!g.id){c.id=dhx4.newId()}else{c.id=g.id}while(this._items[c.id]){c.id=dhx4.newId()}this._tabbar.addTab(c.id,c.conf.text,c.conf.width,c.conf.position,c.conf.active);c.base.className="dhxrb_g_area";c.base._dhx_ribbonId=c.id;this.tabs(c.id).attachObject(c.base);this._changeApiForTab(this.tabs(c.id));this._items[c.id]=c;return c};dhtmlXRibbon.prototype._changeApiForTab=function(c){var a;for(a in this._tabOriginalApi){this._tabOriginalApi[a]=this._tabOriginalApi[a]||c[a];c[a]=this._tabCustomApi[a]}};dhtmlXRibbon.prototype._tabOriginalApi={enable:null,disable:null,close:null};dhtmlXRibbon.prototype._appendBlocks=function(a,u,g){var n,j,o,m,r,c,s=[];g=g||null;j=a.length;for(n=0;n<j;n++){if(typeof(a[n])=="object"&&a[n].type=="block"){o=this._addBlock(a[n],u);if(a[n].list&&(a[n].list instanceof Array)){m=a[n].list;r=m.length;for(c=0;c<r;c++){this._addItem(o.id,null,null,m[c])}}if(g!=null){o.parentId=g.id}if(o.conf.disable){this.disable(o.id)}s.push(o.id)}}return s};dhtmlXRibbon.prototype._addBlock=function(m,j){var g,a,n,c;n={conf:{text:"",text_pos:"bottom",type:"block",mode:"cols",disable:false},type:"block",childIds:[],base:document.createElement("div"),contForItems:document.createElement("div"),contForText:document.createElement("div")};for(c in m){if(c=="list"||c=="type"||c=="id"){continue}n.conf[c]=m[c]}if(!m.id){n.id=dhx4.newId()}else{n.id=m.id}while(this._items[n.id]){n.id=dhx4.newId()}n.base.className="dhxrb_block_base";j.appendChild(n.base);n.contForItems.className="dhxrb_block_items";n.contForText.className="dhxrb_block_label";n.base.appendChild(n.contForItems);if(n.conf.text){n.contForText.innerHTML=n.conf.text;if(n.conf.text_pos=="top"){n.base.insertBefore(n.contForText,n.contForItems)}else{n.base.appendChild(n.contForText)}}n.base._dhx_ribbonId=n.id;this._items[n.id]=n;return n};dhtmlXRibbon.prototype._addItem=function(g,c,q,n){var l=this._items[g],a,m,s=null,o=this,j;if(n.type!="newLevel"&&!this.items[n.type]){return null}if(n.type=="newLevel"){this._addNewLevel(l)}else{if(l.type=="group"){a=document.createElement("div");a.className="dhxrb_in_group";l.base.appendChild(a)}else{if(n.isbig){a=document.createElement("div");a.className="dhxrb_big_button";l.contForItems.appendChild(a)}else{m=this._getContainerForSmallItem(l);a=document.createElement("div");a.className=(l.conf.mode=="rows")?"dhxrb_in_row":"dhxrb_3rows_button";m.appendChild(a)}}}if(a){this._attachEventForItem(a);j={icons_path:n.icons_path||this.conf.icons_path,skin:this.conf.skin};for(var r in n){j[r]=n[r]}if(!j.id){j.id=dhx4.newId()}while(this._items[j.id]){j.id=dhx4.newId()}s=(this.items[j.type]&&this.items[j.type].render)?this.items[j.type].render(a,j):null}if(s!=null){this._items[s.id]=s;s.parentId=l.id;l.childIds.push(s.id);a._dhx_ribbonId=s.id;if(j.onclick&&(typeof(j.onclick)=="function")){this._eventHandlers[s.id]=this._eventHandlers[s.id]||{};this._eventHandlers[s.id]["onclick"]=j.onclick}s.callEvent=function(){o.callEvent.apply(o,arguments)};s._callHandler=function(){o._callHandler.apply(o,arguments)};if(this.items[j.type]&&typeof(this.items[j.type].callAfterInit)=="function"){this.items[j.type].callAfterInit.apply(this,[s])}}return s};dhtmlXRibbon.prototype._callHandler=function(c,a){if(this._eventHandlers[c]&&this._eventHandlers[c].onclick){this._eventHandlers[c].onclick.apply(this,a)}};dhtmlXRibbon.prototype.items={};dhtmlXRibbon.prototype.items.button={render:function(c,a){var g,j;j={base:c,id:a.id,type:a.type,conf:{text:"",text_pos:(a.isbig)?"bottom":"right",img:null,imgdis:null,isbig:false,disable:false,skin:a.skin}};for(g in a){if(g=="id"||g=="onclick"||g=="type"){continue}j.conf[g]=a[g]}c.innerHTML="<img class='dhxrb_image"+((j.conf.img)?"'":" dhxrb_invisible'")+" src='"+((j.conf.img)?j.conf.icons_path+j.conf.img:"")+"' /><div class='dhxrb_label_button'>"+j.conf.text+"</div>";if(typeof(this.afterRender)=="function"){this.afterRender(j)}if(j.conf.disable){this.disable(j)}return j},getText:function(a){return a.conf.text},setText:function(c,g){var a=c.base.childNodes[1];c.conf.text=g;a.innerHTML=g},setImage:function(c,a){c.conf.img=a;if(c.conf.disable==false){c.base.childNodes[0].src=c.conf.icons_path+c.conf.img}},setImageDis:function(c,a){c.conf.imgdis=a;if(c.conf.disable==true){c.base.childNodes[0].src=c.conf.icons_path+c.conf.imgdis}},mousedown:function(a,g,c){return true},click:function(a,g,c){if(c.button!=0){return false}g._callHandler(a.id,[a.id]);a.callEvent("onClick",[a.id]);return false},disable:function(c){var g=c.base.childNodes[0],a=c.base.childNodes[1];if(c.conf.imgdis){g.src=c.conf.icons_path+c.conf.imgdis;if(/\s?dhxrb_invisible/i.test(g.className)){g.className=g.className.replace(/\s?dhxrb_invisible/i,"")}}if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(c){var g=c.base.childNodes[0],a=c.base.childNodes[1];if(c.conf.img){g.src=c.conf.icons_path+c.conf.img}else{if(!/\s?dhxrb_invisible/i.test(g.className)){g.className+=" dhxrb_invisible"}}if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true}};dhtmlXRibbon.prototype.items.buttonTwoState={click:function(a,g,c){return false},afterRender:function(a){if(a.conf.state){this.setState(a,a.conf.state)}},mouseover:function(a){if(!/dhxrb_highlight0/.test(a.base.className)){a.base.className+=" dhxrb_highlight0"}return false},mouseout:function(a){if(/dhxrb_highlight0/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight0/,"")}return false},mousedown:function(a,g,c){g._callHandler(a.id,[a.id,!a.conf.state]);this.setState(a,!a.conf.state,true);return false},mouseup:function(a){return false},setState:function(a,c,g){g=g||false;c=dhx4.s2b(c);if(c){if(!/dhxrb_highlight1/.test(a.base.className)){a.base.className+=" dhxrb_highlight1"}}else{if(/dhxrb_highlight1/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight1/,"")}}a.conf.state=c;if(g){a.callEvent("onStateChange",[a.id,a.conf.state])}},getState:function(a){return(a.conf.state==true)}};dhtmlXRibbon.prototype.items.buttonSegment={click:function(a,g,c){return false},mousedown:function(a,g,c){this.setState(a,g,true);return false},callAfterInit:function(a){if(a.conf.state||dhtmlXRibbon.prototype.items.buttonSegment._getSelectedNeighbor(a,this)==null){if(a.conf.state){a.conf.state=false}dhtmlXRibbon.prototype.items.buttonSegment.setState(a,this,false)}},afterRender:function(){},setState:function(a,l,j){j=j||false;var g=null,c=dhx4.s2b(a.conf.state);if(c==false){g=this._getSelectedNeighbor(a,l);if(g!=null){this._unSelect(g)}if(!/dhxrb_highlight1/.test(a.base.className)){a.base.className+=" dhxrb_highlight1"}a.conf.state=true;if(j){l._callHandler(a.id,[a.id,(g?g.id:null)]);l.callEvent("onStateChange",[a.id,(g?g.id:null)])}}},remove:function(g,n){var l=dhx4.s2b(g.conf.state),m=null,a=0,c=n._items[g.parentId],j;if(l){while(c.childIds[a]&&m==null){j=n._items[c.childIds[a]];if(j.type=="buttonSegment"&&j!=g){m=j}a++}if(m){this.setState(m,n)}}},_unSelect:function(a){var c=dhx4.s2b(a.conf.state);if(c){if(/dhxrb_highlight1/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight1/,"")}a.conf.state=false}},_getSelectedNeighbor:function(j,o){var g=o._items[j.parentId],c,a,n,m=null;a=g.childIds.length;for(c=0;c<a;c++){n=o._items[g.childIds[c]];if(n.type=="buttonSegment"&&n.conf.state){m=n;break}}return m}};dhtmlXRibbon.prototype.items.buttonSelect={itemCollection:[],_isAttachedEventInWindow:false,afterRender:function(c){var a=c.base.childNodes[1];a.innerHTML+="<span class='dhxrb_arrow'>&nbsp;</span>";c.menu=null;this.itemCollection.push(c);this._attachEventToWindow();a=null},setText:function(a,g){var c=a.base.childNodes[1].lastChild;a.conf.text=g;a.base.childNodes[1].innerHTML=g;a.base.childNodes[1].appendChild(c)},setOptionText:function(a,g,c){if(a.menu!=null){a.menu.setItemText(g,c)}else{this._loopThroughItems(a.conf.items,g,c,false)}},getOptionText:function(a,c){if(a.menu!=null){return a.menu.getItemText(c)}return this._loopThroughItems(a.conf.items,c,null,true)},_loopThroughItems:function(a,m,l,j){for(var g=0;g<a.length;g++){if(a[g].id==m){if(j!=true){a[g].text=l;return true}else{return a[g].text}}if(a[g].items!=null){var c=this._loopThroughItems(a[g].items,m,l,j);if(c!=null){return c}}}return null},_attachEventToWindow:function(){if(this._isAttachedEventInWindow==false){if(typeof(window.addEventListener)=="function"){document.body.addEventListener("mousedown",this._hideAllMenus,false)}else{document.body.attachEvent("onmousedown",this._hideAllMenus)}this._isAttachedEventInWindow=true}},_detachEventFromWindow:function(){if(typeof(window.addEventListener)=="function"){document.body.removeEventListener("mousedown",this._hideAllMenus,false)}else{document.body.detachEvent("onmousedown",this._hideAllMenus)}this._isAttachedEventInWindow=false},_hideAllMenus:function(l){l=l||event;var g=l.target||l.srcElement;var a=true;while(g!=null&&a==true){if(g.className!=null&&/SubLevelArea_Polygon/i.test(g.className)){a=false}else{g=g.parentNode}}if(a==false){return}var c=dhtmlXRibbon.prototype.items.buttonSelect.itemCollection;for(var n in c){var j=c[n];if(j.menu instanceof dhtmlXMenuObject){if(j._skipHiding){j._skipHiding=false}else{dhtmlXRibbon.prototype.items.buttonSelect.hideMenu(j)}}}},mousedown:function(a,g,c){a._skipHiding=true;this.showMenu(a);return false},mouseup:function(a){return false},click:function(){},setState:function(){},showMenu:function(c){var a=dhx4.absLeft(c.base),g=dhx4.absTop(c.base)+c.base.offsetHeight;if(!(c.menu instanceof dhtmlXMenuObject)){c.menu=new dhtmlXMenuObject({parent:c.base,icons_path:c.conf.icons_path,context:true,items:c.conf.items,skin:c.conf.skin});if(c.conf.data){c.menu.loadStruct(c.conf.data);delete c.conf.data}c.menu.setAutoHideMode(false);c.menu.attachEvent("onHide",function(j){if(j==null){dhtmlXRibbon.prototype.items.buttonSelect._doOnHideMenu(c)}});c.menu.attachEvent("onShow",function(j){if(j==null){dhtmlXRibbon.prototype.items.buttonSelect._doOnShowMenu(c)}});c.menu.attachEvent("onClick",function(j){c.callEvent("onClick",[j,c.id])});c.base.oncontextmenu=function(){return false};dhtmlXRibbon.prototype.items.buttonSelect.showMenu(c)}else{c.menu.showContextMenu(a,g)}},hideMenu:function(a){if(a.menu instanceof dhtmlXMenuObject){a.menu.hideContextMenu()}},remove:function(c){var g,a;if(c.menu instanceof dhtmlXMenuObject){c.menu.unload();c.menu=null}c.base.oncontextmenu=null;g=dhtmlXRibbon.prototype._indexOf(dhtmlXRibbon.prototype.items.buttonSelect.itemCollection,c);if(g!=-1){dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.splice(g,1)}if(dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.length==0){this._detachEventFromWindow()}},setSkin:function(a,c){if(a.menu instanceof dhtmlXMenuObject){a.menu.setSkin(c)}},_doOnHideMenu:function(a){if(a._skipHiding){a._skipHiding=false}else{if(/dhxrb_highlight1/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight1/,"")}}},_doOnShowMenu:function(a){if(!/dhxrb_highlight1/.test(a.base.className)){a.base.className+=" dhxrb_highlight1"}}};dhtmlXRibbon.prototype.items.group={render:function(c,a){var g,j;j={base:c,id:a.id,type:a.type,conf:{disable:false,skin:a.skin},childIds:[]};c.className="dhxrb_group";for(g in a){if(g=="id"||g=="onclick"||g=="type"){continue}j.conf[g]=a[g]}return j},callAfterInit:function(m){this._detachEventFromItem(m.base);var j,a,n=m.conf.list,o,g,c;a=(n)?n.length:0;for(j=0;j<a;j++){o=this._addItem(m.id,null,null,n[j]);if(o==null){continue}g=o.base.childNodes[1];if(g&&!g.innerHTML&&!/\s?dhxrb_label_hide/i.test(g.className)){g.className+=" dhxrb_label_hide"}}dhtmlXRibbon.prototype.items.group.normalize(m);if(m.conf.disable){this.disable(m.id)}n=undefined},normalize:function(o){var a=o.base.children;var g=a.length,c=false,q=0;var j,n;for(var m=0;m<g;m++){if(!/dhxrb_separator_group/i.test(a[m].className)){if(/dhxrb_item_hide/i.test(a[m].className)){q++;continue}}if((Math.ceil((m-q)/2)-Math.floor((m-q)/2))==0){if(/dhxrb_separator_group/i.test(a[m].className)){a[m].parentNode.removeChild(a[m]);c=true;break}}else{if(!/dhxrb_separator_group/i.test(a[m].className)){j=document.createElement("div");j.className="dhxrb_separator_groupp";o.base.insertBefore(j,a[m]);c=true;break}}}if(c){this.normalize(o)}else{n=o.base.lastChild;if(n&&/dhxrb_separator_group/i.test(n.className)){n.parentNode.removeChild(n)}}},hideChild:function(c,j){var a=dhtmlXRibbon.prototype._indexOf(c.base.children,j.base);if(a==0){a++}else{if(a!=-1){a--}else{return}}var g=c.base.children[a];if(g&&/dhxrb_separator_group/i.test(g.className)){g.parentNode.removeChild(g)}},showChild:function(a){this.normalize(a)}};dhtmlXRibbon.prototype.items.input={render:function(c,a){var g,j;j={base:c,id:a.id,type:a.type,conf:{text:"",text_pos:(a.isbig)?"bottom":"right",img:null,imgdis:null,isbig:false,disable:false,skin:a.skin,value:""}};for(g in a){if(g=="id"||g=="onclick"||g=="type"){continue}j.conf[g]=a[g]}c.innerHTML="<input type='text' class='dhxrb_input'><div class='dhxrb_label_button'>"+j.conf.text+"</div>";if(typeof(this.afterRender)=="function"){this.afterRender(j)}if(j.conf.disable){this.disable(j)}if(j.conf.width){this.setWidth(j,j.conf.width)}if(j.conf.value){this.setValue(j,j.conf.value)}return j},callAfterInit:function(c){var a=c.base.childNodes[0];this._detachEventFromItem(c.base);this._attachEventsToInput(a)},setText:dhtmlXRibbon.prototype.items.button.setText,getText:dhtmlXRibbon.prototype.items.button.getText,change:function(c){var a=c.base.childNodes[0];c.conf.value=a.value},keydown:function(c,j,g){if(g.keyCode==13){var a=c.base.childNodes[0];c.conf.value=a.value;j.callEvent("onEnter",[c.id,c.conf.value])}},remove:function(c,g){var a=c.base.childNodes[0];g._detachEventsFromInput(a)},getValue:function(c){var a=c.base.childNodes[0],g;g=a.value;a=undefined;return g},setValue:function(c,g){var a=c.base.childNodes[0],g;a.value=g;c.conf.value=g},setWidth:function(c,g){var a=c.base.childNodes[0];a.style.width=parseInt(g)+"px"},disable:function(g){var c=g.base.childNodes[0],a=g.base.childNodes[1];c.disabled=true;if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(g){var c=g.base.childNodes[0],a=g.base.childNodes[1];c.disabled=false;if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true},getInput:function(a){return a.base.childNodes[0]}};dhtmlXRibbon.prototype.getInput=function(c){var a=this._items[c];if(a==null||a.type!="input"){return null}return this.items[a.type].getInput(a)};dhtmlXRibbon.prototype.items.checkbox={render:function(c,a){var g,j;j={base:c,id:a.id,type:a.type,conf:{text:"",text_pos:(a.isbig)?"bottom":"right",disable:false,checked:false}};for(g in a){if(g=="id"||g=="onclick"||g=="type"){continue}j.conf[g]=a[g]}c.innerHTML="<div class='dhxrb_checkbox'></div><div class='dhxrb_label_checkbox'>"+j.conf.text+"</div>";if(typeof(this.afterRender)=="function"){this.afterRender(j)}if(j.conf.checked){this.check(j)}return j},callAfterInit:function(a){if(a.conf.disable){this.disable(a.id)}},setText:dhtmlXRibbon.prototype.items.button.setText,getText:dhtmlXRibbon.prototype.items.button.getText,mousedown:function(a){return false},mouseup:function(a){return false},click:function(a,g,c){if(c.button!=0){return false}if(a.type=="checkbox"){if(a.conf.checked){this.uncheck(a,true)}else{this.check(a,true)}}},check:function(a,c){c=c||false;if(a.type!="checkbox"){return}a.conf.checked=true;if(!/\s?dhxrb_checked/i.test(a.base.className)){a.base.className+=" dhxrb_checked"}if(c){a.callEvent("onCheck",[a.id,a.conf.checked])}},uncheck:function(a,c){c=c||false;if(a.type!="checkbox"){return}a.conf.checked=false;if(/\s?dhxrb_checked/i.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_checked/i,"")}if(c){a.callEvent("onCheck",[a.id,a.conf.checked])}},isChecked:function(a){if(a.type!="checkbox"){return false}return(a.conf.checked==true)},disable:function(a){return true},enable:function(a){return true}};dhtmlXRibbon.prototype.items.text={render:function(a,j){var g={base:a,id:j.id,type:j.type,conf:{text:""}};for(var c in j){if(c=="id"||c=="type"){continue}g.conf[c]=j[c]}a.innerHTML="<div class='dhxrb_item_text'>"+g.conf.text+"</div>";if(typeof(this.afterRender)=="function"){this.afterRender(g)}return g},callAfterInit:function(a){this._detachEventFromItem(a.base)},getText:function(a){return a.conf.text},setText:function(a,c){a.conf.text=c;a.base.innerHTML=c}};dhtmlXRibbon.prototype.items.buttonCombo={render:function(a,c){var g,j,l={};j={base:a,id:c.id,type:c.type,conf:{text:"",text_pos:"right",width:140,skin:c.skin,callEvent:true}};for(g in c){if(g=="id"||g=="onclick"||g=="type"){continue}j.conf[g]=c[g]}for(g in j.conf){if(g=="text"||g=="text_pos"||g=="disable"||g=="data"){continue}l[g]=j.conf[g]}j.base.className+=" dhxrb_buttoncombo_cont";j.base.innerHTML="<div class='dhxrb_buttoncombo'></div><div class='dhxrb_label_button'>"+j.conf.text+"</div>";l.parent=j.base.firstChild;j.combo=new dhtmlXCombo(l);j.combo.setSkin(l.skin);j.combo.attachEvent("onChange",function(m,n){j._callHandler(j.id,[m,n]);if(j.conf.callEvent==true){j.callEvent("onSelectOption",[j.id,m,n])}j.conf.callEvent=true});if(j.conf.data){j.combo.load(j.conf.data);delete j.conf.data}if(typeof(this.afterRender)=="function"){this.afterRender(j)}if(j.conf.disable){this.disable(j)}return j},callAfterInit:function(a){this._detachEventFromItem(a.base)},disable:function(c){var a=c.base.lastChild;if(c.combo instanceof dhtmlXCombo){c.combo.disable()}if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(c){var a=c.base.lastChild;if(c.combo instanceof dhtmlXCombo){c.combo.enable()}if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true},remove:function(a){if(a.combo instanceof dhtmlXCombo){a.combo.unload();a.combo=null}},getValue:function(a){var c=null;if(a.combo instanceof dhtmlXCombo){c=a.combo.getSelectedValue()}return c},setValue:function(a,c,g){if(a.combo instanceof dhtmlXCombo){a.conf.callEvent=g;a.combo.setComboValue(c)}},setSkin:function(a,c){if(a.combo instanceof dhtmlXCombo){a.combo.setSkin(c)}}};dhtmlXRibbon.prototype.items.slider={render:function(a,l){var g,j,c={};j={base:a,id:l.id,type:l.type,conf:{text:"",text_pos:"right",size:150,vertical:false,min:0,max:99,value:0,step:1,margin:10,disabled:false,enableTooltip:false}};for(g in l){if(g=="id"||g=="onclick"||g=="type"){continue}j.conf[g]=l[g]}for(g in j.conf){if(g=="text"||g=="text_pos"||g=="isbig"){continue}c[g]=j.conf[g]}j.base.innerHTML="<center><div class='dhxrb_slider'></div></center><div class='dhxrb_label_button'>"+j.conf.text+"</div>";c.parent=j.base.firstChild.firstChild;j.slider=new dhtmlXSlider(c);if(typeof(this.afterRender)=="function"){this.afterRender(j)}if(j.conf.disable){this.disable(j)}j.slider.attachEvent("onChange",function(m){j._callHandler(j.id,[m]);j.callEvent("onValueChange",[j.id,m])});return j},callAfterInit:function(a){this._detachEventFromItem(a.base)},setSkin:function(a,c){if(a.slider instanceof dhtmlXSlider){a.slider.setSkin(c)}},disable:function(c){var a=c.base.childNodes[1];if(c.slider instanceof dhtmlXSlider){c.slider.disable()}if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(c){var a=c.base.childNodes[1];if(c.slider instanceof dhtmlXSlider){c.slider.enable()}if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true},remove:function(a){if(a.slider instanceof dhtmlXSlider){a.slider.unload();a.slider=null}},getValue:function(a){var c=null;if(a.slider instanceof dhtmlXSlider){c=a.slider.getValue()}return c},setValue:function(a,c){if(a.slider instanceof dhtmlXSlider){a.slider.setValue(c)}}};dhtmlXRibbon.prototype.items._extends=function(g,c){var a;for(a in c){g[a]=g[a]||c[a]}return g};dhtmlXRibbon.prototype._addNewLevel=function(g){var c,a;if(g.conf.mode=="rows"){c=g.contForItems.lastChild;if(c&&/dhxrb_block_rows/i.test(c.className)&&(c.childNodes.length<3)){a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}else{c=document.createElement("div");c.className="dhxrb_block_rows";g.contForItems.appendChild(c);a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}}else{var a=document.createElement("div");a.className="dhxrb_3rows_block";g.contForItems.appendChild(a)}};dhtmlXRibbon.prototype._attachEventForItem=function(a){if(typeof(window.addEventListener)=="function"){a.addEventListener("mouseover",this._doOnHighlight0,false);a.addEventListener("mouseout",this._doOffHighlight0,false);a.addEventListener("mousedown",this._doOnHighlight1,false);a.addEventListener("mouseup",this._doOffHighlight1,false);a.addEventListener("click",this._doOnClick,false)}else{a.attachEvent("onmouseover",this._doOnHighlight0);a.attachEvent("onmouseout",this._doOffHighlight0);a.attachEvent("onmousedown",this._doOnHighlight1);a.attachEvent("onmouseup",this._doOffHighlight1);a.attachEvent("onclick",this._doOnClick)}};dhtmlXRibbon.prototype._detachEventFromItem=function(a){if(typeof(window.addEventListener)=="function"){a.removeEventListener("mouseover",this._doOnHighlight0,false);a.removeEventListener("mouseout",this._doOffHighlight0,false);a.removeEventListener("mousedown",this._doOnHighlight1,false);a.removeEventListener("mouseup",this._doOffHighlight1,false);a.removeEventListener("click",this._doOnClick,false)}else{a.detachEvent("onmouseover",this._doOnHighlight0);a.detachEvent("onmouseout",this._doOffHighlight0);a.detachEvent("onmousedown",this._doOnHighlight1);a.detachEvent("onmouseup",this._doOffHighlight1);a.detachEvent("onclick",this._doOnClick)}};dhtmlXRibbon.prototype._attachEventsToInput=function(a){if(typeof(window.addEventListener)=="function"){a.addEventListener("focus",this._doOnFocus,false);a.addEventListener("blur",this._doOnBlur,false);a.addEventListener("change",this._doOnChange,false);a.addEventListener("keydown",this._doOnKeydown,false)}else{a.attachEvent("onfocus",this._doOnFocus);a.attachEvent("onblur",this._doOnBlur);a.attachEvent("onchange",this._doOnChange);a.attachEvent("onkeydown",this._doOnKeydown)}};dhtmlXRibbon.prototype._detachEventsFromInput=function(a){if(typeof(window.addEventListener)=="function"){a.removeEventListener("focus",this._doOnFocus,false);a.removeEventListener("blur",this._doOnBlur,false);a.removeEventListener("change",this._doOnChange,false);a.removeEventListener("keydown",this._doOnKeydown,false)}else{a.detachEvent("onfocus",this._doOnFocus);a.detachEvent("onblur",this._doOnBlur);a.detachEvent("onchange",this._doOnChange);a.detachEvent("onkeydown",this._doOnKeydown)}};dhtmlXRibbon.prototype._getContainerForSmallItem=function(g){var c=g.contForItems.lastChild,a=null;if(g.conf.mode=="rows"){if(c&&/\s?dhxrb_block_rows/i.test(c.className)){a=c.lastChild;if(!a){a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}}else{c=document.createElement("div");c.className="dhxrb_block_rows";g.contForItems.appendChild(c);a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}}else{if(c&&/dhxrb_3rows_block/i.test(c.className)&&(c.childNodes.length<3)){a=c}else{a=document.createElement("div");a.className="dhxrb_3rows_block";g.contForItems.appendChild(a)}}return a};dhtmlXRibbon.prototype._findItemByNode=function(a){while(a&&!a._dhx_ribbonId){a=a.parentNode}return a};dhtmlXRibbon.prototype._indexOf=function(a,j){var g,c;c=a.length;for(g=0;g<c;g++){if(a[g]==j){return g}}return -1};dhtmlXRibbon.prototype._removeItem=function(g){var a,j=-1,c=this._items[g.parentId];if(g.type=="group"){this._removeGroup(g);return}delete this._items[g.id];a=g.base.parentNode;this._detachEventFromItem(g.base);a.removeChild(g.base);if(c.type=="block"){if(a!=c.contForItems&&a.childNodes.length==0){a.parentNode.removeChild(a)}}else{if(c.type=="group"){dhtmlXRibbon.prototype.items.group.normalize(c)}}j=this._indexOf(c.childIds,g.id);if(j!=-1){c.childIds.splice(j,1)}if(this.items[g.type]&&(typeof(this.items[g.type].remove)=="function")){this.items[g.type].remove(g,this)}};dhtmlXRibbon.prototype._removeGroup=function(j){var c=[],l,g=this._items[j.parentId],a=j.base.parentNode;for(l in j.childIds){l=parseInt(l);c.push(this._items[j.childIds[l]])}for(l in c){l=parseInt(l);this._removeItem(c[l])}delete this._items[j.id];if(j.base.parentNode){a.removeChild(j.base)}if(a.childNodes.length==0){a.parentNode.removeChild(a)}l=this._indexOf(g.childIds,j.id);if(l!=-1){g.childIds.splice(l,1)}if(this.items[j.type]&&(typeof(this.items[j.type].remove)=="function")){this.items[j.type].remove(j)}};dhtmlXRibbon.prototype._removeBlock=function(j){var a=[],g,c;for(g in j.childIds){g=parseInt(g);a.push(this._items[j.childIds[g]])}for(g in a){g=parseInt(g);this._removeItem(a[g])}delete this._items[j.id];j.base.parentNode.removeChild(j.base);if(j.parentId){c=this._items[j.parentId]}else{c=this}g=this._indexOf(c.childIds,j.id);if(g!=-1){c.childIds.splice(g,1)}};dhtmlXRibbon.prototype._removeTab=function(c,a){var j=[],g;for(g in c.childIds){g=parseInt(g);j.push(this._items[c.childIds[g]])}for(g in j){g=parseInt(g);this._removeBlock(j[g])}delete this._items[c.id];g=this._indexOf(this.childIds,c.id);if(g!=-1){this.childIds.splice(g,1)}};dhtmlXRibbon.prototype._skinCollection={dhx_skyblue:true,dhx_web:true,dhx_terrace:true};dhtmlXRibbon.prototype._setSkinForItems=function(g){var a,c;for(a in this._items){c=this._items[a];c.conf.skin=g;if(dhtmlXRibbon.prototype.items[c.type]&&typeof(dhtmlXRibbon.prototype.items[c.type].setSkin)=="function"){dhtmlXRibbon.prototype.items[c.type].setSkin(c,g)}}c=undefined,a=undefined};dhtmlXRibbon.prototype._setBlockText=function(a,c){a.conf.text=c;a.contForText.innerHTML=c;if(!c&&(c!=0)&&a.contForText.parentNode){a.contForText.parentNode.removeChild(a.contForText)}else{if(!a.contForText.parentNode){if(a.conf.text_pos=="top"){a.base.insertBefore(a.contForText,a.contForItems)}else{a.base.appendChild(a.contForText)}}}};dhtmlXRibbon.prototype.hide=function(g){var c=this._items[g];if(this.items[c.type]&&(typeof(this.items[c.type].hide)=="function")){if(this.items[c.type].hide(c)!=true){return}}if(c.type=="tab"){return}else{if(!/\s?dhxrb_item_hide/i.test(c.base.className)){c.base.className+=" dhxrb_item_hide"}}var a=this._items[c.parentId];if(a&&this.items[a.type]&&(typeof(this.items[a.type].hideChild)=="function")){this.items[a.type].hideChild(a,c)}};dhtmlXRibbon.prototype.show=function(g){var c=this._items[g];if(this.items[c.type]&&(typeof(this.items[c.type].show)=="function")){if(this.items[c.type].show(c)!=true){return}}if(c.type=="tab"){return}else{if(/\s?dhxrb_item_hide/i.test(c.base.className)){c.base.className=c.base.className.replace(/\s?dhxrb_item_hide/i,"")}}var a=this._items[c.parentId];if(a&&this.items[a.type]&&(typeof(this.items[a.type].showChild)=="function")){this.items[a.type].showChild(a,c)}};dhtmlXRibbon.prototype.check=function(g,c){c=dhx4.s2b(c);var a=this._items[g];if(a&&!a.conf.checked&&typeof(this.items[a.type].check)=="function"){this.items[a.type].check(a);if(c){this.callEvent("onCheck",[a.id,a.conf.checked])}}};dhtmlXRibbon.prototype.uncheck=function(g,c){c=dhx4.s2b(c);var a=this._items[g];if(a&&a.conf.checked&&typeof(this.items[a.type].uncheck)=="function"){this.items[a.type].uncheck(a);if(c){this.callEvent("onCheck",[a.id,a.conf.checked])}}};dhtmlXRibbon.prototype.isChecked=function(c){var a=this._items[c];if(a&&typeof(this.items[a.type].isChecked)=="function"){return this.items[a.type].isChecked(a)}};dhtmlXRibbon.prototype.disable=function(j,c){var g=this._items[j],a;if(this.items[g.type]&&(typeof(this.items[g.type].disable)=="function")){if(this.items[g.type].disable(g)!=true){return}}if(g.type=="tab"){return}else{if(g.type=="block"||g.type=="group"){for(a in g.childIds){a=parseInt(a);this.disable(g.childIds[a])}}}if(!/\s?dhxrb_item_disable/i.test(g.base.className)){g.base.className+=" dhxrb_item_disable"}g.conf.disable=true};dhtmlXRibbon.prototype.enable=function(j,c){var g=this._items[j],a;if(this.items[g.type]&&(typeof(this.items[g.type].enable)=="function")){if(this.items[g.type].enable(g)!=true){return}}if(g.type=="tab"){return}else{if(g.type=="block"||g.type=="group"){for(a in g.childIds){a=parseInt(a);this.enable(g.childIds[a])}}}if(/\s?dhxrb_item_disable/i.test(g.base.className)){g.base.className=g.base.className.replace(/\s?dhxrb_item_disable/i,"")}g.conf.disable=false};dhtmlXRibbon.prototype.isEnabled=function(c){var a=this._items[c];if(this.items[a.type]&&typeof(this.items[a.type].isEnabled)=="function"){return this.items[a.type].isEnabled(a)}if(a.type=="tab"){return}else{return a.conf.disable!=true}};dhtmlXRibbon.prototype.isVisible=function(c){var a=this._items[c];if(this.items[a.type]&&(typeof(this.items[a.type].isVisible)=="function")){return this.items[a.type].isVisible(a)}if(a.type=="tab"){return}else{return !/\s?dhxrb_item_hide/i.test(a.base.className)}};dhtmlXRibbon.prototype.setItemState=function(j,c,g){c=dhx4.s2b(c);g=dhx4.s2b(g);var a=this._items[j];if(a&&(typeof(this.items[a.type].setState)=="function")){switch(a.type){case"buttonSegment":this.items[a.type].setState(a,this,g);break;default:this.items[a.type].setState(a,c,g)}}};dhtmlXRibbon.prototype.getItemState=function(c){var a=this._items[c];if(a&&(typeof(this.items[a.type].getState)=="function")){switch(a.type){case"buttonTwoState":case"buttonSegment":return this.items[a.type].getState(a);break}}return null};dhtmlXRibbon.prototype.setIconPath=function(a){this.conf.icons_path=a};dhtmlXRibbon.prototype.removeItem=function(c){var a=this._items[c];switch(a.type){case"tab":break;case"block":this._removeBlock(a);break;case"group":this._removeGroup(a);break;default:this._removeItem(a)}};dhtmlXRibbon.prototype.setSkin=function(l){l=(typeof(l)=="string")?l.toLowerCase():"";if(this._skinCollection[l]!=true){return}var g,c=-1,a,j="dhtmlxribbon";g=this._base.className.match(/\S\w+/ig);if(g instanceof Array){for(a in this._skinCollection){if(c==-1){c=this._indexOf(g,j+"_"+a)}else{break}}c=(c==-1)?g.length:c}else{g=[];c=0}g[c]=j+"_"+l;this._base.className=g.join(" ");this.conf.skin=l;if(this._tabbar!=null){this._tabbar.setSkin(l)}this._setSkinForItems(l)};dhtmlXRibbon.prototype.tabs=function(a){if(this._tabbar instanceof dhtmlXTabBar){return this._tabbar.tabs(a)}else{return undefined}};dhtmlXRibbon.prototype.getItemType=function(c){var a=this._items[c];if(a){return a.type}else{return undefined}};dhtmlXRibbon.prototype.getValue=function(g){var a=this._items[g],c=undefined;if(a&&this.items[a.type]&&typeof(this.items[a.type].getValue)=="function"){c=this.items[a.type].getValue(a)}return c};dhtmlXRibbon.prototype.setValue=function(j,c,g){var a=this._items[j];g=(g===false?false:true);if(a&&this.items[a.type]&&typeof(this.items[a.type].setValue)=="function"){this.items[a.type].setValue(a,c,g)}};dhtmlXRibbon.prototype.getItemText=function(c){var a=this._items[c];if(!a){return null}else{if(a.type=="tab"){return this.tabs(a.id).getText()}else{if(a.type=="block"){return this.items.button.getText(a)}else{if(this.items[a.type]&&typeof(this.items[a.type].getText)=="function"){return this.items[a.type].getText(a)}else{return null}}}}};dhtmlXRibbon.prototype.setItemText=function(g,c){var a=this._items[g];if(!a){return}else{if(a.type=="tab"){this.tabs(a.id).setText(c)}else{if(a.type=="block"){this._setBlockText(a,c)}else{if(this.items[a.type]&&typeof(this.items[a.type].setText)=="function"){this.items[a.type].setText(a,c)}}}}};dhtmlXRibbon.prototype.setItemOptionText=function(j,g,c){var a=this._items[j];if(a.type=="buttonSelect"){this.items[a.type].setOptionText(a,g,c)}};dhtmlXRibbon.prototype.getItemOptionText=function(g,c){var a=this._items[g];if(a.type=="buttonSelect"){return this.items[a.type].getOptionText(a,c)}return null};dhtmlXRibbon.prototype.setItemImage=function(g,a){var c=this._items[g];if(c!=null&&this.items[c.type]!=null&&typeof(this.items[c.type].setImage)=="function"){this.items[c.type].setImage(c,a)}};dhtmlXRibbon.prototype.setItemImageDis=function(g,a){var c=this._items[g];if(c!=null&&this.items[c.type]!=null&&typeof(this.items[c.type].setImageDis)=="function"){this.items[c.type].setImageDis(c,a)}};(function(){var a=dhtmlXRibbon.prototype.items;a.buttonTwoState=a._extends(a.buttonTwoState,a.button);a.buttonSelect=a._extends(a.buttonSelect,a.buttonTwoState);a.buttonSegment=a._extends(a.buttonSegment,a.buttonTwoState)})();if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype._createNode_ribbon=function(l,c,j,a,g){if(typeof(g)!="undefined"){l=g}else{l=document.createElement("DIV");l.className="dhx_cell_ribbon_"+(this.conf.borders?"def":"no_borders");l.appendChild(document.createElement("DIV"))}this.cell.insertBefore(l,this.cell.childNodes[this.conf.idx.cont]);this.conf.ofs_nodes.t.ribbon=true;this._updateIdx();this._adjustCont(this._idd);return l};dhtmlXCellObject.prototype.attachRibbon=function(a){if(!(this.dataNodes.ribbon==null&&this.dataNodes.toolbar==null)){return}this.callEvent("_onBeforeContentAttach",["ribbon"]);if(typeof(a)=="undefined"){a={}}if(typeof(a.skin)=="undefined"){a.skin=this.conf.skin}a.parent=this._attachObject("ribbon").firstChild;this.dataNodes.ribbon=new dhtmlXRibbon(a);var c=this;this.dataNodes.ribbon.attachEvent("_onHeightChanged",function(){c._adjustCont(c._idd)});this._adjustCont();a.parent=null;a=null;this.callEvent("_onContentAttach",[]);return this.dataNodes.ribbon};dhtmlXCellObject.prototype.detachRibbon=function(){if(!this.dataNodes.ribbon){return}this.dataNodes.ribbon.unload();this.dataNodes.ribbon=null;delete this.dataNodes.ribbon;this._detachObject("ribbon")};dhtmlXCellObject.prototype.showRibbon=function(){this._mtbShowHide("ribbon","")};dhtmlXCellObject.prototype.hideRibbon=function(){this._mtbShowHide("ribbon","none")};dhtmlXCellObject.prototype.getAttachedRibbon=function(){return this.dataNodes.ribbon}}function dhtmlXToolbarObject(c,g){var a=this;this.conf={skin:(g||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxtoolbar")||"dhx_skyblue"),align:"left",align_autostart:"left",icons_path:"",iconSize:18,sel_ofs_x:0,sel_ofs_y:0,xml_autoload:null,items_autoload:null};if(typeof(c)=="object"&&c!=null&&typeof(c.tagName)=="undefined"){if(c.icons_path!=null||c.icon_path!=null){this.conf.icons_path=(c.icons_path||c.icon_path)}if(c.icons_size!=null){this.conf.icons_size_autoload=c.icons_size}if(c.json!=null){this.conf.json_autoload=c.json}if(c.xml!=null){this.conf.xml_autoload=c.xml}if(c.onload!=null){this.conf.onload_autoload=c.onload}if(c.onclick!=null||c.onClick!=null){this.conf.auto_onclick=(c.onclick||c.onClick)}if(c.items!=null){this.conf.items_autoload=c.items}if(c.skin!=null){this.conf.skin=c.skin}if(c.align!=null){this.conf.align_autostart=c.align}c=c.parent}this.cont=(typeof(c)!="object")?document.getElementById(c):c;while(this.cont.childNodes.length>0){this.cont.removeChild(this.cont.childNodes[0])}c=null;this.cont.dir="ltr";this.base=document.createElement("DIV");this.base.className="dhxtoolbar_float_left";this.cont.appendChild(this.base);if(window.dhx4.isIPad){this.cont.ontouchstart=function(j){j=j||event;if((String(j.target.tagName||"").toLowerCase()=="input")){return true}if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}j.cancelBubble=true;return false}}this.setSkin(this.conf.skin);this.objPull={};this.anyUsed="none";this._genStr=function(j){var l="";var n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var m=0;m<j;m++){l+=n.charAt(Math.round(Math.random()*(n.length-1)))}return l};this.rootTypes=new Array("button","buttonSelect","buttonTwoState","separator","label","slider","text","buttonInput");this.idPrefix=this._genStr(12);window.dhx4._enableDataLoading(this,"_initObj","_xmlToJson","toolbar",{struct:true});window.dhx4._eventable(this);this._getObj=function(n,j){var l=null;for(var m=0;m<n.childNodes.length;m++){if(n.childNodes[m].tagName!=null){if(String(n.childNodes[m].tagName).toLowerCase()==String(j).toLowerCase()){l=n.childNodes[m]}}}return l};this._addImgObj=function(l){var j=document.createElement("IMG");if(l.childNodes.length>0){l.insertBefore(j,l.childNodes[0])}else{l.appendChild(j)}return j};this._setItemImage=function(n,l,j){if(j==true){n.imgEn=l}else{n.imgDis=l}if((!n.state&&j==true)||(n.state&&j==false)){return}var m=this._getObj(n.obj,"img");if(m==null){m=this._addImgObj(n.obj)}m.src=this.conf.icons_path+l};this._clearItemImage=function(m,j){if(j==true){m.imgEn=""}else{m.imgDis=""}if((!m.state&&j==true)||(m.state&&j==false)){return}var l=this._getObj(m.obj,"img");if(l!=null){l.parentNode.removeChild(l)}};this._setItemText=function(j,m){var l=this._getObj(j.obj,"div");if(m==null||m.length==0){if(l!=null){l.parentNode.removeChild(l)}return}if(l==null){l=document.createElement("DIV");l.className="dhxtoolbar_text";j.obj.appendChild(l)}l.innerHTML=m};this._getItemText=function(j){var l=this._getObj(j.obj,"div");if(l!=null){return l.innerHTML}return""};this._enableItem=function(l){if(l.state){return}l.state=true;if(this.objPull[l.id]["type"]=="buttonTwoState"&&this.objPull[l.id]["obj"]["pressed"]==true){l.obj.className="dhx_toolbar_btn dhxtoolbar_btn_pres";l.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over"}else{l.obj.className="dhx_toolbar_btn dhxtoolbar_btn_def";l.obj.renderAs=l.obj.className}if(l.arw){l.arw.className=String(l.obj.className).replace("btn","arw")}var j=this._getObj(l.obj,"img");if(l.imgEn!=""){if(j==null){j=this._addImgObj(l.obj)}j.src=this.conf.icons_path+l.imgEn}else{if(j!=null){j.parentNode.removeChild(j)}}};this._disableItem=function(l){if(!l.state){return}l.state=false;l.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.objPull[l.id]["type"]=="buttonTwoState"&&l.obj.pressed?"pres_":"")+"dis";l.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";if(l.arw){l.arw.className=String(l.obj.className).replace("btn","arw")}var j=this._getObj(l.obj,"img");if(l.imgDis!=""){if(j==null){j=this._addImgObj(l.obj)}j.src=this.conf.icons_path+l.imgDis}else{if(j!=null){j.parentNode.removeChild(j)}}if(l.polygon!=null){if(l.polygon.style.display!="none"){window.dhx4.zim.clear(l.polygon._idd);l.polygon.style.display="none";if(l.polygon._ie6cover){l.polygon._ie6cover.style.display="none"}if(this.conf.skin=="dhx_terrace"){this._improveTerraceButtonSelect(l.id,true)}}}this.anyUsed="none"};this.clearAll=function(){for(var j in this.objPull){this._removeItem(String(j).replace(this.idPrefix,""))}};this._doOnClick=function(j){if(a&&a.forEachItem){a.forEachItem(function(m){if(a.objPull[a.idPrefix+m]["type"]=="buttonSelect"){var l=a.objPull[a.idPrefix+m];if(l.arw._skip===true){l.arw._skip=false}else{if(l.polygon.style.display!="none"){l.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";l.obj.className=l.obj.renderAs;l.arw.className=String(l.obj.renderAs).replace("btn","arw");a.anyUsed="none";window.dhx4.zim.clear(l.polygon._idd);l.polygon.style.display="none";if(l.polygon._ie6cover){l.polygon._ie6cover.style.display="none"}if(a.conf.skin=="dhx_terrace"){a._improveTerraceButtonSelect(l.id,true)}}}}})}};if(window.dhx4.isIPad){document.addEventListener("touchstart",this._doOnClick,false)}else{if(typeof(window.addEventListener)!="undefined"){window.addEventListener("mousedown",this._doOnClick,false)}else{document.body.attachEvent("onmousedown",this._doOnClick)}}if(this.conf.icons_size_autoload!=null){this.setIconSize(this.conf.icons_size_autoload);this.conf.icons_size_autoload=null}if(this.conf.items_autoload!=null){this.loadStruct(this.conf.items_autoload,this.conf.onload_autoload);this.conf.items_autoload=null}else{if(this.conf.json_autoload!=null){this.loadStruct(this.conf.json_autoload,this.conf.onload_autoload);this.conf.json_autoload=null}else{if(this.conf.xml_autoload!=null){this.loadStruct(this.conf.xml_autoload,this.conf.onload_autoload);this.conf.xml_autoload=null}}}if(this.conf.align_autostart!=this.conf.align){this.setAlign(this.conf.align_autostart);this.conf.align_autostart=null}if(typeof(this.conf.auto_onclick)=="function"){this.attachEvent("onClick",this.conf.auto_onclick)}else{if(typeof(this.conf.auto_onclick)=="string"&&typeof(window[this.conf.auto_onclick])=="function"){this.attachEvent("onClick",window[this.conf.auto_onclick])}}return this}dhtmlXToolbarObject.prototype.addSpacer=function(g){var c=this.idPrefix+g;if(this._spacer!=null){if(this._spacer.idd==g){return}if(this._spacer==this.objPull[c].obj.parentNode){var a=true;while(a){var n=this._spacer.childNodes[0].idd;this.base.appendChild(this._spacer.childNodes[0]);if(n==g||this._spacer.childNodes.length==0){if(this.objPull[c].arw!=null){this.base.appendChild(this.objPull[c].arw)}a=false}}this._spacer.idd=g;this._fixSpacer();return}if(this.base==this.objPull[c].obj.parentNode){var a=true;var m=(this.objPull[c].arw!=null);while(a){var j=this.base.childNodes.length-1;if(m==true){if(this.base.childNodes[j]==this.objPull[c].arw){a=false}}if(this.base.childNodes[j].idd==g){a=false}if(a){if(this._spacer.childNodes.length>0){this._spacer.insertBefore(this.base.childNodes[j],this._spacer.childNodes[0])}else{this._spacer.appendChild(this.base.childNodes[j])}}}this._spacer.idd=g;this._fixSpacer();return}}else{var l=null;for(var j=0;j<this.base.childNodes.length;j++){if(this.base.childNodes[j]==this.objPull[this.idPrefix+g].obj){l=j;if(this.objPull[this.idPrefix+g].arw!=null){l=j+1}}}if(l!=null){this._spacer=document.createElement("DIV");this._spacer.className=(this.conf.align=="right"?" dhxtoolbar_float_left":" dhxtoolbar_float_right");this._spacer.dir="ltr";this._spacer.idd=g;while(this.base.childNodes.length>l+1){this._spacer.appendChild(this.base.childNodes[l+1])}this.cont.appendChild(this._spacer);this._fixSpacer()}}if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype.removeSpacer=function(){if(!this._spacer){return}while(this._spacer.childNodes.length>0){this.base.appendChild(this._spacer.childNodes[0])}this._spacer.parentNode.removeChild(this._spacer);this._spacer=null;if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype._fixSpacer=function(){if(typeof(window.addEventListener)=="undefined"&&this._spacer!=null){this._spacer.style.borderLeft="1px solid #a4bed4";var a=this._spacer;window.setTimeout(function(){a.style.borderLeft="0px solid #a4bed4";a=null},1)}};dhtmlXToolbarObject.prototype.getType=function(g){var j=this.getParentId(g);if(j!=null){var c=null;var a=this.objPull[this.idPrefix+j]._listOptions[g];if(a!=null){if(a.sep!=null){c="buttonSelectSeparator"}else{c="buttonSelectButton"}}return c}else{if(this.objPull[this.idPrefix+g]==null){return null}return this.objPull[this.idPrefix+g]["type"]}};dhtmlXToolbarObject.prototype.getTypeExt=function(c){var a=this.getType(c);if(a=="buttonSelectButton"||a=="buttonSelectSeparator"){if(a=="buttonSelectButton"){a="button"}else{a="separator"}return a}return null};dhtmlXToolbarObject.prototype.inArray=function(g,c){for(var a=0;a<g.length;a++){if(g[a]==c){return true}}return false};dhtmlXToolbarObject.prototype.getParentId=function(j){var l=null;for(var g in this.objPull){if(this.objPull[g]._listOptions){for(var c in this.objPull[g]._listOptions){if(c==j){l=String(g).replace(this.idPrefix,"")}}}}return l};dhtmlXToolbarObject.prototype._addItem=function(a,c){if(typeof(a.text)=="string"){a.text=window.dhx4.trim(a.text);if(a.text.length==0){a.text=null}}this._addItemToStorage(a,c);if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype.addButton=function(l,j,c,a,g){this._addItem({id:l,type:"button",text:c,img:a,imgdis:g},j)};dhtmlXToolbarObject.prototype.addText=function(g,c,a){this._addItem({id:g,type:"text",text:a},c)};dhtmlXToolbarObject.prototype.addButtonSelect=function(j,o,v,a,c,r,n,x,l,m){var w=[];for(var g=0;g<a.length;g++){var s={};if(a[g] instanceof Array){s.id=a[g][0];s.type=(a[g][1]=="obj"?"button":"separator");s.text=(a[g][2]||null);s.img=(a[g][3]||null)}else{if(a[g] instanceof Object&&a[g]!=null&&typeof(a[g].id)!="undefined"&&typeof(a[g].type)!="undefined"){s.id=a[g].id;s.type=(a[g].type=="obj"?"button":"separator");s.text=a[g].text;s.img=a[g].img}}w.push(s)}this._addItem({id:j,type:"buttonSelect",text:v,img:c,imgdis:r,renderSelect:n,openAll:x,options:w,maxOpen:l,mode:m},o)};dhtmlXToolbarObject.prototype.addButtonTwoState=function(l,j,c,a,g){this._addItem({id:l,type:"buttonTwoState",img:a,imgdis:g,text:c},j)};dhtmlXToolbarObject.prototype.addSeparator=function(c,a){this._addItem({id:c,type:"separator"},a)};dhtmlXToolbarObject.prototype.addSlider=function(c,n,l,j,q,g,m,a,o){this._addItem({id:c,type:"slider",length:l,valueMin:j,valueMax:q,valueNow:g,textMin:m,textMax:a,toolTip:o},n)};dhtmlXToolbarObject.prototype.addInput=function(j,g,c,a){this._addItem({id:j,type:"buttonInput",value:c,width:a},g)};dhtmlXToolbarObject.prototype.forEachItem=function(g){for(var c in this.objPull){if(this.inArray(this.rootTypes,this.objPull[c]["type"])){g(this.objPull[c]["id"].replace(this.idPrefix,""))}}};(function(){var m="isVisible,enableItem,disableItem,isEnabled,setItemText,getItemText,setItemToolTip,getItemToolTip,getInput,setItemImage,setItemImageDis,clearItemImage,clearItemImageDis,setItemState,getItemState,setItemToolTipTemplate,getItemToolTipTemplate,setValue,getValue,setMinValue,getMinValue,setMaxValue,getMaxValue,setWidth,getWidth,setMaxOpen".split(",");var g=[false,"","",false,"","","","","","","","","",false,"","","",null,"",[null,null],"",[null,null],"",null];var c=function(n,o){return function(s,r,q){s=this.idPrefix+s;if(this.objPull[s][n]!=null){return this.objPull[s][n].call(this.objPull[s],r,q)}else{return o}}};for(var l=0;l<m.length;l++){var a=m[l];var j=g[l];dhtmlXToolbarObject.prototype[a]=c(a,j)}})();dhtmlXToolbarObject.prototype.showItem=function(a){a=this.idPrefix+a;if(this.objPull[a]!=null&&this.objPull[a].showItem!=null){this.objPull[a].showItem();if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}}};dhtmlXToolbarObject.prototype.hideItem=function(a){a=this.idPrefix+a;if(this.objPull[a]!=null&&this.objPull[a].hideItem!=null){this.objPull[a].hideItem();if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}}};dhtmlXToolbarObject.prototype.getPosition=function(a){return this._getPosition(a)};dhtmlXToolbarObject.prototype._getPosition=function(l,g){if(this.objPull[this.idPrefix+l]==null){return null}var j=null;var a=0;for(var c=0;c<this.base.childNodes.length;c++){if(this.base.childNodes[c].idd!=null){if(this.base.childNodes[c].idd==l){j=a}a++}}if(!j&&this._spacer!=null){for(var c=0;c<this._spacer.childNodes.length;c++){if(this._spacer.childNodes[c].idd!=null){if(this._spacer.childNodes[c].idd==l){j=a}a++}}}return j};dhtmlXToolbarObject.prototype.setPosition=function(a,c){this._setPosition(a,c)};dhtmlXToolbarObject.prototype._setPosition=function(l,j){if(this.objPull[this.idPrefix+l]==null){return}if(isNaN(j)){j=this.base.childNodes.length}if(j<0){j=0}var a=null;if(this._spacer){a=this._spacer.idd;this.removeSpacer()}var g=this.objPull[this.idPrefix+l];this.base.removeChild(g.obj);if(g.arw){this.base.removeChild(g.arw)}var c=this._getIdByPosition(j,true);if(c[0]==null){this.base.appendChild(g.obj);if(g.arw){this.base.appendChild(g.arw)}}else{this.base.insertBefore(g.obj,this.base.childNodes[c[1]]);if(g.arw){this.base.insertBefore(g.arw,this.base.childNodes[c[1]+1])}}if(a!=null){this.addSpacer(a)}};dhtmlXToolbarObject.prototype._getIdByPosition=function(m,c){var l=null;var a=0;var g=0;for(var j=0;j<this.base.childNodes.length;j++){if(this.base.childNodes[j]["idd"]!=null&&l==null){if((a++)==m){l=this.base.childNodes[j]["idd"]}}if(l==null){g++}}g=(l==null?null:g);return(c==true?new Array(l,g):l)};dhtmlXToolbarObject.prototype.removeItem=function(a){this._removeItem(a);if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype._removeItem=function(l){var g=this.getType(l);l=this.idPrefix+l;var j=this.objPull[l];if(g=="button"){j.obj._doOnMouseOver=null;j.obj._doOnMouseOut=null;j.obj._doOnMouseUp=null;j.obj._doOnMouseUpOnceAnywhere=null;j.obj.onclick=null;j.obj.onmouseover=null;j.obj.onmouseout=null;j.obj.onmouseup=null;j.obj.onmousedown=null;j.obj.onselectstart=null;j.obj.renderAs=null;j.obj.idd=null;j.obj.parentNode.removeChild(j.obj);j.obj=null;j.id=null;j.state=null;j.img=null;j.imgEn=null;j.imgDis=null;j.type=null;j.enableItem=null;j.disableItem=null;j.isEnabled=null;j.showItem=null;j.hideItem=null;j.isVisible=null;j.setItemText=null;j.getItemText=null;j.setItemImage=null;j.clearItemImage=null;j.setItemImageDis=null;j.clearItemImageDis=null;j.setItemToolTip=null;j.getItemToolTip=null}if(g=="buttonTwoState"){j.obj._doOnMouseOver=null;j.obj._doOnMouseOut=null;j.obj.onmouseover=null;j.obj.onmouseout=null;j.obj.onmousedown=null;j.obj.onselectstart=null;j.obj.renderAs=null;j.obj.idd=null;j.obj.parentNode.removeChild(j.obj);j.obj=null;j.id=null;j.state=null;j.img=null;j.imgEn=null;j.imgDis=null;j.type=null;j.enableItem=null;j.disableItem=null;j.isEnabled=null;j.showItem=null;j.hideItem=null;j.isVisible=null;j.setItemText=null;j.getItemText=null;j.setItemImage=null;j.clearItemImage=null;j.setItemImageDis=null;j.clearItemImageDis=null;j.setItemToolTip=null;j.getItemToolTip=null;j.setItemState=null;j.getItemState=null}if(g=="buttonSelect"){for(var c in j._listOptions){this.removeListOption(l,c)}j._listOptions=null;if(j.polygon._ie6cover){document.body.removeChild(j.polygon._ie6cover);j.polygon._ie6cover=null}j.p_tbl.removeChild(j.p_tbody);j.polygon.removeChild(j.p_tbl);j.polygon.onselectstart=null;document.body.removeChild(j.polygon);j.p_tbody=null;j.p_tbl=null;j.polygon=null;j.obj.onclick=null;j.obj.onmouseover=null;j.obj.onmouseout=null;j.obj.onmouseup=null;j.obj.onmousedown=null;j.obj.onselectstart=null;j.obj.idd=null;j.obj.iddPrefix=null;j.obj.parentNode.removeChild(j.obj);j.obj=null;j.arw.onclick=null;j.arw.onmouseover=null;j.arw.onmouseout=null;j.arw.onmouseup=null;j.arw.onmousedown=null;j.arw.onselectstart=null;j.arw.parentNode.removeChild(j.arw);j.arw=null;j.renderSelect=null;j.state=null;j.type=null;j.id=null;j.img=null;j.imgEn=null;j.imgDis=null;j.openAll=null;j._isListButton=null;j._separatorButtonSelectObject=null;j._buttonButtonSelectObject=null;j.setWidth=null;j.enableItem=null;j.disableItem=null;j.isEnabled=null;j.showItem=null;j.hideItem=null;j.isVisible=null;j.setItemText=null;j.getItemText=null;j.setItemImage=null;j.clearItemImage=null;j.setItemImageDis=null;j.clearItemImageDis=null;j.setItemToolTip=null;j.getItemToolTip=null;j.addListOption=null;j.removeListOption=null;j.showListOption=null;j.hideListOption=null;j.isListOptionVisible=null;j.enableListOption=null;j.disableListOption=null;j.isListOptionEnabled=null;j.setListOptionPosition=null;j.getListOptionPosition=null;j.setListOptionImage=null;j.getListOptionImage=null;j.clearListOptionImage=null;j.setListOptionText=null;j.getListOptionText=null;j.setListOptionToolTip=null;j.getListOptionToolTip=null;j.forEachListOption=null;j.getAllListOptions=null;j.setListOptionSelected=null;j.getListOptionSelected=null}if(g=="buttonInput"){j.obj.childNodes[0].onkeydown=null;j.obj.removeChild(j.obj.childNodes[0]);j.obj.w=null;j.obj.idd=null;j.obj.parentNode.removeChild(j.obj);j.obj=null;j.id=null;j.type=null;j.enableItem=null;j.disableItem=null;j.isEnabled=null;j.showItem=null;j.hideItem=null;j.isVisible=null;j.setItemToolTip=null;j.getItemToolTip=null;j.setWidth=null;j.getWidth=null;j.setValue=null;j.getValue=null;j.setItemText=null;j.getItemText=null}if(g=="slider"){if(window.dhx4.isIPad){document.removeEventListener("touchmove",pen._doOnMouseMoveStart,false);document.removeEventListener("touchend",pen._doOnMouseMoveEnd,false)}else{if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousemove",j.pen._doOnMouseMoveStart,false);window.removeEventListener("mouseup",j.pen._doOnMouseMoveEnd,false)}else{document.body.detachEvent("onmousemove",j.pen._doOnMouseMoveStart);document.body.detachEvent("onmouseup",j.pen._doOnMouseMoveEnd)}}j.pen.allowMove=null;j.pen.initXY=null;j.pen.maxX=null;j.pen.minX=null;j.pen.nowX=null;j.pen.newNowX=null;j.pen.valueMax=null;j.pen.valueMin=null;j.pen.valueNow=null;j.pen._definePos=null;j.pen._detectLimits=null;j.pen._doOnMouseMoveStart=null;j.pen._doOnMouseMoveEnd=null;j.pen.onmousedown=null;j.obj.removeChild(j.pen);j.pen=null;j.label.tip=null;document.body.removeChild(j.label);j.label=null;j.obj.onselectstart=null;j.obj.idd=null;while(j.obj.childNodes.length>0){j.obj.removeChild(j.obj.childNodes[0])}j.obj.parentNode.removeChild(j.obj);j.obj=null;j.id=null;j.type=null;j.state=null;j.enableItem=null;j.disableItem=null;j.isEnabled=null;j.setItemToolTipTemplate=null;j.getItemToolTipTemplate=null;j.setMaxValue=null;j.setMinValue=null;j.getMaxValue=null;j.getMinValue=null;j.setValue=null;j.getValue=null;j.showItem=null;j.hideItem=null;j.isVisible=null}if(g=="separator"){j.obj.onselectstart=null;j.obj.idd=null;j.obj.parentNode.removeChild(j.obj);j.obj=null;j.id=null;j.type=null;j.showItem=null;j.hideItem=null;j.isVisible=null}if(g=="text"){j.obj.onselectstart=null;j.obj.idd=null;j.obj.parentNode.removeChild(j.obj);j.obj=null;j.id=null;j.type=null;j.showItem=null;j.hideItem=null;j.isVisible=null;j.setWidth=null;j.setItemText=null;j.getItemText=null}g=null;j=null;this.objPull[this.idPrefix+l]=null;delete this.objPull[this.idPrefix+l]};(function(){var j="addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split(",");var c=function(l){return function(s,n,m,r,q,o){s=this.idPrefix+s;if(this.objPull[s]==null){return}if(this.objPull[s]["type"]!="buttonSelect"){return}return this.objPull[s][l].call(this.objPull[s],n,m,r,q,o)}};for(var g=0;g<j.length;g++){var a=j[g];dhtmlXToolbarObject.prototype[a]=c(a)}})();dhtmlXToolbarObject.prototype._rtlParseBtn=function(c,a){return c+a};dhtmlXToolbarObject.prototype._separatorObject=function(a,g,c){this.id=a.idPrefix+g;this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_sep";this.obj.style.display=(c.hidden!=null?"none":"");this.obj.idd=String(g);this.obj.title=(c.title||"");this.obj.onselectstart=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}};if(window.dhx4.isIPad){this.obj.ontouchstart=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}j.cancelBubble=true;return false}}a.base.appendChild(this.obj);this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};return this};dhtmlXToolbarObject.prototype._textObject=function(a,g,c){this.id=a.idPrefix+g;this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_text";this.obj.style.display=(c.hidden!=null?"none":"");this.obj.idd=String(g);this.obj.title=(c.title||"");this.obj.onselectstart=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}};if(window.dhx4.isIPad){this.obj.ontouchstart=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}j.cancelBubble=true;return false}}this.obj.innerHTML=(c.text||"");a.base.appendChild(this.obj);this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setItemText=function(j){this.obj.innerHTML=j};this.getItemText=function(){return this.obj.innerHTML};this.setWidth=function(j){this.obj.style.width=j+"px"};this.setItemToolTip=function(j){this.obj.title=j};this.getItemToolTip=function(){return this.obj.title};return this};dhtmlXToolbarObject.prototype._buttonObject=function(a,j,c){this.id=a.idPrefix+j;this.state=(c.enabled!=null?false:true);this.imgEn=(c.img||"");this.imgDis=(c.imgdis||"");this.img=(this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.style.display=(c.hidden!=null?"none":"");this.obj.allowClick=false;this.obj.extAction=(c.action||null);this.obj.renderAs=this.obj.className;this.obj.idd=String(j);this.obj.title=(c.title||"");this.obj.pressed=false;this.obj.innerHTML=a._rtlParseBtn((this.img!=""?"<img src='"+a.conf.icons_path+this.img+"'>":""),(c.text!=null?"<div class='dhxtoolbar_text'>"+c.text+"</div>":""));var g=this;this.obj.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};this.obj.onmouseover=function(){this._doOnMouseOver()};this.obj.onmouseout=function(){this._doOnMouseOut()};this.obj._doOnMouseOver=function(){this.allowClick=true;if(g.state==false){return}if(a.anyUsed!="none"){return}this.className="dhx_toolbar_btn dhxtoolbar_btn_over";this.renderAs=this.className};this.obj._doOnMouseOut=function(){this.allowClick=false;if(g.state==false){return}if(a.anyUsed!="none"){return}this.className="dhx_toolbar_btn dhxtoolbar_btn_def";this.renderAs=this.renderAs};this.obj.onclick=function(l){if(g.state==false){return}if(this.allowClick==false){return}l=l||event;var m=this.idd.replace(a.idPrefix,"");if(this.extAction){try{window[this.extAction](m)}catch(l){}}if(a&&a.callEvent){a.callEvent("onClick",[m])}};this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(l){if(g.state==false){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}l.cancelBubble=true;return false}if(a.anyUsed!="none"){return}a.anyUsed=this.idd;this.className="dhx_toolbar_btn dhxtoolbar_btn_pres";this.pressed=true;this.onmouseover=function(){this._doOnMouseOver()};this.onmouseout=function(){a.anyUsed="none";this._doOnMouseOut()};return false};this.obj[window.dhx4.isIPad?"ontouchend":"onmouseup"]=function(m){if(g.state==false){return}if(a.anyUsed!="none"){if(a.anyUsed!=this.idd){return}}var l=a.anyUsed;this._doOnMouseUp();if(window.dhx4.isIPad&&l!="none"){a.callEvent("onClick",[this.idd.replace(a.idPrefix,"")])}};if(window.dhx4.isIPad){this.obj.ontouchmove=function(l){this._doOnMouseUp()}}this.obj._doOnMouseUp=function(){a.anyUsed="none";this.className=this.renderAs;this.pressed=false};this.obj._doOnMouseUpOnceAnywhere=function(){this._doOnMouseUp();this.onmouseover=function(){this._doOnMouseOver()};this.onmouseout=function(){this._doOnMouseOut()}};a.base.appendChild(this.obj);this.enableItem=function(){a._enableItem(this)};this.disableItem=function(){a._disableItem(this)};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setItemText=function(l){a._setItemText(this,l)};this.getItemText=function(){return a._getItemText(this)};this.setItemImage=function(l){a._setItemImage(this,l,true)};this.clearItemImage=function(){a._clearItemImage(this,true)};this.setItemImageDis=function(l){a._setItemImage(this,l,false)};this.clearItemImageDis=function(){a._clearItemImage(this,false)};this.setItemToolTip=function(l){this.obj.title=l};this.getItemToolTip=function(){return this.obj.title};return this};dhtmlXToolbarObject.prototype._buttonSelectObject=function(g,m,l){this.id=g.idPrefix+m;this.state=(l.enabled!=null?(l.enabled=="true"?true:false):true);this.imgEn=(l.img||"");this.imgDis=(l.imgdis||"");this.img=(this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.mode=(l.mode||"button");if(this.mode=="select"){this.openAll=true;this.renderSelect=false;if(!l.text||l.text.length==0){l.text="&nbsp;"}}else{this.openAll=(window.dhx4.s2b(l.openAll)==true);this.renderSelect=(l.renderSelect==null?true:window.dhx4.s2b(l.renderSelect))}this.maxOpen=(!isNaN(l.maxOpen?l.maxOpen:"")?l.maxOpen:null);this._maxOpenTest=function(){if(!isNaN(this.maxOpen)){if(!g._sbw){var o=document.createElement("DIV");o.className="dhxtoolbar_maxopen_test";document.body.appendChild(o);var n=document.createElement("DIV");n.className="dhxtoolbar_maxopen_test2";o.appendChild(n);g._sbw=o.offsetWidth-n.offsetWidth;o.removeChild(n);n=null;document.body.removeChild(o);o=null}}};this._maxOpenTest();this.obj=document.createElement("DIV");this.obj.allowClick=false;this.obj.extAction=(l.action||null);this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.style.display=(l.hidden!=null?"none":"");this.obj.renderAs=this.obj.className;this.obj.onselectstart=function(n){n=n||event;if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}};this.obj.idd=String(m);this.obj.title=(l.title||"");this.obj.pressed=false;this.callEvent=false;this.obj.innerHTML=g._rtlParseBtn((this.img!=""?"<img src='"+g.conf.icons_path+this.img+"'>":""),(l.text!=null?"<div class='dhxtoolbar_text'>"+l.text+"</div>":""));g.base.appendChild(this.obj);this.arw=document.createElement("DIV");this.arw.className="dhx_toolbar_arw dhxtoolbar_btn_"+(this.state?"def":"dis");this.arw.style.display=this.obj.style.display;this.arw.innerHTML="<div class='arwimg'>&nbsp;</div>";this.arw.title=this.obj.title;this.arw.onselectstart=function(n){n=n||event;if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}};g.base.appendChild(this.arw);var a=this;this.obj.onmouseover=function(n){n=n||event;if(g.anyUsed!="none"){return}if(!a.state){return}a.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over";a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw")};this.obj.onmouseout=function(){a.obj.allowClick=false;if(g.anyUsed!="none"){return}if(!a.state){return}a.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");a.callEvent=false};this.arw.onmouseover=this.obj.onmouseover;this.arw.onmouseout=this.obj.onmouseout;if(this.openAll==true){}else{this.obj.onclick=function(n){n=n||event;if(!a.obj.allowClick){return}if(!a.state){return}if(g.anyUsed!="none"){return}var o=a.obj.idd.replace(g.idPrefix,"");if(a.obj.extAction){try{window[a.obj.extAction](o)}catch(n){}}g.callEvent("onClick",[o])};this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(n){n=n||event;if(g.anyUsed!="none"){return}if(!a.state){return}a.obj.allowClick=true;a.obj.className="dhx_toolbar_btn dhxtoolbar_btn_pres";a.arw.className="dhx_toolbar_arw dhxtoolbar_btn_pres";a.callEvent=true};this.obj[window.dhx4.isIPad?"ontouchend":"onmouseup"]=function(n){n=n||event;n.cancelBubble=true;if(g.anyUsed!="none"){return}if(!a.state){return}a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");if(window.dhx4.isIPad&&a.callEvent){var o=a.obj.idd.replace(g.idPrefix,"");g.callEvent("onClick",[o])}}}if(window.dhx4.isIPad){this.obj.ontouchmove=this.obj.onmouseout}this.arw[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(q){q=q||event;var x=(this.className.indexOf("dhx_toolbar_arw")===0?this:this.nextSibling);if(x._skip){q=q||event;q.cancelBubble=true}else{x._skip=true}x=null;if(!a.state){return}if(g.anyUsed==a.obj.idd){a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");g.anyUsed="none";window.dhx4.zim.clear(a.polygon._idd);a.polygon.style.display="none";if(a.polygon._ie6cover){a.polygon._ie6cover.style.display="none"}if(g.conf.skin=="dhx_terrace"){g._improveTerraceButtonSelect(a.id,true)}}else{if(g.anyUsed!="none"){if(g.objPull[g.idPrefix+g.anyUsed]["type"]=="buttonSelect"){var w=g.objPull[g.idPrefix+g.anyUsed];if(w.polygon.style.display!="none"){w.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";w.obj.className=w.obj.renderAs;w.arw.className=String(a.obj.renderAs).replace("btn","arw");window.dhx4.zim.clear(w.polygon._idd);w.polygon.style.display="none";if(w.polygon._ie6cover){w.polygon._ie6cover.style.display="none"}if(g.conf.skin=="dhx_terrace"){g._improveTerraceButtonSelect(w.id,true)}}}}a.obj.className="dhx_toolbar_btn dhxtoolbar_btn_over";a.arw.className="dhx_toolbar_arw dhxtoolbar_btn_pres";g.anyUsed=a.obj.idd;a.polygon.style.top="0px";a.polygon.style.visibility="hidden";a.polygon.style.zIndex=window.dhx4.zim.reserve(a.polygon._idd);a.polygon.style.display="";if(g.conf.skin=="dhx_terrace"){g._improveTerraceButtonSelect(a.id,false)}a._fixMaxOpenHeight(a.maxOpen||null);g._autoDetectVisibleArea();var r=window.dhx4.absTop(a.obj)+a.obj.offsetHeight+g.conf.sel_ofs_y;var u=a.polygon.offsetHeight;if(r+u>g.tY2){var s=(a.maxOpen!=null?Math.floor((g.tY2-r)/22):0);if(s>=1){a._fixMaxOpenHeight(s)}else{r=window.dhx4.absTop(a.obj)-u-g.conf.sel_ofs_y;if(r<0){r=0}}}a.polygon.style.top=r+"px";if(g.rtl){a.polygon.style.left=window.dhx4.absLeft(a.obj)+a.obj.offsetWidth-a.polygon.offsetWidth+g.conf.sel_ofs_x+"px"}else{var o=document.body.scrollLeft;var n=o+(window.innerWidth||document.body.clientWidth);var v=window.dhx4.absLeft(a.obj)+g.conf.sel_ofs_x;if(v+a.polygon.offsetWidth>n){v=window.dhx4.absLeft(a.arw)+a.arw.offsetWidth-a.polygon.offsetWidth}a.polygon.style.left=Math.max(v,5)+"px"}a.polygon.style.visibility="visible";if(a.polygon._ie6cover){a.polygon._ie6cover.style.left=a.polygon.style.left;a.polygon._ie6cover.style.top=a.polygon.style.top;a.polygon._ie6cover.style.width=a.polygon.offsetWidth+"px";a.polygon._ie6cover.style.height=a.polygon.offsetHeight+"px";a.polygon._ie6cover.style.display=""}}return false};this.arw.onclick=function(n){n=n||event;n.cancelBubble=true};this.arw[window.dhx4.isIPad?"ontouchend":"onmouseup"]=function(n){n=n||event;n.cancelBubble=true};if(this.openAll===true){this.obj.onclick=this.arw.onclick;this.obj.onmousedown=this.arw.onmousedown;this.obj.onmouseup=this.arw.onmouseup;if(window.dhx4.isIPad){this.obj.ontouchstart=this.arw.ontouchstart;this.obj.ontouchend=this.arw.ontouchend}}this.obj.iddPrefix=g.idPrefix;this._listOptions={};this._fixMaxOpenHeight=function(s){var r="auto";var q=false;if(s!==null){var o=0;for(var n in this._listOptions){o++}if(o>s){this._ph=22*s;r=this._ph+"px"}else{q=true}}this.polygon.style.width="auto";this.polygon.style.height="auto";if(!q&&a.maxOpen!=null){this.polygon.style.width=this.p_tbl.offsetWidth+g._sbw+"px";this.polygon.style.height=r}};this._separatorButtonSelectObject=function(q,n,o){this.obj={};this.obj.tr=document.createElement("TR");this.obj.tr.className="tr_sep";this.obj.tr.onselectstart=function(r){r=r||event;if(r.preventDefault){r.preventDefault()}else{r.returnValue=false}return false};this.obj.td=document.createElement("TD");this.obj.td.colSpan="2";this.obj.td.className="td_btn_sep";this.obj.td.onselectstart=function(r){r=r||event;if(r.preventDefault){r.preventDefault()}else{r.returnValue=false}return false};if(isNaN(o)){o=a.p_tbody.childNodes.length+1}else{if(o<1){o=1}}if(o>a.p_tbody.childNodes.length){a.p_tbody.appendChild(this.obj.tr)}else{a.p_tbody.insertBefore(this.obj.tr,a.p_tbody.childNodes[o-1])}this.obj.tr.appendChild(this.obj.td);this.obj.sep=document.createElement("DIV");this.obj.sep.className="btn_sep";this.obj.sep.onselectstart=function(r){r=r||event;if(r.preventDefault){r.preventDefault()}else{r.returnValue=false}return false};this.obj.td.appendChild(this.obj.sep);a._listOptions[q]=this.obj;return this};this._buttonButtonSelectObject=function(s,q,r){var o=true;if(typeof(q.enabled)!="undefined"){o=window.dhx4.s2b(q.enabled)}else{if(typeof(q.disabled)!="undefined"){o=window.dhx4.s2b(q.disabled)}}this.obj={};this.obj.tr=document.createElement("TR");this.obj.tr.en=o;this.obj.tr.extAction=(q.action||null);this.obj.tr._selected=(q.selected!=null);this.obj.tr.className="tr_btn"+(this.obj.tr.en?(this.obj.tr._selected&&a.renderSelect?" tr_btn_selected":""):" tr_btn_disabled");this.obj.tr.onselectstart=function(u){u=u||event;if(u.preventDefault){u.preventDefault()}else{u.returnValue=false}return false};this.obj.tr.idd=String(s);if(isNaN(r)){r=a.p_tbody.childNodes.length+1}else{if(r<1){r=1}}if(r>a.p_tbody.childNodes.length){a.p_tbody.appendChild(this.obj.tr)}else{a.p_tbody.insertBefore(this.obj.tr,a.p_tbody.childNodes[r-1])}this.obj.td_a=document.createElement("TD");this.obj.td_a.className="td_btn_img";this.obj.td_a.onselectstart=function(u){u=u||event;if(u.preventDefault){u.preventDefault()}else{u.returnValue=false}return false};this.obj.td_b=document.createElement("TD");this.obj.td_b.className="td_btn_txt";this.obj.td_b.onselectstart=function(u){u=u||event;if(u.preventDefault){u.preventDefault()}else{u.returnValue=false}return false};if(g.rtl){this.obj.tr.appendChild(this.obj.td_b);this.obj.tr.appendChild(this.obj.td_a)}else{this.obj.tr.appendChild(this.obj.td_a);this.obj.tr.appendChild(this.obj.td_b)}if(q.img!=null){this.obj.td_a.innerHTML="<img class='btn_sel_img' src='"+g.conf.icons_path+q.img+"' border='0'>";this.obj.tr._img=q.img}else{this.obj.td_a.innerHTML="&nbsp;"}var n=(q.text!=null?q.text:(q.itemText||""));this.obj.td_b.innerHTML="<div class='btn_sel_text'>"+n+"</div>";this.obj.tr[window.dhx4.isIPad?"ontouchstart":"onmouseover"]=function(){if(!this.en||(this._selected&&a.renderSelect)){return}this.className="tr_btn tr_btn_over"};this.obj.tr.onmouseout=function(){if(!this.en){return}if(this._selected&&a.renderSelect){if(String(this.className).search("tr_btn_selected")==-1){this.className="tr_btn tr_btn_selected"}}else{this.className="tr_btn"}};this.obj.tr[window.dhx4.isIPad?"ontouchend":"onclick"]=function(u){u=u||event;u.cancelBubble=true;if(!this.en){return}a.setListOptionSelected(this.idd.replace(g.idPrefix,""));a.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");window.dhx4.zim.clear(a.polygon._idd);a.polygon.style.display="none";if(a.polygon._ie6cover){a.polygon._ie6cover.style.display="none"}if(g.conf.skin=="dhx_terrace"){g._improveTerraceButtonSelect(a.id,true)}g.anyUsed="none";var v=this.idd.replace(g.idPrefix,"");if(this.extAction){try{window[this.extAction](v)}catch(u){}}g.callEvent("onClick",[v])};a._listOptions[s]=this.obj;return this};this.polygon=document.createElement("DIV");this.polygon.dir="ltr";this.polygon.style.display="none";this.polygon.className="dhx_toolbar_poly_"+g.conf.skin+" dhxtoolbar_icons_"+g.conf.iconSize;this.polygon.onselectstart=function(n){n=n||event;if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}};this.polygon.onmousedown=function(n){n=n||event;n.cancelBubble=true};this.polygon.style.overflowY="auto";this.polygon._idd=window.dhx4.newId();if(window.dhx4.isIPad){this.polygon.ontouchstart=function(n){n=n||event;if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}n.cancelBubble=true;return false}}this.p_tbl=document.createElement("TABLE");this.p_tbl.className="buttons_cont";this.p_tbl.cellSpacing="0";this.p_tbl.cellPadding="0";this.p_tbl.border="0";this.polygon.appendChild(this.p_tbl);this.p_tbody=document.createElement("TBODY");this.p_tbl.appendChild(this.p_tbody);if(l.options!=null){for(var j=0;j<l.options.length;j++){var c="_"+(l.options[j].type||"")+"ButtonSelectObject";if(l.options[j].id==null){l.options[j].id=g._genStr(24)}if(typeof(this[c])=="function"){new this[c](l.options[j].id,l.options[j])}}}document.body.appendChild(this.polygon);if(window.dhx4.isIE6){this.polygon._ie6cover=document.createElement("IFRAME");this.polygon._ie6cover.frameBorder=0;this.polygon._ie6cover.style.position="absolute";this.polygon._ie6cover.style.border="none";this.polygon._ie6cover.style.backgroundColor="#000000";this.polygon._ie6cover.style.filter="alpha(opacity=100)";this.polygon._ie6cover.style.display="none";this.polygon._ie6cover.setAttribute("src","javascript:false;");document.body.appendChild(this.polygon._ie6cover)}this.setWidth=function(n){this.obj.style.width=n-this.arw.offsetWidth+"px";this.polygon.style.width=this.obj.offsetWidth+this.arw.offsetWidth-2+"px";this.p_tbl.style.width=this.polygon.style.width};this.enableItem=function(){g._enableItem(this)};this.disableItem=function(){g._disableItem(this)};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display="";this.arw.style.display=""};this.hideItem=function(){this.obj.style.display="none";this.arw.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setItemText=function(n){g._setItemText(this,n)};this.getItemText=function(){return g._getItemText(this)};this.setItemImage=function(n){g._setItemImage(this,n,true)};this.clearItemImage=function(){g._clearItemImage(this,true)};this.setItemImageDis=function(n){g._setItemImage(this,n,false)};this.clearItemImageDis=function(){g._clearItemImage(this,false)};this.setItemToolTip=function(n){this.obj.title=n;this.arw.title=n};this.getItemToolTip=function(){return this.obj.title};this.addListOption=function(u,s,q,r,n){if(!(q=="button"||q=="separator")){return}var o={id:u,type:q,text:r,img:n};new this["_"+q+"ButtonSelectObject"](u,o,s)};this.removeListOption=function(q){if(!this._isListButton(q,true)){return}var n=this._listOptions[q];if(n.td_a!=null&&n.td_b!=null){n.td_a.onselectstart=null;n.td_b.onselectstart=null;while(n.td_a.childNodes.length>0){n.td_a.removeChild(n.td_a.childNodes[0])}while(n.td_b.childNodes.length>0){n.td_b.removeChild(n.td_b.childNodes[0])}n.tr.onselectstart=null;n.tr.onmouseover=null;n.tr.onmouseout=null;n.tr.onclick=null;while(n.tr.childNodes.length>0){n.tr.removeChild(n.tr.childNodes[0])}n.tr.parentNode.removeChild(n.tr);n.td_a=null;n.td_b=null;n.tr=null}else{n.sep.onselectstart=null;n.td.onselectstart=null;n.tr.onselectstart=null;while(n.td.childNodes.length>0){n.td.removeChild(n.td.childNodes[0])}while(n.tr.childNodes.length>0){n.tr.removeChild(n.tr.childNodes[0])}n.tr.parentNode.removeChild(n.tr);n.sep=null;n.td=null;n.tr=null}n=null;this._listOptions[q]=null;try{delete this._listOptions[q]}catch(o){}};this.showListOption=function(n){if(!this._isListButton(n,true)){return}this._listOptions[n].tr.style.display=""};this.hideListOption=function(n){if(!this._isListButton(n,true)){return}this._listOptions[n].tr.style.display="none"};this.isListOptionVisible=function(n){if(!this._isListButton(n,true)){return}return(this._listOptions[n].tr.style.display!="none")};this.enableListOption=function(n){if(!this._isListButton(n)){return}this._listOptions[n].tr.en=true;this._listOptions[n].tr.className="tr_btn"+(this._listOptions[n].tr._selected&&g.renderSelect?" tr_btn_selected":"")};this.disableListOption=function(n){if(!this._isListButton(n)){return}this._listOptions[n].tr.en=false;this._listOptions[n].tr.className="tr_btn tr_btn_disabled"};this.isListOptionEnabled=function(n){if(!this._isListButton(n)){return}return this._listOptions[n].tr.en};this.setListOptionPosition=function(q,o){if(!this._listOptions[q]||this.getListOptionPosition(q)==o||isNaN(o)){return}if(o<1){o=1}var n=this._listOptions[q].tr;this.p_tbody.removeChild(n);if(o>this.p_tbody.childNodes.length){this.p_tbody.appendChild(n)}else{this.p_tbody.insertBefore(n,this.p_tbody.childNodes[o-1])}n=null};this.getListOptionPosition=function(r){var o=-1;if(!this._listOptions[r]){return o}for(var n=0;n<this.p_tbody.childNodes.length;n++){if(this.p_tbody.childNodes[n]==this._listOptions[r].tr){o=n+1}}return o};this.setListOptionImage=function(r,n){if(!this._isListButton(r)){return}var q=this._listOptions[r].tr.childNodes[(g.rtl?1:0)];if(q.childNodes.length>0){q.childNodes[0].src=g.conf.icons_path+n}else{var o=document.createElement("IMG");o.className="btn_sel_img";o.src=g.conf.icons_path+n;q.appendChild(o)}q=null};this.getListOptionImage=function(q){if(!this._isListButton(q)){return}var o=this._listOptions[q].tr.childNodes[(g.rtl?1:0)];var n=null;if(o.childNodes.length>0){n=o.childNodes[0].src}o=null;return n};this.clearListOptionImage=function(o){if(!this._isListButton(o)){return}var n=this._listOptions[o].tr.childNodes[(g.rtl?1:0)];while(n.childNodes.length>0){n.removeChild(n.childNodes[0])}n.innerHTML="&nbsp;";n=null};this.setListOptionText=function(o,n){if(!this._isListButton(o)){return}this._listOptions[o].tr.childNodes[(g.rtl?0:1)].childNodes[0].innerHTML=n};this.getListOptionText=function(n){if(!this._isListButton(n)){return}return this._listOptions[n].tr.childNodes[(g.rtl?0:1)].childNodes[0].innerHTML};this.setListOptionToolTip=function(o,n){if(!this._isListButton(o)){return}this._listOptions[o].tr.title=n};this.getListOptionToolTip=function(n){if(!this._isListButton(n)){return}return this._listOptions[n].tr.title};this.forEachListOption=function(o){for(var n in this._listOptions){o(n)}};this.getAllListOptions=function(){var o=new Array();for(var n in this._listOptions){o[o.length]=n}return o};this.setListOptionSelected=function(q){for(var n in this._listOptions){var o=this._listOptions[n];if(o.td_a!=null&&o.td_b!=null&&o.tr.en){if(n==q){o.tr._selected=true;o.tr.className="tr_btn"+(this.renderSelect?" tr_btn_selected":"");if(this.mode=="select"){if(o.tr._img){this.setItemImage(o.tr._img)}else{this.clearItemImage()}this.setItemText(this.getListOptionText(q))}}else{o.tr._selected=false;o.tr.className="tr_btn"}}o=null}};this.getListOptionSelected=function(){var o=null;for(var n in this._listOptions){if(this._listOptions[n].tr._selected==true){o=n}}return o};this._isListButton=function(o,n){if(this._listOptions[o]==null){return false}if(!n&&this._listOptions[o].tr.className=="tr_sep"){return false}return true};this.setMaxOpen=function(n){this._ph=null;if(typeof(n)=="number"){this.maxOpen=n;this._maxOpenTest();return}this.maxOpen=null};if(l.width){this.setWidth(l.width)}if(this.mode=="select"&&typeof(l.selected)!="undefined"){this.setListOptionSelected(l.selected)}return this};dhtmlXToolbarObject.prototype._buttonInputObject=function(g,l,j){this.id=g.idPrefix+l;this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_def";this.obj.style.display=(j.hidden!=null?"none":"");this.obj.idd=String(l);this.obj.w=(j.width!=null?j.width:100);this.obj.title=(j.title!=null?j.title:"");this.obj.innerHTML="<input class='dhxtoolbar_input' type='text' style='width:"+this.obj.w+"px;'"+(j.value!=null?" value='"+j.value+"'":"")+">";var c=g;var a=this;this.obj.childNodes[0].onkeydown=function(m){m=m||event;if(m.keyCode==13){c.callEvent("onEnter",[a.obj.idd,this.value])}};g.base.appendChild(this.obj);this.enableItem=function(){this.obj.childNodes[0].disabled=false};this.disableItem=function(){this.obj.childNodes[0].disabled=true};this.isEnabled=function(){return(!this.obj.childNodes[0].disabled)};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display!="none")};this.setValue=function(m){this.obj.childNodes[0].value=m};this.getValue=function(){return this.obj.childNodes[0].value};this.setWidth=function(m){this.obj.w=m;this.obj.childNodes[0].style.width=this.obj.w+"px"};this.getWidth=function(){return this.obj.w};this.setItemToolTip=function(m){this.obj.title=m};this.getItemToolTip=function(){return this.obj.title};this.getInput=function(){return this.obj.firstChild};if(typeof(j.enabled)!="undefined"&&window.dhx4.s2b(j.enabled)==false){this.disableItem()}return this};dhtmlXToolbarObject.prototype._buttonTwoStateObject=function(a,j,c){this.id=a.idPrefix+j;this.state=(c.enabled!=null?false:true);this.imgEn=(c.img!=null?c.img:"");this.imgDis=(c.imgdis!=null?c.imgdis:"");this.img=(this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.obj=document.createElement("DIV");this.obj.pressed=(c.selected!=null);this.obj.extAction=(c.action||null);this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.obj.pressed?"pres"+(this.state?"":"_dis"):(this.state?"def":"dis"));this.obj.style.display=(c.hidden!=null?"none":"");this.obj.renderAs=this.obj.className;this.obj.idd=String(j);this.obj.title=(c.title||"");if(this.obj.pressed){this.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over"}this.obj.innerHTML=a._rtlParseBtn((this.img!=""?"<img src='"+a.conf.icons_path+this.img+"'>":""),(c.text!=null?"<div class='dhxtoolbar_text'>"+c.text+"</div>":""));a.base.appendChild(this.obj);var g=this;this.obj.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};this.obj.onmouseover=function(){this._doOnMouseOver()};this.obj.onmouseout=function(){this._doOnMouseOut()};this.obj._doOnMouseOver=function(){if(g.state==false){return}if(a.anyUsed!="none"){return}if(this.pressed){this.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over";return}this.className="dhx_toolbar_btn dhxtoolbar_btn_over";this.renderAs=this.className};this.obj._doOnMouseOut=function(){if(g.state==false){return}if(a.anyUsed!="none"){return}if(this.pressed){this.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";return}this.className="dhx_toolbar_btn dhxtoolbar_btn_def";this.renderAs=this.className};this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(l){if(a.checkEvent("onBeforeStateChange")){if(!a.callEvent("onBeforeStateChange",[this.idd.replace(a.idPrefix,""),this.pressed])){return}}if(g.state==false){return}if(a.anyUsed!="none"){return}this.pressed=!this.pressed;this.className=(this.pressed?"dhx_toolbar_btn dhxtoolbar_btn_pres":this.renderAs);var m=this.idd.replace(a.idPrefix,"");if(this.extAction){try{window[this.extAction](m,this.pressed)}catch(l){}}a.callEvent("onStateChange",[m,this.pressed]);return false};this.setItemState=function(l,n){if(this.obj.pressed!=l){if(l==true){this.obj.pressed=true;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_pres"+(this.state?"":"_dis");this.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over"}else{this.obj.pressed=false;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.renderAs=this.obj.className}if(n==true){var o=this.obj.idd.replace(a.idPrefix,"");if(this.obj.extAction){try{window[this.obj.extAction](o,this.obj.pressed)}catch(m){}}a.callEvent("onStateChange",[o,this.obj.pressed])}}};this.getItemState=function(){return this.obj.pressed};this.enableItem=function(){a._enableItem(this)};this.disableItem=function(){a._disableItem(this)};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setItemText=function(l){a._setItemText(this,l)};this.getItemText=function(){return a._getItemText(this)};this.setItemImage=function(l){a._setItemImage(this,l,true)};this.clearItemImage=function(){a._clearItemImage(this,true)};this.setItemImageDis=function(l){a._setItemImage(this,l,false)};this.clearItemImageDis=function(){a._clearItemImage(this,false)};this.setItemToolTip=function(l){this.obj.title=l};this.getItemToolTip=function(){return this.obj.title};return this};dhtmlXToolbarObject.prototype._sliderObject=function(j,m,l){this.id=j.idPrefix+m;this.state=(l.enabled!=null?(l.enabled=="true"?true:false):true);this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.style.display=(l.hidden!=null?"none":"");this.obj.onselectstart=function(n){n=n||event;if(n.preventDefault){n.preventDefault()}else{n.returnValue=false}};this.obj.idd=String(m);this.obj.len=(l.length!=null?Number(l.length):50);this.obj.innerHTML="<div class='dhxtoolbar_text'>"+(l.textMin||"")+"</div><div class='dhxtoolbar_sl_bg_l'></div><div class='dhxtoolbar_sl_bg_m' style='width:"+this.obj.len+"px;'></div><div class='dhxtoolbar_sl_bg_r'></div><div class='dhxtoolbar_text'>"+(l.textMax||"")+"</div>";j.base.appendChild(this.obj);var a=this;this.pen=document.createElement("DIV");this.pen.className="dhxtoolbar_sl_pen";this.obj.appendChild(this.pen);var g=this.pen;this.label=document.createElement("DIV");this.label.dir="ltr";this.label.className="dhx_toolbar_slider_label_"+j.conf.skin+(j.rtl?"_rtl":"");this.label.style.display="none";this.label.tip=(l.toolTip||"%v");this.label._zi=window.dhx4.newId();document.body.appendChild(this.label);var c=this.label;this.pen.valueMin=(l.valueMin!=null?Number(l.valueMin):0);this.pen.valueMax=(l.valueMax!=null?Number(l.valueMax):100);if(this.pen.valueMin>this.pen.valueMax){this.pen.valueMin=this.pen.valueMax}this.pen.valueNow=(l.valueNow!=null?Number(l.valueNow):this.pen.valueMax);if(this.pen.valueNow>this.pen.valueMax){this.pen.valueNow=this.pen.valueMax}if(this.pen.valueNow<this.pen.valueMin){this.pen.valueNow=this.pen.valueMin}this.pen._detectLimits=function(){this.minX=a.obj.childNodes[1].offsetLeft+2;this.maxX=a.obj.childNodes[3].offsetLeft-this.offsetWidth+1};this.pen._detectLimits();this.pen._definePos=function(){this.nowX=Math.round((this.valueNow-this.valueMin)*(this.maxX-this.minX)/(this.valueMax-this.valueMin)+this.minX);this.style.left=this.nowX+"px";this.newNowX=this.nowX};this.pen._definePos();this.pen.initXY=0;this.pen.allowMove=false;this.pen[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(n){if(a.state==false){return}n=n||event;this.initXY=(window.dhx4.isIPad?n.touches[0].clientX:n.clientX);this.newValueNow=this.valueNow;this.allowMove=true;this.className="dhxtoolbar_sl_pen dhxtoolbar_over";if(c.tip!=""){c.style.visibility="hidden";c.style.display="";c.innerHTML=c.tip.replace("%v",this.valueNow);c.style.left=Math.round(window.dhx4.absLeft(this)+this.offsetWidth/2-c.offsetWidth/2)+"px";c.style.top=window.dhx4.absTop(this)-c.offsetHeight-3+"px";c.style.visibility="";c.style.zIndex=window.dhx4.zim.reserve(c._zi)}};this.pen._doOnMouseMoveStart=function(o){o=o||event;if(!g.allowMove){return}var n=(window.dhx4.isIPad?o.touches[0].clientX:o.clientX);var q=n-g.initXY;if(n<window.dhx4.absLeft(g)+Math.round(g.offsetWidth/2)&&g.nowX==g.minX){return}if(n>window.dhx4.absLeft(g)+Math.round(g.offsetWidth/2)&&g.nowX==g.maxX){return}g.newNowX=g.nowX+q;if(g.newNowX<g.minX){g.newNowX=g.minX}if(g.newNowX>g.maxX){g.newNowX=g.maxX}g.nowX=g.newNowX;g.style.left=g.nowX+"px";g.initXY=n;g.newValueNow=Math.round((g.valueMax-g.valueMin)*(g.newNowX-g.minX)/(g.maxX-g.minX)+g.valueMin);if(c.tip!=""){c.innerHTML=c.tip.replace(/%v/gi,g.newValueNow);c.style.left=Math.round(window.dhx4.absLeft(g)+g.offsetWidth/2-c.offsetWidth/2)+"px";c.style.top=window.dhx4.absTop(g)-c.offsetHeight-3+"px"}o.cancelBubble=true;if(o.preventDefault){o.preventDefault()}else{o.returnValue=false}return false};this.pen._doOnMouseMoveEnd=function(){if(!g.allowMove){return}g.className="dhxtoolbar_sl_pen";g.allowMove=false;g.nowX=g.newNowX;g.valueNow=g.newValueNow;if(c.tip!=""){c.style.display="none";window.dhx4.zim.clear(c._zi)}j.callEvent("onValueChange",[a.obj.idd.replace(j.idPrefix,""),g.valueNow])};if(window.dhx4.isIPad){document.addEventListener("touchmove",g._doOnMouseMoveStart,false);document.addEventListener("touchend",g._doOnMouseMoveEnd,false)}else{if(typeof(window.addEventListener)!="undefined"){window.addEventListener("mousemove",g._doOnMouseMoveStart,false);window.addEventListener("mouseup",g._doOnMouseMoveEnd,false)}else{document.body.attachEvent("onmousemove",g._doOnMouseMoveStart);document.body.attachEvent("onmouseup",g._doOnMouseMoveEnd)}}this.enableItem=function(){if(this.state){return}this.state=true;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_def"};this.disableItem=function(){if(!this.state){return}this.state=false;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_dis"};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setValue=function(n,o){n=Number(n);if(n<this.pen.valueMin){n=this.pen.valueMin}if(n>this.pen.valueMax){n=this.pen.valueMax}this.pen.valueNow=n;this.pen._definePos();if(o==true){j.callEvent("onValueChange",[this.obj.idd.replace(j.idPrefix,""),this.pen.valueNow])}};this.getValue=function(){return this.pen.valueNow};this.setMinValue=function(o,n){o=Number(o);if(o>this.pen.valueMax){return}this.obj.childNodes[0].innerHTML=n;this.obj.childNodes[0].style.display=(n.length>0?"":"none");this.pen.valueMin=o;if(this.pen.valueNow<this.pen.valueMin){this.pen.valueNow=this.pen.valueMin}this.pen._detectLimits();this.pen._definePos()};this.setMaxValue=function(o,n){o=Number(o);if(o<this.pen.valueMin){return}this.obj.childNodes[4].innerHTML=n;this.obj.childNodes[4].style.display=(n.length>0?"":"none");this.pen.valueMax=o;if(this.pen.valueNow>this.pen.valueMax){this.pen.valueNow=this.pen.valueMax}this.pen._detectLimits();this.pen._definePos()};this.getMinValue=function(){var n=this.obj.childNodes[0].innerHTML;var o=this.pen.valueMin;return new Array(o,n)};this.getMaxValue=function(){var n=this.obj.childNodes[4].innerHTML;var o=this.pen.valueMax;return new Array(o,n)};this.setItemToolTipTemplate=function(n){this.label.tip=n};this.getItemToolTipTemplate=function(){return this.label.tip};return this};dhtmlXToolbarObject.prototype.unload=function(){if(this.conf.isIPad){document.removeEventListener("touchstart",this._doOnClick,false)}else{if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousedown",this._doOnClick,false)}else{document.body.detachEvent("onmousedown",this._doOnClick)}}this._doOnClick=null;this.clearAll();this.objPull=null;if(this._xmlLoader){this._xmlLoader.destructor();this._xmlLoader=null}while(this.base.childNodes.length>0){this.base.removeChild(this.base.childNodes[0])}this.cont.removeChild(this.base);this.base=null;while(this.cont.childNodes.length>0){this.cont.removeChild(this.cont.childNodes[0])}this.cont.className="";this.cont=null;window.dhx4._enableDataLoading(this,null,null,null,"clear");window.dhx4._eventable(this,"clear");this.tX1=null;this.tX2=null;this.tY1=null;this.tY2=null;this.anyUsed=null;this.idPrefix=null;this.rootTypes=null;this._rtl=null;this._rtlParseBtn=null;this.setRTL=null;this._sbw=null;this._getObj=null;this._addImgObj=null;this._setItemImage=null;this._clearItemImage=null;this._setItemText=null;this._getItemText=null;this._enableItem=null;this._disableItem=null;this._xmlParser=null;this._addItemToStorage=null;this._genStr=null;this._addItem=null;this._getPosition=null;this._setPosition=null;this._getIdByPosition=null;this._separatorObject=null;this._textObject=null;this._buttonObject=null;this._buttonSelectObject=null;this._buttonInputObject=null;this._buttonTwoStateObject=null;this._sliderObject=null;this._autoDetectVisibleArea=null;this._removeItem=null;this.setAlign=null;this.setSkin=null;this.setIconsPath=null;this.setIconPath=null;this.loadXML=null;this.loadXMLString=null;this.clearAll=null;this.addSpacer=null;this.removeSpacer=null;this.getType=null;this.getTypeExt=null;this.inArray=null;this.getParentId=null;this.addButton=null;this.addText=null;this.addButtonSelect=null;this.addButtonTwoState=null;this.addSeparator=null;this.addSlider=null;this.addInput=null;this.forEachItem=null;this.showItem=null;this.hideItem=null;this.isVisible=null;this.enableItem=null;this.disableItem=null;this.isEnabled=null;this.setItemText=null;this.getItemText=null;this.setItemToolTip=null;this.getItemToolTip=null;this.setItemImage=null;this.setItemImageDis=null;this.clearItemImage=null;this.clearItemImageDis=null;this.setItemState=null;this.getItemState=null;this.setItemToolTipTemplate=null;this.getItemToolTipTemplate=null;this.setValue=null;this.getValue=null;this.setMinValue=null;this.getMinValue=null;this.setMaxValue=null;this.getMaxValue=null;this.setWidth=null;this.getWidth=null;this.getPosition=null;this.setPosition=null;this.removeItem=null;this.addListOption=null;this.removeListOption=null;this.showListOption=null;this.hideListOption=null;this.isListOptionVisible=null;this.enableListOption=null;this.disableListOption=null;this.isListOptionEnabled=null;this.setListOptionPosition=null;this.getListOptionPosition=null;this.setListOptionText=null;this.getListOptionText=null;this.setListOptionToolTip=null;this.getListOptionToolTip=null;this.setListOptionImage=null;this.getListOptionImage=null;this.clearListOptionImage=null;this.forEachListOption=null;this.getAllListOptions=null;this.setListOptionSelected=null;this.getListOptionSelected=null;this.unload=null;this.setUserData=null;this.getUserData=null;this.setMaxOpen=null;this.items=null;this.conf=null};dhtmlXToolbarObject.prototype._autoDetectVisibleArea=function(){var a=window.dhx4.screenDim();this.tX1=a.left;this.tX2=a.right;this.tY1=a.top;this.tY2=a.bottom};dhtmlXToolbarObject.prototype._initObj=function(c){for(var a=0;a<c.length;a++){this._addItemToStorage(c[a])}if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype._xmlToJson=function(s){var n=[];var y=s.getElementsByTagName("toolbar");if(y!=null&&y[0]!=null){y=y[0];var D=["id","type","hidden","title","text","enabled","img","imgdis","action","openAll","renderSelect","mode","maxOpen","width","value","selected","length","textMin","textMax","toolTip","valueMin","valueMax","valueNow"];var g=["id","type","enabled","disabled","action","selected","img","text"];for(var c=0;c<y.childNodes.length;c++){if(y.childNodes[c].tagName=="item"){var m={};for(var A=0;A<D.length;A++){var j=y.childNodes[c].getAttribute(D[A]);if(j!=null){m[D[A]]=j}}for(var x=0;x<y.childNodes[c].childNodes.length;x++){if(y.childNodes[c].childNodes[x].tagName=="item"&&m.type=="buttonSelect"){var C={};for(var A=0;A<g.length;A++){var j=y.childNodes[c].childNodes[x].getAttribute(g[A]);if(j!=null){C[g[A]]=j}}var v=y.childNodes[c].childNodes[x].getElementsByTagName("itemText");if(v!=null&&v[0]!=null){C.itemText=v[0].firstChild.nodeValue}var o=y.childNodes[c].childNodes[x].getElementsByTagName("userdata");for(var A=0;A<o.length;A++){if(!C.userdata){C.userdata={}}var a={};try{a.name=o[A].getAttribute("name")}catch(l){a.name=null}try{a.value=o[A].firstChild.nodeValue}catch(l){a.value=""}if(a.name!=null){C.userdata[a.name]=a.value}}if(m.options==null){m.options=[]}m.options.push(C)}if(y.childNodes[c].childNodes[x].tagName=="userdata"){if(m.userdata==null){m.userdata={}}var C={};try{C.name=y.childNodes[c].childNodes[x].getAttribute("name")}catch(l){C.name=null}try{C.value=y.childNodes[c].childNodes[x].firstChild.nodeValue}catch(l){C.value=""}if(C.name!=null){m.userdata[C.name]=C.value}}}n.push(m)}}}return n};dhtmlXToolbarObject.prototype._addItemToStorage=function(m,o){var n=(m.id||this._genStr(24));var j=(m.type||"");if(j=="spacer"){this.addSpacer(this._lastId)}else{this._lastId=n}if(j!=""&&this["_"+j+"Object"]!=null){if(j=="buttonSelect"){if(m.options!=null){for(var l=0;l<m.options.length;l++){if(m.options[l].type=="obj"){m.options[l].type="button"}if(m.options[l].type=="sep"){m.options[l].type="separator"}}}}if(j=="slider"){var g={tip_template:"toolTip",value_min:"valueMin",value_max:"valueMax",value_now:"valueNow",text_min:"textMin",text_max:"textMax"};for(var c in g){if(m[g[c]]==null&&m[c]!=null){m[g[c]]=m[c]}}}if(j=="buttonInput"){if(m.value==null&&m.text!=null){m.value=m.text}}if(j=="buttonTwoState"){if(typeof(m.selected)=="undefined"&&typeof(m.pressed)!="undefined"&&window.dhx4.s2b(m.pressed)){m.selected=true}}if(typeof(m.enabled)=="undefined"&&typeof(m.disabled)!="undefined"&&window.dhx4.s2b(m.disabled)){m.enabled=false}if(m.imgDis==null&&m.img_disabled!=null){m.imgdis=m.img_disabled}if((typeof(m.openAll)=="undefined"||m.openAll==null)&&this.conf.skin=="dhx_terrace"){m.openAll=true}this.objPull[this.idPrefix+n]=new this["_"+j+"Object"](this,n,m);this.objPull[this.idPrefix+n]["type"]=j;this.setPosition(n,o)}if(m.userdata!=null){for(var c in m.userdata){this.setUserData(n,c,m.userdata[c])}}if(m.options!=null){for(var l=0;l<m.options.length;l++){if(m.options[l].userdata!=null){for(var c in m.options[l].userdata){this.setListOptionUserData(m.id,m.options[l].id,c,m.options[l].userdata[c])}}}}};dhtmlXToolbarObject.prototype.setSkin=function(l,g){if(g===true){this.cont.className=this.cont.className.replace(/dhxtoolbar_icons_\d{1,}/,"dhxtoolbar_icons_"+this.conf.iconSize)}else{this.conf.skin=l;if(this.conf.skin=="dhx_skyblue"){this.conf.sel_ofs_y=1}if(this.conf.skin=="dhx_web"){this.conf.sel_ofs_y=1;this.conf.sel_ofs_x=1}if(this.conf.skin=="dhx_terrace"){this.conf.sel_ofs_y=-1;this.conf.sel_ofs_x=0}this.cont.className="dhx_toolbar_"+this.conf.skin+" dhxtoolbar_icons_"+this.conf.iconSize}for(var c in this.objPull){var j=this.objPull[c];if(j.type=="slider"){j.pen._detectLimits();j.pen._definePos();j.label.className="dhx_toolbar_slider_label_"+this.conf.skin}if(j.type=="buttonSelect"){j.polygon.className="dhx_toolbar_poly_"+this.conf.skin+" dhxtoolbar_icons_"+this.conf.iconSize}}if(l=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype.setAlign=function(a){this.conf.align=(a=="right"?"right":"left");this.base.className=(a=="right"?"dhxtoolbar_float_right":"dhxtoolbar_float_left");if(this._spacer){this._spacer.className=(a=="right"?" dhxtoolbar_float_left":" dhxtoolbar_float_right")}};dhtmlXToolbarObject.prototype.setIconSize=function(a){this.conf.iconSize=({18:true,24:true,32:true,48:true}[a]?a:18);this.setSkin(this.conf.skin,true);this.callEvent("_onIconSizeChange",[this.conf.iconSize])};dhtmlXToolbarObject.prototype.setIconsPath=function(a){this.conf.icons_path=a};dhtmlXToolbarObject.prototype.setUserData=function(g,a,c){g=this.idPrefix+g;if(this.objPull[g]!=null){if(this.objPull[g].userData==null){this.objPull[g].userData={}}this.objPull[g].userData[a]=c}};dhtmlXToolbarObject.prototype.getUserData=function(c,a){c=this.idPrefix+c;if(this.objPull[c]!=null&&this.objPull[c].userData!=null){return this.objPull[c].userData[a]||null}return null};dhtmlXToolbarObject.prototype._isListOptionExists=function(a,g){if(this.objPull[this.idPrefix+a]==null){return false}var c=this.objPull[this.idPrefix+a];if(c.type!="buttonSelect"){return false}if(c._listOptions[g]==null){return false}return true};dhtmlXToolbarObject.prototype.setListOptionUserData=function(a,l,c,j){if(!this._isListOptionExists(a,l)){return}var g=this.objPull[this.idPrefix+a]._listOptions[l];if(g.userData==null){g.userData={}}g.userData[c]=j};dhtmlXToolbarObject.prototype.getListOptionUserData=function(a,j,c){if(!this._isListOptionExists(a,j)){return null}var g=this.objPull[this.idPrefix+a]._listOptions[j];if(!g.userData){return null}return(g.userData[c]?g.userData[c]:null)};dhtmlXToolbarObject.prototype._improveTerraceSkin=function(){if(this.conf.terrace_radius==null){this.conf.terrace_radius="3px"}var g=[];var j={separator:true,text:true};var m=[this.base];if(this._spacer!=null){m.push(this._spacer)}for(var o=0;o<m.length;o++){g[o]=[];for(var c=0;c<m[o].childNodes.length;c++){if(m[o].childNodes[c].idd!=null&&m[o].childNodes[c].style.display!="none"){var n=this.idPrefix+m[o].childNodes[c].idd;if(this.objPull[n]!=null&&this.objPull[n].obj==m[o].childNodes[c]){g[o].push({a:n,type:this.objPull[n].type,node:this.objPull[n][this.objPull[n].type=="buttonSelect"?"arw":"obj"]})}}}m[o]=null}for(var o=0;o<g.length;o++){for(var c=0;c<g[o].length;c++){var r=g[o][c];var s=false;var l=false;if(!j[r.type]){if(c==g[o].length-1||(g[o][c+1]!=null&&j[g[o][c+1].type])){s=true}if(c==0||(c-1>=0&&g[o][c-1]!=null&&j[g[o][c-1].type])){l=true}}r.node.style.borderRightWidth=(s?"1px":"0px");r.node.style.borderTopRightRadius=r.node.style.borderBottomRightRadius=(s?this.conf.terrace_radius:"0px");if(r.type=="buttonSelect"){r.node.previousSibling.style.borderTopLeftRadius=r.node.previousSibling.style.borderBottomLeftRadius=(l?this.conf.terrace_radius:"0px");r.node.previousSibling._br=s;r.node.previousSibling._bl=l}else{r.node.style.borderTopLeftRadius=r.node.style.borderBottomLeftRadius=(l?this.conf.terrace_radius:"0px")}r.node._br=s;r.node._bl=l}}for(var o=0;o<g.length;o++){for(var c=0;c<g[o].length;c++){for(var n in g[o][c]){g[o][c][n]=null}g[o][c]=null}g[o]=null}g=m=null};dhtmlXToolbarObject.prototype._improveTerraceButtonSelect=function(g,c){var a=this.objPull[g];if(c==true){a.obj.style.borderBottomLeftRadius=(a.obj._bl?this.conf.terrace_radius:"0px");a.arw.style.borderBottomRightRadius=(a.obj._br?this.conf.terrace_radius:"0px")}else{a.obj.style.borderBottomLeftRadius="0px";a.arw.style.borderBottomRightRadius="0px"}a=null};if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype._createNode_toolbar=function(l,c,j,a,g){if(typeof(g)!="undefined"){l=g}else{l=document.createElement("DIV");l.className="dhx_cell_toolbar_"+(this.conf.borders?"def":"no_borders");l.appendChild(document.createElement("DIV"));l.firstChild.className="dhx_toolbar_base_18_dhx_skyblue"}this.cell.insertBefore(l,this.cell.childNodes[this.conf.idx.cont]);this.conf.ofs_nodes.t.toolbar=true;this._updateIdx();return l};dhtmlXCellObject.prototype.attachToolbar=function(a){if(!(this.dataNodes.ribbon==null&&this.dataNodes.toolbar==null)){return}this.callEvent("_onBeforeContentAttach",["toolbar"]);if(typeof(a)=="undefined"){a={}}else{if(typeof(a)=="string"){a={skin:a}}}if(typeof(a.skin)=="undefined"){a.skin=this.conf.skin}a.parent=this._attachObject("toolbar").firstChild;this.dataNodes.toolbar=new dhtmlXToolbarObject(a);this._adjustCont(this._idd);this.dataNodes.toolbar._masterCell=this;this.dataNodes.toolbar.attachEvent("_onIconSizeChange",function(){this._masterCell._adjustCont()});a.parent=null;a=null;this.callEvent("_onContentAttach",[]);return this.dataNodes.toolbar};dhtmlXCellObject.prototype.detachToolbar=function(){if(!this.dataNodes.toolbar){return}this.dataNodes.toolbar._masterCell=null;this.dataNodes.toolbar.unload();this.dataNodes.toolbar=null;delete this.dataNodes.toolbar;this._detachObject("toolbar")};dhtmlXCellObject.prototype.showToolbar=function(){this._mtbShowHide("toolbar","")};dhtmlXCellObject.prototype.hideToolbar=function(){this._mtbShowHide("toolbar","none")};dhtmlXCellObject.prototype.getAttachedToolbar=function(){return this.dataNodes.toolbar}}function dhtmlXEditor(g,j){var c=this;this.conf={content:"",contentHTML:"",resizeTM:null,resizeTMTime:100,roMode:false,toolbar:false,iconsPath:"",evs:["focus","blur","keydown","keyup","keypress","mouseup","mousedown","click"]};this._doOnFocusChanged=null;this._doOnAccess=null;if(typeof(g)=="object"&&g!=null&&g.tagName==null){j=g.skin;if(g.content!=null){this.conf.content=g.content}if(g.contentHTML!=null){this.conf.contentHTML=g.contentHTML}if(g.iconsPath!=null){this.conf.iconsPath=g.iconsPath}if(g.toolbar!=null){this.conf.toolbar=window.dhx4.s2b(g.toolbar)}if(g.onFocusChanged!=null){this._doOnFocusChanged=g.onFocusChanged}if(g.onAccess!=null){this._doOnAccess=g.onAccess}g=g.parent}this.conf.skin=(j||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxeditor")||"dhx_skyblue");if(typeof(g)=="string"){g=document.getElementById(g)}this.base=g;this.base.className+=" dhxeditor_"+this.conf.skin;while(this.base.childNodes.length>0){this.base.removeChild(this.base.childNodes[0])}var l=(window.dhx4.isIE?this.base.currentStyle.position:window.getComputedStyle(this.base,null).getPropertyValue("position"));if(!(l=="relative"||l=="absolute")){this.base.style.position="relative"}this.cell=new dhtmlXEditorCell(window.dhx4.newId(),this);this.base.appendChild(this.cell.cell);this.cBlock=document.createElement("DIV");this.cBlock.className="dhxcont_content_blocker";this.cBlock.style.display="none";this.base.appendChild(this.cBlock);this.editor=document.createElement("IFRAME");this.editor.className="dhxeditor_mainiframe";this.editor.frameBorder=0;if(window.dhx4.isOpera){this.editor.scrolling="yes"}this.setSizes();var a=this.editor;if(typeof(window.addEventListener)!="undefined"){a.onload=function(){for(var m=0;m<c.conf.evs.length;m++){a.contentWindow.addEventListener(c.conf.evs[m],c._ev,false)}}}else{a.onreadystatechange=function(m){if(typeof(a.readyState)!="undefined"&&a.readyState=="complete"){try{for(var n=0;n<c.conf.evs.length;n++){a.contentWindow.document.body.attachEvent("on"+c.conf.evs[n],c._ev)}}catch(o){}}}}this._ev=function(n){n=n||event;var m=n.type;c.callEvent("onAccess",[m,n]);if(typeof(c._doOnAccess)=="function"){c._doOnAccess(m,n)}else{if(typeof(c._doOnAccess)=="string"&&typeof(window[c._doOnAccess])=="function"){window[c._doOnAccess](m,n)}}};this._focus=function(){if(window.dhx4.isIE){this.editor.contentWindow.document.body.focus()}else{this.editor.contentWindow.focus()}};this.cell.attachObject(this.editor);this.edWin=this.editor.contentWindow;this.edDoc=this.edWin.document;this._prepareContent=function(o,r){var n="";if(o===true&&this.getContent!=null){n=this.getContent()}var m=this.editor.contentWindow.document;m.open("text/html","replace");if(window.dhx4.isOpera){m.write("<html><head><style> html, body { overflow:auto;-webkit-overflow-scrolling: touch; padding:0px; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color:#ffffff;} </style></head><body "+(r!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>")}else{if(window.dhx4.isKHTML){m.write("<html><head><style> html {overflow-x: auto;-webkit-overflow-scrolling: touch; overflow-y: auto;} body { overflow: auto; overflow-y: scroll;} html,body { padding:0px; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color:#ffffff;} </style></head><body "+(r!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>")}else{if(window.dhx4.isIE){m.write("<html><head><style> html {overflow-y: auto;} body {overflow-y: scroll;-webkit-overflow-scrolling: touch;} html,body { overflow-x: auto; padding:0px; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color: #ffffff; outline: none;} </style></head><body "+(r!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>")}else{m.write("<html><head><style> html,body { overflow-x: auto; overflow-y:-webkit-overflow-scrolling: touch; scroll; padding:0px; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color:#ffffff;} </style></head><body "+(r!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>")}}}m.close();if(window.dhx4.isIE){m.contentEditable=(r!==true)}else{m.designMode=(r!==true?"On":"Off")}if(window.dhx4.isFF){try{m.execCommand("useCSS",false,true)}catch(q){}}if(o===true&&this.setContent!=null){this.setContent(n)}};this._prepareContent();this._doOnResize=function(){window.clearTimeout(c.conf.resizeTM);c.conf.resizeTM=window.setTimeout(function(){if(c.setSizes){c.setSizes()}},c.conf.resizeTMTime)};this._runCommand=function(o,r){if(this.conf.roMode===true){return}if(arguments.length<2){r=null}if(window.dhx4.isIE){this.edWin.focus()}try{var n=this.editor.contentWindow.document;n.execCommand(o,false,r)}catch(q){}if(window.dhx4.isIE){this.edWin.focus();var m=this;window.setTimeout(function(){m.edWin.focus();m=null},1)}};this.applyBold=function(){this._runCommand("Bold")};this.applyItalic=function(){this._runCommand("Italic")};this.applyUnderscore=function(){this._runCommand("Underline")};this.clearFormatting=function(){this._runCommand("RemoveFormat");var m=this.getContent();m=m.replace(/<\/?h\d>/gi,"");this.setContent(m)};this._doOnClick=function(o){var n=o||window.event;var m=n.target||n.srcElement;c._showInfo(m)};this._doOnMouseDown=function(o){var n=o||window.event;var m=n.target||n.srcElement;c._showInfo(m)};this._doOnKeyUp=function(q){var o=q||window.event;var m=o.keyCode;var n=o.target||o.srcElement;if({37:1,38:1,39:1,40:1,13:1}[m]==1){c._showInfo(n)}};this._getParentByTag=function(m,o){o=o.toLowerCase();var n=m;do{if(o==""||n.nodeName.toLowerCase()==o){return n}}while(n=n.parentNode);return m};this._isStyleProperty=function(o,r,m,q){r=r.toLowerCase();var s=o;do{if((s.nodeName.toLowerCase()==r)&&(s.style[m]==q)){return true}}while(s=s.parentNode);return false};this._setStyleProperty=function(m,q){this.style[q]=false;var o=this._getParentByTag(m,q);if(o&&(o.tagName.toLowerCase()==q)){this.style[q]=true}if(q=="del"&&this._getParentByTag(m,"strike")&&this._getParentByTag(m,"strike").tagName.toLowerCase()=="strike"){this.style.del=true}};this._showInfo=function(n){var n=(this._getSelectionBounds().end)?this._getSelectionBounds().end:n;if(!n||!this._setStyleProperty){return}try{if(this.edWin.getComputedStyle){var m=this.edWin.getComputedStyle(n,null);var o=((m.getPropertyValue("font-weight")==401)?700:m.getPropertyValue("font-weight"));this.style={fontStyle:m.getPropertyValue("font-style"),fontSize:m.getPropertyValue("font-size"),textDecoration:m.getPropertyValue("text-decoration"),fontWeight:o,fontFamily:m.getPropertyValue("font-family"),textAlign:m.getPropertyValue("text-align")};if(window.dhx4.isKHTML){this.style.fontStyle=m.getPropertyValue("font-style");this.style.vAlign=m.getPropertyValue("vertical-align");this.style.del=this._isStyleProperty(n,"span","textDecoration","line-through");this.style.u=this._isStyleProperty(n,"span","textDecoration","underline")}}else{var m=n.currentStyle;this.style={fontStyle:m.fontStyle,fontSize:m.fontSize,textDecoration:m.textDecoration,fontWeight:m.fontWeight,fontFamily:m.fontFamily,textAlign:m.textAlign}}this._setStyleProperty(n,"h1");this._setStyleProperty(n,"h2");this._setStyleProperty(n,"h3");this._setStyleProperty(n,"h4");if(!window.dhx4.isKHTML){this._setStyleProperty(n,"del");this._setStyleProperty(n,"sub");this._setStyleProperty(n,"sup");this._setStyleProperty(n,"u")}this.callEvent("onFocusChanged",[this.style,m])}catch(q){return null}};this._getSelectionBounds=function(){var r,o,u,n;if(this.edWin.getSelection){var s=this.edWin.getSelection();r=s.getRangeAt(s.rangeCount-1);u=r.startContainer;n=r.endContainer;o=r.commonAncestorContainer;if(u.nodeName=="#text"){o=o.parentNode}if(u.nodeName=="#text"){u=u.parentNode}if(u.nodeName.toLowerCase()=="body"){u=u.firstChild}if(n.nodeName=="#text"){n=n.parentNode}if(n.nodeName.toLowerCase()=="body"){n=n.lastChild}if(u==n){o=u}return{root:o,start:u,end:n}}else{if(this.edWin.document.selection){r=this.edDoc.selection.createRange();if(!r.duplicate){return null}o=r.parentElement();var q=r.duplicate();var m=r.duplicate();q.collapse(true);m.moveToElementText(q.parentElement());m.setEndPoint("EndToStart",q);u=q.parentElement();q=r.duplicate();m=r.duplicate();m.collapse(false);q.moveToElementText(m.parentElement());q.setEndPoint("StartToEnd",m);n=m.parentElement();if(u.nodeName.toLowerCase()=="body"){u=u.firstChild}if(n.nodeName.toLowerCase()=="body"){n=n.lastChild}if(u==n){o=u}return{root:o,start:u,end:n}}}return null};this.getContent=function(){if(!this.edDoc.body){return""}else{if(window.dhx4.isFF){return this.editor.contentWindow.document.body.innerHTML.replace(/<\/{0,}br\/{0,}>\s{0,}$/gi,"")}if(window.dhx4.isIE&&this.edDoc.body.innerText.length==0){return""}return this.edDoc.body.innerHTML}};this.setContent=function(o){o=o||"";if(this.edDoc.body){var n=false;if(window.dhx4.isFF){var m=navigator.userAgent.match(/Firefox\/(\d*)/);n=(m!=null&&m[1]<28)}if(n){if(typeof(this.conf.ffTest)=="undefined"){this.editor.contentWindow.document.body.innerHTML="";this._runCommand("InsertHTML","test");this.conf.ffTest=(this.editor.contentWindow.document.body.innerHTML.length>0)}if(this.conf.ffTest){this.editor.contentWindow.document.body.innerHTML=o}else{this.editor.contentWindow.document.body.innerHTML="";if(o.length==0){o=" "}this._runCommand("InsertHTML",o)}}else{this.editor.contentWindow.document.body.innerHTML=o}this.callEvent("onContentSet",[])}else{if(!this.conf.firstLoadEv){this.conf.firstLoadEv=true;this.conf.firstLoadData=o;this._onFirstLoad=function(){c.setContent(c.conf.firstLoadData);if(typeof(window.addEventListener)=="function"){c.edWin.removeEventListener("load",c._onFirstLoad,false)}else{c.edWin.detachEvent("onload",c._onFirstLoad)}c.conf.firstLoadData=null;c.conf.firstLoadEv=false;c._onFirstLoad=null};if(typeof(window.addEventListener)=="function"){this.edWin.addEventListener("load",this._onFirstLoad,false)}else{this.edWin.attachEvent("onload",this._onFirstLoad)}}}};this.setContentHTML=function(m){window.dhx4.ajax.get(m,function(n){if(n.xmlDoc.responseText!=null){c.setContent(n.xmlDoc.responseText)}})};window.dhx4._eventable(this);this.attachEvent("onFocusChanged",function(m){if(typeof(this._doOnFocusChanged)=="function"){this._doOnFocusChanged(m)}else{if(typeof(this._doOnFocusChanged)=="string"&&typeof(window[this._doOnFocusChanged])=="function"){window[this._doOnFocusChanged](m)}}});if(typeof(window.addEventListener)=="function"){window.addEventListener("resize",this._doOnResize,false);this.edDoc.addEventListener("click",this._doOnClick,false);this.edDoc.addEventListener("keyup",this._doOnKeyUp,false);if(window.dhx4.isOpera){this.edDoc.addEventListener("mousedown",this._doOnMouseDown,false)}}else{window.attachEvent("onresize",this._doOnResize);this.edDoc.attachEvent("onclick",this._doOnClick);this.edDoc.attachEvent("onkeyup",this._doOnKeyUp)}this.unload=function(){if(typeof(window.addEventListener)=="function"){window.removeEventListener("resize",this._doOnResize,false);this.edDoc.removeEventListener("click",this._doOnClick,false);this.edDoc.removeEventListener("keyup",this._doOnKeyUp,false);if(window.dhx4.isOpera){this.edDoc.removeEventListener("mousedown",this._doOnMouseDown,false)}for(var m=0;m<c.conf.evs.length;m++){a.contentWindow.removeEventListener(c.conf.evs[m],c._ev,false)}}else{window.detachEvent("onresize",this._doOnResize,false);this.edDoc.detachEvent("onclick",this._doOnClick);this.edDoc.detachEvent("onkeyup",this._doOnKeyUp);for(var m=0;m<c.conf.evs.length;m++){a.contentWindow.document.body.detachEvent("on"+c.conf.evs[m],c._ev)}}this._doOnAccess=null;this._doOnFocusChanged=null;if(typeof(window.addEventListener)=="function"){this.editor.onload=null}else{this.editor.onreadystatechange=null}this.editor.parentNode.removeChild(this.editor);this.editor=null;this.edDoc=null;this.edWin=null;this.cell._unload();this.cell=null;this.tb=null;window.dhx4._eventable(this,"clear");this.cBlock.parentNode.removeChild(this.cBlock);this.cBlock=null;this.base.className=String(this.base.className).replace(new RegExp("\\s{0,}dhxeditor_"+this.conf.skin),"");while(this.base.childNodes.length>0){this.base.removeChild(this.base.childNodes[0])}this.base=null;this._doOnClick=null;this._doOnKeyUp=null;this._doOnMouseDown=null;this._ev=null;this._focus=null;this._prepareContent=null;this._doOnResize=null;this.setIconsPath=null;this.init=null;this.setSizes=null;this._runCommand=null;this.applyBold=null;this.applyItalic=null;this.applyUnderscore=null;this.clearFormatting=null;this._showInfo=null;this._getSelectionBounds=null;this.getContent=null;this.setContent=null;this.setContentHTML=null;this.setReadonly=null;this.isReadonly=null;this.unload=null;c=a=null};if(this.conf.toolbar==true&&typeof(this.attachToolbar)=="function"&&typeof(window.dhtmlXToolbarObject)=="function"){this.attachToolbar(this.conf.iconsPath)}this.setIconsPath=function(m){this.conf.iconsPath=m};if(this.conf.content.length>0){this.setContent(this.conf.content);this.conf.content=""}else{if(this.conf.contentHTML.length>0){this.setContentHTML(this.conf.contentHTML);this.conf.contentHTML=""}}return this}dhtmlXEditor.prototype.setSizes=function(){this.cell._setSize(0,0,this.base.clientWidth,this.base.clientHeight);if(this.editor!=null){this.editor.style.left="5px";this.editor.style.width=this.base.clientWidth-5+"px"}};dhtmlXEditor.prototype.setReadonly=function(a){this.conf.roMode=(a===true);this._prepareContent(true,this.conf.roMode);this.cBlock.style.display=(this.conf.roMode?"":"none")};dhtmlXEditor.prototype.isReadonly=function(a){return(this.conf.roMode||false)};dhtmlXEditor.prototype.setSkin=function(a){this.base.className=String(this.base.className).replace(new RegExp("dhxeditor_"+this.conf.skin),"dhxeditor_"+a);this.conf.skin=this.cell.conf.skin=a;if(this.tb){this.cell.detachToolbar(a);this.tb=null;this.attachToolbar()}this.setSizes()};window.dhtmlXEditorCell=function(g,a){dhtmlXCellObject.apply(this,[g,"_editor"]);var c=this;this.editor=a;this.conf.skin=this.editor.conf.skin;this.attachEvent("_onCellUnload",function(){this._stbUnload();this.editor=null;c=null});this._stbInit();return this};dhtmlXEditorCell.prototype=new dhtmlXCellObject();dhtmlXEditorCell.prototype._stbInit=function(){var m=this;var l=document.createElement("DIV");l.className="dhx_cell_stb";this.cell.insertBefore(l,this.cell.childNodes[this.conf.idx.cont]);l.onselectstart=function(a){a=a||event;a.cancelBubble=true;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};var j={bold:"applyBold",italic:"applyItalic",underline:"applyUnderscore",clearformat:"clearFormatting"};for(var g in j){var c=document.createElement("A");c.href="javascript:void(0);";c.tabIndex=-1;l.appendChild(c);c.onmousedown=c.onclick=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};var n=document.createElement("DIV");n.className="dhx_cell_stb_button btn_"+g;n._actv=g.charAt(0);n._cmd=j[g];c.appendChild(n);n.onclick=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};n.onmousedown=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}m.editor[this._cmd]();m.editor.callEvent("onToolbarClick",[this._actv])};n=c=null}l=null;this._stbUnload=function(){var a=this.cell.childNodes[this.conf.idx.stb];a.onselectstart=null;while(a.childNodes.length>0){a.lastChild.onmousedown=a.lastChild.onclick=null;a.lastChild.firstChild.onmousedown=a.lastChild.firstChild.onclick=null;a.lastChild.firstChild._actv=a.lastChild.firstChild._cmd=null;a.lastChild.removeChild(a.lastChild.firstChild);a.removeChild(a.lastChild)}a.parentNode.removeChild(a);a=m=null;this.conf.idx_data.stb=this.conf.ofs_nodes.t._getStbHeight=null;delete this.conf.ofs_nodes.t._getStbHeight;delete this.conf.idx_data.stb;this._updateIdx()};this.conf.ofs_nodes.t._getStbHeight="func";this.conf.idx_data.stb="dhx_cell_stb";this._updateIdx()};dhtmlXEditorCell.prototype._stbHide=function(){this.cell.childNodes[this.conf.idx.stb].style.display="none"};dhtmlXEditorCell.prototype._getStbHeight=function(){return this.cell.childNodes[this.conf.idx.stb].offsetHeight};dhtmlXCellObject.prototype.attachEditor=function(a){this.callEvent("_onBeforeContentAttach",["editor"]);var g=document.createElement("DIV");g.style.width="100%";g.style.height="100%";g.style.position="relative";g.style.overflow="hidden";this._attachObject(g);if(!(typeof(a)=="object"&&a!=null)){a={}}a.parent=g;this.dataType="editor";this.dataObj=new dhtmlXEditor(a);g=null;a.parent=null;a=null;if(typeof(window.dhtmlXPortalCell)!="undefined"&&this instanceof window.dhtmlXPortalCell){if(this.portal.conf.editor_ev==null){var j=this.portal.attachEvent("onBeforeDrag",function(l){if(this.cdata[l].dataType=="editor"){this.cdata[l].conf.editor_cont=this.cdata[l].dataObj.getContent()}return true});var c=this.portal.attachEvent("onDrop",function(l){if(this.cdata[l].dataType=="editor"){this.cdata[l].dataObj.setContent(this.cdata[l].conf.editor_cont);this.cdata[l].dataObj._prepareContent(true);this.cdata[l].conf.editor_cont=null}});this.portal.conf.editor_ev=[j,c]}this.conf.editor_ev=this.attachEvent("_onBeforeContentDetach",function(){this.detachEvent(this.conf.editor_ev);this.conf.editor_ev=null;if(this instanceof window.dhtmlXPortalCell){var m=false;for(var l in this.portal.cdata){if(this.portal.cdata[l]!=this&&this.portal.cdata[l].dataType=="editor"){m=true}}if(m==false){for(var n=0;n<this.portal.conf.editor_ev.length;n++){this.portal.detachEvent(this.portal.conf.editor_ev[n])}this.portal.conf.editor_ev=null}}})}this.callEvent("_onContentAttach",[]);return this.dataObj};dhtmlXEditor.prototype.attachToolbar=function(c){if(this.tb!=null){return}if(c!=null){this.conf.iconsPath=c}this.cell._stbHide();this.tb=this.cell.attachToolbar({icons_path:this.conf.iconsPath+"/dhxeditor_"+String(this.conf.skin).replace(/^dhx_/,"")+"/",skin:this.conf.skin});this.setSizes();this._availFonts=new Array("Arial","Arial Narrow","Comic Sans MS","Courier","Georgia","Impact","Tahoma","Times New Roman","Verdana");this._initFont=this._availFonts[0];this._xmlFonts="";for(var m=0;m<this._availFonts.length;m++){var j=String(this._availFonts[m]).replace(/\s/g,"_");this._xmlFonts+='<item type="button" id="applyFontFamily:'+j+'"><itemText><![CDATA[<img src="'+this.tb.imagePath+"font_"+String(j).toLowerCase()+'.gif" border="0" style="/*margin-top:1px;margin-bottom:1px;*/width:110px;height:16px;">]]></itemText></item>'}this._availSizes={"1":"8pt","2":"10pt","3":"12pt","4":"14pt","5":"18pt","6":"24pt","7":"36pt"};this._xmlSizes="";for(var g in this._availSizes){this._xmlSizes+='<item type="button" id="applyFontSize:'+g+":"+this._availSizes[g]+'" text="'+this._availSizes[g]+'"/>'}this.tbXML='<toolbar><item id="applyH1" type="buttonTwoState" img="h1.gif" imgdis="h4_dis.gif" title="H1"/><item id="applyH2" type="buttonTwoState" img="h2.gif" imgdis="h4_dis.gif" title="H2"/><item id="applyH3" type="buttonTwoState" img="h3.gif" imgdis="h4_dis.gif" title="H3"/><item id="applyH4" type="buttonTwoState" img="h4.gif" imgdis="h4_dis.gif" title="H4"/><item id="separ01" type="separator"/><item id="applyBold" type="buttonTwoState" img="bold.gif" imgdis="bold_dis.gif" title="Bold Text"/><item id="applyItalic" type="buttonTwoState" img="italic.gif" imgdis="italic_dis.gif" title="Italic Text"/><item id="applyUnderscore" type="buttonTwoState" img="underline.gif" imgdis="underline_dis.gif" title="Underscore Text"/><item id="applyStrikethrough" type="buttonTwoState" img="strike.gif" imgdis="strike_dis.gif" title="Strikethrough Text"/><item id="separ02" type="separator"/><item id="alignLeft" type="buttonTwoState" img="align_left.gif" imgdis="align_left_dis.gif" title="Left Alignment"/><item id="alignCenter" type="buttonTwoState" img="align_center.gif" imgdis="align_center_dis.gif" title="Center Alignment"/><item id="alignRight" type="buttonTwoState" img="align_right.gif" imgdis="align_right_dis.gif" title="Right Alignment"/><item id="alignJustify" type="buttonTwoState" img="align_justify.gif" title="Justified Alignment"/><item id="separ03" type="separator"/><item id="applySub" type="buttonTwoState" img="script_sub.gif" imgdis="script_sub.gif" title="Subscript"/><item id="applySuper" type="buttonTwoState" img="script_super.gif" imgdis="script_super_dis.gif" title="Superscript"/><item id="separ04" type="separator"/><item id="createNumList" type="button" img="list_number.gif" imgdis="list_number_dis.gif" title="Number List"/><item id="createBulList" type="button" img="list_bullet.gif" imgdis="list_bullet_dis.gif" title="Bullet List"/><item id="separ05" type="separator"/><item id="increaseIndent" type="button" img="indent_inc.gif" imgdis="indent_inc_dis.gif" title="Increase Indent"/><item id="decreaseIndent" type="button" img="indent_dec.gif" imgdis="indent_dec_dis.gif" title="Decrease Indent"/><item id="separ06" type="separator"/><item id="clearFormatting" type="button" img="clear.gif" title="Clear Formatting"/></toolbar>';this.tb.loadStruct(this.tbXML);this._checkAlign=function(a){this.tb.setItemState("alignCenter",false);this.tb.setItemState("alignRight",false);this.tb.setItemState("alignJustify",false);this.tb.setItemState("alignLeft",false);if(a){this.tb.setItemState(a,true)}};this._checkH=function(a){this.tb.setItemState("applyH1",false);this.tb.setItemState("applyH2",false);this.tb.setItemState("applyH3",false);this.tb.setItemState("applyH4",false);if(a){this.tb.setItemState(a,true)}};this._doOnFocusChanged=function(o){if(!o.h1&&!o.h2&&!o.h3&&!o.h4){var a=(String(o.fontWeight).search(/bold/i)!=-1)||(Number(o.fontWeight)>=700);this.tb.setItemState("applyBold",a)}else{this.tb.setItemState("applyBold",false)}var n="alignLeft";if(String(o.textAlign).search(/center/)!=-1){n="alignCenter"}if(String(o.textAlign).search(/right/)!=-1){n="alignRight"}if(String(o.textAlign).search(/justify/)!=-1){n="alignJustify"}this.tb.setItemState(n,true);this._checkAlign(n);this.tb.setItemState("applyH1",o.h1);this.tb.setItemState("applyH2",o.h2);this.tb.setItemState("applyH3",o.h3);this.tb.setItemState("applyH4",o.h4);if(window._KHTMLrv){o.sub=(o.vAlign=="sub");o.sup=(o.vAlign=="super")}this.tb.setItemState("applyItalic",(o.fontStyle=="italic"));this.tb.setItemState("applyStrikethrough",o.del);this.tb.setItemState("applySub",o.sub);this.tb.setItemState("applySuper",o.sup);this.tb.setItemState("applyUnderscore",o.u)};this._doOnToolbarClick=function(n){var a=String(n).split(":");if(this[a[0]]!=null){if(typeof(this[a[0]])=="function"){this[a[0]](a[1]);this.callEvent("onToolbarClick",[n])}}};this._doOnStateChange=function(n,a){this[n]();switch(n){case"alignLeft":case"alignCenter":case"alignRight":case"alignJustify":this._checkAlign(n);break;case"applyH1":case"applyH2":case"applyH3":case"applyH4":this._checkH(n);break}this.callEvent("onToolbarClick",[n])};this._doOnBeforeStateChange=function(n,a){if((n=="alignLeft"||n=="alignCenter"||n=="alignRight"||n=="alignJustify")&&a==true){return false}return true};var l=this;this.tb.attachEvent("onClick",function(a){l._doOnToolbarClick(a)});this.tb.attachEvent("onStateChange",function(n,a){l._doOnStateChange(n,a)});this.tb.attachEvent("onBeforeStateChange",function(n,a){return l._doOnBeforeStateChange(n,a)});this.applyBold=function(){this._runCommand("Bold")};this.applyItalic=function(){this._runCommand("Italic")};this.applyUnderscore=function(){this._runCommand("Underline")};this.applyStrikethrough=function(){this._runCommand("StrikeThrough")};this.alignLeft=function(){this._runCommand("JustifyLeft")};this.alignRight=function(){this._runCommand("JustifyRight")};this.alignCenter=function(){this._runCommand("JustifyCenter")};this.alignJustify=function(){this._runCommand("JustifyFull")};this.applySub=function(){this._runCommand("Subscript")};this.applySuper=function(){this._runCommand("Superscript")};this.applyH1=function(){this._runCommand("FormatBlock","<H1>")};this.applyH2=function(){this._runCommand("FormatBlock","<H2>")};this.applyH3=function(){this._runCommand("FormatBlock","<H3>")};this.applyH4=function(){this._runCommand("FormatBlock","<H4>")};this.createNumList=function(){this._runCommand("InsertOrderedList")};this.createBulList=function(){this._runCommand("InsertUnorderedList")};this.increaseIndent=function(){this._runCommand("Indent")};this.decreaseIndent=function(){this._runCommand("Outdent")};this.clearFormatting=function(){this._runCommand("RemoveFormat");this.tb.setItemState("applyBold",false);this.tb.setItemState("applyItalic",false);this.tb.setItemState("applyStrikethrough",false);this.tb.setItemState("applySub",false);this.tb.setItemState("applySuper",false);this.tb.setItemState("applyUnderscore",false);var a=this.getContent();a=a.replace(/<\/?h\d>/gi,"");this.setContent(a)}};dhtmlx.Group={_init:function(){dhtmlx.assert(this.data,"DataStore required for grouping");this.data.attachEvent("onStoreLoad",dhtmlx.bind(function(){if(this._settings.group){this.group(this._settings.group,false)}},this));this.attachEvent("onBeforeRender",dhtmlx.bind(function(a){if(this._settings.sort){a.block();a.sort(this._settings.sort);a.unblock()}},this));this.data.attachEvent("onClearAll",dhtmlx.bind(function(){this.data._not_grouped_order=this.data._not_grouped_pull=null},this));this.attachEvent("onBeforeSort",dhtmlx.bind(function(){this._settings.sort=null},this))},_init_group_data_event:function(c,a){c.attachEvent("onClearAll",dhtmlx.bind(function(){this.ungroup(false);this.block();this.clearAll();this.unblock()},a))},sum:function(c,a){c=dhtmlx.Template.setter(c);a=a||this.data;var g=0;a.each(function(j){g+=c(j)*1});return g},min:function(g,c){g=dhtmlx.Template.setter(g);c=c||this.data;var a=Infinity;c.each(function(j){if(g(j)*1<a){a=g(j)*1}});return a*1},max:function(g,c){g=dhtmlx.Template.setter(g);c=c||this.data;var a=-Infinity;c.each(function(j){if(g(j)*1>a){a=g(j)*1}});return a},_split_data_by:function(m){var o=function(s,r){s=dhtmlx.Template.setter(s);return s(r[0])};var q=dhtmlx.Template.setter(m.by);if(!m.map[q]){m.map[q]=[q,o]}var g={};var n=[];this.data.each(function(r){var s=q(r);if(!g[s]){n.push({id:s});g[s]=dhtmlx.toArray()}g[s].push(r)});for(var a in m.map){var l=(m.map[a][1]||o);if(typeof l!="function"){l=this[l]}for(var j=0;j<n.length;j++){n[j][a]=l.call(this,m.map[a][0],g[n[j].id])}}this.data._not_grouped_order=this.data.order;this.data._not_grouped_pull=this.data.pull;this.data.order=dhtmlx.toArray();this.data.pull={};for(var j=0;j<n.length;j++){var c=this.data.id(n[j]);this.data.pull[c]=n[j];this.data.order.push(c)}this.callEvent("onStoreUpdated",[])},group:function(a,c){this.ungroup(false);this._split_data_by(a);if(c!==false){this.data.callEvent("onStoreUpdated",[])}},ungroup:function(a){if(this.data._not_grouped_order){this.data.order=this.data._not_grouped_order;this.data.pull=this.data._not_grouped_pull;this.data._not_grouped_pull=this.data._not_grouped_order=null}if(a!==false){this.data.callEvent("onStoreUpdated",[])}},group_setter:function(a){dhtmlx.assert(typeof a=="object","Incorrect group value");dhtmlx.assert(a.by,"group.by is mandatory");dhtmlx.assert(a.map,"group.map is mandatory");return a},sort_setter:function(a){if(typeof a!="object"){a={by:a}}this._mergeSettings(a,{as:"string",dir:"asc"});return a}};dhtmlx.Date={Locale:{month_full:["January","February","March","April","May","June","July","August","September","October","November","December"],month_short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],day_full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},date_part:function(a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);return a},time_part:function(a){return(a.valueOf()/1000-a.getTimezoneOffset()*60)%86400},week_start:function(c){var a=c.getDay();if(this.config.start_on_monday){if(a===0){a=6}else{a--}}return this.date_part(this.add(c,-1*a,"day"))},month_start:function(a){a.setDate(1);return this.date_part(a)},year_start:function(a){a.setMonth(0);return this.month_start(a)},day_start:function(a){return this.date_part(a)},add:function(c,g,j){var a=new Date(c.valueOf());switch(j){case"day":a.setDate(a.getDate()+g);break;case"week":a.setDate(a.getDate()+7*g);break;case"month":a.setMonth(a.getMonth()+g);break;case"year":a.setYear(a.getFullYear()+g);break;case"hour":a.setHours(a.getHours()+g);break;case"minute":a.setMinutes(a.getMinutes()+g);break;default:return dhtmlx.Date["add_"+j](c,g,j)}return a},to_fixed:function(a){if(a<10){return"0"+a}return a},copy:function(a){return new Date(a.valueOf())},date_to_str:function(c,a){c=c.replace(/%[a-zA-Z]/g,function(g){switch(g){case"%d":return'"+dhtmlx.Date.to_fixed(date.getDate())+"';case"%m":return'"+dhtmlx.Date.to_fixed((date.getMonth()+1))+"';case"%j":return'"+date.getDate()+"';case"%n":return'"+(date.getMonth()+1)+"';case"%y":return'"+dhtmlx.Date.to_fixed(date.getFullYear()%100)+"';case"%Y":return'"+date.getFullYear()+"';case"%D":return'"+dhtmlx.Date.Locale.day_short[date.getDay()]+"';case"%l":return'"+dhtmlx.Date.Locale.day_full[date.getDay()]+"';case"%M":return'"+dhtmlx.Date.Locale.month_short[date.getMonth()]+"';case"%F":return'"+dhtmlx.Date.Locale.month_full[date.getMonth()]+"';case"%h":return'"+dhtmlx.Date.to_fixed((date.getHours()+11)%12+1)+"';case"%g":return'"+((date.getHours()+11)%12+1)+"';case"%G":return'"+date.getHours()+"';case"%H":return'"+dhtmlx.Date.to_fixed(date.getHours())+"';case"%i":return'"+dhtmlx.Date.to_fixed(date.getMinutes())+"';case"%a":return'"+(date.getHours()>11?"pm":"am")+"';case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+dhtmlx.Date.to_fixed(date.getSeconds())+"';case"%W":return'"+dhtmlx.Date.to_fixed(dhtmlx.Date.getISOWeek(date))+"';default:return g}});if(a){c=c.replace(/date\.get/g,"date.getUTC")}return new Function("date",'return "'+c+'";')},str_to_date:function(l,g){var m="var temp=date.split(/[^0-9a-zA-Z]+/g);";var a=l.match(/%[a-zA-Z]/g);for(var c=0;c<a.length;c++){switch(a[c]){case"%j":case"%d":m+="set[2]=temp["+c+"]||1;";break;case"%n":case"%m":m+="set[1]=(temp["+c+"]||1)-1;";break;case"%y":m+="set[0]=temp["+c+"]*1+(temp["+c+"]>50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":m+="set[3]=temp["+c+"]||0;";break;case"%i":m+="set[4]=temp["+c+"]||0;";break;case"%Y":m+="set[0]=temp["+c+"]||0;";break;case"%a":case"%A":m+="set[3]=set[3]%12+((temp["+c+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":m+="set[5]=temp["+c+"]||0;";break}}var j="set[0],set[1],set[2],set[3],set[4],set[5]";if(g){j=" Date.UTC("+j+")"}return new Function("date","var set=[0,0,1,0,0,0]; "+m+" return new Date("+j+");")},getISOWeek:function(g){if(!g){return false}var c=g.getDay();if(c===0){c=7}var j=new Date(g.valueOf());j.setDate(g.getDate()+(4-c));var a=j.getFullYear();var m=Math.floor((j.getTime()-new Date(a,0,1).getTime())/86400000);var l=1+Math.floor(m/7);return l},getUTCISOWeek:function(a){return this.getISOWeek(a)}};dhtmlx.math={};dhtmlx.math._toHex=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];dhtmlx.math.toHex=function(c,a){c=parseInt(c,10);str="";while(c>0){str=this._toHex[c%16]+str;c=Math.floor(c/16)}while(str.length<a){str="0"+str}return str};dhtmlx.math.hexToDec=function(a){return parseInt(a,16)};dhtmlx.math.toRgb=function(c){var l,j,a,m;if(typeof(c)!="string"){l=c[0];j=c[1];a=c[2]}else{if(c.indexOf("rgb")!=-1){m=c.substr(c.indexOf("(")+1,c.lastIndexOf(")")-c.indexOf("(")-1).split(",");l=m[0];j=m[1];a=m[2]}else{if(c.substr(0,1)=="#"){c=c.substr(1)}l=this.hexToDec(c.substr(0,2));j=this.hexToDec(c.substr(2,2));a=this.hexToDec(c.substr(4,2))}}l=(parseInt(l,10)||0);j=(parseInt(j,10)||0);a=(parseInt(a,10)||0);if(l<0||l>255){l=0}if(j<0||j>255){j=0}if(a<0||a>255){a=0}return[l,j,a]};dhtmlx.math.hsvToRgb=function(m,y,w){var l,o,j,c,x,a,n,u;l=Math.floor((m/60))%6;o=m/60-l;j=w*(1-y);c=w*(1-o*y);x=w*(1-(1-o)*y);a=0;n=0;u=0;switch(l){case 0:a=w;n=x;u=j;break;case 1:a=c;n=w;u=j;break;case 2:a=j;n=w;u=x;break;case 3:a=j;n=c;u=w;break;case 4:a=x;n=j;u=w;break;case 5:a=w;n=j;u=c;break}a=Math.floor(a*255);n=Math.floor(n*255);u=Math.floor(u*255);return[a,n,u]};dhtmlx.math.rgbToHsv=function(c,n,o){var l,j,q,a,u,x,m,w;l=c/255;j=n/255;q=o/255;var a=Math.min(l,j,q);var u=Math.max(l,j,q);m=0;x=u==0?0:(1-a/u);w=u;if(u==a){m=0}else{if(u==l&&j>=q){m=60*(j-q)/(u-a)+0}else{if(u==l&&j<q){m=60*(j-q)/(u-a)+360}else{if(u==j){m=60*(q-l)/(u-a)+120}else{if(u==q){m=60*(l-j)/(u-a)+240}}}}}return[m,x,w]};if(!dhtmlx.presets){dhtmlx.presets={}}dhtmlx.presets.chart={simple:{item:{borderColor:"#ffffff",color:"#2b7100",shadow:false,borderWidth:2},line:{color:"#8ecf03",width:2}},plot:{color:"#1293f8",item:{borderColor:"#636363",borderWidth:1,color:"#ffffff",type:"r",shadow:false},line:{color:"#1293f8",width:2}},diamond:{color:"#b64040",item:{borderColor:"#b64040",color:"#b64040",type:"d",radius:3,shadow:true},line:{color:"#ff9000",width:2}},point:{color:"#fe5916",disableLines:true,fill:false,disableItems:false,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:false,disableItems:false,disableLines:false,alpha:1},area:{fill:"#3399ff",line:{color:"#3399ff",width:1},disableItems:true,alpha:0.2,disableLines:false},round:{item:{radius:3,borderColor:"#3f83ff",borderWidth:1,color:"#3f83ff",type:"r",shadow:false,alpha:0.6}},square:{item:{radius:3,borderColor:"#447900",borderWidth:2,color:"#69ba00",type:"s",shadow:false,alpha:1}},column:{color:"RAINBOW",gradient:false,width:45,radius:0,alpha:1,border:true},stick:{width:5,gradient:false,color:"#67b5c9",radius:2,alpha:1,border:false},alpha:{color:"#b9a8f9",width:70,gradient:"falling",radius:0,alpha:0.5,border:true}};dhtmlx.ui.Map=function(a){this.name="Map";this._id="map_"+dhtmlx.uid();this._key=a;this._map=[]};dhtmlx.ui.Map.prototype={addRect:function(g,c,a){this._createMapArea(g,"RECT",c,a)},addPoly:function(g,c,a){this._createMapArea(g,"POLY",c,a)},_createMapArea:function(l,c,j,g){var a="";if(arguments.length==4){a="userdata='"+g+"'"}this._map.push("<area "+this._key+"='"+l+"' shape='"+c+"' coords='"+j.join()+"' "+a+"></area>")},addSector:function(a,r,q,n,l,g,j,m){var o=[];o.push(n);o.push(Math.floor(l*j));for(var c=r;c<q;c+=Math.PI/18){o.push(Math.floor(n+g*Math.cos(c)));o.push(Math.floor((l+g*Math.sin(c))*j))}o.push(Math.floor(n+g*Math.cos(q)));o.push(Math.floor((l+g*Math.sin(q))*j));o.push(n);o.push(Math.floor(l*j));return this.addPoly(a,o,m)},render:function(a){var g=dhtmlx.html.create("DIV");g.style.cssText="position:absolute; width:100%; height:100%; top:0px; left:0px;";a.appendChild(g);var c=dhtmlx._isIE?"":"src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='";g.innerHTML="<map id='"+this._id+"' name='"+this._id+"'>"+this._map.join("\n")+"</map><img "+c+" class='dhx_map_img' usemap='#"+this._id+"' onmousedown='return false;'>";a._htmlmap=g;this._map=[]}};dhtmlx.chart={};dhtmlx.chart.scatter={pvt_render_scatter:function(r,m,q,o,n,a){if(!this._settings.xValue){return dhtmlx.log("warning","Undefined propery: xValue")}var g=this._getLimits();var l=this._getLimits("h","xValue");if(!n){if(!this.canvases.x){this.canvases.x=new dhtmlx.ui.Canvas(this._obj,"axis_x")}if(!this.canvases.y){this.canvases.y=new dhtmlx.ui.Canvas(this._obj,"axis_y")}this._drawYAxis(this.canvases.y.getCanvas(),m,q,o,g.min,g.max);this._drawHXAxis(this.canvases.x.getCanvas(),m,q,o,l.min,l.max)}g={min:this._settings.yAxis.start,max:this._settings.yAxis.end};l={min:this._settings.xAxis.start,max:this._settings.xAxis.end};var c=this._getScatterParams(r,m,q,o,l,g);this._mapStart=q;for(var j=0;j<m.length;j++){this._drawScatterItem(r,a,q,o,c,l,g,m[j],n)}},_getScatterParams:function(a,j,g,c,n,m){var l={};l.totalHeight=c.y-g.y;l.totalWidth=c.x-g.x;this._calcScatterUnit(l,n.min,n.max,l.totalWidth,"X");this._calcScatterUnit(l,m.min,m.max,l.totalHeight,"Y");return l},_drawScatterItem:function(s,a,q,o,g,l,j,m,n){var c=this._calculateScatterItemPosition(g,o,q,l,m,"X");var r=this._calculateScatterItemPosition(g,q,o,j,m,"Y");this._drawItem(s,c,r,m,this._settings.label.call(this,m),n,a)},_calculateScatterItemPosition:function(g,o,n,a,l,c){var r=this._settings[c=="X"?"xValue":"value"].call(this,l);var j=g["valueFactor"+c];var s=(parseFloat(r||0)-a.min)*j;var q=g["unit"+c];var m=n[c.toLowerCase()]-(c=="X"?(-1):1)*Math.floor(q*s);if(s<0){m=n[c.toLowerCase()]}if(r>a.max){m=o[c.toLowerCase()]}if(r<a.min){m=n[c.toLowerCase()]}return m},_calcScatterUnit:function(m,g,a,c,j){var l=this._getRelativeValue(g,a);j=(j||"");m["relValue"+j]=l[0];m["valueFactor"+j]=l[1];m["unit"+j]=(m["relValue"+j]?c/m["relValue"+j]:10)}};dhtmlx.chart.radar={pvt_render_radar:function(c,j,a,m,g,l){this._renderRadarChart(c,j,a,m,g,l)},_renderRadarChart:function(v,l,s,r,q,a){if(!l.length){return}var n=this._getPieParameters(s,r);var o=(this._settings.radius?this._settings.radius:n.radius);var c=(this._settings.x?this._settings.x:n.x);var u=(this._settings.y?this._settings.y:n.y);var g=[];for(var j=0;j<l.length;j++){g.push(1)}var m=this._getRatios(g,l.length);this._mapStart=s;if(!q){this._drawRadarAxises(m,c,u,o,l)}this._drawRadarData(v,m,c,u,o,l,q,a)},_drawRadarData:function(D,u,o,n,l,O,E,N){var C,w,M,K,F,J,j,g,H,L,I,v,c,A,r,q,a,s,m;M=this._settings;F=M.yAxis.start;J=M.yAxis.end;m=this._getRelativeValue(F,J);v=m[0];s=(v?l/v:l/2);a=m[1];c=-Math.PI/2;C=w=c;H=[];g=0;for(K=0;K<O.length;K++){if(!q){A=M.value(O[K]);r=(parseFloat(A||0)-F)*a}else{r=q}L=Math.floor(s*r);A=M.value((K!=(O.length-1))?O[K+1]:O[0]);q=(parseFloat(A||0)-F)*a;I=Math.floor(s*q);C=w;w=((K!=(O.length-1))?(c+u[K]-0.0001):c);j=(g||this._getPositionByAngle(C,o,n,L));g=this._getPositionByAngle(w,o,n,I);H.push(j)}if(M.fill){this._fillRadarChart(D,H,O)}if(!M.disableLines){this._strokeRadarChart(D,H,O)}if(!M.disableItems){this._drawRadarItemMarkers(D,H,O,E,N)}H=null},_drawRadarItemMarkers:function(a,g,l,j,m){for(var c=0;c<g.length;c++){this._drawItem(a,g[c].x,g[c].y,l[c],this._settings.label.call(this,l),j,m)}},_fillRadarChart:function(a,j,m){var l,g;a.globalAlpha=this._settings.alpha.call(this,{});a.beginPath();for(var c=0;c<j.length;c++){a.fillStyle=this._settings.fill.call(this,m[c]);l=j[c];g=(j[c+1]||j[0]);if(!c){a.moveTo(l.x,l.y)}a.lineTo(g.x,g.y)}a.fill();a.globalAlpha=1},_strokeRadarChart:function(a,j,m){var l,g;for(var c=0;c<j.length;c++){l=j[c];g=(j[c+1]||j[0]);this._drawLine(a,l.x,l.y,g.x,g.y,this._settings.line.color.call(this,m[c]),this._settings.line.width)}},_drawRadarAxises:function(D,A,w,o,Q){var a=this._settings.yAxis;var l=this._settings.xAxis;var q=a.start;var n=a.end;var s=a.step;var E={};var P=this._configYAxis;if(typeof P.step=="undefined"||typeof P.start=="undefined"||typeof P.end=="undefined"){var u=this._getLimits();E=this._calculateScale(u.min,u.max);q=E.start;n=E.end;s=E.step;a.end=n;a.start=q}var K=[];var N,M,F;var O=0;var g=o*s/(n-q);var v,C;if(s<1){v=Math.min(this._log10(s),(q<=0?0:this._log10(q)));C=Math.pow(10,-v)}var L=[];if(!this.canvases.scale){this.canvases.scale=new dhtmlx.ui.Canvas(this._obj,"radar_scale")}var J=this.canvases.scale.getCanvas();for(N=n;N>=q;N-=s){if(E.fixNum){N=parseFloat((new Number(N)).toFixed(E.fixNum))}K.push(Math.floor(O*g)+0.5);if(C){N=Math.round(N*C)/C}var r=w-o+K[K.length-1];this.canvases.scale.renderTextAt("middle","left",A,r,a.template(N.toString()),"dhx_axis_item_y dhx_radar");if(D.length<2){this._drawScaleSector(J,"arc",A,w,o-K[K.length-1],-Math.PI/2,3*Math.PI/2,N);return}var m=-Math.PI/2;var I=m;var H;for(M=0;M<D.length;M++){if(N==n){L.push(I)}H=m+D[M]-0.0001;this._drawScaleSector(J,(P.lineShape||"line"),A,w,o-K[K.length-1],I,H,N,M,Q[N]);I=H}O++}for(N=0;N<L.length;N++){F=this._getPositionByAngle(L[N],A,w,o);if(l.lines.call(this,Q[N],N)){this._drawLine(J,A,w,F.x,F.y,(l?l.lineColor.call(this,Q[N]):"#cfcfcf"),1)}this._drawRadarScaleLabel(J,A,w,o,L[N],(l?l.template.call(this,Q[N]):"&nbsp;"))}},_drawScaleSector:function(v,n,u,r,m,c,a,l,g){var s,q;if(m<0){return false}s=this._getPositionByAngle(c,u,r,m);q=this._getPositionByAngle(a,u,r,m);var o=this._settings.yAxis;if(o.bg){v.beginPath();v.moveTo(u,r);if(n=="arc"){v.arc(u,r,m,c,a,false)}else{v.lineTo(s.x,s.y);v.lineTo(q.x,q.y)}v.fillStyle=o.bg(l,g);v.moveTo(u,r);v.fill();v.closePath()}if(o.lines.call(this,l)){v.lineWidth=1;v.beginPath();if(n=="arc"){v.arc(u,r,m,c,a,false)}else{v.moveTo(s.x,s.y);v.lineTo(q.x,q.y)}v.strokeStyle=o.lineColor.call(this,l);v.stroke()}},_drawRadarScaleLabel:function(A,q,n,c,o,v){var w=this.canvases.scale.renderText(0,0,v,"dhx_axis_radar_title",1);var g=w.scrollWidth;var u=w.offsetHeight;var s=0.001;var m=this._getPositionByAngle(o,q,n,c+5);var l=0,j=0;if(o<0||o>Math.PI){j=-u}if(o>Math.PI/2){l=-g}if(Math.abs(o+Math.PI/2)<s||Math.abs(o-Math.PI/2)<s){l=-g/2}else{if(Math.abs(o)<s||Math.abs(o-Math.PI)<s){j=-u/2}}w.style.top=m.y+j+"px";w.style.left=m.x+l+"px";w.style.width=g+"px";w.style.whiteSpace="nowrap"}};dhtmlx.chart.area={pvt_render_area:function(o,F,l,j,q,C){var s,A,u,r,m,y,n,E,D,x,w,c,v,a,g;y=this._calculateLineParams(o,F,l,j,q);A=this._settings;r=(A.eventRadius||Math.floor(y.cellWidth/2));if(F.length){n=[];x=(!A.offset?l.x:l.x+y.cellWidth*0.5);for(u=0;u<F.length;u++){m=F[u];D=this._getPointY(m,l,j,y);v=x+y.cellWidth*u;if(D){a=(typeof D=="object"?D.y0:D);if(u&&this._settings.fixOverflow){E=this._getPointY(F[u-1],l,j,y);if(E.out&&E.out==D.out){continue}w=y.cellWidth*(u-1)-0.5+x;c=(typeof E=="object"?E.y0:E);if(E.out){g=(E.out=="min"?j.y:l.y);n.push([this._calcOverflowX(w,v,c,a,g),g])}if(D.out){g=(D.out=="min"?j.y:l.y);n.push([this._calcOverflowX(w,v,c,a,g),g]);if(u==(F.length-1)&&g==l.y){n.push([v,l.y])}}}if(!D.out){n.push([v,a]);C.addRect(m.id,[v-r-l.x,a-r-l.y,v+r-l.x,a+r-l.y],q)}if(!A.yAxis){s=(!A.offset&&(u==F.length-1)?"left":"center");this.canvases[q].renderTextAt(false,s,v,a-A.labelOffset,A.label(m))}}}if(n.length){n.push([v,j.y]);n.push([n[0][0],j.y])}o.globalAlpha=this._settings.alpha.call(this,F[0]);o.fillStyle=this._settings.color.call(this,F[0]);o.beginPath();this._path(o,n);o.fill();if(A.border){o.lineWidth=A.borderWidth||1;if(A.borderColor){o.strokeStyle=A.borderColor.call(this,F[0])}else{this._setBorderStyles(o,o.fillStyle)}o.beginPath();this._path(o,n);o.stroke()}o.lineWidth=1;o.globalAlpha=1}}};dhtmlx.chart.stackedArea={pvt_render_stackedArea:function(r,I,c,a,s,F){var K,J,w,E,C,A,m,v,n,D,q,l,g,o;D=this._calculateLineParams(r,I,c,a,s);E=this._settings;v=(E.eventRadius||Math.floor(D.cellWidth/2));if(I.length){q=[];o=[];l=(!E.offset?c.x:c.x+D.cellWidth*0.5);var H=function(j,x){return s?(I[j].$startY?x-a.y+I[j].$startY:0):x};var u=function(j,M,L){var y=(L.y-M.y)/(L.x-M.x);return y*j+M.y-y*M.x};for(C=0;C<I.length;C++){n=I[C];if(!C){g=H(C,a.y);q.push([l,g])}else{l+=D.cellWidth}g=H(C,this._getPointY(n,c,a,D));o.push((isNaN(g)&&!C)?(I[C].$startY||a.y):g);if(g){q.push([l,g]);F.addRect(n.id,[l-v-c.x,g-v-c.y,l+v-c.x,g+v-c.y],s);if(!E.yAxis){w=(!E.offset&&m?"left":"center");this.canvases[s].renderTextAt(false,w,l,g-E.labelOffset,E.label(n))}}}q.push([l,H(C-1,a.y)]);if(s){for(C=I.length-2;C>0;C--){l-=D.cellWidth;g=I[C].$startY;if(g){q.push([l,g])}}}q.push([q[0][0],q[0][1]]);r.globalAlpha=this._settings.alpha.call(this,I[0]);r.fillStyle=this._settings.color.call(this,I[0]);r.beginPath();this._path(r,q);r.fill();for(C=0;C<I.length;C++){g=o[C];if(!g){if(C==I.length-1){g=I[C].$startY}for(A=C+1;A<I.length;A++){if(o[A]){K={x:c.x,y:o[0]};J={x:(c.x+D.cellWidth*A),y:o[A]};g=u(c.x+D.cellWidth*C,K,J);break}}}I[C].$startY=g}}}};dhtmlx.chart.spline={pvt_render_spline:function(r,J,l,g,s,I){var H,v,q,u,F,o,n,C,A,w,m,c,a;F=this._calculateLineParams(r,J,l,g,s);H=this._settings;this._mapStart=l;q=[];if(J.length){C=(H.offset?l.x+F.cellWidth*0.5:l.x);for(v=0;v<J.length;v++){m=this._getPointY(J[v],l,g,F);if(m){n=((!v)?C:F.cellWidth*v-0.5+C);q.push({x:n,y:m,index:v})}}o=this._getSplineParameters(q);for(v=0;v<q.length;v++){A=q[v].x;c=q[v].y;if(v<q.length-1){w=q[v+1].x;a=q[v+1].y;for(u=A;u<w;u++){var E=this._getSplineYPoint(u,A,v,o.a,o.b,o.c,o.d);if(E<l.y){E=l.y}if(E>g.y){E=g.y}var D=this._getSplineYPoint(u+1,A,v,o.a,o.b,o.c,o.d);if(D<l.y){D=l.y}if(D>g.y){D=g.y}this._drawLine(r,u,E,u+1,D,H.line.color(J[v]),H.line.width)}this._drawLine(r,w-1,this._getSplineYPoint(u,A,v,o.a,o.b,o.c,o.d),w,a,H.line.color(J[v]),H.line.width)}this._drawItem(r,A,c,J[q[v].index],H.label(J[q[v].index]),s,I)}}},_getSplineParameters:function(y){var l,C,A,D,x,w,r,q,o=[],j=[],g=y.length;for(l=0;l<g-1;l++){o[l]=y[l+1].x-y[l].x;j[l]=(y[l+1].y-y[l].y)/o[l]}C=[];A=[];C[0]=0;C[1]=2*(o[0]+o[1]);A[0]=0;A[1]=6*(j[1]-j[0]);for(l=2;l<g-1;l++){C[l]=2*(o[l-1]+o[l])-o[l-1]*o[l-1]/C[l-1];A[l]=6*(j[l]-j[l-1])-o[l-1]*A[l-1]/C[l-1]}D=[];D[g-1]=D[0]=0;for(l=g-2;l>=1;l--){D[l]=(A[l]-o[l]*D[l+1])/C[l]}x=[];w=[];r=[];q=[];for(l=0;l<g-1;l++){x[l]=y[l].y;w[l]=-o[l]*D[l+1]/6-o[l]*D[l]/3+(y[l+1].y-y[l].y)/o[l];r[l]=D[l]/2;q[l]=(D[l+1]-D[l])/(6*o[l])}return{a:x,b:w,c:r,d:q}},_getSplineYPoint:function(j,m,n,l,g,q,o){return l[n]+(j-m)*(g[n]+(j-m)*(q[n]+(j-m)*o[n]))}};dhtmlx.chart.barH={pvt_render_barH:function(A,N,m,l,C,M){var r,u,E,D,a,H,o,K,v,L,c,x,n,I,w,j,y,s,J,g,q;E=(l.y-m.y)/N.length;o=this._getLimits("h");K=o.max;v=o.min;j=l.x-m.x;q=!!this._settings.yAxis;if(!C){this._drawHScales(A,N,m,l,v,K,E)}if(q){K=parseFloat(this._settings.xAxis.end);v=parseFloat(this._settings.xAxis.start)}I=this._getRelativeValue(v,K);x=I[0];c=I[1];s=(x?j/x:10);if(!q){w=10;s=(x?(j-w)/x:10)}u=parseInt(this._settings.width,10);if((u*this._series.length+4)>E){u=E/this._series.length-4}r=Math.floor((E-u*this._series.length)/2);n=(typeof this._settings.radius!="undefined"?parseInt(this._settings.radius,10):Math.round(u/5));L=false;a=this._settings.gradient;if(a&&typeof(a)!="function"){L=a;a=false}else{if(a){a=A.createLinearGradient(m.x,m.y,l.x,m.y);this._settings.gradient(a)}}if(!q){this._drawLine(A,m.x-0.5,m.y,m.x-0.5,l.y,"#000000",1)}for(H=0;H<N.length;H++){y=parseFloat(this._settings.value(N[H]||0));if(y>K){y=K}y-=v;y*=c;J=m.x;g=m.y+r+H*E+(u+1)*C;if((y<0&&this._settings.origin=="auto")||(this._settings.xAxis&&y===0&&!(this._settings.origin!="auto"&&this._settings.origin>v))){this.canvases[C].renderTextAt("middle","right",J+10,g+u/2+r,this._settings.label(N[H]));continue}if(y<0&&this._settings.origin!="auto"&&this._settings.origin>v){y=0}if(!q){y+=w/s}D=a||this._settings.color.call(this,N[H]);if(this._settings.border){this._drawBarHBorder(A,J,g,u,v,n,s,y,D)}A.globalAlpha=this._settings.alpha.call(this,N[H]);var F=this._drawBarH(A,l,J,g,u,v,n,s,y,D,a,L);if(L!=false){this._drawBarHGradient(A,J,g,u,v,n,s,y,D,L)}A.globalAlpha=1;if(F[3]==g){this.canvases[C].renderTextAt("middle","left",F[0]-5,F[3]+Math.floor(u/2),this._settings.label(N[H]));M.addRect(N[H].id,[F[0]-m.x,F[3]-m.y,F[2]-m.x,F[3]+u-m.y],C)}else{this.canvases[C].renderTextAt("middle",false,F[2]+5,F[1]+Math.floor(u/2),this._settings.label(N[H]));M.addRect(N[H].id,[F[0]-m.x,g-m.y,F[2]-m.x,F[3]-m.y],C)}}},_setBarHPoints:function(x,j,v,y,n,w,u,m,l){var c=0;if(n>w*u){var s=(n-w*u)/n;c=-Math.asin(s)+Math.PI/2}x.moveTo(j,v+m);var g=j+w*u-n-(n?0:m);if(n<w*u){x.lineTo(g,v+m)}var r=v+n;if(n&&n>0){x.arc(g,r,n-m,-Math.PI/2+c,0,false)}var q=v+y-n-(n?0:m);var a=g+n-(n?m:0);x.lineTo(a,q);if(n&&n>0){x.arc(g,q,n-m,0,Math.PI/2-c,false)}var o=v+y-m;x.lineTo(j,o);if(!l){x.lineTo(j,v+m)}return[a,o]},_drawHScales:function(g,n,m,l,o,c,j){var a=0;if(this._settings.xAxis){if(!this.canvases.x){this.canvases.x=new dhtmlx.ui.Canvas(this._obj)}a=this._drawHXAxis(this.canvases.x.getCanvas(),n,m,l,o,c)}if(this._settings.yAxis){if(!this.canvases.y){this.canvases.y=new dhtmlx.ui.Canvas(this._obj)}this._drawHYAxis(this.canvases.y.getCanvas(),n,m,l,j,a)}},_drawHYAxis:function(u,l,q,n,g,a){if(!this._settings.yAxis){return}var m;var c=parseInt((a?a:q.x),10)-0.5;var r=n.y+0.5;var o=q.y;this._drawLine(u,c,r,c,o,this._settings.yAxis.color,1);for(var j=0;j<l.length;j++){var s=((this._settings.origin!="auto")&&(this._settings.view=="barH")&&(parseFloat(this._settings.value(l[j]))<this._settings.origin));m=o+g/2+j*g;this.canvases.y.renderTextAt("middle",(s?false:"left"),(s?c+5:c-5),m,this._settings.yAxis.template(l[j]),"dhx_axis_item_y",(s?0:c-10));if(this._settings.yAxis.lines.call(this,l[j])){this._drawLine(u,q.x,m,n.x,m,this._settings.yAxis.lineColor.call(this,l[j]),1)}}this._drawLine(u,q.x+0.5,o+0.5,n.x,o+0.5,this._settings.yAxis.lineColor.call(this,{}),1);this._setYAxisTitle(q,n)},_drawHXAxis:function(C,u,y,x,g,q){var n;var l={};var o=this._settings.xAxis;if(!o){return}var A=x.y+0.5;var j=y.x-0.5;var a=x.x-0.5;var s=y.x;this._drawLine(C,j,A,a,A,o.color,1);if(o.step){n=parseFloat(o.step)}if(typeof this._configXAxis.step=="undefined"||typeof this._configXAxis.start=="undefined"||typeof this._configXAxis.end=="undefined"){l=this._calculateScale(g,q);g=l.start;q=l.end;n=l.step;this._settings.xAxis.end=q;this._settings.xAxis.start=g;this._settings.xAxis.step=n}if(n===0){return}var m=(a-j)*n/(q-g);var w=0;for(var r=g;r<=q;r+=n){if(l.fixNum){r=parseFloat((new Number(r)).toFixed(l.fixNum))}var v=Math.floor(j+w*m)+0.5;if(!(r==g&&this._settings.origin=="auto")&&o.lines.call(this,r)){this._drawLine(C,v,A,v,y.y,this._settings.xAxis.lineColor.call(this,r),1)}if(r==this._settings.origin){s=v+1}this.canvases.x.renderTextAt(false,true,v,A+2,o.template(r.toString()),"dhx_axis_item_x");w++}this.canvases.x.renderTextAt(true,false,j,x.y+this._settings.padding.bottom-3,this._settings.xAxis.title,"dhx_axis_title_x",x.x-y.x);if(!o.lines.call(this,{})){this._drawLine(C,j,y.y-0.5,a,y.y-0.5,this._settings.xAxis.color,0.2)}return s},_correctBarHParams:function(o,l,g,m,n,q,j){var a=this._settings.yAxis;var c=l;if(!!a&&this._settings.origin!="auto"&&(this._settings.origin>j)){l+=(this._settings.origin-j)*n;c=l;m=m-(this._settings.origin-j);if(m<0){m*=(-1);o.translate(l,g+q);o.rotate(Math.PI);l=0.5;g=0}l+=0.5}return{value:m,x0:l,y0:g,start:c}},_drawBarH:function(v,l,C,j,q,r,m,o,u,w,a,n){v.save();var s=this._correctBarHParams(v,C,j,u,o,q,r);v.fillStyle=w;v.beginPath();var x=this._setBarHPoints(v,s.x0,s.y0,q,m,o,s.value,(this._settings.border?1:0));if(a&&!n){v.lineTo(l.x,s.y0+(this._settings.border?1:0))}v.fill();v.restore();var g=s.y0;var c=(s.y0!=j?j:x[1]);var A=(s.y0!=j?(s.start-x[0]):s.start);var y=(s.y0!=j?s.start:x[0]);return[A,g,y,c]},_drawBarHBorder:function(q,c,n,r,l,j,o,m,g){q.save();var a=this._correctBarHParams(q,c,n,m,o,r,l);q.beginPath();this._setBorderStyles(q,g);q.globalAlpha=0.9;this._setBarHPoints(q,a.x0,a.y0,r,j,o,a.value,q.lineWidth/2,1);q.stroke();q.restore()},_drawBarHGradient:function(s,g,q,u,n,m,r,o,j,a){s.save();var c=this._correctBarHParams(s,g,q,o,r,u,n);var l=this._setBarGradient(s,c.x0,c.y0+u,c.x0+r*c.value,c.y0,a,j,"x");s.fillStyle=l.gradient;s.beginPath();this._setBarHPoints(s,c.x0,c.y0+l.offset,u-l.offset*2,m,r,c.value,l.offset);s.fill();s.globalAlpha=1;s.restore()}};dhtmlx.assert(dhtmlx.chart.barH);dhtmlx.chart.stackedBarH={pvt_render_stackedBarH:function(D,Q,l,j,E,P){var O,w;var c;var x;var A=j.x-l.x;var o=!!this._settings.yAxis;var n=this._getStackedLimits(Q);O=n.max;w=n.min;var H=Math.floor((j.y-l.y)/Q.length);if(!E){this._drawHScales(D,Q,l,j,w,O,H)}if(o){O=parseFloat(this._settings.xAxis.end);w=parseFloat(this._settings.xAxis.start)}var L=this._getRelativeValue(w,O);x=L[0];c=L[1];var u=(x?A/x:10);if(!o){var y=10;u=(x?(A-y)/x:10)}var v=parseInt(this._settings.width,10);if((v+4)>H){v=H-4}var q=(H-v)/2;var m=0;var r=false;var a=this._settings.gradient;if(a){r=true}if(!o){this._drawLine(D,l.x-0.5,l.y,l.x-0.5,j.y,"#000000",1)}var N=0;var K=0;for(J=0;J<this._series.length;J++){if(J==E){K=N}if(this._series[J].view=="stackedBarH"){N++}}for(var J=0;J<Q.length;J++){if(!K){Q[J].$startX=l.x}var C=parseFloat(this._settings.value(Q[J]||0));if(C>O){C=O}C-=w;C*=c;var M=l.x;var g=l.y+q+J*H;if(!K){Q[J].$startX=M}else{M=Q[J].$startX}if(C<0||(this._settings.yAxis&&C===0)){this.canvases.y.renderTextAt("middle",true,M+10,g+v/2,this._settings.label(Q[J]));continue}if(!o){C+=y/u}var F=this._settings.color.call(this,Q[J]);D.globalAlpha=this._settings.alpha.call(this,Q[J]);D.fillStyle=this._settings.color.call(this,Q[J]);D.beginPath();var I=this._setBarHPoints(D,M,g,v,m,u,C,(this._settings.border?1:0));if(a&&!r){D.lineTo(l.x+A,g+(this._settings.border?1:0))}D.fill();if(r!=false){var s=this._setBarGradient(D,M,g+v,M,g,r,F,"x");D.fillStyle=s.gradient;D.beginPath();I=this._setBarHPoints(D,M,g,v,m,u,C,0);D.fill()}if(this._settings.border){this._drawBarHBorder(D,M,g,v,w,m,u,C,F)}D.globalAlpha=1;this.canvases[E].renderTextAt("middle",true,Q[J].$startX+(I[0]-Q[J].$startX)/2-1,g+(I[1]-g)/2,this._settings.label(Q[J]));P.addRect(Q[J].id,[Q[J].$startX-l.x,g-l.y,I[0]-l.x,I[1]-l.y],E);Q[J].$startX=I[0]}}};dhtmlx.chart.stackedBar={pvt_render_stackedBar:function(y,M,j,g,A,L){var J,u;var a;var v;var w=g.y-j.y;var m=!!this._settings.yAxis;var K=!!this._settings.xAxis;var l=this._getStackedLimits(M);J=l.max;u=l.min;var D=Math.floor((g.x-j.x)/M.length);if(!A){this._drawScales(M,j,g,u,J,D)}if(m){J=parseFloat(this._settings.yAxis.end);u=parseFloat(this._settings.yAxis.start)}var H=this._getRelativeValue(u,J);v=H[0];a=H[1];var r=(v?w/v:10);var s=parseInt(this._settings.width,10);if(s+4>D){s=D-4}var n=Math.floor((D-s)/2);var o=(this._settings.gradient?this._settings.gradient:false);if(!K){this._drawLine(y,j.x,g.y+0.5,g.x,g.y+0.5,"#000000",1)}for(var F=0;F<M.length;F++){var x=parseFloat(this._settings.value(M[F]||0));if(!x){if(!A||!M[F].$startY){M[F].$startY=g.y}continue}if(!A){x-=u}x*=a;var I=j.x+n+F*D;var c=g.y;if(!A){M[F].$startY=c}else{c=M[F].$startY}if(c<(j.y+1)){continue}if(x<0||(this._settings.yAxis&&x===0)){this.canvases.y.renderTextAt(true,true,I+Math.floor(s/2),c,this._settings.label(M[F]));continue}var C=this._settings.color.call(this,M[F]);y.globalAlpha=this._settings.alpha.call(this,M[F]);y.fillStyle=this._settings.color.call(this,M[F]);y.beginPath();var E=this._setStakedBarPoints(y,I-(this._settings.border?0.5:0),c,s+(this._settings.border?0.5:0),r,x,0,j.y);y.fill();if(o){y.save();var q=this._setBarGradient(y,I,c,I+s,E[1],o,C,"y");y.fillStyle=q.gradient;y.beginPath();E=this._setStakedBarPoints(y,I+q.offset,c,s-q.offset*2,r,x,(this._settings.border?1:0),j.y);y.fill();y.restore()}if(this._settings.border){y.save();this._setBorderStyles(y,C);y.beginPath();this._setStakedBarPoints(y,I-0.5,c,s+1,r,x,0,j.y,1);y.stroke();y.restore()}y.globalAlpha=1;this.canvases[A].renderTextAt(false,true,I+Math.floor(s/2),(E[1]+(c-E[1])/2)-7,this._settings.label(M[F]));L.addRect(M[F].id,[I-j.x,E[1]-j.y,E[0]-j.x,(M[F].$startY||c)-j.y],A);M[F].$startY=(this._settings.border?(E[1]+1):E[1])}},_setStakedBarPoints:function(u,c,q,v,r,o,j,g,l){u.moveTo(c,q);var n=q-r*o+j;if(n<g){n=g}u.lineTo(c,n);var a=c+v;var m=n;u.lineTo(a,m);var s=c+v;u.lineTo(s,q);if(!l){u.lineTo(c,q)}return[s,m-2*j]}};dhtmlx.chart.line={pvt_render_line:function(n,C,l,j,o,y){var x,q,m,v,u,s,r,c,a,g,A,w;v=this._calculateLineParams(n,C,l,j,o);x=this._settings;if(C.length){u=(x.offset?l.x+v.cellWidth*0.5:l.x);m=[];for(q=0;q<C.length;q++){w=this._getPointY(C[q],l,j,v);if(w){r=((!q)?u:v.cellWidth*q-0.5+u);a=(typeof w=="object"?w.y0:w);if(q&&this._settings.fixOverflow){A=this._getPointY(C[q-1],l,j,v);if(A.out&&A.out==w.out){continue}s=v.cellWidth*(q-1)-0.5+u;c=(typeof A=="object"?A.y0:A);if(A.out){g=(A.out=="min"?j.y:l.y);m.push({x:this._calcOverflowX(s,r,c,a,g),y:g})}if(w.out){g=(w.out=="min"?j.y:l.y);m.push({x:this._calcOverflowX(s,r,c,a,g),y:g})}}if(!w.out){m.push({x:r,y:w,index:q})}}}this._mapStart=l;for(q=1;q<=m.length;q++){s=m[q-1].x;c=m[q-1].y;if(q<m.length){r=m[q].x;a=m[q].y;this._drawLine(n,s,c,r,a,x.line.color.call(this,C[q-1]),x.line.width);if(x.line&&x.line.shadow){n.globalAlpha=0.3;this._drawLine(n,s+2,c+x.line.width+8,r+2,a+x.line.width+8,"#eeeeee",x.line.width+3);n.globalAlpha=1}}if(typeof m[q-1].index!="undefined"){this._drawItem(n,s,c,C[m[q-1].index],x.label(C[m[q-1].index]),o,y,l)}}}},_calcOverflowX:function(c,a,j,g,l){return c+(l-j)*(a-c)/(g-j)},_drawItem:function(v,g,u,q,s,r,c){var j=this._settings.item;var o=parseInt(j.radius.call(this,q),10)||0;var n=this._mapStart;if(o){v.save();if(j.shadow){v.lineWidth=1;v.strokeStyle="#bdbdbd";v.fillStyle="#bdbdbd";var a=[0.1,0.2,0.3];for(var m=(a.length-1);m>=0;m--){v.globalAlpha=a[m];v.strokeStyle="#d0d0d0";v.beginPath();this._strokeChartItem(v,g,u+2*o/3,o+m+1,j.type);v.stroke()}v.beginPath();v.globalAlpha=0.3;v.fillStyle="#bdbdbd";this._strokeChartItem(v,g,u+2*o/3,o+1,j.type);v.fill()}v.restore();v.lineWidth=j.borderWidth;v.fillStyle=j.color.call(this,q);v.strokeStyle=j.borderColor.call(this,q);v.globalAlpha=j.alpha.call(this,q);v.beginPath();this._strokeChartItem(v,g,u,o+1,j.type);v.fill();v.stroke();v.globalAlpha=1}if(s){this.canvases[r].renderTextAt(false,true,g,u-o-this._settings.labelOffset,this._settings.label.call(this,q))}var l=(this._settings.eventRadius||o+1);c.addRect(q.id,[g-l-n.x,u-l-n.y,g+l-n.x,u+l-n.y],r)},_strokeChartItem:function(a,c,l,j,g){var m=[];c=parseInt(c,10);l=parseInt(l,10);if(g&&(g=="square"||g=="s")){j*=Math.sqrt(2)/2;m=[[c-j-a.lineWidth/2,l-j],[c+j,l-j],[c+j,l+j],[c-j,l+j],[c-j,l-j]]}else{if(g&&(g=="diamond"||g=="d")){var n=(a.lineWidth>1?a.lineWidth*Math.sqrt(2)/4:0);m=[[c,l-j],[c+j,l],[c,l+j],[c-j,l],[c+n,l-j-n]]}else{if(g&&(g=="triangle"||g=="t")){m=[[c,l-j],[c+Math.sqrt(3)*j/2,l+j/2],[c-Math.sqrt(3)*j/2,l+j/2],[c,l-j]]}else{m=[[c,l,j,0,Math.PI*2,true]]}}}this._path(a,m)},_getPointY:function(g,o,m,a){var n=a.minValue;var j=a.maxValue;var r=a.unit;var c=a.valueFactor;var q=this._settings.value(g);var s=(parseFloat(q||0)-n)*c;if(!this._settings.yAxis){s+=a.startValue/r}var l=m.y-r*s;if(this._settings.fixOverflow&&(this._settings.view=="line"||this._settings.view=="area")){if(q>j){l={y:o.y,y0:l,out:"max"}}else{if(s<0||q<n){l={y:m.y,y0:l,out:"min"}}}}else{if(q>j){l=o.y}if(s<0||q<n){l=m.y}}return l},_calculateLineParams:function(q,j,n,m,l){var c={};var r;c.totalHeight=m.y-n.y;c.cellWidth=(m.x-n.x)/((!this._settings.offset)?(j.length-1):j.length);var g=!!this._settings.yAxis;var a=(this._settings.view.indexOf("stacked")!=-1?this._getStackedLimits(j):this._getLimits());c.maxValue=a.max;c.minValue=a.min;if(!l){this._drawScales(j,n,m,c.minValue,c.maxValue,c.cellWidth)}if(g){c.maxValue=parseFloat(this._settings.yAxis.end);c.minValue=parseFloat(this._settings.yAxis.start)}var o=this._getRelativeValue(c.minValue,c.maxValue);r=o[0];c.valueFactor=o[1];c.unit=(r?c.totalHeight/r:10);c.startValue=0;if(!g){c.startValue=10;if(c.unit!=c.totalHeight){c.unit=(r?(c.totalHeight-c.startValue)/r:10)}}return c}};dhtmlx.chart.bar={pvt_render_bar:function(A,Q,l,j,C,P){var u,E,I,n,N,v,w,c,J,x,s,M,o,O=j.y-l.y;o=!!this._settings.yAxis;M=!!this._settings.xAxis;n=this._getLimits();N=n.max;v=n.min;E=(j.x-l.x)/Q.length;if(!C&&!(this._settings.origin!="auto"&&!o)){this._drawScales(Q,l,j,v,N,E)}if(o){N=parseFloat(this._settings.yAxis.end);v=parseFloat(this._settings.yAxis.start)}J=this._getRelativeValue(v,N);w=J[0];c=J[1];s=(w?O/w:w);if(!o&&!(this._settings.origin!="auto"&&M)){x=10;s=(w?(O-x)/w:x)}if(!C&&(this._settings.origin!="auto"&&!o)&&this._settings.origin>v){this._drawXAxis(A,Q,l,j,E,j.y-s*(this._settings.origin-v))}u=parseInt(this._settings.width,10);var L=0;var H=0;for(I=0;I<this._series.length;I++){if(I==C){H=L}if(this._series[I].view=="bar"){L++}}if(this._series&&(u*L+4)>E){u=parseInt(E/L-4,10)}var q=(E-u*L)/2;var m=(typeof this._settings.radius!="undefined"?parseInt(this._settings.radius,10):Math.round(u/5));var r=false;var a=this._settings.gradient;if(a&&typeof(a)!="function"){r=a;a=false}else{if(a){a=A.createLinearGradient(0,j.y,0,l.y);this._settings.gradient(a)}}if(!M){this._drawLine(A,l.x,j.y+0.5,j.x,j.y+0.5,"#000000",1)}for(I=0;I<Q.length;I++){var y=parseFloat(this._settings.value(Q[I])||0);if(isNaN(y)){continue}if(y>N){y=N}y-=v;y*=c;var K=l.x+q+parseInt(I*E,10)+(u+1)*H;var g=j.y;if(y<0||(this._settings.yAxis&&y===0&&!(this._settings.origin!="auto"&&this._settings.origin>v))){this.canvases[C].renderTextAt(true,true,K+Math.floor(u/2),g,this._settings.label(Q[I]));continue}if(!o&&!(this._settings.origin!="auto"&&M)){y+=x/s}var D=a||this._settings.color.call(this,Q[I]);A.globalAlpha=this._settings.alpha.call(this,Q[I]);var F=this._drawBar(A,l,K,g,u,v,m,s,y,D,a,r);if(r){this._drawBarGradient(A,K,g,u,v,m,s,y,D,r)}if(this._settings.border){this._drawBarBorder(A,K,g,u,v,m,s,y,D)}A.globalAlpha=1;if(F[0]!=K){this.canvases[C].renderTextAt(false,true,K+Math.floor(u/2),F[1],this._settings.label(Q[I]))}else{this.canvases[C].renderTextAt(true,true,K+Math.floor(u/2),F[3],this._settings.label(Q[I]))}P.addRect(Q[I].id,[K-l.x,F[3]-l.y,F[2]-l.x,F[1]-l.y],C)}},_correctBarParams:function(o,l,g,m,n,q,j){var a=this._settings.xAxis;var c=g;if(!!a&&this._settings.origin!="auto"&&(this._settings.origin>j)){g-=(this._settings.origin-j)*n;c=g;m=m-(this._settings.origin-j);if(m<0){m*=(-1);o.translate(l+q,g);o.rotate(Math.PI);l=0;g=0}g-=0.5}return{value:m,x0:l,y0:g,start:c}},_drawBar:function(v,l,C,j,q,r,m,o,u,w,a,n){v.save();v.fillStyle=w;var s=this._correctBarParams(v,C,j,u,o,q,r);var x=this._setBarPoints(v,s.x0,s.y0,q,m,o,s.value,(this._settings.border?1:0));if(a&&!n){v.lineTo(s.x0+(this._settings.border?1:0),l.y)}v.fill();v.restore();var A=s.x0;var y=(s.x0!=C?C+x[0]:x[0]);var g=(s.x0!=C?(s.start-x[1]-s.y0):s.y0);var c=(s.x0!=C?s.start-s.y0:x[1]);return[A,g,y,c]},_drawBarBorder:function(q,c,n,r,l,j,o,m,g){var a;q.save();a=this._correctBarParams(q,c,n,m,o,r,l);this._setBorderStyles(q,g);this._setBarPoints(q,a.x0,a.y0,r,j,o,a.value,q.lineWidth/2,1);q.stroke();q.restore()},_drawBarGradient:function(u,j,r,v,o,n,s,q,l,c){u.save();var g=this._correctBarParams(u,j,r,q,s,v,o);var m=this._setBarGradient(u,g.x0,g.y0,g.x0+v,g.y0-s*g.value+2,c,l,"y");var a=this._settings.border?1:0;u.fillStyle=m.gradient;this._setBarPoints(u,g.x0+m.offset,g.y0,v-m.offset*2,n,s,g.value,m.offset+a);u.fill();u.restore()},_setBarPoints:function(x,j,u,y,o,v,s,l,n){x.beginPath();var c=0;if(o>v*s){var m=(o-v*s)/o;if(m<=1&&m>=-1){c=-Math.acos(m)+Math.PI/2}}x.moveTo(j+l,u);var r=u-Math.floor(v*s)+o+(o?0:l);if(o<v*s){x.lineTo(j+l,r)}var g=j+o;if(o&&o>0){x.arc(g,r,o-l,-Math.PI+c,-Math.PI/2,false)}var a=j+y-o-l;var q=r-o+(o?l:0);x.lineTo(a,q);if(o&&o>0){x.arc(a,r,o-l,-Math.PI/2,0-c,false)}var w=j+y-l;x.lineTo(w,u);if(!n){x.lineTo(j+l,u)}return[w,q]}};dhtmlx.chart.pie={pvt_render_pie:function(c,j,a,m,g,l){this._renderPie(c,j,a,m,1,l,g)},_renderPie:function(s,F,l,j,D,E,u){if(!F.length){return}var v=this._getPieParameters(l,j);var n=(this._settings.radius?this._settings.radius:v.radius);if(n<0){return}var a=this._getValues(F);var m=this._getTotalValue(a);var o=this._getRatios(a,m);var C=(this._settings.x?this._settings.x:v.x);var g=(this._settings.y?this._settings.y:v.y);if(D==1&&this._settings.shadow){this._addShadow(s,C,g,n)}g=g/D;var r=-Math.PI/2;var x=[];s.scale(1,D);if(this._settings.gradient){var A=(D!=1?C+n/3:C);var c=(D!=1?g+n/3:g);this._showRadialGradient(s,C,g,n,A,c)}for(var y=0;y<F.length;y++){if(!a[y]){continue}s.strokeStyle=this._settings.lineColor.call(this,F[y]);s.beginPath();s.moveTo(C,g);x.push(r);alpha1=-Math.PI/2+o[y]-0.0001;s.arc(C,g,n,r,alpha1,false);s.lineTo(C,g);var w=this._settings.color.call(this,F[y]);s.fillStyle=w;s.fill();if(this._settings.pieInnerText){this._drawSectorLabel(C,g,5*n/6,r,alpha1,D,this._settings.pieInnerText(F[y],m),true)}if(this._settings.label){this._drawSectorLabel(C,g,n+this._settings.labelOffset,r,alpha1,D,this._settings.label(F[y]))}if(D!=1){this._createLowerSector(s,C,g,r,alpha1,n,true);s.fillStyle="#000000";s.globalAlpha=0.2;this._createLowerSector(s,C,g,r,alpha1,n,false);s.globalAlpha=1;s.fillStyle=w}E.addSector(F[y].id,r,alpha1,C-l.x,g-l.y/D,n,D,u);r=alpha1}s.globalAlpha=0.8;var q;for(y=0;y<x.length;y++){q=this._getPositionByAngle(x[y],C,g,n);this._drawLine(s,C,g,q.x,q.y,this._settings.lineColor.call(this,F[y]),2)}if(D==1){s.lineWidth=2;s.strokeStyle="#ffffff";s.beginPath();s.arc(C,g,n+1,0,2*Math.PI,false);s.stroke()}s.globalAlpha=1;s.scale(1,1/D)},_getValues:function(g){var a=[];for(var c=0;c<g.length;c++){a.push(parseFloat(this._settings.value(g[c])||0))}return a},_getTotalValue:function(a){var g=0;for(var c=0;c<a.length;c++){g+=a[c]}return g},_getRatios:function(c,a){var m;var l=[];var j=0;a=a||this._getTotalValue(c);for(var g=0;g<c.length;g++){m=c[g];l[g]=Math.PI*2*(a?((m+j)/a):(1/c.length));j+=m}return l},_getPieParameters:function(n,l){var j=l.x-n.x;var c=l.y-n.y;var g=n.x+j/2;var m=n.y+c/2;var a=Math.min(j/2,c/2);return{x:g,y:m,radius:a}},_createLowerSector:function(j,l,n,g,a,m,c){j.lineWidth=1;if(!((g<=0&&a>=0)||(g>=0&&a<=Math.PI)||(Math.abs(g-Math.PI)>0.003&&g<=Math.PI&&a>=Math.PI))){return}if(g<=0&&a>=0){g=0;c=false;this._drawSectorLine(j,l,n,m,g,a)}if(g<=Math.PI&&a>=Math.PI){a=Math.PI;c=false;this._drawSectorLine(j,l,n,m,g,a)}var o=(this._settings.height||Math.floor(m/4))/this._settings.cant;j.beginPath();j.arc(l,n,m,g,a,false);j.lineTo(l+m*Math.cos(a),n+m*Math.sin(a)+o);j.arc(l,n+o,m,a,g,true);j.lineTo(l+m*Math.cos(g),n+m*Math.sin(g));j.fill();if(c){j.stroke()}},_drawSectorLine:function(g,j,m,l,c,a){g.beginPath();g.arc(j,m,l,c,a,false);g.stroke()},_addShadow:function(c,a,m,j){c.globalAlpha=0.5;var l=["#c4c4c4","#c6c6c6","#cacaca","#dcdcdc","#dddddd","#e0e0e0","#eeeeee","#f5f5f5","#f8f8f8"];for(var g=l.length-1;g>-1;g--){c.beginPath();c.fillStyle=l[g];c.arc(a+1,m+1,j+g,0,Math.PI*2,true);c.fill()}c.globalAlpha=1},_getGrayGradient:function(a){a.addColorStop(0,"#ffffff");a.addColorStop(0.7,"#7a7a7a");a.addColorStop(1,"#000000");return a},_showRadialGradient:function(g,c,n,a,j,l){g.beginPath();var m;if(typeof this._settings.gradient!="function"){m=g.createRadialGradient(j,l,a/4,c,n,a);m=this._getGrayGradient(m)}else{m=this._settings.gradient(m)}g.fillStyle=m;g.arc(c,n,a,0,Math.PI*2,true);g.fill();g.globalAlpha=0.7},_drawSectorLabel:function(E,c,j,A,w,F,v,a){var u=this.canvases[0].renderText(0,0,v,0,1);if(!u){return}var H=u.scrollWidth;u.style.width=H+"px";if(H>E){H=E}var C=(w-A<0.2?4:8);if(a){C=H/1.8}var g=A+(w-A)/2;j=j-(C-8)/2;var o=-C;var n=-8;var D="right";if(g>=Math.PI/2&&g<Math.PI||g<=3*Math.PI/2&&g>=Math.PI){o=-H-o+1;D="left"}var l=0;if(!a&&F<1&&(g>0&&g<Math.PI)){l=(this._settings.height||Math.floor(j/4))/F}var q=(c+Math.floor((j+l)*Math.sin(g)))*F+n;var r=E+Math.floor((j+C/2)*Math.cos(g))+o;var m=(w<Math.PI/2+0.01);var s=(A<Math.PI/2);if(s&&m){r=Math.max(r,E+3)}else{if(!s&&!m){r=Math.min(r,E-H)}else{if(!a&&(g>=Math.PI/2&&g<Math.PI||g<=3*Math.PI/2&&g>=Math.PI)){r+=H/3}}}u.style.top=q+"px";u.style.left=r+"px";u.style.width=H+"px";u.style.textAlign=D;u.style.whiteSpace="nowrap"}};dhtmlx.chart.pie3D={pvt_render_pie3D:function(c,j,a,m,g,l){this._renderPie(c,j,a,m,this._settings.cant,l)}};dhtmlx.chart.donut={pvt_render_donut:function(u,l,r,q,n,c){if(!l.length){return}this._renderPie(u,l,r,q,1,c);var j=this._settings;var m=this._getPieParameters(r,q);var a=(j.radius?j.radius:m.radius);var o=((j.innerRadius&&(j.innerRadius<a))?j.innerRadius:a/3);var g=(j.x?j.x:m.x);var s=(j.y?j.y:m.y);u.fillStyle="#ffffff";u.beginPath();u.arc(g,s,o,0,Math.PI*2,true);u.fill()}};dhtmlx.DataDriver.dhtmlxgrid={_grid_getter:"_get_cell_value",toObject:function(a){this._grid=a;return a},getRecords:function(a){return a.rowsBuffer},getDetails:function(g){var a={};for(var c=0;c<this._grid.getColumnsNum();c++){a["data"+c]=this._grid[this._grid_getter](g,c)}return a},getInfo:function(a){return{_size:0,_from:0}}};dhtmlx.ui.Canvas=function(c,g,l){this._canvas_labels=[];this._canvas_name=g;this._obj=c;var j=c.offsetWidth*(window.devicePixelRatio||1);var a=c.offsetHeight*(window.devicePixelRatio||1);var l=l||"";l+=";width:"+c.offsetWidth+"px;height:"+c.offsetHeight+"px;";this._prepareCanvas(g,l,j,a)};dhtmlx.ui.Canvas.prototype={_prepareCanvas:function(c,j,g,a){this._canvas=dhtmlx.html.create("canvas",{width:g,height:a,canvas_id:c,style:(j||"")});this._obj.appendChild(this._canvas);if(!this._canvas.getContext){if(dhtmlx._isIE){dhtmlx.require("thirdparty/excanvas/excanvas.js");G_vmlCanvasManager.init_(document);G_vmlCanvasManager.initElement(this._canvas)}else{dhtmlx.error("Canvas is not supported in the current browser")}}return this._canvas},getCanvas:function(c){var a=(this._canvas||this._prepareCanvas()).getContext(c||"2d");if(!this._webixDevicePixelRatio){this._webixDevicePixelRatio=true;a.scale(window.devicePixelRatio||1,window.devicePixelRatio||1)}return a},_resizeCanvas:function(){if(this._canvas){var a=this._canvas.parentNode.offsetWidth;var c=this._canvas.parentNode.offsetHeight;this._canvas.setAttribute("width",a*(window.devicePixelRatio||1));this._canvas.setAttribute("height",c*(window.devicePixelRatio||1));this._canvas.style.width=a+"px";this._canvas.style.height=c+"px";this._webixDevicePixelRatio=false}},renderText:function(a,m,l,j,c){if(!l){return}var g=dhtmlx.html.create("DIV",{"class":"dhx_canvas_text"+(j?(" "+j):""),style:"left:"+a+"px; top:"+m+"px;"},l);this._obj.appendChild(g);this._canvas_labels.push(g);if(c){g.style.width=c+"px"}return g},renderTextAt:function(l,q,a,o,j,n,g){var m=this.renderText.call(this,a,o,j,n,g);if(m){if(l){if(l=="middle"){m.style.top=parseInt(o-m.offsetHeight/2,10)+"px"}else{m.style.top=o-m.offsetHeight+"px"}}if(q){if(q=="left"){m.style.left=a-m.offsetWidth+"px"}else{m.style.left=parseInt(a-m.offsetWidth/2,10)+"px"}}}return m},clearCanvas:function(a){var c=[],g;for(g=0;g<this._canvas_labels.length;g++){this._obj.removeChild(this._canvas_labels[g])}this._canvas_labels=[];if(!a&&this._obj._htmlmap){c=this._getMapAreas();while(c.length){c[0].parentNode.removeChild(c[0]);c.splice(0,1)}c=null;if(!this._obj._htmlmap.getElementsByTagName("AREA").length){this._obj._htmlmap.parentNode.removeChild(this._obj._htmlmap);this._obj._htmlmap=null}}this.getCanvas().clearRect(0,0,this._obj.offsetWidth*(window.devicePixelRatio||1),this._obj.offsetWidth*(window.devicePixelRatio||1))},toggleCanvas:function(){this._toggleCanvas(this._canvas.style.display=="none")},showCanvas:function(){this._toggleCanvas(true)},hideCanvas:function(){this._toggleCanvas(false)},_toggleCanvas:function(a){var c,g;for(g=0;g<this._canvas_labels.length;g++){this._canvas_labels[g].style.display=(a?"":"none")}if(this._obj._htmlmap){c=this._getMapAreas();for(g=0;g<c.length;g++){if(a){c[g].removeAttribute("disabled")}else{c[g].setAttribute("disabled","true")}}}this._canvas.style.display=(a?"":"none")},_getMapAreas:function(){var g=[],a,c;a=this._obj._htmlmap.getElementsByTagName("AREA");for(c=0;c<a.length;c++){if(a[c].getAttribute("userdata")==this._canvas_name){g.push(a[c])}}return g}};dhtmlXChart=function(a){this.name="Chart";this.version="3.0";if(dhtmlx.assert_enabled()){this._assert()}dhtmlx.extend(this,dhtmlx.Settings);this._parseContainer(a,"dhx_chart");dhtmlx.extend(this,dhtmlx.AtomDataLoader);dhtmlx.extend(this,dhtmlx.DataLoader);this.data.provideApi(this,true);dhtmlx.extend(this,dhtmlx.EventSystem);dhtmlx.extend(this,dhtmlx.MouseEvents);dhtmlx.extend(this,dhtmlx.Destruction);dhtmlx.extend(this,dhtmlx.Group);dhtmlx.extend(this,dhtmlx.AutoTooltip);for(var c in dhtmlx.chart){dhtmlx.extend(this,dhtmlx.chart[c])}if(a.preset){this.definePreset(a)}this._parseSettings(a,this.defaults);this._series=[this._settings];this.data.attachEvent("onStoreUpdated",dhtmlx.bind(function(){this.render()},this));this.attachEvent("onLocateData",this._switchSerie)};dhtmlXChart.prototype={_id:"dhx_area_id",on_click:{dhx_chart_legend_item:function(m,n,l){var j=l.getAttribute("series_id");if(this.callEvent("onLegendClick",[m,j,l])){var g=this._settings;var c=g.legend.values;var a=(c&&(typeof c[j].toggle!="undefined"))?c[j].toggle:g.legend.toggle;if((typeof j!="undefined")&&this._series.length>1){if(a){if(l.className.indexOf("hidden")!=-1){this.showSeries(j)}else{this.hideSeries(j)}}}}}},on_dblclick:{},on_mouse_move:{},bind:function(){dhx.BaseBind.legacyBind.apply(this,arguments)},sync:function(){dhx.BaseBind.legacySync.apply(this,arguments)},resize:function(){for(var a in this.canvases){this.canvases[a]._resizeCanvas()}this.render()},view_setter:function(a){if(!dhtmlx.chart[a]){dhtmlx.error("Chart type extension is not loaded: "+a)}if(typeof this._settings.offset=="undefined"){this._settings.offset=!(a=="area"||a=="stackedArea")}if(a=="radar"&&!this._settings.yAxis){this.define("yAxis",{})}if(a=="scatter"){if(!this._settings.yAxis){this.define("yAxis",{})}if(!this._settings.xAxis){this.define("xAxis",{})}}return a},clearCanvas:function(){if(this.canvases&&typeof this.canvases=="object"){for(var a in this.canvases){this.canvases[a].clearCanvas()}}},render:function(){var g,c,j,l,a;if(!this.callEvent("onBeforeRender",[this.data])){return}if(this.canvases&&typeof this.canvases=="object"){for(c in this.canvases){this.canvases[c].clearCanvas()}}else{this.canvases={}}if(this._settings.legend){if(!this.canvases.legend){this.canvases.legend=new dhtmlx.ui.Canvas(this._obj,"legend")}this._drawLegend(this.data.getRange(),this._obj.offsetWidth)}g=this._getChartBounds(this._obj.offsetWidth,this._obj.offsetHeight);l=new dhtmlx.ui.Map(this._id);a=this._settings;j=this._getChartData();for(c=0;c<this._series.length;c++){this._settings=this._series[c];if(!this.canvases[c]){this.canvases[c]=new dhtmlx.ui.Canvas(this._obj,c,"z-index:"+(2+c))}this["pvt_render_"+this._settings.view](this.canvases[c].getCanvas(),j,g.start,g.end,c,l)}l.render(this._obj);this._obj.lastChild.style.zIndex=1000;this._applyBounds(this._obj.lastChild,g);this.callEvent("onAfterRender",[]);this._settings=a},_applyBounds:function(g,c){var a={};a.left=c.start.x;a.top=c.start.y;a.width=c.end.x-c.start.x;a.height=c.end.y-c.start.y;for(var j in a){g.style[j]=a[j]+"px"}},_getChartData:function(){var j,n,g,l,m,r,a,o,q,c;l=this.data.getRange();j=(this._settings.view.toLowerCase().indexOf("barh")!=-1?"yAxis":"xAxis");n=this._settings[j];if(n&&n.units&&(typeof n.units=="object")){g=n.units;o=[];if(typeof g.start!="undefined"&&typeof g.end!="undefined"&&typeof g.next!="undefined"){a=g.start;while(a<=g.end){o.push(a);a=g.next.call(this,a)}}else{if(Object.prototype.toString.call(g)==="[object Array]"){o=g}}r=[];if(o.length){q=n.value;c={};for(m=0;m<l.length;m++){c[q(l[m])]=m}for(m=0;m<o.length;m++){if(typeof c[o[m]]!="undefined"){l[c[o[m]]].$unit=o[m];r.push(l[c[o[m]]])}else{r.push({$unit:o[m]})}}}return r}return l},value_setter:dhtmlx.Template.obj_setter,xValue_setter:dhtmlx.Template.obj_setter,yValue_setter:function(a){this.define("value",a)},alpha_setter:dhtmlx.Template.obj_setter,label_setter:dhtmlx.Template.obj_setter,lineColor_setter:dhtmlx.Template.obj_setter,borderColor_setter:dhtmlx.Template.obj_setter,pieInnerText_setter:dhtmlx.Template.obj_setter,gradient_setter:function(a){if((typeof(a)!="function")&&a&&(a===true)){a="light"}return a},colormap:{RAINBOW:function(a){var c=Math.floor(this.indexById(a.id)/this.dataCount()*1536);if(c==1536){c-=1}return this._rainbow[Math.floor(c/256)](c%256)}},color_setter:function(a){return this.colormap[a]||dhtmlx.Template.obj_setter(a)},fill_setter:function(a){return((!a||a==0)?false:dhtmlx.Template.obj_setter(a))},definePreset:function(a){this.define("preset",a.preset);delete a.preset},preset_setter:function(l){var g,c,j;this.defaults=dhtmlx.extend({},this.defaults);if(typeof dhtmlx.presets.chart[l]=="object"){j=dhtmlx.presets.chart[l];for(g in j){if(typeof j[g]=="object"){if(!this.defaults[g]||typeof this.defaults[g]!="object"){this.defaults[g]=dhtmlx.extend({},j[g])}else{this.defaults[g]=dhtmlx.extend({},this.defaults[g]);for(c in j[g]){this.defaults[g][c]=j[g][c]}}}else{this.defaults[g]=j[g]}}return l}return false},legend_setter:function(a){if(!a){if(this.legendObj){this.legendObj.innerHTML="";this.legendObj=null}return false}if(typeof(a)!="object"){a={template:a}}this._mergeSettings(a,{width:150,height:18,layout:"y",align:"left",valign:"bottom",template:"",toggle:(this._settings.view.toLowerCase().indexOf("stacked")!=-1?"":"hide"),marker:{type:"square",width:15,height:15,radius:3},margin:4,padding:3});a.template=dhtmlx.Template.setter(a.template);return a},defaults:{color:"RAINBOW",alpha:"1",label:false,value:"{obj.value}",padding:{},view:"pie",lineColor:"#ffffff",cant:0.5,width:30,labelWidth:100,line:{width:2,color:"#1293f8"},item:{radius:3,borderColor:"#636363",borderWidth:1,color:"#ffffff",alpha:1,type:"r",shadow:false},shadow:true,gradient:false,border:true,labelOffset:20,origin:"auto"},item_setter:function(a){if(typeof(a)!="object"){a={color:a,borderColor:a}}this._mergeSettings(a,dhtmlx.extend({},this.defaults.item));var g=["alpha","borderColor","color","radius"];for(var c=0;c<g.length;c++){a[g[c]]=dhtmlx.Template.setter(a[g[c]])}return a},line_setter:function(a){if(typeof(a)!="object"){a={color:a}}dhtmlx.extend(this.defaults.line,a);a=dhtmlx.extend({},this.defaults.line);a.color=dhtmlx.Template.setter(a.color);return a},padding_setter:function(a){if(typeof(a)!="object"){a={left:a,right:a,top:a,bottom:a}}this._mergeSettings(a,{left:50,right:20,top:35,bottom:40});return a},xAxis_setter:function(a){if(!a){return false}if(typeof(a)!="object"){a={template:a}}if(!a.value){a.value=a.template}this._mergeSettings(a,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",value:"{obj}",lines:true});var c=["lineColor","template","lines","value"];this._converToTemplate(c,a);this._configXAxis=dhtmlx.extend({},a);return a},yAxis_setter:function(a){this._mergeSettings(a,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",lines:true,bg:"#ffffff"});var c=["lineColor","template","lines","bg"];this._converToTemplate(c,a);this._configYAxis=dhtmlx.extend({},a);return a},_converToTemplate:function(a,c){for(var g=0;g<a.length;g++){c[a[g]]=dhtmlx.Template.setter(c[a[g]])}},_drawScales:function(l,j,g,n,a,c){var m=0;if(this._settings.yAxis){if(!this.canvases.y){this.canvases.y=new dhtmlx.ui.Canvas(this._obj,"axis_y")}m=this._drawYAxis(this.canvases.y.getCanvas(),l,j,g,n,a)}if(this._settings.xAxis){if(!this.canvases.x){this.canvases.x=new dhtmlx.ui.Canvas(this._obj,"axis_x")}this._drawXAxis(this.canvases.x.getCanvas(),l,j,g,c,m)}return m},_drawXAxis:function(v,m,s,r,j,q){var g=s.x-0.5;var u=parseInt((q?q:r.y),10)+0.5;var c=r.x;var n;var a=true;for(var l=0;l<m.length;l++){if(this._settings.offset===true){n=g+j/2+l*j}else{n=(l==m.length-1)?r.x:g+l*j;a=!!l}n=Math.ceil(n)-0.5;var o=((this._settings.origin!="auto")&&(this._settings.view=="bar")&&(parseFloat(this._settings.value(m[l]))<this._settings.origin));this._drawXAxisLabel(n,u,m[l],a,o);if((this._settings.offset||l)&&this._settings.xAxis.lines.call(this,m[l])){this._drawXAxisLine(v,n,r.y,s.y,m[l])}}this.canvases.x.renderTextAt(true,false,g,r.y+this._settings.padding.bottom-3,this._settings.xAxis.title,"dhx_axis_title_x",r.x-s.x);this._drawLine(v,g,u,c,u,this._settings.xAxis.color,1);if(!this._settings.xAxis.lines.call(this,{})||!this._settings.offset){return}this._drawLine(v,c+0.5,r.y,c+0.5,s.y+0.5,this._settings.xAxis.color,0.2)},_drawYAxis:function(x,E,m,l,o,n){var q;var v={};if(!this._settings.yAxis){return}var A=m.x-0.5;var j=l.y;var g=m.y;var w=l.y;if(this._settings.yAxis.step){q=parseFloat(this._settings.yAxis.step)}if(typeof this._configYAxis.step=="undefined"||typeof this._configYAxis.start=="undefined"||typeof this._configYAxis.end=="undefined"){v=this._calculateScale(o,n);o=v.start;n=v.end;q=v.step;this._settings.yAxis.end=n;this._settings.yAxis.start=o}this._setYAxisTitle(m,l);if(q===0){n=o;q=1}var a=(n==o?j-g:(j-g)*q/(n-o));var C=0;for(var y=o;y<=n;y+=q){if(v.fixNum){y=parseFloat((new Number(y)).toFixed(v.fixNum))}var D=Math.floor(j-C*a)+0.5;if(!(y==o&&this._settings.origin=="auto")&&this._settings.yAxis.lines.call(this,y)){this._drawLine(x,A,D,l.x,D,this._settings.yAxis.lineColor.call(this,y),1)}if(y==this._settings.origin){w=D}var r=y;if(q<1){var s=Math.min(this._log10(q),(o<=0?0:this._log10(o)));var u=Math.pow(10,-s);r=Math.round(y*u)/u;y=r}this.canvases.y.renderText(0,D-5,this._settings.yAxis.template(r.toString()),"dhx_axis_item_y",m.x-5);C++}this._drawLine(x,A,j+1,A,g,this._settings.yAxis.color,1);return w},_setYAxisTitle:function(g,c){var a="dhx_axis_title_y"+(dhtmlx._isIE&&dhtmlx._isIE!=9?" dhx_ie_filter":"");var j=this.canvases.y.renderTextAt("middle",false,0,parseInt((c.y-g.y)/2+g.y,10),this._settings.yAxis.title,a);if(j){j.style.left=(dhtmlx.env.transform?(j.offsetHeight-j.offsetWidth)/2:0)+"px"}},_calculateScale:function(r,c){if(this._settings.origin!="auto"&&this._settings.origin<r){r=this._settings.origin}var l,j,n;l=((c-r)/8)||1;var g=Math.floor(this._log10(l));var a=Math.pow(10,g);var m=l/a;m=(m>5?10:5);l=parseInt(m,10)*a;if(l>Math.abs(r)){j=(r<0?-l:0)}else{var s=Math.abs(r);var q=Math.floor(this._log10(s));var o=s/Math.pow(10,q);j=Math.ceil(o*10)/10*Math.pow(10,q)-l;if(s>1&&l>0.1){j=Math.ceil(j)}while(r<0?j<=r:j>=r){j-=l}if(r<0){j=-j-2*l}}n=j;while(n<c){n+=l;n=parseFloat((new Number(n)).toFixed(Math.abs(g)))}return{start:j,end:n,step:l,fixNum:Math.abs(g)}},_getLimits:function(c,n){var o,m;var l=((arguments.length&&c=="h")?this._configXAxis:this._configYAxis);n=n||"value";if(l&&(typeof l.end!="undefined")&&(typeof l.start!="undefined")&&l.step){o=parseFloat(l.end);m=parseFloat(l.start)}else{o=this.max(this._series[0][n]);m=(l&&(typeof l.start!="undefined"))?parseFloat(l.start):this.min(this._series[0][n]);if(this._series.length>1){for(var j=1;j<this._series.length;j++){var a=this.max(this._series[j][n]);var g=this.min(this._series[j][n]);if(a>o){o=a}if(g<m){m=g}}}}return{max:o,min:m}},_log10:function(c){var a="log";return Math.floor((Math[a](c)/Math.LN10))},_drawXAxisLabel:function(c,m,l,a,j){if(!this._settings.xAxis){return}var g=this.canvases.x.renderTextAt(j,a,c,m-(j?2:0),this._settings.xAxis.template(l));if(g){g.className+=" dhx_axis_item_x"}},_drawXAxisLine:function(c,a,j,g,l){if(!this._settings.xAxis||!this._settings.xAxis.lines){return}this._drawLine(c,a,j,a,g,this._settings.xAxis.lineColor.call(this,l),1)},_drawLine:function(a,j,n,g,l,c,m){a.strokeStyle=c;a.lineWidth=m;a.beginPath();a.moveTo(j,n);a.lineTo(g,l);a.stroke();a.lineWidth=1},_getRelativeValue:function(j,l){var g,a;var c=1;if(l!=j){g=l-j}else{g=j}return[g,c]},_rainbow:[function(a){return"#FF"+dhtmlx.math.toHex(a/2,2)+"00"},function(a){return"#FF"+dhtmlx.math.toHex(a/2+128,2)+"00"},function(a){return"#"+dhtmlx.math.toHex(255-a,2)+"FF00"},function(a){return"#00FF"+dhtmlx.math.toHex(a,2)},function(a){return"#00"+dhtmlx.math.toHex(255-a,2)+"FF"},function(a){return"#"+dhtmlx.math.toHex(a,2)+"00FF"}],addSeries:function(c){var a=this._settings;this._settings=dhtmlx.extend({},a);this._parseSettings(c,{});this._series.push(this._settings);this._settings=a},_switchSerie:function(j,a){var g;this._active_serie=a.getAttribute("userdata");if(!this._series[this._active_serie]){return}for(var c=0;c<this._series.length;c++){g=this._series[c].tooltip;if(g){g.disable()}}if(!a.getAttribute("disabled")){g=this._series[this._active_serie].tooltip;if(g){g.enable()}}},hideSeries:function(a){this.canvases[a].hideCanvas();if(this._settings.legend.values&&this._settings.legend.values[a]){this._settings.legend.values[a].$hidden=true}this._drawLegend()},showSeries:function(a){this.canvases[a].showCanvas();if(this._settings.legend.values&&this._settings.legend.values[a]){delete this._settings.legend.values[a].$hidden}this._drawLegend()},_setBorderStyles:function(a,c){var j,g;g=dhtmlx.math.toRgb(c);j=dhtmlx.math.rgbToHsv(g[0],g[1],g[2]);j[2]/=2;c="rgb("+dhtmlx.math.hsvToRgb(j[0],j[1],j[2])+")";a.strokeStyle=c;if(a.globalAlpha==1){a.globalAlpha=0.9}},_drawLegend:function(j,c){var l,r,A,s,m,u,a,o=0,n=0,w,q,g,v;j=j||[];c=c||this._obj.offsetWidth;w=this.canvases.legend.getCanvas();r=this._settings.legend;a=(this._settings.legend.layout!="x"?"width:"+r.width+"px":"");if(this.legendObj){this.legendObj.innerHTML="";this.legendObj.parentNode.removeChild(this.legendObj)}this.canvases.legend.clearCanvas(true);A=dhtmlx.html.create("DIV",{"class":"dhx_chart_legend",style:"left:"+o+"px; top:"+n+"px;"+a},"");if(r.padding){A.style.padding=r.padding+"px"}this.legendObj=A;this._obj.appendChild(A);m=[];if(!r.values){for(l=0;l<j.length;l++){m.push(this._drawLegendText(A,r.template(j[l])))}}else{for(l=0;l<r.values.length;l++){m.push(this._drawLegendText(A,r.values[l].text,(typeof r.values[l].id!="undefined"?typeof r.values[l].id:l),r.values[l].$hidden))}}u=A.offsetWidth;s=A.offsetHeight;if(u<this._obj.offsetWidth){if(r.layout=="x"&&r.align=="center"){o=(this._obj.offsetWidth-u)/2}if(r.align=="right"){o=this._obj.offsetWidth-u}if(r.margin&&r.align!="center"){o+=(r.align=="left"?1:-1)*r.margin}}if(s<this._obj.offsetHeight){if(r.valign=="middle"&&r.align!="center"&&r.layout!="x"){n=(this._obj.offsetHeight-s)/2}else{if(r.valign=="bottom"){n=this._obj.offsetHeight-s}}if(r.margin&&r.valign!="middle"){n+=(r.valign=="top"?1:-1)*r.margin}}A.style.left=o+"px";A.style.top=n+"px";w.save();for(l=0;l<m.length;l++){v=m[l];if(r.values&&r.values[l].$hidden){g=true;q=(r.values[l].disableColor?r.values[l].disableColor:"#d9d9d9")}else{g=false;q=(r.values?r.values[l].color:this._settings.color.call(this,j[l]))}this._drawLegendMarker(w,v.offsetLeft+o,v.offsetTop+n,q,v.offsetHeight,g,l)}w.restore();m=null},_drawLegendText:function(a,l,c,j){var g="";if(this._settings.legend.layout=="x"){g="float:left;"}var m=dhtmlx.html.create("DIV",{style:g+"padding-left:"+(10+this._settings.legend.marker.width)+"px","class":"dhx_chart_legend_item"+(j?" hidden":"")},l);if(arguments.length>2){m.setAttribute("series_id",c)}a.appendChild(m);return m},_drawLegendMarker:function(C,u,s,l,A,m,o){var c=[];var n=this._settings.legend.marker;var w=this._settings.legend.values;var r=(w&&w[o].markerType?w[o].markerType:n.type);if(l){C.fillStyle=l;C.strokeStyle=this._getDarkenColor(l,0.75)}C.beginPath();if(r=="round"||!n.radius){C.lineWidth=n.height;C.lineCap=r;u+=C.lineWidth/2+5;s+=A/2;C.moveTo(u,s);var a=u+n.width-n.height+1;C.lineTo(a,s)}else{if(r=="item"){if(this._settings.line&&this._settings.view!="scatter"&&!this._settings.disableLines){C.beginPath();C.lineWidth=this._series[o].line.width;C.strokeStyle=m?l:this._series[o].line.color.call(this,{});var g=u+5;var v=s+A/2;C.moveTo(g,v);var a=g+n.width;C.lineTo(a,v);C.stroke()}var j=this._series[o].item;var q=parseInt(j.radius.call(this,{}),10)||0;if(q){C.beginPath();if(m){C.lineWidth=j.borderWidth;C.strokeStyle=l;C.fillStyle=l}else{C.lineWidth=j.borderWidth;C.fillStyle=j.color.call(this,{});C.strokeStyle=j.borderColor.call(this,{});C.globalAlpha=j.alpha.call(this,{})}C.beginPath();u+=n.width/2+5;s+=A/2;this._strokeChartItem(C,u,s,q+1,j.type);C.fill();C.stroke()}C.globalAlpha=1}else{C.lineWidth=1;u+=5;s+=parseInt(A/2-n.height/2,10);c=[[u+n.radius,s+n.radius,n.radius,Math.PI,3*Math.PI/2,false],[u+n.width-n.radius,s],[u+n.width-n.radius,s+n.radius,n.radius,-Math.PI/2,0,false],[u+n.width,s+n.height-n.radius],[u+n.width-n.radius,s+n.height-n.radius,n.radius,0,Math.PI/2,false],[u+n.radius,s+n.height],[u+n.radius,s+n.height-n.radius,n.radius,Math.PI/2,Math.PI,false],[u,s+n.radius]];this._path(C,c)}}C.stroke();C.fill()},_getDarkenColor:function(a,j){var g,c;c=dhtmlx.math.toRgb(a);g=dhtmlx.math.rgbToHsv(c[0],c[1],c[2]);g[2]=g[2]*j;return"rgb("+dhtmlx.math.hsvToRgb(g[0],g[1],g[2])+")"},_getChartBounds:function(a,n){var q,g,o,c;q=this._settings.padding.left;g=this._settings.padding.top;o=a-this._settings.padding.right;c=n-this._settings.padding.bottom;if(this._settings.legend){var l=this._settings.legend;var m=this._settings.legend.width;var j=this._settings.legend.height;if(l.layout=="x"){if(l.valign=="center"){if(l.align=="right"){o-=m}else{if(l.align=="left"){q+=m}}}else{if(l.valign=="bottom"){c-=j}else{g+=j}}}else{if(l.align=="right"){o-=m}else{if(l.align=="left"){q+=m}}}}return{start:{x:q,y:g},end:{x:o,y:c}}},_getStackedLimits:function(m){var c,a,n,l,g;if(this._settings.yAxis&&(typeof this._settings.yAxis.end!="undefined")&&(typeof this._settings.yAxis.start!="undefined")&&this._settings.yAxis.step){n=parseFloat(this._settings.yAxis.end);l=parseFloat(this._settings.yAxis.start)}else{for(c=0;c<m.length;c++){m[c].$sum=0;m[c].$min=Infinity;for(a=0;a<this._series.length;a++){g=parseFloat(this._series[a].value(m[c])||0);if(isNaN(g)){continue}if(this._series[a].view.toLowerCase().indexOf("stacked")!=-1){m[c].$sum+=g}if(g<m[c].$min){m[c].$min=g}}}n=-Infinity;l=Infinity;for(c=0;c<m.length;c++){if(m[c].$sum>n){n=m[c].$sum}if(m[c].$min<l){l=m[c].$min}}if(l>0){l=0}}return{max:n,min:l}},_setBarGradient:function(w,c,s,a,q,o,j,g){var r,l,n,m,v,u;if(o=="light"){if(g=="x"){r=w.createLinearGradient(c,s,a,s)}else{r=w.createLinearGradient(c,s,c,q)}u=[[0,"#FFFFFF"],[0.9,j],[1,j]];l=2}else{if(o=="falling"||o=="rising"){if(g=="x"){r=w.createLinearGradient(c,s,a,s)}else{r=w.createLinearGradient(c,s,c,q)}n=dhtmlx.math.toRgb(j);m=dhtmlx.math.rgbToHsv(n[0],n[1],n[2]);m[1]*=1/2;v="rgb("+dhtmlx.math.hsvToRgb(m[0],m[1],m[2])+")";if(o=="falling"){u=[[0,v],[0.7,j],[1,j]]}else{if(o=="rising"){u=[[0,j],[0.3,j],[1,v]]}}l=0}else{w.globalAlpha=0.37;l=0;if(g=="x"){r=w.createLinearGradient(c,q,c,s)}else{r=w.createLinearGradient(c,s,a,s)}u=[[0,"#9d9d9d"],[0.3,"#e8e8e8"],[0.45,"#ffffff"],[0.55,"#ffffff"],[0.7,"#e8e8e8"],[1,"#9d9d9d"]]}}this._gradient(r,u);return{gradient:r,offset:l}},_getPositionByAngle:function(g,c,l,j){g*=(-1);c=c+Math.cos(g)*j;l=l-Math.sin(g)*j;return{x:c,y:l}},_gradient:function(g,c){for(var a=0;a<c.length;a++){g.addColorStop(c[a][0],c[a][1])}},_path:function(a,g){var c,j;for(c=0;c<g.length;c++){j=(c?"lineTo":"moveTo");if(g[c].length>2){j="arc"}a[j].apply(a,g[c])}},_circle:function(c,a,j,g){c.arc(a,j,g,Math.PI*2,true)},_addMapRect:function(j,l,a,g,c){j.addRect(l,[a[0].x-g.x,a[0].y-g.y,a[1].x-g.x,a[1].y-g.y],c)}};dhtmlx.compat("layout");if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachChart=function(a){this.callEvent("_onBeforeContentAttach",["chart"]);var c=document.createElement("DIV");c.id="dhxChartObj_"+window.dhx4.newId();c.style.width="100%";c.style.height="100%";document.body.appendChild(c);this._attachObject(c);a.container=c.id;this.dataType="chart";this.dataObj=new dhtmlXChart(a);if(!this.dataObj.setSizes){this.dataObj.setSizes=function(){if(this.resize){this.resize()}else{this.render()}}}return this.dataObj}}dhtmlx.ui.pager=function(a){this.name="Pager";if(dhtmlx.assert_enabled()){this._assert()}dhtmlx.extend(this,dhtmlx.Settings);this._parseContainer(a,"dhx_pager");dhtmlx.extend(this,dhtmlx.EventSystem);dhtmlx.extend(this,dhtmlx.SingleRender);dhtmlx.extend(this,dhtmlx.MouseEvents);this._parseSettings(a,{size:10,page:-1,group:5,count:0,type:"default"});this.data=this._settings;this.refresh()};dhtmlx.ui.pager.prototype={_id:"dhx_p_id",on_click:{dhx_pager_item:function(a,c){this.select(c)}},select:function(a){switch(a){case"next":a=this._settings.page+1;break;case"prev":a=this._settings.page-1;break;case"first":a=0;break;case"last":a=this._settings.limit-1;break;default:break}if(a<0){a=0}if(a>=this.data.limit){a=this.data.limit-1}if(this.callEvent("onBeforePageChange",[this._settings.page,a])){this.data.page=a*1;this.refresh();this.callEvent("onAfterPageChange",[a])}},types:{"default":{template:dhtmlx.Template.fromHTML("{common.pages()}"),pages:function(g){var c="";if(g.page==-1){return""}g.min=g.page-Math.round((g.group-1)/2);g.max=g.min+g.group-1;if(g.min<0){g.max+=g.min*(-1);g.min=0}if(g.max>=g.limit){g.min-=Math.min(g.min,g.max-g.limit+1);g.max=g.limit-1}for(var a=(g.min||0);a<=g.max;a++){c+=this.button({id:a,index:(a+1),selected:(a==g.page?"_selected":"")})}return c},page:function(a){return a.page+1},first:function(){return this.button({id:"first",index:" &lt;&lt; ",selected:""})},last:function(){return this.button({id:"last",index:" &gt;&gt; ",selected:""})},prev:function(){return this.button({id:"prev",index:"&lt;",selected:""})},next:function(){return this.button({id:"next",index:"&gt;",selected:""})},button:dhtmlx.Template.fromHTML("<div dhx_p_id='{obj.id}' class='dhx_pager_item{obj.selected}'>{obj.index}</div>")}},refresh:function(){var a=this._settings;a.limit=Math.ceil(a.count/a.size);if(a.limit&&a.limit!=a.old_limit){a.page=Math.min(a.limit-1,a.page)}var c=a.page;if(c!=-1&&(c!=a.old_page)||(a.limit!=a.old_limit)){this.render();this.callEvent("onRefresh",[]);a.old_limit=a.limit;a.old_page=a.page}},template_item_start:dhtmlx.Template.fromHTML("<div>"),template_item_end:dhtmlx.Template.fromHTML("</div>")};dhtmlx.DataProcessor={_dp_init:function(c){var a="_methods";c[a]=["setItemStyle","","changeId","remove"];this.attachEvent("onAfterAdd",function(g){c.setUpdated(g,true,"inserted")});this.data.attachEvent("onStoreLoad",dhtmlx.bind(function(j,g){if(j.getUserData){j.getUserData(g,this._userdata)}},this));this.attachEvent("onBeforeDelete",function(j){if(c._silent_mode){return true}var g=c.getState(j);if(g=="inserted"){c.setUpdated(j,false);return true}if(g=="deleted"){return false}if(g=="true_deleted"){return true}c.setUpdated(j,true,"deleted");return false});this.attachEvent("onAfterEditStop",function(g){c.setUpdated(g,true,"updated")});this.attachEvent("onBindUpdate",function(g){window.setTimeout(function(){c.setUpdated(g.id,true,"updated")},1)});a="_getRowData";c[a]=function(n,g){var l=this.obj.data.get(n);var m={};for(var j in l){if(j.indexOf("_")===0){continue}m[j]=l[j]}return m};a="_clearUpdateFlag";c[a]=function(){};this._userdata={};c.attachEvent("insertCallback",this._dp_callback);c.attachEvent("updateCallback",this._dp_callback);c.attachEvent("deleteCallback",function(g,j){this.obj.setUserData(j,this.action_param,"true_deleted");this.obj.remove(j)});dhtmlx.compat("dataProcessor",c)},_dp_callback:function(a,c){this.obj.data.set(c,dhtmlx.DataDriver.xml.getDetails(a.firstChild));this.obj.data.refresh(c)},setItemStyle:function(g,a){var c=this._locateHTML(g);if(c){c.style.cssText+=";"+a}},changeId:function(c,a){this.data.changeId(c,a);this.refresh()},setUserData:function(g,a,c){if(g){this.data.get(g)[a]=c}else{this._userdata[a]=c}},getUserData:function(c,a){return c?this.data.get(c)[a]:this._userdata[a]}};(function(){var a="_dp_init";dhtmlx.DataProcessor[a]=dhtmlx.DataProcessor._dp_init})();dhtmlx.compat.dnd=function(){if(window.dhtmlDragAndDropObject){var o="_dragged";var j=dhtmlDragAndDropObject.prototype.checkLanding;dhtmlDragAndDropObject.prototype.checkLanding=function(r,s,q){j.apply(this,arguments);if(!q){var u=dhtmlx.DragControl._drag_context=dhtmlx.DragControl._drag_context||{};if(!u.from){u.from=this.dragStartObject}dhtmlx.DragControl._checkLand(r,s,true)}};var c=dhtmlDragAndDropObject.prototype.stopDrag;dhtmlDragAndDropObject.prototype.stopDrag=function(s,q,r){if(!r){if(dhtmlx.DragControl._last){dhtmlx.DragControl._active=n.dragStartNode;dhtmlx.DragControl._stopDrag(s,true)}}c.apply(this,arguments)};var n=new dhtmlDragAndDropObject();var l=dhtmlx.DragControl._startDrag;dhtmlx.DragControl._startDrag=function(){l.apply(this,arguments);var u=dhtmlx.DragControl._drag_context;if(!u){return}var s=[];var r=[];for(var q=0;q<u.source.length;q++){s[q]={idd:u.source[q]};r.push(u.source[q])}n.dragStartNode={parentNode:{},parentObject:{idd:s,id:(r.length==1?r[0]:r),treeNod:{object:u.from}}};n.dragStartNode.parentObject.treeNod[o]=s;n.dragStartObject=u.from};var m=dhtmlx.DragControl._checkLand;dhtmlx.DragControl._checkLand=function(r,s,q){m.apply(this,arguments);if(!this._last&&!q){r=n.checkLanding(r,s,true)}};var a=dhtmlx.DragControl._stopDrag;dhtmlx.DragControl._stopDrag=function(r,q){a.apply(this,arguments);if(n.lastLanding&&!q){n.stopDrag(r,false,true)}};var g=dhtmlx.DragControl.getMaster;dhtmlx.DragControl.getMaster=function(r){var s=null;if(r){s=g.apply(this,arguments)}if(!s){s=n.dragStartObject;var u=[];var v=s[o];for(var q=0;q<v.length;q++){u.push(v[q].idd||v[q].id)}dhtmlx.DragControl._drag_context.source=u}return s}}};dhtmlx.DataMove={_init:function(){dhtmlx.assert(this.data,"DataMove :: Component doesn't have DataStore")},copy:function(c,l,a,j){var g=this.get(c);if(!g){dhtmlx.log("Warning","Incorrect ID in DataMove::copy");return}if(a){dhtmlx.assert(a.externalData,"DataMove :: External object doesn't support operation");g=a.externalData(g)}a=a||this;return a.add(a.externalData(g,j),l)},move:function(g,n,c,m){if(g instanceof Array){for(var j=0;j<g.length;j++){var a=(c||this).indexById(this.move(g[j],n,c,g[j]));if(g[j+1]){n=a+(this.indexById(g[j+1])<a?0:1)}}return}nid=g;if(n<0){dhtmlx.log("Info","DataMove::move - moving outside of bounds is ignored");return}var l=this.get(g);if(!l){dhtmlx.log("Warning","Incorrect ID in DataMove::move");return}if(!c||c==this){this.data.move(this.indexById(g),n)}else{dhtmlx.assert(c.externalData,"DataMove :: External object doesn't support operation");nid=c.add(c.externalData(l,m),n);this.remove(g)}return nid},moveUp:function(c,a){return this.move(c,this.indexById(c)-(a||1))},moveDown:function(c,a){return this.moveUp(c,(a||1)*-1)},moveTop:function(a){return this.move(a,0)},moveBottom:function(a){return this.move(a,this.data.dataCount()-1)},externalData:function(a,g){var c=dhtmlx.extend({},a);c.id=g||dhtmlx.uid();c.$selected=c.$template=null;return c}};dhtmlx.DragControl={_drag_masters:dhtmlx.toArray(["dummy"]),addDrop:function(c,g,a){c=dhtmlx.toNode(c);c.dhx_drop=this._getCtrl(g);if(a){c.dhx_master=true}},_getCtrl:function(c){c=c||dhtmlx.DragControl;var a=this._drag_masters.find(c);if(a<0){a=this._drag_masters.length;this._drag_masters.push(c)}return a},addDrag:function(a,c){a=dhtmlx.toNode(a);a.dhx_drag=this._getCtrl(c);dhtmlx.event(a,"mousedown",this._preStart,a)},_preStart:function(a){if(dhtmlx.DragControl._active){dhtmlx.DragControl._preStartFalse();dhtmlx.DragControl.destroyDrag()}dhtmlx.DragControl._active=this;dhtmlx.DragControl._start_pos={x:a.pageX,y:a.pageY};dhtmlx.DragControl._dhx_drag_mm=dhtmlx.event(document.body,"mousemove",dhtmlx.DragControl._startDrag);dhtmlx.DragControl._dhx_drag_mu=dhtmlx.event(document.body,"mouseup",dhtmlx.DragControl._preStartFalse);dhtmlx.DragControl._dhx_drag_sc=dhtmlx.event(this,"scroll",dhtmlx.DragControl._preStartFalse);a.cancelBubble=true;return false},_preStartFalse:function(a){dhtmlx.DragControl._dhx_drag_mm=dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm);dhtmlx.DragControl._dhx_drag_mu=dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu);dhtmlx.DragControl._dhx_drag_sc=dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_sc)},_startDrag:function(a){var c={x:a.pageX,y:a.pageY};if(Math.abs(c.x-dhtmlx.DragControl._start_pos.x)<5&&Math.abs(c.y-dhtmlx.DragControl._start_pos.y)<5){return}dhtmlx.DragControl._preStartFalse();if(!dhtmlx.DragControl.createDrag(a)){return}dhtmlx.DragControl.sendSignal("start");dhtmlx.DragControl._dhx_drag_mm=dhtmlx.event(document.body,"mousemove",dhtmlx.DragControl._moveDrag);dhtmlx.DragControl._dhx_drag_mu=dhtmlx.event(document.body,"mouseup",dhtmlx.DragControl._stopDrag);dhtmlx.DragControl._moveDrag(a)},_stopDrag:function(a){dhtmlx.DragControl._dhx_drag_mm=dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm);dhtmlx.DragControl._dhx_drag_mu=dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu);if(dhtmlx.DragControl._last){dhtmlx.DragControl.onDrop(dhtmlx.DragControl._active,dhtmlx.DragControl._last,this._landing,a);dhtmlx.DragControl.onDragOut(dhtmlx.DragControl._active,dhtmlx.DragControl._last,null,a)}dhtmlx.DragControl.destroyDrag();dhtmlx.DragControl.sendSignal("stop")},_moveDrag:function(a){var c=dhtmlx.html.pos(a);dhtmlx.DragControl._html.style.top=c.y+dhtmlx.DragControl.top+"px";dhtmlx.DragControl._html.style.left=c.x+dhtmlx.DragControl.left+"px";if(dhtmlx.DragControl._skip){dhtmlx.DragControl._skip=false}else{dhtmlx.DragControl._checkLand((a.srcElement||a.target),a)}a.cancelBubble=true;return false},_checkLand:function(a,c){while(a&&a.tagName!="BODY"){if(a.dhx_drop){if(this._last&&(this._last!=a||a.dhx_master)){this.onDragOut(this._active,this._last,a,c)}if(!this._last||this._last!=a||a.dhx_master){this._last=null;this._landing=this.onDragIn(dhtmlx.DragControl._active,a,c);if(this._landing){this._last=a}return}return}a=a.parentNode}if(this._last){this._last=this._landing=this.onDragOut(this._active,this._last,null,c)}},sendSignal:function(a){dhtmlx.DragControl.active=(a=="start")},getMaster:function(a){return this._drag_masters[a.dhx_drag||a.dhx_drop]},getContext:function(a){return this._drag_context},createDrag:function(l){var g=dhtmlx.DragControl._active;var j=this._drag_masters[g.dhx_drag];var c;if(j.onDragCreate){c=j.onDragCreate(g,l);c.style.position="absolute";c.style.zIndex=dhtmlx.zIndex.drag;c.onmousemove=dhtmlx.DragControl._skip_mark}else{var m=dhtmlx.DragControl.onDrag(g,l);if(!m){return false}var c=document.createElement("DIV");c.innerHTML=m;c.className="dhx_drag_zone";c.onmousemove=dhtmlx.DragControl._skip_mark;document.body.appendChild(c)}dhtmlx.DragControl._html=c;return true},_skip_mark:function(){dhtmlx.DragControl._skip=true},destroyDrag:function(){var c=dhtmlx.DragControl._active;var g=this._drag_masters[c.dhx_drag];if(g&&g.onDragDestroy){g.onDragDestroy(c,dhtmlx.DragControl._html)}else{dhtmlx.html.remove(dhtmlx.DragControl._html)}dhtmlx.DragControl._landing=dhtmlx.DragControl._active=dhtmlx.DragControl._last=dhtmlx.DragControl._html=null},top:5,left:5,onDragIn:function(g,c,j){var a=this._drag_masters[c.dhx_drop];if(a.onDragIn&&a!=this){return a.onDragIn(g,c,j)}c.className=c.className+" dhx_drop_zone";return c},onDragOut:function(g,c,l,j){var a=this._drag_masters[c.dhx_drop];if(a.onDragOut&&a!=this){return a.onDragOut(g,c,l,j)}c.className=c.className.replace("dhx_drop_zone","");return null},onDrop:function(g,c,l,j){var a=this._drag_masters[c.dhx_drop];dhtmlx.DragControl._drag_context.from=dhtmlx.DragControl.getMaster(g);if(a.onDrop&&a!=this){return a.onDrop(g,c,l,j)}c.appendChild(g)},onDrag:function(c,g){var a=this._drag_masters[c.dhx_drag];if(a.onDrag&&a!=this){return a.onDrag(c,g)}dhtmlx.DragControl._drag_context={source:c,from:c};return"<div style='"+c.style.cssText+"'>"+c.innerHTML+"</div>"}};dhtmlx.DragItem={_init:function(){dhtmlx.assert(this.move,"DragItem :: Component doesn't have DataMove interface");dhtmlx.assert(this.locate,"DragItem :: Component doesn't have RenderStack interface");dhtmlx.assert(dhtmlx.DragControl,"DragItem :: DragControl is not included");if(!this._settings||this._settings.drag){dhtmlx.DragItem._initHandlers(this)}else{if(this._settings){this.drag_setter=function(a){if(a){this._initHandlers(this);delete this.drag_setter}return a}}}if(this.dragMarker){this.attachEvent("onBeforeDragIn",this.dragMarker);this.attachEvent("onDragOut",this.dragMarker)}},_initHandlers:function(a){dhtmlx.DragControl.addDrop(a._obj,a,true);dhtmlx.DragControl.addDrag(a._obj,a)},onDragIn:function(j,g,l){var n=this.locate(l)||null;var c=dhtmlx.DragControl._drag_context;var m=dhtmlx.DragControl.getMaster(j);var a=(this._locateHTML(n)||this._obj);if(a==dhtmlx.DragControl._landing){return a}c.target=n;c.to=m;if(!this.callEvent("onBeforeDragIn",[c,l])){c.id=null;return null}dhtmlx.html.addCss(a,"dhx_drag_over");return a},onDragOut:function(j,g,o,l){var m=this.locate(l)||null;if(o!=this._dataobj){m=null}var c=(this._locateHTML(m)||(o?dhtmlx.DragControl.getMaster(o)._obj:window.undefined));if(c==dhtmlx.DragControl._landing){return null}var a=dhtmlx.DragControl._drag_context;dhtmlx.html.removeCss(dhtmlx.DragControl._landing,"dhx_drag_over");a.target=a.to=null;this.callEvent("onDragOut",[a,l]);return null},onDrop:function(g,c,l,j){var a=dhtmlx.DragControl._drag_context;a.to=this;a.index=a.target?this.indexById(a.target):this.dataCount();a.new_id=dhtmlx.uid();if(!this.callEvent("onBeforeDrop",[a,j])){return}if(a.from==a.to){this.move(a.source,a.index)}else{if(a.from){a.from.move(a.source,a.index,a.to,a.new_id)}else{dhtmlx.error("Unsopported d-n-d combination")}}this.callEvent("onAfterDrop",[a,j])},onDrag:function(g,l){var m=this.locate(l);var j=[m];if(m){if(this.getSelected){var c=this.getSelected();if(dhtmlx.PowerArray.find.call(c,m)!=-1){j=c}}var a=dhtmlx.DragControl._drag_context={source:j,start:m};a.from=this;if(this.callEvent("onBeforeDrag",[a,l])){return a.html||this._toHTML(this.get(m))}}return null}};dhtmlx.EditAbility={_init:function(a){this._edit_id=null;this._edit_bind=null;dhtmlx.assert(this.data,"EditAbility :: Component doesn't have DataStore");dhtmlx.assert(this._locateHTML,"EditAbility :: Component doesn't have RenderStack");this.attachEvent("onEditKeyPress",function(g,j,c){if(g==13&&!c){this.stopEdit()}else{if(g==27){this.stopEdit(true)}}});this.attachEvent("onBeforeRender",function(){this.stopEdit()})},isEdit:function(){return this._edit_id},edit:function(c){if(this.stopEdit(false,c)){if(!this.callEvent("onBeforeEditStart",[c])){return}var a=this.data.get(c);if(a.$template){return}a.$template="edit";this.data.refresh(c);this._edit_id=c;this._save_binding(c);this._edit_bind(true,a);this.callEvent("onAfterEditStart",[c])}},stopEdit:function(g,l){if(!this._edit_id){return true}if(this._edit_id==l){return false}var a={};if(!g){this._edit_bind(false,a)}else{a=null}if(!this.callEvent("onBeforeEditStop",[this._edit_id,a])){return false}var c=this.data.get(this._edit_id);c.$template=null;if(!g){this._edit_bind(false,c)}var j=this._edit_id;this._edit_bind=this._edit_id=null;this.data.refresh(j);this.callEvent("onAfterEditStop",[j,a]);return true},_save_binding:function(o){var a=this._locateHTML(o);var g="";var m="";var l=[];if(a){var j=a.getElementsByTagName("*");var n="";for(var c=0;c<j.length;c++){if(j[c].nodeType==1&&(n=j[c].getAttribute("bind"))){g+="els["+l.length+"].value="+n+";";m+=n+"=els["+l.length+"].value;";l.push(j[c]);j[c].className+=" dhx_allow_selection";j[c].onselectstart=this._block_native}}j=null}g=Function("obj","els",g);m=Function("obj","els",m);this._edit_bind=function(r,q){if(r){g(q,l);if(l.length&&l[0].select){l[0].select()}}else{m(q,l)}}},_block_native:function(a){(a||event).cancelBubble=true;return true}};dhtmlx.SelectionModel={_init:function(){this._selected=dhtmlx.toArray();dhtmlx.assert(this.data,"SelectionModel :: Component doesn't have DataStore");this.data.attachEvent("onStoreUpdated",dhtmlx.bind(this._data_updated,this));this.data.attachEvent("onStoreLoad",dhtmlx.bind(this._data_loaded,this));this.data.attachEvent("onAfterFilter",dhtmlx.bind(this._data_filtered,this));this.data.attachEvent("onIdChange",dhtmlx.bind(this._id_changed,this))},_id_changed:function(g,a){for(var c=this._selected.length-1;c>=0;c--){if(this._selected[c]==g){this._selected[c]=a}}},_data_filtered:function(){for(var a=this._selected.length-1;a>=0;a--){if(this.data.indexById(this._selected[a])<0){var g=this._selected[a]}var c=this.item(g);if(c){delete c.$selected}this._selected.splice(a,1);this.callEvent("onSelectChange",[g])}},_data_updated:function(g,c,a){if(a=="delete"){this._selected.remove(g)}else{if(!this.data.dataCount()&&!this.data._filter_order){this._selected=dhtmlx.toArray()}}},_data_loaded:function(){if(this._settings.select){this.data.each(function(a){if(a.$selected){this.select(a.id)}},this)}},_select_mark:function(g,c,a){if(!a&&!this.callEvent("onBeforeSelect",[g,c])){return false}this.data.item(g).$selected=c;if(a){a.push(g)}else{if(c){this._selected.push(g)}else{this._selected.remove(g)}this._refresh_selection(g)}return true},select:function(j,g,a){if(!j){return this.selectAll()}if(j instanceof Array){for(var c=0;c<j.length;c++){this.select(j[c],g,a)}return}if(!this.data.exists(j)){dhtmlx.error("Incorrect id in select command: "+j);return}if(a&&this._selected.length){return this.selectAll(this._selected[this._selected.length-1],j)}if(!g&&(this._selected.length!=1||this._selected[0]!=j)){this._silent_selection=true;this.unselectAll();this._silent_selection=false}if(this.isSelected(j)){if(g){this.unselect(j)}return}if(this._select_mark(j,true)){this.callEvent("onAfterSelect",[j])}},unselect:function(a){if(!a){return this.unselectAll()}if(!this.isSelected(a)){return}this._select_mark(a,false)},selectAll:function(j,g){var a;var c=[];if(j||g){a=this.data.getRange(j||null,g||null)}else{a=this.data.getRange()}a.each(function(l){var m=this.data.item(l.id);if(!m.$selected){this._selected.push(l.id);this._select_mark(l.id,true,c)}return l.id},this);this._refresh_selection(c)},unselectAll:function(){var a=[];this._selected.each(function(c){this._select_mark(c,false,a)},this);this._selected=dhtmlx.toArray();this._refresh_selection(a)},isSelected:function(a){return this._selected.find(a)!=-1},getSelected:function(a){switch(this._selected.length){case 0:return a?[]:"";case 1:return a?[this._selected[0]]:this._selected[0];default:return([].concat(this._selected))}},_is_mass_selection:function(a){return a.length>100||a.length>this.data.dataCount/2},_refresh_selection:function(c){if(typeof c!="object"){c=[c]}if(!c.length){return}if(this._is_mass_selection(c)){this.data.refresh()}else{for(var a=0;a<c.length;a++){this.render(c[a],this.data.item(c[a]),"update")}}if(!this._silent_selection){this.callEvent("onSelectChange",[c])}}};dhtmlx.RenderStack={_init:function(){dhtmlx.assert(this.data,"RenderStack :: Component doesn't have DataStore");dhtmlx.assert(dhtmlx.Template,"dhtmlx.Template :: dhtmlx.Template is not accessible");this._html=document.createElement("DIV")},_toHTML:function(a){dhtmlx.assert((!a.$template||this.type["template_"+a.$template]),"RenderStack :: Unknown template: "+a.$template);this.callEvent("onItemRender",[a]);return this.type._item_start(a,this.type)+(a.$template?this.type["template_"+a.$template]:this.type.template)(a,this.type)+this.type._item_end},_toHTMLObject:function(a){this._html.innerHTML=this._toHTML(a);return this._html.firstChild},_locateHTML:function(a){if(this._htmlmap){return this._htmlmap[a]}this._htmlmap={};var g=this._dataobj.childNodes;for(var c=0;c<g.length;c++){var j=g[c].getAttribute(this._id);if(j){this._htmlmap[j]=g[c]}}return this._locateHTML(a)},locate:function(a){return dhtmlx.html.locate(a,this._id)},show:function(c){var a=this._locateHTML(c);if(a){this._dataobj.scrollTop=a.offsetTop-this._dataobj.offsetTop}},render:function(m,j,g,l){if(m){var a=this._locateHTML(m);switch(g){case"update":if(!a){return}var c=this._htmlmap[m]=this._toHTMLObject(j);dhtmlx.html.insertBefore(c,a);dhtmlx.html.remove(a);break;case"delete":if(!a){return}dhtmlx.html.remove(a);delete this._htmlmap[m];break;case"add":var c=this._htmlmap[m]=this._toHTMLObject(j);dhtmlx.html.insertBefore(c,this._locateHTML(this.data.next(m)),this._dataobj);break;case"move":this.render(m,j,"delete");this.render(m,j,"add");break;default:dhtmlx.error("Unknown render command: "+g);break}}else{if(this.callEvent("onBeforeRender",[this.data])){this._dataobj.innerHTML=this.data.getRange().map(this._toHTML,this).join("");this._htmlmap=null}}this.callEvent("onAfterRender",[])},pager_setter:function(c){this.attachEvent("onBeforeRender",function(){var j=this._settings.pager._settings;if(j.page==-1){return false}this.data.min=j.page*j.size;this.data.max=(j.page+1)*j.size-1;return true});var a=new dhtmlx.ui.pager(c);var g=dhtmlx.bind(function(){this.data.refresh()},this);a.attachEvent("onRefresh",g);this.data.attachEvent("onStoreUpdated",function(l){var j=this.dataCount();if(j!=a._settings.count){a._settings.count=j;if(a._settings.page==-1){a._settings.page=0}a.refresh()}});return a},height_setter:function(a){if(a=="auto"){this.attachEvent("onAfterRender",this._correct_height);dhtmlx.event(window,"resize",dhtmlx.bind(this._correct_height,this))}return a},_correct_height:function(){this._dataobj.style.overflow="hidden";this._dataobj.style.height="1px";var a=this._dataobj.scrollHeight;this._dataobj.style.height=a+"px";if(dhtmlx._isFF){var c=this._dataobj.scrollHeight;if(c!=a){this._dataobj.style.height=c+"px"}}this._obj.style.height=this._dataobj.style.height},_getDimension:function(){var a=this.type;var c=(a.border||0)+(a.padding||0)*2+(a.margin||0)*2;return{x:a.width+c,y:a.height+c}},x_count_setter:function(c){var g=this._getDimension();var a=dhtmlx.$customScroll?0:18;this._dataobj.style.width=g.x*c+(this._settings.height!="auto"?a:0)+"px";return c},y_count_setter:function(a){var c=this._getDimension();this._dataobj.style.height=c.y*a+"px";return a}};dhtmlx.VirtualRenderStack={_init:function(){dhtmlx.assert(this.render,"VirtualRenderStack :: Object must use RenderStack first");this._htmlmap={};this._dataobj.style.overflowY="scroll";dhtmlx.event(this._dataobj,"scroll",dhtmlx.bind(this._render_visible_rows,this));dhtmlx.event(window,"resize",dhtmlx.bind(function(){this.render()},this));this.data._unrendered_area=[];this.data.getIndexRange=this._getIndexRange},_locateHTML:function(a){return this._htmlmap[a]},show:function(g){range=this._getVisibleRange();var c=this.data.indexById(g);var a=Math.floor(c/range._dx)*range._y;this._dataobj.scrollTop=a},_getIndexRange:function(l,j){if(j!==0){j=Math.min((j||Infinity),this.dataCount()-1)}var a=dhtmlx.toArray();for(var c=(l||0);c<=j;c++){var g=this.item(this.order[c]);if(this.order.length>c){if(!g){this.order[c]=dhtmlx.uid();g={id:this.order[c],$template:"loading"};this._unrendered_area.push(this.order[c])}else{if(g.$template=="loading"){this._unrendered_area.push(this.order[c])}}a.push(g)}}return a},render:function(m,j,g,l){if(m){var a=this._locateHTML(m);switch(g){case"update":if(!a){return}var c=this._htmlmap[m]=this._toHTMLObject(j);dhtmlx.html.insertBefore(c,a);dhtmlx.html.remove(a);break;default:this._render_delayed();break}}else{if(this.callEvent("onBeforeRender",[this.data])){this._htmlmap={};this._render_visible_rows(null,true);this._wait_for_render=false;this.callEvent("onAfterRender",[])}}},_render_delayed:function(){if(this._wait_for_render){return}this._wait_for_render=true;window.setTimeout(dhtmlx.bind(function(){this.render()},this),1)},_create_placeholder:function(a){var c=document.createElement("DIV");c.className="dhxdataview_placeholder";c.style.cssText="height:"+a+"px; width:100%; overflow:hidden;";return c},_render_visible_rows:function(y,D){this.data._unrendered_area=[];var x=this._getVisibleRange();if(!this._dataobj.firstChild||D){this._dataobj.innerHTML="";this._dataobj.appendChild(this._create_placeholder(x._max));this._htmlrows=[this._dataobj.firstChild]}var j=Math.max(x._from,0);var w=(this.data.max||this.data.max===0)?this.data.max:Infinity;while(j<=x._height){while(this._htmlrows[j]&&this._htmlrows[j]._filled&&j<=x._height){j++}if(j>x._height){break}var n=j;while(!this._htmlrows[n]){n--}var a=this._htmlrows[n];var g=j*x._dx+(this.data.min||0);if(g>w){break}var l=Math.min(g+x._dx-1,w);var q=this._create_placeholder(x._y);var m=this.data.getIndexRange(g,l);if(!m.length){break}q.innerHTML=m.map(this._toHTML,this).join("");for(var u=0;u<m.length;u++){this._htmlmap[this.data.idByIndex(g+u)]=q.childNodes[u]}var v=parseInt(a.style.height,10);var C=(j-n)*x._y;var s=(v-C-x._y);dhtmlx.html.insertBefore(q,C?a.nextSibling:a,this._dataobj);this._htmlrows[j]=q;q._filled=true;if(C<=0&&s>0){a.style.height=s+"px";this._htmlrows[j+1]=a}else{if(C<0){dhtmlx.html.remove(a)}else{a.style.height=C+"px"}if(s>0){var o=this._htmlrows[j+1]=this._create_placeholder(s);dhtmlx.html.insertBefore(o,q.nextSibling,this._dataobj)}}j++}if(this.data._unrendered_area.length){var r=this.indexById(this.data._unrendered_area[0]);var c=this.indexById(this.data._unrendered_area.pop())+1;if(c>r){if(!this.callEvent("onDataRequest",[r,c-r])){return false}dhtmlx.assert(this.data.feed,"Data feed is missed");this.data.feed.call(this,r,c-r)}}if(dhtmlx._isIE){var A=this._getVisibleRange();if(A._from!=x._from){this._render_visible_rows()}}},_getVisibleRange:function(){var c=dhtmlx.$customScroll?0:18;var n=this._dataobj.scrollTop;var a=Math.max(this._dataobj.scrollWidth,this._dataobj.offsetWidth)-c;var o=this._dataobj.offsetHeight;var r=this.type;var j=this._getDimension();var s=Math.floor(a/j.x)||1;var g=Math.floor(n/j.y);var q=Math.ceil((o+n)/j.y)-1;var l=this.data.max?(this.data.max-this.data.min):this.data.dataCount();var m=Math.ceil(l/s)*j.y;return{_from:g,_height:q,_top:n,_max:m,_y:j.y,_dx:s}}};dhtmlXDataView=function(a){this.name="DataView";this.version="3.0";if(dhtmlx.assert_enabled()){this._assert()}dhtmlx.extend(this,dhtmlx.Settings);this._parseContainer(a,"dhx_dataview");dhtmlx.extend(this,dhtmlx.AtomDataLoader);dhtmlx.extend(this,dhtmlx.DataLoader);dhtmlx.extend(this,dhtmlx.EventSystem);dhtmlx.extend(this,dhtmlx.RenderStack);dhtmlx.extend(this,dhtmlx.SelectionModel);dhtmlx.extend(this,dhtmlx.MouseEvents);dhtmlx.extend(this,dhtmlx.KeyEvents);dhtmlx.extend(this,dhtmlx.EditAbility);dhtmlx.extend(this,dhtmlx.DataMove);dhtmlx.extend(this,dhtmlx.DragItem);dhtmlx.extend(this,dhtmlx.DataProcessor);dhtmlx.extend(this,dhtmlx.AutoTooltip);dhtmlx.extend(this,dhtmlx.Destruction);this.data.attachEvent("onStoreUpdated",dhtmlx.bind(function(){this.render.apply(this,arguments)},this));this._parseSettings(a,{drag:false,edit:false,select:"multiselect",type:"default"});if(this._settings.height!="auto"&&!this._settings.renderAll){dhtmlx.extend(this,dhtmlx.VirtualRenderStack)}this.data.provideApi(this,true);if(dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(this)}};dhtmlXDataView.prototype={bind:function(){dhx.BaseBind.legacyBind.apply(this,arguments)},sync:function(){dhx.BaseBind.legacySync.apply(this,arguments)},dragMarker:function(g,l){var j=this._locateHTML(g.target);if(this.type.drag_marker){if(this._drag_marker){this._drag_marker.style.backgroundImage="";this._drag_marker.style.backgroundRepeat=""}if(j){j.style.backgroundImage="url("+(dhtmlx.image_path||"")+this.type.drag_marker+")";j.style.backgroundRepeat="no-repeat";this._drag_marker=j}}if(j&&this._settings.auto_scroll){var a=j.offsetTop;var m=j.offsetHeight;var c=this._obj.scrollTop;var n=this._obj.offsetHeight;if(a-m>=0&&a-m*0.75<c){c=Math.max(a-m,0)}else{if(a+m/0.75>c+n){c=c+m}}this._obj.scrollTop=c}return true},_id:"dhx_f_id",on_click:{dhx_dataview_item:function(a,c){if(this.stopEdit(false,c)){if(this._settings.select){if(this._settings.select=="multiselect"){this.select(c,a.ctrlKey,a.shiftKey)}else{this.select(c)}}}}},on_dblclick:{dhx_dataview_item:function(a,c){if(this._settings.edit){this.edit(c)}}},on_mouse_move:{},types:{"default":{css:"default",template:dhtmlx.Template.fromHTML("<div style='padding:10px; white-space:nowrap; overflow:hidden;'>{obj.text}</div>"),template_edit:dhtmlx.Template.fromHTML("<div style='padding:10px; white-space:nowrap; overflow:hidden;'><textarea style='width:100%; height:100%;' bind='obj.text'></textarea></div>"),template_loading:dhtmlx.Template.fromHTML("<div style='padding:10px; white-space:nowrap; overflow:hidden;'>Loading...</div>"),width:210,height:115,margin:0,padding:10,border:1}},template_item_start:dhtmlx.Template.fromHTML("<div dhx_f_id='{-obj.id}' class='dhx_dataview_item dhx_dataview_{obj.css}_item{-obj.$selected?_selected:}' style='width:{obj.width}px; height:{obj.height}px; padding:{obj.padding}px; margin:{obj.margin}px; float:left; overflow:hidden;'>"),template_item_end:dhtmlx.Template.fromHTML("</div>")};dhtmlx.compat("layout");if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachDataView=function(a){this.callEvent("_onBeforeContentAttach",["dataview"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(typeof(a)=="undefined"){a={}}c.id="DataViewObject_"+new Date().getTime();a.container=c.id;a.skin=this.conf.skin;this.dataType="dataview";this.dataObj=new dhtmlXDataView(a);this.dataObj.setSizes=function(){this.render()};c=null;this.callEvent("_onContentAttach",[]);return this.dataObj}}function xmlPointer(a){this.d=a}xmlPointer.prototype={text:function(){if(!_isFF){return this.d.xml}var a=new XMLSerializer();return a.serializeToString(this.d)},get:function(a){return this.d.getAttribute(a)},exists:function(){return !!this.d},content:function(){return this.d.firstChild?(this.d.firstChild.wholeText||this.d.firstChild.data):""},each:function(j,n,m,l){var g=this.d.childNodes;var o=new xmlPointer();if(g.length){for(l=l||0;l<g.length;l++){if(g[l].tagName==j){o.d=g[l];if(n.apply(m,[o,l])==-1){return}}}}},get_all:function(){var g={};var c=this.d.attributes;for(var j=0;j<c.length;j++){g[c[j].name]=c[j].value}return g},sub:function(j){var g=this.d.childNodes;var m=new xmlPointer();if(g.length){for(var l=0;l<g.length;l++){if(g[l].tagName==j){m.d=g[l];return m}}}},up:function(a){return new xmlPointer(this.d.parentNode)},set:function(a,c){this.d.setAttribute(a,c)},clone:function(a){return new xmlPointer(this.d)},sub_exists:function(g){var c=this.d.childNodes;if(c.length){for(var j=0;j<c.length;j++){if(c[j].tagName==g){return true}}}return false},through:function(g,n,r,l,s){var o=this.d.childNodes;if(o.length){for(var j=0;j<o.length;j++){if(o[j].tagName==g&&o[j].getAttribute(n)!=null&&o[j].getAttribute(n)!=""&&(!r||o[j].getAttribute(n)==r)){var m=new xmlPointer(o[j]);l.apply(s,[m,j])}var q=this.d;this.d=o[j];this.through(g,n,r,l,s);this.d=q}}}};function dhtmlXTreeObject(m,j,c,a){if(dhtmlxEvent.initTouch){dhtmlxEvent.initTouch()}if(_isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(l){}}if(typeof(m)!="object"){this.parentObject=document.getElementById(m)}else{this.parentObject=m}this.parentObject.style.overflow="hidden";this._itim_dg=true;this.dlmtr=",";this.dropLower=false;this.enableIEImageFix(true);this.xmlstate=0;this.mytype="tree";this.smcheck=true;this.width=j;this.height=c;this.rootId=a;this.childCalc=null;this.def_img_x="18px";this.def_img_y="18px";this.def_line_img_x="18px";this.def_line_img_y="24px";this._dragged=new Array();this._selected=new Array();this.style_pointer="pointer";this._aimgs=true;this.htmlcA=" [";this.htmlcB="]";this.lWin=window;this.cMenu=0;this.mlitems=0;this.iconURL="";this.dadmode=0;this.slowParse=false;this.autoScroll=true;this.hfMode=0;this.nodeCut=new Array();this.XMLsource=0;this.XMLloadingWarning=0;this._idpull={};this._pullSize=0;this.treeLinesOn=true;this.tscheck=false;this.timgen=true;this.dpcpy=false;this._ld_id=null;this._oie_onXLE=[];this.imPath=window.dhx_globalImgPath||"";this.checkArray=new Array("iconUncheckAll.gif","iconCheckAll.gif","iconCheckGray.gif","iconUncheckDis.gif","iconCheckDis.gif","iconCheckDis.gif");this.radioArray=new Array("radio_off.gif","radio_on.gif","radio_on.gif","radio_off.gif","radio_on.gif","radio_on.gif");this.lineArray=new Array("line2.gif","line3.gif","line4.gif","blank.gif","blank.gif","line1.gif");this.minusArray=new Array("minus2.gif","minus3.gif","minus4.gif","minus.gif","minus5.gif");this.plusArray=new Array("plus2.gif","plus3.gif","plus4.gif","plus.gif","plus5.gif");this.imageArray=new Array("leaf.gif","folderOpen.gif","folderClosed.gif");this.cutImg=new Array(0,0,0);this.cutImage="but_cut.gif";dhx4._eventable(this);this.dragger=new dhtmlDragAndDropObject();this.htmlNode=new dhtmlXTreeItemObject(this.rootId,"",0,this);this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display="none";this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className="hiddenRow";this.allTree=this._createSelf();this.allTree.appendChild(this.htmlNode.htmlNode);if(dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(this)}if(_isFF){this.allTree.childNodes[0].width="100%";this.allTree.childNodes[0].style.overflow="hidden"}var g=this;this.allTree.onselectstart=new Function("return false;");if(_isMacOS){this.allTree.oncontextmenu=function(n){return g._doContClick(n||window.event,true)}}this.allTree.onmousedown=function(n){return g._doContClick(n||window.event)};this.XMLLoader=this._parseXMLTree;if(_isIE){this.preventIECashing(true)}this.selectionBar=document.createElement("DIV");this.selectionBar.className="selectionBar";this.selectionBar.innerHTML="&nbsp;";this.selectionBar.style.display="none";this.allTree.appendChild(this.selectionBar);if(window.addEventListener){window.addEventListener("unload",function(){try{g.destructor()}catch(n){}},false)}if(window.attachEvent){window.attachEvent("onunload",function(){try{g.destructor()}catch(n){}})}this.setImagesPath=this.setImagePath;this.setIconsPath=this.setIconPath;if(dhtmlx.image_path){this.setImagePath(dhtmlx.image_path)}this.setSkin(window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxtree")||"dhx_skyblue");return this}dhtmlXTreeObject.prototype.setDataMode=function(a){this._datamode=a};dhtmlXTreeObject.prototype._doContClick=function(n,a){if(!a&&n.button!=2){if(this._acMenu){if(this._acMenu.hideContextMenu){this._acMenu.hideContextMenu()}else{this.cMenu._contextEnd()}}return true}var c=(_isIE?n.srcElement:n.target);while((c)&&(c.tagName!="BODY")){if(c.parentObject){break}c=c.parentNode}if((!c)||(!c.parentObject)){return true}var l=c.parentObject;if(!this.callEvent("onRightClick",[l.id,n])){(n.srcElement||n.target).oncontextmenu=function(r){(r||event).cancelBubble=true;return false}}this._acMenu=(l.cMenu||this.cMenu);if(this._acMenu){if(!(this.callEvent("onBeforeContextMenu",[l.id]))){return true}if(!_isMacOS){(n.srcElement||n.target).oncontextmenu=function(r){(r||event).cancelBubble=true;return false}}if(this._acMenu.showContextMenu){var j=window.document.documentElement;var g=window.document.body;var o=new Array((j.scrollLeft||g.scrollLeft),(j.scrollTop||g.scrollTop));if(_isIE){var q=n.clientX+o[0];var m=n.clientY+o[1]}else{var q=n.pageX;var m=n.pageY}this._acMenu.showContextMenu(q-1,m-1);this.contextID=l.id;n.cancelBubble=true;this._acMenu._skip_hide=true}else{c.contextMenuId=l.id;c.contextMenu=this._acMenu;c.a=this._acMenu._contextStart;c.a(c,n);c.a=null}return false}return true};dhtmlXTreeObject.prototype.enableIEImageFix=function(a){if(!a){this._getImg=function(c){return document.createElement((c==this.rootId)?"div":"img")};this._setSrc=function(g,c){g.src=c};this._getSrc=function(c){return c.src}}else{this._getImg=function(){var c=document.createElement("DIV");c.innerHTML="&nbsp;";c.className="dhx_bg_img_fix";return c};this._setSrc=function(g,c){g.style.backgroundImage="url("+c+")"};this._getSrc=function(c){var g=c.style.backgroundImage;return g.substr(4,g.length-5).replace(/(^")|("$)/g,"")}}};dhtmlXTreeObject.prototype.destructor=function(){for(var c in this._idpull){var g=this._idpull[c];if(!g){continue}g.parentObject=null;g.treeNod=null;g.childNodes=null;g.span=null;g.tr.nodem=null;g.tr=null;g.htmlNode.objBelong=null;g.htmlNode=null;this._idpull[c]=null}this.parentObject.innerHTML="";this.allTree.onselectstart=null;this.allTree.oncontextmenu=null;this.allTree.onmousedown=null;for(var c in this){this[c]=null}};function cObject(){return this}cObject.prototype=new Object;cObject.prototype.clone=function(){function a(){}a.prototype=this;return new a()};function dhtmlXTreeItemObject(m,c,g,a,j,l){this.htmlNode="";this.acolor="";this.scolor="";this.tr=0;this.childsCount=0;this.tempDOMM=0;this.tempDOMU=0;this.dragSpan=0;this.dragMove=0;this.span=0;this.closeble=1;this.childNodes=new Array();this.userData=new cObject();this.checkstate=0;this.treeNod=a;this.label=c;this.parentObject=g;this.actionHandler=j;this.images=new Array(a.imageArray[0],a.imageArray[1],a.imageArray[2]);this.id=a._globalIdStorageAdd(m,this);if(this.treeNod.checkBoxOff){this.htmlNode=this.treeNod._createItem(1,this,l)}else{this.htmlNode=this.treeNod._createItem(0,this,l)}this.htmlNode.objBelong=this;return this}dhtmlXTreeObject.prototype._globalIdStorageAdd=function(c,a){if(this._globalIdStorageFind(c,1,1)){c=c+"_"+(new Date()).valueOf();return this._globalIdStorageAdd(c,a)}this._idpull[c]=a;this._pullSize++;return c};dhtmlXTreeObject.prototype._globalIdStorageSub=function(a){if(this._idpull[a]){this._unselectItem(this._idpull[a]);this._idpull[a]=null;this._pullSize--}if((this._locker)&&(this._locker[a])){this._locker[a]=false}};dhtmlXTreeObject.prototype._globalIdStorageFind=function(n,a,g,l){var m=this._idpull[n];if(m){if((m.unParsed)&&(!g)){this.reParse(m,0)}if(this._srnd&&!m.htmlNode){this._buildSRND(m,g)}if((l)&&(this._edsbpsA)){for(var c=0;c<this._edsbpsA.length;c++){if(this._edsbpsA[c][2]==n){dhx4.callEvent("ongetItemError",["Requested item still in parsing process.",n]);return null}}}return m}if((this.slowParse)&&(n!=0)&&(!a)){return this.preParse(n)}else{return null}};dhtmlXTreeObject.prototype._getSubItemsXML=function(a){var c=[];a.each("item",function(g){c.push(g.get("id"))},this);return c.join(this.dlmtr)};dhtmlXTreeObject.prototype.enableSmartXMLParsing=function(a){this.slowParse=dhx4.s2b(a)};dhtmlXTreeObject.prototype.findXML=function(c,a,g){};dhtmlXTreeObject.prototype._getAllCheckedXML=function(c,a,j){var g=[];if(j==2){c.through("item","checked",-1,function(l){g.push(l.get("id"))},this)}if(j==1){c.through("item","id",null,function(l){if(l.get("checked")&&(l.get("checked")!=-1)){g.push(l.get("id"))}},this)}if(j==0){c.through("item","id",null,function(l){if(!l.get("checked")||l.get("checked")==0){g.push(l.get("id"))}},this)}if(g.length){return a+(a?this.dlmtr:"")+g.join(this.dlmtr)}if(a){return a}else{return""}};dhtmlXTreeObject.prototype._setSubCheckedXML=function(a,c){var g=a?"1":"";c.through("item","id",null,function(j){if(!j.get("disabled")||j.get("disabled")==0){j.set("checked",g)}},this)};dhtmlXTreeObject.prototype._getAllScraggyItemsXML=function(g,a){var j=[];var c=function(l){if(!l.sub_exists("item")){j.push(l.get("id"))}else{l.each("item",c,this)}};c(g);return j.join(",")};dhtmlXTreeObject.prototype._getAllFatItemsXML=function(g,a){var j=[];var c=function(l){if(!l.sub_exists("item")){return}j.push(l.get("id"));l.each("item",c,this)};c(g);return j.join(",")};dhtmlXTreeObject.prototype._getAllSubItemsXML=function(g,c,a){var c=[];a.through("item","id",null,function(j){c.push(j.get("id"))},this);return c.join(",")};dhtmlXTreeObject.prototype.reParse=function(g){var m=this;if(!this.parsCount){m.callEvent("onXLS",[m,g.id])}this.xmlstate=1;var j=g.unParsed;g.unParsed=0;this.XMLloadingWarning=1;var a=this.parsingOn;var o=this.waitUpdateXML;var q=this.parsedArray;this.parsedArray=new Array();this.waitUpdateXML=false;this.parsingOn=g.id;this.parsedArray=new Array();this.setCheckList="";this._parse(j,g.id,2);var r=this.setCheckList.split(this.dlmtr);for(var l=0;l<this.parsedArray.length;l++){g.htmlNode.childNodes[0].appendChild(this.parsedArray[l])}if(j.get("order")&&j.get("order")!="none"){this._reorderBranch(g,j.get("order"),true)}this.oldsmcheck=this.smcheck;this.smcheck=false;for(var c=0;c<r.length;c++){if(r[c]){this.setCheck(r[c],1)}}this.smcheck=this.oldsmcheck;this.parsingOn=a;this.waitUpdateXML=o;this.parsedArray=q;this.XMLloadingWarning=0;this._redrawFrom(this,g);if(this._srnd&&!g._sready){this.prepareSR(g.id)}this.xmlstate=0;return true};dhtmlXTreeObject.prototype.preParse=function(c){if(!c||!this._p){return null}var a=false;this._p.clone().through("item","id",c,function(j){this._globalIdStorageFind(j.up().get("id"));return a=true},this);if(a){var g=this._globalIdStorageFind(c,true,false);if(!g){dhx4.callEvent("ongetItemError",["The item "+c+" not operable. Seems you have non-unique|incorrect IDs in tree's XML.",c])}}return g};dhtmlXTreeObject.prototype._escape=function(a){switch(this.utfesc){case"none":return a;break;case"utf8":return encodeURIComponent(a);break;default:return escape(a);break}};dhtmlXTreeObject.prototype._drawNewTr=function(l,g){var j=document.createElement("tr");var c=document.createElement("td");var a=document.createElement("td");c.appendChild(document.createTextNode(" "));a.colSpan=3;a.appendChild(l);j.appendChild(c);j.appendChild(a);return j};dhtmlXTreeObject.prototype.loadXMLString=function(g,c){var a=this;if(!this.parsCount){this.callEvent("onXLS",[a,null])}this.xmlstate=1;this.XMLLoader({responseXML:dhx4.ajax.parse(g)},c)};dhtmlXTreeObject.prototype.loadXML=function(c,j){if(this._datamode&&this._datamode!="xml"){return this["load"+this._datamode.toUpperCase()](c,j)}var g=this;if(!this.parsCount){this.callEvent("onXLS",[g,this._ld_id])}this._ld_id=null;this.xmlstate=1;this.XMLLoader=this._parseXMLTree;var a=this;dhx4.ajax.get(c,function(l){a.XMLLoader(l.xmlDoc,j);a=null})};dhtmlXTreeObject.prototype._attachChildNode=function(o,m,j,q,E,D,C,r,g,v,w){if(v&&v.parentObject){o=v.parentObject}if(((o.XMLload==0)&&(this.XMLsource))&&(!this.XMLloadingWarning)){o.XMLload=1;this._loadDynXML(o.id)}var s=o.childsCount;var F=o.childNodes;if(w&&w.tr.previousSibling){if(w.tr.previousSibling.previousSibling){v=w.tr.previousSibling.nodem}else{r=r.replace("TOP","")+",TOP"}}if(v){var l,A;for(l=0;l<s;l++){if(F[l]==v){for(A=s;A!=l;A--){F[1+A]=F[A]}break}}l++;s=l}if(r){var x=r.split(",");for(var y=0;y<x.length;y++){switch(x[y]){case"TOP":if(o.childsCount>0){v=new Object;v.tr=o.childNodes[0].tr.previousSibling}o._has_top=true;for(l=s;l>0;l--){F[l]=F[l-1]}s=0;break}}}var u;if(!(u=this._idpull[m])||u.span!=-1){u=F[s]=new dhtmlXTreeItemObject(m,j,o,this,q,1);m=F[s].id;o.childsCount++}if(!u.htmlNode){u.label=j;u.htmlNode=this._createItem((this.checkBoxOff?1:0),u);u.htmlNode.objBelong=u}if(E){u.images[0]=E}if(D){u.images[1]=D}if(C){u.images[2]=C}var c=this._drawNewTr(u.htmlNode);if((this.XMLloadingWarning)||(this._hAdI)){u.htmlNode.parentNode.parentNode.style.display="none"}if((v)&&v.tr&&(v.tr.nextSibling)){o.htmlNode.childNodes[0].insertBefore(c,v.tr.nextSibling)}else{if(this.parsingOn==o.id){this.parsedArray[this.parsedArray.length]=c}else{o.htmlNode.childNodes[0].appendChild(c)}}if((v)&&(!v.span)){v=null}if(this.XMLsource){if((g)&&(g!=0)){u.XMLload=0}else{u.XMLload=1}}u.tr=c;c.nodem=u;if(o.itemId==0){c.childNodes[0].className="hiddenRow"}if((o._r_logic)||(this._frbtr)){this._setSrc(u.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0],this.imPath+this.radioArray[0])}if(r){var x=r.split(",");for(var y=0;y<x.length;y++){switch(x[y]){case"SELECT":this.selectItem(m,false);break;case"CALL":this.selectItem(m,true);break;case"CHILD":u.XMLload=0;break;case"CHECKED":if(this.XMLloadingWarning){this.setCheckList+=this.dlmtr+m}else{this.setCheck(m,1)}break;case"HCHECKED":this._setCheck(u,"unsure");break;case"OPEN":u.openMe=1;break}}}if(!this.XMLloadingWarning){if((this._getOpenState(o)<0)&&(!this._hAdI)){this.openItem(o.id)}if(v){this._correctPlus(v);this._correctLine(v)}this._correctPlus(o);this._correctLine(o);this._correctPlus(u);if(o.childsCount>=2){this._correctPlus(F[o.childsCount-2]);this._correctLine(F[o.childsCount-2])}if(o.childsCount!=2){this._correctPlus(F[0])}if(this.tscheck){this._correctCheckStates(o)}if(this._onradh){if(this.xmlstate==1){var a=this.onXLE;this.onXLE=function(n){this._onradh(m);if(a){a(n)}}}else{this._onradh(m)}}}return u};dhtmlXTreeObject.prototype.enableContextMenu=function(a){if(a){this.cMenu=a}};dhtmlXTreeObject.prototype.setItemContextMenu=function(m,j){var a=m.toString().split(this.dlmtr);for(var g=0;g<a.length;g++){var c=this._globalIdStorageFind(a[g]);if(!c){continue}c.cMenu=j}};dhtmlXTreeObject.prototype.insertNewItem=function(j,o,r,g,n,m,l,c,a){var s=this._globalIdStorageFind(j);if(!s){return(-1)}var q=this._attachChildNode(s,o,r,g,n,m,l,c,a);if(!this._idpull[this.rootId].XMLload){this._idpull[this.rootId].XMLload=1}if((!this.XMLloadingWarning)&&(this.childCalc)){this._fixChildCountLabel(s)}return q};dhtmlXTreeObject.prototype.insertNewChild=function(j,o,q,g,n,m,l,c,a){return this.insertNewItem(j,o,q,g,n,m,l,c,a)};dhtmlXTreeObject.prototype._parseXMLTree=function(a,g){var c=new xmlPointer(dhx4.ajax.xmltop("tree",a));this._parse(c);this._p=c;if(g){g.call(this,a)}};dhtmlXTreeObject.prototype._parseItem=function(m,r,l,o){var g;if(this._srnd&&(!this._idpull[g=m.get("id")]||!this._idpull[g].span)){this._addItemSRND(r.id,g,m);return}var n=m.get_all();if((typeof(this.waitUpdateXML)=="object")&&(!this.waitUpdateXML[n.id])){this._parse(m,n.id,1);return}if((n.text===null)||(typeof(n.text)=="undefined")){n.text=m.sub("itemtext");if(n.text){n.text=n.text.content()}}var u=[];if(n.select){u.push("SELECT")}if(n.top){u.push("TOP")}if(n.call){this.nodeAskingCall=n.id}if(n.checked==-1){u.push("HCHECKED")}else{if(n.checked){u.push("CHECKED")}}if(n.open){u.push("OPEN")}if(this.waitUpdateXML){if(this._globalIdStorageFind(n.id)){var q=this.updateItem(n.id,n.text,n.im0,n.im1,n.im2,n.checked,n.child)}else{if(this.npl==0){u.push("TOP")}else{l=r.childNodes[this.npl]}var q=this._attachChildNode(r,n.id,n.text,0,n.im0,n.im1,n.im2,u.join(","),n.child,0,l);n.id=q.id;l=null}}else{var q=this._attachChildNode(r,n.id,n.text,0,n.im0,n.im1,n.im2,u.join(","),n.child,(o||0),l)}if(n.tooltip){q.span.parentNode.parentNode.title=n.tooltip}if(n.style){if(q.span.style.cssText){q.span.style.cssText+=(";"+n.style)}else{q.span.setAttribute("style",q.span.getAttribute("style")+"; "+n.style)}}if(n.radio){q._r_logic=true}if(n.nocheckbox){var s=q.span.parentNode.previousSibling.previousSibling;s.style.display="none";q.nocheckbox=true}if(n.disabled){if(n.checked!=null){this._setCheck(q,n.checked)}this.disableCheckbox(q,1)}q._acc=n.child||0;if(this.parserExtension){this.parserExtension._parseExtension.call(this,m,n,(r?r.id:0))}this.setItemColor(q,n.aCol,n.sCol);if(n.locked=="1"){this.lockItem(q.id,true,true)}if((n.imwidth)||(n.imheight)){this.setIconSize(n.imwidth,n.imheight,q)}if((n.closeable=="0")||(n.closeable=="1")){this.setItemCloseable(q,n.closeable)}var j="";if(n.topoffset){this.setItemTopOffset(q,n.topoffset)}if((!this.slowParse)||(typeof(this.waitUpdateXML)=="object")){if(m.sub_exists("item")){j=this._parse(m,n.id,1)}}else{if((!q.childsCount)&&m.sub_exists("item")){q.unParsed=m.clone()}m.each("userdata",function(a){this.setUserData(n.id,a.get("name"),a.content())},this)}if(j!=""){this.nodeAskingCall=j}m.each("userdata",function(a){this.setUserData(m.get("id"),a.get("name"),a.content())},this)};dhtmlXTreeObject.prototype._parse=function(g,m,a,c){if(this._srnd&&!this.parentObject.offsetHeight){var w=this;return window.setTimeout(function(){w._parse(g,m,a,c)},100)}if(!g.exists()){return}this.skipLock=true;if(!m){m=g.get("id");var u=g.get("dhx_security");if(u){dhtmlx.security_key=u}if(g.get("radio")){this.htmlNode._r_logic=true}this.parsingOn=m;this.parsedArray=new Array();this.setCheckList="";this.nodeAskingCall=""}var v=this._globalIdStorageFind(m);if(!v){return dhx4.callEvent("onDataStructureError",["XML refers to not existing parent"])}this.parsCount=this.parsCount?(this.parsCount+1):1;this.XMLloadingWarning=1;if((v.childsCount)&&(!c)&&(!this._edsbps)&&(!v._has_top)){var o=0}else{var o=0}this.npl=0;g.each("item",function(x,n){v.XMLload=1;this._parseItem(x,v,0,o);if((this._edsbps)&&(this.npl==this._edsbpsC)){this._distributedStart(g,n+1,m,a,v.childsCount);return -1}this.npl++},this,c);if(!a){g.each("userdata",function(n){this.setUserData(g.get("id"),n.get("name"),n.content())},this);v.XMLload=1;if(this.waitUpdateXML){this.waitUpdateXML=false;for(var l=v.childsCount-1;l>=0;l--){if(v.childNodes[l]._dmark){this.deleteItem(v.childNodes[l].id)}}}var r=this._globalIdStorageFind(this.parsingOn);for(var l=0;l<this.parsedArray.length;l++){v.htmlNode.childNodes[0].appendChild(this.parsedArray[l])}this.parsedArray=[];this.lastLoadedXMLId=m;this.XMLloadingWarning=0;var s=this.setCheckList.split(this.dlmtr);for(var j=0;j<s.length;j++){if(s[j]){this.setCheck(s[j],1)}}if((this.XMLsource)&&(this.tscheck)&&(this.smcheck)&&(v.id!=this.rootId)){if(v.checkstate===0){this._setSubChecked(0,v)}else{if(v.checkstate===1){this._setSubChecked(1,v)}}}this._redrawFrom(this,null,c);if(g.get("order")&&g.get("order")!="none"){this._reorderBranch(v,g.get("order"),true)}if(this.nodeAskingCall!=""){this.callEvent("onClick",[this.nodeAskingCall,this.getSelectedItemId()])}if(this._branchUpdate){this._branchUpdateNext(g)}}if(this.parsCount==1){this.parsingOn=null;if(this._srnd&&v.id!=this.rootId){this.prepareSR(v.id);if(this.XMLsource){this.openItem(v.id)}}g.through("item","open",null,function(n){this.openItem(n.get("id"))},this);if((!this._edsbps)||(!this._edsbpsA.length)){var q=this;window.setTimeout(function(){q.callEvent("onXLE",[q,m])},1);this.xmlstate=0}this.skipLock=false}this.parsCount--;var q=this;if(this._edsbps){window.setTimeout(function(){q._distributedStep(m)},this._edsbpsD)}if(!a&&this.onXLE){this.onXLE(this,m)}return this.nodeAskingCall};dhtmlXTreeObject.prototype._branchUpdateNext=function(a){a.each("item",function(j){var g=j.get("id");if(this._idpull[g]&&(!this._idpull[g].XMLload)){return}this._branchUpdate++;this.smartRefreshItem(j.get("id"),j)},this);this._branchUpdate--};dhtmlXTreeObject.prototype.checkUserData=function(c,g){if((c.nodeType==1)&&(c.tagName=="userdata")){var a=c.getAttribute("name");if((a)&&(c.childNodes[0])){this.setUserData(g,a,c.childNodes[0].data)}}};dhtmlXTreeObject.prototype._redrawFrom=function(o,c,n,g){if(!c){var l=o._globalIdStorageFind(o.lastLoadedXMLId);o.lastLoadedXMLId=-1;if(!l){return 0}}else{l=c}var m=0;for(var j=(n?n-1:0);j<l.childsCount;j++){if((!this._branchUpdate)||(this._getOpenState(l)==1)){if((!c)||(g==1)){l.childNodes[j].htmlNode.parentNode.parentNode.style.display=""}}if(l.childNodes[j].openMe==1){this._openItem(l.childNodes[j]);l.childNodes[j].openMe=0}o._redrawFrom(o,l.childNodes[j]);if(this.childCalc!=null){if((l.childNodes[j].unParsed)||((!l.childNodes[j].XMLload)&&(this.XMLsource))){if(l.childNodes[j]._acc){l.childNodes[j].span.innerHTML=l.childNodes[j].label+this.htmlcA+l.childNodes[j]._acc+this.htmlcB}else{l.childNodes[j].span.innerHTML=l.childNodes[j].label}}if((l.childNodes[j].childNodes.length)&&(this.childCalc)){if(this.childCalc==1){l.childNodes[j].span.innerHTML=l.childNodes[j].label+this.htmlcA+l.childNodes[j].childsCount+this.htmlcB}if(this.childCalc==2){var a=l.childNodes[j].childsCount-(l.childNodes[j].pureChilds||0);if(a){l.childNodes[j].span.innerHTML=l.childNodes[j].label+this.htmlcA+a+this.htmlcB}if(l.pureChilds){l.pureChilds++}else{l.pureChilds=1}}if(this.childCalc==3){l.childNodes[j].span.innerHTML=l.childNodes[j].label+this.htmlcA+l.childNodes[j]._acc+this.htmlcB}if(this.childCalc==4){var a=l.childNodes[j]._acc;if(a){l.childNodes[j].span.innerHTML=l.childNodes[j].label+this.htmlcA+a+this.htmlcB}}}else{if(this.childCalc==4){m++}}m+=l.childNodes[j]._acc;if(this.childCalc==3){m++}}}if((!l.unParsed)&&((l.XMLload)||(!this.XMLsource))){l._acc=m}o._correctLine(l);o._correctPlus(l);if((this.childCalc)&&(!c)){o._fixChildCountLabel(l)}};dhtmlXTreeObject.prototype._createSelf=function(){var a=document.createElement("div");a.className="containerTableStyle";a.style.width=this.width;a.style.height=this.height;this.parentObject.appendChild(a);return a};dhtmlXTreeObject.prototype._xcloseAll=function(c){if(c.unParsed){return}if(this.rootId!=c.id){if(!c.htmlNode){return}var j=c.htmlNode.childNodes[0].childNodes;var a=j.length;for(var g=1;g<a;g++){j[g].style.display="none"}this._correctPlus(c)}for(var g=0;g<c.childsCount;g++){if(c.childNodes[g].childsCount){this._xcloseAll(c.childNodes[g])}}};dhtmlXTreeObject.prototype._xopenAll=function(a){this._HideShow(a,2);for(var c=0;c<a.childsCount;c++){this._xopenAll(a.childNodes[c])}};dhtmlXTreeObject.prototype._correctPlus=function(c){if(!c.htmlNode){return}var g=c.htmlNode.childNodes[0].childNodes[0].childNodes[0].lastChild;var l=c.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0];var a=this.lineArray;if((this.XMLsource)&&(!c.XMLload)){var a=this.plusArray;this._setSrc(l,this.iconURL+c.images[2]);if(this._txtimg){return(g.innerHTML="[+]")}}else{if((c.childsCount)||(c.unParsed)){if((c.htmlNode.childNodes[0].childNodes[1])&&(c.htmlNode.childNodes[0].childNodes[1].style.display!="none")){if(!c.wsign){var a=this.minusArray}this._setSrc(l,this.iconURL+c.images[1]);if(this._txtimg){return(g.innerHTML="[-]")}}else{if(!c.wsign){var a=this.plusArray}this._setSrc(l,this.iconURL+c.images[2]);if(this._txtimg){return(g.innerHTML="[+]")}}}else{this._setSrc(l,this.iconURL+c.images[0])}}var j=2;if(!c.treeNod.treeLinesOn){this._setSrc(g,this.imPath+a[3])}else{if(c.parentObject){j=this._getCountStatus(c.id,c.parentObject)}this._setSrc(g,this.imPath+a[j])}};dhtmlXTreeObject.prototype._correctLine=function(c){if(!c.htmlNode){return}var a=c.parentObject;if(a){if((this._getLineStatus(c.id,a)==0)||(!this.treeLinesOn)){for(var g=1;g<=c.childsCount;g++){if(!c.htmlNode.childNodes[0].childNodes[g]){break}c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundImage="";c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundRepeat=""}}else{for(var g=1;g<=c.childsCount;g++){if(!c.htmlNode.childNodes[0].childNodes[g]){break}c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundImage="url("+this.imPath+this.lineArray[5]+")";c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundRepeat="repeat-y"}}}};dhtmlXTreeObject.prototype._getCountStatus=function(c,a){if(a.childsCount<=1){if(a.id==this.rootId){return 4}else{return 0}}if(a.childNodes[0].id==c){if(a.id==this.rootId){return 2}else{return 1}}if(a.childNodes[a.childsCount-1].id==c){return 0}return 1};dhtmlXTreeObject.prototype._getLineStatus=function(c,a){if(a.childNodes[a.childsCount-1].id==c){return 0}return 1};dhtmlXTreeObject.prototype._HideShow=function(c,l){if((this.XMLsource)&&(!c.XMLload)){if(l==1){return}c.XMLload=1;this._loadDynXML(c.id);return}if(c.unParsed){this.reParse(c)}var j=c.htmlNode.childNodes[0].childNodes;var a=j.length;if(a>1){if(((j[1].style.display!="none")||(l==1))&&(l!=2)){this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0";nodestyle="none"}else{nodestyle=""}for(var g=1;g<a;g++){j[g].style.display=nodestyle}}this._correctPlus(c)};dhtmlXTreeObject.prototype._getOpenState=function(a){if(!a.htmlNode){return 0}var c=a.htmlNode.childNodes[0].childNodes;if(c.length<=1){return 0}if(c[1].style.display!="none"){return 1}else{return -1}};dhtmlXTreeObject.prototype.onRowClick2=function(){var a=this.parentObject.treeNod;if(!a.callEvent("onDblClick",[this.parentObject.id,a])){return false}if((this.parentObject.closeble)&&(this.parentObject.closeble!="0")){a._HideShow(this.parentObject)}else{a._HideShow(this.parentObject,2)}if(a.checkEvent("onOpenEnd")){if(!a.xmlstate){a.callEvent("onOpenEnd",[this.parentObject.id,a._getOpenState(this.parentObject)])}else{a._oie_onXLE.push(a.onXLE);a.onXLE=a._epnFHe}}return false};dhtmlXTreeObject.prototype.onRowClick=function(){var a=this.parentObject.treeNod;if(!a.callEvent("onOpenStart",[this.parentObject.id,a._getOpenState(this.parentObject)])){return 0}if((this.parentObject.closeble)&&(this.parentObject.closeble!="0")){a._HideShow(this.parentObject)}else{a._HideShow(this.parentObject,2)}if(a.checkEvent("onOpenEnd")){if(!a.xmlstate){a.callEvent("onOpenEnd",[this.parentObject.id,a._getOpenState(this.parentObject)])}else{a._oie_onXLE.push(a.onXLE);a.onXLE=a._epnFHe}}};dhtmlXTreeObject.prototype._epnFHe=function(c,g,a){if(g!=this.rootId){this.callEvent("onOpenEnd",[g,c.getOpenState(g)])}c.onXLE=c._oie_onXLE.pop();if(!a&&!c._oie_onXLE.length){if(c.onXLE){c.onXLE(c,g)}}};dhtmlXTreeObject.prototype.onRowClickDown=function(c){c=c||window.event;var a=this.parentObject.treeNod;a._selectItem(this.parentObject,c)};dhtmlXTreeObject.prototype.getSelectedItemId=function(){var c=new Array();for(var a=0;a<this._selected.length;a++){c[a]=this._selected[a].id}return(c.join(this.dlmtr))};dhtmlXTreeObject.prototype._selectItem=function(m,n){if(this.checkEvent("onSelect")){this._onSSCFold=this.getSelectedItemId()}if((!this._amsel)||(!n)||((!n.ctrlKey)&&(!n.metaKey)&&(!n.shiftKey))){this._unselectItems()}if((m.i_sel)&&(this._amsel)&&(n)&&(n.ctrlKey||n.metaKey)){this._unselectItem(m)}else{if((!m.i_sel)&&((!this._amselS)||(this._selected.length==0)||(this._selected[0].parentObject==m.parentObject))){if((this._amsel)&&(n)&&(n.shiftKey)&&(this._selected.length!=0)&&(this._selected[this._selected.length-1].parentObject==m.parentObject)){var j=this._getIndex(this._selected[this._selected.length-1]);var g=this._getIndex(m);if(g<j){var q=j;j=g;g=q}for(var l=j;l<=g;l++){if(!m.parentObject.childNodes[l].i_sel){this._markItem(m.parentObject.childNodes[l])}}}else{this._markItem(m)}}}if(this.checkEvent("onSelect")){var o=this.getSelectedItemId();if(o!=this._onSSCFold){this.callEvent("onSelect",[o])}}};dhtmlXTreeObject.prototype._markItem=function(a){if(a.scolor){a.span.style.color=a.scolor}a.span.className="selectedTreeRow";a.i_sel=true;this._selected[this._selected.length]=a};dhtmlXTreeObject.prototype.getIndexById=function(c){var a=this._globalIdStorageFind(c);if(!a){return null}return this._getIndex(a)};dhtmlXTreeObject.prototype._getIndex=function(a){var g=a.parentObject;for(var c=0;c<g.childsCount;c++){if(g.childNodes[c]==a){return c}}};dhtmlXTreeObject.prototype._unselectItem=function(c){if((c)&&(c.i_sel)){c.span.className="standartTreeRow";if(c.acolor){c.span.style.color=c.acolor}c.i_sel=false;for(var a=0;a<this._selected.length;a++){if(!this._selected[a].i_sel){this._selected.splice(a,1);break}}}};dhtmlXTreeObject.prototype._unselectItems=function(){for(var a=0;a<this._selected.length;a++){var c=this._selected[a];c.span.className="standartTreeRow";if(c.acolor){c.span.style.color=c.acolor}c.i_sel=false}this._selected=new Array()};dhtmlXTreeObject.prototype.onRowSelect=function(j,g,m){j=j||window.event;var c=this.parentObject;if(g){c=g.parentObject}var a=c.treeNod;var l=a.getSelectedItemId();if((!j)||(!j.skipUnSel)){a._selectItem(c,j)}if(!m){if(c.actionHandler){c.actionHandler(c.id,l)}else{a.callEvent("onClick",[c.id,l])}}};dhtmlXTreeObject.prototype._correctCheckStates=function(l){if(!this.tscheck){return}if(!l){return}if(l.id==this.rootId){return}var g=l.childNodes;var c=0;var a=0;if(l.childsCount==0){return}for(var j=0;j<l.childsCount;j++){if(g[j].dscheck){continue}if(g[j].checkstate==0){c=1}else{if(g[j].checkstate==1){a=1}else{c=1;a=1;break}}}if((c)&&(a)){this._setCheck(l,"unsure")}else{if(c){this._setCheck(l,false)}else{this._setCheck(l,true)}}this._correctCheckStates(l.parentObject)};dhtmlXTreeObject.prototype.onCheckBoxClick=function(a){if(!this.treeNod.callEvent("onBeforeCheck",[this.parentObject.id,this.parentObject.checkstate])){return}if(this.parentObject.dscheck){return true}if(this.treeNod.tscheck){if(this.parentObject.checkstate==1){this.treeNod._setSubChecked(false,this.parentObject)}else{this.treeNod._setSubChecked(true,this.parentObject)}}else{if(this.parentObject.checkstate==1){this.treeNod._setCheck(this.parentObject,false)}else{this.treeNod._setCheck(this.parentObject,true)}}this.treeNod._correctCheckStates(this.parentObject.parentObject);return this.treeNod.callEvent("onCheck",[this.parentObject.id,this.parentObject.checkstate])};dhtmlXTreeObject.prototype._createItem=function(u,s,o){var v=document.createElement("table");v.cellSpacing=0;v.cellPadding=0;v.border=0;if(this.hfMode){v.style.tableLayout="fixed"}v.style.margin=0;v.style.padding=0;var n=document.createElement("tbody");var r=document.createElement("tr");var j=document.createElement("td");j.className="standartTreeImage";if(this._txtimg){var l=document.createElement("div");j.appendChild(l);l.className="dhx_tree_textSign"}else{var l=this._getImg(s.id);l.border="0";if(l.tagName=="IMG"){l.align="absmiddle"}j.appendChild(l);l.style.padding=0;l.style.margin=0;l.style.width=this.def_line_img_x}var g=document.createElement("td");var q=this._getImg(this.cBROf?this.rootId:s.id);q.checked=0;this._setSrc(q,this.imPath+this.checkArray[0]);q.style.width="18px";q.style.height="18px";if(!u){g.style.display="none"}g.appendChild(q);if((!this.cBROf)&&(q.tagName=="IMG")){q.align="absmiddle"}q.onclick=this.onCheckBoxClick;q.treeNod=this;q.parentObject=s;if(!window._KHTMLrv){g.width="20px"}else{g.width="16px"}var c=document.createElement("td");c.className="standartTreeImage";var m=this._getImg(this.timgen?s.id:this.rootId);m.onmousedown=this._preventNsDrag;m.ondragstart=this._preventNsDrag;m.border="0";if(this._aimgs){m.parentObject=s;if(m.tagName=="IMG"){m.align="absmiddle"}m.onclick=this.onRowSelect}if(!o){this._setSrc(m,this.iconURL+this.imageArray[0])}c.appendChild(m);m.style.padding=0;m.style.margin=0;if(this.timgen){c.style.width=m.style.width=this.def_img_x;m.style.height=this.def_img_y}else{m.style.width="0px";m.style.height="0px";if(_isOpera||window._KHTMLrv){c.style.display="none"}}var a=document.createElement("td");a.className="standartTreeRow";s.span=document.createElement("span");s.span.className="standartTreeRow";if(this.mlitems){s.span.style.width=this.mlitems;s.span.style.display="block"}else{a.noWrap=true}if(dhx4.isIE8){a.style.width="99999px"}else{if(!window._KHTMLrv){a.style.width="100%"}}s.span.innerHTML=s.label;a.appendChild(s.span);a.parentObject=s;j.parentObject=s;a.onclick=this.onRowSelect;j.onclick=this.onRowClick;a.ondblclick=this.onRowClick2;if(this.ettip){r.title=s.label}if(this.dragAndDropOff){if(this._aimgs){this.dragger.addDraggableItem(c,this);c.parentObject=s}this.dragger.addDraggableItem(a,this)}s.span.style.paddingLeft="5px";s.span.style.paddingRight="5px";a.style.verticalAlign="";a.style.fontSize="10pt";a.style.cursor=this.style_pointer;r.appendChild(j);r.appendChild(g);r.appendChild(c);r.appendChild(a);n.appendChild(r);v.appendChild(n);if(this.ehlt||this.checkEvent("onMouseIn")||this.checkEvent("onMouseOut")){r.onmousemove=this._itemMouseIn;r[(_isIE)?"onmouseleave":"onmouseout"]=this._itemMouseOut}return v};dhtmlXTreeObject.prototype.setImagePath=function(a){this.imPath=a;this.iconURL=a};dhtmlXTreeObject.prototype.setIconPath=function(a){this.iconURL=a};dhtmlXTreeObject.prototype._getLeafCount=function(j){var g=0;for(var c=0;c<j.childsCount;c++){if(j.childNodes[c].childsCount==0){g++}}return g};dhtmlXTreeObject.prototype._getChildCounterValue=function(c){var a=this._globalIdStorageFind(c);if(!a){return 0}if((a.unParsed)||((!a.XMLload)&&(this.XMLsource))){return a._acc}switch(this.childCalc){case 1:return a.childsCount;break;case 2:return this._getLeafCount(a);break;case 3:return a._acc;break;case 4:return a._acc;break}};dhtmlXTreeObject.prototype._fixChildCountLabel=function(m,j){if(this.childCalc==null){return}if((m.unParsed)||((!m.XMLload)&&(this.XMLsource))){if(m._acc){m.span.innerHTML=m.label+this.htmlcA+m._acc+this.htmlcB}else{m.span.innerHTML=m.label}return}switch(this.childCalc){case 1:if(m.childsCount!=0){m.span.innerHTML=m.label+this.htmlcA+m.childsCount+this.htmlcB}else{m.span.innerHTML=m.label}break;case 2:var l=this._getLeafCount(m);if(l!=0){m.span.innerHTML=m.label+this.htmlcA+l+this.htmlcB}else{m.span.innerHTML=m.label}break;case 3:if(m.childsCount!=0){var g=0;for(var c=0;c<m.childsCount;c++){if(!m.childNodes[c]._acc){m.childNodes[c]._acc=0}g+=m.childNodes[c]._acc*1}g+=m.childsCount*1;m.span.innerHTML=m.label+this.htmlcA+g+this.htmlcB;m._acc=g}else{m.span.innerHTML=m.label;m._acc=0}if((m.parentObject)&&(m.parentObject!=this.htmlNode)){this._fixChildCountLabel(m.parentObject)}break;case 4:if(m.childsCount!=0){var g=0;for(var c=0;c<m.childsCount;c++){if(!m.childNodes[c]._acc){m.childNodes[c]._acc=1}g+=m.childNodes[c]._acc*1}m.span.innerHTML=m.label+this.htmlcA+g+this.htmlcB;m._acc=g}else{m.span.innerHTML=m.label;m._acc=1}if((m.parentObject)&&(m.parentObject!=this.htmlNode)){this._fixChildCountLabel(m.parentObject)}break}};dhtmlXTreeObject.prototype.setChildCalcMode=function(a){switch(a){case"child":this.childCalc=1;break;case"leafs":this.childCalc=2;break;case"childrec":this.childCalc=3;break;case"leafsrec":this.childCalc=4;break;case"disabled":this.childCalc=null;break;default:this.childCalc=4}};dhtmlXTreeObject.prototype.setChildCalcHTML=function(c,a){this.htmlcA=c;this.htmlcB=a};dhtmlXTreeObject.prototype.setOnRightClickHandler=function(a){this.attachEvent("onRightClick",a)};dhtmlXTreeObject.prototype.setOnClickHandler=function(a){this.attachEvent("onClick",a)};dhtmlXTreeObject.prototype.setOnSelectStateChange=function(a){this.attachEvent("onSelect",a)};dhtmlXTreeObject.prototype.setXMLAutoLoading=function(a){this.XMLsource=a};dhtmlXTreeObject.prototype.setOnCheckHandler=function(a){this.attachEvent("onCheck",a)};dhtmlXTreeObject.prototype.setOnOpenHandler=function(a){this.attachEvent("onOpenStart",a)};dhtmlXTreeObject.prototype.setOnOpenStartHandler=function(a){this.attachEvent("onOpenStart",a)};dhtmlXTreeObject.prototype.setOnOpenEndHandler=function(a){this.attachEvent("onOpenEnd",a)};dhtmlXTreeObject.prototype.setOnDblClickHandler=function(a){this.attachEvent("onDblClick",a)};dhtmlXTreeObject.prototype.openAllItems=function(c){var a=this._globalIdStorageFind(c);if(!a){return 0}this._xopenAll(a)};dhtmlXTreeObject.prototype.getOpenState=function(c){var a=this._globalIdStorageFind(c);if(!a){return""}return this._getOpenState(a)};dhtmlXTreeObject.prototype.closeAllItems=function(c){if(c===window.undefined){c=this.rootId}var a=this._globalIdStorageFind(c);if(!a){return 0}this._xcloseAll(a);this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0"};dhtmlXTreeObject.prototype.setUserData=function(j,c,g){var a=this._globalIdStorageFind(j,0,true);if(!a){return}if(c=="hint"){a.htmlNode.childNodes[0].childNodes[0].title=g}if(typeof(a.userData["t_"+c])=="undefined"){if(!a._userdatalist){a._userdatalist=c}else{a._userdatalist+=","+c}}a.userData["t_"+c]=g};dhtmlXTreeObject.prototype.getUserData=function(g,c){var a=this._globalIdStorageFind(g,0,true);if(!a){return}return a.userData["t_"+c]};dhtmlXTreeObject.prototype.getItemColor=function(g){var a=this._globalIdStorageFind(g);if(!a){return 0}var c=new Object();if(a.acolor){c.acolor=a.acolor}if(a.scolor){c.scolor=a.scolor}return c};dhtmlXTreeObject.prototype.setItemColor=function(g,c,j){if((g)&&(g.span)){var a=g}else{var a=this._globalIdStorageFind(g)}if(!a){return 0}else{if(a.i_sel){if(j){a.span.style.color=j}}else{if(c){a.span.style.color=c}}if(j){a.scolor=j}if(c){a.acolor=c}}};dhtmlXTreeObject.prototype.getItemText=function(c){var a=this._globalIdStorageFind(c);if(!a){return 0}return(a.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML)};dhtmlXTreeObject.prototype.getParentId=function(c){var a=this._globalIdStorageFind(c);if((!a)||(!a.parentObject)){return""}return a.parentObject.id};dhtmlXTreeObject.prototype.changeItemId=function(c,g){if(c==g){return}var a=this._globalIdStorageFind(c);if(!a){return 0}a.id=g;a.span.contextMenuId=g;this._idpull[g]=this._idpull[c];delete this._idpull[c]};dhtmlXTreeObject.prototype.doCut=function(){if(this.nodeCut){this.clearCut()}this.nodeCut=(new Array()).concat(this._selected);for(var a=0;a<this.nodeCut.length;a++){var c=this.nodeCut[a];c._cimgs=new Array();c._cimgs[0]=c.images[0];c._cimgs[1]=c.images[1];c._cimgs[2]=c.images[2];c.images[0]=c.images[1]=c.images[2]=this.cutImage;this._correctPlus(c)}};dhtmlXTreeObject.prototype.doPaste=function(g){var a=this._globalIdStorageFind(g);if(!a){return 0}for(var c=0;c<this.nodeCut.length;c++){if(this._checkPNodes(a,this.nodeCut[c])){continue}this._moveNode(this.nodeCut[c],a)}this.clearCut()};dhtmlXTreeObject.prototype.clearCut=function(){for(var a=0;a<this.nodeCut.length;a++){var c=this.nodeCut[a];c.images[0]=c._cimgs[0];c.images[1]=c._cimgs[1];c.images[2]=c._cimgs[2];this._correctPlus(c)}this.nodeCut=new Array()};dhtmlXTreeObject.prototype._moveNode=function(a,c){var m=this.dadmodec;if(m==1){var l=c;if(this.dadmodefix<0){while(true){l=this._getPrevNode(l);if((l==-1)){l=this.htmlNode;break}if((l.tr==0)||(l.tr.style.display=="")||(!l.parentObject)){break}}var j=l;var g=c}else{if((l.tr)&&(l.tr.nextSibling)&&(l.tr.nextSibling.nodem)&&(this._getOpenState(l)<1)){l=l.tr.nextSibling.nodem}else{l=this._getNextNode(l);if((l==-1)){l=this.htmlNode}}var g=l;var j=c}if(this._getNodeLevel(j,0)>this._getNodeLevel(g,0)){if(!this.dropLower){return this._moveNodeTo(a,j.parentObject)}else{if(g.id!=this.rootId){return this._moveNodeTo(a,g.parentObject,g)}else{return this._moveNodeTo(a,this.htmlNode,null)}}}else{return this._moveNodeTo(a,g.parentObject,g)}}else{return this._moveNodeTo(a,c)}};dhtmlXTreeObject.prototype._fixNodesCollection=function(o,m){var c=0;var j=0;var n=o.childNodes;var a=o.childsCount-1;if(m==n[a]){return}for(var l=0;l<a;l++){if(n[l]==n[a]){n[l]=n[l+1];n[l+1]=n[a]}}for(var l=0;l<a+1;l++){if(c){var g=n[l];n[l]=c;c=g}else{if(n[l]==m){c=n[l];n[l]=n[a]}}}};dhtmlXTreeObject.prototype._recreateBranch=function(m,o,l,a){var c;var q="";if(l){for(c=0;c<o.childsCount;c++){if(o.childNodes[c]==l){break}}if(c!=0){l=o.childNodes[c-1]}else{q="TOP";l=""}}var g=this._onradh;this._onradh=null;var n=this._attachChildNode(o,m.id,m.label,0,m.images[0],m.images[1],m.images[2],q,0,l);n._userdatalist=m._userdatalist;n.userData=m.userData.clone();if(m._attrs){n._attrs={};for(var j in m._attrs){n._attrs[j]=m._attrs[j]}}n.XMLload=m.XMLload;if(g){this._onradh=g;this._onradh(n.id)}if(m.treeNod.dpcpy){m.treeNod._globalIdStorageFind(m.id)}else{n.unParsed=m.unParsed}this._correctPlus(n);for(var c=0;c<m.childsCount;c++){this._recreateBranch(m.childNodes[c],n,0,1)}if((!a)&&(this.childCalc)){this._redrawFrom(this,o)}return n};dhtmlXTreeObject.prototype._moveNodeTo=function(u,w,s){if(u.treeNod._nonTrivialNode){return u.treeNod._nonTrivialNode(this,w,s,u)}if(this._checkPNodes(w,u)){return false}if(w.mytype){var n=(u.treeNod.lWin!=w.lWin)}else{var n=(u.treeNod.lWin!=w.treeNod.lWin)}if(!this.callEvent("onDrag",[u.id,w.id,(s?s.id:null),u.treeNod,w.treeNod])){return false}if((w.XMLload==0)&&(this.XMLsource)){w.XMLload=1;this._loadDynXML(w.id)}this.openItem(w.id);var g=u.treeNod;var q=u.parentObject.childsCount;var r=u.parentObject;if((n)||(g.dpcpy)){var j=u.id;u=this._recreateBranch(u,w,s);if(!g.dpcpy){g.deleteItem(j)}}else{var l=w.childsCount;var v=w.childNodes;if(l==0){w._open=true}g._unselectItem(u);v[l]=u;u.treeNod=w.treeNod;w.childsCount++;var o=this._drawNewTr(v[l].htmlNode);if(!s){w.htmlNode.childNodes[0].appendChild(o);if(this.dadmode==1){this._fixNodesCollection(w,s)}}else{w.htmlNode.childNodes[0].insertBefore(o,s.tr);this._fixNodesCollection(w,s);v=w.childNodes}}if((!g.dpcpy)&&(!n)){var a=u.tr;if((document.all)&&(navigator.appVersion.search(/MSIE\ 5\.0/gi)!=-1)){window.setTimeout(function(){a.parentNode.removeChild(a)},250)}else{u.parentObject.htmlNode.childNodes[0].removeChild(u.tr)}if((!s)||(w!=u.parentObject)){for(var m=0;m<r.childsCount;m++){if(r.childNodes[m].id==u.id){r.childNodes[m]=0;break}}}else{r.childNodes[r.childsCount-1]=0}g._compressChildList(r.childsCount,r.childNodes);r.childsCount--}if((!n)&&(!g.dpcpy)){u.tr=o;o.nodem=u;u.parentObject=w;if(g!=w.treeNod){if(u.treeNod._registerBranch(u,g)){return}this._clearStyles(u);this._redrawFrom(this,u.parentObject);if(this._onradh){this._onradh(u.id)}}this._correctPlus(w);this._correctLine(w);this._correctLine(u);this._correctPlus(u);if(s){this._correctPlus(s)}else{if(w.childsCount>=2){this._correctPlus(v[w.childsCount-2]);this._correctLine(v[w.childsCount-2])}}this._correctPlus(v[w.childsCount-1]);if(this.tscheck){this._correctCheckStates(w)}if(g.tscheck){g._correctCheckStates(r)}}if(q>1){g._correctPlus(r.childNodes[q-2]);g._correctLine(r.childNodes[q-2])}g._correctPlus(r);g._correctLine(r);this._fixChildCountLabel(w);g._fixChildCountLabel(r);this.callEvent("onDrop",[u.id,w.id,(s?s.id:null),g,w.treeNod]);return u.id};dhtmlXTreeObject.prototype._clearStyles=function(a){if(!a.htmlNode){return}var j=a.htmlNode.childNodes[0].childNodes[0].childNodes[1];var c=j.nextSibling.nextSibling;a.span.innerHTML=a.label;a.i_sel=false;if(a._aimgs){this.dragger.removeDraggableItem(j.nextSibling)}if(this.checkBoxOff){j.childNodes[0].style.display="";j.childNodes[0].onclick=this.onCheckBoxClick;this._setSrc(j.childNodes[0],this.imPath+this.checkArray[a.checkstate])}else{j.style.display="none"}j.childNodes[0].treeNod=this;this.dragger.removeDraggableItem(c);if(this.dragAndDropOff){this.dragger.addDraggableItem(c,this)}if(this._aimgs){this.dragger.addDraggableItem(j.nextSibling,this)}c.childNodes[0].className="standartTreeRow";c.onclick=this.onRowSelect;c.ondblclick=this.onRowClick2;j.previousSibling.onclick=this.onRowClick;this._correctLine(a);this._correctPlus(a);for(var g=0;g<a.childsCount;g++){this._clearStyles(a.childNodes[g])}};dhtmlXTreeObject.prototype._registerBranch=function(c,a){if(a){a._globalIdStorageSub(c.id)}c.id=this._globalIdStorageAdd(c.id,c);c.treeNod=this;for(var g=0;g<c.childsCount;g++){this._registerBranch(c.childNodes[g],a)}return 0};dhtmlXTreeObject.prototype.enableThreeStateCheckboxes=function(a){this.tscheck=dhx4.s2b(a)};dhtmlXTreeObject.prototype.setOnMouseInHandler=function(a){this.ehlt=true;this.attachEvent("onMouseIn",a)};dhtmlXTreeObject.prototype.setOnMouseOutHandler=function(a){this.ehlt=true;this.attachEvent("onMouseOut",a)};dhtmlXTreeObject.prototype.enableMercyDrag=function(a){this.dpcpy=dhx4.s2b(a)};dhtmlXTreeObject.prototype.enableTreeImages=function(a){this.timgen=dhx4.s2b(a)};dhtmlXTreeObject.prototype.enableFixedMode=function(a){this.hfMode=dhx4.s2b(a)};dhtmlXTreeObject.prototype.enableCheckBoxes=function(c,a){this.checkBoxOff=dhx4.s2b(c);this.cBROf=(!(this.checkBoxOff||dhx4.s2b(a)))};dhtmlXTreeObject.prototype.setStdImages=function(a,g,c){this.imageArray[0]=a;this.imageArray[1]=g;this.imageArray[2]=c};dhtmlXTreeObject.prototype.enableTreeLines=function(a){this.treeLinesOn=dhx4.s2b(a)};dhtmlXTreeObject.prototype.setImageArrays=function(j,a,m,l,g,c){switch(j){case"plus":this.plusArray[0]=a;this.plusArray[1]=m;this.plusArray[2]=l;this.plusArray[3]=g;this.plusArray[4]=c;break;case"minus":this.minusArray[0]=a;this.minusArray[1]=m;this.minusArray[2]=l;this.minusArray[3]=g;this.minusArray[4]=c;break}};dhtmlXTreeObject.prototype.openItem=function(c){this.skipLock=true;var a=this._globalIdStorageFind(c);if(!a){return 0}else{return this._openItem(a)}this.skipLock=false};dhtmlXTreeObject.prototype._openItem=function(a){var c=this._getOpenState(a);if((c<0)||(((this.XMLsource)&&(!a.XMLload)))){if(!this.callEvent("onOpenStart",[a.id,c])){return 0}this._HideShow(a,2);if(this.checkEvent("onOpenEnd")){if(this.onXLE==this._epnFHe){this._epnFHe(this,a.id,true)}if(!this.xmlstate||!this.XMLsource){this.callEvent("onOpenEnd",[a.id,this._getOpenState(a)])}else{this._oie_onXLE.push(this.onXLE);this.onXLE=this._epnFHe}}}else{if(this._srnd){this._HideShow(a,2)}}if(a.parentObject&&!this._skip_open_parent){this._openItem(a.parentObject)}};dhtmlXTreeObject.prototype.closeItem=function(c){if(this.rootId==c){return 0}this.skipLock=true;var a=this._globalIdStorageFind(c);if(!a){return 0}if(a.closeble){this._HideShow(a,1)}this.skipLock=false};dhtmlXTreeObject.prototype.getLevel=function(c){var a=this._globalIdStorageFind(c);if(!a){return 0}return this._getNodeLevel(a,0)};dhtmlXTreeObject.prototype.setItemCloseable=function(g,a){a=dhx4.s2b(a);if((g)&&(g.span)){var c=g}else{var c=this._globalIdStorageFind(g)}if(!c){return 0}c.closeble=a};dhtmlXTreeObject.prototype._getNodeLevel=function(a,c){if(a.parentObject){return this._getNodeLevel(a.parentObject,c+1)}return(c)};dhtmlXTreeObject.prototype.hasChildren=function(c){var a=this._globalIdStorageFind(c);if(!a){return 0}else{if((this.XMLsource)&&(!a.XMLload)){return true}else{return a.childsCount}}};dhtmlXTreeObject.prototype._getLeafCount=function(j){var g=0;for(var c=0;c<j.childsCount;c++){if(j.childNodes[c].childsCount==0){g++}}return g};dhtmlXTreeObject.prototype.setItemText=function(j,g,c){var a=this._globalIdStorageFind(j);if(!a){return 0}a.label=g;a.span.innerHTML=g;if(this.childCalc){this._fixChildCountLabel(a)}a.span.parentNode.parentNode.title=c||""};dhtmlXTreeObject.prototype.getItemTooltip=function(c){var a=this._globalIdStorageFind(c);if(!a){return""}return(a.span.parentNode.parentNode._dhx_title||a.span.parentNode.parentNode.title||"")};dhtmlXTreeObject.prototype.refreshItem=function(c){if(!c){c=this.rootId}var a=this._globalIdStorageFind(c);this.deleteChildItems(c);this._loadDynXML(c)};dhtmlXTreeObject.prototype.setItemImage2=function(j,a,l,g){var c=this._globalIdStorageFind(j);if(!c){return 0}c.images[1]=l;c.images[2]=g;c.images[0]=a;this._correctPlus(c)};dhtmlXTreeObject.prototype.setItemImage=function(g,a,j){var c=this._globalIdStorageFind(g);if(!c){return 0}if(j){c.images[1]=a;c.images[2]=j}else{c.images[0]=a}this._correctPlus(c)};dhtmlXTreeObject.prototype.getSubItems=function(g){var a=this._globalIdStorageFind(g,0,1);if(!a){return 0}if(a.unParsed){return(this._getSubItemsXML(a.unParsed))}var c="";for(i=0;i<a.childsCount;i++){if(!c){c=""+a.childNodes[i].id}else{c+=this.dlmtr+a.childNodes[i].id}}return c};dhtmlXTreeObject.prototype._getAllScraggyItems=function(g){var j="";for(var c=0;c<g.childsCount;c++){if((g.childNodes[c].unParsed)||(g.childNodes[c].childsCount>0)){if(g.childNodes[c].unParsed){var a=this._getAllScraggyItemsXML(g.childNodes[c].unParsed,1)}else{var a=this._getAllScraggyItems(g.childNodes[c])}if(a){if(j){j+=this.dlmtr+a}else{j=a}}}else{if(!j){j=""+g.childNodes[c].id}else{j+=this.dlmtr+g.childNodes[c].id}}}return j};dhtmlXTreeObject.prototype._getAllFatItems=function(g){var j="";for(var c=0;c<g.childsCount;c++){if((g.childNodes[c].unParsed)||(g.childNodes[c].childsCount>0)){if(!j){j=""+g.childNodes[c].id}else{j+=this.dlmtr+g.childNodes[c].id}if(g.childNodes[c].unParsed){var a=this._getAllFatItemsXML(g.childNodes[c].unParsed,1)}else{var a=this._getAllFatItems(g.childNodes[c])}if(a){j+=this.dlmtr+a}}}return j};dhtmlXTreeObject.prototype._getAllSubItems=function(m,l,j){if(j){c=j}else{var c=this._globalIdStorageFind(m)}if(!c){return 0}l="";for(var g=0;g<c.childsCount;g++){if(!l){l=""+c.childNodes[g].id}else{l+=this.dlmtr+c.childNodes[g].id}var a=this._getAllSubItems(0,l,c.childNodes[g]);if(a){l+=this.dlmtr+a}}if(c.unParsed){l=this._getAllSubItemsXML(m,l,c.unParsed)}return l};dhtmlXTreeObject.prototype.selectItem=function(j,g,c){g=dhx4.s2b(g);var a=this._globalIdStorageFind(j);if((!a)||(!a.parentObject)){return 0}if(this.XMLloadingWarning){a.parentObject.openMe=1}else{this._openItem(a.parentObject)}var l=null;if(c){l=new Object;l.ctrlKey=true;if(a.i_sel){l.skipUnSel=true}}if(g){this.onRowSelect(l,a.htmlNode.childNodes[0].childNodes[0].childNodes[3],false)}else{this.onRowSelect(l,a.htmlNode.childNodes[0].childNodes[0].childNodes[3],true)}};dhtmlXTreeObject.prototype.getSelectedItemText=function(){var c=new Array();for(var a=0;a<this._selected.length;a++){c[a]=this._selected[a].span.innerHTML}return(c.join(this.dlmtr))};dhtmlXTreeObject.prototype._compressChildList=function(a,g){a--;for(var c=0;c<a;c++){if(g[c]==0){g[c]=g[c+1];g[c+1]=0}}};dhtmlXTreeObject.prototype._deleteNode=function(n,l,q){if((!l)||(!l.parentObject)){return 0}var a=0;var c=0;if(l.tr.nextSibling){a=l.tr.nextSibling.nodem}if(l.tr.previousSibling){c=l.tr.previousSibling.nodem}var m=l.parentObject;var g=m.childsCount;var o=m.childNodes;for(var j=0;j<g;j++){if(o[j].id==n){if(!q){m.htmlNode.childNodes[0].removeChild(o[j].tr)}o[j]=0;break}}this._compressChildList(g,o);if(!q){m.childsCount--}if(a){this._correctPlus(a);this._correctLine(a)}if(c){this._correctPlus(c);this._correctLine(c)}if(this.tscheck){this._correctCheckStates(m)}if(!q){this._globalIdStorageRecSub(l)}};dhtmlXTreeObject.prototype.setCheck=function(g,c){var a=this._globalIdStorageFind(g,0,1);if(!a){return}if(c==="unsure"){this._setCheck(a,c)}else{c=dhx4.s2b(c);if((this.tscheck)&&(this.smcheck)){this._setSubChecked(c,a)}else{this._setCheck(a,c)}}if(this.smcheck){this._correctCheckStates(a.parentObject)}};dhtmlXTreeObject.prototype._setCheck=function(a,g){if(!a){return}if(((a.parentObject._r_logic)||(this._frbtr))&&(g)){if(this._frbtrs){if(this._frbtrL){this.setCheck(this._frbtrL.id,0)}this._frbtrL=a}else{for(var c=0;c<a.parentObject.childsCount;c++){this._setCheck(a.parentObject.childNodes[c],0)}}}var j=a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];if(g=="unsure"){a.checkstate=2}else{if(g){a.checkstate=1}else{a.checkstate=0}}if(a.dscheck){a.checkstate=a.dscheck}this._setSrc(j,this.imPath+((a.parentObject._r_logic||this._frbtr)?this.radioArray:this.checkArray)[a.checkstate])};dhtmlXTreeObject.prototype.setSubChecked=function(g,c){var a=this._globalIdStorageFind(g);this._setSubChecked(c,a);this._correctCheckStates(a.parentObject)};dhtmlXTreeObject.prototype._setSubChecked=function(g,a){g=dhx4.s2b(g);if(!a){return}if(((a.parentObject._r_logic)||(this._frbtr))&&(g)){for(var c=0;c<a.parentObject.childsCount;c++){this._setSubChecked(0,a.parentObject.childNodes[c])}}if(a.unParsed){this._setSubCheckedXML(g,a.unParsed)}if(a._r_logic||this._frbtr){this._setSubChecked(g,a.childNodes[0])}else{for(var c=0;c<a.childsCount;c++){this._setSubChecked(g,a.childNodes[c])}}var j=a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];if(g){a.checkstate=1}else{a.checkstate=0}if(a.dscheck){a.checkstate=a.dscheck}this._setSrc(j,this.imPath+((a.parentObject._r_logic||this._frbtr)?this.radioArray:this.checkArray)[a.checkstate])};dhtmlXTreeObject.prototype.isItemChecked=function(c){var a=this._globalIdStorageFind(c);if(!a){return}return a.checkstate};dhtmlXTreeObject.prototype.deleteChildItems=function(l){var a=this._globalIdStorageFind(l);if(!a){return}var c=a.childsCount;for(var g=0;g<c;g++){this._deleteNode(a.childNodes[0].id,a.childNodes[0])}};dhtmlXTreeObject.prototype.deleteItem=function(g,a){if((!this._onrdlh)||(this._onrdlh(g))){var c=this._deleteItem(g,a);if(c){this._fixChildCountLabel(c)}}this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0"};dhtmlXTreeObject.prototype._deleteItem=function(m,c,l){c=dhx4.s2b(c);var a=this._globalIdStorageFind(m);if(!a){return}var g=this.getParentId(m);var j=a.parentObject;this._deleteNode(m,a,l);if(this._editCell&&this._editCell.id==m){this._editCell=null}this._correctPlus(j);this._correctLine(j);if((c)&&(g!=this.rootId)){this.selectItem(g,1)}return j};dhtmlXTreeObject.prototype._globalIdStorageRecSub=function(a){for(var c=0;c<a.childsCount;c++){this._globalIdStorageRecSub(a.childNodes[c]);this._globalIdStorageSub(a.childNodes[c].id)}this._globalIdStorageSub(a.id);var g=a;g.span=null;g.tr.nodem=null;g.tr=null;g.htmlNode=null};dhtmlXTreeObject.prototype.insertNewNext=function(o,s,r,g,m,l,j,c,a){var n=this._globalIdStorageFind(o);if((!n)||(!n.parentObject)){return(0)}var q=this._attachChildNode(0,s,r,g,m,l,j,c,a,n);if((!this.XMLloadingWarning)&&(this.childCalc)){this._fixChildCountLabel(n.parentObject)}return q};dhtmlXTreeObject.prototype.getItemIdByIndex=function(g,a){var c=this._globalIdStorageFind(g);if((!c)||(a>=c.childsCount)){return null}return c.childNodes[a].id};dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(g,a){var c=this._globalIdStorageFind(g);if((!c)||(a>=c.childsCount)){return null}return c.childNodes[a].id};dhtmlXTreeObject.prototype.setDragHandler=function(a){this.attachEvent("onDrag",a)};dhtmlXTreeObject.prototype._clearMove=function(){if(this._lastMark){this._lastMark.className=this._lastMark.className.replace(/dragAndDropRow/g,"");this._lastMark=null}this.selectionBar.style.display="none";this.allTree.className=this.allTree.className.replace(" selectionBox","")};dhtmlXTreeObject.prototype.enableDragAndDrop=function(c,a){if(c=="temporary_disabled"){this.dADTempOff=false;c=true}else{this.dADTempOff=true}this.dragAndDropOff=dhx4.s2b(c);if(this.dragAndDropOff){this.dragger.addDragLanding(this.allTree,this)}if(arguments.length>1){this._ddronr=(!dhx4.s2b(a))}};dhtmlXTreeObject.prototype._setMove=function(l,g,n){if(l.parentObject.span){var j=dhx4.absTop(l);var c=dhx4.absTop(this.allTree)-this.allTree.scrollTop;this.dadmodec=this.dadmode;this.dadmodefix=0;if(this.dadmode==2){var m=n-j+(document.body.scrollTop||document.documentElement.scrollTop)-2-l.offsetHeight/2;if((Math.abs(m)-l.offsetHeight/6)>0){this.dadmodec=1;if(m<0){this.dadmodefix=0-l.offsetHeight}}else{this.dadmodec=0}}if(this.dadmodec==0){var a=l.parentObject.span;a.className+=" dragAndDropRow";this._lastMark=a}else{this._clearMove();this.selectionBar.style.top=(j-c+((parseInt(l.parentObject.span.parentNode.previousSibling.childNodes[0].style.height)||18)-1)+this.dadmodefix)+"px";this.selectionBar.style.left="5px";if(this.allTree.offsetWidth>20){this.selectionBar.style.width=(this.allTree.offsetWidth-(_isFF?30:25))+"px"}this.selectionBar.style.display=""}this._autoScroll(null,j,c)}};dhtmlXTreeObject.prototype._autoScroll=function(g,c,a){if(this.autoScroll){if(g){c=dhx4.absTop(g);a=dhx4.absTop(this.allTree)-this.allTree.scrollTop}if((c-a-parseInt(this.allTree.scrollTop))>(parseInt(this.allTree.offsetHeight)-50)){this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20}if((c-a)<(parseInt(this.allTree.scrollTop)+30)){this.allTree.scrollTop=parseInt(this.allTree.scrollTop)-20}}};dhtmlXTreeObject.prototype._createDragNode=function(l,j){if(!this.dADTempOff){return null}var g=l.parentObject;if(!this.callEvent("onBeforeDrag",[g.id,j])){return null}if(!g.i_sel){this._selectItem(g,j)}this._checkMSelectionLogic();var c=document.createElement("div");var m=new Array();if(this._itim_dg){for(var a=0;a<this._selected.length;a++){m[a]="<table cellspacing='0' cellpadding='0'><tr><td><img width='18px' height='18px' src='"+this._getSrc(this._selected[a].span.parentNode.previousSibling.childNodes[0])+"'></td><td>"+this._selected[a].span.innerHTML+"</td></tr></table>"}}else{m=this.getSelectedItemText().split(this.dlmtr)}c.innerHTML=m.join("");c.style.position="absolute";c.className="dragSpanDiv";this._dragged=(new Array()).concat(this._selected);return c};dhtmlXTreeObject.prototype._focusNode=function(a){var c=dhx4.absTop(a.htmlNode)-dhx4.absTop(this.allTree);if((c>(this.allTree.offsetHeight-30))||(c<0)){this.allTree.scrollTop=c+this.allTree.scrollTop}};dhtmlXTreeObject.prototype._preventNsDrag=function(a){if((a)&&(a.preventDefault)){a.preventDefault();return false}return false};dhtmlXTreeObject.prototype._drag=function(n,o,a){if(this._autoOpenTimer){clearTimeout(this._autoOpenTimer)}if(!a.parentObject){a=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];this.dadmodec=0}this._clearMove();var m=n.parentObject.treeNod;if((m)&&(m._clearMove)){m._clearMove("")}if((!this.dragMove)||(this.dragMove())){if((!m)||(!m._clearMove)||(!m._dragged)){var j=new Array(n.parentObject)}else{var j=m._dragged}var c=a.parentObject;for(var l=0;l<j.length;l++){var g=this._moveNode(j[l],c);if((this.dadmodec)&&(g!==false)){c=this._globalIdStorageFind(g,true,true)}if((g)&&(!this._sADnD)){this.selectItem(g,0,1)}}}if(m){m._dragged=new Array()}};dhtmlXTreeObject.prototype._dragIn=function(j,c,m,l){if(!this.dADTempOff){return 0}var n=c.parentObject;var a=j.parentObject;if((!a)&&(this._ddronr)){return}if(!this.callEvent("onDragIn",[n.id,a?a.id:null,n.treeNod,this])){if(a){this._autoScroll(j)}return 0}if(!a){this.allTree.className+=" selectionBox"}else{if(n.childNodes==null){this._setMove(j,m,l);return j}var q=n.treeNod;for(var g=0;g<q._dragged.length;g++){if(this._checkPNodes(a,q._dragged[g])){this._autoScroll(j);return 0}}this.selectionBar.parentNode.removeChild(this.selectionBar);a.span.parentNode.appendChild(this.selectionBar);this._setMove(j,m,l);if(this._getOpenState(a)<=0){var o=this;this._autoOpenId=a.id;this._autoOpenTimer=window.setTimeout(function(){o._autoOpenItem(null,o);o=null},1000)}}return j};dhtmlXTreeObject.prototype._autoOpenItem=function(c,a){a.openItem(a._autoOpenId)};dhtmlXTreeObject.prototype._dragOut=function(a){this._clearMove();if(this._autoOpenTimer){clearTimeout(this._autoOpenTimer)}};dhtmlXTreeObject.prototype._getNextNode=function(a,c){if((!c)&&(a.childsCount)){return a.childNodes[0]}if(a==this.htmlNode){return -1}if((a.tr)&&(a.tr.nextSibling)&&(a.tr.nextSibling.nodem)){return a.tr.nextSibling.nodem}return this._getNextNode(a.parentObject,true)};dhtmlXTreeObject.prototype._lastChild=function(a){if(a.childsCount){return this._lastChild(a.childNodes[a.childsCount-1])}else{return a}};dhtmlXTreeObject.prototype._getPrevNode=function(a,c){if((a.tr)&&(a.tr.previousSibling)&&(a.tr.previousSibling.nodem)){return this._lastChild(a.tr.previousSibling.nodem)}if(a.parentObject){return a.parentObject}else{return -1}};dhtmlXTreeObject.prototype.findItem=function(a,g,c){var j=this._findNodeByLabel(a,g,(c?this.htmlNode:null));if(j){this.selectItem(j.id,true);this._focusNode(j);return j.id}else{return null}};dhtmlXTreeObject.prototype.findItemIdByLabel=function(a,g,c){var j=this._findNodeByLabel(a,g,(c?this.htmlNode:null));if(j){return j.id}else{return null}};dhtmlXTreeObject.prototype.findStrInXML=function(c,g,l){if(!c.childNodes&&c.item){return this.findStrInJSON(c,g,l)}if(!c.childNodes){return false}for(var a=0;a<c.childNodes.length;a++){if(c.childNodes[a].nodeType==1){var j=c.childNodes[a].getAttribute(g);if(!j&&c.childNodes[a].tagName=="itemtext"){j=c.childNodes[a].firstChild.data}if((j)&&(j.toLowerCase().search(l)!=-1)){return true}if(this.findStrInXML(c.childNodes[a],g,l)){return true}}}return false};dhtmlXTreeObject.prototype.findStrInJSON=function(c,g,l){for(var a=0;a<c.item.length;a++){var j=c.item[a].text;if((j)&&(j.toLowerCase().search(l)!=-1)){return true}if(c.item[a].item&&this.findStrInJSON(c.item[a],g,l)){return true}}return false};dhtmlXTreeObject.prototype._findNodeByLabel=function(a,l,j){var a=a.replace(new RegExp("^( )+"),"").replace(new RegExp("( )+$"),"");a=new RegExp(a.replace(/([\^\.\?\*\+\\\[\]\(\)]{1})/gi,"\\$1").replace(/ /gi,".*"),"gi");if(!j){j=this._selected[0];if(!j){j=this.htmlNode}}var c=j;if(!l){if((j.unParsed)&&(this.findStrInXML(j.unParsed.d,"text",a))){this.reParse(j)}j=this._getNextNode(c);if(j==-1){j=this.htmlNode.childNodes[0]}}else{var g=this._getPrevNode(c);if(g==-1){g=this._lastChild(this.htmlNode)}if((g.unParsed)&&(this.findStrInXML(g.unParsed.d,"text",a))){this.reParse(g);j=this._getPrevNode(c)}else{j=g}if(j==-1){j=this._lastChild(this.htmlNode)}}while((j)&&(j!=c)){if((j.label)&&(j.label.search(a)!=-1)){return(j)}if(!l){if(j==-1){if(c==this.htmlNode){break}j=this.htmlNode.childNodes[0]}if((j.unParsed)&&(this.findStrInXML(j.unParsed.d,"text",a))){this.reParse(j)}j=this._getNextNode(j);if(j==-1){j=this.htmlNode}}else{var g=this._getPrevNode(j);if(g==-1){g=this._lastChild(this.htmlNode)}if((g.unParsed)&&(this.findStrInXML(g.unParsed.d,"text",a))){this.reParse(g);j=this._getPrevNode(j)}else{j=g}if(j==-1){j=this._lastChild(this.htmlNode)}}}return null};dhtmlXTreeObject.prototype.moveItem=function(o,c,q,a){var l=this._globalIdStorageFind(o);if(!l){return(0)}var m=null;switch(c){case"right":alert("Not supported yet");break;case"item_child":var g=(a||this)._globalIdStorageFind(q);if(!g){return(0)}m=(a||this)._moveNodeTo(l,g,0);break;case"item_sibling":var g=(a||this)._globalIdStorageFind(q);if(!g){return(0)}m=(a||this)._moveNodeTo(l,g.parentObject,g);break;case"item_sibling_next":var g=(a||this)._globalIdStorageFind(q);if(!g){return(0)}if((g.tr)&&(g.tr.nextSibling)&&(g.tr.nextSibling.nodem)){m=(a||this)._moveNodeTo(l,g.parentObject,g.tr.nextSibling.nodem)}else{m=(a||this)._moveNodeTo(l,g.parentObject)}break;case"left":if(l.parentObject.parentObject){m=this._moveNodeTo(l,l.parentObject.parentObject,l.parentObject)}break;case"up":var n=this._getPrevNode(l);if((n==-1)||(!n.parentObject)){return null}m=this._moveNodeTo(l,n.parentObject,n);break;case"up_strict":var n=this._getIndex(l);if(n!=0){m=this._moveNodeTo(l,l.parentObject,l.parentObject.childNodes[n-1])}break;case"down_strict":var n=this._getIndex(l);var j=l.parentObject.childsCount-2;if(n==j){m=this._moveNodeTo(l,l.parentObject)}else{if(n<j){m=this._moveNodeTo(l,l.parentObject,l.parentObject.childNodes[n+2])}}break;case"down":var n=this._getNextNode(this._lastChild(l));if((n==-1)||(!n.parentObject)){return}if(n.parentObject==l.parentObject){var n=this._getNextNode(n)}if(n==-1){m=this._moveNodeTo(l,l.parentObject)}else{if((n==-1)||(!n.parentObject)){return}m=this._moveNodeTo(l,n.parentObject,n)}break}if(_isIE&&_isIE<8){this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0"}return m};dhtmlXTreeObject.prototype.setDragBehavior=function(c,a){this._sADnD=(!dhx4.s2b(a));switch(c){case"child":this.dadmode=0;break;case"sibling":this.dadmode=1;break;case"complex":this.dadmode=2;break}};dhtmlXTreeObject.prototype._loadDynXML=function(g,c){c=c||this.XMLsource;var a=(new Date()).valueOf();this._ld_id=g;if(this.xmlalb=="function"){if(c){c(this._escape(g))}}else{if(this.xmlalb=="name"){this.loadXML(c+this._escape(g))}else{if(this.xmlalb=="xmlname"){this.loadXML(c+this._escape(g)+".xml?uid="+a)}else{this.loadXML(c+dhtmlx.url(c)+"uid="+a+"&id="+this._escape(g))}}}};dhtmlXTreeObject.prototype.enableMultiselection=function(c,a){this._amsel=dhx4.s2b(c);this._amselS=dhx4.s2b(a)};dhtmlXTreeObject.prototype._checkMSelectionLogic=function(){var g=new Array();for(var c=0;c<this._selected.length;c++){for(var a=0;a<this._selected.length;a++){if((c!=a)&&(this._checkPNodes(this._selected[a],this._selected[c]))){g[g.length]=this._selected[a]}}}for(var c=0;c<g.length;c++){this._unselectItem(g[c])}};dhtmlXTreeObject.prototype._checkPNodes=function(c,a){if(this._dcheckf){return false}if(a==c){return 1}if(c.parentObject){return this._checkPNodes(c.parentObject,a)}else{return 0}};dhtmlXTreeObject.prototype.disableDropCheck=function(a){this._dcheckf=dhx4.s2b(a)};dhtmlXTreeObject.prototype.enableDistributedParsing=function(g,c,a){this._edsbps=dhx4.s2b(g);this._edsbpsA=new Array();this._edsbpsC=c||10;this._edsbpsD=a||250};dhtmlXTreeObject.prototype.getDistributedParsingState=function(){return(!((!this._edsbpsA)||(!this._edsbpsA.length)))};dhtmlXTreeObject.prototype.getItemParsingState=function(g){var c=this._globalIdStorageFind(g,true,true);if(!c){return 0}if(this._edsbpsA){for(var a=0;a<this._edsbpsA.length;a++){if(this._edsbpsA[a][2]==g){return -1}}}return 1};dhtmlXTreeObject.prototype._distributedStart=function(c,l,j,g,a){if(!this._edsbpsA){this._edsbpsA=new Array()}this._edsbpsA[this._edsbpsA.length]=[c,l,j,g,a]};dhtmlXTreeObject.prototype._distributedStep=function(j){var c=this;if((!this._edsbpsA)||(!this._edsbpsA.length)){c.XMLloadingWarning=0;return}var l=this._edsbpsA[0];this.parsedArray=new Array();this._parse(l[0],l[2],l[3],l[1]);var a=this._globalIdStorageFind(l[2]);this._redrawFrom(this,a,l[4],this._getOpenState(a));var g=this.setCheckList.split(this.dlmtr);for(var m=0;m<g.length;m++){if(g[m]){this.setCheck(g[m],1)}}this._edsbpsA=(new Array()).concat(this._edsbpsA.slice(1));if((!this._edsbpsA.length)){window.setTimeout(function(){if(c.onXLE){c.onXLE(c,j)}c.callEvent("onXLE",[c,j])},1);c.xmlstate=0}};dhtmlXTreeObject.prototype.enableTextSigns=function(a){this._txtimg=dhx4.s2b(a)};dhtmlXTreeObject.prototype.preventIECaching=function(a){dhx4.ajax.cache=!a};dhtmlXTreeObject.prototype.preventIECashing=dhtmlXTreeObject.prototype.preventIECaching;dhtmlXTreeObject.prototype.disableCheckbox=function(g,c){if(typeof(g)!="object"){var a=this._globalIdStorageFind(g,0,1)}else{var a=g}if(!a){return}a.dscheck=dhx4.s2b(c)?(((a.checkstate||0)%3)+3):((a.checkstate>2)?(a.checkstate-3):a.checkstate);this._setCheck(a);if(a.dscheck<3){a.dscheck=false}};dhtmlXTreeObject.prototype.smartRefreshBranch=function(c,a){this._branchUpdate=1;this.smartRefreshItem(c,a)};dhtmlXTreeObject.prototype.smartRefreshItem=function(j,g){var a=this._globalIdStorageFind(j);for(var c=0;c<a.childsCount;c++){a.childNodes[c]._dmark=true}this.waitUpdateXML=true;if(g&&g.exists){this._parse(g,j)}else{this._loadDynXML(j,g)}};dhtmlXTreeObject.prototype.refreshItems=function(c,g){var j=c.toString().split(this.dlmtr);this.waitUpdateXML=new Array();for(var a=0;a<j.length;a++){this.waitUpdateXML[j[a]]=true}this.loadXML((g||this.XMLsource)+dhtmlx.url(g||this.XMLsource)+"ids="+this._escape(c))};dhtmlXTreeObject.prototype.updateItem=function(n,m,j,g,c,l,o){var a=this._globalIdStorageFind(n);a.userData=new cObject();if(m){a.label=m}a.images=new Array(j||this.imageArray[0],g||this.imageArray[1],c||this.imageArray[2]);this.setItemText(n,m);if(l){this._setCheck(a,true)}if(o=="1"&&!this.hasChildren(n)){a.XMLload=0}this._correctPlus(a);a._dmark=false;return a};dhtmlXTreeObject.prototype.setDropHandler=function(a){this.attachEvent("onDrop",a)};dhtmlXTreeObject.prototype.setOnLoadingStart=function(a){this.attachEvent("onXLS",a)};dhtmlXTreeObject.prototype.setOnLoadingEnd=function(a){this.attachEvent("onXLE",a)};dhtmlXTreeObject.prototype.setXMLAutoLoadingBehaviour=function(a){this.xmlalb=a};dhtmlXTreeObject.prototype.enableSmartCheckboxes=function(a){this.smcheck=dhx4.s2b(a)};dhtmlXTreeObject.prototype.getXMLState=function(){return(this.xmlstate==1)};dhtmlXTreeObject.prototype.setItemTopOffset=function(m,j){var g;if(typeof(m)!="object"){g=this._globalIdStorageFind(m)}else{g=m}var l=g.span.parentNode.parentNode;g.span.style.paddingBottom="1px";for(var c=0;c<l.childNodes.length;c++){if(c!=0){if(_isIE){l.childNodes[c].style.height="18px";l.childNodes[c].style.paddingTop=parseInt(j)+"px"}else{l.childNodes[c].style.height=18+parseInt(j)+"px"}}else{var a=l.childNodes[c].firstChild;if(l.childNodes[c].firstChild.tagName!="DIV"){a=document.createElement("DIV");l.childNodes[c].insertBefore(a,l.childNodes[c].firstChild)}a.style.height=parseInt(j)+"px";if((g.parentObject.id!=this.rootId||g.parentObject.childNodes[0]!=g)&&this.treeLinesOn){a.style.backgroundImage="url("+this.imPath+this.lineArray[5]+")"}a.innerHTML="&nbsp;";a.style.overflow="hidden";if(parseInt(j)==0){l.childNodes[c].removeChild(a)}}if(!_isIE){l.childNodes[c].style.verticalAlign="bottom"}if(_isIE){this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0"}}};dhtmlXTreeObject.prototype.setIconSize=function(j,c,l){if(l){if((l)&&(l.span)){var a=l}else{var a=this._globalIdStorageFind(l)}if(!a){return(0)}var g=a.span.parentNode.previousSibling.childNodes[0];if(j){g.style.width=j+"px";if(window._KHTMLrv){g.parentNode.style.width=j+"px"}}if(c){g.style.height=c+"px";if(window._KHTMLrv){g.parentNode.style.height=c+"px"}}}else{this.def_img_x=j;this.def_img_y=c}};dhtmlXTreeObject.prototype.getItemImage=function(l,j,c){var g=this._globalIdStorageFind(l);if(!g){return""}var a=g.images[j||0];if(c){a=this.iconURL+a}return a};dhtmlXTreeObject.prototype.enableRadioButtons=function(j,g){if(arguments.length==1){this._frbtr=dhx4.s2b(j);this.checkBoxOff=this.checkBoxOff||this._frbtr;return}var c=this._globalIdStorageFind(j);if(!c){return""}g=dhx4.s2b(g);if((g)&&(!c._r_logic)){c._r_logic=true;for(var a=0;a<c.childsCount;a++){this._setCheck(c.childNodes[a],c.childNodes[a].checkstate)}}if((!g)&&(c._r_logic)){c._r_logic=false;for(var a=0;a<c.childsCount;a++){this._setCheck(c.childNodes[a],c.childNodes[a].checkstate)}}};dhtmlXTreeObject.prototype.enableSingleRadioMode=function(a){this._frbtrs=dhx4.s2b(a)};dhtmlXTreeObject.prototype.openOnItemAdded=function(a){this._hAdI=!dhx4.s2b(a)};dhtmlXTreeObject.prototype.openOnItemAdding=function(a){this._hAdI=!dhx4.s2b(a)};dhtmlXTreeObject.prototype.enableMultiLineItems=function(a){if(a===true){this.mlitems="100%"}else{this.mlitems=a}};dhtmlXTreeObject.prototype.enableAutoTooltips=function(a){this.ettip=dhx4.s2b(a)};dhtmlXTreeObject.prototype.clearSelection=function(a){if(a){this._unselectItem(this._globalIdStorageFind(a))}else{this._unselectItems()}};dhtmlXTreeObject.prototype.showItemSign=function(j,c){var a=this._globalIdStorageFind(j);if(!a){return 0}var g=a.span.parentNode.previousSibling.previousSibling.previousSibling;if(!dhx4.s2b(c)){this._openItem(a);a.closeble=false;a.wsign=true}else{a.closeble=true;a.wsign=false}this._correctPlus(a)};dhtmlXTreeObject.prototype.showItemCheckbox=function(l,j){if(!l){for(var c in this._idpull){this.showItemCheckbox(this._idpull[c],j)}}if(typeof(l)!="object"){l=this._globalIdStorageFind(l,0,0)}if(!l){return 0}l.nocheckbox=!dhx4.s2b(j);var g=l.span.parentNode.previousSibling.previousSibling.childNodes[0];g.parentNode.style.display=(!l.nocheckbox)?"":"none"};dhtmlXTreeObject.prototype.setListDelimeter=function(a){this.dlmtr=a};dhtmlXTreeObject.prototype.setEscapingMode=function(a){this.utfesc=a};dhtmlXTreeObject.prototype.enableHighlighting=function(a){this.ehlt=true;this.ehlta=dhx4.s2b(a)};dhtmlXTreeObject.prototype._itemMouseOut=function(){var c=this.childNodes[3].parentObject;var a=c.treeNod;a.callEvent("onMouseOut",[c.id]);if(c.id==a._l_onMSI){a._l_onMSI=null}if(!a.ehlta){return}c.span.className=c.span.className.replace("_lor","")};dhtmlXTreeObject.prototype._itemMouseIn=function(){var c=this.childNodes[3].parentObject;var a=c.treeNod;if(a._l_onMSI!=c.id){a.callEvent("onMouseIn",[c.id])}a._l_onMSI=c.id;if(!a.ehlta){return}c.span.className=c.span.className.replace("_lor","");c.span.className=c.span.className.replace(/((standart|selected)TreeRow)/,"$1_lor")};dhtmlXTreeObject.prototype.enableActiveImages=function(a){this._aimgs=dhx4.s2b(a)};dhtmlXTreeObject.prototype.focusItem=function(c){var a=this._globalIdStorageFind(c);if(!a){return(0)}this._focusNode(a)};dhtmlXTreeObject.prototype.getAllSubItems=function(a){return this._getAllSubItems(a)};dhtmlXTreeObject.prototype.getAllChildless=function(){return this._getAllScraggyItems(this.htmlNode)};dhtmlXTreeObject.prototype.getAllLeafs=dhtmlXTreeObject.prototype.getAllChildless;dhtmlXTreeObject.prototype._getAllScraggyItems=function(g){var j="";for(var c=0;c<g.childsCount;c++){if((g.childNodes[c].unParsed)||(g.childNodes[c].childsCount>0)){if(g.childNodes[c].unParsed){var a=this._getAllScraggyItemsXML(g.childNodes[c].unParsed,1)}else{var a=this._getAllScraggyItems(g.childNodes[c])}if(a){if(j){j+=this.dlmtr+a}else{j=a}}}else{if(!j){j=""+g.childNodes[c].id}else{j+=this.dlmtr+g.childNodes[c].id}}}return j};dhtmlXTreeObject.prototype._getAllFatItems=function(g){var j="";for(var c=0;c<g.childsCount;c++){if((g.childNodes[c].unParsed)||(g.childNodes[c].childsCount>0)){if(!j){j=""+g.childNodes[c].id}else{j+=this.dlmtr+g.childNodes[c].id}if(g.childNodes[c].unParsed){var a=this._getAllFatItemsXML(g.childNodes[c].unParsed,1)}else{var a=this._getAllFatItems(g.childNodes[c])}if(a){j+=this.dlmtr+a}}}return j};dhtmlXTreeObject.prototype.getAllItemsWithKids=function(){return this._getAllFatItems(this.htmlNode)};dhtmlXTreeObject.prototype.getAllFatItems=dhtmlXTreeObject.prototype.getAllItemsWithKids;dhtmlXTreeObject.prototype.getAllChecked=function(){return this._getAllChecked("","",1)};dhtmlXTreeObject.prototype.getAllUnchecked=function(a){if(a){a=this._globalIdStorageFind(a)}return this._getAllChecked(a,"",0)};dhtmlXTreeObject.prototype.getAllPartiallyChecked=function(){return this._getAllChecked("","",2)};dhtmlXTreeObject.prototype.getAllCheckedBranches=function(){var a=[this._getAllChecked("","",1)];var c=this._getAllChecked("","",2);if(c){a.push(c)}return a.join(this.dlmtr)};dhtmlXTreeObject.prototype._getAllChecked=function(l,g,m){if(!l){l=this.htmlNode}if(l.checkstate==m){if(!l.nocheckbox){if(g){g+=this.dlmtr+l.id}else{g=""+l.id}}}var a=l.childsCount;for(var c=0;c<a;c++){g=this._getAllChecked(l.childNodes[c],g,m)}if(l.unParsed){g=this._getAllCheckedXML(l.unParsed,g,m)}if(g){return g}else{return""}};dhtmlXTreeObject.prototype.setItemStyle=function(j,g,c){var c=c||false;var a=this._globalIdStorageFind(j);if(!a){return 0}if(!a.span.style.cssText){a.span.setAttribute("style",a.span.getAttribute("style")+"; "+g)}else{a.span.style.cssText=c?g:a.span.style.cssText+";"+g}};dhtmlXTreeObject.prototype.enableImageDrag=function(a){this._itim_dg=dhx4.s2b(a)};dhtmlXTreeObject.prototype.setOnDragIn=function(a){this.attachEvent("onDragIn",a)};dhtmlXTreeObject.prototype.enableDragAndDropScrolling=function(a){this.autoScroll=dhx4.s2b(a)};dhtmlXTreeObject.prototype.setSkin=function(a){var c=this.parentObject.className.replace(/dhxtree_[^ ]*/gi,"");this.parentObject.className=c+" dhxtree_"+a;if(a=="dhx_terrace"||a=="dhx_web"){this.enableTreeLines(false)}};(function(){dhtmlx.extend_api("dhtmlXTreeObject",{_init:function(a){return[a.parent,(a.width||"100%"),(a.height||"100%"),(a.root_id||0)]},auto_save_selection:"enableAutoSavingSelected",auto_tooltip:"enableAutoTooltips",checkbox:"enableCheckBoxes",checkbox_3_state:"enableThreeStateCheckboxes",checkbox_smart:"enableSmartCheckboxes",context_menu:"enableContextMenu",distributed_parsing:"enableDistributedParsing",drag:"enableDragAndDrop",drag_copy:"enableMercyDrag",drag_image:"enableImageDrag",drag_scroll:"enableDragAndDropScrolling",editor:"enableItemEditor",hover:"enableHighlighting",images:"enableTreeImages",image_fix:"enableIEImageFix",image_path:"setImagePath",lines:"enableTreeLines",loading_item:"enableLoadingItem",multiline:"enableMultiLineItems",multiselect:"enableMultiselection",navigation:"enableKeyboardNavigation",radio:"enableRadioButtons",radio_single:"enableSingleRadioMode",rtl:"enableRTL",search:"enableKeySearch",smart_parsing:"enableSmartXMLParsing",smart_rendering:"enableSmartRendering",text_icons:"enableTextSigns",xml:"loadXML",skin:"setSkin"},{})})();dhtmlXTreeObject.prototype._dp_init=function(a){a.attachEvent("insertCallback",function(j,m,c){var g=dhx4.ajax.xpath(".//item",j);var l=g[0].getAttribute("text");this.obj.insertNewItem(c,m,l,0,0,0,0,"CHILD")});a.attachEvent("updateCallback",function(j,m,c){var g=dhx4.ajax.xpath(".//item",j);var l=g[0].getAttribute("text");this.obj.setItemText(m,l);if(this.obj.getParentId(m)!=c){this.obj.moveItem(m,"item_child",c)}this.setUpdated(m,true,"updated")});a.attachEvent("deleteCallback",function(g,j,c){this.obj.setUserData(j,this.action_param,"true_deleted");this.obj.deleteItem(j,false)});a._methods=["setItemStyle","","changeItemId","deleteItem"];this.attachEvent("onEdit",function(c,g){if(c==3){a.setUpdated(g,true)}return true});this.attachEvent("onDrop",function(m,l,j,g,c){if(g==c){a.setUpdated(m,true)}});this._onrdlh=function(c){var g=a.getState(c);if(g=="inserted"){a.set_invalid(c,false);a.setUpdated(c,false);return true}if(g=="true_deleted"){a.setUpdated(c,false);return true}a.setUpdated(c,true,"deleted");return false};this._onradh=function(c){a.setUpdated(c,true,"inserted")};a._getRowData=function(l){var j={};var m=this.obj._globalIdStorageFind(l);var g=m.parentObject;var c=0;for(c=0;c<g.childsCount;c++){if(g.childNodes[c]==m){break}}j.tr_id=m.id;j.tr_pid=g.id;j.tr_order=c;j.tr_text=m.span.innerHTML;g=(m._userdatalist||"").split(",");for(c=0;c<g.length;c++){j[g[c]]=m.userData["t_"+g[c]]}return j}};if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachTree=function(a){this.callEvent("_onBeforeContentAttach",["tree"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);this.dataType="tree";this.dataObj=new dhtmlXTreeObject(c,"100%","100%",(a||0));this.dataObj.setSkin(this.conf.skin);this.dataObj.allTree.childNodes[0].style.marginTop="2px";this.dataObj.allTree.childNodes[0].style.marginBottom="2px";c=null;this.callEvent("_onContentAttach",[]);return this.dataObj}}dhtmlXTreeObject.prototype.makeDraggable=function(c,a){if(typeof(c)!="object"){c=document.getElementById(c)}dragger=new dhtmlDragAndDropObject();dropper=new dhx_dragSomethingInTree();dragger.addDraggableItem(c,dropper);c.dragLanding=null;c.ondragstart=dropper._preventNsDrag;c.onselectstart=new Function("return false;");c.parentObject=new Object;c.parentObject.img=c;c.parentObject.treeNod=dropper;dropper._customDrop=a};dhtmlXTreeObject.prototype.makeDragable=dhtmlXTreeObject.prototype.makeDraggable;dhtmlXTreeObject.prototype.makeAllDraggable=function(c){var g=document.getElementsByTagName("div");for(var a=0;a<g.length;a++){if(g[a].getAttribute("dragInDhtmlXTree")){this.makeDragable(g[a],c)}}};function dhx_dragSomethingInTree(){this.lWin=window;this._createDragNode=function(c){var a=document.createElement("div");a.style.position="absolute";a.innerHTML=(c.innerHTML||c.value);a.className="dragSpanDiv";return a};this._preventNsDrag=function(a){(a||window.event).cancelBubble=true;if((a)&&(a.preventDefault)){a.preventDefault();return false}return false};this._nonTrivialNode=function(c,g,a,j){if(this._customDrop){return this._customDrop(c,j.img.id,g.id,a?a.id:null)}var l=(j.img.getAttribute("image")||"");var n=j.img.id||"new";var m=(j.img.getAttribute("text")||(_isIE?j.img.innerText:j.img.textContent));c[a?"insertNewNext":"insertNewItem"](a?a.id:g.id,n,m,"",l,l,l)}}dhtmlXTreeObject.prototype.enableItemEditor=function(a){this._eItEd=dhx4.s2b(a);if(!this._eItEdFlag){this._edn_click_IE=true;this._edn_dblclick=true;this._ie_aFunc=this.aFunc;this._ie_dblclickFuncHandler=this.dblclickFuncHandler;this.setOnDblClickHandler(function(g,c){if(this._edn_dblclick){this._editItem(g,c)}return true});this.setOnClickHandler(function(g,c){this._stopEditItem(g,c);if((this.ed_hist_clcik==g)&&(this._edn_click_IE)){this._editItem(g,c)}this.ed_hist_clcik=g;return true});this._eItEdFlag=true}};dhtmlXTreeObject.prototype.setOnEditHandler=function(a){this.attachEvent("onEdit",a)};dhtmlXTreeObject.prototype.setEditStartAction=function(a,c){this._edn_click_IE=dhx4.s2b(a);this._edn_dblclick=dhx4.s2b(c)};dhtmlXTreeObject.prototype._stopEdit=function(c,m){if(this._editCell){this.dADTempOff=this.dADTempOffEd;if(this._editCell.id!=c){var j=true;if(!m){j=this.callEvent("onEdit",[2,this._editCell.id,this,this._editCell.span.childNodes[0].value])}else{j=false;this.callEvent("onEditCancel",[this._editCell.id,this._editCell._oldValue])}if(j===true){j=this._editCell.span.childNodes[0].value}else{if(j===false){j=this._editCell._oldValue}}var l=(j!=this._editCell._oldValue);this._editCell.span.innerHTML=j;this._editCell.label=this._editCell.span.innerHTML;var g=this._editCell.i_sel?"selectedTreeRow":"standartTreeRow";this._editCell.span.className=g;this._editCell.span.parentNode.className="standartTreeRow";this._editCell.span.style.paddingRight=this._editCell.span.style.paddingLeft="5px";this._editCell.span.onclick=this._editCell.span.ondblclick=function(){};var n=this._editCell.id;if(this.childCalc){this._fixChildCountLabel(this._editCell)}this._editCell=null;if(!m){this.callEvent("onEdit",[3,n,this,l])}if(this._enblkbrd){this.parentObject.lastChild.focus();this.parentObject.lastChild.focus()}}}};dhtmlXTreeObject.prototype._stopEditItem=function(c,a){this._stopEdit(c)};dhtmlXTreeObject.prototype.stopEdit=function(a){if(this._editCell){this._stopEdit(this._editCell.id+"_non",a)}};dhtmlXTreeObject.prototype.editItem=function(a){this._editItem(a,this)};dhtmlXTreeObject.prototype._editItem=function(l,a){if(this._eItEd){this._stopEdit();var g=this._globalIdStorageFind(l);if(!g){return}var j=this.callEvent("onEdit",[0,l,this,g.span.innerHTML]);if(j===true){j=(typeof g.span.innerText!="undefined"?g.span.innerText:g.span.textContent)}else{if(j===false){return}}this.dADTempOffEd=this.dADTempOff;this.dADTempOff=false;this._editCell=g;g._oldValue=j;g.span.innerHTML="<input type='text' class='intreeeditRow' />";g.span.style.paddingRight=g.span.style.paddingLeft="0px";g.span.onclick=g.span.ondblclick=function(m){(m||event).cancelBubble=true};g.span.childNodes[0].value=j;g.span.childNodes[0].onselectstart=function(m){(m||event).cancelBubble=true;return true};g.span.childNodes[0].onmousedown=function(m){(m||event).cancelBubble=true;return true};g.span.childNodes[0].focus();g.span.childNodes[0].focus();g.span.onclick=function(m){(m||event).cancelBubble=true;return false};g.span.className="";g.span.parentNode.className="";var c=this;g.span.childNodes[0].onkeydown=function(m){if(!m){m=window.event}if(m.keyCode==13){m.cancelBubble=true;c._stopEdit(window.undefined)}else{if(m.keyCode==27){c._stopEdit(window.undefined,true)}}(m||event).cancelBubble=true};this.callEvent("onEdit",[1,l,this])}};function jsonPointer(c,a){this.d=c;this.dp=a}jsonPointer.prototype={text:function(){var a=function(l){var j=[];for(var g=0;g<l.length;g++){j.push("{"+c(l[g])+"}")}return j.join(",")};var c=function(l){var j=[];for(var g in l){if(typeof(l[g])=="object"){if(g.length){j.push('"'+g+'":['+a(l[g])+"]")}else{j.push('"'+g+'":{'+c(l[g])+"}")}}else{j.push('"'+g+'":"'+l[g]+'"')}}return j.join(",")};return"{"+c(this.d)+"}"},get:function(a){return this.d[a]},exists:function(){return !!this.d},content:function(){return this.d.content},each:function(j,n,m){var g=this.d[j];var o=new jsonPointer();if(g){for(var l=0;l<g.length;l++){o.d=g[l];n.apply(m,[o,l])}}},get_all:function(){return this.d},sub:function(a){return new jsonPointer(this.d[a],this.d)},sub_exists:function(a){return !!this.d[a]},each_x:function(j,o,n,m,l){var g=this.d[j];var q=new jsonPointer(0,this.d);if(g){for(l=l||0;l<g.length;l++){if(g[l][o]){q.d=g[l];if(n.apply(m,[q,l])==-1){return}}}}},up:function(a){return new jsonPointer(this.dp,this.d)},set:function(a,c){this.d[a]=c},clone:function(a){return new jsonPointer(this.d,this.dp)},through:function(g,n,r,l,s){var o=this.d[g];if(o.length){for(var j=0;j<o.length;j++){if(o[j][n]!=null&&o[j][n]!=""&&(!r||o[j][n]==r)){var m=new jsonPointer(o[j],this.d);l.apply(s,[m,j])}var q=this.d;this.d=o[j];if(this.sub_exists(g)){this.through(g,n,r,l,s)}this.d=q}}}};dhtmlXTreeObject.prototype.loadJSArrayFile=function(file,callback){if(!this.parsCount){this.callEvent("onXLS",[this,this._ld_id])}this._ld_id=null;this.xmlstate=1;var that=this;this.XMLLoader=function(xml,callback){eval("var z="+xml.responseText);this.loadJSArray(z);if(callback){callback.call(this,xml)}};dhx4.ajax.get(file,function(obj){that.XMLLoader(obj.xmlDoc,callback)})};dhtmlXTreeObject.prototype.loadCSV=function(a,g){if(!this.parsCount){this.callEvent("onXLS",[this,this._ld_id])}this._ld_id=null;this.xmlstate=1;var c=this;this.XMLLoader=function(j,l){this.loadCSVString(j.responseText);if(l){l.call(this,j)}};dhx4.ajax.get(a,function(j){c.XMLLoader(j.xmlDoc,g)})};dhtmlXTreeObject.prototype.loadJSArray=function(a,j){var m=[];for(var c=0;c<a.length;c++){if(!m[a[c][1]]){m[a[c][1]]=[]}m[a[c][1]].push({id:a[c][0],text:a[c][2]})}var l={id:this.rootId};var g=function(q,o){if(m[q.id]){q.item=m[q.id];for(var n=0;n<q.item.length;n++){o(q.item[n],o)}}};g(l,g);this.loadJSONObject(l,j)};dhtmlXTreeObject.prototype.loadCSVString=function(a,m){var o=[];var c=a.split("\n");for(var j=0;j<c.length;j++){var g=c[j].split(",");if(!o[g[1]]){o[g[1]]=[]}o[g[1]].push({id:g[0],text:g[2]})}var n={id:this.rootId};var l=function(s,r){if(o[s.id]){s.item=o[s.id];for(var q=0;q<s.item.length;q++){r(s.item[q],r)}}};l(n,l);this.loadJSONObject(n,m)};dhtmlXTreeObject.prototype.loadJSONObject=function(a,c){if(!this.parsCount){this.callEvent("onXLS",[this,null])}this.xmlstate=1;var g=new jsonPointer(a);this._parse(g);this._p=g;if(c){c()}};dhtmlXTreeObject.prototype.loadJSON=function(file,callback){if(!this.parsCount){this.callEvent("onXLS",[this,this._ld_id])}this._ld_id=null;this.xmlstate=1;var that=this;this.XMLLoader=function(xml,callback){try{eval("var t="+xml.responseText)}catch(e){dhx4.callEvent("onLoadXMLerror",["Incorrect JSON",(xml),this]);return}var p=new jsonPointer(t);this._parse(p);this._p=p;if(callback){callback.call(this,xml)}};dhx4.ajax.get(file,function(obj){that.XMLLoader(obj.xmlDoc,callback)})};dhtmlXTreeObject.prototype.serializeTreeToJSON=function(){var a=['{"id":"'+this.rootId+'", "item":['];var g=[];for(var c=0;c<this.htmlNode.childsCount;c++){g.push(this._serializeItemJSON(this.htmlNode.childNodes[c]))}a.push(g.join(","));a.push("]}");return a.join("")};dhtmlXTreeObject.prototype._serializeItemJSON=function(n){var a=[];if(n.unParsed){return(n.unParsed.text())}if(this._selected.length){var g=this._selected[0].id}else{g=""}var m=n.span.innerHTML;m=m.replace(/\"/g,'\\"',m);if(!this._xfullXML){a.push('{ "id":"'+n.id+'", '+(this._getOpenState(n)==1?' "open":"1", ':"")+(g==n.id?' "select":"1",':"")+' "text":"'+m+'"'+(((this.XMLsource)&&(n.XMLload==0))?', "child":"1" ':""))}else{a.push('{ "id":"'+n.id+'", '+(this._getOpenState(n)==1?' "open":"1", ':"")+(g==n.id?' "select":"1",':"")+' "text":"'+m+'", "im0":"'+n.images[0]+'", "im1":"'+n.images[1]+'", "im2":"'+n.images[2]+'" '+(n.acolor?(', "aCol":"'+n.acolor+'" '):"")+(n.scolor?(', "sCol":"'+n.scolor+'" '):"")+(n.checkstate==1?', "checked":"1" ':(n.checkstate==2?', "checked":"-1"':""))+(n.closeable?', "closeable":"1" ':"")+(((this.XMLsource)&&(n.XMLload==0))?', "child":"1" ':""))}if((this._xuserData)&&(n._userdatalist)){a.push(', "userdata":[');var l=n._userdatalist.split(",");var j=[];for(var c=0;c<l.length;c++){j.push('{ "name":"'+l[c]+'" , "content":"'+n.userData["t_"+l[c]]+'" }')}a.push(j.join(","));a.push("]")}if(n.childsCount){a.push(', "item":[');var j=[];for(var c=0;c<n.childsCount;c++){j.push(this._serializeItemJSON(n.childNodes[c]))}a.push(j.join(","));a.push("]\n")}a.push("}\n");return a.join("")};function dhtmlXTreeFromHTML(obj){if(typeof(obj)!="object"){obj=document.getElementById(obj)}var n=obj;var id=n.id;var cont="";for(var j=0;j<obj.childNodes.length;j++){if(obj.childNodes[j].nodeType=="1"){if(obj.childNodes[j].tagName=="XMP"){var cHead=obj.childNodes[j];for(var m=0;m<cHead.childNodes.length;m++){cont+=cHead.childNodes[m].data}}else{if(obj.childNodes[j].tagName.toLowerCase()=="ul"){cont=dhx_li2trees(obj.childNodes[j],new Array(),0)}}break}}obj.innerHTML="";var t=new dhtmlXTreeObject(obj,"100%","100%",0);var z_all=new Array();for(b in t){z_all[b.toLowerCase()]=b}var atr=obj.attributes;for(var a=0;a<atr.length;a++){if((atr[a].name.indexOf("set")==0)||(atr[a].name.indexOf("enable")==0)){var an=atr[a].name;if(!t[an]){an=z_all[atr[a].name]}t[an].apply(t,atr[a].value.split(","))}}if(typeof(cont)=="object"){t.XMLloadingWarning=1;for(var i=0;i<cont.length;i++){var n=t.insertNewItem(cont[i][0],cont[i][3],cont[i][1]);if(cont[i][2]){t._setCheck(n,cont[i][2])}}t.XMLloadingWarning=0;t.lastLoadedXMLId=0;t._redrawFrom(t)}else{t.loadXMLString("<tree id='0'>"+cont+"</tree>")}window[id]=t;var oninit=obj.getAttribute("oninit");if(oninit){eval(oninit)}return t}function dhx_init_trees(){var c=document.getElementsByTagName("div");for(var a=0;a<c.length;a++){if(c[a].className=="dhtmlxTree"){dhtmlXTreeFromHTML(c[a])}}}function dhx_li2trees(u,n,g){for(var o=0;o<u.childNodes.length;o++){var s=u.childNodes[o];if((s.nodeType==1)&&(s.tagName.toLowerCase()=="li")){var r="";var q=null;var a=s.getAttribute("checked");for(var m=0;m<s.childNodes.length;m++){var l=s.childNodes[m];if(l.nodeType==3){r+=l.data}else{if(l.tagName.toLowerCase()!="ul"){r+=dhx_outer_html(l)}else{q=l}}}n[n.length]=[g,r,a,(s.id||(n.length+1))];if(q){n=dhx_li2trees(q,n,(s.id||n.length))}}}return n}function dhx_outer_html(c){if(c.outerHTML){return c.outerHTML}var a=document.createElement("DIV");a.appendChild(c.cloneNode(true));a=a.innerHTML;return a}if(window.addEventListener){window.addEventListener("load",dhx_init_trees,false)}else{if(window.attachEvent){window.attachEvent("onload",dhx_init_trees)}}var globalActiveDHTMLGridObject;String.prototype._dhx_trim=function(){return this.replace(/&nbsp;/g," ").replace(/(^[ \t]*)|([ \t]*$)/g,"")};function dhtmlxArray(a){return dhtmlx.extend((a||new Array()),dhtmlxArray._master)}dhtmlxArray._master={_dhx_find:function(c){for(var a=0;a<this.length;a++){if(c==this[a]){return a}}return -1},_dhx_insertAt:function(g,c){this[this.length]=null;for(var a=this.length-1;a>=g;a--){this[a]=this[a-1]}this[g]=c},_dhx_removeAt:function(a){this.splice(a,1)},_dhx_swapItems:function(a,g){var c=this[a];this[a]=this[g];this[g]=c}};function dhtmlXGridObject(id){if(dhtmlxEvent.initTouch){dhtmlxEvent.initTouch()}if(_isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}if(id){if(typeof(id)=="object"){this.entBox=id;if(!this.entBox.id){this.entBox.id="cgrid2_"+this.uid()}}else{this.entBox=document.getElementById(id)}}else{this.entBox=document.createElement("DIV");this.entBox.id="cgrid2_"+this.uid()}this.entBox.innerHTML="";dhx4._eventable(this);var self=this;this._wcorr=0;this.fontWidth=7;this.cell=null;this.row=null;this.iconURL="";this.editor=null;this._f2kE=true;this._dclE=true;this.combos=new Array(0);this.defVal=new Array(0);this.rowsAr={};this.rowsBuffer=dhtmlxArray();this.rowsCol=dhtmlxArray();this._data_cache={};this._ecache={};this._ud_enabled=true;this.xmlLoader=this.doLoadDetails;this._maskArr=[];this.selectedRows=dhtmlxArray();this.UserData={};this._sizeFix=this._borderFix=0;this.entBox.className+=" gridbox";this.entBox.style.width=this.entBox.getAttribute("width")||(window.getComputedStyle?(this.entBox.style.width||window.getComputedStyle(this.entBox,null)["width"]):(this.entBox.currentStyle?this.entBox.currentStyle.width:this.entBox.style.width||0))||"100%";this.entBox.style.height=this.entBox.getAttribute("height")||(window.getComputedStyle?(this.entBox.style.height||window.getComputedStyle(this.entBox,null)["height"]):(this.entBox.currentStyle?this.entBox.currentStyle.height:this.entBox.style.height||0))||"100%";this.entBox.style.cursor="default";this.entBox.onselectstart=function(){return false};var t_creator=function(name){var t=document.createElement("TABLE");t.cellSpacing=t.cellPadding=0;t.style.cssText="width:100%;table-layout:fixed;";t.className=name.substr(2);return t};this.obj=t_creator("c_obj");this.hdr=t_creator("c_hdr");this.hdr.style.marginRight="20px";this.hdr.style.paddingRight="20px";this.objBox=document.createElement("DIV");this.objBox.style.width="100%";this.objBox.style.overflow="auto";this.objBox.appendChild(this.obj);this.objBox.className="objbox";if(dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(this)}this.hdrBox=document.createElement("DIV");this.hdrBox.style.width="100%";this.hdrBox.style.height="25px";this.hdrBox.style.overflow="hidden";this.hdrBox.className="xhdr";this.preloadImagesAr=new Array(0);this.sortImg=document.createElement("DIV");this.sortImg.style.display="none";this.hdrBox.appendChild(this.sortImg);this.hdrBox.appendChild(this.hdr);this.hdrBox.style.position="relative";this.entBox.appendChild(this.hdrBox);this.entBox.appendChild(this.objBox);this.entBox.grid=this;this.objBox.grid=this;this.hdrBox.grid=this;this.obj.grid=this;this.hdr.grid=this;this.cellWidthPX=[];this.cellWidthPC=[];this.cellWidthType=this.entBox.cellwidthtype||"px";this.delim=this.entBox.delimiter||",";this._csvDelim=",";this.hdrLabels=[];this.columnIds=[];this.columnColor=[];this._hrrar=[];this.cellType=dhtmlxArray();this.cellAlign=[];this.initCellWidth=[];this.fldSort=[];this._srdh=(_isIE&&(document.compatMode!="BackCompat")?22:20);this.imgURL=window.dhx_globalImgPath||"";this.isActive=false;this.isEditable=true;this.useImagesInHeader=false;this.pagingOn=false;this.rowsBufferOutSize=0;dhtmlxEvent(window,"unload",function(){try{if(self.destructor){self.destructor()}}catch(e){}});this.setSkin=function(name){this._srdh=window.dhx4.readFromCss("dhxgrid_rh_"+name)+4;this.skin_name=name;if(this._imgURL){this.setImagePath(this._imgURL)}var classname=this.entBox.className.split(" gridbox")[0];this.entBox.className=classname+" gridbox gridbox_"+name+(_isIE?" isIE":" isModern");this.skin_h_correction=0;this.enableAlterCss("ev_"+name,"odd_"+name,this.isTreeGrid());this._fixAlterCss();switch(name){case"dhx_terrace":this._srdh=33;this.forceDivInHeader=true;break;case"dhx_skyblue":case"dhx_web":this.forceDivInHeader=true;break}if(_isIE&&this.hdr){var d=this.hdr.parentNode;d.removeChild(this.hdr);d.appendChild(this.hdr)}this.setSizes()};if(_isIE){this.preventIECaching(true)}if(window.dhtmlDragAndDropObject){this.dragger=new dhtmlDragAndDropObject()}this._doOnScroll=function(e,mode){this.callEvent("onScroll",[this.objBox.scrollLeft,this.objBox.scrollTop]);this.doOnScroll(e,mode)};this.doOnScroll=function(e,mode){this.hdrBox.scrollLeft=this.objBox.scrollLeft;if(this.ftr){this.ftr.parentNode.scrollLeft=this.objBox.scrollLeft}if(mode){return}if(this._srnd){if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}this._dLoadTimer=window.setTimeout(function(){if(self._update_srnd_view){self._update_srnd_view()}},100)}};this.attachToObject=function(obj){obj.appendChild(this.globalBox?this.globalBox:this.entBox);this.setSizes()};this.init=function(fl){if((this.isTreeGrid())&&(!this._h2)){this._h2=this._createHierarchy();if((this._fake)&&(!this._realfake)){this._fake._h2=this._h2}this._tgc={imgURL:null}}if(!this._hstyles){return}if(!this.skin_name){this.setSkin(window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxgrid")||"dhx_skyblue")}this.editStop();this.lastClicked=null;this.resized=null;this.fldSorted=this.r_fldSorted=null;this.cellWidthPX=[];this.cellWidthPC=[];if(this.hdr.rows.length>0){var temp=this.xmlFileUrl;this.clearAll(true);this.xmlFileUrl=temp}var hdrRow=this.hdr.insertRow(0);for(var i=0;i<this.hdrLabels.length;i++){hdrRow.appendChild(document.createElement("TH"));hdrRow.childNodes[i]._cellIndex=i;hdrRow.childNodes[i].style.height="0px"}if(_isIE&&_isIE<8&&document.body.style.msTouchAction==this.undefined){hdrRow.style.position="absolute"}else{hdrRow.style.height="auto"}var hdrRow=this.hdr.insertRow(_isKHTML?2:1);hdrRow._childIndexes=new Array();var col_ex=0;for(var i=0;i<this.hdrLabels.length;i++){hdrRow._childIndexes[i]=i-col_ex;if((this.hdrLabels[i]==this.splitSign)&&(i!=0)){if(_isKHTML){hdrRow.insertCell(i-col_ex)}hdrRow.cells[i-col_ex-1].colSpan=(hdrRow.cells[i-col_ex-1].colSpan||1)+1;hdrRow.childNodes[i-col_ex-1]._cellIndex++;col_ex++;hdrRow._childIndexes[i]=i-col_ex;continue}hdrRow.insertCell(i-col_ex);hdrRow.childNodes[i-col_ex]._cellIndex=i;hdrRow.childNodes[i-col_ex]._cellIndexS=i;this.setColumnLabel(i,this.hdrLabels[i])}if(col_ex==0){hdrRow._childIndexes=null}this._cCount=this.hdrLabels.length;if(_isIE){window.setTimeout(function(){if(self.setSizes){self.setSizes()}},1)}if(!this.obj.firstChild){this.obj.appendChild(document.createElement("TBODY"))}var tar=this.obj.firstChild;if(!tar.firstChild){tar.appendChild(document.createElement("TR"));tar=tar.firstChild;if(_isIE&&_isIE<8&&document.body.style.msTouchAction==this.undefined){tar.style.position="absolute"}else{tar.style.height="auto"}for(var i=0;i<this.hdrLabels.length;i++){tar.appendChild(document.createElement("TH"));tar.childNodes[i].style.height="0px"}}this._c_order=null;if(this.multiLine!=true){this.obj.className+=" row20px"}this.sortImg.style.position="absolute";this.sortImg.style.display="none";this.sortImg.className="dhxgrid_sort_desc";this.sortImg.defLeft=0;if(this.noHeader){this.hdrBox.style.display="none"}else{this.noHeader=false}if(this._ivizcol){this.setColHidden()}this.attachHeader();this.attachHeader(0,0,"_aFoot");this.setSizes();if(fl){this.parseXML()}this.obj.scrollTop=0;if(this.dragAndDropOff){this.dragger.addDragLanding(this.entBox,this)}if(this._initDrF){this._initD()}dhx4.callEvent("onGridCreated",[this])};this.setColumnSizes=function(gridWidth){var summ=0;var fcols=[];var fix=0;for(var i=0;i<this._cCount;i++){if((this.initCellWidth[i]=="*")&&!this._hrrar[i]){this._awdth=false;fcols.push(i);continue}if(this.cellWidthType=="%"){if(typeof this.cellWidthPC[i]=="undefined"){this.cellWidthPC[i]=this.initCellWidth[i]}var cwidth=(gridWidth*this.cellWidthPC[i]/100)||0;if(fix>0.5){cwidth++;fix--}var rwidth=this.cellWidthPX[i]=Math.floor(cwidth);var fix=fix+cwidth-rwidth}else{if(typeof this.cellWidthPX[i]=="undefined"){this.cellWidthPX[i]=this.initCellWidth[i]}}if(!this._hrrar[i]){summ+=this.cellWidthPX[i]*1}}if(fcols.length){var ms=Math.floor((gridWidth-summ)/fcols.length);if(ms<0){ms=1}for(var i=0;i<fcols.length;i++){var next=Math.max((this._drsclmW?(this._drsclmW[fcols[i]]||0):0),ms);this.cellWidthPX[fcols[i]]=next;summ+=next}if(gridWidth>summ){var last=fcols[fcols.length-1];this.cellWidthPX[last]=this.cellWidthPX[last]+(gridWidth-summ);summ=gridWidth}this._setAutoResize()}this.obj.style.width=summ+"px";this.hdr.style.width=summ+"px";if(this.ftr){this.ftr.style.width=summ+"px"}this.chngCellWidth();return summ};this.setSizes=function(){if((!this.hdr.rows[0])){return}var quirks=this.quirks=(_isIE&&document.compatMode=="BackCompat");var outerBorder=(this.entBox.offsetWidth-this.entBox.clientWidth)/2;if(!this.dontSetSizes){if(this.globalBox){var splitOuterBorder=(this.globalBox.offsetWidth-this.globalBox.clientWidth)/2;if(this._delta_x&&!this._realfake){var ow=this.globalBox.clientWidth;this.globalBox.style.width=this._delta_x;this.entBox.style.width=Math.max(0,(this.globalBox.clientWidth+(quirks?splitOuterBorder*2:0))-this._fake.entBox.clientWidth)+"px";if(ow!=this.globalBox.clientWidth){this._fake._correctSplit(this._fake.entBox.clientWidth)}}if(this._delta_y&&!this._realfake){this.globalBox.style.height=this._delta_y;this.entBox.style.overflow=this._fake.entBox.style.overflow="hidden";this.entBox.style.height=this._fake.entBox.style.height=this.globalBox.clientHeight+(quirks?splitOuterBorder*2:0)+"px"}}else{if(this._delta_x){if(this.entBox.parentNode&&this.entBox.parentNode.tagName=="TD"){this.entBox.style.width="1px";this.entBox.style.width=parseInt(this._delta_x)*this.entBox.parentNode.clientWidth/100-outerBorder*2+"px"}else{this.entBox.style.width=this._delta_x}}if(this._delta_y){this.entBox.style.height=this._delta_y}}}window.clearTimeout(this._sizeTime);if(!this.entBox.offsetWidth&&(!this.globalBox||!this.globalBox.offsetWidth)){this._sizeTime=window.setTimeout(function(){if(self.setSizes){self.setSizes()}},250);return}var border_x=((!this._wthB)&&((this.entBox.cmp||this._delta_x)&&(this.skin_name||"").indexOf("dhx")==0&&!quirks)?2:0);var border_y=((!this._wthB)&&((this.entBox.cmp||this._delta_y)&&(this.skin_name||"").indexOf("dhx")==0&&!quirks)?2:0);if(this._sizeFix){border_x-=this._sizeFix;border_y-=this._sizeFix}var isVScroll=this.parentGrid?false:(this.objBox.scrollHeight>this.objBox.offsetHeight);var scrfix=dhtmlx.$customScroll?0:18;var gridWidth=this.entBox.clientWidth-(this.skin_h_correction||0)*(quirks?0:1)-border_x;var gridWidthActive=this.entBox.clientWidth-(this.skin_h_correction||0)-border_x;var gridHeight=this.entBox.clientHeight-border_y;var summ=this.setColumnSizes(gridWidthActive-(isVScroll?scrfix:0)-(this._correction_x||0));var isHScroll=this.parentGrid?false:((this.objBox.scrollWidth>this.objBox.offsetWidth)||(this.objBox.style.overflowX=="scroll"));var headerHeight=this.hdr.clientHeight;var footerHeight=this.ftr?this.ftr.clientHeight:0;var newWidth=gridWidth;var newHeight=gridHeight-headerHeight-footerHeight;if(this._awdth&&this._awdth[0]&&this._awdth[1]==99999){isHScroll=0}if(this._ahgr){if(this._ahgrMA){newHeight=this.entBox.parentNode.clientHeight-headerHeight-footerHeight}else{newHeight=this.obj.offsetHeight+(isHScroll?scrfix:0)+(this._correction_y||0)}if(this._ahgrM){if(this._ahgrF){newHeight=Math.min(this._ahgrM,newHeight+headerHeight+footerHeight)-headerHeight-footerHeight}else{newHeight=Math.min(this._ahgrM,newHeight)}}if(isVScroll&&newHeight>=this.obj.scrollHeight+(isHScroll?scrfix:0)){isVScroll=false;this.setColumnSizes(gridWidthActive-(this._correction_x||0))}}if((this._awdth)&&(this._awdth[0])){if(this.cellWidthType=="%"){this.cellWidthType="px"}if(this._fake){summ+=this._fake.entBox.clientWidth}var newWidth=Math.min(Math.max(summ+(isVScroll?scrfix:0),this._awdth[2]),this._awdth[1])+(this._correction_x||0);this.objBox.style.overflowX=(!isVScroll&&this.objBox.scrollWidth<=newWidth)?"hidden":"auto";if(this._fake){newWidth-=this._fake.entBox.clientWidth}}newHeight=Math.max(0,newHeight);this._ff_size_delta=(this._ff_size_delta==0.1)?0.2:0.1;if(!_isFF){this._ff_size_delta=0}if(!this.dontSetSizes){this.entBox.style.width=Math.max(0,newWidth+(quirks?2:0)*outerBorder+this._ff_size_delta)+"px";this.entBox.style.height=newHeight+(quirks?2:0)*outerBorder+headerHeight+footerHeight+"px"}this.objBox.style.height=newHeight+((quirks&&!isVScroll)?2:0)*outerBorder+"px";this.hdrBox.style.height=headerHeight+"px";if(newHeight!=gridHeight){this.doOnScroll(0,!this._srnd)}var ext=this["setSizes_"+this.skin_name];if(ext){ext.call(this)}this.setSortImgPos();if(headerHeight!=this.hdr.clientHeight&&this._ahgr){this.setSizes()}this.callEvent("onSetSizes",[])};this.chngCellWidth=function(){if((_isOpera)&&(this.ftr)){this.ftr.width=this.objBox.scrollWidth+"px"}var l=this._cCount;for(var i=0;i<l;i++){this.hdr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px";this.obj.rows[0].childNodes[i].style.width=this.cellWidthPX[i]+"px";if(this.ftr){this.ftr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px"}}};this.setDelimiter=function(delim){this.delim=delim};this.setInitWidthsP=function(wp){this.cellWidthType="%";this.initCellWidth=wp.split(this.delim.replace(/px/gi,""));if(!arguments[1]){this._setAutoResize()}};this._setAutoResize=function(){if(this._realfake){return}var el=window;var self=this;dhtmlxEvent(window,"resize",function(){window.clearTimeout(self._resize_timer);if(self._setAutoResize){self._resize_timer=window.setTimeout(function(){if(self.setSizes){self.setSizes()}if(self._fake){self._fake._correctSplit()}},100)}})};this.setInitWidths=function(wp){this.cellWidthType="px";this.initCellWidth=wp.split(this.delim);if(_isFF){for(var i=0;i<this.initCellWidth.length;i++){if(this.initCellWidth[i]!="*"){this.initCellWidth[i]=parseInt(this.initCellWidth[i])}}}};this.enableMultiline=function(state){this.multiLine=dhx4.s2b(state)};this.enableMultiselect=function(state){this.selMultiRows=dhx4.s2b(state)};this.setImagePath=function(path){path=path.replace(/imgs\/dhxgrid_[a-z]*\/$/,"imgs/");this._imgURL=path;this.imgURL=path+"dhxgrid_"+(this.skin_name||"dhx_skyblue").replace("dhx_","")+"/";this.iconTree=this.imgURL+"tree/"};this.setImagesPath=this.setImagePath;this.setIconPath=function(path){this.iconURL=path};this.setIconsPath=this.setIconPath;this.changeCursorState=function(ev){var el=ev.target||ev.srcElement;if(el.tagName!="TD"){el=this.getFirstParentOfType(el,"TD")}if(!el){return}if((el.tagName=="TD")&&(this._drsclmn)&&(!this._drsclmn[el._cellIndex])){return el.style.cursor="default"}var check=(ev.layerX||0)+(((!_isIE)&&(ev.target.tagName=="DIV"))?el.offsetLeft:0);if((el.offsetWidth-(ev.offsetX||(parseInt(this.getPosition(el,this.hdrBox))-check)*-1))<(_isOpera?20:10)){el.style.cursor="E-resize"}else{el.style.cursor="default"}if(_isOpera){this.hdrBox.scrollLeft=this.objBox.scrollLeft}};this.startColResize=function(ev){if(this.resized){this.stopColResize()}this.resized=null;var el=ev.target||ev.srcElement;if(el.tagName!="TD"){el=this.getFirstParentOfType(el,"TD")}var x=ev.clientX;var tabW=this.hdr.offsetWidth;var startW=parseInt(el.offsetWidth);if(el.tagName=="TD"&&el.style.cursor!="default"){if((this._drsclmn)&&(!this._drsclmn[el._cellIndex])){return}self._old_d_mm=document.body.onmousemove;self._old_d_mu=document.body.onmouseup;document.body.onmousemove=function(e){if(self){self.doColResize(e||window.event,el,startW,x,tabW)}};document.body.onmouseup=function(){if(self){self.stopColResize()}}}};this.stopColResize=function(){document.body.onmousemove=self._old_d_mm||"";document.body.onmouseup=self._old_d_mu||"";this.setSizes();this.doOnScroll(0,1);this.callEvent("onResizeEnd",[this])};this.doColResize=function(ev,el,startW,x,tabW){el.style.cursor="E-resize";this.resized=el;var fcolW=startW+(ev.clientX-x);var wtabW=tabW+(ev.clientX-x);if(!(this.callEvent("onResize",[el._cellIndex,fcolW,this]))){return}if(_isIE){this.objBox.scrollLeft=this.hdrBox.scrollLeft}var result=false;if(el.colSpan>1){var a_sizes=new Array();for(var i=0;i<el.colSpan;i++){a_sizes[i]=Math.round(fcolW*this.hdr.rows[0].childNodes[el._cellIndexS+i].offsetWidth/el.offsetWidth)}for(var i=0;i<el.colSpan;i++){result=this._setColumnSizeR(el._cellIndexS+i*1,a_sizes[i])}}else{result=this._setColumnSizeR(el._cellIndex,fcolW)}this.doOnScroll(0,1);this.setSizes();if(this._fake&&this._awdth){this._fake._correctSplit()}return result};this._setColumnSizeR=function(ind,fcolW){if(fcolW>((this._drsclmW&&!this._notresize)?(this._drsclmW[ind]||10):10)){this.obj.rows[0].childNodes[ind].style.width=fcolW+"px";this.hdr.rows[0].childNodes[ind].style.width=fcolW+"px";if(this.ftr){this.ftr.rows[0].childNodes[ind].style.width=fcolW+"px"}if(this.cellWidthType=="px"){this.cellWidthPX[ind]=fcolW}else{var gridWidth=parseInt(this.entBox.offsetWidth);if(this.objBox.scrollHeight>this.objBox.offsetHeight){gridWidth-=17}var pcWidth=Math.round(fcolW/gridWidth*100);this.cellWidthPC[ind]=pcWidth}if(this.sortImg.style.display!="none"){this.setSortImgPos()}}else{return false}};this.setSortImgState=function(state,ind,order,row){order=(order||"asc").toLowerCase();if(!dhx4.s2b(state)){this.sortImg.style.display="none";this.fldSorted=this.r_fldSorted=null;return}if(order=="asc"){this.sortImg.className="dhxgrid_sort_asc"}else{this.sortImg.className="dhxgrid_sort_desc"}this.sortImg.style.display="";this.fldSorted=this.hdr.rows[0].childNodes[ind];var r=this.hdr.rows[row||1];if(!r){return}for(var i=0;i<r.childNodes.length;i++){if(r.childNodes[i]._cellIndexS==ind){this.r_fldSorted=r.childNodes[i];return this.setSortImgPos()}}return this.setSortImgState(state,ind,order,(row||1)+1)};this.setSortImgPos=function(ind,mode,hRowInd,el){if(this._hrrar&&this._hrrar[this.r_fldSorted?this.r_fldSorted._cellIndex:ind]){return}if(!el){if(!ind){var el=this.r_fldSorted}else{var el=this.hdr.rows[hRowInd||0].cells[ind]}}if(el!=null){var pos=this.getPosition(el,this.hdrBox);var wdth=el.offsetWidth;this.sortImg.style.left=Number(pos[0]+wdth-13)+"px";this.sortImg.defLeft=parseInt(this.sortImg.style.left);this.sortImg.style.top=Number(pos[1]+5)+"px";if((!this.useImagesInHeader)&&(!mode)){this.sortImg.style.display="inline"}this.sortImg.style.left=this.sortImg.defLeft+"px"}};this.setActive=function(fl){if(arguments.length==0){var fl=true}if(fl==true){if(globalActiveDHTMLGridObject&&(globalActiveDHTMLGridObject!=this)){globalActiveDHTMLGridObject.editStop();globalActiveDHTMLGridObject.callEvent("onBlur",[globalActiveDHTMLGridObject])}globalActiveDHTMLGridObject=this;this.isActive=true}else{this.isActive=false;this.callEvent("onBlur",[this])}};this._doClick=function(ev){var selMethod=0;var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if(!el||!el.parentNode||!el.parentNode.idd){return}var fl=true;if(this.markedCells){var markMethod=0;if(ev.shiftKey||ev.metaKey){markMethod=1}if(ev.ctrlKey){markMethod=2}this.doMark(el,markMethod);return true}if(this.selMultiRows!=false){if(ev.shiftKey&&this.row!=null&&this.selectedRows.length){selMethod=1}if(ev.ctrlKey||ev.metaKey){selMethod=2}}return this.doClick(el,fl,selMethod,false)};this._doContClick=function(ev){var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if((!el)||(typeof(el.parentNode.idd)=="undefined")){this.callEvent("onEmptyClick",[ev]);return true}if(ev.button==2||(_isMacOS&&ev.ctrlKey)){if(!this.callEvent("onRightClick",[el.parentNode.idd,el._cellIndex,ev])){var z=function(e){(e||event).cancelBubble=true;return false};(ev.srcElement||ev.target).oncontextmenu=z;return z(ev)}if(this._ctmndx){if(!(this.callEvent("onBeforeContextMenu",[el.parentNode.idd,el._cellIndex,this]))){return true}if(_isIE){ev.srcElement.oncontextmenu=function(){event.cancelBubble=true;return false}}if(this._ctmndx.showContextMenu){var dEl0=window.document.documentElement;var dEl1=window.document.body;var corrector=new Array((dEl0.scrollLeft||dEl1.scrollLeft),(dEl0.scrollTop||dEl1.scrollTop));if(_isIE){var x=ev.clientX+corrector[0];var y=ev.clientY+corrector[1]}else{var x=ev.pageX;var y=ev.pageY}this._ctmndx.showContextMenu(x-1,y-1);this.contextID=this._ctmndx.contextMenuZoneId=el.parentNode.idd+"_"+el._cellIndex;this._ctmndx._skip_hide=true}else{el.contextMenuId=el.parentNode.idd+"_"+el._cellIndex;el.contextMenu=this._ctmndx;el.a=this._ctmndx._contextStart;el.a(el,ev);el.a=null}ev.cancelBubble=true;return false}}else{if(this._ctmndx){if(this._ctmndx.hideContextMenu){this._ctmndx.hideContextMenu()}else{this._ctmndx._contextEnd()}}}return true};this.doClick=function(el,fl,selMethod,show){if(!this.selMultiRows){selMethod=0}var psid=this.row?this.row.idd:0;this.setActive(true);if(!selMethod){selMethod=0}if(this.cell!=null){this.cell.className=this.cell.className.replace(/cellselected/g,"")}if(el.tagName=="TD"){if(this.checkEvent("onSelectStateChanged")){var initial=this.getSelectedId()}var prow=this.row;if(selMethod==1){var elRowIndex=this.rowsCol._dhx_find(el.parentNode);var lcRowIndex=this.rowsCol._dhx_find(this.lastClicked);if(elRowIndex>lcRowIndex){var strt=lcRowIndex;var end=elRowIndex}else{var strt=elRowIndex;var end=lcRowIndex}for(var i=0;i<this.rowsCol.length;i++){if((i>=strt&&i<=end)){if(this.rowsCol[i]&&(!this.rowsCol[i]._sRow)){if(this.rowsCol[i].className.indexOf("rowselected")==-1&&(this.callEvent("onBeforeSelect",[this.rowsCol[i].idd,psid,el._cellIndex]))){this.rowsCol[i].className+=" rowselected";this.selectedRows[this.selectedRows.length]=this.rowsCol[i]}}else{this.clearSelection();return this.doClick(el,fl,0,show)}}}}else{if(selMethod==2){if(el.parentNode.className.indexOf("rowselected")!=-1){el.parentNode.className=el.parentNode.className.replace(/rowselected/g,"");this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode));var skipRowSelection=true;show=false}}}this.editStop();if(typeof(el.parentNode.idd)=="undefined"){return true}if((!skipRowSelection)&&(!el.parentNode._sRow)){if(this.callEvent("onBeforeSelect",[el.parentNode.idd,psid,el._cellIndex])){if(this.getSelectedRowId()!=el.parentNode.idd){if(selMethod==0){this.clearSelection()}this.cell=el;if((prow==el.parentNode)&&(this._chRRS)){fl=false}this.row=el.parentNode;this.row.className+=" rowselected";if(this.selectedRows._dhx_find(this.row)==-1){this.selectedRows[this.selectedRows.length]=this.row}}else{this.cell=el;this.row=el.parentNode}}else{fl=false}}if(this.cell&&this.cell.parentNode.className.indexOf("rowselected")!=-1){this.cell.className=this.cell.className.replace(/cellselected/g,"")+" cellselected"}if(selMethod!=1){if(!this.row){return}}this.lastClicked=el.parentNode;var rid=this.row.idd;var cid=this.cell;if(fl&&typeof(rid)!="undefined"&&cid&&!skipRowSelection){self.onRowSelectTime=setTimeout(function(){if(self.callEvent){self.callEvent("onRowSelect",[rid,cid._cellIndex])}},100)}else{this.callEvent("onRowSelectRSOnly",[rid])}if(this.checkEvent("onSelectStateChanged")){var afinal=this.getSelectedId();if(initial!=afinal){this.callEvent("onSelectStateChanged",[afinal,initial])}}if(skipRowSelection){return false}}this.isActive=true;if(show!==false&&this.cell&&this.cell.parentNode.idd){this.moveToVisible(this.cell)}};this.selectAll=function(){this.clearSelection();var coll=this.rowsBuffer;if(this.pagingOn){coll=this.rowsCol}for(var i=0;i<coll.length;i++){this.render_row(i).className+=" rowselected"}this.selectedRows=dhtmlxArray([].concat(coll));if(this.selectedRows.length){this.row=this.selectedRows[0];this.cell=this.row.cells[0]}if((this._fake)&&(!this._realfake)){this._fake.selectAll()}};this.selectCell=function(r,cInd,fl,preserve,edit,show){if(!fl){fl=false}if(typeof(r)!="object"){r=this.render_row(r)}if(!r||r==-1){return null}if(r._childIndexes){var c=r.childNodes[r._childIndexes[cInd]]}else{var c=r.childNodes[cInd]}if(!c){c=r.childNodes[0]}if(!this.markedCells){if(preserve){this.doClick(c,fl,3,show)}else{this.doClick(c,fl,0,show)}}else{this.doMark(c,preserve?2:0)}if(edit){this.editCell()}};this.moveToVisible=function(cell_obj,onlyVScroll){if(this.pagingOn){var newPage=Math.floor(this.getRowIndex(cell_obj.parentNode.idd)/this.rowsBufferOutSize)+1;if(newPage!=this.currentPage){this.changePage(newPage)}}try{if(cell_obj.offsetHeight){var distance=cell_obj.offsetLeft+cell_obj.offsetWidth+20;var scrollLeft=0;if(distance>(this.objBox.offsetWidth+this.objBox.scrollLeft)){if(cell_obj.offsetLeft>this.objBox.scrollLeft){scrollLeft=cell_obj.offsetLeft-(this.objBox.offsetWidth-cell_obj.offsetWidth)+5}}else{if(cell_obj.offsetLeft<this.objBox.scrollLeft){distance-=cell_obj.offsetWidth*2/3;if(distance<this.objBox.scrollLeft){scrollLeft=cell_obj.offsetLeft-5}}}if((scrollLeft)&&(!onlyVScroll)){this.objBox.scrollLeft=scrollLeft}}if(!cell_obj.offsetHeight){var mask=this._realfake?this._fake.rowsAr[cell_obj.parentNode.idd]:cell_obj.parentNode;distance=this.rowsBuffer._dhx_find(mask)*this._srdh}else{distance=cell_obj.offsetTop}var distancemax=distance+cell_obj.offsetHeight+38;if(distancemax>(this.objBox.offsetHeight+this.objBox.scrollTop)){var scrollTop=distance}else{if(distance<this.objBox.scrollTop){var scrollTop=distance-5}}if(scrollTop){this.objBox.scrollTop=scrollTop}}catch(er){}};this.editCell=function(){if(this.editor&&this.cell==this.editor.cell){return}this.editStop();if((this.isEditable!=true)||(!this.cell)){return false}var c=this.cell;if(c.parentNode._locked){return false}this.editor=this.cells4(c);if(this.editor!=null){if(this.editor.isDisabled()){this.editor=null;return false}if(this.callEvent("onEditCell",[0,this.row.idd,this.cell._cellIndex])!=false&&this.editor.edit){this._Opera_stop=(new Date).valueOf();c.className+=" editable";this.editor.edit();this.callEvent("onEditCell",[1,this.row.idd,this.cell._cellIndex])}else{this.editor=null}}};this.editStop=function(mode){if(_isOpera){if(this._Opera_stop){if((this._Opera_stop*1+50)>(new Date).valueOf()){return}this._Opera_stop=null}}if(this.editor&&this.editor!=null){this.editor.cell.className=this.editor.cell.className.replace("editable","");if(mode){var t=this.editor.val;this.editor.detach();this.editor.setValue(t);this.editor=null;this.callEvent("onEditCancel",[this.row.idd,this.cell._cellIndex,t]);return}if(this.editor.detach()){this.cell.wasChanged=true}var g=this.editor;if(g==null){return}this.editor=null;var z=this.callEvent("onEditCell",[2,this.row.idd,this.cell._cellIndex,g.getValue(),g.val]);if((typeof(z)=="string")||(typeof(z)=="number")){g[g.setImage?"setLabel":"setValue"](z)}else{if(!z){g[g.setImage?"setLabel":"setValue"](g.val)}}if(this._ahgr&&this.multiLine){this.setSizes()}}};this._nextRowCell=function(row,dir,pos){row=this._nextRow((this._groups?this.rowsCol:this.rowsBuffer)._dhx_find(row),dir);if(!row){return null}return row.childNodes[row._childIndexes?row._childIndexes[pos]:pos]};this._getNextCell=function(acell,dir,i){acell=acell||this.cell;var arow=acell.parentNode;if(this._tabOrder){i=this._tabOrder[acell._cellIndex];if(typeof i!="undefined"){if(i<0){acell=this._nextRowCell(arow,dir,Math.abs(i)-1)}else{acell=arow.childNodes[i]}}}else{var i=acell._cellIndex+dir;if(i>=0&&i<this._cCount){if(arow._childIndexes){i=arow._childIndexes[acell._cellIndex]+dir}acell=arow.childNodes[i]}else{acell=this._nextRowCell(arow,dir,(dir==1?0:(this._cCount-1)))}}if(!acell){if((dir==1)&&this.tabEnd){this.tabEnd.focus();this.tabEnd.focus();this.setActive(false)}if((dir==-1)&&this.tabStart){this.tabStart.focus();this.tabStart.focus();this.setActive(false)}return null}if(acell.style.display!="none"&&(!this.smartTabOrder||!this.cells(acell.parentNode.idd,acell._cellIndex).isDisabled())){return acell}return this._getNextCell(acell,dir)};this._nextRow=function(ind,dir){var r=this.render_row(ind+dir);if(!r||r==-1){return null}if(r&&r.style.display=="none"){return this._nextRow(ind+dir,dir)}return r};this.scrollPage=function(dir){if(!this.rowsBuffer.length){return}var master=this._realfake?this._fake:this;var new_ind=Math.floor((master._r_select||this.getRowIndex(this.row.idd)||0)+(dir)*this.objBox.offsetHeight/(this._srdh||20));if(new_ind<0){new_ind=0}if(new_ind>=this.rowsBuffer.length){new_ind=this.rowsBuffer.length-1}if(this._srnd&&!this.rowsBuffer[new_ind]){this.objBox.scrollTop+=Math.floor((dir)*this.objBox.offsetHeight/(this._srdh||20))*(this._srdh||20);if(this._fake){this._fake.objBox.scrollTop=this.objBox.scrollTop}master._r_select=new_ind}else{this.selectCell(new_ind,this.cell._cellIndex,true,false,false,(this.multiLine||this._srnd));if(!this.multiLine&&!this._srnd&&!this._realfake){this.objBox.scrollTop=this.getRowById(this.getRowId(new_ind)).offsetTop;if(this._fake){this._fake.objBox.scrollTop=this.objBox.scrollTop}}master._r_select=null}};this.doKey=function(ev){if(!ev){return true}if((ev.target||ev.srcElement).value!==window.undefined){var zx=(ev.target||ev.srcElement);if(zx.className!="dhxcombo_input"&&((!zx.parentNode)||(zx.parentNode.className.indexOf("editable")==-1))){return true}}if((globalActiveDHTMLGridObject)&&(this!=globalActiveDHTMLGridObject)){return globalActiveDHTMLGridObject.doKey(ev)}if(this.isActive==false){return true}if(this._htkebl){return true}if(!this.callEvent("onKeyPress",[ev.keyCode,ev.ctrlKey,ev.shiftKey,ev])){return false}var code="k"+ev.keyCode+"_"+(ev.ctrlKey?1:0)+"_"+(ev.shiftKey?1:0);if(this.cell){if(this._key_events[code]){if(false===this._key_events[code].call(this)){return true}if(ev.preventDefault){ev.preventDefault()}ev.cancelBubble=true;return false}if(this._key_events.k_other){this._key_events.k_other.call(this,ev)}}return true};this.selectRow=function(r,fl,preserve,show){if(typeof(r)!="object"){r=this.render_row(r)}this.selectCell(r,0,fl,preserve,false,show)};this.wasDblClicked=function(ev){var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if(el){var rowId=el.parentNode.idd;return this.callEvent("onRowDblClicked",[rowId,el._cellIndex,ev])}};this._onHeaderClick=function(e,el){var that=this.grid;el=el||that.getFirstParentOfType(_isIE?event.srcElement:e.target,"TD");if(this.grid.resized==null){if(!(this.grid.callEvent("onHeaderClick",[el._cellIndexS,(e||window.event)]))){return false}that.sortField(el._cellIndexS,false,el)}this.grid.resized=null};this.deleteSelectedRows=function(){var num=this.selectedRows.length;if(num==0){return}var tmpAr=this.selectedRows;this.selectedRows=dhtmlxArray();for(var i=num-1;i>=0;i--){var node=tmpAr[i];if(!this.deleteRow(node.idd,node)){this.selectedRows[this.selectedRows.length]=node}else{if(node==this.row){var ind=i}}}if(ind){try{if(ind+1>this.rowsCol.length){ind--}this.selectCell(ind,0,true)}catch(er){this.row=null;this.cell=null}}};this.getSelectedRowId=function(){var selAr=new Array(0);var uni={};for(var i=0;i<this.selectedRows.length;i++){var id=this.selectedRows[i].idd;if(uni[id]){continue}selAr[selAr.length]=id;uni[id]=true}if(selAr.length==0){return null}else{return selAr.join(this.delim)}};this.getSelectedCellIndex=function(){if(this.cell!=null){return this.cell._cellIndex}else{return -1}};this.getColWidth=function(ind){return parseInt(this.cellWidthPX[ind])};this.setColWidth=function(ind,value){if(value=="*"){this.initCellWidth[ind]="*"}else{if(this._hrrar[ind]){return}if(this.cellWidthType=="px"){this.cellWidthPX[ind]=parseInt(value)}else{this.cellWidthPC[ind]=parseInt(value)}}this.setSizes()};this.getRowIndex=function(row_id){for(var i=0;i<this.rowsBuffer.length;i++){if(this.rowsBuffer[i]&&this.rowsBuffer[i].idd==row_id){return i}}return -1};this.getRowId=function(ind){return this.rowsBuffer[ind]?this.rowsBuffer[ind].idd:this.undefined};this.setRowId=function(ind,row_id){this.changeRowId(this.getRowId(ind),row_id)};this.changeRowId=function(oldRowId,newRowId){if(oldRowId==newRowId){return}var row=this.rowsAr[oldRowId];row.idd=newRowId;if(this.UserData[oldRowId]){this.UserData[newRowId]=this.UserData[oldRowId];this.UserData[oldRowId]=null}if(this._h2&&this._h2.get[oldRowId]){this._h2.get[newRowId]=this._h2.get[oldRowId];this._h2.get[newRowId].id=newRowId;delete this._h2.get[oldRowId]}this.rowsAr[oldRowId]=null;this.rowsAr[newRowId]=row;for(var i=0;i<row.childNodes.length;i++){if(row.childNodes[i]._code){row.childNodes[i]._code=this._compileSCL(row.childNodes[i]._val,row.childNodes[i])}}if(this._mat_links&&this._mat_links[oldRowId]){var a=this._mat_links[oldRowId];delete this._mat_links[oldRowId];for(var c in a){for(var i=0;i<a[c].length;i++){this._compileSCL(a[c][i].original,a[c][i])}}}this.callEvent("onRowIdChange",[oldRowId,newRowId])};this.setColumnIds=function(ids){this.columnIds=ids.split(this.delim)};this.setColumnId=function(ind,id){this.columnIds[ind]=id};this.getColIndexById=function(id){for(var i=0;i<this.columnIds.length;i++){if(this.columnIds[i]==id){return i}}};this.getColumnId=function(cin){return this.columnIds[cin]};this.getColumnLabel=function(cin,ind,hdr){var z=(hdr||this.hdr).rows[(ind||0)+1];for(var i=0;i<z.cells.length;i++){if(z.cells[i]._cellIndexS==cin){return(_isIE?z.cells[i].innerText:z.cells[i].textContent)}}return""};this.getColLabel=this.getColumnLabel;this.getFooterLabel=function(cin,ind){return this.getColumnLabel(cin,ind,this.ftr)};this.setRowTextBold=function(row_id){var r=this.getRowById(row_id);if(r){r.style.fontWeight="bold"}};this.setRowTextStyle=function(row_id,styleString){var r=this.getRowById(row_id);if(!r){return}for(var i=0;i<r.childNodes.length;i++){var pfix=r.childNodes[i]._attrs.style||"";if((this._hrrar)&&(this._hrrar[i])){pfix="display:none;"}if(_isIE){r.childNodes[i].style.cssText=pfix+"width:"+r.childNodes[i].style.width+";"+styleString}else{r.childNodes[i].style.cssText=pfix+"width:"+r.childNodes[i].style.width+";"+styleString}}};this.setRowColor=function(row_id,color){var r=this.getRowById(row_id);for(var i=0;i<r.childNodes.length;i++){r.childNodes[i].bgColor=color}};this.setCellTextStyle=function(row_id,ind,styleString){var r=this.getRowById(row_id);if(!r){return}var cell=r.childNodes[r._childIndexes?r._childIndexes[ind]:ind];if(!cell){return}var pfix="";if((this._hrrar)&&(this._hrrar[ind])){pfix="display:none;"}if(_isIE){cell.style.cssText=pfix+"width:"+cell.style.width+";"+styleString}else{cell.style.cssText=pfix+"width:"+cell.style.width+";"+styleString}};this.setRowTextNormal=function(row_id){var r=this.getRowById(row_id);if(r){r.style.fontWeight="normal"}};this.doesRowExist=function(row_id){if(this.getRowById(row_id)!=null){return true}else{return false}};this.getColumnsNum=function(){return this._cCount};this.moveRowUp=function(row_id){var r=this.getRowById(row_id);if(this.isTreeGrid()){return this.moveRowUDTG(row_id,-1)}var rInd=this.rowsCol._dhx_find(r);if((r.previousSibling)&&(rInd!=0)){r.parentNode.insertBefore(r,r.previousSibling);this.rowsCol._dhx_swapItems(rInd,rInd-1);this.setSizes();var bInd=this.rowsBuffer._dhx_find(r);this.rowsBuffer._dhx_swapItems(bInd,bInd-1);if(this._cssEven){this._fixAlterCss(rInd-1)}}};this.moveRowDown=function(row_id){var r=this.getRowById(row_id);if(this.isTreeGrid()){return this.moveRowUDTG(row_id,1)}var rInd=this.rowsCol._dhx_find(r);if(r.nextSibling){this.rowsCol._dhx_swapItems(rInd,rInd+1);if(r.nextSibling.nextSibling){r.parentNode.insertBefore(r,r.nextSibling.nextSibling)}else{r.parentNode.appendChild(r)}this.setSizes();var bInd=this.rowsBuffer._dhx_find(r);this.rowsBuffer._dhx_swapItems(bInd,bInd+1);if(this._cssEven){this._fixAlterCss(rInd)}}};this.getCombo=function(col_ind){if(!this.combos[col_ind]){this.combos[col_ind]=new dhtmlXGridComboObject()}return this.combos[col_ind]};this.setUserData=function(row_id,name,value){if(!row_id){row_id="gridglobaluserdata"}if(!this.UserData[row_id]){this.UserData[row_id]=new Hashtable()}this.UserData[row_id].put(name,value)};this.getUserData=function(row_id,name){if(!row_id){row_id="gridglobaluserdata"}this.getRowById(row_id);var z=this.UserData[row_id];return(z?z.get(name):"")};this.setEditable=function(fl){this.isEditable=dhx4.s2b(fl)};this.selectRowById=function(row_id,multiFL,show,call){if(!call){call=false}this.selectCell(this.getRowById(row_id),0,call,multiFL,false,show)};this.clearSelection=function(){this.editStop();for(var i=0;i<this.selectedRows.length;i++){var r=this.rowsAr[this.selectedRows[i].idd];if(r){r.className=r.className.replace(/rowselected/g,"")}}this.selectedRows=dhtmlxArray();this.row=null;if(this.cell!=null){this.cell.className=this.cell.className.replace(/cellselected/g,"");this.cell=null}this.callEvent("onSelectionCleared",[])};this.copyRowContent=function(from_row_id,to_row_id){var frRow=this.getRowById(from_row_id);if(!this.isTreeGrid()){for(var i=0;i<frRow.cells.length;i++){this.cells(to_row_id,i).setValue(this.cells(from_row_id,i).getValue())}}else{this._copyTreeGridRowContent(frRow,from_row_id,to_row_id)}if(!_isIE){this.getRowById(from_row_id).cells[0].height=frRow.cells[0].offsetHeight}};this.setFooterLabel=function(c,label,ind){return this.setColumnLabel(c,label,ind,this.ftr)};this.setColumnLabel=function(c,label,ind,hdr){var z=(hdr||this.hdr).rows[ind||1];var col=(z._childIndexes?z._childIndexes[c]:c);if(!z.cells[col]){return}if(!this.useImagesInHeader){var hdrHTML="<div class='hdrcell'>";if(label.indexOf("img:[")!=-1){var imUrl=label.replace(/.*\[([^>]+)\].*/,"$1");label=label.substr(label.indexOf("]")+1,label.length);hdrHTML+="<img width='18px' height='18px' align='absmiddle' src='"+imUrl+"' hspace='2'>"}hdrHTML+=label;hdrHTML+="</div>";z.cells[col].innerHTML=hdrHTML;if(this._hstyles[col]){z.cells[col].style.cssText=this._hstyles[col]}}else{z.cells[col].style.textAlign="left";z.cells[col].innerHTML="<img src='"+label+"'>";var a=new Image();a.src=""+label.replace(/(\.[a-z]+)/,".des$1");this.preloadImagesAr[this.preloadImagesAr.length]=a;var b=new Image();b.src=""+label.replace(/(\.[a-z]+)/,".asc$1");this.preloadImagesAr[this.preloadImagesAr.length]=b}if((label||"").indexOf("#")!=-1){var t=label.match(/(^|{)#([^}]+)(}|$)/);if(t){var tn="_in_header_"+t[2];if(this[tn]){this[tn]((this.forceDivInHeader?z.cells[col].firstChild:z.cells[col]),col,label.split(t[0]))}}}};this.setColLabel=function(a,b,ind,c){return this.setColumnLabel(a,b,(ind||0)+1,c)};this.clearAll=function(header){if(!this.obj.rows[0]){return}if(this._h2){this._h2=this._createHierarchy();if(this._fake){if(this._realfake){this._h2=this._fake._h2}else{this._fake._h2=this._h2}}}this.limit=this._limitC=0;this.editStop(true);if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}if(this._dload){this.objBox.scrollTop=0;this.limit=this._limitC||0;this._initDrF=true}var len=this.rowsCol.length;len=this.obj.rows.length;for(var i=len-1;i>0;i--){var t_r=this.obj.rows[i];t_r.parentNode.removeChild(t_r)}if(header){this._master_row=null;this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]);for(var i=this.hdr.rows.length-1;i>=0;i--){var t_r=this.hdr.rows[i];t_r.parentNode.removeChild(t_r)}if(this.ftr){this.ftr.parentNode.removeChild(this.ftr);this.ftr=null}this._aHead=this.ftr=this.cellWidth=this._aFoot=null;this.cellType=dhtmlxArray();this._hrrar=[];this.columnIds=[];this.combos=[];this._strangeParams=[];this.defVal=[];this._ivizcol=null}this.row=null;this.cell=null;this.rowsCol=dhtmlxArray();this.rowsAr={};this._RaSeCol=[];this.rowsBuffer=dhtmlxArray();this.UserData=[];this.selectedRows=dhtmlxArray();if(this.pagingOn||this._srnd){this.xmlFileUrl=""}if(this.pagingOn){this.changePage(1)}if(this._contextCallTimer){window.clearTimeout(this._contextCallTimer)}if(this._sst){this.enableStableSorting(true)}this._fillers=this.undefined;this.setSortImgState(false);this.setSizes();this.callEvent("onClearAll",[])};this.sortField=function(ind,repeatFl,r_el){if(this.getRowsNum()==0){return false}var el=this.hdr.rows[0].cells[ind];if(!el){return}if(el.tagName=="TH"&&(this.fldSort.length-1)>=el._cellIndex&&this.fldSort[el._cellIndex]!="na"){var data=this.getSortingState();var sortType=(data[0]==ind&&data[1]=="asc")?"des":"asc";if(!this.callEvent("onBeforeSorting",[ind,this.fldSort[ind],sortType])){return}this.sortImg.className="dhxgrid_sort_"+(sortType=="asc"?"asc":"desc");if(this.useImagesInHeader){var cel=this.hdr.rows[1].cells[el._cellIndex].firstChild;if(this.fldSorted!=null){var celT=this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild;celT.src=celT.src.replace(/(\.asc\.)|(\.des\.)/,".")}cel.src=cel.src.replace(/(\.[a-z]+)$/,"."+sortType+"$1")}this.sortRows(el._cellIndex,this.fldSort[el._cellIndex],sortType);this.fldSorted=el;this.r_fldSorted=r_el;var c=this.hdr.rows[1];var c=r_el.parentNode;var real_el=c._childIndexes?c._childIndexes[el._cellIndex]:el._cellIndex;this.setSortImgPos(false,false,false,r_el)}};this.setCustomSorting=function(func,col){if(!this._customSorts){this._customSorts=new Array()}this._customSorts[col]=(typeof(func)=="string")?eval(func):func;this.fldSort[col]="cus"};this.enableHeaderImages=function(fl){this.useImagesInHeader=fl};this.setHeader=function(hdrStr,splitSign,styles){if(typeof(hdrStr)!="object"){var arLab=this._eSplit(hdrStr)}else{arLab=[].concat(hdrStr)}var arWdth=new Array(0);var arTyp=new dhtmlxArray(0);var arAlg=new Array(0);var arVAlg=new Array(0);var arSrt=new Array(0);for(var i=0;i<arLab.length;i++){arWdth[arWdth.length]=Math.round(100/arLab.length);arTyp[arTyp.length]="ed";arAlg[arAlg.length]="left";arVAlg[arVAlg.length]="middle";arSrt[arSrt.length]="na"}this.splitSign=splitSign||"#cspan";this.hdrLabels=arLab;this.cellWidth=arWdth;if(!this.initCellWidth.length){this.setInitWidthsP(arWdth.join(this.delim),true)}this.cellType=arTyp;this.cellAlign=arAlg;this.cellVAlign=arVAlg;this.fldSort=arSrt;this._hstyles=styles||[]};this._eSplit=function(str){if(![].push){return str.split(this.delim)}var a="r"+(new Date()).valueOf();var z=this.delim.replace(/([\|\+\*\^])/g,"\\$1");return(str||"").replace(RegExp(z,"g"),a).replace(RegExp("\\\\"+a,"g"),this.delim).split(a)};this.getColType=function(cInd){return this.cellType[cInd]};this.getColTypeById=function(cID){return this.cellType[this.getColIndexById(cID)]};this.setColTypes=function(typeStr){this.cellType=dhtmlxArray(typeStr.split(this.delim));this._strangeParams=new Array();for(var i=0;i<this.cellType.length;i++){if((this.cellType[i].indexOf("[")!=-1)){var z=this.cellType[i].split(/[\[\]]+/g);this.cellType[i]=z[0];this.defVal[i]=z[1];if(z[1].indexOf("=")==0){this.cellType[i]="math";this._strangeParams[i]=z[0]}}if(!window["eXcell_"+this.cellType[i]]){dhx4.callEvent("onConfigurationError",["Incorrect cell type: "+this.cellType[i],this,this.cellType[i]])}}};this.setColSorting=function(sortStr){this.fldSort=sortStr.split(this.delim);var check={str:1,"int":1,date:1};for(var i=0;i<this.fldSort.length;i++){if((!check[this.fldSort[i]])&&(typeof(window[this.fldSort[i]])=="function")){if(!this._customSorts){this._customSorts=new Array()}this._customSorts[i]=window[this.fldSort[i]];this.fldSort[i]="cus"}}};this.setColAlign=function(alStr){this.cellAlign=alStr.split(this.delim);for(var i=0;i<this.cellAlign.length;i++){this.cellAlign[i]=this.cellAlign[i]._dhx_trim()}};this.setColVAlign=function(valStr){this.cellVAlign=valStr.split(this.delim)};this.setNoHeader=function(fl){this.noHeader=dhx4.s2b(fl)};this.showRow=function(rowID){this.getRowById(rowID);if(this._h2){this.openItem(this._h2.get[rowID].parent.id)}var c=this.getRowById(rowID).childNodes[0];while(c&&c.style.display=="none"){c=c.nextSibling}if(c){this.moveToVisible(c,true)}};this.setStyle=function(ss_header,ss_grid,ss_selCell,ss_selRow){this.ssModifier=[ss_header,ss_grid,ss_selCell,ss_selCell,ss_selRow];var prefs=["#"+this.entBox.id+" table.hdr td","#"+this.entBox.id+" table.obj td","#"+this.entBox.id+" table.obj tr.rowselected td.cellselected","#"+this.entBox.id+" table.obj td.cellselected","#"+this.entBox.id+" table.obj tr.rowselected td"];var index=0;while(!_isIE){try{var temp=document.styleSheets[index].cssRules.length}catch(e){index++;continue}break}for(var i=0;i<prefs.length;i++){if(this.ssModifier[i]){if(_isIE){document.styleSheets[0].addRule(prefs[i],this.ssModifier[i])}else{document.styleSheets[index].insertRule(prefs[i]+(" { "+this.ssModifier[i]+" }"),document.styleSheets[index].cssRules.length)}}}};this.setColumnColor=function(clr){this.columnColor=clr.split(this.delim)};this.enableAlterCss=function(cssE,cssU,perLevel,levelUnique){if(cssE||cssU){this.attachEvent("onGridReconstructed",function(){this._fixAlterCss();if(this._fake){this._fake._fixAlterCss()}})}this._cssSP=perLevel;this._cssSU=levelUnique;this._cssEven=cssE;this._cssUnEven=cssU};this._fixAlterCss=function(ind){if(this._h2&&(this._cssSP||this._cssSU)){return this._fixAlterCssTGR(ind)}if(!this._cssEven&&!this._cssUnEven){return}ind=ind||0;var j=ind;for(var i=ind;i<this.rowsCol.length;i++){if(!this.rowsCol[i]){continue}if(this.rowsCol[i].style.display!="none"){if(this.rowsCol[i]._cntr){j=1;continue}if(this.rowsCol[i].className.indexOf("rowselected")!=-1){if(j%2==1){this.rowsCol[i].className=this._cssUnEven+" rowselected "+(this.rowsCol[i]._css||"")}else{this.rowsCol[i].className=this._cssEven+" rowselected "+(this.rowsCol[i]._css||"")}}else{if(j%2==1){this.rowsCol[i].className=this._cssUnEven+" "+(this.rowsCol[i]._css||"")}else{this.rowsCol[i].className=this._cssEven+" "+(this.rowsCol[i]._css||"")}}j++}}};this.clearChangedState=function(){for(var i=0;i<this.rowsCol.length;i++){var row=this.rowsCol[i];if(row&&row.childNodes){var cols=row.childNodes.length;for(var j=0;j<cols;j++){row.childNodes[j].wasChanged=false}}}};this.getChangedRows=function(and_added){var res=new Array();this.forEachRow(function(id){var row=this.rowsAr[id];if(row.tagName!="TR"){return}var cols=row.childNodes.length;if(and_added&&row._added){res[res.length]=row.idd}else{for(var j=0;j<cols;j++){if(row.childNodes[j].wasChanged){res[res.length]=row.idd;break}}}});return res.join(this.delim)};this._sUDa=false;this._sAll=false;this.setSerializationLevel=function(userData,fullXML,config,changedAttr,onlyChanged,asCDATA){this._sUDa=userData;this._sAll=fullXML;this._sConfig=config;this._chAttr=changedAttr;this._onlChAttr=onlyChanged;this._asCDATA=asCDATA};this.setSerializableColumns=function(list){if(!list){this._srClmn=null;return}this._srClmn=(list||"").split(",");for(var i=0;i<this._srClmn.length;i++){this._srClmn[i]=dhx4.s2b(this._srClmn[i])}};this._serialise=function(rCol,inner,closed){this.editStop();var out=[];var close="</"+this.xml.s_row+">";if(this.isTreeGrid()){this._h2.forEachChildF(0,function(el){var temp=this._serializeRow(this.render_row_tree(-1,el.id));out.push(temp);if(temp){return true}else{return false}},this,function(){out.push(close)})}else{for(var i=0;i<this.rowsBuffer.length;i++){if(this.rowsBuffer[i]){if(this._chAttr&&this.rowsBuffer[i]._locator){continue}var temp=this._serializeRow(this.render_row(i));out.push(temp);if(temp){out.push(close)}}}}return[out.join("")]};this._serializeRow=function(r,i){var out=[];var ra=this.xml.row_attrs;var ca=this.xml.cell_attrs;out.push("<"+this.xml.s_row);out.push(" id='"+r.idd+"'");if((this._sAll)&&this.selectedRows._dhx_find(r)!=-1){out.push(" selected='1'")}if(this._h2&&this._h2.get[r.idd].state=="minus"){out.push(" open='1'")}if(ra.length){for(var i=0;i<ra.length;i++){out.push(" "+ra[i]+"='"+r._attrs[ra[i]]+"'")}}out.push(">");if(this._sUDa&&this.UserData[r.idd]){keysAr=this.UserData[r.idd].getKeys();for(var ii=0;ii<keysAr.length;ii++){out.push("<userdata name='"+keysAr[ii]+"'>"+(this._asCDATA?"<![CDATA[":"")+this.UserData[r.idd].get(keysAr[ii])+(this._asCDATA?"]]>":"")+"</userdata>")}}var changeFl=false;for(var jj=0;jj<this._cCount;jj++){if((!this._srClmn)||(this._srClmn[jj])){var zx=this.cells3(r,jj);out.push("<cell");if(ca.length){for(var i=0;i<ca.length;i++){out.push(" "+ca[i]+"='"+zx.cell._attrs[ca[i]]+"'")}}zxVal=zx[this._agetm]();if(this._asCDATA){zxVal="<![CDATA["+zxVal+"]]>"}if((this._ecspn)&&(zx.cell.colSpan)&&zx.cell.colSpan>1){out.push(' colspan="'+zx.cell.colSpan+'" ')}if(this._chAttr){if(zx.wasChanged()){out.push(' changed="1"');changeFl=true}}else{if((this._onlChAttr)&&(zx.wasChanged())){changeFl=true}}if(this._sAll&&this.cellType[jj]=="tree"){out.push((this._h2?(" image='"+this._h2.get[r.idd].image+"'"):"")+">"+zxVal+"</cell>")}else{out.push(">"+zxVal+"</cell>")}if((this._ecspn)&&(zx.cell.colSpan)){for(var u=0;u<zx.cell.colSpan-1;u++){out.push("<cell/>");jj++}}}}if((this._onlChAttr)&&(!changeFl)&&(!r._added)){return""}return out.join("")};this._serialiseConfig=function(){var out="<head>";for(var i=0;i<this.hdr.rows[0].cells.length;i++){if(this._srClmn&&!this._srClmn[i]){continue}var sort=this.fldSort[i];if(sort=="cus"){sort=this._customSorts[i].toString();sort=sort.replace(/function[\ ]*/,"").replace(/\([^\f]*/,"")}out+="<column width='"+this.getColWidth(i)+"' align='"+this.cellAlign[i]+"' type='"+this.cellType[i]+"' sort='"+(sort||"na")+"' color='"+this.columnColor[i]+"'"+(this.columnIds[i]?(" id='"+this.columnIds[i]+"'"):"")+">";if(this._asCDATA){out+="<![CDATA["+this.getColumnLabel(i)+"]]>"}else{out+=this.getColumnLabel(i)}var z=this.getCombo(i);if(z){for(var j=0;j<z.keys.length;j++){out+="<option value='"+z.keys[j]+"'>"+z.values[j]+"</option>"}}out+="</column>"}return out+="</head>"};this.serialize=function(){var out='<?xml version="1.0"?><rows>';if(this._mathSerialization){this._agetm="getMathValue"}else{this._agetm="getValue"}if(this._sUDa&&this.UserData.gridglobaluserdata){var keysAr=this.UserData.gridglobaluserdata.getKeys();for(var i=0;i<keysAr.length;i++){out+="<userdata name='"+keysAr[i]+"'>"+this.UserData.gridglobaluserdata.get(keysAr[i])+"</userdata>"}}if(this._sConfig){out+=this._serialiseConfig()}out+=this._serialise();out+="</rows>";return out};this.getPosition=function(oNode,pNode){if(!pNode){var pos=dhx4.getOffset(oNode);return[pos.left,pos.top]}pNode=pNode||document.body;var oCurrentNode=oNode;var iLeft=0;var iTop=0;while((oCurrentNode)&&(oCurrentNode!=pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;oCurrentNode=oCurrentNode.offsetParent}if(pNode==document.body){if(_isIE){iTop+=document.body.offsetTop||document.documentElement.offsetTop;iLeft+=document.body.offsetLeft||document.documentElement.offsetLeft}else{if(!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop}}}return[iLeft,iTop]};this.getFirstParentOfType=function(obj,tag){while(obj&&obj.tagName!=tag&&obj.tagName!="BODY"){obj=obj.parentNode}return obj};this.objBox.onscroll=function(){this.grid._doOnScroll()};this.hdrBox.onscroll=function(){if(this._try_header_sync){return}this._try_header_sync=true;if(Math.abs(this.grid.objBox.scrollLeft-this.scrollLeft)>1){this.grid.objBox.scrollLeft=this.scrollLeft}this._try_header_sync=false};if((!_isOpera)||(_OperaRv>8.5)){this.hdr.onmousemove=function(e){this.grid.changeCursorState(e||window.event)};this.hdr.onmousedown=function(e){return this.grid.startColResize(e||window.event)}}this.obj.onmousemove=this._drawTooltip;this.objBox.onclick=function(e){(e||event).cancelBubble=true};this.obj.onclick=function(e){if(this.grid._doClick(e||window.event)!==false){if(this.grid._sclE){this.grid.editCell(e||window.event)}else{this.grid.editStop()}}(e||event).cancelBubble=true};if(_isMacOS){this.entBox.oncontextmenu=function(e){e.cancelBubble=true;if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}var that=this.grid;if(that._realfake){that=that._fake}return that._doContClick(e||window.event)}}else{this.entBox.onmousedown=function(e){return this.grid._doContClick(e||window.event)};this.entBox.oncontextmenu=function(e){if(this.grid._ctmndx){(e||event).cancelBubble=true}return !this.grid._ctmndx}}this.obj.ondblclick=function(e){if(!this.grid.wasDblClicked(e||window.event)){return false}if(this.grid._dclE){var row=this.grid.getFirstParentOfType((_isIE?event.srcElement:e.target),"TR");if(row==this.grid.row){this.grid.editCell(e||window.event)}}(e||event).cancelBubble=true;if(_isOpera){return false}};this.hdr.onclick=this._onHeaderClick;this.sortImg.onclick=function(){self._onHeaderClick.apply({grid:self},[null,self.r_fldSorted])};this.hdr.ondblclick=this._onHeaderDblClick;if(!document.body._dhtmlxgrid_onkeydown){dhtmlxEvent(document,"keydown",function(e){if(globalActiveDHTMLGridObject){return globalActiveDHTMLGridObject.doKey(e||window.event)}});document.body._dhtmlxgrid_onkeydown=true}dhtmlxEvent(document.body,"click",function(){if(self.editStop){self.editStop()}if(self.isActive){self.setActive(false)}});if(this.entBox.style.height.toString().indexOf("%")!=-1){this._delta_y=this.entBox.style.height}if(this.entBox.style.width.toString().indexOf("%")!=-1){this._delta_x=this.entBox.style.width}if(this._delta_x||this._delta_y){this._setAutoResize()}this.setColHidden=this.setColumnsVisibility;this.enableCollSpan=this.enableColSpan;this.setMultiselect=this.enableMultiselect;this.setMultiLine=this.enableMultiline;this.deleteSelectedItem=this.deleteSelectedRows;this.getSelectedId=this.getSelectedRowId;this.getHeaderCol=this.getColumnLabel;this.isItemExists=this.doesRowExist;this.getColumnCount=this.getColumnsNum;this.setSelectedRow=this.selectRowById;this.setHeaderCol=this.setColumnLabel;this.preventIECashing=this.preventIECaching;this.enableAutoHeigth=this.enableAutoHeight;this.getUID=this.uid;if(dhtmlx.image_path){this.setImagePath(dhtmlx.image_path)}if(dhtmlx.skin){this.setSkin(dhtmlx.skin)}return this}dhtmlXGridObject.prototype={getRowAttribute:function(c,a){return this.getRowById(c)._attrs[a]},setRowAttribute:function(g,a,c){this.getRowById(g)._attrs[a]=c},isTreeGrid:function(){return(this.cellType._dhx_find("tree")!=-1)},setRowHidden:function(m,g){var c=dhx4.s2b(g);var l=this.getRowById(m);if(!l){return}if(l.expand===""){this.collapseKids(l)}if((g)&&(l.style.display!="none")){l.style.display="none";var j=this.selectedRows._dhx_find(l);if(j!=-1){l.className=l.className.replace("rowselected","");for(var a=0;a<l.childNodes.length;a++){l.childNodes[a].className=l.childNodes[a].className.replace(/cellselected/g,"")}this.selectedRows._dhx_removeAt(j)}this.callEvent("onGridReconstructed",[])}if((!g)&&(l.style.display=="none")){l.style.display="";this.callEvent("onGridReconstructed",[])}this.callEvent("onRowHide",[m,g]);this.setSizes()},setColumnHidden:function(g,c){if(!this.hdr.rows.length){if(!this._ivizcol){this._ivizcol=[]}return this._ivizcol[g]=c}if((this.fldSorted)&&(this.fldSorted.cellIndex==g)&&(c)){this.sortImg.style.display="none"}var a=dhx4.s2b(c);if(a){if(!this._hrrar){this._hrrar=new Array()}else{if(this._hrrar[g]){return}}this._hrrar[g]="display:none;";this._hideShowColumn(g,"none")}else{if((!this._hrrar)||(!this._hrrar[g])){return}this._hrrar[g]="";this._hideShowColumn(g,"")}if((this.fldSorted)&&(this.fldSorted.cellIndex==g)&&(!c)){this.sortImg.style.display="inline"}this.setSortImgPos();this.callEvent("onColumnHidden",[g,c])},isColumnHidden:function(a){if((this._hrrar)&&(this._hrrar[a])){return true}return false},setColumnsVisibility:function(c){if(c){this._ivizcol=c.split(this.delim)}if(this.hdr.rows.length&&this._ivizcol){for(var a=0;a<this._ivizcol.length;a++){this.setColumnHidden(a,this._ivizcol[a])}}},_fixHiddenRowsAll:function(q,g,a,c,n){n=n||"_cellIndex";var o=q.rows.length;for(var m=0;m<o;m++){var r=q.rows[m].childNodes;if(r.length!=this._cCount){for(var l=0;l<r.length;l++){if(r[l][n]==g){r[l].style[a]=c;break}}}else{r[g].style[a]=c}}},_hideShowColumn:function(l,j){var a=l;if(this.hdr.rows[1]&&(this.hdr.rows[1]._childIndexes)&&(this.hdr.rows[1]._childIndexes[l]!=l)){a=this.hdr.rows[1]._childIndexes[l]}if(j=="none"){this.hdr.rows[0].cells[l]._oldWidth=this.hdr.rows[0].cells[l].style.width||(this.initCellWidth[l]+"px");this.hdr.rows[0].cells[l]._oldWidthP=this.cellWidthPC[l];this.obj.rows[0].cells[l].style.width="0px";var c={rows:[this.obj.rows[0]]};this.forEachRow(function(m){if(this.rowsAr[m].tagName=="TR"){c.rows.push(this.rowsAr[m])}});this._fixHiddenRowsAll(c,l,"display","none");if(this.isTreeGrid()){this._fixHiddenRowsAllTG(l,"none")}if((_isOpera&&_OperaRv<9)||_isKHTML||(_isFF)){this._fixHiddenRowsAll(this.hdr,l,"display","none","_cellIndexS")}if(this.ftr){this._fixHiddenRowsAll(this.ftr.childNodes[0],l,"display","none")}this._fixHiddenRowsAll(this.hdr,l,"whiteSpace","nowrap","_cellIndexS");if(!this.cellWidthPX.length&&!this.cellWidthPC.length){this.cellWidthPX=[].concat(this.initCellWidth)}if(this.cellWidthPX[l]){this.cellWidthPX[l]=0}if(this.cellWidthPC[l]){this.cellWidthPC[l]=0}}else{if(this.hdr.rows[0].cells[l]._oldWidth){var g=this.hdr.rows[0].cells[l];if(_isOpera||_isKHTML||(_isFF)){this._fixHiddenRowsAll(this.hdr,l,"display","","_cellIndexS")}if(this.ftr){this._fixHiddenRowsAll(this.ftr.childNodes[0],l,"display","")}var c={rows:[this.obj.rows[0]]};this.forEachRow(function(m){if(this.rowsAr[m].tagName=="TR"){c.rows.push(this.rowsAr[m])}});this._fixHiddenRowsAll(c,l,"display","");if(this.isTreeGrid()){this._fixHiddenRowsAllTG(l,"")}this._fixHiddenRowsAll(this.hdr,l,"whiteSpace","normal","_cellIndexS");if(g._oldWidthP){this.cellWidthPC[l]=g._oldWidthP}if(g._oldWidth){this.cellWidthPX[l]=parseInt(g._oldWidth)}}}this.setSizes();if((!_isIE)&&(!_isFF)){this.obj.border=1;this.obj.border=0}},enableColSpan:function(a){this._ecspn=dhx4.s2b(a)},enableRowsHover:function(c,a){this._unsetRowHover(false,true);this._hvrCss=a;if(dhx4.s2b(c)){if(!this._elmnh){this.obj._honmousemove=this.obj.onmousemove;this.obj.onmousemove=this._setRowHover;if(_isIE){this.obj.onmouseleave=this._unsetRowHover}else{this.obj.onmouseout=this._unsetRowHover}this._elmnh=true}}else{if(this._elmnh){this.obj.onmousemove=this.obj._honmousemove;if(_isIE){this.obj.onmouseleave=null}else{this.obj.onmouseout=null}this._elmnh=false}}},enableEditEvents:function(c,g,a){this._sclE=dhx4.s2b(c);this._dclE=dhx4.s2b(g);this._f2kE=dhx4.s2b(a)},enableLightMouseNavigation:function(a){if(dhx4.s2b(a)){if(!this._elmn){this.entBox._onclick=this.entBox.onclick;this.entBox.onclick=function(){return true};this.obj._onclick=this.obj.onclick;this.obj.onclick=function(g){var j=this.grid.getFirstParentOfType(g?g.target:event.srcElement,"TD");if(!j){return}this.grid.editStop();this.grid.doClick(j);this.grid.editCell();(g||event).cancelBubble=true};this.obj._onmousemove=this.obj.onmousemove;this.obj.onmousemove=this._autoMoveSelect;this._elmn=true}}else{if(this._elmn){this.entBox.onclick=this.entBox._onclick;this.obj.onclick=this.obj._onclick;this.obj.onmousemove=this.obj._onmousemove;this._elmn=false}}},_unsetRowHover:function(g,j){if(j){that=this}else{that=this.grid}if((that._lahRw)&&(that._lahRw!=j)){for(var a=0;a<that._lahRw.childNodes.length;a++){that._lahRw.childNodes[a].className=that._lahRw.childNodes[a].className.replace(that._hvrCss,"")}that._lahRw=null}},_setRowHover:function(g){var j=this.grid.getFirstParentOfType(g?g.target:event.srcElement,"TD");if(j&&j.parentNode!=this.grid._lahRw){this.grid._unsetRowHover(0,j);j=j.parentNode;if(!j.idd||j.idd=="__filler__"){return}for(var a=0;a<j.childNodes.length;a++){j.childNodes[a].className+=" "+this.grid._hvrCss}this.grid._lahRw=j}this._honmousemove(g)},_autoMoveSelect:function(a){if(!this.grid.editor){var g=this.grid.getFirstParentOfType(a?a.target:event.srcElement,"TD");if(g.parentNode.idd){this.grid.doClick(g,true,0)}}this._onmousemove(a)},enableDistributedParsing:function(g,a,c){if(dhx4.s2b(g)){this._ads_count=a||10;this._ads_time=c||250}else{this._ads_count=0}},destructor:function(){this.editStop(true);if(this._sizeTime){this._sizeTime=window.clearTimeout(this._sizeTime)}this.entBox.className=(this.entBox.className||"").replace(/gridbox.*/,"");if(this.formInputs){for(var g=0;g<this.formInputs.length;g++){this.parentForm.removeChild(this.formInputs[g])}}var c;for(var g=0;g<this.rowsCol.length;g++){if(this.rowsCol[g]){this.rowsCol[g].grid=null}}for(g in this.rowsAr){if(this.rowsAr[g]){this.rowsAr[g]=null}}this.rowsCol=new dhtmlxArray();this.rowsAr={};this.entBox.innerHTML="";var j=function(){};this.entBox.onclick=this.entBox.onmousedown=this.entBox.onbeforeactivate=this.entBox.onbeforedeactivate=this.entBox.onbeforedeactivate=this.entBox.onselectstart=j;this.setSizes=this._update_srnd_view=this.callEvent=j;this.entBox.grid=this.objBox.grid=this.hdrBox.grid=this.obj.grid=this.hdr.grid=null;if(this._fake){this.globalBox.innerHTML="";this._fake.setSizes=this._fake._update_srnd_view=this._fake.callEvent=j;this.globalBox.onclick=this.globalBox.onmousedown=this.globalBox.onbeforeactivate=this.globalBox.onbeforedeactivate=this.globalBox.onbeforedeactivate=this.globalBox.onselectstart=j}for(c in this){if((this[c])&&(this[c].m_obj)){this[c].m_obj=null}this[c]=null}if(this==globalActiveDHTMLGridObject){globalActiveDHTMLGridObject=null}return null},getSortingState:function(){var a=new Array();if(this.fldSorted){a[0]=this.fldSorted._cellIndex;a[1]=(this.sortImg.className=="dhxgrid_sort_desc"?"des":"asc")}return a},enableAutoHeight:function(g,c,a){this._ahgr=dhx4.s2b(g);this._ahgrF=dhx4.s2b(a);this._ahgrM=c||null;if(arguments.length==1){this.objBox.style.overflowY=g?"hidden":"auto"}if(c=="auto"){this._ahgrM=null;this._ahgrMA=true;this._setAutoResize()}},enableStableSorting:function(a){this._sst=dhx4.s2b(a);this.rowsCol.stablesort=function(n){var m=this.length-1;for(var l=0;l<this.length-1;l++){for(var g=0;g<m;g++){if(n(this[g],this[g+1])>0){var c=this[g];this[g]=this[g+1];this[g+1]=c}}m--}}},enableKeyboardSupport:function(a){this._htkebl=!dhx4.s2b(a)},enableContextMenu:function(a){this._ctmndx=a},setScrollbarWidthCorrection:function(a){},enableTooltips:function(c){this._enbTts=c.split(",");for(var a=0;a<this._enbTts.length;a++){this._enbTts[a]=dhx4.s2b(this._enbTts[a])}},enableResizing:function(c){this._drsclmn=c.split(",");for(var a=0;a<this._drsclmn.length;a++){this._drsclmn[a]=dhx4.s2b(this._drsclmn[a])}},setColumnMinWidth:function(a,c){if(arguments.length==2){if(!this._drsclmW){this._drsclmW=new Array()}this._drsclmW[c]=a}else{this._drsclmW=a.split(",")}},enableCellIds:function(a){this._enbCid=dhx4.s2b(a)},lockRow:function(a,g){var c=this.getRowById(a);if(c){c._locked=dhx4.s2b(g);if((this.cell)&&(this.cell.parentNode.idd==a)){this.editStop()}}},_getRowArray:function(l){var j=new Array();for(var g=0;g<l.childNodes.length;g++){var c=this.cells3(l,g);j[g]=c.getValue()}return j},setDateFormat:function(c,a){this._dtmask=c;this._dtmask_inc=a},setNumberFormat:function(o,g,l,n){var j=o.replace(/[^0\,\.]*/g,"");var a=j.indexOf(".");if(a>-1){a=j.length-a-1}var c=j.indexOf(",");if(c>-1){c=j.length-a-2-c}if(typeof l!="string"){l=this.i18n.decimal_separator}if(typeof n!="string"){n=this.i18n.group_separator}var q=o.split(j)[0];var m=o.split(j)[1];this._maskArr[g]=[a,c,q,m,l,n]},_aplNFb:function(l,j){var c=this._maskArr[j];if(!c){return l}var g=parseFloat(l.toString().replace(/[^0-9]*/g,""));if(l.toString().substr(0,1)=="-"){g=g*-1}if(c[0]>0){g=g/Math.pow(10,c[0])}return g},_aplNF:function(n,m){var g=this._maskArr[m];if(!g){return n}var o=(parseFloat(n)<0?"-":"")+g[2];n=Math.abs(Math.round(parseFloat(n)*Math.pow(10,g[0]>0?g[0]:0))).toString();n=(n.length<g[0]?Math.pow(10,g[0]+1-n.length).toString().substr(1,g[0]+1)+n.toString():n).split("").reverse();n[g[0]]=(n[g[0]]||"0")+g[4];if(g[1]>0){for(var l=(g[0]>0?0:1)+g[0]+g[1];l<n.length;l+=g[1]){n[l]+=g[5]}}return o+n.reverse().join("")+g[3]},_launchCommands:function(a){for(var l=0;l<a.length;l++){var g=new Array();for(var c=0;c<a[l].childNodes.length;c++){if(a[l].childNodes[c].nodeType==1){g[g.length]=a[l].childNodes[c].firstChild.data}}this[a[l].getAttribute("command")].apply(this,g)}},_parseHead:function(m){var l=dhx4.ajax.xpath("./head",m);if(l.length){var n=dhx4.ajax.xpath("./column",l[0]);var o=dhx4.ajax.xpath("./settings",l[0]);var D="setInitWidths";var x=false;if(o[0]){for(var q=0;q<o[0].childNodes.length;q++){switch(o[0].childNodes[q].tagName){case"colwidth":if(o[0].childNodes[q].firstChild&&o[0].childNodes[q].firstChild.data=="%"){D="setInitWidthsP"}break;case"splitat":x=(o[0].childNodes[q].firstChild?o[0].childNodes[q].firstChild.data:false);break}}}this._launchCommands(dhx4.ajax.xpath("./beforeInit/call",l[0]));if(n.length>0){if(this.hdr.rows.length>0){this.clearAll(true)}var a=[[],[],[],[],[],[],[],[],[]];var w=["","width","type","align","sort","color","format","hidden","id"];var v=["",D,"setColTypes","setColAlign","setColSorting","setColumnColor","","","setColumnIds"];for(var C=0;C<n.length;C++){for(var A=1;A<w.length;A++){a[A].push(n[C].getAttribute(w[A]))}a[0].push((n[C].firstChild?n[C].firstChild.data:"").replace(/^\s*((\s\S)*.+)\s*$/gi,"$1"))}this.setHeader(a[0]);for(var C=0;C<v.length;C++){if(v[C]){this[v[C]](a[C].join(this.delim))}}for(var C=0;C<n.length;C++){if((this.cellType[C].indexOf("co")==0)||(this.cellType[C]=="clist")){var r=dhx4.ajax.xpath("./option",n[C]);if(r.length){var y=new Array();if(this.cellType[C]=="clist"){for(var A=0;A<r.length;A++){y[y.length]=r[A].firstChild?r[A].firstChild.data:""}this.registerCList(C,y)}else{var E=this.getCombo(C);for(var A=0;A<r.length;A++){E.put(r[A].getAttribute("value"),r[A].firstChild?r[A].firstChild.data:"")}}}}else{if(a[6][C]){if((this.cellType[C].toLowerCase().indexOf("calendar")!=-1)||(this.fldSort[C]=="date")){this.setDateFormat(a[6][C])}else{this.setNumberFormat(a[6][C],C)}}}}this.init();var g=a[7].join(this.delim);if(this.setColHidden&&g.replace(/,/g,"")!=""){this.setColHidden(g)}if((x)&&(this.splitAt)){this.splitAt(x)}}this._launchCommands(dhx4.ajax.xpath("./afterInit/call",l[0]))}var c=dhx4.ajax.xpath("//rows/userdata",m);if(c.length>0){if(!this.UserData.gridglobaluserdata){this.UserData.gridglobaluserdata=new Hashtable()}for(var A=0;A<c.length;A++){var F="";for(var u=0;u<c[A].childNodes.length;u++){F+=c[A].childNodes[u].nodeValue}this.UserData.gridglobaluserdata.put(c[A].getAttribute("name"),F)}}},getCheckedRows:function(a){var c=new Array();this.forEachRowA(function(j){var g=this.cells(j,a);if(g.changeState&&g.getValue()!=0){c.push(j)}},true);return c.join(",")},checkAll:function(){var c=arguments.length?arguments[0]:1;for(var a=0;a<this.getColumnsNum();a++){if(this.getColType(a)=="ch"){this.setCheckedRows(a,c)}}},uncheckAll:function(){this.checkAll(0)},setCheckedRows:function(c,a){this.forEachRowA(function(g){if(this.cells(g,c).isCheckbox()){this.cells(g,c).setValue(a)}})},_drawTooltip:function(l){var m=this.grid.getFirstParentOfType(l?l.target:event.srcElement,"TD");if(!m||((this.grid.editor)&&(this.grid.editor.cell==m))){return true}var j=m.parentNode;if(!j.idd||j.idd=="__filler__"){return}var g=(l?l.target:event.srcElement);if(j.idd==window.unknown){return true}if(!this.grid.callEvent("onMouseOver",[j.idd,m._cellIndex,(l||window.event)])){return true}if((this.grid._enbTts)&&(!this.grid._enbTts[m._cellIndex])){if(g.title){g.title=""}return true}if(m._cellIndex>=this.grid._cCount){return}var a=this.grid.cells3(j,m._cellIndex);if(!a||!a.cell||!a.cell._attrs){return}if(g._title){a.cell.title=""}if(!a.cell._attrs.title){g._title=true}if(a){g.title=a.cell._attrs.title||(a.getTitle?a.getTitle():(a.getValue()||"").toString().replace(/<[^>]*>/gi,""))}return true},enableCellWidthCorrection:function(a){if(_isFF){this._wcorr=parseInt(a)}},getAllRowIds:function(g){var a=[];for(var c=0;c<this.rowsBuffer.length;c++){if(this.rowsBuffer[c]){a.push(this.rowsBuffer[c].idd)}}return a.join(g||this.delim)},getAllItemIds:function(){return this.getAllRowIds()},setColspan:function(g,y,l){if(!this._ecspn){return}var a=this.getRowById(g);if((a._childIndexes)&&(a.childNodes[a._childIndexes[y]])){var s=a._childIndexes[y];var o=a.childNodes[s];var q=o.colSpan;o.colSpan=1;if((q)&&(q!=1)){for(var v=1;v<q;v++){var x=document.createElement("TD");if(o.nextSibling){a.insertBefore(x,o.nextSibling)}else{a.appendChild(x)}a._childIndexes[y+v]=s+v;x._cellIndex=y+v;x.style.textAlign=this.cellAlign[v];x.style.verticalAlign=this.cellVAlign[v];o=x;this.cells3(a,y+v).setValue("")}}for(var w=y*1+1*q;w<a._childIndexes.length;w++){a._childIndexes[w]+=(q-1)*1}}if((l)&&(l>1)){if(a._childIndexes){var s=a._childIndexes[y]}else{var s=y;a._childIndexes=new Array();for(var w=0;w<a.childNodes.length;w++){a._childIndexes[w]=w}}a.childNodes[s].colSpan=l;for(var w=1;w<l;w++){a._childIndexes[a.childNodes[s+1]._cellIndex]=s;a.removeChild(a.childNodes[s+1])}var u=a.childNodes[a._childIndexes[y]]._cellIndex;for(var w=u*1+1*l;w<a._childIndexes.length;w++){a._childIndexes[w]-=(l-1)}}},preventIECaching:function(a){dhx4.ajax.cache=!a},enableColumnAutoSize:function(a){this._eCAS=dhx4.s2b(a)},_onHeaderDblClick:function(g){var c=this.grid;var a=c.getFirstParentOfType(_isIE?event.srcElement:g.target,"TD");if(!c._eCAS){return false}c.adjustColumnSize(a._cellIndexS)},adjustColumnSize:function(r,c){if(this._hrrar&&this._hrrar[r]){return}this._notresize=true;var g=0;this._setColumnSizeR(r,20);for(var o=1;o<this.hdr.rows.length;o++){var u=this.hdr.rows[o];u=u.childNodes[(u._childIndexes)?u._childIndexes[r]:r];if((u)&&((!u.colSpan)||(u.colSpan<2))&&u._cellIndex==r){if((u.childNodes[0])&&(u.childNodes[0].className=="hdrcell")){u=u.childNodes[0]}g=Math.max(g,u.scrollWidth)}}var n=this.obj.rows.length;var s=0;var w=this.cellType._dhx_find("tree");for(var q=1;q<n;q++){var v=this.obj.rows[q];if(!this.rowsAr[v.idd]){continue}if(v._childIndexes&&v._childIndexes[r]!=r||!v.childNodes[r]){continue}s=(v.childNodes[r].innerText||v.childNodes[r].textContent||"").length*this.fontWidth;if(this._h2&&r==w){s+=this._h2.get[v.idd].level*22}if(s>g){g=s}}g+=20+(c||0);this._setColumnSizeR(r,g);this._notresize=false;this.setSizes()},detachHeader:function(a,g){g=g||this.hdr;var c=g.rows[a+1];if(c){c.parentNode.removeChild(c)}this.setSizes()},detachFooter:function(a){this.detachHeader(a,this.ftr)},attachHeader:function(a,j,c){if(typeof(a)=="string"){a=this._eSplit(a)}if(typeof(j)=="string"){j=j.split(this.delim)}c=c||"_aHead";if(this.hdr.rows.length){if(a){this._createHRow([a,j],this[(c=="_aHead")?"hdr":"ftr"])}else{if(this[c]){for(var g=0;g<this[c].length;g++){this.attachHeader.apply(this,this[c][g])}}}}else{if(!this[c]){this[c]=new Array()}this[c][this[c].length]=[a,j,c]}},_createHRow:function(g,s){if(!s){if(this.entBox.style.position!="absolute"){this.entBox.style.position="relative"}var o=document.createElement("DIV");o.className="c_ftr".substr(2);this.entBox.appendChild(o);var x=document.createElement("TABLE");x.cellPadding=x.cellSpacing=0;if(!_isIE||_isIE==8){x.width="100%";x.style.paddingRight="20px"}x.style.marginRight="20px";x.style.tableLayout="fixed";o.appendChild(x);x.appendChild(document.createElement("TBODY"));this.ftr=s=x;var n=x.insertRow(0);var a=((this.hdrLabels.length<=1)?g[0].length:this.hdrLabels.length);for(var l=0;l<a;l++){n.appendChild(document.createElement("TH"));n.childNodes[l]._cellIndex=l}if(_isIE&&_isIE<8){n.style.position="absolute"}else{n.style.height="auto"}}var m=g[1];var o=document.createElement("TR");s.rows[0].parentNode.appendChild(o);for(var l=0;l<g[0].length;l++){if(g[0][l]=="#cspan"){var q=o.cells[o.cells.length-1];q.colSpan=(q.colSpan||1)+1;continue}if((g[0][l]=="#rspan")&&(s.rows.length>1)){var A=s.rows.length-2;var y=false;var q=null;while(!y){var q=s.rows[A];for(var c=0;c<q.cells.length;c++){if(q.cells[c]._cellIndex==l){y=c+1;break}}A--}q=q.cells[y-1];q.rowSpan=(q.rowSpan||1)+1;continue}var r=document.createElement("TD");r._cellIndex=r._cellIndexS=l;if(this._hrrar&&this._hrrar[l]&&!_isIE){r.style.display="none"}if(typeof g[0][l]=="object"){r.appendChild(g[0][l])}else{if(this.forceDivInHeader){r.innerHTML="<div class='hdrcell'>"+(g[0][l]||"&nbsp;")+"</div>"}else{r.innerHTML=(g[0][l]||"&nbsp;")}if((g[0][l]||"").indexOf("#")!=-1){var x=g[0][l].match(/(^|{)#([^}]+)(}|$)/);if(x){var u="_in_header_"+x[2];if(this[u]){this[u]((this.forceDivInHeader?r.firstChild:r),l,g[0][l].split(x[0]))}}}}if(m){r.style.cssText=m[l]}o.appendChild(r)}var v=s;if(_isKHTML){if(s._kTimer){window.clearTimeout(s._kTimer)}s._kTimer=window.setTimeout(function(){s.rows[1].style.display="none";window.setTimeout(function(){s.rows[1].style.display=""},1)},500)}},attachFooter:function(a,c){this.attachHeader(a,c,"_aFoot")},setCellExcellType:function(g,a,c){this.changeCellType(this.getRowById(g),a,c)},changeCellType:function(g,j,c){c=c||this.cellType[j];var l=this.cells3(g,j);var a=l.getValue();l.cell._cellType=c;var l=this.cells3(g,j);l.setValue(a)},setRowExcellType:function(g,c){var j=this.rowsAr[g];for(var a=0;a<j.childNodes.length;a++){this.changeCellType(j,a,c)}},setColumnExcellType:function(a,g){for(var c=0;c<this.rowsBuffer.length;c++){if(this.rowsBuffer[c]&&this.rowsBuffer[c].tagName=="TR"){this.changeCellType(this.rowsBuffer[c],a,g)}}if(this.cellType[a]=="math"){this._strangeParams[c]=g}else{this.cellType[a]=g}},forEachRow:function(g){for(var c in this.rowsAr){if(this.rowsAr[c]&&this.rowsAr[c].idd){g.apply(this,[this.rowsAr[c].idd])}}},forEachRowA:function(g){for(var c=0;c<this.rowsBuffer.length;c++){if(this.rowsBuffer[c]){g.call(this,this.render_row(c).idd)}}},forEachCell:function(g,c){var j=this.getRowById(g);if(!j){return}for(var a=0;a<this._cCount;a++){c(this.cells3(j,a),a)}},enableAutoWidth:function(g,a,c){this._awdth=[dhx4.s2b(g),parseInt(a||99999),parseInt(c||0)];if(arguments.length==1){this.objBox.style.overflowX=g?"hidden":"auto"}},updateFromXML:function(a,j,c,g){if(typeof j=="undefined"){j=true}this._refresh_mode=[true,j,c];this.load(a,g)},_refreshFromXML:function(j){if(this._f_rowsBuffer){this.filterBy(0,"")}reset=false;if(window.eXcell_tree){eXcell_tree.prototype.setValueX=eXcell_tree.prototype.setValue;eXcell_tree.prototype.setValue=function(v){var u=this.grid._h2.get[this.cell.parentNode.idd];if(u&&this.cell.parentNode.valTag){this.setLabel(v)}else{this.setValueX(v)}}}var s=this.cellType._dhx_find("tree");var m=dhx4.ajax.xmltop("rows",j);var l=m.getAttribute("parent")||0;var o={};if(this._refresh_mode[2]){if(s!=-1){this._h2.forEachChild(l,function(u){o[u.id]=true},this)}else{this.forEachRow(function(u){o[u]=true})}}var r=dhx4.ajax.xpath("//row",m);for(var g=0;g<r.length;g++){var q=r[g];var a=q.getAttribute("id");o[a]=false;var l=q.parentNode.getAttribute("id")||l;if(this.rowsAr[a]&&this.rowsAr[a].tagName!="TR"){if(this._h2){this._h2.get[a].buff.data=q}else{this.rowsBuffer[this.getRowIndex(a)].data=q}this.rowsAr[a]=q}else{if(this.rowsAr[a]){this._process_xml_row(this.rowsAr[a],q,-1);this._postRowProcessing(this.rowsAr[a],true);if(this._fake&&this._fake.rowsAr[a]){this._fake._process_xml_row(this._fake.rowsAr[a],q,-1)}}else{if(this._refresh_mode[1]){var n={idd:a,data:q,_parser:this._process_xml_row,_locator:this._get_xml_data};var c=this.rowsBuffer.length;if(this._refresh_mode[1]=="top"){this.rowsBuffer.unshift(n);c=0}else{this.rowsBuffer.push(n)}if(this._h2){reset=true;(this._h2.add(a,(q.parentNode.getAttribute("id")||q.parentNode.getAttribute("parent")))).buff=this.rowsBuffer[this.rowsBuffer.length-1]}else{if(this._srnd){reset=true}}this.rowsAr[a]=q;q=this.render_row(c);this._insertRowAt(q,c?-1:0)}}}}if(this._refresh_mode[2]){for(a in o){if(o[a]&&this.rowsAr[a]){this.deleteRow(a)}}}this._refresh_mode=null;if(window.eXcell_tree){eXcell_tree.prototype.setValue=eXcell_tree.prototype.setValueX}if(reset){if(this._h2){this._renderSort()}else{this.render_dataset()}}if(this._f_rowsBuffer){this._f_rowsBuffer=null;this.filterByAll()}},getCustomCombo:function(g,c){var a=this.cells(g,c).cell;if(!a._combo){a._combo=new dhtmlXGridComboObject()}return a._combo},setTabOrder:function(c){var j=c.split(this.delim);this._tabOrder=[];var a=this._cCount||c.length;for(var g=0;g<a;g++){j[g]={c:parseInt(j[g]),ind:g}}j.sort(function(m,l){return(m.c>l.c?1:-1)});for(var g=0;g<a;g++){if(!j[g+1]||(typeof j[g].c=="undefined")){this._tabOrder[j[g].ind]=(j[0].ind+1)*-1}else{this._tabOrder[j[g].ind]=j[g+1].ind}}},i18n:{loading:"Loading",decimal_separator:".",group_separator:","},_key_events:{k13_1_0:function(){var a=this.rowsCol._dhx_find(this.row);this.selectCell(this.rowsCol[a+1],this.cell._cellIndex,true)},k13_0_1:function(){var a=this.rowsCol._dhx_find(this.row);this.selectCell(this.rowsCol[a-1],this.cell._cellIndex,true)},k13_0_0:function(){this.editStop();this.callEvent("onEnter",[(this.row?this.row.idd:null),(this.cell?this.cell._cellIndex:null)]);this._still_active=true},k9_0_0:function(){this.editStop();if(!this.callEvent("onTab",[true])){return true}var a=this._getNextCell(null,1);if(a){this.selectCell(a.parentNode,a._cellIndex,(this.row!=a.parentNode),false,true);this._still_active=true}},k9_0_1:function(){this.editStop();if(!this.callEvent("onTab",[false])){return false}var a=this._getNextCell(null,-1);if(a){this.selectCell(a.parentNode,a._cellIndex,(this.row!=a.parentNode),false,true);this._still_active=true}},k113_0_0:function(){if(this._f2kE){this.editCell()}},k32_0_0:function(){var a=this.cells4(this.cell);if(!a.changeState||(a.changeState()===false)){return false}},k27_0_0:function(){this.editStop(true)},k33_0_0:function(){if(this.pagingOn){this.changePage(this.currentPage-1)}else{this.scrollPage(-1)}},k34_0_0:function(){if(this.pagingOn){this.changePage(this.currentPage+1)}else{this.scrollPage(1)}},k37_0_0:function(){if(!this.editor&&this.isTreeGrid()){this.collapseKids(this.row)}else{return false}},k39_0_0:function(){if(!this.editor&&this.isTreeGrid()){this.expandKids(this.row)}else{return false}},k40_0_0:function(){var c=this._realfake?this._fake:this;if(this.editor&&this.editor.combo){this.editor.shiftNext()}else{if(!this.row.idd){return}var a=Math.max((c._r_select||0),this.getRowIndex(this.row.idd));var g=this._nextRow(a,1);if(g){c._r_select=null;this.selectCell(g,this.cell._cellIndex,true);if(c.pagingOn){c.showRow(g.idd)}}else{if(!this.callEvent("onLastRow",[])){return false}this._key_events.k34_0_0.apply(this,[]);if(this.pagingOn&&this.rowsCol[a+1]){this.selectCell(a+1,0,true)}}}this._still_active=true},k38_0_0:function(){var c=this._realfake?this._fake:this;if(this.editor&&this.editor.combo){this.editor.shiftPrev()}else{if(!this.row.idd){return}var a=this.getRowIndex(this.row.idd)+1;if(a!=-1&&(!this.pagingOn||(a!=1))){var g=this._nextRow(a-1,-1);this.selectCell(g,this.cell._cellIndex,true);if(c.pagingOn&&g){c.showRow(g.idd)}}else{this._key_events.k33_0_0.apply(this,[])}}this._still_active=true}},_build_master_row:function(){var g=document.createElement("DIV");var c=["<table><tr>"];for(var a=0;a<this._cCount;a++){c.push("<td></td>")}c.push("</tr></table>");g.innerHTML=c.join("");this._master_row=g.firstChild.rows[0]},_prepareRow:function(a){if(!this._master_row){this._build_master_row()}var g=this._master_row.cloneNode(true);for(var c=0;c<g.childNodes.length;c++){g.childNodes[c]._cellIndex=c;if(this._enbCid){g.childNodes[c].id="c_"+a+"_"+c}if(this.dragAndDropOff){this.dragger.addDraggableItem(g.childNodes[c],this)}}g.idd=a;g.grid=this;return g},_process_jsarray_row:function(c,g){c._attrs={};for(var a=0;a<c.childNodes.length;a++){c.childNodes[a]._attrs={}}this._fillRow(c,(this._c_order?this._swapColumns(g):g));return c},_get_jsarray_data:function(c,a){return c[a]},_process_json_row:function(a,c){c=this._c_order?this._swapColumns(c.data):c.data;return this._process_some_row(a,c)},_process_some_row:function(c,g){c._attrs={};for(var a=0;a<c.childNodes.length;a++){c.childNodes[a]._attrs={}}this._fillRow(c,g);return c},_get_json_data:function(c,a){return c.data[a]},_process_js_row:function(g,j){var a=[];for(var c=0;c<this.columnIds.length;c++){a[c]=j[this.columnIds[c]];if(!a[c]&&a[c]!==0){a[c]=""}}this._process_some_row(g,a);g._attrs=j;return g},_get_js_data:function(c,a){return c[this.columnIds[a]]},_process_csv_row:function(c,g){c._attrs={};for(var a=0;a<c.childNodes.length;a++){c.childNodes[a]._attrs={}}this._fillRow(c,(this._c_order?this._swapColumns(g.split(this.csv.cell)):g.split(this.csv.cell)));return c},_get_csv_data:function(c,a){return c.split(this.csv.cell)[a]},_process_store_row:function(m,l){var a=[];for(var g=0;g<this.columnIds.length;g++){a[g]=l[this.columnIds[g]]}for(var c=0;c<m.childNodes.length;c++){m.childNodes[c]._attrs={}}m._attrs=l;this._fillRow(m,a)},_process_xml_row:function(a,n){var v=dhx4.ajax.xpath(this.xml.cell,n);var s=[];a._attrs=this._xml_attrs(n);if(this._ud_enabled){var u=dhx4.ajax.xpath("./userdata",n);for(var m=u.length-1;m>=0;m--){var q="";for(var g=0;g<u[m].childNodes.length;g++){q+=u[m].childNodes[g].nodeValue}this.setUserData(a.idd,u[m].getAttribute("name"),q)}}for(var g=0;g<v.length;g++){var l=v[this._c_order?this._c_order[g]:g];if(!l){continue}var c=a._childIndexes?a._childIndexes[g]:g;var o=l.getAttribute("type");if(a.childNodes[c]){if(o){a.childNodes[c]._cellType=o}a.childNodes[c]._attrs=this._xml_attrs(l)}if(!l.getAttribute("xmlcontent")){if(l.firstChild){l=l.firstChild.data}else{l=""}}s.push(l)}for(g<v.length;g<a.childNodes.length;g++){a.childNodes[g]._attrs={}}if(a.parentNode&&a.parentNode.tagName=="row"){a._attrs.parent=a.parentNode.getAttribute("idd")}this._fillRow(a,s);return a},_get_xml_data:function(c,a){c=c.firstChild;while(true){if(!c){return""}if(c.tagName=="cell"){a--}if(a<0){break}c=c.nextSibling}return(c.firstChild?c.firstChild.data:"")},_fillRow:function(j,m){if(this.editor&&this.editor.parentNode&&this.editor.parentNode.idd==j.idd){this.editStop()}for(var c=0;c<j.childNodes.length;c++){if((c<m.length)||(this.defVal[c])){var g=j.childNodes[c]._cellIndex;var l=m[g];var a=this.cells4(j.childNodes[c]);if((this.defVal[g])&&((l=="")||(typeof(l)=="undefined"))){l=this.defVal[g]}if(a){a.setValue(l)}}else{j.childNodes[c].innerHTML="&nbsp;";j.childNodes[c]._clearCell=true}}return j},_postRowProcessing:function(m,o){if(m._attrs["class"]){m._css=m.className=m._attrs["class"]}if(m._attrs.locked){m._locked=true}if(m._attrs.bgColor){m.bgColor=m._attrs.bgColor}var n=0;for(var g=0;g<m.childNodes.length;g++){var q=m.childNodes[g];var l=q._cellIndex;var j=q._attrs.style||m._attrs.style;if(j){q.style.cssText+=";"+j}if(q._attrs["class"]){q.className=q._attrs["class"]}j=q._attrs.align||this.cellAlign[l];if(j){q.align=j}q.vAlign=q._attrs.valign||this.cellVAlign[l];var a=q._attrs.bgColor||this.columnColor[l];if(a){q.bgColor=a}if(q._attrs.colspan&&!o){this.setColspan(m.idd,g+n,q._attrs.colspan);n+=(q._attrs.colspan-1)}if(this._hrrar&&this._hrrar[l]&&!o){q.style.display="none"}}this.callEvent("onRowCreated",[m.idd,m,null])},load:function(a,g,c){this.callEvent("onXLS",[this]);if(arguments.length==2&&typeof g!="function"){c=g;g=null}c=c||"xml";if(!this.xmlFileUrl){this.xmlFileUrl=a}this._data_type=c;this.xmlLoader=this.doLoadDetails;var j=this;this.xmlLoader=function(l){if(!j.callEvent){return}j["_process_"+c](l.xmlDoc);if(!j._contextCallTimer){j.callEvent("onXLE",[j,0,0,l.xmlDoc])}if(g){g();g=null}};return dhx4.ajax.get(a,this.xmlLoader)},loadXMLString:function(c,a){this.parse({responseXML:dhx4.ajax.parse(c)},a,"xml")},loadXML:function(a,c){this.load(a,c,"xml")},parse:function(g,c,a){if(arguments.length==2&&typeof c!="function"){a=c;c=null}a=a||"xml";this._data_type=a;if(a=="xml"&&typeof g=="string"){g={responseXML:dhx4.ajax.parse(g)}}this["_process_"+a](g);if(!this._contextCallTimer){this.callEvent("onXLE",[this,0,0,g])}if(c){c()}},xml:{top:"rows",row:"./row",cell:"./cell",s_row:"row",s_cell:"cell",row_attrs:[],cell_attrs:[]},csv:{row:"\n",cell:","},_xml_attrs:function(c){var g={};if(c.attributes.length){for(var a=0;a<c.attributes.length;a++){g[c.attributes[a].name]=c.attributes[a].value}}return g},_process_xml:function(q){if(this._refresh_mode){return this._refreshFromXML(q)}this._parsing=true;var m=dhx4.ajax.xmltop(this.xml.top,q);if(m.tagName!=this.xml.top){return}var o=m.getAttribute("dhx_security");if(o){dhtmlx.security_key=o}this._parseHead(m);var r=dhx4.ajax.xpath(this.xml.row,m);var l=parseInt(m.getAttribute("pos")||0);var n=parseInt(m.getAttribute("total_count")||0);if(!this.pagingOn){var n=Math.min(n,32000000/this._srdh)}var j=false;if(n&&n!=this.rowsBuffer.length){if(!this.rowsBuffer[n-1]){if(this.rowsBuffer.length){j=true}this.rowsBuffer[n-1]=null}if(n<this.rowsBuffer.length){this.rowsBuffer.splice(n,this.rowsBuffer.length-n);j=true}}if(this.isTreeGrid()){return this._process_tree_xml(m)}for(var c=0;c<r.length;c++){if(this.rowsBuffer[c+l]){continue}var a=r[c].getAttribute("id")||(c+l+1);this.rowsBuffer[c+l]={idd:a,data:r[c],_parser:this._process_xml_row,_locator:this._get_xml_data};this.rowsAr[a]=r[c]}this.callEvent("onDataReady",[]);if(j&&this._srnd){var g=this.objBox.scrollTop;this._reset_view();this.objBox.scrollTop=g}else{this.render_dataset()}this._parsing=false},_process_jsarray:function(data){this._parsing=true;data=data.responseText||data;if(typeof data=="string"){eval("dhtmlx.temp="+data+";");data=dhtmlx.temp}for(var i=0;i<data.length;i++){var id=i+1;this.rowsBuffer.push({idd:id,data:data[i],_parser:this._process_jsarray_row,_locator:this._get_jsarray_data});this.rowsAr[id]=data[i]}this.render_dataset();this._parsing=false},_process_csv:function(j){this._parsing=true;j=j.responseText||j;j=j.replace(/\r/g,"");j=j.split(this.csv.row);if(this._csvHdr){this.clearAll();var g=j.splice(0,1)[0].split(this.csv.cell);if(!this._csvAID){g.splice(0,1)}this.setHeader(g.join(this.delim));this.init()}for(var c=0;c<j.length;c++){if(!j[c]&&c==j.length-1){continue}if(this._csvAID){var l=c+1;this.rowsBuffer.push({idd:l,data:j[c],_parser:this._process_csv_row,_locator:this._get_csv_data})}else{var a=j[c].split(this.csv.cell);var l=a.splice(0,1)[0];this.rowsBuffer.push({idd:l,data:a,_parser:this._process_jsarray_row,_locator:this._get_jsarray_data})}this.rowsAr[l]=j[c]}this.render_dataset();this._parsing=false},_process_js:function(a){return this._process_json(a,"js")},_process_json:function(data,mode){this._parsing=true;var data=data.responseText||data;if(typeof data=="string"){eval("dhtmlx.temp="+data+";");data=dhtmlx.temp}if(mode=="js"){if(data.data){data=data.data}for(var i=0;i<data.length;i++){var row=data[i];var id=row.id||(i+1);this.rowsBuffer.push({idd:id,data:row,_parser:this._process_js_row,_locator:this._get_js_data});this.rowsAr[id]=data[i]}}else{for(var i=0;i<data.rows.length;i++){var id=data.rows[i].id;this.rowsBuffer.push({idd:id,data:data.rows[i],_parser:this._process_json_row,_locator:this._get_json_data});this.rowsAr[id]=data.rows[i]}}if(data.dhx_security){dhtmlx.security_key=data.dhx_security}this.callEvent("onDataReady",[]);this.render_dataset();this._parsing=false},render_dataset:function(j,a){if(this._srnd){if(this._fillers){return this._update_srnd_view()}a=Math.min((this._get_view_size()+(this._srnd_pr||0)),this.rowsBuffer.length)}if(this.pagingOn){j=Math.max((j||0),(this.currentPage-1)*this.rowsBufferOutSize);a=Math.min(this.currentPage*this.rowsBufferOutSize,this.rowsBuffer.length)}else{j=j||0;a=a||this.rowsBuffer.length}for(var g=j;g<a;g++){var m=this.render_row(g);if(m==-1){if(this.xmlFileUrl){if(this.callEvent("onDynXLS",[g,(this._dpref?this._dpref:(a-g))])){this.load(this.xmlFileUrl+dhtmlx.url(this.xmlFileUrl)+"posStart="+g+"&count="+(this._dpref?this._dpref:(a-g)),this._data_type)}}a=g;break}if(!m.parentNode||!m.parentNode.tagName){this._insertRowAt(m,g);if(m._attrs.selected||m._attrs.select){this.selectRow(m,m._attrs.call?true:false,true);m._attrs.selected=m._attrs.select=null}}if(this._ads_count&&g-j==this._ads_count){var l=this;this._context_parsing=this._context_parsing||this._parsing;return this._contextCallTimer=window.setTimeout(function(){l._contextCallTimer=null;l.render_dataset(g,a);if(!l._contextCallTimer){if(l._context_parsing){l.callEvent("onXLE",[])}else{l._fixAlterCss()}l.callEvent("onDistributedEnd",[]);l._context_parsing=false}},this._ads_time)}}if(this._ads_count&&g==a){this.callEvent("onDistributedEnd",[])}if(this._srnd&&!this._fillers){var c=this.rowsBuffer.length-a;this._fillers=[];if(this._fake&&!this._realfake){this._fake._fillers=[]}while(c>0){var o=(_isIE||window._FFrv)?Math.min(c,50000):c;var n=this._add_filler(a,o);if(n){this._fillers.push(n)}c-=o;a+=o}}this.setSizes()},render_row:function(c){if(!this.rowsBuffer[c]){return -1}if(this.rowsBuffer[c]._parser){var a=this.rowsBuffer[c];if(this.rowsAr[a.idd]&&this.rowsAr[a.idd].tagName=="TR"){return this.rowsBuffer[c]=this.rowsAr[a.idd]}var g=this._prepareRow(a.idd);this.rowsBuffer[c]=g;this.rowsAr[a.idd]=g;a._parser.call(this,g,a.data);this._postRowProcessing(g);return g}return this.rowsBuffer[c]},_get_cell_value:function(c,a,g){if(c._locator){if(this._c_order){a=this._c_order[a]}return c._locator.call(this,c.data,a)}return this.cells3(c,a)[g?g:"getValue"]()},sortRows:function(g,m,c){this.editStop();c=(c||"asc").toLowerCase();m=(m||this.fldSort[g]);g=g||0;if(this.isTreeGrid()){this.sortTreeRows(g,m,c)}else{var a={};var l=this.cellType[g];var n="getValue";if(l=="link"){n="getContent"}if(l=="dhxCalendar"||l=="dhxCalendarA"){n="getDate"}for(var j=0;j<this.rowsBuffer.length;j++){a[this.rowsBuffer[j].idd]=this._get_cell_value(this.rowsBuffer[j],g,n)}this._sortRows(g,m,c,a)}this.callEvent("onAfterSorting",[g,m,c])},_sortCore:function(g,m,c,a,l){var j="sort";if(this._sst){l.stablesort=this.rowsCol.stablesort;j="stablesort"}if(m.length>4){m=window[m]}if(m=="cus"){var n=this._customSorts[g];l[j](function(q,o){return n(a[q.idd],a[o.idd],c,q.idd,o.idd)})}else{if(typeof(m)=="function"){l[j](function(q,o){return m(a[q.idd],a[o.idd],c,q.idd,o.idd)})}else{if(m=="str"){l[j](function(q,o){if(c=="asc"){return a[q.idd]>a[o.idd]?1:(a[q.idd]<a[o.idd]?-1:0)}else{return a[q.idd]<a[o.idd]?1:(a[q.idd]>a[o.idd]?-1:0)}})}else{if(m=="int"){l[j](function(r,q){var o=parseFloat(a[r.idd]);o=isNaN(o)?-99999999999999:o;var s=parseFloat(a[q.idd]);s=isNaN(s)?-99999999999999:s;if(c=="asc"){return o-s}else{return s-o}})}else{if(m=="date"){l[j](function(r,q){var o=Date.parse(a[r.idd])||(Date.parse("01/01/1900"));var s=Date.parse(a[q.idd])||(Date.parse("01/01/1900"));if(c=="asc"){return o-s}else{return s-o}})}}}}}},_sortRows:function(g,j,c,a){this._sortCore(g,j,c,a,this.rowsBuffer);this._reset_view();this.callEvent("onGridReconstructed",[])},_reset_view:function(g){if(!this.obj.rows[0]){return}if(this._lahRw){this._unsetRowHover(0,true)}this.callEvent("onResetView",[]);var a=this.obj.rows[0].parentNode;var j=a.removeChild(a.childNodes[0],true);if(_isKHTML){for(var c=a.parentNode.childNodes.length-1;c>=0;c--){if(a.parentNode.childNodes[c].tagName=="TR"){a.parentNode.removeChild(a.parentNode.childNodes[c],true)}}}else{if(_isIE){for(var c=a.childNodes.length-1;c>=0;c--){a.childNodes[c].removeNode(true)}}else{a.innerHTML=""}}a.appendChild(j);this.rowsCol=dhtmlxArray();if(this._sst){this.enableStableSorting(true)}this._fillers=this.undefined;if(!g){if(_isIE&&this._srnd){this.render_dataset()}else{this.render_dataset()}}},deleteRow:function(c,j){if(!j){j=this.getRowById(c)}if(!j){return}this.editStop();if(!this._realfake){if(this.callEvent("onBeforeRowDeleted",[c])==false){return false}}var a=0;if(this.cellType._dhx_find("tree")!=-1&&!this._realfake){a=this._h2.get[c].parent.id;this._removeTrGrRow(j)}else{if(j.parentNode){j.parentNode.removeChild(j)}var m=this.rowsCol._dhx_find(j);if(m!=-1){this.rowsCol._dhx_removeAt(m)}for(var g=0;g<this.rowsBuffer.length;g++){if(this.rowsBuffer[g]&&this.rowsBuffer[g].idd==c){this.rowsBuffer._dhx_removeAt(g);m=g;break}}}this.rowsAr[c]=null;for(var g=0;g<this.selectedRows.length;g++){if(this.selectedRows[g].idd==c){this.selectedRows._dhx_removeAt(g)}}if(this._srnd){for(var g=0;g<this._fillers.length;g++){var l=this._fillers[g];if(!l){continue}if(l[0]>=m){this._update_fillers(g,0,-1)}else{if(l[0]+l[1]>m){this._update_fillers(g,-1,0)}}}this._update_srnd_view()}if(this.pagingOn){this.changePage()}if(!this._realfake){this.callEvent("onAfterRowDeleted",[c,a])}this.callEvent("onGridReconstructed",[]);if(this._ahgr){this.setSizes()}return true},_addRow:function(n,o,c){if(c==-1||typeof c=="undefined"){c=this.rowsBuffer.length}if(typeof o=="string"){o=o.split(this.delim)}var q=this._prepareRow(n);q._attrs={};for(var g=0;g<q.childNodes.length;g++){q.childNodes[g]._attrs={}}this.rowsAr[q.idd]=q;if(this._h2){this._h2.get[q.idd].buff=q}this._fillRow(q,o);this._postRowProcessing(q);if(this._skipInsert){this._skipInsert=false;return this.rowsAr[q.idd]=q}if(this.pagingOn){this.rowsBuffer._dhx_insertAt(c,q);this.rowsAr[q.idd]=q;return q}if(this._fillers){this.rowsCol._dhx_insertAt(c,null);this.rowsBuffer._dhx_insertAt(c,q);if(this._fake){this._fake.rowsCol._dhx_insertAt(c,null)}this.rowsAr[q.idd]=q;var r=false;for(var l=0;l<this._fillers.length;l++){var m=this._fillers[l];if(m&&m[0]<=c&&(m[0]+m[1])>=c){m[1]=m[1]+1;var a=m[2].firstChild.style.height=parseInt(m[2].firstChild.style.height)+this._srdh+"px";r=true;if(this._fake){this._fake._fillers[l][1]++;this._fake._fillers[l][2].firstChild.style.height=a}}if(m&&m[0]>c){m[0]=m[0]+1;if(this._fake){this._fake._fillers[l][0]++}}}if(!r){this._fillers.push(this._add_filler(c,1,(c==0?{parentNode:this.obj.rows[0].parentNode,nextSibling:(this.rowsCol[1])}:this.rowsCol[c-1])))}return q}this.rowsBuffer._dhx_insertAt(c,q);return this._insertRowAt(q,c)},addRow:function(a,j,g){var c=this._addRow(a,j,g);if(!this.dragContext){this.callEvent("onRowAdded",[a])}if(this.pagingOn){this.changePage(this.currentPage)}if(this._srnd){this._update_srnd_view()}c._added=true;if(this._ahgr){this.setSizes()}this.callEvent("onGridReconstructed",[]);return c},_insertRowAt:function(g,j,c){this.rowsAr[g.idd]=g;if(this._skipInsert){this._skipInsert=false;return g}if((j<0)||((!j)&&(parseInt(j)!==0))){j=this.rowsCol.length}else{if(j>this.rowsCol.length){j=this.rowsCol.length}}if(this._cssEven){var a=g.className.replace(this._cssUnEven,"");if((this._cssSP?this.getLevel(g.idd):j)%2==1){g.className=a+" "+this._cssUnEven+(this._cssSU?(" "+this._cssUnEven+"_"+this.getLevel(g.idd)):"")}else{g.className=a+" "+this._cssEven+(this._cssSU?(" "+this._cssEven+"_"+this.getLevel(g.idd)):"")}}if(!c){if((j==(this.obj.rows.length-1))||(!this.rowsCol[j])){if(_isKHTML){this.obj.appendChild(g)}else{this.obj.firstChild.appendChild(g)}}else{this.rowsCol[j].parentNode.insertBefore(g,this.rowsCol[j])}}this.rowsCol._dhx_insertAt(j,g);this.callEvent("onRowInserted",[g,j]);return g},getRowById:function(g){var c=this.rowsAr[g];if(c){if(c.tagName!="TR"){for(var a=0;a<this.rowsBuffer.length;a++){if(this.rowsBuffer[a]&&this.rowsBuffer[a].idd==g){return this.render_row(a)}}if(this._h2){return this.render_row(null,c.idd)}}return c}return null},cellById:function(c,a){return this.cells(c,a)},cells:function(j,g){if(arguments.length==0){return this.cells4(this.cell)}else{var l=this.getRowById(j)}var a=(l._childIndexes?l.childNodes[l._childIndexes[g]]:l.childNodes[g]);if(!a&&l._childIndexes){a=l.firstChild||{}}return this.cells4(a)},cellByIndex:function(c,a){return this.cells2(c,a)},cells2:function(j,g){var l=this.render_row(j);var a=(l._childIndexes?l.childNodes[l._childIndexes[g]]:l.childNodes[g]);if(!a&&l._childIndexes){a=l.firstChild||{}}return this.cells4(a)},cells3:function(g,c){var a=(g._childIndexes?g.childNodes[g._childIndexes[c]]:g.childNodes[c]);return this.cells4(a)},cells4:function(a){var c=window["eXcell_"+(a._cellType||this.cellType[a._cellIndex])];if(c){return new c(a)}},cells5:function(a,g){var g=g||(a._cellType||this.cellType[a._cellIndex]);if(!this._ecache[g]){if(!window["eXcell_"+g]){var c=eXcell_ro}else{var c=window["eXcell_"+g]}this._ecache[g]=new c(a)}this._ecache[g].cell=a;return this._ecache[g]},dma:function(a){if(!this._ecache){this._ecache={}}if(a&&!this._dma){this._dma=this.cells4;this.cells4=this.cells5}else{if(!a&&this._dma){this.cells4=this._dma;this._dma=null}}},getRowsNum:function(){return this.rowsBuffer.length},enableEditTabOnly:function(a){if(arguments.length>0){this.smartTabOrder=dhx4.s2b(a)}else{this.smartTabOrder=true}},setExternalTabOrder:function(l,a){var c=this;this.tabStart=(typeof(l)=="object")?l:document.getElementById(l);var g=this.tabStart.onkeydown;this.tabStart.onkeydown=function(n){if(g){g.call(this,n)}var m=(n||window.event);if(m.keyCode==9&&!m.shiftKey){m.cancelBubble=true;c.selectCell(0,0,0,0,1);if(c.smartTabOrder&&c.cells2(0,0).isDisabled()){c._key_events.k9_0_0.call(c)}this.blur();return false}};if(_isOpera){this.tabStart.onkeypress=this.tabStart.onkeydown}this.tabEnd=(typeof(a)=="object")?a:document.getElementById(a);var j=this.tabEnd.onkeydown;this.tabEnd.onkeydown=this.tabEnd.onkeypress=function(n){if(j){j.call(this,n)}var m=(n||window.event);if(m.keyCode==9&&m.shiftKey){m.cancelBubble=true;c.selectCell((c.getRowsNum()-1),(c.getColumnCount()-1),0,0,1);if(c.smartTabOrder&&c.cells2((c.getRowsNum()-1),(c.getColumnCount()-1)).isDisabled()){c._key_events.k9_0_1.call(c)}this.blur();return false}};if(_isOpera){this.tabEnd.onkeypress=this.tabEnd.onkeydown}},uid:function(){if(!this._ui_seed){this._ui_seed=(new Date()).valueOf()}return this._ui_seed++},clearAndLoad:function(){var a=this._pgn_skin;this._pgn_skin=null;this.clearAll();this._pgn_skin=a;this.load.apply(this,arguments)},getStateOfView:function(){if(this.pagingOn){var a=(this.currentPage-1)*this.rowsBufferOutSize;return[this.currentPage,a,Math.min(a+this.rowsBufferOutSize,this.rowsBuffer.length),this.rowsBuffer.length]}return[Math.floor(this.objBox.scrollTop/this._srdh),Math.ceil(parseInt(this.objBox.offsetHeight)/this._srdh),this.rowsBuffer.length]}};(function(){function j(n,o){this[n]=o}function m(n,o){this[n].call(this,o)}function g(n,o){this[n].call(this,o.join(this.delim))}function a(n,r){for(var q=0;q<r.length;q++){if(typeof r[q]=="object"){var s=this.getCombo(q);for(var o in r[q]){s.put(o,r[q][o])}}}}function l(n,w,r){var y=1;var v=[];function x(C,A,D){if(!v[A]){v[A]=[]}if(typeof D=="object"){D.toString=function(){return this.text}}v[A][C]=D}for(var s=0;s<w.length;s++){if(typeof(w[s])=="object"&&w[s].length){for(var q=0;q<w[s].length;q++){x(s,q,w[s][q])}}else{x(s,0,w[s])}}for(var s=0;s<v.length;s++){for(var q=0;q<v[0].length;q++){var u=v[s][q];v[s][q]=(u||"").toString()||"&nbsp;";if(u&&u.colspan){for(var o=1;o<u.colspan;o++){x(q+o,s,"#cspan")}}if(u&&u.rowspan){for(var o=1;o<u.rowspan;o++){x(q,s+o,"#rspan")}}}}this.setHeader(v[0]);for(var s=1;s<v.length;s++){this.attachHeader(v[s])}}var c=[{name:"label",def:"&nbsp;",operation:"setHeader",type:l},{name:"id",def:"",operation:"columnIds",type:j},{name:"width",def:"*",operation:"setInitWidths",type:g},{name:"align",def:"left",operation:"cellAlign",type:j},{name:"valign",def:"middle",operation:"cellVAlign",type:j},{name:"sort",def:"na",operation:"fldSort",type:j},{name:"type",def:"ro",operation:"setColTypes",type:g},{name:"options",def:"",operation:"",type:a}];dhtmlx.extend_api("dhtmlXGridObject",{_init:function(n){return[n.parent]},image_path:"setImagePath",columns:"columns",rows:"rows",headers:"headers",skin:"setSkin",smart_rendering:"enableSmartRendering",css:"enableAlterCss",auto_height:"enableAutoHeight",save_hidden:"enableAutoHiddenColumnsSaving",save_cookie:"enableAutoSaving",save_size:"enableAutoSizeSaving",auto_width:"enableAutoWidth",block_selection:"enableBlockSelection",csv_id:"enableCSVAutoID",csv_header:"enableCSVHeader",cell_ids:"enableCellIds",colspan:"enableColSpan",column_move:"enableColumnMove",context_menu:"enableContextMenu",distributed:"enableDistributedParsing",drag:"enableDragAndDrop",drag_order:"enableDragOrder",tabulation:"enableEditTabOnly",header_images:"enableHeaderImages",header_menu:"enableHeaderMenu",keymap:"enableKeyboardSupport",mouse_navigation:"enableLightMouseNavigation",markers:"enableMarkedCells",math_editing:"enableMathEditing",math_serialization:"enableMathSerialization",drag_copy:"enableMercyDrag",multiline:"enableMultiline",multiselect:"enableMultiselect",save_column_order:"enableOrderSaving",hover:"enableRowsHover",rowspan:"enableRowspan",smart:"enableSmartRendering",save_sorting:"enableSortingSaving",stable_sorting:"enableStableSorting",undo:"enableUndoRedo",csv_cell:"setCSVDelimiter",date_format:"setDateFormat",drag_behavior:"setDragBehavior",editable:"setEditable",without_header:"setNoHeader",submit_changed:"submitOnlyChanged",submit_serialization:"submitSerialization",submit_selected:"submitOnlySelected",submit_id:"submitOnlyRowID",xml:"load"},{columns:function(s){for(var n=0;n<c.length;n++){var r=[];for(var o=0;o<s.length;o++){r[o]=s[o][c[n].name]||c[n].def}var q=c[n].type||m;q.call(this,c[n].operation,r,s)}this.init()},rows:function(n){},headers:function(o){for(var n=0;n<o.length;n++){this.attachHeader(o[n])}}})})();dhtmlXGridObject.prototype._dp_init=function(a){a.attachEvent("insertCallback",function(c,j){if(this.obj._h2){this.obj.addRow(j,g,null,parent)}else{this.obj.addRow(j,[],0)}var g=this.obj.getRowById(j);if(g){this.obj._process_xml_row(g,c.firstChild);this.obj._postRowProcessing(g)}});a.attachEvent("updateCallback",function(c,j){var g=this.obj.getRowById(j);if(g){this.obj._process_xml_row(g,c.firstChild);this.obj._postRowProcessing(g)}});a.attachEvent("deleteCallback",function(c,g){this.obj.setUserData(g,this.action_param,"true_deleted");this.obj.deleteRow(g)});a._methods=["setRowTextStyle","setCellTextStyle","changeRowId","deleteRow"];this.attachEvent("onEditCell",function(j,l,g){if(a._columns&&!a._columns[g]){return true}var c=this.cells(l,g);if(j==1){if(c.isCheckbox()){a.setUpdated(l,true)}}else{if(j==2){if(c.wasChanged()){a.setUpdated(l,true)}}}return true});this.attachEvent("onRowPaste",function(c){a.setUpdated(c,true)});this.attachEvent("onUndo",function(c){a.setUpdated(c,true)});this.attachEvent("onRowIdChange",function(j,c){var g=a.findRow(j);if(g<a.updatedRows.length){a.updatedRows[g]=c}});this.attachEvent("onSelectStateChanged",function(c){if(a.updateMode=="row"){a.sendData()}return true});this.attachEvent("onEnter",function(g,c){if(a.updateMode=="row"){a.sendData()}return true});this.attachEvent("onBeforeRowDeleted",function(c){if(!this.rowsAr[c]){return true}if(this.dragContext&&a.dnd){window.setTimeout(function(){a.setUpdated(c,true)},1);return true}var g=a.getState(c);if(this._h2){this._h2.forEachChild(c,function(j){a.setUpdated(j.id,false);a.markRow(j.id,true,"deleted")},this)}if(g=="inserted"){a.set_invalid(c,false);a.setUpdated(c,false);return true}if(g=="deleted"){return false}if(g=="true_deleted"){a.setUpdated(c,false);return true}a.setUpdated(c,true,"deleted");return false});this.attachEvent("onBindUpdate",function(c){if(typeof c=="object"){c=c.id}a.setUpdated(c,true)});this.attachEvent("onRowAdded",function(c){if(this.dragContext&&a.dnd){return true}a.setUpdated(c,true,"inserted");return true});a._getRowData=function(l,v){var o=[];o.gr_id=l;if(this.obj.isTreeGrid()){o.gr_pid=this.obj.getParentId(l)}var g=this.obj.getRowById(l);for(var q=0;q<this.obj._cCount;q++){if(this.obj._c_order){var s=this.obj._c_order[q]}else{var s=q}var u=this.obj.cells(g.idd,q);if(this._changed&&!u.wasChanged()){continue}if(this._endnm){o[this.obj.getColumnId(q)]=u.getValue()}else{o["c"+s]=u.getValue()}}var m=this.obj.UserData[l];if(m){for(var n=0;n<m.keys.length;n++){if(m.keys[n]&&m.keys[n].indexOf("__")!=0){o[m.keys[n]]=m.values[n]}}}var m=this.obj.UserData.gridglobaluserdata;if(m){for(var n=0;n<m.keys.length;n++){o[m.keys[n]]=m.values[n]}}return o};a._clearUpdateFlag=function(g){var l=this.obj.getRowById(g);if(l){for(var c=0;c<this.obj._cCount;c++){this.obj.cells(g,c).cell.wasChanged=false}}};a.checkBeforeUpdate=function(m){var l=true;var c=[];for(var j=0;j<this.obj._cCount;j++){if(this.mandatoryFields[j]){var g=this.mandatoryFields[j].call(this.obj,this.obj.cells(m,j).getValue(),m,j);if(typeof g=="string"){this.messages.push(g);l=false}else{l&=g;c[j]=!g}}}if(!l){this.set_invalid(m,"invalid",c);this.setUpdated(m,false)}return l}};dhx4.attachEvent("onGridCreated",function(c){c._con_f_used=[].concat(c._con_f_used);dhtmlXGridObject.prototype._con_f_used=[];var a=function(m){m=m.replace(/(\?|\&)connector[^\f]*/g,"");return m+(m.indexOf("?")!=-1?"&":"?")+"connector=true"+(this.hdr.rows.length>0?"&dhx_no_header=1":"")};var l=function(m){return a.call(this,m)+(this._connector_sorting||"")+(this._connector_filter||"")};var j=function(n,o,m){this._connector_sorting="&dhx_sort["+o+"]="+m;return l.call(this,n)};var g=function(n,m,q){var r=[];for(var o=0;o<m.length;o++){r[o]="dhx_filter["+m[o]+"]="+encodeURIComponent(q[o])}this._connector_filter="&"+r.join("&");return l.call(this,n)};c.attachEvent("onCollectValues",function(m){if(this._con_f_used[m]){if(typeof(this._con_f_used[m])=="object"){return this._con_f_used[m]}else{return false}}return true});c.attachEvent("onDynXLS",function(){this.xmlFileUrl=l.call(this,this.xmlFileUrl);return true});c.attachEvent("onBeforeSorting",function(q,o,n){if(o=="connector"){var m=this;this.clearAndLoad(j.call(this,this.xmlFileUrl,q,n),function(){m.setSortImgState(true,q,n)});return false}return true});c.attachEvent("onFilterStart",function(n,m){var q=this.getSortingState();if(this._con_f_used.length){var o=this;this.clearAndLoad(g.call(this,this.xmlFileUrl,n,m));if(q.length){o.setSortImgState(true,q[0],q[1])}return false}return true})});dhtmlXGridObject.prototype._con_f_used=[];dhtmlXGridObject.prototype._in_header_connector_text_filter=function(c,a){if(!this._con_f_used[a]){this._con_f_used[a]=1}return this._in_header_text_filter(c,a)};dhtmlXGridObject.prototype._in_header_connector_select_filter=function(c,a){if(!this._con_f_used[a]){this._con_f_used[a]=2}return this._in_header_select_filter(c,a)};dhtmlXGridObject.prototype.load_connector=dhtmlXGridObject.prototype.load;dhtmlXGridObject.prototype.load=function(c,l,j){if(!this._colls_loaded&&this.cellType){var a=[];for(var g=0;g<this.cellType.length;g++){if(this.cellType[g].indexOf("co")==0||this.cellType[g].indexOf("clist")==0||this._con_f_used[g]==2){a.push(g)}}if(a.length){arguments[0]+=(arguments[0].indexOf("?")!=-1?"&":"?")+"connector=true&dhx_colls="+a.join(",")}}return this.load_connector.apply(this,arguments)};dhtmlXGridObject.prototype._parseHead_connector=dhtmlXGridObject.prototype._parseHead;dhtmlXGridObject.prototype._parseHead=function(c,x,s){this._parseHead_connector.apply(this,arguments);if(!this._colls_loaded){var u=dhx4.ajax.xpath("./coll_options",arguments[0]);for(var o=0;o<u.length;o++){var r=u[o].getAttribute("for");var w=[];var l=null;if(this.cellType[r]=="combo"){l=this.getColumnCombo(r)}else{if(this.cellType[r].indexOf("co")==0){l=this.getCombo(r)}}var n=dhx4.ajax.xpath("./item",u[o]);var a=[];for(var m=0;m<n.length;m++){var g=n[m].getAttribute("value");if(l){var q=n[m].getAttribute("label")||g;if(l.addOption){a.push([g,q])}else{l.put(g,q)}w[w.length]=q}else{w[w.length]=g}}if(a.length){if(l){l.addOption(a)}}else{if(w.length&&!l){if(this.registerCList){this.registerCList(r*1,w)}}}if(this._con_f_used[r*1]){this._con_f_used[r*1]=w}}this._colls_loaded=true}};function dhtmlXGridCellObject(a){this.destructor=function(){this.cell.obj=null;this.cell=null;this.grid=null;this.base=null;return null};this.cell=a;this.getValue=function(){if((this.cell.firstChild)&&(this.cell.firstChild.tagName=="TEXTAREA")){return this.cell.firstChild.value}else{return this.cell.innerHTML._dhx_trim()}};this.getMathValue=function(){if(this.cell.original){return this.cell.original}else{return this.getValue()}};this.getFont=function(){arOut=new Array(3);if(this.cell.style.fontFamily){arOut[0]=this.cell.style.fontFamily}if(this.cell.style.fontWeight=="bold"||this.cell.parentNode.style.fontWeight=="bold"){arOut[1]="bold"}if(this.cell.style.fontStyle=="italic"||this.cell.parentNode.style.fontWeight=="italic"){arOut[1]+="italic"}if(this.cell.style.fontSize){arOut[2]=this.cell.style.fontSize}else{arOut[2]=""}return arOut.join("-")};this.getTextColor=function(){if(this.cell.style.color){return this.cell.style.color}else{return"#000000"}};this.getBgColor=function(){if(this.cell.bgColor){return this.cell.bgColor}else{return"#FFFFFF"}};this.getHorAlign=function(){if(this.cell.style.textAlign){return this.cell.style.textAlign}else{if(this.cell.style.textAlign){return this.cell.style.textAlign}else{return"left"}}};this.getWidth=function(){return this.cell.scrollWidth};this.setFont=function(c){fntAr=c.split("-");this.cell.style.fontFamily=fntAr[0];this.cell.style.fontSize=fntAr[fntAr.length-1];if(fntAr.length==3){if(/bold/.test(fntAr[1])){this.cell.style.fontWeight="bold"}if(/italic/.test(fntAr[1])){this.cell.style.fontStyle="italic"}if(/underline/.test(fntAr[1])){this.cell.style.textDecoration="underline"}}};this.setTextColor=function(c){this.cell.style.color=c};this.setBgColor=function(c){if(c==""){c=null}this.cell.style.background=c};this.setHorAlign=function(c){if(c.length==1){if(c=="c"){this.cell.style.textAlign="center"}else{if(c=="l"){this.cell.style.textAlign="left"}else{this.cell.style.textAlign="right"}}}else{this.cell.style.textAlign=c}};this.wasChanged=function(){if(this.cell.wasChanged){return true}else{return false}};this.isCheckbox=function(){var c=this.cell.firstChild;if(c&&c.tagName=="INPUT"){type=c.type;if(type=="radio"||type=="checkbox"){return true}else{return false}}else{return false}};this.isChecked=function(){if(this.isCheckbox()){return this.cell.firstChild.checked}};this.isDisabled=function(){return this.cell._disabled};this.setChecked=function(c){if(this.isCheckbox()){if(c!="true"&&c!=1){c=false}this.cell.firstChild.checked=c}};this.setDisabled=function(c){if(c!="true"&&c!=1){c=false}if(this.isCheckbox()){this.cell.firstChild.disabled=c;if(this.disabledF){this.disabledF(c)}}this.cell._disabled=c}}dhtmlXGridCellObject.prototype={getAttribute:function(a){return this.cell._attrs[a]},setAttribute:function(a,c){this.cell._attrs[a]=c},getInput:function(){if(this.obj&&(this.obj.tagName=="INPUT"||this.obj.tagName=="TEXTAREA")){return this.obj}var a=(this.obj||this.cell).getElementsByTagName("TEXTAREA");if(!a.length){a=(this.obj||this.cell).getElementsByTagName("INPUT")}return a[0]}};dhtmlXGridCellObject.prototype.setValue=function(a){if((typeof(a)!="number")&&(!a||a.toString()._dhx_trim()=="")){a="&nbsp;";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCValue(a)};dhtmlXGridCellObject.prototype.getTitle=function(){return(_isIE?this.cell.innerText:this.cell.textContent)};dhtmlXGridCellObject.prototype.setCValue=function(c,a){this.cell.innerHTML=c;this.grid.callEvent("onCellChanged",[this.cell.parentNode.idd,this.cell._cellIndex,(arguments.length>1?a:c)])};dhtmlXGridCellObject.prototype.setCTxtValue=function(a){this.cell.innerHTML="";this.cell.appendChild(document.createTextNode(a));this.grid.callEvent("onCellChanged",[this.cell.parentNode.idd,this.cell._cellIndex,a])};dhtmlXGridCellObject.prototype.setLabel=function(a){this.cell.innerHTML=a};dhtmlXGridCellObject.prototype.getMath=function(){if(this._val){return this.val}else{return this.getValue()}};function eXcell(){this.obj=null;this.val=null;this.changeState=function(){return false};this.edit=function(){this.val=this.getValue()};this.detach=function(){return false};this.getPosition=function(j){var a=j;var g=0;var c=0;while(a.tagName!="BODY"){g+=a.offsetLeft;c+=a.offsetTop;a=a.offsetParent}return new Array(g,c)}}eXcell.prototype=new dhtmlXGridCellObject;function eXcell_ed(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){this.cell.atag=(!this.grid.multiLine)?"INPUT":"TEXTAREA";this.val=this.getValue();this.obj=document.createElement(this.cell.atag);this.obj.setAttribute("autocomplete","off");this.obj.style.height=(this.cell.offsetHeight-(_isIE?4:4))+"px";this.obj.className="dhx_combo_edit";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.style.textAlign;this.obj.onclick=function(c){(c||event).cancelBubble=true};this.obj.onmousedown=function(c){(c||event).cancelBubble=true};this.obj.value=this.val;this.cell.innerHTML="";this.cell.appendChild(this.obj);this.obj.onselectstart=function(c){if(!c){c=event}c.cancelBubble=true;return true};if(_isIE){this.obj.focus();this.obj.blur()}this.obj.focus()};this.getValue=function(){if((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName==this.cell.atag))){return this.cell.firstChild.value}if(this.cell._clearCell){return""}return this.cell.innerHTML.toString()._dhx_trim()};this.detach=function(){this.setValue(this.obj.value);return this.val!=this.getValue()}}eXcell_ed.prototype=new eXcell;function eXcell_edtxt(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.getValue=function(){if((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName==this.cell.atag))){return this.cell.firstChild.value}if(this.cell._clearCell){return""}return(_isIE?this.cell.innerText:this.cell.textContent)};this.setValue=function(c){if(!c||c.toString()._dhx_trim()==""){c=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCTxtValue(c)}}eXcell_edtxt.prototype=new eXcell_ed;function eXcell_edn(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.getValue=function(){if((this.cell.firstChild)&&(this.cell.firstChild.tagName=="TEXTAREA")){return this.cell.firstChild.value}if(this.cell._clearCell){return""}return this.cell._orig_value||this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(),this.cell._cellIndex)};this.detach=function(){var c=this.obj.value;this.setValue(c);return this.val!=this.getValue()}}eXcell_edn.prototype=new eXcell_ed;eXcell_edn.prototype.setValue=function(a){if(!a||a.toString()._dhx_trim()==""){this.cell._clearCell=true;return this.setCValue("&nbsp;",0)}else{this.cell._clearCell=false;this.cell._orig_value=a}this.setCValue(this.grid._aplNF(a,this.cell._cellIndex),a)};function eXcell_ch(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.disabledF=function(c){if((c==true)||(c==1)){this.cell.innerHTML=this.cell.innerHTML.replace("item_chk0.","item_chk0_dis.").replace("item_chk1.","item_chk1_dis.")}else{this.cell.innerHTML=this.cell.innerHTML.replace("item_chk0_dis.","item_chk0.").replace("item_chk1_dis.","item_chk1.")}};this.changeState=function(c){if(c===true&&!this.grid.isActive){if(window.globalActiveDHTMLGridObject!=null&&window.globalActiveDHTMLGridObject!=this.grid&&window.globalActiveDHTMLGridObject.isActive){window.globalActiveDHTMLGridObject.setActive(false)}this.grid.setActive(true)}if((!this.grid.isEditable)||(this.cell.parentNode._locked)||(this.isDisabled())){return}if(this.grid.callEvent("onEditCell",[0,this.cell.parentNode.idd,this.cell._cellIndex])){this.val=this.getValue();if(this.val=="1"){this.setValue("0")}else{this.setValue("1")}this.cell.wasChanged=true;this.grid.callEvent("onEditCell",[1,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid.callEvent("onCheckbox",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")]);this.grid.callEvent("onCheck",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")])}else{this.editor=null}};this.getValue=function(){return this.cell.chstate?this.cell.chstate.toString():"0"};this.isCheckbox=function(){return true};this.isChecked=function(){if(this.getValue()=="1"){return true}else{return false}};this.setChecked=function(c){this.setValue(c.toString())};this.detach=function(){return this.val!=this.getValue()};this.edit=null}eXcell_ch.prototype=new eXcell;eXcell_ch.prototype.setValue=function(c){this.cell.style.verticalAlign="middle";if(c){c=c.toString()._dhx_trim();if((c=="false")||(c=="0")){c=""}}if(c){c="1";this.cell.chstate="1"}else{c="0";this.cell.chstate="0"}var a=this;this.setCValue("<img src='"+this.grid.imgURL+"item_chk"+c+".gif' onclick='new eXcell_ch(this.parentNode).changeState(true); (arguments[0]||event).cancelBubble=true; '>",this.cell.chstate)};function eXcell_ra(a){this.base=eXcell_ch;this.base(a);this.grid=a.parentNode.grid;this.disabledF=function(c){if((c==true)||(c==1)){this.cell.innerHTML=this.cell.innerHTML.replace("radio_chk0.","radio_chk0_dis.").replace("radio_chk1.","radio_chk1_dis.")}else{this.cell.innerHTML=this.cell.innerHTML.replace("radio_chk0_dis.","radio_chk0.").replace("radio_chk1_dis.","radio_chk1.")}};this.changeState=function(c){if(c===false&&this.getValue()==1){return}if((!this.grid.isEditable)||(this.cell.parentNode._locked)||(this.isDisabled())){return}if(this.grid.callEvent("onEditCell",[0,this.cell.parentNode.idd,this.cell._cellIndex])!=false){this.val=this.getValue();if(this.val=="1"){this.setValue("0")}else{this.setValue("1")}this.cell.wasChanged=true;this.grid.callEvent("onEditCell",[1,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid.callEvent("onCheckbox",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")]);this.grid.callEvent("onCheck",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")])}else{this.editor=null}};this.edit=null}eXcell_ra.prototype=new eXcell_ch;eXcell_ra.prototype.setValue=function(c){this.cell.style.verticalAlign="middle";if(c){c=c.toString()._dhx_trim();if((c=="false")||(c=="0")){c=""}}if(c){if(!this.grid._RaSeCol){this.grid._RaSeCol=[]}if(this.grid._RaSeCol[this.cell._cellIndex]){var a=this.grid.cells4(this.grid._RaSeCol[this.cell._cellIndex]);a.setValue("0");if(this.grid.rowsAr[a.cell.parentNode.idd]){this.grid.callEvent("onEditCell",[1,a.cell.parentNode.idd,a.cell._cellIndex])}}this.grid._RaSeCol[this.cell._cellIndex]=this.cell;c="1";this.cell.chstate="1"}else{c="0";this.cell.chstate="0"}this.setCValue("<img src='"+this.grid.imgURL+"radio_chk"+c+".gif' onclick='new eXcell_ra(this.parentNode).changeState(false);'>",this.cell.chstate)};function eXcell_txt(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){this.val=this.getValue();this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_textarea";this.obj.onclick=function(j){(j||event).cancelBubble=true};var c=this.grid.getPosition(this.cell);this.obj.value=this.val;this.obj.style.display="";this.obj.style.textAlign=this.cell.style.textAlign;document.body.appendChild(this.obj);if(_isOpera){this.obj.onkeypress=function(j){if(j.keyCode==9){return false}}}this.obj.onkeydown=function(l){var j=(l||event);if(j.keyCode==9){globalActiveDHTMLGridObject.entBox.focus();globalActiveDHTMLGridObject.doKey({keyCode:j.keyCode,shiftKey:j.shiftKey,srcElement:"0"});return false}};this.obj.style.left=c[0]+"px";this.obj.style.top=c[1]+this.cell.offsetHeight+"px";if(this.cell.offsetWidth<200){var g=200}else{var g=this.cell.offsetWidth}this.obj.style.width=g+16+"px";if(_isIE){this.obj.select();this.obj.value=this.obj.value}this.obj.focus()};this.detach=function(){var c="";c=this.obj.value;if(c==""){this.cell._clearCell=true}else{this.cell._clearCell=false}this.setValue(c);document.body.removeChild(this.obj);this.obj=null;return this.val!=this.getValue()};this.getValue=function(){if(this.obj){return this.obj.value}if(this.cell._clearCell){return""}if(typeof this.cell._brval!="undefined"){return this.cell._brval}if((!this.grid.multiLine)){return this.cell._brval||this.cell.innerHTML}else{return this.cell._brval||this.cell.innerHTML.replace(/<br[^>]*>/gi,"\n")._dhx_trim()}}}eXcell_txt.prototype=new eXcell;function eXcell_txttxt(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.getValue=function(){if((this.cell.firstChild)&&(this.cell.firstChild.tagName=="TEXTAREA")){return this.cell.firstChild.value}if(this.cell._clearCell){return""}if((!this.grid.multiLine)&&this.cell._brval){return this.cell._brval}return(_isIE?this.cell.innerText:this.cell.textContent)};this.setValue=function(c){this.cell._brval=c;if(!c||c.toString()._dhx_trim()==""){c=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCTxtValue(c)}}eXcell_txttxt.prototype=new eXcell_txt;eXcell_txt.prototype.setValue=function(a){this.cell._brval=a;if(!a||a.toString()._dhx_trim()==""){a="&nbsp;";this.cell._clearCell=true}else{this.cell._clearCell=false}if((!this.grid.multiLine)||this.cell._clearCell){this.setCValue(a,this.cell._brval)}else{this.setCValue(a.replace(/\n/g,"<br/>"),a)}};function eXcell_co(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.combo=(this.cell._combo||this.grid.getCombo(this.cell._cellIndex));this.editable=true}this.shiftNext=function(){var c=this.list.options[this.list.selectedIndex+1];if(c){c.selected=true}this.obj.value=this.list.options[this.list.selectedIndex].text;return true};this.shiftPrev=function(){if(this.list.selectedIndex!=0){var c=this.list.options[this.list.selectedIndex-1];if(c){c.selected=true}this.obj.value=this.list.options[this.list.selectedIndex].text}return true};this.edit=function(){this.val=this.getValue();this.text=this.getText()._dhx_trim();var j=this.grid.getPosition(this.cell);this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_combo_edit";this.obj.style.height=(this.cell.offsetHeight-(_isIE?4:4))+"px";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.style.textAlign;this.obj.onclick=function(q){(q||event).cancelBubble=true};this.obj.onmousedown=function(q){(q||event).cancelBubble=true};this.obj.value=this.text;this.obj.onselectstart=function(q){if(!q){q=event}q.cancelBubble=true;return true};var m=this;this.obj.onkeyup=function(s){var r=(s||event).keyCode;if(r==38||r==40||r==9){return}var u=this.readonly?String.fromCharCode(r):this.value;var v=m.list.options;for(var q=0;q<v.length;q++){if(v[q].text.indexOf(u)==0){return v[q].selected=true}}};this.list=document.createElement("SELECT");this.list.className="dhx_combo_select";this.list.style.width=this.cell.offsetWidth+"px";this.list.style.left=j[0]+"px";this.list.style.top=j[1]+this.cell.offsetHeight+"px";this.list.onclick=function(s){var r=s||window.event;var q=r.target||r.srcElement;if(q.tagName=="OPTION"){q=q.parentNode}m.editable=false;m.grid.editStop();r.cancelBubble=true};var c=this.combo.getKeys();var l=false;var o=0;for(var g=0;g<c.length;g++){var n=this.combo.get(c[g]);this.list.options[this.list.options.length]=new Option(n,c[g]);if(c[g]==this.val){o=this.list.options.length-1;l=true}}if(l==false){this.list.options[this.list.options.length]=new Option(this.text,this.val===null?"":this.val);o=this.list.options.length-1}document.body.appendChild(this.list);this.list.size="6";this.cstate=1;if(this.editable){this.cell.innerHTML=""}else{this.obj.style.width="1px";this.obj.style.height="1px"}this.cell.appendChild(this.obj);this.list.options[o].selected=true;if(this.editable){this.obj.focus();this.obj.focus()}if(!this.editable){this.obj.style.visibility="hidden";this.list.focus();this.list.onkeydown=function(q){q=q||window.event;m.grid.setActive(true);if(q.keyCode<30){return m.grid.doKey({target:m.cell,keyCode:q.keyCode,shiftKey:q.shiftKey,ctrlKey:q.ctrlKey})}}}};this.getValue=function(){return((this.cell.combo_value==window.undefined)?"":this.cell.combo_value)};this.detach=function(){if(this.val!=this.getValue()){this.cell.wasChanged=true}if(this.list.parentNode!=null){if(this.editable){var c=this.list.options[this.list.selectedIndex];if(c&&c.text==this.obj.value){this.setValue(this.list.value)}else{var g=(this.cell._combo||this.grid.getCombo(this.cell._cellIndex));var j=g.values._dhx_find(this.obj.value);if(j!=-1){this.setValue(g.keys[j])}else{this.setValue(this.cell.combo_value=this.obj.value)}}}else{this.setValue(this.list.value)}}if(this.list.parentNode){this.list.parentNode.removeChild(this.list)}if(this.obj.parentNode){this.obj.parentNode.removeChild(this.obj)}return this.val!=this.getValue()}}eXcell_co.prototype=new eXcell;eXcell_co.prototype.getText=function(){return this.cell.innerHTML};eXcell_co.prototype.setValue=function(l){if(typeof(l)=="object"){var g=dhx4.ajax.xpath("./option",l);if(g.length){this.cell._combo=new dhtmlXGridComboObject()}for(var c=0;c<g.length;c++){this.cell._combo.put(g[c].getAttribute("value"),g[c].firstChild?g[c].firstChild.data:"")}l=l.firstChild.data}if((l||"").toString()._dhx_trim()==""){l=null}this.cell.combo_value=l;if(l!==null){var a=(this.cell._combo||this.grid.getCombo(this.cell._cellIndex)).get(l);this.setCValue(a===null?l:a,l)}else{this.setCValue("&nbsp;",l)}};function eXcell_coro(a){this.base=eXcell_co;this.base(a);this.editable=false}eXcell_coro.prototype=new eXcell_co;function eXcell_cotxt(a){this.base=eXcell_co;this.base(a)}eXcell_cotxt.prototype=new eXcell_co;eXcell_cotxt.prototype.getText=function(){return(_isIE?this.cell.innerText:this.cell.textContent)};eXcell_cotxt.prototype.setValue=function(g){if(typeof(g)=="object"){var c=dhx4.ajax.xpath("./option",g);if(c.length){this.cell._combo=new dhtmlXGridComboObject()}for(var a=0;a<c.length;a++){this.cell._combo.put(c[a].getAttribute("value"),c[a].firstChild?c[a].firstChild.data:"")}g=g.firstChild.data}if((g||"").toString()._dhx_trim()==""){g=null}if(g!==null){this.setCTxtValue((this.cell._combo||this.grid.getCombo(this.cell._cellIndex)).get(g)||g,g)}else{this.setCTxtValue(" ",g)}this.cell.combo_value=g};function eXcell_corotxt(a){this.base=eXcell_co;this.base(a);this.editable=false}eXcell_corotxt.prototype=new eXcell_cotxt;function eXcell_cp(a){try{this.cell=a;this.grid=this.cell.parentNode.grid}catch(c){}this.edit=function(){this.val=this.getValue();this.obj=document.createElement("SPAN");this.obj.style.border="1px solid black";this.obj.style.position="absolute";var g=this.grid.getPosition(this.cell);this.colorPanel(4,this.obj);document.body.appendChild(this.obj);this.obj.style.left=g[0]+"px";this.obj.style.zIndex=1000;this.obj.style.top=g[1]+this.cell.offsetHeight+"px"};this.toolDNum=function(g){if(g.length==1){g="0"+g}return g};this.colorPanel=function(u,x){var q=document.createElement("TABLE");x.appendChild(q);q.cellSpacing=0;q.editor_obj=this;q.style.cursor="default";q.onclick=function(y){var r=y||window.event;var j=r.target||r.srcElement;var n=j.parentNode.parentNode.parentNode.editor_obj;n.setValue(j._bg);n.grid.editStop()};var m=256/u;for(var o=0;o<=(256/m);o++){var g=q.insertRow(o);for(var s=0;s<=(256/m);s++){for(var l=0;l<=(256/m);l++){R=new Number(m*o)-(o==0?0:1);G=new Number(m*s)-(s==0?0:1);B=new Number(m*l)-(l==0?0:1);var w=this.toolDNum(R.toString(16))+""+this.toolDNum(G.toString(16))+""+this.toolDNum(B.toString(16));var v=g.insertCell(s);v.width="10px";v.innerHTML="&nbsp;";v.title=w.toUpperCase();v.style.backgroundColor="#"+w;v._bg="#"+w;if(this.val!=null&&"#"+w.toUpperCase()==this.val.toUpperCase()){v.style.border="2px solid white"}}}}};this.getValue=function(){return this.cell.firstChild._bg||""};this.getRed=function(){return Number(parseInt(this.getValue().substr(1,2),16))};this.getGreen=function(){return Number(parseInt(this.getValue().substr(3,2),16))};this.getBlue=function(){return Number(parseInt(this.getValue().substr(5,2),16))};this.detach=function(){if(this.obj.offsetParent!=null){document.body.removeChild(this.obj)}return this.val!=this.getValue()}}eXcell_cp.prototype=new eXcell;eXcell_cp.prototype.setValue=function(a){this.setCValue("<div style='width:100%;height:"+((this.grid.multiLine?"100%":23))+";background-color:"+(a||"")+";border:0px;'>&nbsp;</div>",a);this.cell.firstChild._bg=a};function eXcell_img(a){try{this.cell=a;this.grid=this.cell.parentNode.grid}catch(c){}this.getValue=function(){if(this.cell.firstChild.tagName=="IMG"){return this.cell.firstChild.src+(this.cell.titFl!=null?"^"+this.cell._brval:"")}else{if(this.cell.firstChild.tagName=="A"){var g=this.cell.firstChild.firstChild.src+(this.cell.titFl!=null?"^"+this.cell._brval:"");g+="^"+this.cell.lnk;if(this.cell.trg){g+="^"+this.cell.trg}return g}}};this.isDisabled=function(){return true}}eXcell_img.prototype=new eXcell;eXcell_img.prototype.getTitle=function(){return this.cell._brval};eXcell_img.prototype.setValue=function(g){var c=g;if((g||"").indexOf("^")!=-1){var a=g.split("^");g=a[0];c=this.cell._attrs.title||a[1];if(a.length>2){this.cell.lnk=a[2];if(a[3]){this.cell.trg=a[3]}}this.cell.titFl="1"}this.setCValue("<img src='"+this.grid.iconURL+(g||"")._dhx_trim()+"' border='0'>",g);if(this.cell.lnk){this.cell.innerHTML="<a href='"+this.cell.lnk+"' target='"+this.cell.trg+"'>"+this.cell.innerHTML+"</a>"}this.cell._brval=c};function eXcell_price(a){this.base=eXcell_ed;this.base(a);this.getValue=function(){if(this.cell.childNodes.length>1){return this.cell.childNodes[1].innerHTML.toString()._dhx_trim()}else{return"0"}}}eXcell_price.prototype=new eXcell_ed;eXcell_price.prototype.setValue=function(c){if(isNaN(parseFloat(c))){c=this.val||0}var a="green";if(c<0){a="red"}this.setCValue("<span>$</span><span style='padding-right:2px;color:"+a+";'>"+c+"</span>",c)};function eXcell_dyn(a){this.base=eXcell_ed;this.base(a);this.getValue=function(){return this.cell.firstChild.childNodes[1].innerHTML.toString()._dhx_trim()}}eXcell_dyn.prototype=new eXcell_ed;eXcell_dyn.prototype.setValue=function(g){if(!g||isNaN(Number(g))){if(g!==""){g=0}}if(g>0){var c="green";var a="dyn_up.gif"}else{if(g==0){var c="black";var a="dyn_.gif"}else{var c="red";var a="dyn_down.gif"}}this.setCValue("<div style='position:relative;padding-right:2px; width:100%;overflow:hidden; white-space:nowrap;'><img src='"+this.grid.imgURL+""+a+"' height='15' style='position:absolute;top:0px;left:0px;'><span style=' padding-left:20px; width:100%;color:"+c+";'>"+g+"</span></div>",g)};function eXcell_ro(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){};this.isDisabled=function(){return true};this.getValue=function(){return this.cell._clearCell?"":this.cell.innerHTML.toString()._dhx_trim()}}eXcell_ro.prototype=new eXcell;window.eXcell_hidden=function(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){};this.isDisabled=function(){return true};this.getValue=function(){return this.cell.val}};eXcell_hidden.prototype=new eXcell;eXcell_hidden.prototype.setValue=function(a){this.cell.val=a};function eXcell_ron(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.edit=function(){};this.isDisabled=function(){return true};this.getValue=function(){return this.cell._clearCell?"":this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(),this.cell._cellIndex).toString()}}eXcell_ron.prototype=new eXcell;eXcell_ron.prototype.setValue=function(a){if(a===0){}else{if(!a||a.toString()._dhx_trim()==""){this.setCValue("&nbsp;");return this.cell._clearCell=true}}this.cell._clearCell=false;this.setCValue(a?this.grid._aplNF(a,this.cell._cellIndex):"0")};function eXcell_rotxt(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.edit=function(){};this.isDisabled=function(){return true};this.setValue=function(c){if(!c){c=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCTxtValue(c)};this.getValue=function(){if(this.cell._clearCell){return""}return(_isIE?this.cell.innerText:this.cell.textContent)}}eXcell_rotxt.prototype=new eXcell;function dhtmlXGridComboObject(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();this.put=function(c,g){for(var a=0;a<this.keys.length;a++){if(this.keys[a]==c){this.values[a]=g;return true}}this.values[this.values.length]=g;this.keys[this.keys.length]=c};this.get=function(c){for(var a=0;a<this.keys.length;a++){if(this.keys[a]==c){return this.values[a]}}return null};this.clear=function(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray()};this.remove=function(c){for(var a=0;a<this.keys.length;a++){if(this.keys[a]==c){this.keys._dhx_removeAt(a);this.values._dhx_removeAt(a);return true}}};this.size=function(){var a=0;for(var c=0;c<this.keys.length;c++){if(this.keys[c]!=null){a++}}return a};this.getKeys=function(){var a=new Array(0);for(var c=0;c<this.keys.length;c++){if(this.keys[c]!=null){a[a.length]=this.keys[c]}}return a};this.save=function(){this._save=new Array();for(var a=0;a<this.keys.length;a++){this._save[a]=[this.keys[a],this.values[a]]}};this.restore=function(){if(this._save){this.keys[a]=new Array();this.values[a]=new Array();for(var a=0;a<this._save.length;a++){this.keys[a]=this._save[a][0];this.values[a]=this._save[a][1]}}};return this}function Hashtable(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();return this}Hashtable.prototype=new dhtmlXGridComboObject;if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachGrid=function(){this.callEvent("_onBeforeContentAttach",["grid"]);var a=document.createElement("DIV");a.style.width="100%";a.style.height="100%";a.style.position="relative";a.style.overflow="hidden";this._attachObject(a);this.dataType="grid";this.dataObj=new dhtmlXGridObject(a);this.dataObj.setSkin(this.conf.skin);if(this.conf.skin=="dhx_skyblue"&&typeof(window.dhtmlXWindowsCell)!="undefined"&&this instanceof window.dhtmlXWindowsCell){this.dataObj.entBox.style.border="1px solid #a4bed4";this.dataObj._sizeFix=0}else{this.dataObj.entBox.style.border="0px solid white";this.dataObj._sizeFix=2}a=null;this.callEvent("_onContentAttach",[]);return this.dataObj}}dhtmlXGridObject.prototype.enableDragAndDrop=function(a){if(a=="temporary_disabled"){this.dADTempOff=false;a=true}else{this.dADTempOff=true}this.dragAndDropOff=dhx4.s2b(a);this._drag_validate=true;if(a){this.objBox.ondragstart=function(c){(c||event).cancelBubble=true;return false}}};dhtmlXGridObject.prototype.setDragBehavior=function(a){this.dadmodec=this.dadmodefix=0;switch(a){case"child":this.dadmode=0;this._sbmod=false;break;case"sibling":this.dadmode=1;this._sbmod=false;break;case"sibling-next":this.dadmode=1;this._sbmod=true;break;case"complex":this.dadmode=2;this._sbmod=false;break;case"complex-next":this.dadmode=2;this._sbmod=true;break}};dhtmlXGridObject.prototype.enableDragOrder=function(a){this._dndorder=dhx4.s2b(a)};dhtmlXGridObject.prototype._checkParent=function(j,c){var g=this._h2.get[j.idd].parent;if(!g.parent){return}for(var a=0;a<c.length;a++){if(c[a]==g.id){return true}}return this._checkParent(this.rowsAr[g.id],c)};dhtmlXGridObject.prototype._createDragNode=function(g,j){this.editStop();if(window.dhtmlDragAndDrop.dragNode){return null}if(!this.dADTempOff){return null}g.parentObject=new Object();g.parentObject.treeNod=this;var o=this.callEvent("onBeforeDrag",[g.parentNode.idd,g._cellIndex,j]);if(!o){return null}var l=new Array();l=this.getSelectedId();l=(((l)&&(l!=""))?l.split(this.delim):[]);var m=false;for(var c=0;c<l.length;c++){if(l[c]==g.parentNode.idd){m=true}}if(!m){this.selectRow(this.rowsAr[g.parentNode.idd],false,j.ctrlKey,false);if(!j.ctrlKey){l=[]}l[this.selMultiRows?l.length:0]=g.parentNode.idd}if(this.isTreeGrid()){for(var c=l.length-1;c>=0;c--){if(this._checkParent(this.rowsAr[l[c]],l)){l.splice(c,1)}}}var q=this;if(l.length&&this._dndorder){l.sort(function(s,r){return(q.rowsAr[s].rowIndex>q.rowsAr[r].rowIndex?1:-1)})}var a=this.getFirstParentOfType(_isIE?j.srcElement:j.target,"TD");if(a){this._dndExtra=a._cellIndex}this._dragged=new Array();for(var c=0;c<l.length;c++){if(this.rowsAr[l[c]]){this._dragged[this._dragged.length]=this.rowsAr[l[c]];this.rowsAr[l[c]].treeNod=this}}g.parentObject.parentNode=g.parentNode;var n=document.createElement("div");n.innerHTML=(o!==true?o:this.rowToDragElement(g.parentNode.idd));n.style.position="absolute";n.className="dragSpanDiv";return n};dhtmlXGridObject.prototype._createSdrgc=function(){this._sdrgc=document.createElement("DIV");this._sdrgc.innerHTML="&nbsp;";this._sdrgc.className="gridDragLine";this.objBox.appendChild(this._sdrgc)};function dragContext(w,v,u,s,r,q,n,o,m,g){this.source=w||"grid";this.target=v||"grid";this.mode=u||"move";this.dropmode=s||"child";this.sid=r||0;this.tid=q;this.sobj=n||null;this.tobj=o||null;this.sExtra=m||null;this.tExtra=g||null;return this}dragContext.prototype.valid=function(){if(this.sobj!=this.tobj){return true}if(this.sid==this.tid){return false}if(this.target=="treeGrid"){var a=this.tid;while(a=this.tobj.getParentId(a)){if(this.sid==a){return false}}}return true};dragContext.prototype.close=function(){this.sobj=null;this.tobj=null};dragContext.prototype.copy=function(){return new dragContext(this.source,this.target,this.mode,this.dropmode,this.sid,this.tid,this.sobj,this.tobj,this.sExtra,this.tExtra)};dragContext.prototype.set=function(g,c){this[g]=c;return this};dragContext.prototype.uid=function(g,c){this.nid=this.sid;while(this.tobj.rowsAr[this.nid]){this.nid=this.nid+((new Date()).valueOf())}return this};dragContext.prototype.data=function(){if(this.sobj==this.tobj){return this.sobj._getRowArray(this.sobj.rowsAr[this.sid])}if(this.source=="tree"){return this.tobj.treeToGridElement(this.sobj,this.sid,this.tid)}else{return this.tobj.gridToGrid(this.sid,this.sobj,this.tobj)}};dragContext.prototype.attrs=function(){if(this.source=="tree"){return{}}else{return this.sobj.rowsAr[this.sid]._attrs}};dragContext.prototype.childs=function(){if(this.source=="treeGrid"){return this.sobj._h2.get[this.sid]._xml_await?this.sobj._h2.get[this.sid].has_kids:null}return null};dragContext.prototype.pid=function(){if(!this.tid){return 0}if(!this.tobj._h2){return 0}if(this.target=="treeGrid"){if(this.dropmode=="child"){return this.tid}else{var c=this.tobj.rowsAr[this.tid];var a=this.tobj._h2.get[c.idd].parent.id;if((this.alfa)&&(this.tobj._sbmod)&&(c.nextSibling)){var g=this.tobj._h2.get[c.nextSibling.idd].parent.id;if(g==this.tid){return this.tid}if(g!=a){return g}}return a}}};dragContext.prototype.ind=function(){if(this.tid==window.unknown){return this.tobj.rowsBuffer.length}if(this.target=="treeGrid"){if(this.dropmode=="child"){this.tobj.openItem(this.tid)}else{this.tobj.openItem(this.tobj.getParentId(this.tid))}}var a=this.tobj.rowsBuffer._dhx_find(this.tobj.rowsAr[this.tid]);if((this.alfa)&&(this.tobj._sbmod)&&(this.dropmode=="sibling")){var c=this.tobj.rowsAr[this.tid];if((c.nextSibling)&&(this._h2.get[c.nextSibling.idd].parent.id==this.tid)){return a+1}}return(a+1+((this.target=="treeGrid"&&a>=0&&this.tobj._h2.get[this.tobj.rowsBuffer[a].idd].state=="minus")?this.tobj._getOpenLenght(this.tobj.rowsBuffer[a].idd,0):0))};dragContext.prototype.img=function(){if((this.target!="grid")&&(this.sobj._h2)){return this.sobj.getItemImage(this.sid)}else{return null}};dragContext.prototype.slist=function(){var c=new Array();for(var a=0;a<this.sid.length;a++){c[c.length]=this.sid[a][(this.source=="tree")?"id":"idd"]}return c.join(",")};dhtmlXGridObject.prototype._drag=function(s,l,r,u){if(this._realfake){return this._fake._drag()}var q=(this.lastLanding);if(this._autoOpenTimer){window.clearTimeout(this._autoOpenTimer)}var j=r.parentNode;var g=s.parentObject;if(!j.idd){j.grid=this;this.dadmodefix=0}var o=new dragContext(0,0,0,((j.grid.dadmode==1||j.grid.dadmodec)?"sibling":"child"));if(g&&g.childNodes){o.set("source","tree").set("sobj",g.treeNod).set("sid",o.sobj._dragged)}else{if(!g){return true}if(g.treeNod.isTreeGrid&&g.treeNod.isTreeGrid()){o.set("source","treeGrid")}o.set("sobj",g.treeNod).set("sid",o.sobj._dragged)}if(j.grid.isTreeGrid()){o.set("target","treeGrid")}else{o.set("dropmode","sibling")}o.set("tobj",j.grid).set("tid",j.idd);if(((o.tobj.dadmode==2)&&(o.tobj.dadmodec==1))&&(o.tobj.dadmodefix<0)){if(o.tobj.obj.rows[1].idd!=o.tid){o.tid=j.previousSibling.idd}else{o.tid=0}}var a=this.getFirstParentOfType(u,"TD");if(a){o.set("tExtra",a._cellIndex)}if(a){o.set("sExtra",o.sobj._dndExtra)}if(o.sobj.dpcpy){o.set("mode","copy")}if(o.tobj._realfake){o.tobj=o.tobj._fake}if(o.sobj._realfake){o.sobj=o.sobj._fake}o.tobj._clearMove();if(g&&g.treeNod&&g.treeNod._nonTrivialRow){g.treeNod._nonTrivialRow(this,o.tid,o.dropmode,g)}else{o.tobj.dragContext=o;if(!o.tobj.callEvent("onDrag",[o.slist(),o.tid,o.sobj,o.tobj,o.sExtra,o.tExtra])){return o.tobj.dragContext=null}var v=new Array();if(typeof(o.sid)=="object"){var n=o.copy();for(var m=0;m<o.sid.length;m++){if(!n.set("alfa",(!m)).set("sid",o.sid[m][(o.source=="tree"?"id":"idd")]).valid()){continue}n.tobj._dragRoutine(n);if(n.target=="treeGrid"&&n.dropmode=="child"){n.tobj.openItem(n.tid)}v[v.length]=n.nid;n.set("dropmode","sibling").set("tid",n.nid)}n.close()}else{o.tobj._dragRoutine(o)}if(o.tobj.laterLink){o.tobj.laterLink()}o.tobj.callEvent("onDrop",[o.slist(),o.tid,v.join(","),o.sobj,o.tobj,o.sExtra,o.tExtra])}o.tobj.dragContext=null;o.close()};dhtmlXGridObject.prototype._dragRoutine=function(u){if((u.sobj==u.tobj)&&(u.source=="grid")&&(u.mode=="move")&&!this._fake){if(u.sobj._dndProblematic){return}var r=u.sobj.rowsAr[u.sid];var s=u.sobj.rowsCol._dhx_find(r);u.sobj.rowsCol._dhx_removeAt(u.sobj.rowsCol._dhx_find(r));u.sobj.rowsBuffer._dhx_removeAt(u.sobj.rowsBuffer._dhx_find(r));u.sobj.rowsBuffer._dhx_insertAt(u.ind(),r);if(u.tobj._fake){u.tobj._fake.rowsCol._dhx_removeAt(s);var v=u.tobj._fake.rowsAr[u.sid];v.parentNode.removeChild(v)}u.sobj._insertRowAt(r,u.ind());u.nid=u.sid;u.sobj.callEvent("onGridReconstructed",[]);return}var q;if(this._h2&&typeof u.tid!="undefined"&&u.dropmode=="sibling"&&(this._sbmod||u.tid)){if(u.alfa&&this._sbmod&&this._h2.get[u.tid].childs.length){this.openItem(u.tid);q=u.uid().tobj.addRowBefore(u.nid,u.data(),this._h2.get[u.tid].childs[0].id,u.img(),u.childs())}else{q=u.uid().tobj.addRowAfter(u.nid,u.data(),u.tid,u.img(),u.childs())}}else{q=u.uid().tobj.addRow(u.nid,u.data(),u.ind(),u.pid(),u.img(),u.childs())}q._attrs=u.attrs();if(u.source=="tree"){this.callEvent("onRowAdded",[u.nid]);var a=u.sobj._globalIdStorageFind(u.sid);if(a.childsCount){var o=u.copy().set("tid",u.nid).set("dropmode",u.target=="grid"?"sibling":"child");for(var m=0;m<a.childsCount;m++){u.tobj._dragRoutine(o.set("sid",a.childNodes[m].id));if(u.mode=="move"){m--}}o.close()}}else{u.tobj._copyUserData(u);this.callEvent("onRowAdded",[u.nid]);if((u.source=="treeGrid")){if(u.sobj==u.tobj){q._xml=u.sobj.rowsAr[u.sid]._xml}var n=u.sobj._h2.get[u.sid];if((n)&&(n.childs.length)){var o=u.copy().set("tid",u.nid);if(u.target=="grid"){o.set("dropmode","sibling")}else{if(!o.tobj.kidsXmlFile){o.tobj.openItem(u.tid)}o.set("dropmode","child")}var g=n.childs.length;if(!o.tobj.kidsXmlFile){for(var m=0;m<g;m++){u.sobj.render_row_tree(null,n.childs[m].id);u.tobj._dragRoutine(o.set("sid",n.childs[m].id));if(g!=n.childs.length){m--;g=n.childs.length}}}o.close()}}}if(u.mode=="move"){u.sobj[(u.source=="tree")?"deleteItem":"deleteRow"](u.sid);if((u.sobj==u.tobj)&&(!u.tobj.rowsAr[u.sid])){u.tobj.changeRowId(u.nid,u.sid);u.nid=u.sid}}};dhtmlXGridObject.prototype.gridToGrid=function(j,a,g){var l=new Array();for(var c=0;c<a.hdr.rows[0].cells.length;c++){l[c]=a.cells(j,c).getValue()}return l};dhtmlXGridObject.prototype.checkParentLine=function(a,c){if((!this._h2)||(!c)||(!a)){return false}if(a.id==c){return true}else{return this.checkParentLine(a.parent,c)}};dhtmlXGridObject.prototype._dragIn=function(m,j,c,n){if(!this.dADTempOff){return 0}var a=this.isTreeGrid();var l=j.parentNode.idd?j.parentNode:j.parentObject;if(this._drag_validate){if(m.parentNode==j.parentNode){return 0}if((a)&&(this==l.grid)&&((this.checkParentLine(this._h2.get[m.parentNode.idd],j.parentNode.idd)))){return 0}}if(!this.callEvent("onDragIn",[l.idd||l.id,m.parentNode.idd,l.grid||l.treeNod,(m.grid||m.parentNode.grid)])){return this._setMove(m,c,n,true)}this._setMove(m,c,n);if((a)&&(m.parentNode.expand!="")){var g=this;this._autoOpenTimer=window.setTimeout(function(){g._autoOpenItem(null,g);g=null},1000);this._autoOpenId=m.parentNode.idd}else{if(this._autoOpenTimer){window.clearTimeout(this._autoOpenTimer)}}return m};dhtmlXGridObject.prototype._autoOpenItem=function(a,c){c.openItem(c._autoOpenId)};dhtmlXGridObject.prototype._dragOut=function(c){this._clearMove();var a=c.parentNode.parentObject?c.parentObject.id:c.parentNode.idd;this.callEvent("onDragOut",[a]);if(this._autoOpenTimer){window.clearTimeout(this._autoOpenTimer)}};dhtmlXGridObject.prototype._setMove=function(m,c,o,l){if(!m.parentNode.idd){return}var g=dhx4.absTop(m);var a=dhx4.absTop(this.objBox);if((g-a)>(parseInt(this.objBox.offsetHeight)-50)){this.objBox.scrollTop=parseInt(this.objBox.scrollTop)+20}if((g-a+parseInt(this.objBox.scrollTop))<(parseInt(this.objBox.scrollTop)+30)){this.objBox.scrollTop=parseInt(this.objBox.scrollTop)-20}if(l){return 0}if(this.dadmode==2){var n=o-g+(document.body.scrollTop||document.documentElement.scrollTop)-2-m.offsetHeight/2;if((Math.abs(n)-m.offsetHeight/6)>0){this.dadmodec=1;if(n<0){this.dadmodefix=-1}else{this.dadmodefix=1}}else{this.dadmodec=0}}else{this.dadmodec=this.dadmode}if(this.dadmodec){if(!this._sdrgc){this._createSdrgc()}this._sdrgc.style.display="block";this._sdrgc.style.top=g-a+parseInt(this.objBox.scrollTop)+((this.dadmodefix>=0)?m.offsetHeight:0)+"px"}else{this._llSelD=m;if(m.parentNode.tagName=="TR"){for(var j=0;j<m.parentNode.childNodes.length;j++){var n=m.parentNode.childNodes[j];n._bgCol=n.style.backgroundColor;n.style.backgroundColor="#FFCCCC"}}}};dhtmlXGridObject.prototype._clearMove=function(){if(this._sdrgc){this._sdrgc.style.display="none"}if((this._llSelD)&&(this._llSelD.parentNode.tagName=="TR")){var c=this._llSelD.parentNode.childNodes;for(var a=0;a<c.length;a++){c[a].style.backgroundColor=c[a]._bgCol}}this._llSelD=null};dhtmlXGridObject.prototype.rowToDragElement=function(a){var c=this.cells(a,0).getValue();return c};dhtmlXGridObject.prototype._copyUserData=function(j){if(!j.tobj.UserData[j.nid]||j.tobj!=j.sobj){j.tobj.UserData[j.nid]=new Hashtable()}else{return}var g=j.sobj.UserData[j.sid];var a=j.tobj.UserData[j.nid];if(g){a.keys=a.keys.concat(g.keys);a.values=a.values.concat(g.values)}};dhtmlXGridObject.prototype.moveRow=function(g,j,a,c){switch(j){case"row_sibling":this.moveRowTo(g,a,"move","sibling",this,c);break;case"up":this.moveRowUp(g);break;case"down":this.moveRowDown(g);break}};dhtmlXGridObject.prototype._nonTrivialNode=function(s,r,n,o,g){if((s.callEvent)&&(!g)){if(!s.callEvent("onDrag",[o.idd,r.id,(n?n.id:null),this,s])){return false}}var q=o.idd;var a=q;while(s._idpull[a]){a+=(new Date()).getMilliseconds().toString()}var l=(this.isTreeGrid()?this.getItemImage(q):"");if(n){for(j=0;j<r.childsCount;j++){if(r.childNodes[j]==n){break}}if(j!=0){n=r.childNodes[j-1]}else{st="TOP";n=""}}var c=s._attachChildNode(r,a,this.gridToTreeElement(s,a,q),"",l,l,l,"","",n);if(this._h2){var m=this._h2.get[q];if(m.childs.length){for(var j=0;j<m.childs.length;j++){this._nonTrivialNode(s,c,0,this.rowsAr[m.childs[j].id],1);if(!this.dpcpy){j--}}}}if(!this.dpcpy){this.deleteRow(q)}if((s.callEvent)&&(!g)){s.callEvent("onDrop",[a,r.id,(n?n.id:null),this,s])}};dhtmlXGridObject.prototype.gridToTreeElement=function(c,g,a){return this.cells(a,0).getValue()};dhtmlXGridObject.prototype.treeToGridElement=function(j,l,a){var c=new Array();var m=this.cellType._dhx_find("tree");if(m==-1){m=0}for(var g=0;g<this.getColumnCount();g++){c[c.length]=(g!=m)?(j.getUserData(l,this.getColumnId(g))||""):j.getItemText(l)}return c};dhtmlXGridObject.prototype.moveRowTo=function(j,g,n,m,a,l){var o=new dragContext((a||this).isTreeGrid()?"treeGrid":"grid",(l||this).isTreeGrid()?"treeGrid":"grid",n,m||"sibling",j,g,a||this,l||this);o.tobj._dragRoutine(o);o.close();return o.nid};dhtmlXGridObject.prototype.enableMercyDrag=function(a){this.dpcpy=dhx4.s2b(a)};dhtmlXGridObject.prototype.toPDF=function(j,r,w,u,o,C){var l={row:this.getSelectedRowId(),col:this.getSelectedCellIndex()};if(l.row===null||l.col===-1){l=false}else{if(l.row&&l.row.indexOf(this.delim)!==-1){var c=this.cells(l.row,l.col).cell;c.parentNode.className=c.parentNode.className.replace(" rowselected","");c.className=c.className.replace(" cellselected","");l.el=c}else{l=false}}r=r||"color";var x=r=="full_color";var a=this;a._asCDATA=true;if(typeof(C)==="undefined"){this.target=' target="_blank"'}else{this.target=C}eXcell_ch.prototype.getContent=function(){return this.getValue()};eXcell_ra.prototype.getContent=function(){return this.getValue()};function A(F){var M=[];for(var K=1;K<a.hdr.rows.length;K++){M[K]=[];for(var J=0;J<a._cCount;J++){var O=a.hdr.rows[K].childNodes[J];if(!M[K][J]){M[K][J]=[0,0]}if(O){M[K][O._cellIndexS]=[O.colSpan,O.rowSpan]}}}var L="<rows profile='"+F+"'";if(w){L+=" header='"+w+"'"}if(u){L+=" footer='"+u+"'"}L+="><head>"+a._serialiseExportConfig(M).replace(/^<head/,"<columns").replace(/head>$/,"columns>");for(var K=2;K<a.hdr.rows.length;K++){var D=0;var S=a.hdr.rows[K];var N="";for(var J=0;J<a._cCount;J++){if((a._srClmn&&!a._srClmn[J])||(a._hrrar[J]&&(!a._fake||J>=a._fake.hdrLabels.length))){D++;continue}var Q=M[K][J];var P=((Q[0]&&Q[0]>1)?' colspan="'+Q[0]+'" ':"");if(Q[1]&&Q[1]>1){P+=' rowspan="'+Q[1]+'" ';D=-1}var E="";var I=S;if(a._fake&&J<a._fake._cCount){I=a._fake.hdr.rows[K]}for(var H=0;H<I.cells.length;H++){if(I.cells[H]._cellIndexS==J){if(I.cells[H].getElementsByTagName("SELECT").length){E=""}else{E=_isIE?I.cells[H].innerText:I.cells[H].textContent}E=E.replace(/[ \n\r\t\xA0]+/," ");break}}if(!E||E==" "){D++}N+="<column"+P+"><![CDATA["+E+"]]></column>"}if(D!=a._cCount){L+="\n<columns>"+N+"</columns>"}}L+="</head>\n";L+=q();return L}function g(){var D=[];if(o){for(var E=0;E<o.length;E++){D.push(v(a.getRowIndex(o[E])))}}else{for(var E=0;E<a.getRowsNum();E++){D.push(v(E))}}return D.join("\n")}function q(){var F=["<foot>"];if(!a.ftr){return""}for(var H=1;H<a.ftr.rows.length;H++){F.push("<columns>");var K=a.ftr.rows[H];for(var E=0;E<a._cCount;E++){if(a._srClmn&&!a._srClmn[E]){continue}if(a._hrrar[E]&&(!a._fake||E>=a._fake.hdrLabels.length)){continue}for(var D=0;D<K.cells.length;D++){var J="";var I="";if(K.cells[D]._cellIndexS==E){J=_isIE?K.cells[D].innerText:K.cells[D].textContent;J=J.replace(/[ \n\r\t\xA0]+/," ");if(K.cells[D].colSpan&&K.cells[D].colSpan!=1){I=" colspan='"+K.cells[D].colSpan+"' "}if(K.cells[D].rowSpan&&K.cells[D].rowSpan!=1){I=" rowspan='"+K.cells[D].rowSpan+"' "}break}}F.push("<column"+I+"><![CDATA["+J+"]]></column>")}F.push("</columns>")}F.push("</foot>");return F.join("\n")}function n(E,D){return(window.getComputedStyle?(window.getComputedStyle(E,null)[D]):(E.currentStyle?E.currentStyle[D]:null))||""}function v(H){if(!a.rowsBuffer[H]){return""}var D=a.render_row(H);if(D.style.display=="none"){return""}var E=a.isTreeGrid()?' level="'+a.getLevel(D.idd)+'"':"";var L="<row"+E+">";for(var J=0;J<a._cCount;J++){if(((!a._srClmn)||(a._srClmn[J]))&&(!a._hrrar[J]||(a._fake&&J<a._fake.hdrLabels.length))){var P=a.cells(D.idd,J);if(x){var I=n(P.cell,"color");var O=n(P.cell,"backgroundColor");var N=n(P.cell,"font-weight")||n(P.cell,"fontWeight");var K=n(P.cell,"font-style")||n(P.cell,"fontStyle");var M=n(P.cell,"text-align")||n(P.cell,"textAlign");var F=n(P.cell,"font-family")||n(P.cell,"fontFamily");if(O=="transparent"||O=="rgba(0, 0, 0, 0)"){O="rgb(255,255,255)"}L+="<cell bgColor='"+O+"' textColor='"+I+"' bold='"+N+"' italic='"+K+"' align='"+M+"' font='"+F+"'>"}else{L+="<cell>"}L+="<![CDATA["+(P.getContent?P.getContent():P.getTitle())+"]]></cell>"}}return L+"</row>"}function s(){var D="</rows>";return D}var y=document.createElement("div");y.style.display="none";document.body.appendChild(y);var m="form_"+a.uid();y.innerHTML='<form id="'+m+'" method="post" action="'+j+'" accept-charset="utf-8"  enctype="application/x-www-form-urlencoded"'+this.target+'><input type="hidden" name="grid_xml" id="grid_xml"/> </form>';document.getElementById(m).firstChild.value=encodeURIComponent(A(r).replace("\u2013","-")+g()+s());document.getElementById(m).submit();y.parentNode.removeChild(y);a=null;if(l){l.el.parentNode.className+=" rowselected";l.el.className+=" cellselected"}l=null};dhtmlXGridObject.prototype._serialiseExportConfig=function(n){function m(j){if(typeof(j)!=="string"){return j}j=j.replace(/&/g,"&amp;");j=j.replace(/"/g,"&quot;");j=j.replace(/'/g,"&apos;");j=j.replace(/</g,"&lt;");j=j.replace(/>/g,"&gt;");return j}var c="<head>";for(var g=0;g<this.hdr.rows[0].cells.length;g++){if(this._srClmn&&!this._srClmn[g]){continue}if(this._hrrar[g]&&(!this._fake||g>=this._fake.hdrLabels.length)){continue}var l=this.fldSort[g];if(l=="cus"){l=this._customSorts[g].toString();l=l.replace(/function[\ ]*/,"").replace(/\([^\f]*/,"")}var r=n[1][g];var o=((r[1]&&r[1]>1)?' rowspan="'+r[1]+'" ':"")+((r[0]&&r[0]>1)?' colspan="'+r[0]+'" ':"");c+="<column "+o+" width='"+this.getColWidth(g)+"' align='"+this.cellAlign[g]+"' type='"+this.cellType[g]+"' hidden='"+((this.isColumnHidden&&this.isColumnHidden(g))?"true":"false")+"' sort='"+(l||"na")+"' color='"+(this.columnColor[g]||"")+"'"+(this.columnIds[g]?(" id='"+this.columnIds[g]+"'"):"")+">";if(this._asCDATA){c+="<![CDATA["+this.getColumnLabel(g)+"]]>"}else{c+=this.getColumnLabel(g)}var q=this.combos[g]?this.getCombo(g):null;if(q){for(var a=0;a<q.keys.length;a++){c+="<option value='"+m(q.keys[a])+"'><![CDATA["+q.values[a]+"]]></option>"}}c+="</column>"}return c+="</head>"};if(window.eXcell_sub_row_grid){window.eXcell_sub_row_grid.prototype.getContent=function(){return""}}dhtmlXGridObject.prototype.toExcel=function(a,j,n,m,c){if(!document.getElementById("ifr")){var l=document.createElement("iframe");l.style.display="none";l.setAttribute("name","dhx_export_iframe");l.setAttribute("src","");l.setAttribute("id","dhx_export_iframe");document.body.appendChild(l)}var g=' target="dhx_export_iframe"';this.toPDF(a,j,n,m,c,g)};dhtmlXGridObject.prototype.filterBy=function(g,l,c){if(this.isTreeGrid()){return this.filterTreeBy(g,l,c)}if(this._f_rowsBuffer){if(!c){this.rowsBuffer=dhtmlxArray([].concat(this._f_rowsBuffer));if(this._fake){this._fake.rowsBuffer=this.rowsBuffer}}}else{this._f_rowsBuffer=[].concat(this.rowsBuffer)}if(!this.rowsBuffer.length){return}var m=true;this.dma(true);if(typeof(g)=="object"){for(var a=0;a<l.length;a++){this._filterA(g[a],l[a])}}else{this._filterA(g,l)}this.dma(false);if(this.pagingOn&&this.rowsBuffer.length/this.rowsBufferOutSize<(this.currentPage-1)){this.changePage(0)}this._reset_view();this.callEvent("onGridReconstructed",[])};dhtmlXGridObject.prototype._filterA=function(c,g){if(g==""){return}var j=true;if(typeof(g)=="function"){j=false}else{g=(g||"").toString().toLowerCase()}if(!this.rowsBuffer.length){return}for(var a=this.rowsBuffer.length-1;a>=0;a--){if(j?(this._get_cell_value(this.rowsBuffer[a],c).toString().toLowerCase().indexOf(g)==-1):(!g.call(this,this._get_cell_value(this.rowsBuffer[a],c),this.rowsBuffer[a].idd))){this.rowsBuffer.splice(a,1)}}};dhtmlXGridObject.prototype.getFilterElement=function(a){if(!this.filters){return}for(var c=0;c<this.filters.length;c++){if(this.filters[c][1]==a){return(this.filters[c][0].combo||this.filters[c][0])}}return null};dhtmlXGridObject.prototype.collectValues=function(j){var u=this.dhxevs.data.oncollectvalues;if(u){var r=true;for(var s in u){var v=u[s].call(this,j);if(v!==true){r=v||r}}if(r!==true){return r}}if(this.isTreeGrid()){return this.collectTreeValues(j)}this.dma(true);this._build_m_order();j=this._m_order?this._m_order[j]:j;var o={};var m=[];var g=this._f_rowsBuffer||this.rowsBuffer;for(var l=0;l<g.length;l++){var a=this._get_cell_value(g[l],j);if(a&&(!g[l]._childIndexes||g[l]._childIndexes[j]!=g[l]._childIndexes[j-1])){o[a]=true}}this.dma(false);var q=(this.combos[j]||(this._col_combos?this._col_combos[j]:false));for(var n in o){if(o[n]===true){if(q){if(q.get&&q.get(n)){n=q.get(n)}else{if(q.getOption&&q.getOption(n)){n=q.getOption(n).text}}}m.push(n)}}return m.sort()};dhtmlXGridObject.prototype._build_m_order=function(){if(this._c_order){this._m_order=[];for(var a=0;a<this._c_order.length;a++){this._m_order[this._c_order[a]]=a}}};dhtmlXGridObject.prototype.filterByAll=function(){var g=[];var c=[];this._build_m_order();for(var j=0;j<this.filters.length;j++){var m=this._m_order?this._m_order[this.filters[j][1]]:this.filters[j][1];if(m>=this._cCount){continue}c.push(m);var n=this.filters[j][0].old_value=this.filters[j][0].value;if(this.filters[j][0]._filter){n=this.filters[j][0]._filter()}var l;if(typeof n!="function"&&(l=(this.combos[m]||(this._col_combos?this._col_combos[m]:false)))){if(l.values){m=l.values._dhx_find(n);n=(m==-1)?n:l.keys[m]}else{if(l.getOptionByLabel){n=(l.getOptionByLabel(n)?l.getOptionByLabel(n).value:n)}}}g.push(n)}if(!this.callEvent("onFilterStart",[c,g])){return}this.filterBy(c,g);if(this._cssEven){this._fixAlterCss()}this.callEvent("onFilterEnd",[this.filters]);if(this._f_rowsBuffer&&this.rowsBuffer.length==this._f_rowsBuffer.length){this._f_rowsBuffer=null}};dhtmlXGridObject.prototype.makeFilter=function(l,g,c){if(!this.filters){this.filters=[]}if(typeof(l)!="object"){l=document.getElementById(l)}if(!l){return}var a=this;if(!l.style.width){l.style.width="90%"}if(l.tagName=="SELECT"){this.filters.push([l,g]);this._loadSelectOptins(l,g);l.onchange=function(){a.filterByAll()};if(_isIE){l.style.marginTop="1px"}this.attachEvent("onEditCell",function(n,m,o){this._build_m_order();if(n==2&&this.filters&&(this._m_order?(o==this._m_order[g]):(o==g))){this._loadSelectOptins(l,g)}return true})}else{if(l.tagName=="INPUT"){this.filters.push([l,g]);l.old_value=l.value="";l.onkeydown=function(){if(this._timer){window.clearTimeout(this._timer)}this._timer=window.setTimeout(function(){if(l.value!=l.old_value){a.filterByAll();l.old_value=l.value}},500)}}else{if(l.tagName=="DIV"&&l.className=="combo"){this.filters.push([l,g]);l.style.padding="0px";l.style.margin="0px";if(!window.dhx_globalImgPath){window.dhx_globalImgPath=this.imgURL}var j=new dhtmlXCombo(l,"_filter","90%");j.filterSelfA=j.filterSelf;j.filterSelf=function(){if(this.getSelectedIndex()==0){this.setComboText("")}this.filterSelfA.apply(this,arguments);this.optionsArr[0].hide(false)};j.enableFilteringMode(true);l.combo=j;l.value="";this._loadComboOptins(l,g);j.attachEvent("onChange",function(){l.value=j.getSelectedValue();if(l.value===null){l.value=""}a.filterByAll()})}}}if(l.parentNode){l.parentNode.className+=" filter"}this._filters_ready()};dhtmlXGridObject.prototype.findCell=function(n,o,l,m){var m=m||(function(q,j){return j.toString().toLowerCase().indexOf(q)!=-1});if(m===true){m=function(q,j){return j.toString().toLowerCase()==q}}var g=new Array();n=n.toString().toLowerCase();if(typeof l!="number"){l=l?1:0}if(!this.rowsBuffer.length){return g}for(var c=(o||0);c<this._cCount;c++){if(this._h2){this._h2.forEachChild(0,function(j){if(l&&g.length==l){return g}if(m(n,this._get_cell_value(j.buff,c))){g.push([j.id,c])}},this)}else{for(var a=0;a<this.rowsBuffer.length;a++){if(m(n,this._get_cell_value(this.rowsBuffer[a],c))){g.push([this.rowsBuffer[a].idd,c]);if(l&&g.length==l){return g}}}}if(typeof(o)!="undefined"){return g}}return g};dhtmlXGridObject.prototype.makeSearch=function(j,g,a){if(typeof(j)!="object"){j=document.getElementById(j)}if(!j){return}var c=this;if(j.tagName=="INPUT"){j.onkeypress=function(){if(this._timer){window.clearTimeout(this._timer)}this._timer=window.setTimeout(function(){if(j.value==""){return}var l=c.findCell(j.value,g,true,a);if(l.length){if(c._h2){c.openItem(l[0][0])}c.selectCell(c.getRowIndex(l[0][0]),(g||0))}},500)}}if(j.parentNode){j.parentNode.className+=" filter"}};dhtmlXGridObject.prototype._loadSelectOptins=function(m,o){var a=this.collectValues(o);var g=m.value;m.innerHTML="";m.options[0]=new Option("","");var n=this._filter_tr?this._filter_tr[o]:null;for(var j=0;j<a.length;j++){m.options[m.options.length]=new Option(n?n(a[j]):a[j],a[j])}m.value=g};dhtmlXGridObject.prototype.setSelectFilterLabel=function(c,a){if(!this._filter_tr){this._filter_tr=[]}this._filter_tr[c]=a};dhtmlXGridObject.prototype._loadComboOptins=function(j,n){if(!j.combo){return}var a=this.collectValues(n);j.combo.clearAll();var m=[["",""]];for(var g=0;g<a.length;g++){m.push([a[g],a[g]])}j.combo.addOption(m)};dhtmlXGridObject.prototype.refreshFilters=function(){if(!this.filters){return}for(var a=0;a<this.filters.length;a++){switch(this.filters[a][0].tagName.toLowerCase()){case"input":break;case"select":this._loadSelectOptins.apply(this,this.filters[a]);break;case"div":this._loadComboOptins.apply(this,this.filters[a]);break}}};dhtmlXGridObject.prototype._filters_ready=function(c,a){this.attachEvent("onXLE",this.refreshFilters);this.attachEvent("onRowCreated",function(l,j){if(this._f_rowsBuffer){for(var g=0;g<this._f_rowsBuffer.length;g++){if(this._f_rowsBuffer[g].idd==l){return this._f_rowsBuffer[g]=j}}}});this.attachEvent("onClearAll",function(){this._f_rowsBuffer=null;if(!this.hdr.rows.length){this.filters=[]}});this.attachEvent("onSetSizes",this._filters_resize_combo);this.attachEvent("onResize",this._filters_resize_combo);this._filters_ready=function(){}};dhtmlXGridObject.prototype._filters_resize_combo=function(){if(!this.filters){return}for(var a=0;a<this.filters.length;a++){if(this.filters[a][0].combo!=null){this.filters[a][0].combo.setSize(Math.round(this.filters[a][0].offsetWidth*90/100))}}return true};dhtmlXGridObject.prototype._in_header_text_filter=function(c,a){c.innerHTML="<input type='text'>";c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};c.onselectstart=function(){return(event.cancelBubble=true)};this.makeFilter(c.firstChild,a)};dhtmlXGridObject.prototype._in_header_text_filter_inc=function(c,a){c.innerHTML="<input type='text'>";c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};c.onselectstart=function(){return(event.cancelBubble=true)};this.makeFilter(c.firstChild,a);c.firstChild._filter=function(){if(c.firstChild.value==""){return""}return function(g){return(g.toString().toLowerCase().indexOf(c.firstChild.value.toLowerCase())==0)}};this._filters_ready()};dhtmlXGridObject.prototype._in_header_select_filter=function(c,a){c.innerHTML="<select></select>";c.onclick=function(g){(g||event).cancelBubble=true;return false};this.makeFilter(c.firstChild,a)};dhtmlXGridObject.prototype._in_header_select_filter_strict=function(g,c){g.innerHTML="<select style='width:90%; font-size:8pt; font-family:Tahoma;'></select>";g.onclick=function(j){(j||event).cancelBubble=true;return false};this.makeFilter(g.firstChild,c);var a=this.combos;g.firstChild._filter=function(){var j=g.firstChild.value;if(!j){return""}if(a[c]){j=a[c].keys[a[c].values._dhx_find(j)]}j=j.toLowerCase();return function(l){return(l.toString().toLowerCase()==j)}};this._filters_ready()};dhtmlXGridObject.prototype._in_header_combo_filter=function(c,a){c.innerHTML="<div style='width:100%; padding-left:2px; overflow:hidden; ' class='combo'></div>";c.onselectstart=function(){return(event.cancelBubble=true)};c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};this.makeFilter(c.firstChild,a)};dhtmlXGridObject.prototype._search_common=function(c,a){c.innerHTML="<input type='text' style='width:90%; '>";c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};c.onselectstart=function(){return(event.cancelBubble=true)}};dhtmlXGridObject.prototype._in_header_text_search=function(g,c,a){this._search_common(g,c);this.makeSearch(g.firstChild,c)};dhtmlXGridObject.prototype._in_header_text_search_strict=function(c,a){this._search_common(c,a);this.makeSearch(c.firstChild,a,true)};dhtmlXGridObject.prototype._in_header_numeric_filter=function(c,a){this._in_header_text_filter.call(this,c,a);c.firstChild._filter=function(){var g=this.value;var l;var n="==";var j=parseFloat(g.replace("=",""));var m=null;if(g){if(g.indexOf("..")!=-1){g=g.split("..");j=parseFloat(g[0]);m=parseFloat(g[1]);return function(o){if(o>=j&&o<=m){return true}return false}}l=g.match(/>=|<=|>|</);if(l){n=l[0];j=parseFloat(g.replace(n,""))}return Function("v"," if (v "+n+" "+j+" ) return true; return false;")}return""}};dhtmlXGridObject.prototype._in_header_master_checkbox=function(j,g,l){j.innerHTML=l[0]+"<input type='checkbox' />"+l[1];var a=this;j.getElementsByTagName("input")[0].onclick=function(m){a._build_m_order();var c=a._m_order?a._m_order[g]:g;var n=this.checked?1:0;a.forEachRowA(function(q){var o=this.cells(q,c);if(o.isCheckbox()){o.setValue(n);o.cell.wasChanged=true}this.callEvent("onEditCell",[1,q,c,n]);this.callEvent("onCheckbox",[q,c,n])});(m||event).cancelBubble=true}};dhtmlXGridObject.prototype._in_header_stat_total=function(g,a,l){var j=function(){var o=0;this._build_m_order();var n=this._m_order?this._m_order[a]:a;for(var m=0;m<this.rowsBuffer.length;m++){var c=parseFloat(this._get_cell_value(this.rowsBuffer[m],n));o+=isNaN(c)?0:c}return this._maskArr[n]?this._aplNF(o,n):(Math.round(o*100)/100)};this._stat_in_header(g,j,a,l,l)};dhtmlXGridObject.prototype._in_header_stat_multi_total=function(l,j,q){var o=q[1].split(":");q[1]="";for(var g=0;g<o.length;g++){o[g]=parseInt(o[g])}var m=function(){var u=0;for(var s=0;s<this.rowsBuffer.length;s++){var r=1;for(var c=0;c<o.length;c++){r*=parseFloat(this._get_cell_value(this.rowsBuffer[s],o[c]))}u+=isNaN(r)?0:r}return this._maskArr[j]?this._aplNF(u,j):(Math.round(u*100)/100)};var a=[];for(var n=0;n<o.length;n++){a[o[n]]=true}this._stat_in_header(l,m,a,q,q)};dhtmlXGridObject.prototype._in_header_stat_max=function(g,a,l){var j=function(){this._build_m_order();var m=this._m_order?this._m_order[a]:a;var n=-999999999;if(this.getRowsNum()==0){return"&nbsp;"}for(var c=0;c<this.rowsBuffer.length;c++){n=Math.max(n,parseFloat(this._get_cell_value(this.rowsBuffer[c],m)))}return this._maskArr[a]?this._aplNF(n,a):n};this._stat_in_header(g,j,a,l)};dhtmlXGridObject.prototype._in_header_stat_min=function(g,a,l){var j=function(){this._build_m_order();var m=this._m_order?this._m_order[a]:a;var n=999999999;if(this.getRowsNum()==0){return"&nbsp;"}for(var c=0;c<this.rowsBuffer.length;c++){n=Math.min(n,parseFloat(this._get_cell_value(this.rowsBuffer[c],m)))}return this._maskArr[a]?this._aplNF(n,a):n};this._stat_in_header(g,j,a,l)};dhtmlXGridObject.prototype._in_header_stat_average=function(g,a,l){var j=function(){this._build_m_order();var n=this._m_order?this._m_order[a]:a;var q=0;var o=0;if(this.getRowsNum()==0){return"&nbsp;"}for(var m=0;m<this.rowsBuffer.length;m++){var c=parseFloat(this._get_cell_value(this.rowsBuffer[m],n));if(!isNaN(c)){q+=c;o++}}return this._maskArr[a]?this._aplNF(q/o,a):(Math.round(q/o*100)/100)};this._stat_in_header(g,j,a,l)};dhtmlXGridObject.prototype._in_header_stat_count=function(g,a,l){var j=function(){return this.getRowsNum()};this._stat_in_header(g,j,a,l)};dhtmlXGridObject.prototype._stat_in_header=function(g,j,a,n){var l=this;var m=function(){this.dma(true);g.innerHTML=(n[0]?n[0]:"")+j.call(this)+(n[1]?n[1]:"");this.dma(false);this.callEvent("onStatReady",[])};if(!this._stat_events){this._stat_events=[];this.attachEvent("onClearAll",function(){if(!this.hdr.rows[1]){for(var o=0;o<this._stat_events.length;o++){for(var c=0;c<4;c++){this.detachEvent(this._stat_events[o][c])}}this._stat_events=[]}})}this._stat_events.push([this.attachEvent("onGridReconstructed",m),this.attachEvent("onXLE",m),this.attachEvent("onFilterEnd",m),this.attachEvent("onEditCell",function(c,q,o){if(c==2&&(o==a||(a&&a[o]))){m.call(this)}return true})]);g.innerHTML=""};dhtmlXGridObject.prototype.loadCSVFile=function(c,a){this.load(c,a,"csv")};dhtmlXGridObject.prototype.enableCSVAutoID=function(a){this._csvAID=dhx4.s2b(a)};dhtmlXGridObject.prototype.enableCSVHeader=function(a){this._csvHdr=dhx4.s2b(a)};dhtmlXGridObject.prototype.setCSVDelimiter=function(a){this.csv.cell=a};dhtmlXGridObject.prototype._csvAID=true;dhtmlXGridObject.prototype.loadCSVString=function(a){this.parse(a,"csv")};dhtmlXGridObject.prototype.serializeToCSV=function(q){this.editStop();if(this._mathSerialization){this._agetm="getMathValue"}else{if(this._strictText||q){this._agetm="getTitle"}else{this._agetm="getValue"}}var n=[];if(this._csvHdr){for(var m=1;m<this.hdr.rows.length;m++){var c=[];for(var o=0;o<this._cCount;o++){if((!this._srClmn)||(this._srClmn[o])){c.push(this.getColumnLabel(o,m-1))}}n.push(this.csvParser.str(c,this.csv.cell,this.csv.row))}}var o=0;var l=this.rowsBuffer.length;for(o;o<l;o++){var g=this._serializeRowToCVS(null,o);if(g!=""){n.push(g)}}return this.csvParser.block(n,this.csv.row)};dhtmlXGridObject.prototype._serializeRowToCVS=function(a,q,g,n){var o=new Array();if(!a){a=this.render_row(q);if(this._fake&&!this._fake.rowsAr[a.idd]){this._fake.render_row(q)}}if(!this._csvAID){o[o.length]=a.idd}g=g||0;n=n||this._cCount;var v=false;var j=g;while(a.childNodes[g]._cellIndex>j&&g){g--}for(var s=g;j<n;s++){if(!a.childNodes[s]){break}var c=a.childNodes[s]._cellIndex;if(((!this._srClmn)||(this._srClmn[c]))&&(!this._serialize_visible||!this._hrrar[c])){var l=a.childNodes[s];var m=this.cells(a.idd,c);while(j!=c){j++;o.push("");if(j>=n){break}}if(j>=n){break}j++;if(m.cell){zxVal=m[this._agetm]()}else{zxVal=""}if((this._chAttr)&&(m.wasChanged())){v=true}o[o.length]=((zxVal===null)?"":zxVal);if(this._ecspn&&l.colSpan&&l.colSpan>1){l=l.colSpan-1;for(var w=0;w<l;w++){o[o.length]="";j++}}}else{j++}}if((this._onlChAttr)&&(!v)){return""}return this.csvParser.str(o,this.csv.cell,this.csv.row)};dhtmlXGridObject.prototype.toClipBoard=function(a){if(window.clipboardData){window.clipboardData.setData("Text",a)}else{(new Clipboard()).copy(a)}};dhtmlXGridObject.prototype.fromClipBoard=function(){if(window.clipboardData){return window.clipboardData.getData("Text")}else{return(new Clipboard()).paste()}};dhtmlXGridObject.prototype.cellToClipboard=function(g,c){if((!g)||(!c&&c!==0)){if(!this.selectedRows[0]){return}g=this.selectedRows[0].idd;c=this.cell._cellIndex}var a=this.cells(g,c);this.toClipBoard(((a.getLabel?a.getLabel():a.getValue())||"").toString())};dhtmlXGridObject.prototype.updateCellFromClipboard=function(g,c){if((!g)||(!c)){if(!this.selectedRows[0]){return}g=this.selectedRows[0].idd;c=this.cell._cellIndex}var a=this.cells(g,c);a[a.setImage?"setLabel":"setValue"](this.fromClipBoard())};dhtmlXGridObject.prototype.rowToClipboard=function(j){var a="";if(this._mathSerialization){this._agetm="getMathValue"}else{if(this._strictText){this._agetm="getTitle"}else{this._agetm="getValue"}}this._serialize_visible=!this._fake;if(j){a=this._serializeRowToCVS(this.getRowById(j))}else{var g=[];for(var c=0;c<this.selectedRows.length;c++){g[g.length]=this._serializeRowToCVS(this.selectedRows[c]);a=this.csvParser.block(g,this.csv.row)}}this._serialize_visible=false;this.toClipBoard(a)};dhtmlXGridObject.prototype.updateRowFromClipboard=function(l){var a=this.fromClipBoard();if(!a){return}if(l){var j=this.getRowById(l)}else{var j=this.selectedRows[0]}if(!j){return}var m=this.csvParser;a=m.unblock(a,this.csv.cell,this.csv.row)[0];if(!this._csvAID){a.splice(0,1)}for(var g=0;g<a.length;g++){var c=this.cells3(j,g);c[c.setImage?"setLabel":"setValue"](a[g])}};dhtmlXGridObject.prototype.csvParser={block:function(a,c){return a.join(c)},unblock:function(m,a,l){var j=(m||"").split(l);for(var c=0;c<j.length;c++){j[c]=(j[c]||"").split(a)}var g=j.length-1;if(j[g].length==1&&j[g][0]==""){j.splice(g,1)}return j},str:function(c,a,g){return c.join(a)}};dhtmlXGridObject.prototype.csvExtParser={_quote:RegExp('"',"g"),_quote_esc:RegExp('\\\\"',"g"),block:function(a,c){return a.join(c)},unblock:function(o,s,v){var g=[[]];var c=0;if(!o){return g}var q=/^[ ]*"/;var n=/"[ ]*$/;var a=new RegExp(".*"+v+".*$");var l=o.split(s);for(var j=0;j<l.length;j++){if(l[j].match(q)){var u=l[j].replace(q,"");while(!l[j].match(n)){j++;u+=l[j]}g[c].push(u.replace(n,"").replace(this._quote_esc,'"'))}else{if(l[j].match(a)){var m=l[j].indexOf(v);g[c].push(l[j].substr(0,m));c++;g[c]=[];l[j]=l[j].substr(m+1);j--}else{if(l[j]||j!=l.length-1){g[c].push(l[j])}}}}var r=g.length-1;if(r>0&&!g[r].length){g.splice(r,1)}return g},str:function(g,a,j){for(var c=0;c<g.length;c++){g[c]='"'+g[c].replace(this._quote,'\\"')+'"'}return g.join(a)}};dhtmlXGridObject.prototype.addRowFromClipboard=function(){var a=this.fromClipBoard();if(!a){return}var g=this.csvParser.unblock(a,this.csv.cell,this.csv.row);for(var c=0;c<g.length;c++){if(g[c]){a=g[c];if(!a.length){continue}if(this._csvAID){this.addRow(this.getRowsNum()+2,a)}else{if(this.rowsAr[a[0]]){a[0]=this.uid()}this.addRow(a[0],a.slice(1))}}}};dhtmlXGridObject.prototype.gridToClipboard=function(){this.toClipBoard(this.serializeToCSV())};dhtmlXGridObject.prototype.gridFromClipboard=function(){var a=this.fromClipBoard();if(!a){return}this.loadCSVString(a)};dhtmlXGridObject.prototype.getXLS=function(n){if(!this.xslform){this.xslform=document.createElement("FORM");this.xslform.action=(n||"")+"xls.php";this.xslform.method="post";this.xslform.target=(_isIE?"_blank":"");document.body.appendChild(this.xslform);var m=document.createElement("INPUT");m.type="hidden";m.name="csv";this.xslform.appendChild(m);var j=document.createElement("INPUT");j.type="hidden";j.name="csv_header";this.xslform.appendChild(j)}var o=this.serializeToCSV();this.xslform.childNodes[0].value=o;var g=[];var a=this._cCount;for(var c=0;c<a;c++){g.push(this.getHeaderCol(c))}g=g.join(",");this.xslform.childNodes[1].value=g;this.xslform.submit()};dhtmlXGridObject.prototype.printView=function(u,g){var r="<style>TD { font-family:Arial; text-align:center; padding-left:2px;padding-right:2px; } \n td.filter input, td.filter select { display:none; }  \n  </style>";var D=null;if(this._fake){D=[].concat(this._hrrar);for(var C=0;C<this._fake._cCount;C++){this._hrrar[C]=null}}r+="<base  href='"+document.location.href+"'></base>";if(!this.parentGrid){r+=(u||"")}r+='<table width="100%" border="2px" cellpadding="0" cellspacing="0">';var s=Math.max(this.rowsBuffer.length,this.rowsCol.length);var q=this._cCount;var v=this._printWidth();r+='<tr class="header_row_1">';for(var C=0;C<q;C++){if(this._hrrar&&this._hrrar[C]){continue}var m=this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes?this.hdr.rows[1]._childIndexes[parseInt(C)]:C];var a=(m.colSpan||1);var I=(m.rowSpan||1);for(var A=1;A<a;A++){v[C]+=v[A]}r+='<td rowspan="'+I+'" width="'+v[C]+'%" style="background-color:lightgrey;" colspan="'+a+'">'+this.getHeaderCol(C)+"</td>";C+=a-1}r+="</tr>";for(var C=2;C<this.hdr.rows.length;C++){if(_isIE){r+="<tr style='background-color:lightgrey' class='header_row_"+C+"'>";var l=this.hdr.rows[C].childNodes;for(var A=0;A<l.length;A++){if(!this._hrrar||!this._hrrar[l[A]._cellIndex]){r+=l[A].outerHTML}}r+="</tr>"}else{r+="<tr class='header_row_"+C+"' style='background-color:lightgrey'>"+(this._fake?this._fake.hdr.rows[C].innerHTML:"")+this.hdr.rows[C].innerHTML+"</tr>"}}for(var C=0;C<s;C++){r+="<tr>";if(this.rowsCol[C]&&this.rowsCol[C]._cntr){r+=this.rowsCol[C].innerHTML.replace(/<img[^>]*>/gi,"")+"</tr>";continue}if(this.rowsCol[C]&&this.rowsCol[C].style.display=="none"){continue}var o;if(this.rowsCol[C]){o=this.rowsCol[C].idd}else{if(this.rowsBuffer[C]){o=this.rowsBuffer[C].idd}else{continue}}for(var A=0;A<q;A++){if(this._hrrar&&this._hrrar[A]){continue}if(this.rowsAr[o]&&this.rowsAr[o].tagName=="TR"){var H=this.cells(o,A);if(H._setState){var w=""}else{if(H.getContent){w=H.getContent()}else{if(H.getImage||H.combo){var w=H.cell.innerHTML}else{var w=H.getValue()}}}}else{var w=this._get_cell_value(this.rowsBuffer[C],A)}var x=this.columnColor[A]?"background-color:"+this.columnColor[A]+";":"";var y=this.cellAlign[A]?"text-align:"+this.cellAlign[A]+";":"";var E=H.getAttribute("colspan");r+='<td style="'+x+y+'" '+(E?'colSpan="'+E+'"':"")+">"+(w===""?"&nbsp;":w)+"</td>";if(E){A+=E-1}}r+="</tr>";if(this.rowsCol[C]&&this.rowsCol[C]._expanded){var n=this.cells4(this.rowsCol[C]._expanded.ctrl);if(n.getSubGrid){r+='<tr><td colspan="'+q+'">'+n.getSubGrid().printView()+"</td></tr>"}else{r+='<tr><td colspan="'+q+'">'+this.rowsCol[C]._expanded.innerHTML+"</td></tr>"}}}if(this.ftr){for(var C=1;C<this.ftr.childNodes[0].rows.length;C++){r+="<tr style='background-color:lightgrey'>"+((this._fake)?this._fake.ftr.childNodes[0].rows[C].innerHTML:"")+this.ftr.childNodes[0].rows[C].innerHTML+"</tr>"}}r+="</table>";if(this.parentGrid){return r}r+=(g||"");var F=window.open("","_blank");F.document.write(r);F.document.write("<script>window.onerror=function(){return true;}<\/script>");F.document.close();if(this._fake){this._hrrar=D}};dhtmlXGridObject.prototype._printWidth=function(){var l=[];var j=0;for(var g=0;g<this._cCount;g++){var a=this.getColWidth(g);l.push(a);j+=a}var n=[];var c=0;for(var g=0;g<l.length;g++){var m=Math.floor((l[g]/j)*100);c+=m;n.push(m)}n[n.length-1]+=100-c;return n};if(!window.clipboardData){window.clipboardData={_make:function(){var c=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(!c){return null}var a=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(!a){return null}a.addDataFlavor("text/unicode");var g=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);this._p=[c,a,g];return true},setData:function(a,j){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(g){dhx4.callEvent("onClipboardError",["Access to clipboard denied",a,j]);return""}if(!this._make()){return false}this._p[2].data=j;this._p[1].setTransferData("text/unicode",this._p[2],j.length*2);var c=Components.interfaces.nsIClipboard;this._p[0].setData(this._p[1],null,c.kGlobalClipboard)},getData:function(a){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(g){dhx4.callEvent("onClipboardError",["Access to clipboard denied",a]);return""}if(!this._make()){return false}this._p[0].getData(this._p[1],this._p[0].kGlobalClipboard);var c=new Object();var j=new Object();try{this._p[1].getTransferData("text/unicode",j,c)}catch(g){return""}if(j){j=j.value.QueryInterface(Components.interfaces.nsISupportsString)}if(j){return j.data.substring(0,c.value/2)}return""}}}dhtmlXGridObject.prototype.enableBlockSelection=function(g){if(typeof this._bs_mode=="undefined"){var a=this;this.obj.onmousedown=function(j){if(a._bs_mode){a._OnSelectionStart((j||event),this)}return true};this._CSVRowDelimiter=this.csv.row;this.attachEvent("onResize",function(){a._HideSelection();return true});this.attachEvent("onGridReconstructed",function(){a._HideSelection();return true});this.attachEvent("onFilterEnd",this._HideSelection)}if(g===false){this._bs_mode=false;return this._HideSelection()}else{this._bs_mode=true}if(!window.dhx4.isIPad){var c=this._clip_area=document.createElement("textarea");c.style.cssText="position:absolute; width:1px; height:1px; overflow:hidden; color:transparent; background-color:transparent; bottom:1px; right:1px; border:none;";c.onkeydown=function(j){j=j||event;if(j.keyCode==86&&(j.ctrlKey||j.metaKey)){a.pasteBlockFromClipboard()}};document.body.insertBefore(this._clip_area,document.body.firstChild);dhtmlxEvent(this.entBox,"click",function(){if(!a.editor){a._clip_area.select()}})}};dhtmlXGridObject.prototype.forceLabelSelection=function(a){this._strictText=dhx4.s2b(a)};dhtmlXGridObject.prototype._OnSelectionStart=function(g,j){var c=this;if(g.button==2){return}var l=g.srcElement||g.target;if(this.editor){if(l.tagName&&(l.tagName=="INPUT"||l.tagName=="TEXTAREA")){return}this.editStop()}c.setActive(true);var n=this.getPosition(this.obj);var a=g.clientX-n[0]+(document.body.scrollLeft||(document.documentElement?document.documentElement.scrollLeft:0));var m=g.clientY-n[1]+(document.body.scrollTop||(document.documentElement?document.documentElement.scrollTop:0));this._CreateSelection(a-4,m-4);if(l==this._selectionObj){this._HideSelection();this._startSelectionCell=null}else{while(l&&(!l.tagName||l.tagName.toLowerCase()!="td")){l=l.parentNode}this._startSelectionCell=l}if(this._startSelectionCell){if(!this.callEvent("onBeforeBlockSelected",[this._startSelectionCell.parentNode.idd,this._startSelectionCell._cellIndex])){return this._startSelectionCell=null}}this.obj.onmousedown=null;this.obj[_isIE?"onmouseleave":"onmouseout"]=function(o){if(c._blsTimer){window.clearTimeout(c._blsTimer)}};this.obj.onmmold=this.obj.onmousemove;this._init_pos=[a,m];this._selectionObj.onmousemove=this.obj.onmousemove=function(o){o=o||g;if(o.preventDefault){o.preventDefault()}else{o.returnValue=false}c._OnSelectionMove(o)};this._oldDMP=document.body.onmouseup;document.body.onmouseup=function(o){o=o||g;c._OnSelectionStop(o,this);return true};this.callEvent("onBeforeBlockSelection",[]);document.body.onselectstart=function(){return false}};dhtmlXGridObject.prototype._getCellByPos=function(a,j){a=a;if(this._fake){a+=this._fake.objBox.scrollWidth}j=j;var c=0;for(var g=0;g<this.obj.rows.length;g++){j-=this.obj.rows[g].offsetHeight;if(j<=0){c=this.obj.rows[g];break}}if(!c||!c.idd){return null}for(var g=0;g<this._cCount;g++){a-=this.getColWidth(g);if(a<=0){while(true){if(c._childIndexes&&c._childIndexes[g+1]==c._childIndexes[g]){c=c.previousSibling}else{return this.cells(c.idd,g).cell}}}}return null};dhtmlXGridObject.prototype._OnSelectionMove=function(j){var x=this;this._ShowSelection();var s=this.getPosition(this.obj);var n=j.clientX-s[0]+(document.body.scrollLeft||(document.documentElement?document.documentElement.scrollLeft:0));var m=j.clientY-s[1]+(document.body.scrollTop||(document.documentElement?document.documentElement.scrollTop:0));if((Math.abs(this._init_pos[0]-n)<5)&&(Math.abs(this._init_pos[1]-m)<5)){return this._HideSelection()}var v=this._endSelectionCell;if(this._startSelectionCell==null){this._endSelectionCell=this._startSelectionCell=this.getFirstParentOfType(j.srcElement||j.target,"TD")}else{if(j.srcElement||j.target){if((j.srcElement||j.target).className=="dhtmlxGrid_selection"){this._endSelectionCell=(this._getCellByPos(n,m)||this._endSelectionCell)}else{var w=this.getFirstParentOfType(j.srcElement||j.target,"TD");if(w.parentNode.idd){this._endSelectionCell=w}}}}if(this._endSelectionCell){if(!this.callEvent("onBeforeBlockSelected",[this._endSelectionCell.parentNode.idd,this._endSelectionCell._cellIndex])){this._endSelectionCell=v}}var l=this.objBox.scrollLeft+this.objBox.clientWidth;var c=this.objBox.scrollTop+this.objBox.clientHeight;var q=this.objBox.scrollLeft;var o=this.objBox.scrollTop;var g=false;if(this._blsTimer){window.clearTimeout(this._blsTimer)}if(n+20>=l){this.objBox.scrollLeft=this.objBox.scrollLeft+20;g=true}else{if(n-20<q){this.objBox.scrollLeft=this.objBox.scrollLeft-20;g=true}}if(m+20>=c&&!this._realfake){this.objBox.scrollTop=this.objBox.scrollTop+20;g=true}else{if(m-20<o&&!this._realfake){this.objBox.scrollTop=this.objBox.scrollTop-20;g=true}}this._selectionArea=this._RedrawSelectionPos(this._startSelectionCell,this._endSelectionCell);if(g){var u=j.clientX;var r=j.clientY;this._blsTimer=window.setTimeout(function(){x._OnSelectionMove({clientX:u,clientY:r})},100)}};dhtmlXGridObject.prototype._OnSelectionStop=function(c){var a=this;if(this._blsTimer){window.clearTimeout(this._blsTimer)}this.obj.onmousedown=function(j){if(a._bs_mode){a._OnSelectionStart((j||c),this)}return true};this.obj.onmousemove=this.obj.onmmold||null;this._selectionObj.onmousemove=null;document.body.onmouseup=this._oldDMP||null;if(parseInt(this._selectionObj.style.width)<2&&parseInt(this._selectionObj.style.height)<2){this._HideSelection()}else{var g=this.getFirstParentOfType(c.srcElement||c.target,"TD");if((!g)||(!g.parentNode.idd)){g=this._endSelectionCell}while(g&&(!g.tagName||g.tagName.toLowerCase()!="td")){g=g.parentNode}if(!g){return this._HideSelection()}this._stopSelectionCell=g;this._selectionArea=this._RedrawSelectionPos(this._startSelectionCell,this._stopSelectionCell);this.callEvent("onBlockSelected",[])}document.body.onselectstart=function(){}};dhtmlXGridObject.prototype._RedrawSelectionPos=function(u,n){if(u.parentNode.grid!=n.parentNode.grid){return this._selectionArea}var r={};r.LeftTopCol=u._cellIndex;r.LeftTopRow=this.getRowIndex(u.parentNode.idd);r.RightBottomCol=n._cellIndex;r.RightBottomRow=this.getRowIndex(n.parentNode.idd);var j=u.offsetWidth;var g=u.offsetHeight;u=this.getPosition(u,this.obj);var v=n.offsetWidth;var o=n.offsetHeight;n=this.getPosition(n,this.obj);if(u[0]<n[0]){var l=u[0];var m=n[0]+v}else{var q=r.RightBottomCol;r.RightBottomCol=r.LeftTopCol;r.LeftTopCol=q;var l=n[0];var m=u[0]+j}if(u[1]<n[1]){var s=u[1];var a=n[1]+o}else{var q=r.RightBottomRow;r.RightBottomRow=r.LeftTopRow;r.LeftTopRow=q;var s=n[1];var a=u[1]+g}var w=m-l;var c=a-s;this._selectionObj.style.left=l+"px";this._selectionObj.style.top=s+"px";this._selectionObj.style.width=w+"px";this._selectionObj.style.height=c+"px";return r};dhtmlXGridObject.prototype._CreateSelection=function(a,g){if(this._selectionObj==null){var c=document.createElement("div");c.style.position="absolute";c.style.display="none";c.className="dhtmlxGrid_selection";this._selectionObj=c;this._selectionObj.onmousedown=function(j){j=j||event;if(j.button==2||(_isMacOS&&j.ctrlKey)){return this.parentNode.grid.callEvent("onBlockRightClick",["BLOCK",j])}};this._selectionObj.oncontextmenu=function(j){(j||event).cancelBubble=true;return false};this.objBox.appendChild(this._selectionObj)}this._selectionObj.style.width="0px";this._selectionObj.style.height="0px";this._selectionObj.style.left=a+"px";this._selectionObj.style.top=g+"px";this._selectionObj.startX=a;this._selectionObj.startY=g};dhtmlXGridObject.prototype._ShowSelection=function(){if(this._selectionObj){this._selectionObj.style.display=""}};dhtmlXGridObject.prototype._HideSelection=function(){if(this._selectionObj){this._selectionObj.style.display="none"}this._selectionArea=null;if(this._clip_area){this._clip_area.value="";this._clip_area.blur()}};dhtmlXGridObject.prototype.copyBlockToClipboard=function(){if(!this._clip_area){return}if(this._selectionArea!=null){var g=new Array();if(this._mathSerialization){this._agetm="getMathValue"}else{if(this._strictText){this._agetm="getTitle"}else{this._agetm="getValue"}}this._serialize_visible=true;for(var a=this._selectionArea.LeftTopRow;a<=this._selectionArea.RightBottomRow;a++){var c=this._serializeRowToCVS(this.rowsBuffer[a],null,this._selectionArea.LeftTopCol,this._selectionArea.RightBottomCol+1);if(!this._csvAID){g[g.length]=c.substr(c.indexOf(this.csv.cell)+1)}else{g[g.length]=c}}g=g.join(this._CSVRowDelimiter);this._clip_area.value=g;this._clip_area.select();this._serialize_visible=false}};dhtmlXGridObject.prototype.pasteBlockFromClipboard=function(){if(!this._clip_area){return}this._clip_area.select();var a=this;window.setTimeout(function(){a._pasteBlockFromClipboard();a=null},1)};dhtmlXGridObject.prototype._pasteBlockFromClipboard=function(){var q=this._clip_area.value;if(!q){return}if(this._selectionArea!=null){var x=this._selectionArea.LeftTopRow;var a=this._selectionArea.LeftTopCol}else{if(this.cell!=null&&!this.editor){var x=this.getRowIndex(this.cell.parentNode.idd);var a=this.cell._cellIndex}else{return false}}q=this.csvParser.unblock(q,this.csv.cell,this.csv.row);var r=x+q.length;var v=a+q[0].length;if(v>this._cCount){v=this._cCount}var m=0;for(var s=x;s<r;s++){var y=this.render_row(s);if(y==-1){continue}var g=0;for(var o=a;o<v;o++){if(this._hrrar[o]&&!this._fake){v=Math.max(v+1,this._cCount);continue}var u=this.cells3(y,o);if(u.isDisabled()){g++;continue}if(this._onEditUndoRedo){this._onEditUndoRedo(2,y.idd,o,q[m][g],u.getValue())}if(u.combo){var w=u.combo.values;for(var c=0;c<w.length;c++){if(q[m][g]==w[c]){u.setValue(u.combo.keys[c]);w=null;break}}if(w!=null&&u.editable){u.setValue(q[m][g++])}else{g++}}else{u[u.setImage?"setLabel":"setValue"](q[m][g++])}u.cell.wasChanged=true}this.callEvent("onRowPaste",[y.idd]);m++}};dhtmlXGridObject.prototype.getSelectedBlock=function(){if(this._selectionArea){return this._selectionArea}else{if(this.getSelectedRowId()!==null){return{LeftTopRow:this.getSelectedRowId(),LeftTopCol:this.getSelectedCellIndex(),RightBottomRow:this.getSelectedRowId(),RightBottomCol:this.getSelectedCellIndex()}}else{return null}}};dhtmlXGridObject.prototype.enableSmartRendering=function(g,c,a){if(arguments.length>2){if(c&&!this.rowsBuffer[c-1]){this.rowsBuffer[c-1]=0}c=a}this._srnd=dhx4.s2b(g);this._srdh=this._srdh||20;this._dpref=c||0};dhtmlXGridObject.prototype.enablePreRendering=function(a){this._srnd_pr=parseInt(a||50)};dhtmlXGridObject.prototype.forceFullLoading=function(a,l){for(var g=0;g<this.rowsBuffer.length;g++){if(!this.rowsBuffer[g]){var j=a||(this.rowsBuffer.length-g);if(this.callEvent("onDynXLS",[g,j])){var c=this;this.load(this.xmlFileUrl+dhtmlx.url(this.xmlFileUrl)+"posStart="+g+"&count="+j,function(){window.setTimeout(function(){c.forceFullLoading(a,l)},100)},this._data_type)}return}}if(l){l.call(this)}};dhtmlXGridObject.prototype.setAwaitedRowHeight=function(a){this._srdh=parseInt(a)};dhtmlXGridObject.prototype._get_view_size=function(){return Math.floor(parseInt(this.entBox.offsetHeight)/this._srdh)+2};dhtmlXGridObject.prototype._add_filler=function(n,a,c,j){if(!a){return null}var m="__filler__";var l=this._prepareRow(m);l.firstChild.style.width="1px";l.firstChild.style.padding=l.firstChild.style.margin="0px";for(var g=1;g<l.childNodes.length;g++){l.childNodes[g].style.display="none"}l.firstChild.style.height=a*this._srdh+"px";c=c||this.rowsCol[n];if(c&&c.nextSibling){c.parentNode.insertBefore(l,c.nextSibling)}else{if(_isKHTML){this.obj.appendChild(l)}else{this.obj.rows[0].parentNode.appendChild(l)}}this.callEvent("onAddFiller",[n,a,l,c,j]);return[n,a,l]};dhtmlXGridObject.prototype._update_srnd_view=function(){var n=Math.floor(this.objBox.scrollTop/this._srdh);var c=n+this._get_view_size();if(this.multiLine){var o=this.objBox.scrollTop;n=0;while(o>0){o-=this.rowsCol[n]?this.rowsCol[n].offsetHeight:this._srdh;n++}c=n+this._get_view_size();if(n>0){n--}}c+=(this._srnd_pr||0);if(c>this.rowsBuffer.length){c=this.rowsBuffer.length}for(var l=n;l<c;l++){if(!this.rowsCol[l]){var m=this._add_from_buffer(l);if(m==-1){if(this.xmlFileUrl){if(this._dpref&&this.rowsBuffer[c-1]){var g=this._dpref?this._dpref:(c-l);var a=Math.max(0,Math.min(l,c-this._dpref));this._current_load=[a,c-a]}else{this._current_load=[l,(this._dpref?this._dpref:(c-l))]}if(this.callEvent("onDynXLS",this._current_load)){this.load(this.xmlFileUrl+dhtmlx.url(this.xmlFileUrl)+"posStart="+this._current_load[0]+"&count="+this._current_load[1],this._data_type)}}return}else{if(this._tgle){this._updateLine(this._h2.get[this.rowsBuffer[l].idd],this.rowsBuffer[l]);this._updateParentLine(this._h2.get[this.rowsBuffer[l].idd],this.rowsBuffer[l])}if(l&&l==(this._realfake?this._fake:this)["_r_select"]){this.selectCell(l,this.cell?this.cell._cellIndex:0,true)}}}}if(this._fake&&!this._realfake&&this.multiLine){this._fake.objBox.scrollTop=this.objBox.scrollTop}};dhtmlXGridObject.prototype._add_from_buffer=function(j){var l=this.render_row(j);if(l==-1){return -1}if(l._attrs.selected||l._attrs.select){this.selectRow(l,false,true);l._attrs.selected=l._attrs.select=null}if(!this._cssSP){if(this._cssEven&&j%2==0){l.className=this._cssEven+((l.className.indexOf("rowselected")!=-1)?" rowselected ":" ")+(l._css||"")}else{if(this._cssUnEven&&j%2==1){l.className=this._cssUnEven+((l.className.indexOf("rowselected")!=-1)?" rowselected ":" ")+(l._css||"")}}}else{if(this._h2){var a=this._h2.get[l.idd];l.className+=" "+((a.level%2)?(this._cssUnEven+" "+this._cssUnEven):(this._cssEven+" "+this._cssEven))+"_"+a.level+(this.rowsAr[a.id]._css||"")}}for(var c=0;c<this._fillers.length;c++){var g=this._fillers[c];if(g&&g[0]<=j&&(g[0]+g[1])>j){var m=j-g[0];if(m==0){this._insert_before(j,l,g[2]);this._update_fillers(c,-1,1)}else{if(m==g[1]-1){this._insert_after(j,l,g[2]);this._update_fillers(c,-1,0)}else{this._fillers.push(this._add_filler(j+1,g[1]-m-1,g[2],1));this._insert_after(j,l,g[2]);this._update_fillers(c,-g[1]+m,0)}}return}}};dhtmlXGridObject.prototype._update_fillers=function(g,a,j){var c=this._fillers[g];c[1]=c[1]+a;c[0]=c[0]+j;if(!c[1]){this.callEvent("onRemoveFiller",[c[2]]);c[2].parentNode.removeChild(c[2]);this._fillers.splice(g,1)}else{c[2].firstChild.style.height=parseFloat(c[2].firstChild.style.height)+a*this._srdh+"px";this.callEvent("onUpdateFiller",[c[2]])}};dhtmlXGridObject.prototype._insert_before=function(c,g,a){a.parentNode.insertBefore(g,a);this.rowsCol[c]=g;this.callEvent("onRowInserted",[g,null,a,"before"])};dhtmlXGridObject.prototype._insert_after=function(c,g,a){if(a.nextSibling){a.parentNode.insertBefore(g,a.nextSibling)}else{a.parentNode.appendChild(g)}this.rowsCol[c]=g;this.callEvent("onRowInserted",[g,null,a,"after"])};if(typeof(window.dhtmlxValidation)!="undefined"){dhtmlxValidation.trackInput=function(g,j,c,a){dhtmlxEvent(g,"keyup",function(l){if(dhtmlxValidation._timer){window.clearTimeout(dhtmlxValidation._timer);dhtmlxValidation._timer=null}dhtmlxValidation._timer=window.setTimeout(function(){if(!dhtmlxValidation.checkInput(g,j)){if(!c||c(g,g.value,j)){g.className+=" dhtmlx_live_validation_error"}}else{g.className=g.className.replace(/[ ]*dhtmlx_live_validation_error/g,"");if(a){a(g,g.value,j)}}},250)})};dhtmlxValidation.checkInput=function(a,c){return dhtmlxValidation.checkValue(a.value,c)};dhtmlxValidation.checkValue=function(g,j){if(typeof j=="string"){j=j.split(",")}var a=true;for(var c=0;c<j.length;c++){if(!this["is"+j[c]]){alert("Incorrect validation rule: "+j[c])}else{a=a&&this["is"+j[c]](g)}}return a}}dhtmlXGridObject.prototype.enableValidation=function(c,a){c=dhx4.s2b(c);if(c){this._validators={data:[]}}else{this._validators=false}if(arguments.length>1){this._validators._live=a}if(!this._validators._event){this._validators._event=this.attachEvent("onEditCell",this.validationEvent)}};dhtmlXGridObject.prototype.setColValidators=function(a){if(!this._validators){this.enableValidation(true)}if(typeof a=="string"){a=a.split(this.delim)}this._validators.data=a};dhtmlXGridObject.prototype.validationEvent=function(m,c,j,g,o){var q=this._validators;if(!q){return true}var n=(q.data[j]||this.cells(c,j).getAttribute("validate"))||"";if(m==1&&n){var l=this.editor||(this._fake||{}).editor;if(!l){return true}l.cell.className=l.cell.className.replace(/[ ]*dhtmlx_validation_error/g,"");if(q._live){var a=this;dhtmlxValidation.trackInput(l.getInput(),n,function(r,s,u){return a.callEvent("onLiveValidationError",[c,j,s,r,u])},function(r,s,u){return a.callEvent("onLiveValidationCorrect",[c,j,s,r,u])})}}if(m==2){this.validateCell(c,j,n,g)}return true};dhtmlXGridObject.prototype.validateCell=function(n,l,m,j){m=m||(this._validators.data[l]||this.cells(n,l).getAttribute("validate"));j=j||this.cells(n,l).getValue();if(!m){return}var c=this.cells(n,l).cell;var a=true;if(typeof m=="string"){m=m.split(this.delim)}for(var g=0;g<m.length;g++){if(!dhtmlxValidation.checkValue(j,m[g])){if(this.callEvent("onValidationError",[n,l,j,m[g]])){c.className+=" dhtmlx_validation_error"}a=false}}if(a){this.callEvent("onValidationCorrect",[n,l,j,m]);c.className=c.className.replace(/[ ]*dhtmlx_validation_error/g,"")}return a};function eXcell_stree(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._sub_trees){return}this._sub=this.grid._sub_trees[a._cellIndex];if(!this._sub){return}this._sub=this._sub[0]}this.getValue=function(){return this.cell._val};this.setValue=function(c){this.cell._val=c;c=this._sub.getItemText(this.cell._val);this.setCValue((c||"&nbsp;"),c)};this.edit=function(){this._sub.parentObject.style.display="block";var g=this.grid.getPosition(this.cell);this._sub.parentObject.style.top=g[1]+"px";this._sub.parentObject.style.left=g[0]+"px";this._sub.parentObject.style.position="absolute";var c=this.grid.editStop;this.grid.editStop=function(){};this.grid.editStop=c};this.detach=function(){this._sub.parentObject.style.display="none";if(this.grid._sub_id!=null){var c=this.cell._val;this.setValue(this._sub.getSelectedItemId());this.grid._sub_id=null;return this.cell._val!=c}}}eXcell_stree.prototype=new eXcell;dhtmlXGridObject.prototype.setSubTree=function(a,c){if(!this._sub_trees){this._sub_trees=[]}this._sub_trees[c]=[a];a.parentObject.style.display="none";var g=this;a.parentObject.onclick=function(j){(j||window.event).cancelBubble=true;return false};a.ev_onDblClick=null;a.attachEvent("onDblClick",function(j){g._sub_id=j;g.editStop();return true});a._chRRS=true};function eXcell_link(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.isDisabled=function(){return true};this.edit=function(){};this.getValue=function(){if(this.cell.firstChild.getAttribute){var c=this.cell.firstChild.getAttribute("target");return this.cell.firstChild.innerHTML+"^"+this.cell.firstChild.getAttribute("href")+(c?("^"+c):"")}else{return""}};this.setValue=function(g){if((typeof(g)!="number")&&(!g||g.toString()._dhx_trim()=="")){this.setCValue("&nbsp;",c);return(this.cell._clearCell=true)}var c=g.split("^");if(c.length==1){c[1]=""}else{if(c.length>1){c[1]="href='"+c[1]+"'";if(c.length==3){c[1]+=" target='"+c[2]+"'"}else{c[1]+=" target='_blank'"}}}this.setCValue("<a "+c[1]+" onclick='(_isIE?event:arguments[0]).cancelBubble = true;'>"+c[0]+"</a>",c)}}eXcell_link.prototype=new eXcell;eXcell_link.prototype.getTitle=function(){var a=this.cell.firstChild;return((a&&a.tagName)?a.getAttribute("href"):"")};eXcell_link.prototype.getContent=function(){var a=this.cell.firstChild;return((a&&a.tagName)?a.innerHTML:"")};function eXcell_grid(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._sub_grids){return}this._sub=this.grid._sub_grids[a._cellIndex];if(!this._sub){return}this._sindex=this._sub[1];this._sub=this._sub[0]}this.getValue=function(){return this.cell.val};this.setValue=function(c){this.cell.val=c;if(this._sub.getRowById(c)){c=this._sub.cells(c,this._sindex);if(c){c=c.getValue()}else{c=""}}this.setCValue((c||"&nbsp;"),c)};this.edit=function(){this.val=this.cell.val;this._sub.entBox.style.display="block";var g=this.grid.getPosition(this.cell);this._sub.entBox.style.top=g[1]+"px";this._sub.entBox.style.left=g[0]+"px";this._sub.entBox.style.position="absolute";this._sub.setSizes();var c=this.grid.editStop;this.grid.editStop=function(){};if(this._sub.getRowById(this.cell.val)){this._sub.setSelectedRow(this.cell.val)}this._sub.setActive(true);this.grid.editStop=c};this.detach=function(){var c=this.cell.val;this._sub.entBox.style.display="none";if(this._sub.getSelectedId()===null){return false}this.setValue(this._sub.getSelectedId());this.grid.setActive(true);return this.cell.val!=c}}eXcell_grid.prototype=new eXcell;dhtmlXGridObject.prototype.setSubGrid=function(c,a,j){if(!this._sub_grids){this._sub_grids=[]}this._sub_grids[a]=[c,j];c.entBox.style.display="none";var g=this;c.entBox.onclick=function(l){(l||window.event).cancelBubble=true;return false};c.attachEvent("onRowSelect",function(l){g.editStop();return true});c._chRRS=false};function eXcell_dhxCalendar(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._grid_calendarA){var g=this.grid._grid_calendarA=new dhtmlxCalendarObject();this.grid.callEvent("onDhxCalendarCreated",[g]);var c=this.grid;g.attachEvent("onClick",function(){this._last_operation_calendar=true;window.setTimeout(function(){c.editStop()},1);return true});var j=function(l){(l||event).cancelBubble=true};dhtmlxEvent(g.base,"click",j);g=null}}}eXcell_dhxCalendar.prototype=new eXcell;eXcell_dhxCalendar.prototype.edit=function(){var c=this.grid.getPosition(this.cell);this.grid._grid_calendarA._show(false,false);this.grid._grid_calendarA.setPosition(c[0],c[1]+this.cell.offsetHeight);this.grid._grid_calendarA._last_operation_calendar=false;this.grid.callEvent("onCalendarShow",[this.grid._grid_calendarA,this.cell.parentNode.idd,this.cell._cellIndex]);this.cell._cediton=true;this.val=this.cell.val;this._val=this.cell.innerHTML;var a=this.grid._grid_calendarA.draw;this.grid._grid_calendarA.draw=function(){};this.grid._grid_calendarA.setDateFormat((this.grid._dtmask||"%d/%m/%Y"));this.grid._grid_calendarA.setDate(this.val||(new Date()));this.grid._grid_calendarA.draw=a};eXcell_dhxCalendar.prototype.getDate=function(){if(this.cell.val){return this.cell.val}return null};eXcell_dhxCalendar.prototype.getValue=function(){if(this.cell._clearCell){return""}if(this.grid._dtmask_inc&&this.cell.val){return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc,this.cell.val).toString()}return this.cell.innerHTML.toString()._dhx_trim()};eXcell_dhxCalendar.prototype.detach=function(){if(!this.grid._grid_calendarA){return}this.grid._grid_calendarA.hide();if(this.cell._cediton){this.cell._cediton=false}else{return}if(this.grid._grid_calendarA._last_operation_calendar){var g=this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"));var c=this.grid._grid_calendarA.getDate();this.cell.val=new Date(c);this.setCValue(g,c);this.cell._clearCell=!g;var a=this.val;this.val=this._val;return(this.cell.val.valueOf()!=a)}return false};eXcell_dhxCalendar.prototype.setValue=function(a){if(a&&typeof a=="object"){this.cell.val=a;this.cell._clearCell=false;this.setCValue(this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),a).toString(),this.cell.val);return}if(!a||a.toString()._dhx_trim()==""){a="&nbsp";this.cell._clearCell=true;this.cell.val=""}else{this.cell._clearCell=false;this.cell.val=new Date(this.grid._grid_calendarA.setFormatedDate((this.grid._dtmask_inc||this.grid._dtmask||"%d/%m/%Y"),a.toString(),null,true));if(this.grid._dtmask_inc){a=this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),this.cell.val)}}if((this.cell.val=="NaN")||(this.cell.val=="Invalid Date")){this.cell._clearCell=true;this.cell.val=new Date();this.setCValue("&nbsp;",0)}else{this.setCValue((a||"").toString(),this.cell.val)}};function eXcell_dhxCalendarA(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._grid_calendarA){var g=this.grid._grid_calendarA=new dhtmlxCalendarObject();this.grid.callEvent("onDhxCalendarCreated",[g]);var c=this.grid;g.attachEvent("onClick",function(){this._last_operation_calendar=true;window.setTimeout(function(){c.editStop()},1);return true});var j=function(l){(l||event).cancelBubble=true};dhtmlxEvent(g.base,"click",j)}}}eXcell_dhxCalendarA.prototype=new eXcell;eXcell_dhxCalendarA.prototype.edit=function(){var c=this.grid.getPosition(this.cell);this.grid._grid_calendarA._show(false,false);this.grid._grid_calendarA.setPosition(c[0]*1+this.cell.offsetWidth,c[1]*1);this.grid.callEvent("onCalendarShow",[this.grid._grid_calendarA,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid._grid_calendarA._last_operation_calendar=false;this.cell._cediton=true;this.val=this.cell.val;this._val=this.cell.innerHTML;var a=this.grid._grid_calendarA.draw;this.grid._grid_calendarA.draw=function(){};this.grid._grid_calendarA.setDateFormat((this.grid._dtmask||"%d/%m/%Y"));this.grid._grid_calendarA.setDate(this.val);this.grid._grid_calendarA.draw=a;this.cell.atag=((!this.grid.multiLine)&&(_isKHTML||_isMacOS||_isFF))?"INPUT":"TEXTAREA";this.obj=document.createElement(this.cell.atag);this.obj.style.height=(this.cell.offsetHeight-4)+"px";this.obj.className="dhx_combo_edit";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.align;this.obj.onclick=function(g){(g||event).cancelBubble=true};this.obj.onmousedown=function(g){(g||event).cancelBubble=true};this.obj.value=this.getValue();this.cell.innerHTML="";this.cell.appendChild(this.obj);if(window.dhx4.isIE){this.obj.style.overflow="visible";if((this.grid.multiLine)&&(this.obj.offsetHeight>=18)&&(this.obj.offsetHeight<40)){this.obj.style.height="36px";this.obj.style.overflow="scroll"}}this.obj.onselectstart=function(g){if(!g){g=event}g.cancelBubble=true;return true};this.obj.focus();this.obj.focus()};eXcell_dhxCalendarA.prototype.getDate=function(){if(this.cell.val){return this.cell.val}return null};eXcell_dhxCalendarA.prototype.getValue=function(){if(this.cell._clearCell){return""}if(this.grid._dtmask_inc&&this.cell.val){return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc,this.cell.val).toString()}return this.cell.innerHTML.toString()._dhx_trim()};eXcell_dhxCalendarA.prototype.detach=function(){if(!this.grid._grid_calendarA){return}this.grid._grid_calendarA.hide();if(this.cell._cediton){this.cell._cediton=false}else{return}if(this.grid._grid_calendarA._last_operation_calendar){this.grid._grid_calendarA._last_operation_calendar=false;var g=this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y");var c=this.grid._grid_calendarA.getDate();this.cell.val=new Date(c);this.setCValue(g,c);this.cell._clearCell=!g;var a=this.val;this.val=this._val;return(this.cell.val.valueOf()!=(a|"").valueOf())}this.setValue(this.obj.value);var a=this.val;this.val=this._val;return(this.cell.val.valueOf()!=(a||"").valueOf())};eXcell_dhxCalendarA.prototype.setValue=function(a){if(a&&typeof a=="object"){this.cell.val=a;this.cell._clearCell=false;this.setCValue(this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),a).toString(),this.cell.val);return}if(!a||a.toString()._dhx_trim()==""){a="&nbsp";this.cell._clearCell=true;this.cell.val=""}else{this.cell._clearCell=false;this.cell.val=new Date(this.grid._grid_calendarA.setFormatedDate((this.grid._dtmask_inc||this.grid._dtmask||"%d/%m/%Y"),a.toString(),null,true));if(this.grid._dtmask_inc){a=this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),this.cell.val)}}if((this.cell.val=="NaN")||(this.cell.val=="Invalid Date")){this.cell.val=new Date();this.cell._clearCell=true;this.setCValue("&nbsp;",0)}else{this.setCValue((a||"").toString(),this.cell.val)}};function eXcell_cntr(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._ex_cntr_ready&&!this._realfake){this.grid._ex_cntr_ready=true;if(this.grid._h2){this.grid.attachEvent("onOpenEn",function(g){this.resetCounter(a._cellIndex)})}var c=function(){var g=this;window.setTimeout(function(){if(!g.resetCounter){return}if(g._fake&&!g._realfake&&a._cellIndex<g._fake._cCount){g._fake.resetCounter(a._cellIndex)}else{g.resetCounter(a._cellIndex)}},1);return true};this.grid.attachEvent("onBeforeSorting",c);this.grid.attachEvent("onFilterEnd",c)}this.edit=function(){};this.getValue=function(){return this.cell.innerHTML};this.setValue=function(j){this.cell.style.paddingRight="2px";var g=this.cell;window.setTimeout(function(){if(!g.parentNode){return}var l=g.parentNode.rowIndex;if(g.parentNode.grid.currentPage||l<0||g.parentNode.grid._srnd){l=g.parentNode.grid.rowsBuffer._dhx_find(g.parentNode)+1}if(l<=0){return}g.innerHTML=l;if(g.parentNode.grid._fake&&g._cellIndex<g.parentNode.grid._fake._cCount&&g.parentNode.grid._fake.rowsAr[g.parentNode.idd]){g.parentNode.grid._fake.cells(g.parentNode.idd,g._cellIndex).setCValue(l)}g=null},100)}}dhtmlXGridObject.prototype.resetCounter=function(c){if(this._fake&&!this._realfake&&c<this._fake._cCount){this._fake.resetCounter(c,this.currentPage)}var a=arguments[0]||0;if(this.currentPage){a=(this.currentPage-1)*this.rowsBufferOutSize}for(a=0;a<this.rowsBuffer.length;a++){if(this.rowsBuffer[a]&&this.rowsBuffer[a].tagName=="TR"&&this.rowsAr[this.rowsBuffer[a].idd]){this.rowsAr[this.rowsBuffer[a].idd].childNodes[c].innerHTML=a+1}}};eXcell_cntr.prototype=new eXcell;function eXcell_acheck(a){try{this.cell=a;this.grid=this.cell.parentNode.grid;this.cell.obj=this}catch(c){}this.changeState=function(){if((!this.grid.isEditable)||(this.cell.parentNode._locked)||(this.isDisabled())){return}if(this.grid.callEvent("onEditCell",[0,this.cell.parentNode.idd,this.cell._cellIndex])!=false){this.val=this.getValue();if(this.val=="1"){this.setValue("<checkbox state='false'>")}else{this.setValue("<checkbox state='true'>")}this.cell.wasChanged=true;this.grid.callEvent("onEditCell",[1,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid.callEvent("onCheck",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")]);this.grid.callEvent("onCheckbox",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")])}else{this.editor=null}};this.getValue=function(){try{return this.cell.chstate.toString()}catch(g){return null}};this.isCheckbox=function(){return true};this.isChecked=function(){if(this.getValue()=="1"){return true}else{return false}};this.setChecked=function(g){this.setValue(g.toString())};this.detach=function(){return this.val!=this.getValue()};this.drawCurrentState=function(){if(this.cell.chstate==1){return"<div  onclick='(new eXcell_acheck(this.parentNode)).changeState(); (arguments[0]||event).cancelBubble=true;'  style='cursor:pointer; font-weight:bold; text-align:center; '><span style='height:8px; width:8px; background:green; display:inline-block;'></span>&nbsp;Yes</div>"}else{return"<div  onclick='(new eXcell_acheck(this.parentNode)).changeState(); (arguments[0]||event).cancelBubble=true;' style='cursor:pointer;  text-align:center; '><span style='height:8px; width:8px; background:red; display:inline-block;'></span>&nbsp;No</div>"}}}eXcell_acheck.prototype=new eXcell;eXcell_acheck.prototype.setValue=function(c){c=(c||"").toString();if(c.indexOf("1")!=-1||c.indexOf("true")!=-1){c="1";this.cell.chstate="1"}else{c="0";this.cell.chstate="0"}var a=this;this.setCValue(this.drawCurrentState(),this.cell.chstate)};function eXcell_context(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._sub_context){return}this._sub=this.grid._sub_context[a._cellIndex];if(!this._sub){return}this._sindex=this._sub[1];this._sub=this._sub[0]}this.getValue=function(){return _isIE?this.cell.innerText:this.cell.textContent};this.setValue=function(g){this.cell._val=g;var c=this._sub.itemPull[this._sub.idPrefix+this.cell._val];g=c?c.title:g;this.setCValue((g||"&nbsp;"),g)};this.edit=function(){var g=this.grid.getPosition(this.cell);this._sub.showContextMenu(g[0]+this.cell.offsetWidth,g[1]);var c=this.grid.editStop;this.grid.editStop=function(){};this.grid.editStop=c};this.detach=function(){if(this.grid._sub_id!=null){var c=this.cell._val;this.setValue(this.grid._sub_id);this.grid._sub_id=null;return this.cell._val!=c}this._sub.hideContextMenu()}}eXcell_context.prototype=new eXcell;dhtmlXGridObject.prototype.setSubContext=function(a,c,j){var g=this;a.attachEvent("onClick",function(m,l){g._sub_id=m;g.editStop();a.hideContextMenu();return true});if(!this._sub_context){this._sub_context=[]}this._sub_context[c]=[a,j];a.hideContextMenu()};function dhtmlXGridFromTable(obj,init){if(typeof(obj)!="object"){obj=document.getElementById(obj)}var w=document.createElement("DIV");w.setAttribute("width",obj.getAttribute("gridWidth")||(obj.offsetWidth?(obj.offsetWidth+"px"):0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["width"]:(obj.currentStyle?obj.currentStyle.width:0)));w.setAttribute("height",obj.getAttribute("gridHeight")||(obj.offsetHeight?(obj.offsetHeight+"px"):0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["height"]:(obj.currentStyle?obj.currentStyle.height:0)));w.className=obj.className;obj.className="";if(obj.id){w.id=obj.id}var mr=obj;var drag=obj.getAttribute("dragAndDrop");mr.parentNode.insertBefore(w,mr);var f=mr.getAttribute("name")||("name_"+(new Date()).valueOf());var windowf=new dhtmlXGridObject(w);window[f]=windowf;var acs=mr.getAttribute("onbeforeinit");var acs2=mr.getAttribute("oninit");if(acs){eval(acs)}windowf.setImagePath(windowf.imgURL||(mr.getAttribute("imgpath")||mr.getAttribute("image_path")||""));var skin=mr.getAttribute("skin");if(skin){windowf.setSkin(skin)}if(init){init(windowf)}var hrow=mr.rows[0];var za="";var zb="";var zc="";var zd="";var ze="";for(var i=0;i<hrow.cells.length;i++){za+=(za?",":"")+hrow.cells[i].innerHTML;var width=hrow.cells[i].getAttribute("width")||hrow.cells[i].offsetWidth||(window.getComputedStyle?window.getComputedStyle(hrow.cells[i],null)["width"]:(hrow.cells[i].currentStyle?hrow.cells[i].currentStyle.width:0));zb+=(zb?",":"")+(width=="*"?width:parseInt(width));zc+=(zc?",":"")+(hrow.cells[i].getAttribute("align")||"left");zd+=(zd?",":"")+(hrow.cells[i].getAttribute("type")||"ed");ze+=(ze?",":"")+(hrow.cells[i].getAttribute("sort")||"str");var f_a=hrow.cells[i].getAttribute("format");if(f_a){if(hrow.cells[i].getAttribute("type").toLowerCase().indexOf("calendar")!=-1){windowf._dtmask=f_a}else{windowf.setNumberFormat(f_a,i)}}}windowf.setHeader(za);windowf.setInitWidths(zb);windowf.setColAlign(zc);windowf.setColTypes(zd);windowf.setColSorting(ze);if(obj.getAttribute("gridHeight")=="auto"){windowf.enableAutoHeigth(true)}if(obj.getAttribute("multiline")){windowf.enableMultiline(true)}var lmn=mr.getAttribute("lightnavigation");if(lmn){windowf.enableLightMouseNavigation(lmn)}var evr=mr.getAttribute("evenrow");var uevr=mr.getAttribute("unevenrow");if(evr||uevr){windowf.enableAlterCss(evr,uevr)}if(drag){windowf.enableDragAndDrop(true)}windowf.init();if(obj.getAttribute("split")){windowf.splitAt(obj.getAttribute("split"))}windowf._process_inner_html(mr,1);if(acs2){eval(acs2)}if(obj.parentNode&&obj.parentNode.removeChild){obj.parentNode.removeChild(obj)}return windowf}dhtmlXGridObject.prototype._process_html=function(c){if(c.tagName&&c.tagName=="TABLE"){return this._process_inner_html(c,0)}var a=document.createElement("DIV");a.innerHTML=c.xmlDoc.responseText;var g=a.getElementsByTagName("TABLE")[0];this._process_inner_html(g,0)};dhtmlXGridObject.prototype._process_inner_html=function(g,m){var c=g.rows.length;for(var a=m;a<c;a++){var l=g.rows[a].getAttribute("id")||a;this.rowsBuffer.push({idd:l,data:g.rows[a],_parser:this._process_html_row,_locator:this._get_html_data})}this.render_dataset();this.setSizes()};dhtmlXGridObject.prototype._process_html_row=function(q,m){var o=m.getElementsByTagName("TD");var c=[];q._attrs=this._xml_attrs(m);for(var l=0;l<o.length;l++){var n=o[l];var a=n.getAttribute("type");if(q.childNodes[l]){if(a){q.childNodes[l]._cellType=a}q.childNodes[l]._attrs=this._xml_attrs(o[l])}if(n.firstChild){c.push(n.innerHTML)}else{c.push("")}if(n.colSpan>1){q.childNodes[l]._attrs.colspan=n.colSpan;for(var g=1;g<n.colSpan;g++){c.push("")}}}for(l<o.length;l<q.childNodes.length;l++){q.childNodes[l]._attrs={}}this._fillRow(q,(this._c_order?this._swapColumns(c):c));return q};dhtmlXGridObject.prototype._get_html_data=function(c,a){c=c.firstChild;while(true){if(!c){return""}if(c.tagName=="TD"){a--}if(a<0){break}c=c.nextSibling}return(c.firstChild?c.firstChild.data:"")};dhtmlxEvent(window,"load",function(){var g=document.getElementsByTagName("table");for(var c=0;c<g.length;c++){if(g[c].className=="dhtmlxGrid"){dhtmlXGridFromTable(g[c])}}});function dhtmlXForm(l,j,m){this.idef={position:"label-left",labelWidth:"auto",labelHeight:"auto",inputWidth:"auto",inputHeight:"auto",labelAlign:"left",noteWidth:"auto",offsetTop:0,offsetLeft:0,blockOffset:20};this.idef_const={offsetNested:20};this.apos_css={"label-left":"dhxform_item_label_left","label-right":"dhxform_item_label_right","label-top":"dhxform_item_label_top","label-bottom":"dhxform_item_label_bottom",absolute:"dhxform_item_absolute"};this.align_css={left:"dhxform_label_align_left",center:"dhxform_label_align_center",right:"dhxform_label_align_right"};var g=this;this.setSkin=function(a){this.skin=a;this.cont.className="dhxform_obj_"+this.skin;this.cont.style.fontSize=(a=="dhx_terrace"?"13px":"12px");this._updateBlocks();this.forEachItem(function(o){var n=g.getItemType(o);if(typeof(g.items[n])!="undefined"&&typeof(g.items[n].setSkin)=="function"){g.doWithItem(o,"setSkin",a)}})};this.skin=(m||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhx_form")||"dhx_skyblue");this.separator=",";this.live_validate=false;this._type="checkbox";this._rGroup="default";this._idIndex={};this._indexId=[];this.cont=(typeof(l)=="object"?l:document.getElementById(l));if(!l._isNestedForm){this._parentForm=true;this.cont.style.fontSize=(this.skin=="dhx_terrace"?"13px":"12px");this.cont.className="dhxform_obj_"+this.skin;this.setFontSize=function(a){this.cont.style.fontSize=a;this._updateBlocks()};this.getForm=function(){return this};this.cont.onkeypress=function(n){n=(n||event);if(n.keyCode==13){var a=(n.target||n.srcElement);if(typeof(a.tagName)!="undefined"&&String(a.tagName).toLowerCase()=="textarea"&&!n.ctrlKey){return}g.callEvent("onEnter",[])}}}this.b_index=null;this.base=[];this._prepare=function(v,x){if(this.b_index==null){this.b_index=0}else{this.b_index++}var o=null;var n=null;if(x!=null){if(x<0){x=0}var s=0;for(var a=0;a<this.cont.childNodes.length;a++){for(var u=0;u<this.cont.childNodes[a].childNodes.length;u++){if(n==null&&this.cont.childNodes[a].childNodes[u]._isNestedForm!=true){if(s==x){o=this.cont.childNodes[a].nextSibling;n=this.cont.childNodes[a].childNodes[u]}s++}}}}this.base[this.b_index]=document.createElement("DIV");this.base[this.b_index].className="dhxform_base";if(typeof(v)!="undefined"){this.base[this.b_index].style.cssText+=" margin-left:"+v+"px!important;"}if(o!=null){this.cont.insertBefore(this.base[this.b_index],o);o=null}else{this.cont.appendChild(this.base[this.b_index])}if(n!=null){while(n!=null){var r=n;n=n.nextSibling;this.base[this.b_index].appendChild(r);r=null}}};this.setSizes=function(){};this._mergeSettings=function(v){var o=-1;var r={type:"settings"};for(var n in this.idef){r[n]=this.idef[n]}for(var s=0;s<v.length;s++){if(typeof(v[s])!="undefined"&&v[s].type=="settings"){for(var n in v[s]){r[n]=v[s][n]}o=s}}v[o>=0?o:v.length]=r;return v};this._genStr=function(a){var n="";var r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var o=0;o<a;o++){n+=r.charAt(Math.floor(Math.random()*r.length))}return n};this.idPrefix="dhxForm_"+this._genStr(12)+"_";this._rId=(this._parentForm?this._genStr(12)+"_":l._rId);this.objPull={};this.itemPull={};this._ic=0;this._addItem=function(F,s,y,v,D,H,C){if(this.items[F]._index){this.getForm()._indexId.push(s);this.getForm()._idIndex[s]={ind:this.getForm()._indexId.length-1}}if(!F){F=this._type}if(F=="list"&&D!=null&&this.itemPull[this.idPrefix+D]!=null&&typeof(this.itemPull[this.idPrefix+D]._addSubListNode)=="function"){var E=this.itemPull[this.idPrefix+D]._addSubListNode()}else{if(F=="newcolumn"){var E={}}else{var u=this.base[this.b_index];var n=null;if(typeof(H)!="undefined"&&!isNaN(H)&&F!="list"){H=Math.max(parseInt(H),0)+1;for(var J=0;J<this.cont.childNodes.length;J++){for(var o=0;o<this.cont.childNodes[J].childNodes.length;o++){if(n==null&&this.cont.childNodes[J].childNodes[o]._isNestedForm!=true){H--;if(H==0){n=this.cont.childNodes[J].childNodes[o];u=this.cont.childNodes[J]}}}}}else{if(F=="list"){for(var I in this.itemPull){if(I==this.idPrefix+s){n=this.itemPull[I].nextSibling;if(this.itemPull[I]._listBase!=null&&this.itemPull[I]._listBase.length>0){n=this.itemPull[I]._listBase[this.itemPull[I]._listBase.length-1]}}}}}var E=document.createElement("DIV");if(C==true&&n!=null){n=n.nextSibling}if(n!=null){u.insertBefore(E,n)}else{u.appendChild(E)}}}E._idd=s;E._rId=this._rId;if(typeof(E.style)!="undefined"){if(typeof(y.offsetLeft)=="undefined"&&this.idef.offsetLeft>0){y.offsetLeft=this.idef.offsetLeft}if(typeof(y.offsetTop)=="undefined"&&this.idef.offsetTop>0){y.offsetTop=this.idef.offsetTop}var x="";if(typeof(y.offsetLeft)!="undefined"){x+=" padding-left:"+y.offsetLeft+"px!important;"}if(typeof(y.offsetTop)!="undefined"){x+=" padding-top:"+y.offsetTop+"px!important;"}E.style.cssText+=x}if(F=="block"){if(isNaN(y.blockOffset)){y.blockOffset=this.idef.blockOffset}}if(F=="list"){if(typeof(E._ofsNested)=="undefined"){E._ofsNested=this.idef_const.offsetNested}if(v!=null){E._sId=v}var A=this.items[F].render(E,this.skin);if(!this.itemPull[this.idPrefix+s]._listObj){this.itemPull[this.idPrefix+s]._listObj=[]}if(!this.itemPull[this.idPrefix+s]._list){this.itemPull[this.idPrefix+s]._list=[]}if(!this.itemPull[this.idPrefix+s]._listBase){this.itemPull[this.idPrefix+s]._listBase=[]}(this.itemPull[this.idPrefix+s]._listObj).push(A[0]);(this.itemPull[this.idPrefix+s]._list).push(A[1]);(this.itemPull[this.idPrefix+s]._listBase).push(E);A[1].checkEvent=function(a){return g.checkEvent(a)};A[1].callEvent=function(a,q){return g.callEvent(a,q)};A[1].getForm=function(){return g.getForm()};A[1]._initObj(this._mergeSettings(y));if(E._inBlcok){E.className+=" in_block"}return A[1]}if(F=="newcolumn"){this._prepare(y.offset,H);return}if(F=="label"&&this._ic++==0){y._isTopmost=true}y.position=this.apos_css[(!y.position||!this.apos_css[y.position]?this.idef.position:y.position)];E.className=y.position+(typeof(y.className)=="string"?" "+y.className:"");if(!y.labelWidth){y.labelWidth=this.idef.labelWidth}if(!y.labelHeight){y.labelHeight=this.idef.labelHeight}if(typeof(y.wrap)!="undefined"){y.wrap=window.dhx4.s2b(y.wrap)}y.labelAlign=(this.align_css[y.labelAlign]?this.align_css[y.labelAlign]:this.align_css[this.idef.labelAlign]);y.inputWidth=(y.width?y.width:(y.inputWidth?y.inputWidth:this.idef.inputWidth));if(!y.inputHeight){y.inputHeight=this.idef.inputHeight}if(typeof(y.note)!="undefined"){if(y.note.length!=null&&y.note[0]!=null){y.note=y.note[0]}if(typeof(y.note.width)=="undefined"){y.note.width=this.idef.noteWidth}if(y.note.width=="auto"){y.note.width=y.inputWidth}}E.checkEvent=function(a){return g.checkEvent(a)};E.callEvent=function(a,q){return g.callEvent(a,q)};E.getForm=function(){return g.getForm()};E._autoCheck=function(a){g._autoCheck(a)};if(typeof(y.readonly)=="string"){y.readonly=window.dhx4.s2b(y.readonly)}if(typeof(y.autoStart)=="string"){y.autoStart=window.dhx4.s2b(y.autoStart)}if(typeof(y.autoRemove)=="string"){y.autoRemove=window.dhx4.s2b(y.autoRemove)}if(typeof(y.titleScreen)=="string"){y.titleScreen=window.dhx4.s2b(y.titleScreen)}if(typeof(y.info)=="string"){y.info=window.dhx4.s2b(y.info)}if(typeof(y.hidden)=="string"){y.hidden=window.dhx4.s2b(y.hidden)}if(typeof(y.checked)=="string"){y.checked=window.dhx4.s2b(y.checked)}if(typeof(y.userdata)!="undefined"){for(var I in y.userdata){this.getForm().setUserData(s,I,y.userdata[I])}}if(y.validate){if(typeof(y.validate!="undefined")&&(typeof(y.validate)=="function"||typeof(window[y.validate])=="function")){E._validate=[y.validate]}else{E._validate=String(y.validate).split(this.separator)}}if(typeof(y.required)!="undefined"){if(typeof(y.required)=="string"){y.required=window.dhx4.s2b(y.required)}E._required=(y.required==true)}if(E._required){if(!E._validate){E._validate=[]}var r=false;for(o=0;o<E._validate.length;o++){r=(r||(E._validate[o]=="NotEmpty"))}if(!r){E._validate.push("NotEmpty")}}E._ll=(y.position==this.apos_css["label-left"]||y.position==this.apos_css["label-top"]);this.objPull[this.idPrefix+s]=this.items[F].render(E,y);this.itemPull[this.idPrefix+s]=E};this._initObj=function(s,o){if(typeof(s.data)!="undefined"){var u=null;if(typeof(o)!="undefined"){u=o.match(/(\?|\&)id\=([a-z0-9_\-]*)/i);if(u!=null&&u[0]!=null){u=u[0].split("=")[1]}}if(this.callEvent("onBeforeDataLoad",[u,window.dhx4._copyObj(s.data)])===true){this.formId=u;this._last_load_data=s;this.setFormData(s.data);this.resetDataProcessor("updated")}return}this._prepare();for(var r=0;r<s.length;r++){if(typeof(s[r])!="undefined"&&s[r].type=="settings"){for(var n in s[r]){this.idef[n]=s[r][n]}}}for(var r=0;r<s.length;r++){this._prepareItem(s[r])}this._autoCheck()};this._prepareItem=function(r,v,q){var o=(r!=null&&r.type!=null?r.type:"");if(this.items[o]){if(!r.name){r.name=this._genStr(12)}var u=r.name;if(this.objPull[this.idPrefix+u]!=null||o=="radio"){u=this._genStr(12)}var s=r;s.label=s.label||"";s.value=s.value;s.checked=window.dhx4.s2b(s.checked);s.disabled=window.dhx4.s2b(s.disabled);s.name=s.name||this._genStr(12);s.options=s.options||[];s.rows=s.rows||"none";s.uid=this._genStr(12);this._addItem(o,u,s,null,null,v,q);v=null;if(this._parentEnabled===false){this._disableItem(u)}for(var n=0;n<s.options.length;n++){if(s.options[n].list!=null){if(!s.options[n].value){s.options[n].value=this._genStr()}var a=this._addItem("list",u,s.options[n].list,s.options[n].value,null);a._subSelect=true;a._subSelectId=s.options[n].value}}if(r.list!=null){if(!r.listParent){r.listParent=s.name}var a=this._addItem("list",u,r.list,null,r.listParent)}}};this._xmlSubItems={item:"list",option:"options",note:"note",userdata:"_userdata"};this._xmlToObject=function(D,n){if(typeof(n)=="undefined"){n=true}if(n){var F=D.getElementsByTagName("items");F=(F!=null&&F[0]!=null?F[0]:null);var o=D.getElementsByTagName("data");o=(o!=null&&o[0]!=null?o[0]:null)}else{F=D}var A=(n?[]:{});if(F!=null){for(var s=0;s<F.childNodes.length;s++){if(typeof(F.childNodes[s].tagName)!="undefined"){var u=F.childNodes[s].tagName;if(this._xmlSubItems[u]!=null){var v=this._xmlSubItems[u];if(typeof(A[v])=="undefined"){A[v]=[]}var C=F.childNodes[s];var y={};for(var K=0;K<C.attributes.length;K++){var H=C.attributes[K].name;var E=C.attributes[K].value;y[H]=E}if(v=="note"){y.text=C.firstChild.nodeValue}if(v=="_userdata"){y.value=(C.firstChild!=null&&C.firstChild.nodeValue!=null?C.firstChild.nodeValue:"")}var x=this._xmlToObject(C,false);for(var I in x){if(I=="_userdata"){if(!y.userdata){y.userdata={}}for(var K=0;K<x[I].length;K++){y.userdata[x[I][K].name]=x[I][K].value}}else{y[I]=x[I]}}C=null;if(n){A.push(y)}else{A[v].push(y)}}}}}if(o!=null){A={data:{}};for(var s=0;s<o.childNodes.length;s++){if(typeof(o.childNodes[s].tagName)!="undefined"){var r=o.childNodes[s].tagName;var J=(o.childNodes[s].firstChild!=null?o.childNodes[s].firstChild.nodeValue:"");A.data[r]=J}}}return A};this._autoCheck=function(u){if(this._locked===true){u=false}else{if(typeof(u)=="undefined"){u=true}}for(var r in this.itemPull){var x=(u&&(this.itemPull[r]._udis!==true));this[x?"_enableItem":"_disableItem"](this.itemPull[r]._idd);if(this.getForm()._idIndex[this.itemPull[r]._idd]!=null){this.getForm()._idIndex[this.itemPull[r]._idd].enabled=x}var o=(x&&(typeof(this.itemPull[r]._checked)=="boolean"?this.itemPull[r]._checked:true));if(this.itemPull[r]._list){for(var A=0;A<this.itemPull[r]._list.length;A++){var y=true;if(this.itemPull[r]._list[A]._subSelect==true){y=false;var s=this.getItemValue(this.itemPull[r]._idd);if(!(typeof(s)=="object"&&typeof(s.length)=="number")){s=[s]}for(var n=0;n<s.length;n++){y=(s[n]==this.itemPull[r]._list[A]._subSelectId)||y}this.itemPull[r]._listObj[A][y?"show":"hide"](this.itemPull[r]._listBase[A])}this.itemPull[r]._list[A]._autoCheck(o&&y)}}}};this.doWithItem=function(r,n,y,x,w,v){if(typeof(r)=="object"){var C=r[0];var A=r[1];var D=null;var u=null;for(var s in this.itemPull){if((this.itemPull[s]._value==A||A===null)&&this.itemPull[s]._group==C){return this.objPull[s][n](this.itemPull[s],y,x,w,v)}if(this.itemPull[s]._list!=null&&!u){for(var o=0;o<this.itemPull[s]._list.length;o++){u=this.itemPull[s]._list[o].doWithItem(r,n,y,x,w)}}}if(u!=null){return u}else{if(n=="getType"){return this.doWithItem(r[0],"getType")}}}else{if(!this.itemPull[this.idPrefix+r]){var u=null;for(var s in this.itemPull){if(this.itemPull[s]._list&&!u){for(var o=0;o<this.itemPull[s]._list.length;o++){if(u==null){u=this.itemPull[s]._list[o].doWithItem(r,n,y,x,w,v)}}}}return u}else{return this.objPull[this.idPrefix+r][n](this.itemPull[this.idPrefix+r],y,x,w,v)}}};this._removeItem=function(n,a){if(a!=null){n=this.doWithItem([n,a],"destruct")}else{this.doWithItem(n,"destruct")}this._clearItemData(n)};this._clearItemData=function(r){if(this.itemPull[this.idPrefix+r]){r=this.idPrefix+r;try{this.objPull[r]=null;this.itemPull[r]=null;delete this.objPull[r];delete this.itemPull[r]}catch(o){}}else{for(var a in this.itemPull){if(this.itemPull[a]._list){for(var n=0;n<this.itemPull[a]._list.length;n++){this.itemPull[a]._list[n]._clearItemData(r)}}}}};this.isItem=function(n,a){if(a!=null){n=[n,a]}return this.doWithItem(n,"isExist")};this.getItemType=function(n,a){n=[n,(a||null)];return this.doWithItem(n,"getType")};this.forEachItem=function(o){for(var n in this.objPull){if(this.objPull[n].t=="radio"){o(this.itemPull[n]._group,this.itemPull[n]._value)}else{o(String(n).replace(this.idPrefix,""))}if(this.itemPull[n]._list){for(var r=0;r<this.itemPull[n]._list.length;r++){this.itemPull[n]._list[r].forEachItem(o)}}}};this.setItemLabel=function(o,a,n){if(n!=null){o=[o,a]}else{n=a}this.doWithItem(o,"setText",n)};this.getItemLabel=function(n,a){if(a!=null){n=[n,a]}return this.doWithItem(n,"getText")};this._enableItem=function(a){this.doWithItem(a,"enable")};this._disableItem=function(a){this.doWithItem(a,"disable")};this._isItemEnabled=function(a){return this.doWithItem(a,"isEnabled")};this.checkItem=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"check");this._autoCheck()};this.uncheckItem=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"unCheck");this._autoCheck()};this.isItemChecked=function(n,a){if(a!=null){n=[n,a]}return this.doWithItem(n,"isChecked")};this.getCheckedValue=function(a){return this.doWithItem([a,null],"getChecked")};this._getRGroup=function(v,u){for(var n in this.itemPull){if(this.itemPull[n]._group==v&&(u==null||this.itemPull[n]._value==u)){return this.itemPull[n]._idd}if(this.itemPull[n]._list!=null){for(var s=0;s<this.itemPull[n]._list.length;s++){var o=this.itemPull[n]._list[s]._getRGroup(v,u);if(o!=null){return o}}}}return null};this.setItemValue=function(n,a){this.resetValidateCss(n,a);if(this.getItemType(n)=="radio"){if(this._getRGroup(n,a)!=null){this.checkItem(n,a)}else{this.uncheckItem(n,this.getCheckedValue(n))}return null}return this.doWithItem(n,"setValue",a)};this.getItemValue=function(n,a){if(this.getItemType(n)=="radio"){return this.getCheckedValue(n)}return this.doWithItem(n,"getValue",a)};this.updateValues=function(){this._updateValues()};this.showItem=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"show")};this.hideItem=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"hide")};this.isItemHidden=function(n,a){if(a!=null){n=[n,a]}return this.doWithItem(n,"isHidden")};this.getOptions=function(a){return this.doWithItem(a,"getOptions")};this.setItemWidth=function(n,a){this.doWithItem(n,"setWidth",a)};this.getItemWidth=function(a){return this.doWithItem(a,"getWidth")};this.setItemHeight=function(n,a){this.doWithItem(n,"setHeight",a)};this.setItemFocus=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"setFocus")};this._updateValues=function(){for(var n in this.itemPull){if(this.objPull[n]&&typeof(this.objPull[n].updateValue)=="function"){this.objPull[n].updateValue(this.itemPull[n])}if(this.itemPull[n]._list){for(var o=0;o<this.itemPull[n]._list.length;o++){this.itemPull[n]._list[o]._updateValues()}}}};this._getItemByName=function(u){for(var n in this.itemPull){if(this.itemPull[n]._idd==u){return this.itemPull[n]}if(this.itemPull[n]._list!=null){for(var s=0;s<this.itemPull[n]._list.length;s++){var o=this.itemPull[n]._list[s]._getItemByName(u);if(o!=null){return o}}}}return null};this._resetValidateCss=function(a){a.className=(a.className).replace(a._vcss,"");a._vcss=null};this.setValidateCss=function(a,q,o){var n=this[this.getItemType(a)=="radio"?"_getRGroup":"_getItemByName"](a);if(!n){return}if(n._vcss!=null){this._resetValidateCss(n)}n._vcss=(typeof(o)=="string"?o:"validate_"+(q===true?"ok":"error"));n.className+=" "+n._vcss};this.resetValidateCss=function(o){for(var n in this.itemPull){if(this.itemPull[n]._vcss!=null){this._resetValidateCss(this.itemPull[n])}if(this.itemPull[n]._list!=null){for(var r=0;r<this.itemPull[n]._list.length;r++){this.itemPull[n]._list[r].resetValidateCss()}}}};this.validate=function(n){if(this.callEvent("onBeforeValidate",[])==false){return}var a=true;this.forEachItem(function(q,r){if(typeof(r)!="undefined"){q=[q,r]}var o=g.doWithItem(q,"_validate");if(typeof(o)!="boolean"){o=true}a=o&&a});this.callEvent("onAfterValidate",[a]);return a};this.validateItem=function(a,n){if(typeof(n)!="undefined"){a=[a,n]}return this.doWithItem(a,"_validate")};this.enableLiveValidation=function(a){this.live_validate=(a==true)};this.setReadonly=function(n,a){this.doWithItem(n,"setReadonly",a)};this.isReadonly=function(a){return this.doWithItem(a,"isReadonly")};this.getFirstActive=function(n){for(var r=0;r<this._indexId.length;r++){var a=true;if(n==true){var o=this.getItemType(this._indexId[r]);if(!dhtmlXForm.prototype.items[o].setFocus){a=false}}if(a&&this._idIndex[this._indexId[r]].enabled){return this._indexId[r]}}return null};this.setFocusOnFirstActive=function(){var a=this.getFirstActive(true);if(a!=null){this.setItemFocus(a)}};this.enableItem=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"userEnable");this._autoCheck()};this.disableItem=function(n,a){if(a!=null){n=[n,a]}this.doWithItem(n,"userDisable");this._autoCheck()};this.isItemEnabled=function(n,a){if(a!=null){n=[n,a]}return this.doWithItem(n,"isUserEnabled")};this.clear=function(){var n={};this.formId=(new Date()).valueOf();this.resetDataProcessor("inserted");for(var o in this.itemPull){var r=this.itemPull[o]._idd;if(this.itemPull[o]._type=="ch"){this.uncheckItem(r)}if(this.itemPull[o]._type in {ta:1,editor:1,calendar:1,pw:1,hd:1}){this.setItemValue(r,"")}if(this.itemPull[o]._type=="combo"){this.itemPull[o]._apiChange=true;var w=this.getCombo(r);w.selectOption(0);w=null;this.itemPull[o]._apiChange=false}if(this.itemPull[o]._type=="se"){var u=this.getOptions(r);if(u.length>0){u[0].selected=true}}if(this.itemPull[o]._type=="ra"){var s=this.itemPull[o]._group;if(!n[s]){this.checkItem(s,this.doWithItem(r,"_getFirstValue"));n[s]=true}}if(this.itemPull[o]._list){for(var v=0;v<this.itemPull[o]._list.length;v++){this.itemPull[o]._list[v].clear()}}if(this["setFormData_"+this.itemPull[o]._type]){this["setFormData_"+this.itemPull[o]._type](r,"")}}n=null;if(this._parentForm){this._autoCheck()}this.resetValidateCss()};this.unload=function(){window.dhx4._enableDataLoading(this,null,null,null,"clear");window.dhx4._eventable(this,"clear");for(var n in this.objPull){this._removeItem(String(n).replace(this.idPrefix,""))}if(this._ccTm){window.clearTimeout(this._ccTm)}this._formLS=null;for(var o=0;o<this.base.length;o++){while(this.base[o].childNodes.length>0){this.base[o].removeChild(this.base[o].childNodes[0])}if(this.base[o].parentNode){this.base[o].parentNode.removeChild(this.base[o])}this.base[o]=null}this.base=null;this.cont.onkeypress=null;this.cont.className="";this.cont=null;for(var n in this){this[n]=null}g=null};for(var c in this.items){this.items[c].t=c;if(typeof(this.items[c]._index)=="undefined"){this.items[c]._index=true}if(!this.items[c].show){this.items[c].show=function(a){a.style.display="";if(a._listObj){for(var n=0;n<a._listObj.length;n++){a._listObj[n].show(a._listBase[n])}}}}if(!this.items[c].hide){this.items[c].hide=function(a){a.style.display="none";if(a._listObj){for(var n=0;n<a._listObj.length;n++){a._listObj[n].hide(a._listBase[n])}}}}if(!this.items[c].isHidden){this.items[c].isHidden=function(a){return(a.style.display=="none")}}if(!this.items[c].userEnable){this.items[c].userEnable=function(a){a._udis=false}}if(!this.items[c].userDisable){this.items[c].userDisable=function(a){a._udis=true}}if(!this.items[c].isUserEnabled){this.items[c].isUserEnabled=function(a){return(a._udis!==true)}}if(!this.items[c].getType){this.items[c].getType=function(){return this.t}}if(!this.items[c].isExist){this.items[c].isExist=function(){return true}}if(!this.items[c]._validate){this.items[c]._validate=function(o){if(!o._validate||!o._enabled){return true}if(o._type=="ch"){var w=(this.isChecked(o)?this.getValue(o):0)}else{var w=this.getValue(o)}var n=true;for(var u=0;u<o._validate.length;u++){var a="is"+o._validate[u];if((w==null||w.length==0)&&a!="isNotEmpty"&&o._type!="container"){}else{var s=dhtmlxValidation[a];if(o._type=="container"&&typeof(s)=="function"){s=function(){return true}}if(typeof(s)!="function"&&typeof(o._validate[u])=="function"){s=o._validate[u]}if(typeof(s)!="function"&&typeof(window[o._validate[u]])=="function"){s=window[o._validate[u]]}n=((typeof(s)=="function"?s(w,o._idd):new RegExp(o._validate[u]).test(w))&&n);s=null}}if(!(o.callEvent("onValidate"+(n?"Success":"Error"),[o._idd,w,n])===false)){o.getForm().setValidateCss(o._idd,n)}return n}}}this._locked=false;this._doLock=function(n){var a=(n===true?true:false);if(this._locked==a){return}else{this._locked=a}this._autoCheck(!this._locked)};this.lock=function(){this._doLock(true)};this.unlock=function(){this._doLock(false)};this.isLocked=function(){return this._locked};this.setNumberFormat=function(q,n,a,o){return this.doWithItem(q,"setNumberFormat",n,a,o)};window.dhx4._enableDataLoading(this,"_initObj","_xmlToObject","items",{struct:true,data:true});window.dhx4._eventable(this);this.attachEvent("_onButtonClick",function(a,n){this.callEvent("onButtonClick",[a,n])});this._updateBlocks=function(){this.forEachItem(function(a){if(g.getItemType(a)=="block"||g.getItemType(a)=="combo"){g.doWithItem(a,"_setCss",g.skin,g.cont.style.fontSize)}})};this._isObj=function(a){return(a!=null&&typeof(a)=="object"&&typeof(a.length)=="undefined")};this._copyObj=function(q){if(this._isObj(q)){var o={};for(var n in q){if(typeof(q[n])=="object"&&q[n]!=null){o[n]=this._copyObj(q[n])}else{o[n]=q[n]}}}else{var o=[];for(var n=0;n<q.length;n++){if(typeof(q[n])=="object"&&q[n]!=null){o[n]=this._copyObj(q[n])}else{o[n]=q[n]}}}return o};if(j!=null&&typeof(j)=="object"){this._initObj(this._copyObj(j))}if(this._parentForm){this._updateBlocks()}this._ccActive=false;this._ccTm=null;return this}dhtmlXForm.prototype.getInput=function(a){return this.doWithItem(a,"getInput")};dhtmlXForm.prototype.getSelect=function(a){return this.doWithItem(a,"getSelect")};dhtmlXForm.prototype.items={};dhtmlXForm.prototype.items.checkbox={render:function(a,c){a._type="ch";a._enabled=true;a._checked=false;a._value=(typeof(c.value)=="undefined"?null:String(c.value));a._ro=(c.readonly==true);if(c._autoInputWidth!==false){c.inputWidth=14}this.doAddLabel(a,c);this.doAddInput(a,c,"INPUT","TEXT",true,true,"dhxform_textarea");a.childNodes[a._ll?1:0].className+=" dhxform_img_node";var g=document.createElement("DIV");g.className="dhxform_img chbx0";a.appendChild(g);if(!isNaN(c.inputLeft)){a.childNodes[a._ll?1:0].style.left=parseInt(c.inputLeft)+"px"}if(!isNaN(c.inputTop)){a.childNodes[a._ll?1:0].style.top=parseInt(c.inputTop)+"px"}a.childNodes[a._ll?1:0].appendChild(g);a.childNodes[a._ll?1:0].firstChild.value=String(c.value);a._updateImgNode=function(l,m){var j=l.childNodes[l._ll?1:0].lastChild;j.className=(m?"dhxform_actv_c":"dhxform_img")+" "+(l._checked?"chbx1":"chbx0");l=j=null};a._doOnFocus=function(j){j.getForm().callEvent("onFocus",[j._idd])};a._doOnBlur=function(j){j.getForm().callEvent("onBlur",[j._idd])};a._doOnKeyUpDown=function(l,j){this.callEvent(l,[this.childNodes[this._ll?0:1].childNodes[0],j,this._idd])};if(c.checked==true){this.check(a)}if(c.hidden==true){this.hide(a)}if(c.disabled==true){this.userDisable(a)}this.doAttachEvents(a);return this},destruct:function(a){a._doOnFocus=a._doOnBlur=a._updateImgNode=null;this.doUnloadNestedLists(a);this.doDestruct(a)},doAddLabel:function(c,g){var a=document.createElement("DIV");a.className="dhxform_label "+g.labelAlign;if(g.wrap==true){a.style.whiteSpace="normal"}if(c._ll){c.insertBefore(a,c.firstChild)}else{c.appendChild(a)}if(typeof(g.tooltip)!="undefined"){a.title=g.tooltip}a.innerHTML="<div class='dhxform_label_nav_link' onfocus='if(this.parentNode.parentNode._updateImgNode)this.parentNode.parentNode._updateImgNode(this.parentNode.parentNode,true);this.parentNode.parentNode._doOnFocus(this.parentNode.parentNode);' onblur='if(this.parentNode.parentNode._updateImgNode)this.parentNode.parentNode._updateImgNode(this.parentNode.parentNode,false);this.parentNode.parentNode._doOnBlur(this.parentNode.parentNode);' onkeypress='var e=event||window.arguments[0];if(e.keyCode==32||e.charCode==32){e.cancelBubble=true;if(e.preventDefault)e.preventDefault();else e.returnValue=false;_dhxForm_doClick(this,\"mousedown\");return false;}' onkeyup='var e=event||window.arguments[0];this.parentNode.parentNode._doOnKeyUpDown(\"onKeyUp\",e);' onkeydown='var e=event||window.arguments[0];this.parentNode.parentNode._doOnKeyUpDown(\"onKeyDown\",e);' "+(window.dhx4.isIPad?"ontouchstart='var e=event;e.preventDefault();_dhxForm_doClick(this,\"mousedown\");' ":"")+"role='link' tabindex='0'>"+g.label+(g.info?"<span class='dhxform_info'>[?]</span>":"")+(c._required?"<span class='dhxform_item_required'>*</span>":"")+"</div>";if(!isNaN(g.labelWidth)){a.firstChild.style.width=parseInt(g.labelWidth)+"px"}if(!isNaN(g.labelHeight)){a.firstChild.style.height=parseInt(g.labelHeight)+"px"}if(!isNaN(g.labelLeft)){a.style.left=parseInt(g.labelLeft)+"px"}if(!isNaN(g.labelTop)){a.style.top=parseInt(g.labelTop)+"px"}},doAddInput:function(C,E,g,m,n,y,r){var x=document.createElement("DIV");x.className="dhxform_control";if(C._ll){C.appendChild(x)}else{C.insertBefore(x,C.firstChild)}var v=document.createElement(g);v.className=r;v.name=C._idd;v._idd=C._idd;v.id=E.uid;if(typeof(m)=="string"){v.type=m}if(g=="INPUT"||g=="TEXTAREA"){v.onkeyup=function(u){u=u||event;C.callEvent("onKeyUp",[this,u,this._idd])};v.onkeydown=function(u){u=u||event;C.callEvent("onKeyDown",[this,u,this._idd])}}x.appendChild(v);if(E.readonly){this.setReadonly(C,true)}if(E.hidden==true){this.hide(C)}if(E.disabled==true){this.userDisable(C)}if(n){if(!isNaN(E.inputLeft)){x.style.left=parseInt(E.inputLeft)+"px"}if(!isNaN(E.inputTop)){x.style.top=parseInt(E.inputTop)+"px"}}var s="";var l=false;if(y){if(!isNaN(E.inputWidth)){s+="width:"+parseInt(E.inputWidth)+"px;";l=true}if(!isNaN(E.inputHeight)){s+="height:"+parseInt(E.inputHeight)+"px;"}}if(typeof(E.style)=="string"){s+=E.style}v.style.cssText=s;if(E.maxLength){v.setAttribute("maxLength",E.maxLength)}if(E.connector){v.setAttribute("connector",E.connector)}var A=(dhtmlXForm.prototype.items[this.t]!=null?dhtmlXForm.prototype.items[this.t]._dimFix==true:false);if(l&&({input:1,password:1,select:1,multiselect:1,calendar:1,colorpicker:1}[this.t]==1||A)){if(dhtmlXForm.prototype.items[this.t]._dim==null){var c=document.createElement("DIV");c.className="dhxform_dim_test_"+C.getForm().skin;document.body.appendChild(c);var a=x.parentNode;var D=x.nextSibling;c.appendChild(x);var q=parseInt(v.style.width);var o=(dhx4.isFF||dhx4.isIE||dhx4.isChrome||dhx4.isOpera?v.offsetWidth:v.clientWidth);dhtmlXForm.prototype.items[this.t]._dim=o-q;if(D!=null){a.insertBefore(x,D)}else{a.appendChild(x)}c.parentNode.removeChild(c);a=D=c=null}v.style.width=parseInt(v.style.width)-dhtmlXForm.prototype.items[this.t]._dim+"px"}if(typeof(E.note)=="object"){var j=document.createElement("DIV");j.className="dhxform_note";j.style.width=(isNaN(E.note.width)?v.offsetWidth:parseInt(E.note.width))+"px";j._w=E.note.width;j.innerHTML=E.note.text;x.appendChild(j);j=null}},doUnloadNestedLists:function(a){if(!a._list){return}for(var c=0;c<a._list.length;c++){a._list[c].unload();a._list[c]=null;a._listObj[c]=null;a._listBase[c].parentNode.removeChild(a._listBase[c]);a._listBase[c]=null}a._list=null;a._listObj=null;a._listBase=null},doDestruct:function(a){a.callEvent=null;a.checkEvent=null;a.getForm=null;a._autoCheck=null;a._checked=null;a._enabled=null;a._idd=null;a._type=null;a._value=null;a._group=null;a.onselectstart=null;a.childNodes[a._ll?1:0].onmousedown=null;a.childNodes[a._ll?1:0].ontouchstart=null;a.childNodes[a._ll?0:1].onmousedown=null;a.childNodes[a._ll?0:1].ontouchstart=null;a.childNodes[a._ll?0:1].childNodes[0].onfocus=null;a.childNodes[a._ll?0:1].childNodes[0].onblur=null;a.childNodes[a._ll?0:1].childNodes[0].onkeypress=null;a.childNodes[a._ll?0:1].childNodes[0].onkeyup=null;a.childNodes[a._ll?0:1].childNodes[0].onkeydown=null;a.childNodes[a._ll?0:1].childNodes[0].onmousedown=null;a.childNodes[a._ll?0:1].childNodes[0].ontouchstart=null;a.childNodes[a._ll?0:1].removeChild(a.childNodes[a._ll?0:1].childNodes[0]);while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}a.parentNode.removeChild(a);a=null},doAttachEvents:function(c){var a=this;c.childNodes[c._ll?1:0][window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}var g=(j.target||j.srcElement);if(!this.parentNode._enabled||this.parentNode._ro||(typeof(g.className)!="undefined"&&g.className=="dhxform_note")){j.cancelBubble=true;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}return false}a.doClick(this.parentNode)};c.childNodes[c._ll?0:1].childNodes[0][window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}if(!this.parentNode.parentNode._enabled){j.cancelBubble=true;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}return false}var g=j.target||j.srcElement;if(typeof(g.className)!="undefined"&&g.className=="dhxform_info"){this.parentNode.parentNode.callEvent("onInfo",[this.parentNode.parentNode._idd]);j.cancelBubble=true;if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}return false}a.doClick(this.parentNode.parentNode)}},doClick:function(a){a.childNodes[a._ll?0:1].childNodes[0].focus();if(!a._enabled||a._ro){return}if(a.checkEvent("onBeforeChange")){if(a.callEvent("onBeforeChange",[a._idd,a._value,a._checked])!==true){return}}this.setChecked(a,!a._checked);a._autoCheck();a.callEvent("onChange",[a._idd,a._value,a._checked])},doCheckValue:function(a){if(a._checked&&a._enabled){a.childNodes[a._ll?1:0].firstChild.name=String(a._idd);a.childNodes[a._ll?1:0].firstChild.value=this.getValue(a)}else{a.childNodes[a._ll?1:0].firstChild.name="";a.childNodes[a._ll?1:0].firstChild.value=""}},setChecked:function(a,c){a._checked=(c===true?true:false);a.childNodes[a._ll?1:0].lastChild.className=a.childNodes[a._ll?1:0].lastChild.className.replace(/chbx[0-1]{1}/gi,"")+(a._checked?" chbx1":" chbx0");this.doCheckValue(a)},check:function(a){this.setChecked(a,true)},unCheck:function(a){this.setChecked(a,false)},isChecked:function(a){return a._checked},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._enabled=true;a.childNodes[a._ll?0:1].childNodes[0].tabIndex=0;a.childNodes[a._ll?0:1].childNodes[0].removeAttribute("disabled");this.doCheckValue(a)},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._enabled=false;if(a._updateImgNode!=null){a._updateImgNode(a,false)}a.childNodes[a._ll?0:1].childNodes[0].tabIndex=-1;a.childNodes[a._ll?0:1].childNodes[0].setAttribute("disabled","true");this.doCheckValue(a)},isEnabled:function(a){return a._enabled},setText:function(a,c){a.childNodes[a._ll?0:1].childNodes[0].innerHTML=c+(a._required?"<span class='dhxform_item_required'>*</span>":"")},getText:function(a){return a.childNodes[a._ll?0:1].childNodes[0].innerHTML.replace(/<span class=\"dhxform_item_required\">[^<]*<\/span>/g,"")},setValue:function(a,c){this.setChecked(a,(c===true||parseInt(c)==1||c=="true"||a._value===c))},getValue:function(a,c){if(c=="realvalue"){return a._value}return((typeof(a._value)=="undefined"||a._value==null)?(a._checked?1:0):a._value)},setReadonly:function(a,c){a._ro=(c===true)},isReadonly:function(a){return a._ro},setFocus:function(a){a.childNodes[a._ll?0:1].childNodes[0].focus()}};dhtmlXForm.prototype.items.radio={input:{},r:{},firstValue:{},render:function(g,j,c){g._type="ra";g._enabled=true;g._checked=false;g._group=j.name;g._value=j.value;g._uid=c;g._ro=(j.readonly==true);g._rName=g._rId+g._group;this.r[g._idd]=g;j.inputWidth=14;this.doAddLabel(g,j);this.doAddInput(g,j,"INPUT","TEXT",true,true,"dhxform_textarea");g.childNodes[g._ll?1:0].className+=" dhxform_img_node";var l=document.createElement("DIV");l.className="dhxform_img rdbt0";g.appendChild(l);if(!isNaN(j.inputLeft)){g.childNodes[g._ll?1:0].style.left=parseInt(j.inputLeft)+"px"}if(!isNaN(j.inputTop)){g.childNodes[g._ll?1:0].style.top=parseInt(j.inputTop)+"px"}g.childNodes[g._ll?1:0].appendChild(l);g.childNodes[g._ll?1:0].firstChild.name="";g.childNodes[g._ll?1:0].firstChild.value="";g._updateImgNode=function(n,o){var m=n.childNodes[n._ll?1:0].lastChild;m.className=(o?"dhxform_actv_r":"dhxform_img")+" "+(n._checked?"rdbt1":"rdbt0");n=m=null};g._doOnFocus=function(m){m.getForm().callEvent("onFocus",[m._group,m._value])};g._doOnBlur=function(m){m.getForm().callEvent("onBlur",[m._group,m._value])};g._doOnKeyUpDown=function(n,m){this.callEvent(n,[this.childNodes[this._ll?0:1].childNodes[0],m,this._group,this._value])};if(this.input[g._rName]==null){var a=document.createElement("INPUT");a.type="HIDDEN";a.name=j.name;a.firstValue=g._value;g.appendChild(a);this.input[g._rName]=a}if(!this.firstValue[g._rName]){this.firstValue[g._rName]=j.value}if(j.checked==true){this.check(g)}if(j.hidden==true){this.hide(g)}if(j.disabled==true){this.userDisable(g)}this.doAttachEvents(g);return this},destruct:function(j,l){if(j.lastChild==this.input[j._rName]){var g=false;for(var c in this.r){if(!g&&this.r[c]._group==j._group&&this.r[c]._idd!=j._idd){this.r[c].appendChild(this.input[j._rName]);g=true}}if(!g){this.input[j._rName].parentNode.removeChild(this.input[j._rName]);this.input[j._rName]=null;this.firstValue[j._rName]=null}}var m=j._idd;j._doOnFocus=j._doOnBlur=j._updateImgNode=null;this.doUnloadNestedLists(j);this.doDestruct(j);return m},doClick:function(c){c.childNodes[c._ll?0:1].childNodes[0].focus();if(!(c._enabled&&!c._checked)){return}if(c._ro){return}var a=[c._group,c._value,true];if(c.checkEvent("onBeforeChange")){if(c.callEvent("onBeforeChange",a)!==true){return}}this.setChecked(c,true);c.getForm()._autoCheck();c.callEvent("onChange",a)},doCheckValue:function(g){var j=null;for(var c in this.r){if(this.r[c]._checked&&this.r[c]._group==g._group&&this.r[c]._rId==g._rId){j=this.r[c]._value}}if(j!=null&&this.r[c]._enabled){this.input[g._rName].name=String(g._group);this.input[g._rName].value=j}else{this.input[g._rName].name="";this.input[g._rName].value=""}this.input[g._rName]._value=j},setChecked:function(l,m){m=(m===true);for(var c in this.r){if(this.r[c]._group==l._group&&this.r[c]._rId==l._rId){var j=false;if(this.r[c]._idd==l._idd){if(this.r[c]._checked!=m){this.r[c]._checked=m;j=true}}else{if(this.r[c]._checked){this.r[c]._checked=false;j=true}}if(j){var g=this.r[c].childNodes[this.r[c]._ll?1:0].childNodes[1];g.className=g.className.replace(/rdbt[0-1]{1}/gi,"")+(this.r[c]._checked?" rdbt1":" rdbt0");g=null}}}this.doCheckValue(l)},getChecked:function(a){return this.input[a._rName]._value},_getFirstValue:function(a){return this.firstValue[a._rName]},_getId:function(a){return a._idd},setValue:function(a,c){}};(function(){for(var c in {doAddLabel:1,doAddInput:1,doDestruct:1,doUnloadNestedLists:1,doAttachEvents:1,check:1,unCheck:1,isChecked:1,enable:1,disable:1,isEnabled:1,setText:1,getText:1,getValue:1,setReadonly:1,isReadonly:1,setFocus:1}){dhtmlXForm.prototype.items.radio[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.items.select={render:function(a,c){a._type="se";a._enabled=true;a._value=null;a._newValue=null;this.doAddLabel(a,c);this.doAddInput(a,c,"SELECT",null,true,true,"dhxform_select");this.doAttachEvents(a);this.doLoadOpts(a,c);if(c.connector!=null){this.doLoadOptsConnector(a,c.connector)}if(typeof(c.value)!="undefined"&&c.value!=null){this.setValue(a,c.value)}return this},destruct:function(a){this.doUnloadNestedLists(a);a.callEvent=null;a.checkEvent=null;a.getForm=null;a._autoCheck=null;a._enabled=null;a._idd=null;a._type=null;a._value=null;a._newValue=null;a.onselectstart=null;a.childNodes[a._ll?1:0].childNodes[0].onclick=null;a.childNodes[a._ll?1:0].childNodes[0].onkeydown=null;a.childNodes[a._ll?1:0].childNodes[0].onchange=null;a.childNodes[a._ll?1:0].childNodes[0].onfocus=null;a.childNodes[a._ll?1:0].childNodes[0].onblur=null;a.childNodes[a._ll?1:0].childNodes[0].onkeyup=null;a.childNodes[a._ll?1:0].removeChild(a.childNodes[a._ll?1:0].childNodes[0]);while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}a.parentNode.removeChild(a);a=null},doAddLabel:function(c,g){var a=document.createElement("DIV");a.className="dhxform_label "+g.labelAlign;a.innerHTML="<label for='"+g.uid+"'>"+g.label+(g.info?"<span class='dhxform_info'>[?]</span>":"")+(c._required?"<span class='dhxform_item_required'>*</span>":"")+"</label>";if(g.wrap==true){a.style.whiteSpace="normal"}if(typeof(g.tooltip)!="undefined"){a.title=g.tooltip}c.appendChild(a);if(typeof(g.label)=="undefined"||g.label==null||g.label.length==0){a.style.display="none"}if(!isNaN(g.labelWidth)){a.style.width=parseInt(g.labelWidth)+"px"}if(!isNaN(g.labelHeight)){a.style.height=parseInt(g.labelHeight)+"px"}if(!isNaN(g.labelLeft)){a.style.left=parseInt(g.labelLeft)+"px"}if(!isNaN(g.labelTop)){a.style.top=parseInt(g.labelTop)+"px"}if(g.info){a.onclick=function(l){l=l||event;var j=l.target||l.srcElement;if(typeof(j.className)!="undefined"&&j.className=="dhxform_info"){this.parentNode.callEvent("onInfo",[this.parentNode._idd]);l.cancelBubble=true;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false}}}},doAttachEvents:function(g){var a=g.childNodes[g._ll?1:0].childNodes[0];var c=this;a.onclick=function(){c.doOnChange(this)};a.onkeydown=function(j){j=j||event;c.doOnChange(this);this.parentNode.parentNode.callEvent("onKeyDown",[this,j,this.parentNode.parentNode._idd])};a.onchange=function(){c.doOnChange(this)};a.onkeyup=function(j){j=j||event;this.parentNode.parentNode.callEvent("onKeyUp",[this,j,this.parentNode.parentNode._idd])};a=null;this.doAttachChangeLS(g)},doAttachChangeLS:function(c){var a=c.childNodes[c._ll?1:0].childNodes[0];a.onfocus=function(){var g=this.parentNode.parentNode;g.getForm()._ccActivate(g._idd,this,g.getForm().getItemValue(g._idd,true));g.getForm().callEvent("onFocus",[g._idd]);g=null};a.onblur=function(){var g=this.parentNode.parentNode;g.getForm()._ccDeactivate(g._idd);g.getForm().callEvent("onBlur",[g._idd]);g=null};a=null},doValidate:function(a){if(a.getForm().live_validate){this._validate(a)}},doLoadOpts:function(n,l,r){var o=n.childNodes[n._ll?1:0].childNodes[0];var a=l.options;var j=false;for(var c=0;c<a.length;c++){var m=a[c].text||a[c].label;if(!m||typeof(m)=="undefined"){m=""}var g=new Option(m,a[c].value);if(typeof(a[c].img_src)=="string"){g.setAttribute("img_src",a[c].img_src)}o.options.add(g);if(typeof(a[c].selected)!="undefined"&&window.dhx4.s2b(a[c].selected)==true){g.selected=true;n._value=a[c].value;j=true}if(typeof(a[c].checked)!="undefined"&&window.dhx4.s2b(a[c].checked)==true){g.setAttribute("checked","1")}if(typeof(a[c].img)!="undefined"){g.setAttribute("img",a[c].img)}if(typeof(a[c].img_dis)!="undefined"){g.setAttribute("img_dis",a[c].img_dis)}}if(!j&&o.selectedIndex>=0){n._value=o.options[o.selectedIndex].value}if(r===true){n.callEvent("onOptionsLoaded",[n._idd])}this._checkNoteWidth(n)},doLoadOptsConnector:function(g,a){var c=this;g._connector_working=true;window.dhx4.ajax.get(a,function(n){n=n.xmlDoc.responseXML;if(n==null){return}var j=n.getElementsByTagName("data");if(j==null||j[0]==null){return}j=j[0];var m=[];for(var o=0;o<j.childNodes.length;o++){if(typeof(j.childNodes[o].tagName)!="undefined"&&String(j.childNodes[o].tagName).toLowerCase()=="item"){var l=j.childNodes[o];m.push({label:l.getAttribute("label"),value:l.getAttribute("value"),selected:(l.getAttribute("selected")!=null)});l=null}}c.doLoadOpts(g,{options:m},true);g._connector_working=false;if(g._connector_value!=null){c.setValue(g,g._connector_value);g._connector_value=null}c=g=null})},doOnChange:function(g){var a=g.parentNode.parentNode;a._newValue=(g.selectedIndex>=0?g.options[g.selectedIndex].value:null);if(a._newValue!=a._value){if(a.checkEvent("onBeforeChange")){if(a.callEvent("onBeforeChange",[a._idd,a._value,a._newValue])!==true){for(var c=0;c<g.options.length;c++){if(g.options[c].value==a._value){g.options[c].selected=true}}return}}a._value=a._newValue;a.callEvent("onChange",[a._idd,a._value]);if(a._type=="se"&&a.getForm().live_validate){this._validate(a)}}a._autoCheck()},setText:function(a,c){if(!c){c=""}a.childNodes[a._ll?0:1].childNodes[0].innerHTML=c+(a._required?"<span class='dhxform_item_required'>*</span>":"");a.childNodes[a._ll?0:1].style.display=(c.length==0||c==null?"none":"")},getText:function(a){return a.childNodes[a._ll?0:1].childNodes[0].innerHTML.replace(/<span class=\"dhxform_item_required\">[^<]*<\/span>/g,"")},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._enabled=true;a.childNodes[a._ll?1:0].childNodes[0].removeAttribute("disabled")},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._enabled=false;a.childNodes[a._ll?1:0].childNodes[0].setAttribute("disabled",true)},getOptions:function(a){return a.childNodes[a._ll?1:0].childNodes[0].options},setValue:function(c,j){if(c._connector_working){c._connector_value=j;return}var a=this.getOptions(c);for(var g=0;g<a.length;g++){if(a[g].value==j){a[g].selected=true;c._value=a[g].value}}if(c._list!=null&&c._list.length>0){c.getForm()._autoCheck()}c.getForm()._ccReload(c._idd,c._value)},getValue:function(g){var a=-1;var c=this.getOptions(g);for(var j=0;j<c.length;j++){if(c[j].selected){a=c[j].value}}return a},setWidth:function(c,a){c.childNodes[c._ll?1:0].childNodes[0].style.width=a+"px"},getSelect:function(a){return a.childNodes[a._ll?1:0].childNodes[0]},setFocus:function(a){a.childNodes[a._ll?1:0].childNodes[0].focus()},_checkNoteWidth:function(c){var a;if(c.childNodes[c._ll?1:0].childNodes[1]!=null){a=c.childNodes[c._ll?1:0].childNodes[1];if(a.className!=null&&a.className.search(/dhxform_note/gi)>=0&&a._w=="auto"){a.style.width=c.childNodes[c._ll?1:0].childNodes[0].offsetWidth+"px"}}a=null}};(function(){for(var c in {doAddInput:1,doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.select[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.items.multiselect={doLoadOpts:function(j,m,n){var c=j.childNodes[j._ll?1:0].childNodes[0];c.multiple=true;if(!isNaN(m.size)){c.size=Number(m.size)}j._value=[];j._newValue=[];var g=m.options;for(var l=0;l<g.length;l++){var a=new Option(g[l].text||g[l].label,g[l].value);c.options.add(a);if(g[l].selected==true||g[l].selected=="true"){a.selected=true;j._value.push(g[l].value)}}if(n===true){j.callEvent("onOptionsLoaded",[j._idd])}this._checkNoteWidth(j)},doAttachEvents:function(g){var a=g.childNodes[g._ll?1:0].childNodes[0];var c=this;a.onfocus=function(){c.doOnChange(this);var j=this.parentNode.parentNode;j.getForm().callEvent("onFocus",[j._idd]);j=null};a.onblur=function(){c.doOnChange(this);var j=this.parentNode.parentNode;j.getForm().callEvent("onBlur",[j._idd]);j=null};a.onclick=function(){c.doOnChange(this);var j=this.parentNode.parentNode;j._autoCheck();j=null}},doOnChange:function(j){var c=j.parentNode.parentNode;c._newValue=[];for(var g=0;g<j.options.length;g++){if(j.options[g].selected){c._newValue.push(j.options[g].value)}}if((c._value).sort().toString()!=(c._newValue).sort().toString()){if(c.checkEvent("onBeforeChange")){if(c.callEvent("onBeforeChange",[c._idd,c._value,c._newValue])!==true){var a={};for(var g=0;g<c._value.length;g++){a[c._value[g]]=true}for(var g=0;g<j.options.length;g++){j.options[g].selected=(a[j.options[g].value]==true)}a=null;return}}c._value=[];for(var g=0;g<c._newValue.length;g++){c._value.push(c._newValue[g])}c.callEvent("onChange",[c._idd,c._value])}c._autoCheck()},setValue:function(g,l){var a={};if(typeof(l)=="string"){l=l.split(",")}if(typeof(l)!="object"){l=[l]}for(var j=0;j<l.length;j++){a[l[j]]=true}var c=this.getOptions(g);for(var j=0;j<c.length;j++){c[j].selected=(a[c[j].value]==true)}g._autoCheck()},getValue:function(g){var a=[];var c=this.getOptions(g);for(var j=0;j<c.length;j++){if(c[j].selected){a.push(c[j].value)}}return a}};(function(){for(var c in dhtmlXForm.prototype.items.select){if(!dhtmlXForm.prototype.items.multiselect[c]){dhtmlXForm.prototype.items.multiselect[c]=dhtmlXForm.prototype.items.select[c]}}})();dhtmlXForm.prototype.items.input={render:function(m,n){var l=(!isNaN(n.rows));m._type="ta";m._enabled=true;this.doAddLabel(m,n);this.doAddInput(m,n,(l?"TEXTAREA":"INPUT"),(l?null:"TEXT"),true,true,"dhxform_textarea");this.doAttachEvents(m);if(l){m.childNodes[m._ll?1:0].childNodes[0].rows=Number(n.rows)+(window.dhx4.isIE6?1:0)}if(typeof(n.numberFormat)!="undefined"){var j,g=null,o=null;if(typeof(n.numberFormat)!="string"){j=n.numberFormat[0];g=n.numberFormat[1]||null;o=n.numberFormat[2]||null}else{j=n.numberFormat;if(typeof(n.groupSep)=="string"){g=n.groupSep}if(typeof(n.decSep)=="string"){o=n.decSep}}this.setNumberFormat(m,j,g,o,false)}this.setValue(m,n.value);return this},doAttachEvents:function(c){var a=this;if(c._type=="ta"||c._type=="se"||c._type=="pw"){c.childNodes[c._ll?1:0].childNodes[0].onfocus=function(){var g=this.parentNode.parentNode;if(g._df!=null){this.value=g._value||""}g.getForm()._ccActivate(g._idd,this,this.value);g.getForm().callEvent("onFocus",[g._idd]);g=null}}c.childNodes[c._ll?1:0].childNodes[0].onblur=function(){var g=this.parentNode.parentNode;g.getForm()._ccDeactivate(g._idd);a.updateValue(g,true);if(g.getForm().live_validate){a._validate(g)}g.getForm().callEvent("onBlur",[g._idd]);g=null}},updateValue:function(l,a){var m=l.childNodes[l._ll?1:0].childNodes[0].value;var j=l.getForm();var c=(j._ccActive==true&&j._formLS!=null&&j._formLS[l._idd]!=null);j=null;if(!c&&l._df!=null&&m==window.dhx4.template._getFmtValue(l._value,l._df)){return}if(!a&&l._df!=null&&l._value==m&&m==window.dhx4.template._getFmtValue(m,l._df)){return}var g=this;if(l._value!=m){if(l.checkEvent("onBeforeChange")){if(l.callEvent("onBeforeChange",[l._idd,l._value,m])!==true){if(l._df!=null){g.setValue(l,l._value)}else{l.childNodes[l._ll?1:0].childNodes[0].value=l._value}return}}if(l._df!=null&&a){g.setValue(l,m)}else{l._value=m}l.callEvent("onChange",[l._idd,m]);return}if(l._df!=null&&a){this.setValue(l,l._value)}},setValue:function(g,j){g._value=(typeof(j)!="undefined"&&j!=null?j:"");var c=(String(g._value)||"");var a=g.childNodes[g._ll?1:0].childNodes[0];if(g._df!=null){c=window.dhx4.template._getFmtValue(c,g._df)}if(a.value!=c){a.value=c;g.getForm()._ccReload(g._idd,c)}a=null},getValue:function(a){var c=a.getForm();if(c._formLS&&c._formLS[a._idd]!=null){this.updateValue(a)}c=null;return(typeof(a._value)!="undefined"&&a._value!=null?a._value:"")},setReadonly:function(a,c){a._ro=(c===true);if(a._ro){a.childNodes[a._ll?1:0].childNodes[0].setAttribute("readOnly","true")}else{a.childNodes[a._ll?1:0].childNodes[0].removeAttribute("readOnly")}},isReadonly:function(a){if(!a._ro){a._ro=false}return a._ro},getInput:function(a){return a.childNodes[a._ll?1:0].childNodes[0]},setNumberFormat:function(j,l,g,m,c){if(typeof(c)!="boolean"){c=true}if(l==""){j._df=null;if(c){this.setValue(j,j._value)}return true}if(typeof(l)!="string"){return}var a=window.dhx4.template._parseFmt(l,g,m);if(a==false){return false}else{j._df=a}if(c){this.setValue(j,j._value)}return true}};(function(){for(var c in {doAddLabel:1,doAddInput:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setFocus:1}){dhtmlXForm.prototype.items.input[c]=dhtmlXForm.prototype.items.select[c]}})();dhtmlXForm.prototype.items.password={render:function(a,c){a._type="pw";a._enabled=true;this.doAddLabel(a,c);this.doAddInput(a,c,"INPUT","PASSWORD",true,true,"dhxform_textarea");this.doAttachEvents(a);this.setValue(a,c.value);return this}};(function(){for(var c in {doAddLabel:1,doAddInput:1,doAttachEvents:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,setValue:1,getValue:1,updateValue:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setFocus:1,getInput:1}){dhtmlXForm.prototype.items.password[c]=dhtmlXForm.prototype.items.input[c]}})();dhtmlXForm.prototype.items.file={render:function(g,j){g._type="fl";g._enabled=true;this.doAddLabel(g,j);this.doAddInput(g,j,"INPUT","FILE",true,false,"dhxform_textarea");var a=g.childNodes[g._ll?1:0].childNodes[0];var c=this;a.onfocus=function(){var l=this.parentNode.parentNode;l.getForm().callEvent("onFocus",[l._idd]);l=null};a.onblur=function(){var l=this.parentNode.parentNode;if(l.getForm().live_validate){c._validate(l)}l.getForm().callEvent("onBlur",[l._idd]);l=null};a=null;g.childNodes[g._ll?1:0].childNodes[0].onchange=function(){g.callEvent("onChange",[g._idd,this.value])};return this},setValue:function(){},getValue:function(a){return a.childNodes[a._ll?1:0].childNodes[0].value}};(function(){for(var c in {doAddLabel:1,doAddInput:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,getInput:1,enable:1,disable:1,isEnabled:1,setWidth:1}){dhtmlXForm.prototype.items.file[c]=dhtmlXForm.prototype.items.input[c]}})();dhtmlXForm.prototype.items.label={_index:false,render:function(c,g){c._type="lb";c._enabled=true;c._checked=true;var a=document.createElement("DIV");a.className="dhxform_txt_label2"+(g._isTopmost?" topmost":"");a.innerHTML=g.label;c.appendChild(a);if(g.hidden==true){this.hide(c)}if(g.disabled==true){this.userDisable(c)}if(!isNaN(g.labelWidth)){a.style.width=parseInt(g.labelWidth)+"px"}if(!isNaN(g.labelHeight)){a.style.height=parseInt(g.labelHeight)+"px"}if(!isNaN(g.labelLeft)){a.style.left=parseInt(g.labelLeft)+"px"}if(!isNaN(g.labelTop)){a.style.top=parseInt(g.labelTop)+"px"}return this},destruct:function(a){this.doUnloadNestedLists(a);a._autoCheck=null;a._enabled=null;a._type=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;a.onselectstart=null;a.parentNode.removeChild(a);a=null},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._enabled=true},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._enabled=false},setText:function(a,c){a.firstChild.innerHTML=c},getText:function(a){return a.firstChild.innerHTML}};(function(){for(var c in {doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.label[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.items.button={render:function(g,j){g._type="bt";g._enabled=true;g._name=j.name;g.className=String(g.className).replace("item_label_top","item_label_left").replace("item_label_right","item_label_left");if(!isNaN(j.width)){var a=Math.max(j.width,10)}var c=(typeof(a)!="undefined");g._doOnKeyUpDown=function(m,l){this.callEvent(m,[this.childNodes[0].childNodes[0],l,this._idd])};g.innerHTML='<div class="dhxform_btn" role="link" tabindex="0" dir="ltr"><div class="dhxform_btn_txt" '+(c?' style="width:'+a+'px;"':"")+">"+j.value+'</div><div class="dhxform_btn_filler" disabled="true"></div></div>';if(!isNaN(j.inputLeft)){g.childNodes[0].style.left=parseInt(j.inputLeft)+"px"}if(!isNaN(j.inputTop)){g.childNodes[0].style.top=parseInt(j.inputTop)+"px"}if(j.hidden==true){this.hide(g)}if(j.disabled==true){this.userDisable(g)}if(typeof(j.tooltip)!="undefined"){g.firstChild.title=j.tooltip}g.onselectstart=function(l){l=l||event;l.cancelBubble=true;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false};g.firstChild.onselectstart=function(l){l=l||event;l.cancelBubble=true;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}return false};g.firstChild.onkeypress=function(l){l=l||event;if((l.keyCode==32||l.charCode==32||l.keyCode==13||l.charCode==13)&&!this.parentNode._busy){this.parentNode._busy=true;l.cancelBubble=true;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}_dhxForm_doClick(this.childNodes[0],["mousedown","mouseup"]);return false}};g.firstChild.onfocus=function(){this.parentNode._doOnFocus(this.parentNode)};g.firstChild.onblur=function(){_dhxForm_doClick(this.childNodes[0],"mouseout");this.parentNode._doOnBlur(this.parentNode)};g.firstChild.onkeyup=function(l){this.parentNode._doOnKeyUpDown("onKeyUp",l||event)};g.firstChild.onkeydown=function(l){this.parentNode._doOnKeyUpDown("onKeyDown",l||event)};g.firstChild.onmouseover=function(){var l=this.parentNode;if(!l._enabled){return}this._isOver=true;this.className="dhxform_btn dhxform_btn_over";l=null};g.firstChild.onmouseout=function(){var l=this.parentNode;if(!l._enabled){return}this.className="dhxform_btn";this._allowClick=false;this._pressed=false;this._isOver=false;l=null};g.firstChild.ontouchstart=g.firstChild.onmousedown=function(m){m=m||event;if(m.type=="touchstart"&&m.preventDefault){m.preventDefault()}if(m.button>=2){return}if(this._pressed){return}var l=this.parentNode;if(!l._enabled){return}this.className="dhxform_btn dhxform_btn_pressed";this._allowClick=true;this._pressed=true;l=null};g.firstChild.ontouchend=g.firstChild.onmouseup=function(m){m=m||event;if(m.button>=2){return}if(!this._pressed){return}var l=this.parentNode;if(!l._enabled){return}l._busy=false;this.className="dhxform_btn"+(this._isOver?" dhxform_btn_over":"");if(this._pressed&&this._allowClick){l.callEvent("_onButtonClick",[l._name,l._cmd])}this._allowClick=false;this._pressed=false;l=null};g._doOnFocus=function(l){l.getForm().callEvent("onFocus",[l._idd])};g._doOnBlur=function(l){l.getForm().callEvent("onBlur",[l._idd])};return this},destruct:function(a){this.doUnloadNestedLists(a);a.callEvent=null;a.checkEvent=null;a.getForm=null;a._autoCheck=null;a._type=null;a._enabled=null;a._cmd=null;a._name=null;a._doOnFocus=null;a._doOnBlur=null;a._doOnKeyUpDown=null;a.onselectstart=null;a.firstChild.onselectstart=null;a.firstChild.onkeypress=null;a.firstChild.ontouchstart=null;a.firstChild.ontouchend=null;a.firstChild.onfocus=null;a.firstChild.onblur=null;a.firstChild.onkeyup=null;a.firstChild.onkeydown=null;a.firstChild.onmouseover=null;a.firstChild.onmouseout=null;a.firstChild.onmousedown=null;a.firstChild.onmouseup=null;while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}a.parentNode.removeChild(a);a=null},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._enabled=true;a.childNodes[0].removeAttribute("disabled");a.childNodes[0].setAttribute("role","link");a.childNodes[0].setAttribute("tabIndex","0")},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._enabled=false;a.childNodes[0].setAttribute("disabled","true");a.childNodes[0].removeAttribute("role");a.childNodes[0].removeAttribute("tabIndex")},setText:function(a,c){a.childNodes[0].childNodes[0].innerHTML=c},getText:function(a){return a.childNodes[0].childNodes[0].innerHTML},setFocus:function(a){a.childNodes[0].focus()}};(function(){for(var c in {doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.button[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.items.hidden={_index:false,render:function(c,g){c.style.display="none";c._name=g.name;c._type="hd";c._enabled=true;var a=document.createElement("INPUT");a.type="HIDDEN";a.name=g.name;a.value=(g.value||"");c.appendChild(a);return this},destruct:function(a){this.doUnloadNestedLists(a);while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}a._autoCheck=null;a._name=null;a._type=null;a._enabled=null;a.onselectstart=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;a.parentNode.removeChild(a);a=null},enable:function(a){a._enabled=true;a.childNodes[0].setAttribute("name",a._name)},disable:function(a){a._enabled=false;a.childNodes[0].removeAttribute("name")},show:function(){},hide:function(){},isHidden:function(){return true},setValue:function(a,c){a.childNodes[0].value=c},getValue:function(a){return a.childNodes[0].value},getInput:function(a){return a.childNodes[0]}};(function(){for(var c in {doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.hidden[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.items.list={_index:false,render:function(a,c){a._type="list";a._enabled=true;a._isNestedForm=true;a.style.paddingLeft=a._ofsNested+"px";a.className="dhxform_base_nested"+(a._custom_css||"");return[this,new dhtmlXForm(a,null,c)]},destruct:function(a){}};dhtmlXForm.prototype.items.fieldset={_index:false,render:function(c,j){c._type="fs";if(typeof(parseInt(j.inputWidth))=="number"){}c._width=j.width;c._enabled=true;c._checked=true;c.className="fs_"+j.position+(typeof(j.className)=="string"?" "+j.className:"");var g=document.createElement("FIELDSET");g.className="dhxform_fs";var l=String(j.labelAlign).replace("align_","");g.innerHTML="<legend class='fs_legend' align='"+l+"' style='text-align:"+l+"'>"+j.label+"</legend>";c.appendChild(g);if(!isNaN(j.inputLeft)){g.style.left=parseInt(j.inputLeft)+"px"}if(!isNaN(j.inputTop)){g.style.top=parseInt(j.inputTop)+"px"}if(j.inputWidth!="auto"){if(!isNaN(j.inputWidth)){g.style.width=parseInt(j.inputWidth)+"px";var a=parseInt(g.style.width);if(g.offsetWidth>a){g.style.width=a+(a-g.offsetWidth)+"px"}}}c._addSubListNode=function(){var m=document.createElement("DIV");m._custom_css=" dhxform_fs_nested";this.childNodes[0].appendChild(m);return m};if(j.hidden==true){this.hide(c)}if(j.disabled==true){this.userDisable(c)}return this},destruct:function(a){this.doUnloadNestedLists(a);a._checked=null;a._enabled=null;a._idd=null;a._type=null;a._width=null;a.onselectstart=null;a._addSubListNode=null;a._autoCheck=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}a.parentNode.removeChild(a);a=null},setText:function(a,c){a.childNodes[0].childNodes[0].innerHTML=c},getText:function(a){return a.childNodes[0].childNodes[0].innerHTML},enable:function(a){a._enabled=true;if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}},disable:function(a){a._enabled=false;if(String(a.className).search("disabled")<0){a.className+=" disabled"}},setWidth:function(c,a){c.childNodes[0].style.width=a+"px";c._width=a},getWidth:function(a){return a._width}};(function(){for(var c in {doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.fieldset[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.items.block={_index:false,render:function(c,g){c._type="bl";c._width=g.width;c._enabled=true;c._checked=true;c.className="block_"+g.position+(typeof(g.className)=="string"?" "+g.className:"");var a=document.createElement("DIV");a.className="dhxform_obj_"+c.getForm().skin+" dhxform_block";a.style.fontSize=c.getForm().cont.style.fontSize;if(g.style){a.style.cssText=g.style}if(typeof(g.id)!="undefined"){a.id=g.id}c.appendChild(a);if(!isNaN(g.inputLeft)){a.style.left=parseInt(g.inputLeft)+"px"}if(!isNaN(g.inputTop)){a.style.top=parseInt(g.inputTop)+"px"}if(g.inputWidth!="auto"){if(!isNaN(g.inputWidth)){a.style.width=parseInt(g.inputWidth)+"px"}}if(!isNaN(g.blockOffset)){c._ofsNested=g.blockOffset}c._addSubListNode=function(){var j=document.createElement("DIV");j._inBlcok=true;if(typeof(this._ofsNested)!="undefined"){j._ofsNested=this._ofsNested}this.childNodes[0].appendChild(j);return j};if(g.hidden==true){this.hide(c)}if(g.disabled==true){this.userDisable(c)}return this},_setCss:function(a,g,c){a.firstChild.className="dhxform_obj_"+g+" dhxform_block";a.firstChild.style.fontSize=c}};(function(){for(var c in {enable:1,disable:1,isEnabled:1,setWidth:1,getWidth:1,doUnloadNestedLists:1,destruct:1}){dhtmlXForm.prototype.items.block[c]=dhtmlXForm.prototype.items.fieldset[c]}})();dhtmlXForm.prototype.items.newcolumn={_index:false};dhtmlXForm.prototype.items.template={render:function(c,g){var a=(!isNaN(g.rows));c._type="tp";c._enabled=true;if(g.format!=null){if(typeof(g.format)=="function"){c.format=g.format}else{if(typeof(g.format)=="string"&&typeof(window[g.format])=="function"){c.format=window[g.format]}}}if(c.format==null){c.format=function(j,l){return l}}this.doAddLabel(c,g);this.doAddInput(c,g,"DIV",null,true,true,"dhxform_item_template");this.setValue(c,g.value||"");return this},destruct:function(a){a.format=null;this.d2(a);a=null},setValue:function(a,c){a._value=c;a.childNodes[a._ll?1:0].childNodes[0].innerHTML=a.format(a._idd,a._value)},getValue:function(a){return a._value},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._enabled=true},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._enabled=false}};(function(){dhtmlXForm.prototype.items.template.d2=dhtmlXForm.prototype.items.input.destruct;for(var c in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,isEnabled:1,setWidth:1}){dhtmlXForm.prototype.items.template[c]=dhtmlXForm.prototype.items.select[c]}})();dhtmlXForm.prototype._ulToObject=function(l,r){var m=[];for(var c=0;c<l.childNodes.length;c++){if(String(l.childNodes[c].tagName||"").toLowerCase()=="li"){var g={};var u=l.childNodes[c];for(var s=0;s<r.length;s++){if(u.getAttribute(r[s])!=null){g[String(r[s]).replace("ftype","type")]=u.getAttribute(r[s])}}if(!g.label){try{g.label=u.firstChild.nodeValue}catch(o){}}var j=u.getElementsByTagName("UL");if(j[0]!=null){g[(g.type=="select"?"options":"list")]=dhtmlXForm.prototype._ulToObject(j[0],r)}for(var s=0;s<u.childNodes.length;s++){if(String(u.childNodes[s].tagName||"").toLowerCase()=="userdata"){if(!g.userdata){g.userdata={}}g.userdata[u.childNodes[s].getAttribute("name")]=u.childNodes[s].firstChild.nodeValue}}m[m.length]=g}if(String(l.childNodes[c].tagName||"").toLowerCase()=="div"){var g={};g.type="label";try{g.label=l.childNodes[c].firstChild.nodeValue}catch(o){}m[m.length]=g}}return m};dhtmlXForm.prototype.setUserData=function(l,g,j,a){if(typeof(a)!="undefined"){var c=this.doWithItem([l,g],"_getId");if(c!=null){l=c;g=j;j=a}}if(!this._userdata){this._userdata={}}this._userdata[l]=(this._userdata[l]||{});this._userdata[l][g]=j};dhtmlXForm.prototype.getUserData=function(j,g,a){if(typeof(a)!="undefined"){var c=this.doWithItem([j,g],"_getId");if(c!=null){j=c;g=a}}if(this._userdata!=null&&typeof(this._userdata[j])!="undefined"&&typeof(this._userdata[j][g])!="undefined"){return this._userdata[j][g]}return""};dhtmlXForm.prototype.setRTL=function(a){this._rtl=(a===true?true:false);if(this._rtl){if(String(this.cont).search(/dhxform_rtl/gi)<0){this.cont.className+=" dhxform_rtl"}}else{if(String(this.cont).search(/dhxform_rtl/gi)>=0){this.cont.className=String(this.cont.className).replace(/dhxform_rtl/gi,"")}}};_dhxForm_doClick=function(j,c){if(typeof(c)=="object"){var a=c[1];c=c[0]}if(document.createEvent){var g=document.createEvent("MouseEvents");g.initEvent(c,true,false);j.dispatchEvent(g)}else{if(document.createEventObject){var g=document.createEventObject();g.button=1;j.fireEvent("on"+c,g)}}if(a){window.setTimeout(function(){_dhxForm_doClick(j,a)},100)}};dhtmlXForm.prototype.setFormData=function(g){for(var c in g){var j=this.getItemType(c);switch(j){case"checkbox":this[g[c]==true||parseInt(g[c])==1||g[c]=="true"||g[c]==this.getItemValue(c,"realvalue")?"checkItem":"uncheckItem"](c);break;case"radio":this.checkItem(c,g[c]);break;case"input":case"textarea":case"password":case"select":case"multiselect":case"hidden":case"template":case"combo":case"calendar":case"colorpicker":case"editor":this.setItemValue(c,g[c]);break;default:if(this["setFormData_"+j]){this["setFormData_"+j](c,g[c])}else{if(!this.hId){this.hId=this._genStr(12)}this.setUserData(this.hId,c,g[c])}break}}};dhtmlXForm.prototype.getFormData=function(w,m){var c={};var s=this;for(var v in this.itemPull){var o=this.itemPull[v]._idd;var x=this.itemPull[v]._type;if(x=="ch"){c[o]=(this.isItemChecked(o)?this.getItemValue(o):0)}if(x=="ra"&&!c[this.itemPull[v]._group]){c[this.itemPull[v]._group]=this.getCheckedValue(this.itemPull[v]._group)}if(x in {se:1,ta:1,pw:1,hd:1,tp:1,fl:1,calendar:1,combo:1,editor:1,colorpicker:1}){c[o]=this.getItemValue(o,w)}if(this["getFormData_"+x]){c[o]=this["getFormData_"+x](o)}if(x=="up"){var l=this.getItemValue(o);for(var j in l){c[j]=l[j]}}if(this.itemPull[v]._list){for(var g=0;g<this.itemPull[v]._list.length;g++){var n=this.itemPull[v]._list[g].getFormData(w,m);for(var u in n){c[u]=n[u]}}}}if(!m&&this.hId&&this._userdata[this.hId]){for(var v in this._userdata[this.hId]){if(!c[v]){c[v]=this._userdata[this.hId][v]}}}return c};dhtmlXForm.prototype.adjustParentSize=function(){var l=0;var j=-1;for(var m=0;m<this.base.length;m++){l+=this.base[m].firstChild.offsetWidth;if(this.base[m].offsetHeight>j){j=this.base[m].offsetHeight}}var g=false;try{g=(this.cont.parentNode.parentNode.parentNode.parentNode._isCell==true);if(g){var a=this.cont.parentNode.parentNode.parentNode.parentNode}}catch(n){}if(g&&typeof(a)!="undefined"){if(l>0){a.setWidth(l+10)}if(j>0){a.setHeight(j+a.firstChild.firstChild.offsetHeight+5)}g=a=null;return}var c=false;try{c=(this.cont.parentNode.parentNode.parentNode._isWindow==true);if(c){var o=this.cont.parentNode.parentNode;if(typeof(o.callEvent)=="function"){this.cont.style.display="none";o.callEvent("_setCellSize",[l+15,j+15]);this.cont.style.display=""}}}catch(n){}};dhtmlXForm.prototype.reset=function(){if(this.callEvent("onBeforeReset",[this.formId,this.getFormData()])){if(this._last_load_data){this.setFormData(this._last_load_data)}this.callEvent("onAfterReset",[this.formId])}};dhtmlXForm.prototype.send=function(c,n,o,j){if(typeof n=="function"){o=n;n="post"}else{n=(n=="get"?"get":"post")}if(j!==true&&!this.validate()){return}var m=this.getFormData(true);var l=[];for(var g in m){l.push(g+"="+encodeURIComponent(m[g]))}var a=function(q){if(o){o.call(this,q,q.xmlDoc.responseText)}};if(n=="get"){window.dhx4.ajax.get(c+(c.indexOf("?")==-1?"?":"&")+l.join("&"),a)}else{window.dhx4.ajax.post(c,l.join("&"),a)}};dhtmlXForm.prototype.save=function(a,c){};dhtmlXForm.prototype.dummy=function(){};dhtmlXForm.prototype._changeFormId=function(c,a){this.formId=a};dhtmlXForm.prototype._dp_init=function(a){a._methods=["dummy","dummy","_changeFormId","dummy"];a._getRowData=function(j,c){var g=this.obj.getFormData(true);g[this.action_param]=this.obj.getUserData(j,this.action_param);return g};a._clearUpdateFlag=function(){};a.attachEvent("onAfterUpdate",function(g,j,l,c){if(j=="inserted"||j=="updated"){this.obj.resetDataProcessor("updated");this.obj._last_load_data=this.obj.getFormData(true)}this.obj.callEvent("onAfterSave",[this.obj.formId,c]);return true});a.autoUpdate=false;a.setTransactionMode("POST",true);this.dp=a;this.formId=(new Date()).valueOf();this.resetDataProcessor("inserted");this.save=function(){if(!this.callEvent("onBeforeSave",[this.formId,this.getFormData()])){return}if(!this.validate()){return}a.sendData()}};dhtmlXForm.prototype.resetDataProcessor=function(a){if(!this.dp){return}this.dp.updatedRows=[];this.dp._in_progress=[];this.dp.setUpdated(this.formId,true,a)};dhtmlXForm.prototype._ccActivate=function(g,a,c){if(!this._formLS){this._formLS={}}if(!this._formLS[g]){this._formLS[g]={input:a,value:c}}if(!this._ccActive){this._ccActive=true;this._ccDo()}a=null};dhtmlXForm.prototype._ccDeactivate=function(a){if(this._ccTm){window.clearTimeout(this._ccTm)}this._ccActive=false;if(this._formLS!=null&&this._formLS[a]!=null){this._formLS[a].input=null;this._formLS[a]=null;delete this._formLS[a]}};dhtmlXForm.prototype._ccDo=function(){if(this._ccTm){window.clearTimeout(this._ccTm)}for(var c in this._formLS){var l=this._formLS[c].input;if(String(l.tagName).toLowerCase()=="select"){var g="";if(l.selectedIndex>=0&&l.selectedIndex<l.options.length){g=l.options[l.selectedIndex].value}}else{var g=l.value}if(g!=this._formLS[c].value){this._formLS[c].value=g;this.callEvent("onInputChange",[l._idd,g,this])}l=null}if(this._ccActive){var j=this;this._ccTm=window.setTimeout(function(){j._ccDo();j=null},100)}};dhtmlXForm.prototype._ccReload=function(c,a){if(this._formLS&&this._formLS[c]){this._formLS[c].value=a}};dhtmlXForm.prototype._autoload=function(){var c=["ftype","name","value","label","check","checked","disabled","text","rows","select","selected","width","style","className","labelWidth","labelHeight","labelLeft","labelTop","inputWidth","inputHeight","inputLeft","inputTop","position","size"];var g=document.getElementsByTagName("UL");var j=[];for(var n=0;n<g.length;n++){if(g[n].className=="dhtmlxForm"){var m=document.createElement("DIV");j[j.length]={nodeUL:g[n],nodeForm:m,data:dhtmlXForm.prototype._ulToObject(g[n],c),name:(g[n].getAttribute("name")||null)}}}for(var n=0;n<j.length;n++){j[n].nodeUL.parentNode.insertBefore(j[n].nodeForm,j[n].nodeUL);var o=new dhtmlXForm(j[n].nodeForm,j[n].data);if(j[n].name!==null){window[j[n].name]=o}var l=(j[n].nodeUL.getAttribute("oninit")||null);j[n].nodeUL.parentNode.removeChild(j[n].nodeUL);j[n].nodeUL=null;j[n].nodeForm=null;j[n].data=null;j[n]=null;if(l){if(typeof(l)=="function"){l()}else{if(typeof(window[l])=="function"){window[l]()}}}}if(typeof(window.addEventListener)=="function"){window.removeEventListener("load",dhtmlXForm.prototype._autoload,false)}else{window.detachEvent("onload",dhtmlXForm.prototype._autoload)}};if(typeof(window.addEventListener)=="function"){window.addEventListener("load",dhtmlXForm.prototype._autoload,false)}else{window.attachEvent("onload",dhtmlXForm.prototype._autoload)}if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachForm=function(a){this.callEvent("_onBeforeContentAttach",["form"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";if(window.dhtmlx&&dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(c)}else{c.style.overflow="auto"}this._attachObject(c);this.dataType="form";this.dataObj=new dhtmlXForm(c,a);this.dataObj.setSkin(this.conf.skin);c=null;this.callEvent("_onContentAttach",[]);return this.dataObj}}dhtmlXForm.prototype.items.combo={render:function(c,g){c._type="combo";c._enabled=true;c._value=null;c._newValue=null;this.doAddLabel(c,g);this.doAddInput(c,g,"SELECT",null,true,true,"dhxform_select");this.doAttachEvents(c);this.doLoadOpts(c,g);c.onselectstart=function(j){return true};c.childNodes[c._ll?1:0].childNodes[0].setAttribute("mode",g.comboType||"");if(g.comboImagePath){c.childNodes[c._ll?1:0].childNodes[0].setAttribute("imagePath",g.comboImagePath)}if(g.comboDefaultImage){c.childNodes[c._ll?1:0].childNodes[0].setAttribute("defaultImage",g.comboDefaultImage)}if(g.comboDefaultImageDis){c.childNodes[c._ll?1:0].childNodes[0].setAttribute("defaultImageDis",g.comboDefaultImageDis)}c._combo=new dhtmlXComboFromSelect(c.childNodes[c._ll?1:0].childNodes[0]);c._combo.setSkin(c.getForm().skin);c._combo._currentComboValue=c._combo.getSelectedValue();c._combo.getInput().id=g.uid;var a=this;c._combo.attachEvent("onChange",function(){a.doOnChange(this)});if(g.connector){this.doLoadOptsConnector(c,g.connector)}if(g.filtering){c._combo.enableFilteringMode(true)}else{if(g.serverFiltering){c._combo.enableFilteringMode(true,g.serverFiltering,g.filterCache,g.filterSubLoad)}}if(g.readonly==true){this.setReadonly(c,true)}if(g.style){c._combo.DOMelem_input.style.cssText+=g.style}c._combo.attachEvent("onFocus",function(){var j=this.cont.parentNode.parentNode;var l=j.getForm();if(l.skin=="dhx_terrace"&&this.cont.className.search(/combo_in_focus/)<0){this.cont.className+=" combo_in_focus"}l.callEvent("onFocus",[j._idd]);l=j=null});c._combo.attachEvent("onBlur",function(){var j=this.cont.parentNode.parentNode;var l=j.getForm();if(l.skin=="dhx_terrace"&&this.cont.className.search(/combo_in_focus/)>=0){this.cont.className=this.cont.className.replace(/\s{0,}combo_in_focus/gi,"")}l.callEvent("onBlur",[j._idd]);l=j=null});return this},destruct:function(a){a.childNodes[a._ll?1:0].childNodes[0].onchange=null;a._combo._currentComboValue=null;a._combo.unload();a._combo=null;a._apiChange=null;this.d2(a);a=null},doAttachEvents:function(c){var a=this;c.childNodes[c._ll?1:0].childNodes[0].onchange=function(){a.doOnChange(this);a.doValidate(this.DOMParent.parentNode.parentNode)}},doValidate:function(a){if(a.getForm().hot_validate){this._validate(a)}},doOnChange:function(c){var a=c.base.parentNode.parentNode.parentNode;if(a._apiChange){return}c._newComboValue=c.getSelectedValue();if(c._newComboValue!=c._currentComboValue){if(a.checkEvent("onBeforeChange")){if(a.callEvent("onBeforeChange",[a._idd,c._currentComboValue,c._newComboValue])!==true){window.setTimeout(function(){c.setComboValue(c._currentComboValue)},1);return false}}c._currentComboValue=c._newComboValue;a.callEvent("onChange",[a._idd,c._currentComboValue])}a._autoCheck(a._enabled)},doLoadOptsConnector:function(j,a){var g=this;var c=j;j._connector_working=true;j._apiChange=true;j._combo.load(a,function(){c.callEvent("onOptionsLoaded",[c._idd]);c._connector_working=false;if(c._connector_value!=null){g.setValue(c,c._connector_value);c._connector_value=null}c._apiChange=false;g=c=null})},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._enabled=true;a._combo.enable()},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._enabled=false;a._combo.disable()},getCombo:function(a){return a._combo},setValue:function(a,c){if(a._connector_working){a._connector_value=c;return}a._apiChange=true;a._combo.setComboValue(c);a._combo._currentComboValue=a._combo.getActualValue();a._apiChange=false},getValue:function(a){return a._combo.getActualValue()},setWidth:function(c,a){c.childNodes[c._ll?1:0].childNodes[0].style.width=a+"px"},setReadonly:function(a,c){if(!a._combo){return}a._combo_ro=c;a._combo.readonly(a._combo_ro)},isReadonly:function(a,c){return a._combo_ro||false},setFocus:function(a){if(a._enabled){a._combo.setFocus()}},_setCss:function(a,g,c){a._combo.setFontSize(c,c)}};(function(){for(var c in {doAddLabel:1,doAddInput:1,doLoadOpts:1,doUnloadNestedLists:1,setText:1,getText:1,isEnabled:1,_checkNoteWidth:1}){dhtmlXForm.prototype.items.combo[c]=dhtmlXForm.prototype.items.select[c]}})();dhtmlXForm.prototype.items.combo.d2=dhtmlXForm.prototype.items.select.destruct;dhtmlXForm.prototype.getCombo=function(a){return this.doWithItem(a,"getCombo")};dhtmlXForm.prototype.items.calendar={render:function(g,l){var c=this;g._type="calendar";g._enabled=true;var m=navigator.userAgent;var a=(m.indexOf("MSIE 6.0")>=0||m.indexOf("MSIE 7.0")>=0||m.indexOf("MSIE 8.0")>=0);this.doAddLabel(g,l);this.doAddInput(g,l,"INPUT","TEXT",true,true,"dhxform_textarea calendar");this.doAttachChangeLS(g);if(a){g.childNodes[g._ll?1:0].childNodes[0].onfocus2=g.childNodes[g._ll?1:0].childNodes[0].onfocus;g.childNodes[g._ll?1:0].childNodes[0].onfocus=function(){if(this._skipOnFocus==true){this._skipOnFocus=false;return}this.onfocus2.apply(this,arguments)}}g.childNodes[g._ll?1:0].childNodes[0]._idd=g._idd;g.childNodes[g._ll?1:0].childNodes[0].onblur=function(){var n=this.parentNode.parentNode;if(n._c.base._formMouseDown){n._c.base._formMouseDown=false;this._skipOnFocus=true;this.focus();this.value=this.value;n=null;return true}var o=n.getForm();o._ccDeactivate(n._idd);c.checkEnteredValue(this.parentNode.parentNode);if(o.live_validate){c._validate(n)}o.callEvent("onBlur",[n._idd]);o=n=null};g._f=(l.dateFormat||null);g._f0=(l.serverDateFormat||g._f);var j=g.getForm();g._c=new dhtmlXCalendarObject(g.childNodes[g._ll?1:0].childNodes[0],l.skin||j.skin||"dhx_skyblue");g._c._nullInInput=true;g._c.enableListener(g.childNodes[g._ll?1:0].childNodes[0]);if(g._f!=null){g._c.setDateFormat(g._f)}if(!window.dhx4.s2b(l.enableTime)){g._c.hideTime()}if(window.dhx4.s2b(l.showWeekNumbers)){g._c.showWeekNumbers()}if(!isNaN(l.weekStart)){g._c.setWeekStartDay(l.weekStart)}if(typeof(l.calendarPosition)!="undefined"){g._c.setPosition(l.calendarPosition)}if(l.minutesInterval!=null){g._c.setMinutesInterval(l.minutesInterval)}g._c._itemIdd=g._idd;g._c.attachEvent("onBeforeChange",function(n){if(g._value!=n){if(g.checkEvent("onBeforeChange")){if(g.callEvent("onBeforeChange",[g._idd,g._value,n])!==true){return false}}g._tempValue=g._value=n;c.setValue(g,n,false);g.callEvent("onChange",[this._itemIdd,g._value])}return true});g._c.attachEvent("onClick",function(){g._tempValue=null});if(a){g._c.base.onmousedown=function(){this._formMouseDown=true;return false}}this.setValue(g,l.value);j=null;return this},getCalendar:function(a){return a._c},setSkin:function(a,c){a._c.setSkin(c)},setValue:function(c,g,a){if(!g||g==null||typeof(g)=="undefined"||g==""){c._value=null;c.childNodes[c._ll?1:0].childNodes[0].value=""}else{c._value=(g instanceof Date?g:c._c._strToDate(g,c._f0||c._c._dateFormat));c.childNodes[c._ll?1:0].childNodes[0].value=c._c._dateToStr(c._value,c._f||c._c._dateFormat)}if(a!==false){c._c.setDate(c._value)}},getValue:function(c,a){var g=c._tempValue||c._c.getDate();if(a===true&&g==null){return""}return(a===true?c._c._dateToStr(g,c._f0||c._c._dateFormat):g)},setDateFormat:function(c,a,g){c._f=a;c._f0=(g||c._f);c._c.setDateFormat(c._f);this.setValue(c,this.getValue(c))},destruct:function(a){a._c.disableListener(a.childNodes[a._ll?1:0].childNodes[0]);a._c.unload();a._c=null;try{delete a._c}catch(c){}a._f=null;try{delete a._f}catch(c){}a._f0=null;try{delete a._f0}catch(c){}a.childNodes[a._ll?1:0].childNodes[0]._idd=null;a.childNodes[a._ll?1:0].childNodes[0].onblur=null;this.d2(a);a=null},checkEnteredValue:function(a){this.setValue(a,a._c.getDate())}};(function(){for(var c in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setFocus:1,getInput:1}){dhtmlXForm.prototype.items.calendar[c]=dhtmlXForm.prototype.items.input[c]}})();dhtmlXForm.prototype.items.calendar.doAttachChangeLS=dhtmlXForm.prototype.items.select.doAttachChangeLS;dhtmlXForm.prototype.items.calendar.d2=dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.getCalendar=function(a){return this.doWithItem(a,"getCalendar")};dhtmlXForm.prototype.setCalendarDateFormat=function(c,a,g){this.doWithItem(c,"setDateFormat",a,g)};dhtmlXForm.prototype.items.btn2state={setChecked:function(a,c){a._checked=(c===true?true:false);a.childNodes[a._ll?1:0].lastChild.className="dhxform_img "+a._cssName+"_"+(a._checked?"1":"0");this.doCheckValue(a)}};(function(){for(var c in dhtmlXForm.prototype.items.checkbox){if(!dhtmlXForm.prototype.items.btn2state[c]){dhtmlXForm.prototype.items.btn2state[c]=dhtmlXForm.prototype.items.checkbox[c]}}})();dhtmlXForm.prototype.items.btn2state.render2=dhtmlXForm.prototype.items.btn2state.render;dhtmlXForm.prototype.items.btn2state.render=function(a,c){c._autoInputWidth=false;this.render2(a,c);a._type="btn2state";a._cssName=(typeof(c.cssName)=="undefined"?"btn2state":c.cssName);a._updateImgNode=function(){};a._doOnFocus=function(){a.getForm().callEvent("onFocus",[a._idd])};a._doOnBlur=function(){a.getForm().callEvent("onBlur",[a._idd])};a._doOnKeyUpDown=function(j,g,l){this.callEvent(j,[this.childNodes[this._ll?0:1].childNodes[0],g,this._idd])};this.setChecked(a,a._checked);return this};dhtmlXForm.prototype.setFormData_btn2state=function(a,c){this[c==true||parseInt(c)==1||c=="true"||c==this.getItemValue(a)?"checkItem":"uncheckItem"](a)};dhtmlXForm.prototype.getFormData_btn2state=function(a){return(this.isItemChecked(a)?this.getItemValue(a):0)};dhtmlXForm.prototype.items.colorpicker={colorpicker:{},render:function(g,j){var c=this;g._type="colorpicker";g._enabled=true;this.doAddLabel(g,j);this.doAddInput(g,j,"INPUT","TEXT",true,true,"dhxform_textarea");g._value=(j.value||"");g.childNodes[g._ll?1:0].childNodes[0].value=g._value;var a={input:g.childNodes[g._ll?1:0].childNodes[0],custom_colors:(window.dhx4.s2b(j.enableCustomColors)==true),skin:g.getForm().skin};this.colorpicker[g._idd]=new dhtmlXColorPicker(a);this.colorpicker[g._idd]._nodes[0].valueColor=null;this.colorpicker[g._idd].base.className+=" dhtmlxcp_in_form";if(typeof(j.customColors)!="undefined"){this.colorpicker[g._idd].setCustomColors(j.customColors)}if(typeof(j.cpPosition)=="string"){this.colorpicker[g._idd].setPosition(j.cpPosition)}this.colorpicker[g._idd].attachEvent("onSelect",function(l){if(g._value!=l){if(g.checkEvent("onBeforeChange")){if(g.callEvent("onBeforeChange",[g._idd,g._value,l])!==true){g.childNodes[g._ll?1:0].childNodes[0].value=g._value;return}}g._value=l;c.setValue(g,l);g.callEvent("onChange",[g._idd,g._value])}});this.colorpicker[g._idd].attachEvent("onHide",function(l){var m=g.childNodes[g._ll?1:0].childNodes[0];if(m.value!=g._value){m.value=g._value}m=null});g.childNodes[g._ll?1:0].childNodes[0]._idd=g._idd;return this},getColorPicker:function(a){return this.colorpicker[a._idd]},destruct:function(a){if(this.colorpicker[a._idd].unload){this.colorpicker[a._idd].unload()}this.colorpicker[a._idd]=null;try{delete this.colorpicker[a._idd]}catch(c){}a.childNodes[a._ll?1:0].childNodes[0]._idd=null;this.d2(a);a=null},setSkin:function(a,c){this.colorpicker[a._idd].setSkin(c)}};(function(){for(var c in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setValue:1,getValue:1,updateValue:1,setFocus:1,getInput:1}){dhtmlXForm.prototype.items.colorpicker[c]=dhtmlXForm.prototype.items.input[c]}})();dhtmlXForm.prototype.items.colorpicker.d2=dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.getColorPicker=function(a){return this.doWithItem(a,"getColorPicker")};dhtmlXForm.prototype.items.container={render:function(a,c){a._type="container";a._enabled=true;this.doAddLabel(a,c);this.doAddInput(a,c,"DIV",null,true,true,"dhxform_container");return this},getContainer:function(a){return a.childNodes[a._ll?1:0].childNodes[0]},enable:function(a){a._enabled=true;if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a.callEvent("onEnable",[a._idd])},disable:function(a){a._enabled=false;if(String(a.className).search("disabled")<0){a.className+=" disabled"}a.callEvent("onDisable",[a._idd])},doAttachEvents:function(){},setValue:function(){},getValue:function(){return null}};dhtmlXForm.prototype.getContainer=function(a){return this.doWithItem(a,"getContainer")};(function(){for(var c in dhtmlXForm.prototype.items.input){if(!dhtmlXForm.prototype.items.container[c]){dhtmlXForm.prototype.items.container[c]=dhtmlXForm.prototype.items.input[c]}}})();dhtmlXForm.prototype.items.editor={editor:{},render:function(g,j){var a=(!isNaN(j.rows));g._type="editor";g._enabled=true;g._editor_id=g.getForm().idPrefix+g._idd;this.doAddLabel(g,j);this.doAddInput(g,j,"DIV",null,true,true,"dhxform_item_template");g._value=(j.value||"");var c=this;this.editor[g._editor_id]=new dhtmlXEditor({parent:g.childNodes[g._ll?1:0].childNodes[0],content:g._value,iconsPath:j.iconsPath,toolbar:j.toolbar});this.editor[g._editor_id].attachEvent("onAccess",function(m,n){g.callEvent("_onBeforeEditorAccess",[]);_dhxForm_doClick(document.body,"click");if(m=="blur"){c.doOnBlur(g,this);g.callEvent("onBlur",[g._idd]);if(g.getForm().skin=="dhx_terrace"){var l=g.childNodes[g._ll?1:0].className;if(l.indexOf("dhxeditor_focus")>=0){g.childNodes[g._ll?1:0].className=(l).replace(/\s{0,}dhxeditor_focus/gi,"")}}}else{g.callEvent("onEditorAccess",[g._idd,m,n,this,g.getForm()]);g.callEvent("onFocus",[g._idd]);if(g.getForm().skin=="dhx_terrace"){var l=g.childNodes[g._ll?1:0].className;if(l.indexOf("dhxeditor_focus")==-1){g.childNodes[g._ll?1:0].className+=" dhxeditor_focus"}}}});this.editor[g._editor_id].attachEvent("onToolbarClick",function(l){g.callEvent("onEditorToolbarClick",[g._idd,l,this,g.getForm()])});if(j.readonly){this.setReadonly(g,true)}g.childNodes[g._ll?0:1].childNodes[0].removeAttribute("for");g.childNodes[g._ll?0:1].childNodes[0].onclick=function(){c.editor[g._editor_id]._focus()};return this},doOnBlur:function(g,c){var a=c.getContent();if(g._value!=a){if(g.checkEvent("onBeforeChange")){if(g.callEvent("onBeforeChange",[g._idd,g._value,a])!==true){c.setContent(g._value);return}}g._value=a;g.callEvent("onChange",[g._idd,a])}},setValue:function(a,c){if(a._value==c){return}a._value=c;this.editor[a._editor_id].setContent(a._value)},getValue:function(a){a._value=this.editor[a._editor_id].getContent();return a._value},enable:function(a){if(this.isEnabled(a)!=true){this.editor[a._editor_id].setReadonly(false);this.doEn(a)}},disable:function(a){if(this.isEnabled(a)==true){this.editor[a._editor_id].setReadonly(true);this.doDis(a)}},setReadonly:function(a,c){this.editor[a._editor_id].setReadonly(c)},getEditor:function(a){return(this.editor[a._editor_id]||null)},destruct:function(a){a.childNodes[a._ll?0:1].childNodes[0].onclick=null;this.editor[a._editor_id].unload();this.editor[a._editor_id]=null;this.d2(a);a=null},setFocus:function(a){this.editor[a._editor_id]._focus()}};(function(){for(var c in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,setWidth:1,isEnabled:1}){dhtmlXForm.prototype.items.editor[c]=dhtmlXForm.prototype.items.template[c]}})();dhtmlXForm.prototype.items.editor.d2=dhtmlXForm.prototype.items.select.destruct;dhtmlXForm.prototype.items.editor.doEn=dhtmlXForm.prototype.items.select.enable;dhtmlXForm.prototype.items.editor.doDis=dhtmlXForm.prototype.items.select.disable;dhtmlXForm.prototype.getEditor=function(a){return this.doWithItem(a,"getEditor")};dhtmlXForm.prototype.items.upload={render:function(c,g){c._type="up";c._enabled=true;c._checked=true;c.className=g.position+(typeof(g.className)=="string"?" "+g.className:"");var a=document.createElement("DIV");c.appendChild(a);if(!isNaN(g.inputLeft)){c.style.left=parseInt(g.inputLeft)+"px"}if(!isNaN(g.inputTop)){c.style.top=parseInt(g.inputTop)+"px"}if(g.inputWidth!="auto"){if(!isNaN(g.inputWidth)){a.style.width=parseInt(g.inputWidth)+"px"}}c._uploader=new dhtmlXFileUploader(a,g.swfPath||"",g.swfUrl||"",g.mode||null,g.swfLogs,g.slXap||"",g.slUrl||"",g.slLogs||"",g.multiple);c._uploader.setURL(g.url||"");c._uploader.callEvent=c.callEvent;if(typeof(g.autoStart)!="undefined"){c._uploader.setAutoStart(g.autoStart)}if(typeof(g.autoRemove)!="undefined"){c._uploader.setAutoRemove(g.autoRemove)}if(typeof(g.titleScreen)!="undefined"){c._uploader.enableTitleScreen(g.titleScreen)}if(typeof(g.titleText)!="undefined"){c._uploader.setTitleText(g.titleText)}if(g.hidden==true){this.hide(c)}if(g.disabled==true){this.userDisable(c)}if(!(g.inputHeight=="auto"||parseInt(g.inputHeight)==NaN)){c._uploader.p_files.style.height=parseInt(g.inputHeight)+"px"}return this},destruct:function(a){this.doUnloadNestedLists(a);a._uploader.callEvent=function(){return true};a._uploader.unload();a._uploader.callEvent=null;a._uploader=null;a._checked=null;a._enabled=null;a._idd=null;a._type=null;a.onselectstart=null;a._autoCheck=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}a.parentNode.removeChild(a);a=null},setText:function(a,c){},getText:function(a){},enable:function(a){a._enabled=true;if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"")}a._uploader.enable()},disable:function(a){a._enabled=false;if(String(a.className).search("disabled")<0){a.className+=" disabled"}a._uploader.disable()},setWidth:function(c,a){c.childNodes[0].style.width=a+"px";c._width=a},getWidth:function(a){return a._width||parseInt(a.childNodes[0].style.width)},setValue:function(a){a._uploader.clear()},getValue:function(m){var j=m._uploader.getData();var l={};var g=0;for(var c in j){l[m._idd+"_r_"+g]=j[c].realName;l[m._idd+"_s_"+g]=j[c].serverName;g++}l[m._idd+"_count"]=g;return l},getUploader:function(a){return a._uploader},getStatus:function(a){return a._uploader.getStatus()}};(function(){for(var c in {doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.upload[c]=dhtmlXForm.prototype.items.checkbox[c]}})();dhtmlXForm.prototype.setFormData_upload=function(a){this.doWithItem(a,"setValue")};dhtmlXForm.prototype.getUploader=function(a){return this.doWithItem(a,"getUploader")};dhtmlXForm.prototype.getUploaderStatus=function(a){return this.doWithItem(a,"getStatus")};function dhtmlXFileUploader(c,n,m,o,s,l,v,j,w){var q=this;if(typeof(o)=="string"&&typeof(this[o])=="function"){this.engine=o}else{this.engine="html4";var g=null;if(typeof(window.FormData)!="undefined"&&typeof(window.XMLHttpRequest)!="undefined"){g=new XMLHttpRequest();if(typeof(g.upload)=="undefined"){g=null}}if(g!=null){this.engine="html5"}else{if(typeof(window.swfobject)!="undefined"||g===false){var g=swfobject.getFlashPlayerVersion();if(g.major>=10){this.engine="flash"}}else{this._sl_v=this.getSLVersion();if(this._sl_v){this.engine="sl"}}}g=null}if(typeof(c)=="string"){c=document.getElementById(c)}this._upload_mp=(typeof(w)!="undefined"?w==true:true);this._upload_dnd=true;this._swf_file_url=n||"";this._swf_upolad_url=m||"";this._swf_logs=s;this._sl_xap=l;this._sl_upload_url=v;this._sl_logs=j;this.p=document.createElement("DIV");this.p.className+=" dhx_file_uploader";c.appendChild(this.p);this.p_files=document.createElement("DIV");this.p_files.className="dhx_upload_files";this.p.appendChild(this.p_files);this.p_controls=document.createElement("DIV");this.p_controls.className="dhx_upload_controls";this.p.appendChild(this.p_controls);this._files={};this._items={};this._data={};this._autoStart=false;this._autoRemove=false;this._titleScreen=true;this._enabled=true;this._uploaded_count=0;this._initToolbar=function(){this.b_opts={info:{onclick:null},browse:{onclick:null,tooltip:"Browse"},upload:{onclick:function(){if(!q._enabled){return}if(!q._uploading){q._uploadStart()}},tooltip:"Upload"},cancel:{onclick:function(){if(!q._enabled){return}q._uploadStop();q._switchButton(false)},tooltip:"Stop"},clear:{onclick:function(){if(!q._enabled){return}q.clear()},tooltip:"Clear list"}};this.buttons={};for(var x in this.b_opts){var y=document.createElement("DIV");y.innerHTML="&nbsp;";y.className="dhx_file_uploader_button button_"+x;y.onclick=this.b_opts[x].onclick;if(this.b_opts[x].tooltip){y.title=this.b_opts[x].tooltip}this.p_controls.appendChild(y);this.buttons[x]=y;y=null}this.buttons.cancel.style.display="none"};this._readableSize=function(y){var x=false;var a=["b","Kb","Mb","Gb","Tb","Pb","Eb"];for(var A=0;A<a.length;A++){if(y>1024){y=y/1024}else{if(x===false){x=A}}}if(x===false){x=a.length-1}return Math.round(y*100)/100+" "+a[x]};this._beforeAddFileToList=function(a,x){return(this.callEvent("onBeforeFileAdd",[a,x])===true)};this._addFileToList=function(D,x,A,C,a){this._checkTitleScreen();var y=document.createElement("DIV");y._idd=D;y.className="dhx_file dhx_file_"+C;y.innerHTML="<div class='dhx_file_param dhx_file_name'>&nbsp;</div><div class='dhx_file_param dhx_file_progress'>"+a+"%</div><div class='dhx_file_param dhx_file_delete' title='Remove from list'>&nbsp;</div>";this.p_files.appendChild(y);y.childNodes[0].style.width=y.offsetWidth-127+"px";this._items[D]=y;this._updateFileNameSize(D);y.childNodes[2].onclick=function(){if(!q._enabled){return}var E=this.parentNode._idd;q._removeFileFromQueue(E)};this.callEvent("onFileAdd",[x])};this._removeFileFromList=function(a){if(!this._items[a]){return}this._items[a].childNodes[2].onclick=null;this._items[a].parentNode.removeChild(this._items[a]);this._items[a]=null;delete this._items[a];if(this._data[a]){this._data[a]=null;delete this._data[a]}this._checkTitleScreen()};this._updateFileNameSize=function(a){this._items[a].childNodes[0].innerHTML=this._files[a].name+(!isNaN(this._files[a].size)?" ("+this._readableSize(this._files[a].size)+")":"&nbsp;");this._items[a].childNodes[0].title=this._files[a].name+(!isNaN(this._files[a].size)?" ("+this._readableSize(this._files[a].size)+")":"")};this._updateFileInList=function(y,x,a){if(!this._items[y]){return}this._items[y].className="dhx_file dhx_file_"+x;this._updateProgress(y,x,a);this._updateFileNameSize(y)};this._updateProgress=function(y,x,a){if(x=="uploading"&&a<100&&this._progress_type=="loader"){this._items[y].childNodes[1].className="dhx_file_param dhx_file_uploading";this._items[y].childNodes[1].innerHTML="&nbsp;"}else{this._items[y].childNodes[1].className="dhx_file_param dhx_file_progress";this._items[y].childNodes[1].innerHTML=a+"%"}this._updateFileNameSize(y)};this._removeFilesByState=function(y){for(var x in this._files){if(y===true||this._files[x].state==y){this._removeFileFromQueue(x)}}};this._switchButton=function(x){if(x==true){this.buttons.upload.style.display="none";this.buttons.cancel.style.display=""}else{var a=this._uploaded_count;this.buttons.upload.style.display="";this.buttons.cancel.style.display="none";this._uploaded_count=0;if(a>0){this.callEvent("onUploadComplete",[a])}}};this._uploadStart=function(){this._switchButton(true);if(!this._uploading){for(var x in this._files){if(this._files[x].state=="fail"){this._files[x].state="added";this._updateFileInList(x,"added",0)}}}this._uploading=true;var y=false;for(var x in this._files){if(!y&&[this._files[x].state]=="added"){y=true;this._files[x].state="uploading";this._updateFileInList(x,"uploading",0);this._doUploadFile(x)}}if(!y){this._uploading=false;this._switchButton(false)}};this._onUploadSuccess=function(C,A,y,a){if(typeof(y)!="undefined"&&this.engine=="flash"){var x=dhx4.s2j(y.data);if(x!=null&&x.state==true&&x.name!=null){A=x.name;if(x.extra!=null){a=x.extra}}else{this._onUploadFail(C,(x!=null&&x.extra!=null?x.extra:null));return}}this._uploaded_count++;this._data[C]={realName:this._files[C].name,serverName:A};this._files[C].state="uploaded";this._updateFileInList(C,"uploaded",100);this.callEvent("onUploadFile",[this._files[C].name,A,a]);if(this._autoRemove){this._removeFileFromQueue(C)}if(this._uploading){this._uploadStart()}};this._onUploadFail=function(x,a){this._files[x].state="fail";this._updateFileInList(x,"fail",0);this.callEvent("onUploadFail",[this._files[x].name,a]);if(this._uploading){this._uploadStart()}};this._onUploadAbort=function(a){this._uploading=false;this._files[a].state="added";this._updateFileInList(a,"added",0);this.callEvent("onUploadCancel",[this._files[a].name])};this._checkTitleScreen=function(){var y=0;for(var x in this._files){y++}if(y==0&&this.p.className.search("dhx_file_uploader_title")<0&&this._titleScreen){this.p.className+=" dhx_file_uploader_title";this.buttons.info.innerHTML=this._titleText;this.buttons.info.style.width=Math.max(this.p_controls.offsetWidth-134,0)+"px"}if((y>0||!this._titleScreen)&&this.p.className.search("dhx_file_uploader_title")>=0){this.p.className=this.p.className.replace(/dhx_file_uploader_title/g,"");this.buttons.info.innerHTML=""}};this.callEvent=function(){};this.upload=function(){if(!this._uploading){this._uploadStart()}};this.setAutoStart=function(a){this._autoStart=(a==true)};this.setAutoRemove=function(a){this._autoRemove=(a==true)};this.enableTitleScreen=function(a){this._titleScreen=(a==true);this._checkTitleScreen()};this.setTitleText=function(a){this._titleText=a;if(this.p.className.search("dhx_file_uploader_title")>=0){this.buttons.info.innerHTML=this._titleText}};this.setURL=function(a){this._url=a};this.setSWFURL=function(a){this._swf_upolad_url=a};this.enable=function(){this._enabled=true;this.p_files.className="dhx_upload_files";this.p_controls.className="dhx_upload_controls"};this.disable=function(){this._enabled=false;this.p_files.className="dhx_upload_files dhx_uploader_dis";this.p_controls.className="dhx_upload_controls dhx_uploader_dis"};this.getStatus=function(){var y=0;for(var x in this._files){if(this._files[x].state!="uploaded"){return -1}y=1}return y};this.getData=function(){return this._data};this.clear=function(){if(this.callEvent("onBeforeClear",[])!==true){return}if(this._uploading){q._uploadStop()}q._switchButton(false);q._removeFilesByState(true);this.callEvent("onClear",[])};this.unload=function(){this._removeFilesByState(true);this._data=null;this._files=null;this._items=null;this._unloadEngine();for(var x in this.buttons){this.buttons[x].onclick=null;this.buttons[x].parentNode.removeChild(this.buttons[x]);this.buttons[x]=null;delete this.buttons[x]}this.buttons=null;for(var x in this.b_opts){this.b_opts[x].onclick=null;this.b_opts[x]=null;delete this.b_opts[x]}this.b_opts=null;this.p_controls.parentNode.removeChild(this.p_controls);this.p_files.parentNode.removeChild(this.p_files);this.p.className=this.p.className.replace(/dhx_file_uploader_title/gi,"").replace(/dhx_file_uploader/gi,"");for(var x in this){this[x]=null}q=x=null};var r=new this[this.engine]();for(var u in r){this[u]=r[u];r[u]=null}u=r=c=null;this._initToolbar();this._initEngine();this._checkTitleScreen();return this}dhtmlXFileUploader.prototype.html5=function(){};dhtmlXFileUploader.prototype.html5.prototype={_initEngine:function(){var c=this;this.buttons.browse.onclick=function(){if(c._enabled){c.f.click()}};this._progress_type="percentage";var a=window.navigator.userAgent;if(a.match(/Windows/gi)!=null&&a.match(/AppleWebKit/gi)!=null&&a.match(/Safari/gi)!=null){if(a.match(/Version\/5\.1\.5/gi)){this._upload_mp=false}if(a.match(/Version\/5\.1[^\.\d{1,}]/gi)){this._upload_dnd=false}if(a.match(/Version\/5\.1\.1/gi)){this._upload_mp=false;this._upload_dnd=false}if(a.match(/Version\/5\.1\.2/gi)){this._upload_dnd=false}if(a.match(/Version\/5\.1\.7/gi)){this._upload_mp=false}}this._addFileInput();if(this._upload_dnd){this.p.ondragenter=function(g){if(!g.dataTransfer){return}g.stopPropagation();g.preventDefault()};this.p.ondragover=function(g){if(!g.dataTransfer){return}g.stopPropagation();g.preventDefault()};this.p.ondrop=function(g){if(!g.dataTransfer){return}g.stopPropagation();g.preventDefault();if(c._enabled){c._parseFilesInInput(g.dataTransfer.files)}};this._titleText="Drag-n-Drop files here or<br>click to select files for upload."}else{this._titleText="Click to select files for upload."}},_addFileInput:function(){if(this.f!=null){this.f.onchange=null;this.f.parentNode.removeChild(this.f);this.f=null}var a=this;this.f=document.createElement("INPUT");this.f.type="file";if(this._upload_mp){this.f.multiple="1"}this.f.className="dhx_uploader_input";this.p_controls.appendChild(this.f);this.f.onchange=function(){a._parseFilesInInput(this.files);if(window.dhx4.isOpera){a._addFileInput()}else{this.value=""}}},_doUploadFile:function(g){var c=this;if(!this._loader){this._loader=new XMLHttpRequest();this._loader.upload.onprogress=function(j){if(c._files[this._idd].state=="uploading"){c._updateFileInList(this._idd,"uploading",Math.round(j.loaded*100/j.total))}};this._loader.onload=function(l){var j=dhx4.s2j(this.responseText);if(typeof(j)=="object"&&j!=null&&typeof(j.state)!="undefined"&&j.state==true){c._onUploadSuccess(this.upload._idd,j.name,null,j.extra);j=null}else{c._onUploadFail(this.upload._idd,(j!=null&&j.extra!=null?j.extra:null))}};this._loader.onerror=function(j){c._onUploadFail(this.upload._idd)};this._loader.onabort=function(j){c._onUploadAbort(this.upload._idd)}}this._loader.upload._idd=g;var a=new FormData();a.append("file",this._files[g].file);this._loader.open("POST",this._url+(String(this._url).indexOf("?")<0?"?":"&")+"mode=html5&dhxr"+new Date().getTime(),true);this._loader.setRequestHeader("X-Requested-With","XMLHttpRequest");this._loader.send(a)},_uploadStop:function(){if(!this._uploading||!this._loader){return}this._loader.abort()},_parseFilesInInput:function(c){for(var a=0;a<c.length;a++){this._addFileToQueue(c[a])}},_addFileToQueue:function(a){if(!this._beforeAddFileToList(a.name,a.size)){return}var c=(a._idd||window.dhx4.newId());this._files[c]={file:a,name:a.name,size:a.size,state:"added"};this._addFileToList(c,a.name,a.size,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true)}},_removeFileFromQueue:function(j){if(!this._files[j]){return}var c=this._files[j].name;var g=(this._data!=null&&this._data[j]!=null?this._data[j].serverName:null);if(this.callEvent("onBeforeFileRemove",[c,g])!==true){return}var a=false;if(this._uploading&&j==this._loader.upload._idd&&this._files[j].state=="uploading"){this._uploadStop();a=true}this._files[j].file=null;this._files[j].name=null;this._files[j].size=null;this._files[j].state=null;this._files[j]=null;delete this._files[j];this._removeFileFromList(j);this.callEvent("onFileRemove",[c,g]);if(a){this._uploadStart()}},_unloadEngine:function(){this.buttons.browse.onclick=null;this.f.onchange=null;this.f.parentNode.removeChild(this.f);this.f=null;this.p.ondragenter=null;this.p.ondragover=null;this.p.ondrop=null;if(this._loader){this._loader.upload.onprogress=null;this._loader.onload=null;this._loader.onerror=null;this._loader.onabort=null;this._loader.upload._idd=null;this._loader=null}this._initEngine=null;this._doUploadFile=null;this._uploadStop=null;this._parseFilesInInput=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._unloadEngine=null}};dhtmlXFileUploader.prototype.html4=function(){};dhtmlXFileUploader.prototype.html4.prototype={_initEngine:function(){this._addForm();this._progress_type="loader";this._titleText="Click button<br>to select files for upload."},_addForm:function(){var a=this;var g=window.dhx4.newId();if(!this.k){this.k=document.createElement("DIV");this.k.className="dhx_file_form_cont";this.buttons.browse.appendChild(this.k);this.fr_name="dhx_file_"+window.dhx4.newId();this.k.innerHTML='<iframe name="'+this.fr_name+'" style="height:0px;width:0px;" frameBorder="0"></iframe>';this.fr=this.k.firstChild;if(window.navigator.userAgent.indexOf("MSIE")>=0){this.fr.onreadystatechange=function(){if(this.readyState=="complete"){a._onLoad()}}}else{this.fr.onload=function(){a._onLoad()}}}var c=document.createElement("DIV");c.innerHTML="<form method='POST' enctype='multipart/form-data' target='"+this.fr_name+"' class='dhx_file_form' name='dhx_file_form_"+window.dhx4.newId()+"'><input type='hidden' name='mode' value='html4'><input type='hidden' name='uid' value='"+g+"'><input type='file' name='file' class='dhx_file_input'></form>";this.k.appendChild(c);c.firstChild.lastChild._idd=g;c.firstChild.lastChild.onchange=function(){if(!a._beforeAddFileToList(this.value,null)){return}a._addFileToQueue(this);this.onchange=null;this.parentNode.parentNode.style.display="none";a._addForm()};c=null},_onLoad:function(){if(this._uploading){var a=dhx4.s2j(this.fr.contentWindow.document.body.innerHTML);if(typeof(a)=="object"&&a!=null){if(typeof(a.state)!="undefined"){if(a.state=="cancelled"){this._onUploadAbort(this.fr._idd);a=null;return}else{if(a.state==true){if(typeof(a.size)!="undefined"&&!isNaN(a.size)){this._files[this.fr._idd].size=a.size}this._onUploadSuccess(this.fr._idd,a.name,null,a.extra);a=null;return}}}}this._onUploadFail(this.fr._idd,(a!=null&&a.extra!=null?a.extra:null))}},_addFileToQueue:function(c){var a=c.value.match(/[^\\\/]*$/g);if(a[0]!=null){a=a[0]}else{a=c.value}this._files[c._idd]={name:a,form:c.parentNode,node:c.parentNode.parentNode,input:c,state:"added"};this._addFileToList(c._idd,c.value,false,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true)}},_removeFileFromQueue:function(g){var a=this._files[g].name;var c=(this._data!=null&&this._data[g]!=null?this._data[g].serverName:null);if(this.callEvent("onBeforeFileRemove",[a,c])!==true){return}this._files[g].input.onchange=null;this._files[g].form.removeChild(this._files[g].input);this._files[g].node.removeChild(this._files[g].form);this._files[g].node.parentNode.removeChild(this._files[g].node);this._files[g].input=null;this._files[g].name=null;this._files[g].form=null;this._files[g].node=null;this._files[g].size=null;this._files[g].state=null;this._files[g]=null;delete this._files[g];this._removeFileFromList(g);this.callEvent("onFileRemove",[a,c])},_doUploadFile:function(a){this.fr._idd=a;this._files[a].form.action=this._url;this._files[a].form.submit()},_uploadStop:function(){if(!this._uploading){return}this.fr.contentWindow.location.href=(this._url)+(this._url.indexOf("?")<0?"?":"&")+"mode=html4&action=cancel&dhxr"+new Date().getTime()},_unloadEngine:function(){if(this.k){this.fr_name=null;this.fr.onreadystatechange=null;this.fr.onload=null;this.fr.parentNode.removeChild(this.fr);this.fr=null;this.k.firstChild.firstChild.lastChild.onchange=null;this.k.parentNode.removeChild(this.k);this.k=null}this._initEngine=null;this._addForm=null;this._onLoad=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._doUploadFile=null;this._uploadStop=null;this._unloadEngine=null}};dhtmlXFileUploader.prototype.flash=function(){};dhtmlXFileUploader.prototype.flash.prototype={_initEngine:function(){if(!window.dhtmlXFileUploaderSWFObjects){window.dhtmlXFileUploaderSWFObjects={items:{},callEvent:function(l,g,j){return window.dhtmlXFileUploaderSWFObjects.items[l].uploader[g].apply(window.dhtmlXFileUploaderSWFObjects.items[l].uploader,j)}}}var c=this;this._swf_obj_id="dhtmlXFileUploaderSWFObject_"+window.dhx4.newId();this._swf_file_url=this._swf_file_url+(this._swf_file_url.indexOf("?")>=0?"&":"?")+"dhxr"+new Date().getTime();this.buttons.browse.innerHTML="<div id='"+this._swf_obj_id+"' style='width:100%;height:100%;'></div>";swfobject.embedSWF(this._swf_file_url,this._swf_obj_id,"100%","100%","9",null,{ID:this._swf_obj_id,enableLogs:this._swf_logs},{wmode:"transparent"});var a=swfobject.getFlashPlayerVersion();this._titleText="Engine successfuly inited<br>Flash Player: "+a.major+"."+a.minor+"."+a.release;this._progress_type="percentage";window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]={id:this._swf_obj_id,uploader:this}},_beforeAddFileToQueue:function(a,c){return(this.callEvent("onBeforeFileAdd",[a,c])===true)},_addFileToQueue:function(j,c,g){if(window.dhx4.isIE){var a=document.createElement("INPUT");a.type="TEXT";a.style.position="absolute";a.style.left="0px";a.style.top=window.dhx4.absTop(this.buttons.browse)+"px";a.style.width="10px";document.body.appendChild(a);a.focus();document.body.removeChild(a);a=null}this._files[j]={name:c,size:g,state:"added"};this._addFileToList(j,c,g,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true)}},_removeFileFromQueue:function(j){if(!this._files[j]){return}var c=this._files[j].name;var g=(this._data!=null&&this._data[j]!=null?this._data[j].serverName:null);if(this.callEvent("onBeforeFileRemove",[c,g])!==true){return}var a=false;if(this._uploading&&this._files[j].state=="uploading"){this._uploadStop();a=true}swfobject.getObjectById(this._swf_obj_id).removeFileById(j);this._files[j].name=null;this._files[j].size=null;this._files[j].state=null;this._files[j]=null;delete this._files[j];this._removeFileFromList(j);this.callEvent("onFileRemove",[c,g]);if(a){this._uploadStart()}},_doUploadFile:function(a){swfobject.getObjectById(this._swf_obj_id).upload(a,this._swf_upolad_url)},_uploadStop:function(g){for(var c in this._files){if(this._files[c].state=="uploading"){swfobject.getObjectById(this._swf_obj_id).uploadStop(c)}}},_unloadEngine:function(){if(window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]){window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id].id=null;window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id].uploader=null;window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]=null;delete window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]}this._swf_obj_id=null;this._initEngine=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._doUploadFile=null;this._uploadStop=null;this._unloadEngine=null}};dhtmlXFileUploader.prototype.sl=function(){};dhtmlXFileUploader.prototype.sl.prototype={_initEngine:function(){if(typeof(this._sl_v)=="undefined"){this._sl_v=this.getSLVersion()}if(!window.dhtmlXFileUploaderSLObjects){window.dhtmlXFileUploaderSLObjects={items:{},callEvent:function(g,a,c){window.dhtmlXFileUploaderSLObjects.items[g].uploader[a].apply(window.dhtmlXFileUploaderSLObjects.items[g].uploader,c)}}}this._sl_obj_id="dhtmlXFileUploaderSLObject_"+window.dhx4.newId();if(this._sl_v!=false){this._titleText="Engine successfuly inited<br>Silverlight version: "+this._sl_v[0]+"."+this._sl_v[1];this.buttons.browse.innerHTML='<div style="width:100%;height:100%;"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" id="'+this._sl_obj_id+'"><param name="source" value="'+this._sl_xap+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="initParams" value="SLID='+this._sl_obj_id+",LOGS="+this._sl_logs+'"/><param name="minRuntimeVersion" value="5.0"/></object></div>'}else{this._titleText="Silverlight plugin not found<br>or version less than 4.0";this.buttons.browse.style.cursor="wait";this.buttons.browse.title=""}this._progress_type="percentage";window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]={id:this._sl_obj_id,uploader:this}},_addFileToQueue:function(g,a,c){this._files[g]={name:a,size:c,state:"added"};this._addFileToList(g,a,c,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true)}},_removeFileFromQueue:function(c){if(!this._files[c]){return}var a=false;if(this._uploading&&this._files[c].state=="uploading"){this._uploadStop();a=true}document.getElementById([this._sl_obj_id]).Content.a.removeFileById(c);this._files[c].name=null;this._files[c].size=null;this._files[c].state=null;this._files[c]=null;delete this._files[c];this._removeFileFromList(c);if(a){this._uploadStart()}},_doUploadFile:function(c){var a=this._sl_upload_url.split("?");a=(a[1]!=null?"&"+a[1]:"");document.getElementById(this._sl_obj_id).Content.a.upload(c,this._sl_upload_url,a+"&mode=sl&dhxr"+new Date().getTime())},_uploadStop:function(g){this._uploading=false;for(var c in this._files){if(this._files[c].state=="uploading"){document.getElementById(this._sl_obj_id).Content.a.uploadStop(c)}}},_unloadEngine:function(){if(window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]){window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].id=null;window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].uploader=null;window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]=null;delete window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]}this._sl_obj_id=null;this._initEngine=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._doUploadFile=null;this._uploadStop=null;this._unloadEngine=null}};dhtmlXFileUploader.prototype.setSLURL=function(a){this._sl_upload_url=a};dhtmlXFileUploader.prototype.getSLVersion=function(){var a=false;if(window.dhx4.isIE){try{var c=new ActiveXObject("AgControl.AgControl");if(c!=null){var l=4,j=0;while(c.isVersionSupported([l,j].join("."))){a=[l,j];if(++j>9){l++;j=0}}}c=null}catch(g){}}else{if(navigator.plugins["Silverlight Plug-In"]!=null){a=navigator.plugins["Silverlight Plug-In"].description.split(".")}}return a};dhtmlXForm.prototype.saveBackup=function(){if(!this._backup){this._backup={};this._backupId=new Date().getTime()}this._backup[++this._backupId]=this.getFormData();return this._backupId};dhtmlXForm.prototype.restoreBackup=function(a){if(this._backup!=null&&this._backup[a]!=null){this.setFormData(this._backup[a])}};dhtmlXForm.prototype.clearBackup=function(a){if(this._backup!=null&&this._backup[a]!=null){this._backup[a]=null;delete this._backup[a]}};dhtmlXForm.prototype.addItem=function(g,a,m,j){var c=null;if(g instanceof Array){c=g[1];g=g[0]}var l=null;if(g!=null){var l=this._getParentForm(g,c);if(l!=null){if(l.item._list==null){if(!a.listParent){a.listParent=l.item._idd}l.form._addItem("list",l.item._idd,[a],null,l.item._idd,m,j)}else{l.item._list[0].addItem(null,a,m,j)}l.form=l.item=null;l=null;this._autoCheck();return}}this._prepareItem(a,m,j);this._autoCheck()};dhtmlXForm.prototype.removeItem=function(c,a){this._removeItem(c,a)};dhtmlXForm.prototype.removeColumn=function(n,m,j,g){var r=null;if(n instanceof Array){r=n[1];n=n[0]}if(n!=null){var l=this._getParentForm(n,r);if(l!=null){if(l.item._list!=null&&l.item._list[0]!=null){l.item._list[0].removeColumn(null,m,j,g)}l.form=l.item=null;l=null}return}m=Math.min(Math.max(m,0),this.cont.childNodes.length-1);if(this.cont.childNodes.length==1){if(j==true){this._removeItemsInColumn(this.cont.childNodes[m])}}else{if(j==true){this._removeItemsInColumn(this.cont.childNodes[m])}else{if(!g){var a=m-1;if(a<0){a=m+1}}else{var a=m+1;if(a>this.cont.childNodes.length-1){a=m-1}}while(this.cont.childNodes[m].childNodes.length>0){this.cont.childNodes[a].appendChild(this.cont.childNodes[m].childNodes[0])}}var o=[];for(var c=0;c<this.base.length;c++){if(this.cont.childNodes[m]!=this.base[c]){o.push(this.base[c])}}this.base=o;this.cont.removeChild(this.cont.childNodes[m]);this.b_index--;o=null}};dhtmlXForm.prototype.getColumnNode=function(g,c){var j=null;var a=null;if(g instanceof Array){a=g[1];g=g[0]}if(g!=null){var l=this._getParentForm(g,a);if(l!=null){if(l.item._list!=null&&l.item._list[0]!=null&&j==null){j=l.item._list[0].getColumnNode(null,c)}l.form=l.item=null;l=null}return j}if(c<0||c>this.cont.childNodes.length-1){return null}return this.cont.childNodes[c]};dhtmlXForm.prototype._removeItemsInColumn=function(j){var a=[];for(var g=0;g<j.childNodes.length;g++){var c=j.childNodes[g];if(c._idd!=null&&c._type!=null){a.push([c._idd,(c._type=="ra"?c._value:null)])}c=null}for(var g=0;g<a.length;g++){this.removeItem(a[g][0],a[g][1])}};dhtmlXForm.prototype._getParentForm=function(m,l){if(this.itemPull[this.idPrefix+m]!=null){return{form:this,item:this.itemPull[this.idPrefix+m]}}for(var c in this.itemPull){if(this.itemPull[c]._type=="ra"&&this.itemPull[c]._group==m&&this.itemPull[c]._value==l){return{form:this,item:this.itemPull[c]}}}var j=null;for(var c in this.itemPull){if(!j&&this.itemPull[c]._list!=null){for(var g=0;g<this.itemPull[c]._list.length;g++){if(!j){j=this.itemPull[c]._list[g]._getParentForm(m,l)}}}}return j};(function(){for(var c in dhtmlXForm.prototype.items){if(!dhtmlXForm.prototype.items[c]._getItemNode){dhtmlXForm.prototype.items[c]._getItemNode=function(a){return a}}}})();dhtmlXForm.prototype._getItemNode=function(c,a){if(a!=null){c=[c,a]}return this.doWithItem(c,"_getItemNode")};dhtmlXForm.prototype.setRequired=function(o,m,l){if(typeof(l)=="undefined"){l=m}else{o=[o,m]}var g=this._getItemNode(o);if(!g){return}l=window.dhx4.s2b(l);g._required=(l==true);if(g._required){if(!g._validate){g._validate=[]}var c=false;for(var j=0;j<g._validate.length;j++){c=(g._validate[j]=="NotEmpty"||c)}if(!c){g._validate.push("NotEmpty")}var n=g.childNodes[g._ll?0:1].childNodes[0];if(!(n.lastChild&&n.lastChild.className&&n.lastChild.className.search(/required/)>=0)){var a=document.createElement("SPAN");a.className="dhxform_item_required";a.innerHTML="*";n.appendChild(a);a=n=null}}else{if(g._validate!=null){var c=g._validate;g._validate=[];for(var j=0;j<c.length;j++){if(c[j]!="NotEmpty"){g._validate.push(c[j])}}if(g._validate.length==0){g._validate=null}}var n=g.childNodes[g._ll?0:1].childNodes[0];if(n.lastChild&&n.lastChild.className&&n.lastChild.className.search(/required/)>=0){n.removeChild(n.lastChild);n=null}}this._resetValidateCss(g);g=null};dhtmlXForm.prototype.setNote=function(l,g,a){if(typeof(a)=="undefined"){a=g}else{l=[l,g]}var c=this._getItemNode(l);if(!c){return}var j=this._getNoteNode(c);if(!j){if(!a.width){a.width=c.childNodes[c._ll?1:0].childNodes[0].offsetWidth}j=document.createElement("DIV");j.className="dhxform_note";if({ch:1,ra:1}[c._type]){c.childNodes[c._ll?1:0].insertBefore(j,c.childNodes[c._ll?1:0].lastChild)}else{c.childNodes[c._ll?1:0].appendChild(j)}}j.innerHTML=a.text;if(a.width!=null){j.style.width=a.width+"px";j._w=a.width}j=null};dhtmlXForm.prototype.clearNote=function(j,c){if(typeof(c)!="undefined"){j=[j,c]}var a=this._getItemNode(j);if(!a){return}var g=this._getNoteNode(a);if(g!=null){g.parentNode.removeChild(g);g=null}};dhtmlXForm.prototype._getNoteNode=function(a){var g=null;for(var c=0;c<a.childNodes[a._ll?1:0].childNodes.length;c++){if(String(a.childNodes[a._ll?1:0].childNodes[c].className).search(/dhxform_note/)>=0){g=a.childNodes[a._ll?1:0].childNodes[c]}}a=null;return g};dhtmlXForm.prototype.setValidation=function(m,j,l){if(typeof(note)=="undefined"){l=j}else{m=[m,j]}var c=this._getItemNode(m);if(!c){return}if(c._validate!=null){for(var g=0;g<c._validate.length;g++){c._validate[g]=null}}c._validate=[];if(typeof(l)=="function"||typeof(window[l])=="function"){c._validate=[l]}else{c._validate=String(l).split(this.separator)}if(c._required){var a=false;for(var g=0;g<c._validate.length;g++){a=(c._validate[g]=="NotEmpty"||a)}if(!a){c._validate.push("NotEmpty")}}c=null};dhtmlXForm.prototype.clearValidation=function(j,g){if(typeof(g)!="undefined"){j=[j,g]}var a=this._getItemNode(j);if(!a){return}if(a._validate!=null){for(var c=0;c<a._validate.length;c++){a._validate[c]=null}}a._validate=a._required?["NotEmpty"]:null;a=null};dhtmlXForm.prototype.reloadOptions=function(a,m){var c=this.getItemType(a);if(!{select:1,multiselect:1,combo:1}[c]){return}if(c=="select"||c=="multiselect"){var j=this.getOptions(a);while(j.length>0){j.remove(0)}j.length=0;j=null;if(typeof(m)=="string"){this.doWithItem(a,"doLoadOptsConnector",m)}else{if(m instanceof Array){this.doWithItem(a,"doLoadOpts",{options:m})}}}if(c=="combo"){var n=this.getCombo(a);n.clearAll();n.setComboValue("");if(typeof(m)=="string"){this.doWithItem(a,"doLoadOptsConnector",m)}else{if(m instanceof Array){var g=null;for(var l=0;l<m.length;l++){if(window.dhx4.s2b(m[l].selected)){g=m[l].value}}n.addOption(m);if(g!=null){this.setItemValue(a,g)}n=null}}}};dhtmlXForm.prototype.setTooltip=function(m,l,j){if(typeof(j)=="undefined"){j=l}else{m=[m,l]}var c=this._getItemNode(m);if(!c){return}var a=null;if(c.childNodes.length==1){a=c.childNodes[0]}else{for(var g=0;g<c.childNodes.length;g++){if(c.childNodes[g].className!=null&&c.childNodes[g].className.search("dhxform_label")>=0){a=c.childNodes[g]}}}if(a!=null){if(j==null||j.length==0){a.removeAttribute("title")}else{a.title=j}}a=null};function dhtmlXAccordion(l,n){var j=this;var g=window.dhx4.transDetect();this.conf={skin:(n||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxacc")||"dhx_skyblue"),css:"dhxacc",icons_path:"",multi_mode:false,last_opened:null,on_active_id:null,on_active_click:false,size_changed:true,def_height:90,total_count:0,hiden_count:0,cont_w:null};this.conf.tr={prop:g.transProp,ev:g.transEv,height_open:"height 0.2s cubic-bezier(0.25,0.1,0.25,1)",height_close:"height 0.18s cubic-bezier(0.25,0.1,0.25,1)",op_open:"opacity 0.16s ease-in",op_close:"opacity 0.2s ease-out",op_v_open:"1",op_v_close:"0.4",dnd_top:"top 0.16s"};this.ofs={m:{},s:{},def:{m:{left:0,right:0,first:0,between:8},s:{left:0,right:0,first:0,between:-1,last:0}},base:{s:{},m:{}},skin:{dhx_web:{s:{between:3},m:{between:3}},dhx_terrace:{m:{between:12,left:0,right:0}}}};if(navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>=0){this.conf.tr.height_open=this.conf.tr.height_close}else{this.conf.tr.height_open=this.conf.tr.height_close}var m=null;if(typeof(l)=="object"&&!l.tagName){m={};for(var c in l){m[c]=l[c];l[c]=null}l=m.parent;m.parent=null}window.dhtmlXCellTop.apply(this,[l,l._ofs]);this._adjustCont();if(this.base._ofs!=null){for(var o in this.ofs.base){if(this.base._ofs[o]!=null){for(var c in this.base._ofs[o]){this.ofs.base[o][c]=this.base._ofs[o][c]}}}}this._applyOffsets=function(){for(var v in this.ofs.def){var s=this.ofs.def[v];var u=(this.ofs.skin[this.conf.skin]!=null&&this.ofs.skin[this.conf.skin][v]!=null?this.ofs.skin[this.conf.skin][v]:null);var r=(this.base._ofs!=null?this.base._ofs[v]:null);for(var q in s){if(u!=null&&u[q]!=null){this.ofs[v][q]=u[q]}else{if(r!=null&&r[q]!=null){this.ofs[v][q]=r[q]}else{this.ofs[v][q]=s[q]}}}}};this._applyOffsets();this.t={};this.addItem=function(x,w,r,q,v){if(x==null){x="a"+window.dhx4.newId()}while(this.t[x]!=null){x="a"+window.dhx4.newId()}var a=new dhtmlXAccordionCell(x,this);a.conf.skin=this.conf.skin;a.setText(w);if(v!=null){a.setIcon(v)}a.cell._accId=x;a.cell.childNodes[a.conf.idx.hdr].onselectstart=function(y){y=y||event;if(y.preventDefault){y.preventDefault()}else{y.returnValue=false}return false};a.cell.childNodes[a.conf.idx.hdr].onclick=function(A){A=A||event;if(A.preventDefault){A.preventDefault()}else{A.returnValue=false}if(j._dnd!=null&&j._dnd.ofs==true){return}var y=(A.target||A.srcElement);var C=null;while(y._accId!=this&&C==null){if(y._accId!=null){C=y._accId}else{y=y.parentNode}}if(C!=null){j._hdrClick(C)}};this.t[x]={cell:a};this.conf.total_count++;if(this.conf.multi_mode){if(typeof(r)=="undefined"){r=true}this.cont.appendChild(a.cell);a.conf.opened=(r==true);if(typeof(q)=="undefined"||q==null||q=="*"){if(q=="*"){a.conf.h_auto=true}q=this.conf.def_height}else{q=Math.max(parseInt(q),30)}a._setSize(this.ofs.m.left,0,this.conf.cont_w||this._getAvailItemWidth(),a.conf.opened?q:a._getHdrHeight());a.cell.style.marginTop=(a.cell==this.cont.firstChild?this.ofs.m.first:this.ofs.m.between)+"px";if(r!=true){a.conf.size.h=q;a._adjustCell();a.cell.className+=" dhx_cell_closed"}this._adjustOpened();if(this._dnd!=null){this._dndAttachEvent(x)}}else{r=(this.conf.last_opened==null?true:window.dhx4.s2b(r));var u=this._updateCellsHeight();if(this.conf.last_opened!=null){if(r){this._closeItem(this.conf.last_opened,false)}else{var s=this.t[this.conf.last_opened].cell;s._setSize(s.conf.size.x,s.conf.size.y,s.conf.size.w,u);s=null}}this.cont.appendChild(a.cell);a.conf.opened=r;a.cell.style.marginTop=String(a.cell==this.cont.firstChild?this.ofs.s.first:this.ofs.s.between)+"px";a._setSize(this.ofs.s.left,0,this.conf.cont_w||this._getAvailItemWidth(),r?u:a._getHdrHeight());if(r){this.conf.last_opened=x}else{a.conf.size.h=u;a._adjustCell();a.cell.className+=" dhx_cell_closed"}}a=null;return this.t[x].cell};this.removeItem=function(a){if(!this.t[a]){return}if(this.conf.last_opened==a){this.conf.last_opened=null}if(this.conf.on_active_id==a){this.conf.on_active_id=null}if(this._dnd!=null){this._dndClearCell(a)}this.conf.total_count--;if(!this.conf.multi_mode&&!this.t[a].cell.conf.visible){this.conf.hiden_count--}this.t[a].cell._unload();this.t[a].cell=null;this.t[a]=null;delete this.t[a];if(!this.conf.unloading){if(!this.conf.multi_mode){this._updateCellsMargin()}this.setSizes()}};this.cells=function(a){return this.t[a].cell};this.enableMultiMode=function(a,q){this.conf.multi_mode=true;if(!isNaN(q)){this.conf.def_height=q}if(a=="auto"||a=="scroll"){this.cont.style.overflowX="hidden";this.cont.style.overflowY=a}else{this.cont.style.overflow="visible"}};this.forEachItem=function(r){for(var q in this.t){if(typeof(r)=="function"){r.apply(this,[this.t[q].cell])}else{if(typeof(r)=="string"&&typeof(window[r])=="function"){window[r].apply(this,[this.t[q].cell])}}}};this._openItem=function(q,a){if(typeof(a)=="undefined"){a=true}if(this.t[q].cell.conf.opened==false){if(this.conf.multi_mode){this.t[q].cell._open(a)}else{if(this.conf.tr.prop==false){if(this.conf.last_opened!=null){this.t[this.conf.last_opened].cell._close(false)}this.t[q].cell._open(false);this.conf.last_opened=q}else{this.conf.on_active_id=q;this.t[q].cell._open(a);if(this.conf.last_opened!=null){this.t[this.conf.last_opened].cell._close(a)}this.conf.last_opened=q}}}};this._closeItem=function(q,a){if(typeof(a)=="undefined"){a=true}if(this.t[q].cell.conf.opened==true){this.t[q].cell._close(a);this.conf.last_opened=null}};this._adjustOpened=function(){if(this.conf.multi_mode==true){if(this._openCache==null){var u=this._getDynData();for(var r in u){this.t[r].cell.conf.size.h=u[r];this.t[r].cell.cell.style.height=u[r]+"px"}}else{var v=false;for(var r in this._openCache){v=(v||this._openCache[r])}if(v==true){return}this._openCache=this._openId=null}var q=this._getAvailItemWidth();for(var r in this.t){var s=true;if(q==this.t[r].cell.conf.size.w&&(this._openMode=="close"||this.t[r].cell.conf.opened==false)){s=false}if(s){this.t[r].cell._setWidth(q)}}this._openMode=null}else{if(this.conf.last_opened!=null){var w=this.conf.last_opened;this.t[w].cell._setSize(this.t[w].cell.conf.size.x,this.t[w].cell.conf.size.y,this.t[w].cell.conf.size.w,this.t[w].cell.conf.size.h)}}};this._getDynData=function(E,D){if(typeof(E)=="undefined"||E==null){E={}}if(typeof(D)=="undefined"||D==null){D={}}var x={};var C=0;var w=0;var u=0;for(var r=0;r<this.cont.childNodes.length;r++){var s=this.cont.childNodes[r]._accId;var H=this.t[s].cell;if(H.conf.visible==true){var y=this.ofs.m[u==0?"first":"between"];if(E[s]==true||D[s]==true||(H.conf.opened==true&&H.conf.h_auto==true)){if(D[s]==true){var A=H._getHdrHeight();x[s]=A;w+=A+y}else{if(H.conf.h_auto==true){x[s]=true;w+=y;C++}else{if(E[s]==true){x[s]=H.conf.size.h;w+=H.conf.size.h+y}}}}else{w+=H.cell.offsetHeight+y}u++}H=null}if(C>0){var v=this.cont.offsetHeight-w;var w=Math.floor(v/C);for(var F in x){if(x[F]==true){if(C>1){v-=w}else{w=v}x[F]=w;C--}}}return x};this.setSizes=function(){this._adjustCont();if(this.conf.multi_mode==true){this._adjustOpened()}else{this.conf.cont_w=null;var r=this._updateCellsHeight();for(var q in this.t){this.t[q].cell._setSize(this.ofs.s.left,0,this.conf.cont_w||this._getAvailItemWidth(),this.t[q].cell.conf.opened?r:this.t[q].cell._getHdrHeight());if(!this.t[q].cell.conf.opened){this.t[q].cell.conf.size.h=r;this.t[q].cell._adjustCell()}}this.conf.size_changed=true}this.callEvent("_onSetSizes",[])};this.setSkin=function(r){this._setBaseSkin(r);this.conf.skin=r;for(var q in this.t){this.t[q].cell.conf.cells_cont=null;this.t[q].cell.conf.skin=this.conf.skin}this._applyOffsets();this._updateCellsMargin();this.setSizes()};this.setIconsPath=function(a){this.conf.icons_path=a};this._getAvailItemWidth=function(){var q=this.ofs[(this.conf.multi_mode?"m":"s")];var a=Math.max(this.cont.clientWidth-q.left-q.right,10);this.conf.cont_w=a;q=null;return a};this._updateCellsHeight=function(){if(this.conf.multi_mode==true){return}var s=this.conf.total_count-this.conf.hiden_count;var u=this.cont.offsetHeight-this.ofs.s.last;if(s==0){return u}var w=false;for(var v=0;v<this.cont.childNodes.length;v++){if(w==false){var x=this.cont.childNodes[v]._accId;if(this.t[x].cell.conf.visible){u-=this.t[x].cell._getHdrHeight()*(s-1);w=true}}}u-=(s-1)*this.ofs.s.between+this.ofs.s.first;for(var r in this.t){if(this.t[r].cell.conf.size!=null){this.t[r].cell.conf.size.h=u;this.t[r].cell._adjustCell()}}return u};this._updateCellsMargin=function(){var a=0;for(var r=0;r<this.cont.childNodes.length;r++){var s=this.cont.childNodes[r]._accId;if(this.t[s].cell.conf.visible){this.t[s].cell.cell.style.marginTop=String(this.ofs[this.conf.multi_mode?"m":"s"][a++==0?"first":"between"])+"px"}}};this._hdrClick=function(q){if(!this.conf.multi_mode&&this.t[q].cell.conf.opened){return}var a=this.t[q].cell.conf.opened;if(this.callEvent("onBeforeActive",[q,(a?false:true)])!==true){return}this.conf.on_active_click=true;this[a?"_closeItem":"_openItem"](q);if(this.conf.multi_mode&&this.conf.tr.prop==false){this._adjustOpened()}};this.unload=function(){this.conf.unloading=true;for(var q in this.t){this.removeItem(q)}this.t=null;if(typeof(this._unloadDND)=="function"){this._unloadDND()}if(this.conf.fs_mode){if(this.conf.fs_tm){window.clearTimeout(this.conf.fs_tm)}if(window.addEventListener){window.removeEventListener("resize",this._doOnResizeStart,false)}else{window.detachEvent("onresize",this._doOnResizeStart)}this._doOnResizeStart=null;this._doOnResizeEnd=null;this.conf.fs_tm=null}if(this.dhxWins){this.dhxWins.unload();this.dhxWins=null}this._unloadTop();window.dhx4._enableDataLoading(this,null,null,null,"clear");window.dhx4._eventable(this,"clear");this.ofs=this.conf=null;for(var q in this){this[q]=null}j=null};this.setOffset=function(a){this.ofs.s.between=a;this.ofs.m.between=a;this._updateCellsMargin();this.setSizes()};this._initObj=function(r){if(r.skin!=null){this.setSkin(r.skin)}if(window.dhx4.s2b(r.multi_mode)){this.enableMultiMode()}if(r.icons_path!=null){this.setIconsPath(r.icons_path)}if(r.icon_path!=null){this.setIconsPath(r.icon_path)}if(r.items!=null){for(var a=0;a<r.items.length;a++){this.addItem(r.items[a].id,r.items[a].text,r.items[a].open,r.items[a].height,r.items[a].icon||r.items[a].img)}}if(window.dhx4.s2b(r.dnd)==true&&typeof(this.enableDND)=="function"){this.enableDND()}};this._xmlToObj=function(v){var s={items:[]};var a=v.getElementsByTagName("accordion")[0];if(a.getAttribute("skin")!=null){s.skin=a.getAttribute("skin")}if(a.getAttribute("mode")=="multi"){s.multi_mode=true}if(a.getAttribute("multiMode")!=null){s.multi_mode=window.dhx4.s2b(a.getAttribute("multiMode"))}if(a.getAttribute("iconsPath")!=null){s.icons_path=a.getAttribute("iconsPath")}for(var u=0;u<a.childNodes.length;u++){var w=a.childNodes[u];if(typeof(w.tagName)!="undefined"&&String(w.tagName).toLowerCase()=="cell"){var r={};if(w.getAttribute("id")!=null){r.id=w.getAttribute("id")}if(w.getAttribute("icon")!=null){r.icon=w.getAttribute("icon")}if(w.getAttribute("height")!=null){r.height=w.getAttribute("height")}if(w.getAttribute("open")!=null){r.open=window.dhx4.s2b(w.getAttribute("open"))}r.text=w.firstChild.nodeValue;s.items.push(r)}w=null}return s};window.dhx4._enableDataLoading(this,"_initObj","_xmlToObj","accordion",{struct:true});window.dhx4._eventable(this);this._callMainEvent=function(q,a){return this.callEvent(q,a)};this.attachEvent("onActive",function(a){if(this.t[a].cell.dataObj!=null&&this.t[a].cell.dataType=="editor"){this.t[a].cell.dataObj._prepareContent(true)}if(this.t[a].cell.conf.opened==true){this.t[a].cell._adjustProgress()}});if(typeof(window.dhtmlXWindows)=="function"){this.dhxWins=new dhtmlXWindows();this.dhxWins.setSkin(this.conf.skin)}if(m!=null){this._initObj(m);m=null}return this}dhtmlXAccordion.prototype=new dhtmlXCellTop();function dhtmlXAccordionCell(j,g){dhtmlXCellObject.apply(this,[j,"_acc"]);this.acc=g;this.conf.visible=true;this.conf.docked=true;this.attachEvent("_onCellUnload",function(){this._trDetachEv();this._unloadDocking();this.acc=null;this.cell._accObj=null;this.cell.childNodes[this.conf.idx.hdr].onselectstart=null;this.cell.childNodes[this.conf.idx.hdr].onclick=null;this._initHeader=null;this._getHdrHeight=null;this._setWidth=null;this._adjustCell=null;this._open=null;this._close=null;this._isOpened=null;this._trInitEv=null;this._trAttachEv=null;this._trDetachEv=null;this._trOnEnd=null;this._onActiveCall=null;this.setText=null;this.getText=null;this.setIcon=null;this.clearIcon=null;this.show=null;this.hide=null;this.isVisible=null;this.setHeight=null;this.moveOnTop=null});this.acc.attachEvent("onBeforeDrag",function(m){if(this.t[m].cell.dataObj!=null&&this.t[m].cell.dataType=="editor"){if(this.conf.editor_data==null){this.conf.editor_data={}}this.conf.editor_data[m]=this.t[m].cell.dataObj.getContent()}for(var l in this.t){this.t[l].cell._showCellCover()}return true});this.acc.attachEvent("onDrop",function(m){if(this.t[m].cell.dataObj!=null&&this.t[m].cell.dataType=="editor"){this.t[m].cell.dataObj._prepareContent(true);if(this.conf.editor_data!=null&&this.conf.editor_data[m]!=null){this.t[m].cell.dataObj.setContent(this.conf.editor_data[m]);this.conf.editor_data[m]=null}}for(var l in this.t){this.t[l].cell._hideCellCover()}});this.attachEvent("_onContentLoaded",function(){this.acc._callMainEvent("onContentLoaded",arguments)});this.attachEvent("_onBeforeContentAttach",function(a){if(a=="sidebar"){this._hideBorders()}});this._initHeader();this.conf.tr={};for(var c in this.acc.conf.tr){this.conf.tr[c]=this.acc.conf.tr[c]}if(this.conf.tr.prop!=false){this.attachEvent("_onIdxUpdated",function(){this._cellSetOpacity((this.conf.opened?"open":"close"),false)})}this.open=function(){this.acc._openItem(this._idd)};this.close=function(){this.acc._closeItem(this._idd)};this._setWidth=function(a){if(a!=this.conf.size.w){this.conf.size.w=a;this.cell.style.width=a+"px"}this._adjustCell()};this._adjustCell=function(){this._adjustCont();if(this.dataObj!=null&&typeof(this.dataObj.setSizes)=="function"){this.dataObj.setSizes()}};this._initDocking();return this}dhtmlXAccordionCell.prototype=new dhtmlXCellObject();dhtmlXAccordionCell.prototype._initHeader=function(){var a=document.createElement("DIV");a.className="dhx_cell_hdr";a.innerHTML="<div class='dhx_cell_hdr_text'></div><div class='dhx_cell_hdr_arrow'></div>";this.cell.insertBefore(a,this.cell.childNodes[this.conf.idx.cont]);a=null;this.conf.ofs_nodes.t._getHdrHeight="func";this.conf.hdr={visible:true};this.conf.idx_data.hdr="dhx_cell_hdr";this._updateIdx()};dhtmlXAccordionCell.prototype._getHdrHeight=function(){return this.cell.childNodes[this.conf.idx.hdr].offsetHeight};dhtmlXAccordionCell.prototype.setText=function(a){this.conf.text=a;this.cell.childNodes[this.conf.idx.hdr].firstChild.innerHTML="<span>"+a+"</span>"};dhtmlXAccordionCell.prototype.getText=function(){return this.conf.text};dhtmlXAccordionCell.prototype.setIcon=function(g){var c=this.cell.childNodes[this.conf.idx.hdr];if(c.firstChild.className!="dhx_cell_hdr_icon"){c.firstChild.className+=" dhx_cell_hdr_icon";var a=document.createElement("IMG");a.className="dhx_cell_hdr_icon";c.insertBefore(a,c.firstChild);a=null}c.firstChild.src=this.acc.conf.icons_path+g;c=null};dhtmlXAccordionCell.prototype.clearIcon=function(){var a=this.cell.childNodes[this.conf.idx.hdr];if(a.firstChild.className=="dhx_cell_hdr_icon"){a.removeChild(a.firstChild);a.firstChild.className=String(a.firstChild.className).replace(/\s{1,}dhx_cell_hdr_icon/gi,"")}a=null};dhtmlXAccordionCell.prototype._open=function(c){var l={};if(this.acc.conf.multi_mode){var j={};j[this._idd]=true;l=this.acc._getDynData(j);this.acc._openId=this._idd;this.acc._openCache={};this.acc._openMode="open"}else{l[this._idd]=this.conf.size.h}for(var g in l){if(this.acc._openCache!=null){this.acc._openCache[g]=true}var m=this.acc.t[g].cell;m.cell.className=String(m.cell.className).replace(/\s{1,}dhx_cell_closed/gi,"");m.conf.opened=true;m._trInitEv("open",c);m.conf.size.h=l[g];m.cell.style.height=m.conf.size.h+"px";m=null}if(this.conf.tr.prop==false){this.acc._openId=this.acc._openCache=this.acc._openMode=null;this._onActiveCall(true)}};dhtmlXAccordionCell.prototype._close=function(c){var j={};if(this.acc.conf.multi_mode){var l={};l[this._idd]=true;j=this.acc._getDynData(null,l);this.acc._openId=this._idd;this.acc._openCache={};this.acc._openMode="close"}else{j[this._idd]=this._getHdrHeight()}for(var g in j){var m=this.acc.t[g].cell;if(this.acc._openCache!=null){this.acc._openCache[g]=true}if(g==this._idd){m.cell.className+=" dhx_cell_closed";m.conf.opened=false;m._trInitEv("close",c)}else{m.conf.size.h=j[g];m._adjustCell();m._trInitEv("open",c)}m.cell.style.height=j[g]+"px";m=null}if(this.conf.tr.prop==false){this.acc._openId=this.acc._openCache=this.acc._openMode=null;this._onActiveCall(false)}};dhtmlXAccordionCell.prototype.isOpened=function(){return(this.conf.opened==true)};dhtmlXAccordionCell.prototype._trInitEv=function(c,a){if(this.conf.tr.prop==false){return}this._trAttachEv();if(!this.cell._accObj){this.cell._accObj=this.acc}if(a){this.cell.style[this.conf.tr.prop]=this.conf.tr["height_"+c]}this._cellSetOpacity(c,a)};dhtmlXAccordionCell.prototype._trAttachEv=function(){if(!this.conf.tr.ev_attached){this.cell._trProp=this.conf.tr.prop;this.cell.addEventListener(this.conf.tr.ev,this._trOnEnd,false);this.conf.tr.ev_attached=true}};dhtmlXAccordionCell.prototype._trDetachEv=function(){if(this.conf.tr.ev_attached){this.cell.addEventListener(this.conf.tr.ev,this._trOnEnd,false);this.conf.tr.ev_attached=false}};dhtmlXAccordionCell.prototype._trOnEnd=function(a){if(a.stopPropagation){a.stopPropagation()}if(a.propertyName=="height"&&this._accObj!=null){this.style[this._trProp]="";if(this._accObj.conf.multi_mode){if(this._accObj._openCache!=null){this._accObj._openCache[this._accId]=false}this._accObj._adjustOpened()}if(this._accObj.conf.on_active_click==true){if(this._accObj.conf.multi_mode){this._accObj._callMainEvent("onActive",[this._accId,this._accObj.t[this._accId].cell.conf.opened]);this._accObj.conf.on_active_click=false}else{this._accObj._callMainEvent("onActive",[this._accObj.conf.on_active_id,true]);this._accObj.conf.on_active_id=null;this._accObj.conf.on_active_click=false}}this._accObj=null}};dhtmlXAccordionCell.prototype._cellSetOpacity=function(j,c){for(var g in this.conf.idx){if({hdr:true,pr1:true,pr2:true,cover:true}[g]!=true){if(c){this.cell.childNodes[this.conf.idx[g]].style[this.conf.tr.prop]=this.conf.tr["op_"+j]}this.cell.childNodes[this.conf.idx[g]].style.opacity=this.conf.tr["op_v_"+j]}}};dhtmlXAccordionCell.prototype._onActiveCall=function(a){if(this.acc.conf.on_active_click==false){return}if(this.acc.conf.multi_mode==true){this.acc._callMainEvent("onActive",[this._idd,this.conf.opened]);this.acc.conf.on_active_click=false}else{if(a==true){this.acc._callMainEvent("onActive",[this._idd,true]);this.acc.conf.on_active_click=false}}};dhtmlXAccordionCell.prototype.show=function(){if(this.conf.visible){return}if(this.conf.docked==false){this.dock();return}this.cell.style.display="";this.conf.visible=true;if(!this.acc.conf.multi_mode){this.acc.conf.hiden_count--;this.acc._updateCellsHeight();this.acc._updateCellsMargin()}if(this.acc.conf.size_changed){this.acc.setSizes();this.acc.conf.size_changed=false}else{this.acc._adjustOpened()}};dhtmlXAccordionCell.prototype.hide=function(){if(!this.conf.visible){return}if(!this.acc.conf.multi_mode&&this.conf.opened){this._close(false);this.acc.conf.last_opened=null}this.cell.style.display="none";this.conf.visible=false;if(!this.acc.conf.multi_mode){this.acc.conf.hiden_count++;this.acc._updateCellsHeight();this.acc._updateCellsMargin()}this.acc._adjustOpened()};dhtmlXAccordionCell.prototype.isVisible=function(){return(this.conf.visible==true)};dhtmlXAccordionCell.prototype.setHeight=function(a){if(!this.acc.conf.multi_mode){return}if(a=="*"){this.conf.h_auto=true}else{this.conf.h_auto=false;this.conf.size.h=a}if(this.conf.opened){if(a!="*"){this.cell.style.height=a+"px"}this.acc._adjustOpened()}};dhtmlXAccordionCell.prototype.moveOnTop=function(){if(this.cell.parentNode.firstChild==this.cell){return}this.cell.parentNode.insertBefore(this.cell,this.cell.parentNode.firstChild);this.acc._updateCellsMargin()};dhtmlXAccordionCell.prototype._initDocking=function(){var a=this;this.dock=function(){if(this.acc.dhxWins==null||this.conf.docked==true){return}var c=this.acc.dhxWins.window(this._idd);c.close();this._attachFromCell(c);this.conf.docked=true;this.show();if(this.conf.dock_opened){this.open()}c=null;this.acc._callMainEvent("onDock",[this._idd])};this.undock=function(c,m,j,l){if(this.acc.dhxWins==null||this.conf.docked==false){return}this.conf.dock_opened=this.conf.opened;if(this.acc.dhxWins.window(this._idd)!=null){var g=this.acc.dhxWins.window(this._idd);g.show()}else{if(c==null){c=20}if(m==null){m=20}if(j==null){j=320}if(l==null){l=200}var g=this.acc.dhxWins.createWindow(this._idd,c,m,j,l);g.button("close").hide();g.addUserButton("dock",99,"Dock");g.button("dock").show();g.button("dock").attachEvent("onClick",this._doOnDockClick);g.setText(this.getText());g.attachEvent("onClose",this._doOnDockWinClose)}this.conf.docked=false;this.hide();g._attachFromCell(this);g=null;this.acc._callMainEvent("onUnDock",[this._idd])};this._doOnDockClick=function(){a.dock()};this._doOnDockWinClose=function(c){c.hide();return false};this._unloadDocking=function(){a=null}};dhtmlXCellObject.prototype.attachAccordion=function(a){this.callEvent("_onBeforeContentAttach",["acc"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";this._attachObject(c);if(typeof(a)=="undefined"){a={}}if(typeof(a.skin)=="undefined"){a.skin=this.conf.skin}a.parent=c;if(typeof(window.dhtmlXAccordionCell)!="undefined"&&(this instanceof window.dhtmlXAccordionCell)){c._ofs={s:{first:-1},m:{first:4}}}if(typeof(window.dhtmlXSideBarCell)!="undefined"&&(this instanceof window.dhtmlXSideBarCell)){if(this.conf.skin=="dhx_web"){c._ofs={l:2}}else{c._ofs={l:-1}}}this.dataType="acc";this.dataObj=new dhtmlXAccordion(a);a.obj=null;c=a=null;this.callEvent("_onContentAttach",[]);return this.dataObj};dhtmlXAccordion.prototype.enableDND=function(){if(this.conf.multi_mode==false||this._dnd!=null){return}var g=this;this._dnd={tr_count:0,tr_items:{}};this._dndAttachEvent=function(j){var a=this.t[j].cell;if(a.conf.dnd_inited!=true){if(typeof(window.addEventListener)=="function"){a.cell.childNodes[a.conf.idx.hdr].addEventListener("mousedown",this._dndOnMouseDown,false)}else{a.cell.childNodes[a.conf.idx.hdr].attachEvent("onmousedown",this._dndOnMouseDown)}a.conf.dnd_inited=true}a=null};this._dndDetachEvent=function(j){var a=this.t[j].cell;if(a.conf.dnd_inited==true){if(typeof(window.addEventListener)=="function"){a.cell.childNodes[a.conf.idx.hdr].removeEventListener("mousedown",this._dndOnMouseDown,false)}else{a.cell.childNodes[a.conf.idx.hdr].detachEvent("onmousedown",this._dndOnMouseDown)}a.conf.dnd_inited=false}a=null};this._dndOnMouseDown=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}var a=(j.target||j.srcElement);while(a!=null&&a.parentNode!=g.cont){a=a.parentNode}if(a!=null){g._dndDragStart(j,a)}a=null};this._dndDragStart=function(n,l){if(this._dnd.tr_waiting==true){return}var a=-1;for(var m=0;m<l.parentNode.childNodes.length;m++){if(l.parentNode.childNodes[m]==l){a=m}}if(this.callEvent("onBeforeDrag",[l._accId,a])!==true){return}if(typeof(window.addEventListener)=="function"){document.body.addEventListener("mousemove",this._dndOnMouseMove,false);document.body.addEventListener("mouseup",this._dndOnMouseUp,false)}else{document.body.attachEvent("onmousemove",this._dndOnMouseMove,false);document.body.attachEvent("onmouseup",this._dndOnMouseUp,false)}this._dnd.dragObj=l;this._dnd.dy=n.clientY;var j=0;for(var m=0;m<this._dnd.dragObj.parentNode.childNodes.length;m++){this._dnd.dragObj.parentNode.childNodes[m]._ind=m;if(this._dnd.dragObj.parentNode.childNodes[m]==this._dnd.dragObj){this._dnd.dragObj._k0=j;if(m>0){this._dnd.dragObj._k0+=this.ofs.m.between-this.ofs.m.first}j=0}else{j+=this._dnd.dragObj.parentNode.childNodes[m].offsetHeight+parseInt(this._dnd.dragObj.parentNode.childNodes[m].style.marginTop)}}this._dnd.dragObj._k1=j;this._dnd.h=this._dnd.dragObj.offsetHeight;this._dnd.ofs=false};this._dndDoDrag=function(v){if(!this._dnd.dragObj){return}if(this._dnd.tr_waiting==true){return}var n=v.clientY-this._dnd.dy;if(this._dnd.ofs==false&&Math.abs(n)>5){this._dnd.dragObj.className+=" acc_cell_dragged";this._dnd.ofs=true}if(n<0){if(n<-this._dnd.dragObj._k0){n=-this._dnd.dragObj._k0}}else{if(n>this._dnd.dragObj._k1){n=this._dnd.dragObj._k1}}this._dnd.dragObj.style.top=n+"px";var u=v.clientY-this._dnd.dy;var m=0;var j=0;for(var o=this._dnd.dragObj._ind+1;o<=this._dnd.dragObj.parentNode.lastChild._ind;o++){var a=this._dnd.dragObj.parentNode.childNodes[o].offsetHeight;if(u>m+a*2/3){j++}m+=a}var l=this._dnd.dragObj.nextSibling;var o=0;while(l!=null){if(++o<=j&&l!=null){if(!l._ontop){if(l._tm){window.clearTimeout(l._tm)}this._dndAnim(l,false,parseInt(l.style.top||0),-this._dnd.h-this.ofs.m.between);l._ontop=true}}else{if(l._ontop){if(l._tm){window.clearTimeout(l._tm)}this._dndAnim(l,true,parseInt(l.style.top||0),0);l._ontop=false}}l=l.nextSibling}var u=this._dnd.dy-v.clientY;var m=0;var j=0;for(var o=this._dnd.dragObj._ind-1;o>=this._dnd.dragObj.parentNode.firstChild._ind;o--){var a=this._dnd.dragObj.parentNode.childNodes[o].offsetHeight;if(u>m+a*2/3){j++}m+=a}var l=this._dnd.dragObj.previousSibling;var o=0;while(l!=null){if(++o<=j&&l!=null){if(!l._onbottom){if(l._tm){window.clearTimeout(l._tm)}this._dndAnim(l,true,parseInt(l.style.top||0),this._dnd.h+this.ofs.m.between);l._onbottom=true}}else{if(l._onbottom){if(l._tm){window.clearTimeout(l._tm)}this._dndAnim(l,false,parseInt(l.style.top),0);l._onbottom=false}}l=l.previousSibling}};this._dndDragStop=function(r,n){if(n){}else{if(this._dnd.tr_count>0){this._dnd.tr_waiting=true;return}}if(!this._dnd.dragObj){return}this._dnd.dragObj.className=String(this._dnd.dragObj.className).replace(/\s{0,}acc_cell_dragged/gi,"");this._dnd.dragObj.style.top="0px";var o=false;for(var m=0;m<this._dnd.dragObj.parentNode.childNodes.length;m++){var l=this._dnd.dragObj.parentNode.childNodes[m];if(l!=this._dnd.dragObj){if(l._tm){window.clearTimeout(l._tm)}l.style.top="0px";if(l._ontop&&((l.nextSibling!=null&&l.nextSibling._ontop!=true)||!l.nextSibling)){o=(l.nextSibling||null)}if(l._onbottom&&((l.previousSibling!=null&&l.previousSibling._onbottom!=true)||!l.previousSibling)){o=l}}l=null}for(var m=0;m<this._dnd.dragObj.parentNode.childNodes.length;m++){this._dnd.dragObj.parentNode.childNodes[m]._ontop=null;this._dnd.dragObj.parentNode.childNodes[m]._onbottom=null}if(o!==false){if(o==null){this._dnd.dragObj.parentNode.appendChild(this._dnd.dragObj)}else{this._dnd.dragObj.parentNode.insertBefore(this._dnd.dragObj,o)}}var u=this._dnd.dragObj._accId;var j=this._dnd.dragObj._ind;var a=j;for(var m=0;m<this._dnd.dragObj.parentNode.childNodes.length;m++){if(this._dnd.dragObj.parentNode.childNodes[m]==this._dnd.dragObj){a=m}}this._dnd.dragObj=null;this._dnd.tr_waiting=false;this._updateCellsMargin();if(j!=a){this.setSizes();this.callEvent("onDrop",[u,j,a])}if(typeof(window.addEventListener)=="function"){document.body.removeEventListener("mousemove",this._dndOnMouseMove,false);document.body.removeEventListener("mouseup",this._dndOnMouseUp,false)}else{document.body.detachEvent("onmousemove",this._dndOnMouseMove,false);document.body.detachEvent("onmouseup",this._dndOnMouseUp,false)}};this._dndAnim=function(n,a,m,l){if(this.conf.tr.prop!=false){if(!n._dnd_ev){n._dnd_ev=true;n._dnd_tr_prop=this.conf.tr.prop;n.addEventListener(this.conf.tr.ev,this._dndOnTrEnd,false)}if(this._dnd.tr_items[n._accId]!=true){this._dnd.tr_items[n._accId]=true;this._dnd.tr_count++}n.style[this.conf.tr.prop]=this.conf.tr.dnd_top;n.style.top=l+"px";return}var j=false;if(a){m+=5;if(m>=l){m=l;j=true}}else{m-=5;if(m<=l){m=l;j=true}}n.style.top=m+"px";if(n._tm){window.clearTimeout(n._tm)}if(!j){n._tm=window.setTimeout(function(){g._dndAnim(n,a,m,l)},5)}else{n._tm=null}};this._dndOnTrEnd=function(a){if(a.stopPropagation){a.stopPropagation()}if(a.propertyName=="top"){if(g._dnd.tr_items[this._accId]==true){g._dnd.tr_count--;g._dnd.tr_items[this._accId]=false}this.style[this._dnd_tr_prop]="";if(g._dnd.tr_count==0&&g._dnd.tr_waiting==true){g._dndDragStop(null,true)}}};this._dndOnMouseMove=function(a){g._dndDoDrag(a||event)};this._dndOnMouseUp=function(a){g._dndDragStop(a||event)};this._dndClearCell=function(a){if(this.t[a].cell.cell._dnd_ev){this.t[a].cell.cell.addEventListener(this.conf.tr.ev,this._dndOnTrEnd,false)}this._dndDetachEvent(a)};this._unloadDND=function(){for(var j in this){if(String(j).indexOf("_dnd")==0&&typeof(this[j])=="function"){this[j]=null}}this._dnd=null;g=null};for(var c in this.t){this._dndAttachEvent(c)}};function dhtmlXLayoutObject(g,o,w){var u=null;if(g!=null&&typeof(g)=="object"&&typeof(g.tagName)=="undefined"&&g._isCell!=true){u={};if(g.autosize!=null){u.autosize=g.autosize}if(g.cells!=null){u.cells=g.cells}if(g.pattern!=null){o=g.pattern}if(g.skin!=null){w=g.skin}if(g.offsets!=null){u.offsets=g.offsets}g=g.parent}this.cdata={};this.conf={skin:(w||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxlayout")||"dhx_skyblue"),css:"dhxlayout",hh:20,autosize:"b",nextCell:{a:"b",b:"a"},inited:false,b_size:{w:-1,h:-1}};if(typeof(g)=="object"&&g._isCell==true){var n=(typeof(u)!="undefined"&&u!=null?u:{});if(n.pattern==null&&o!=null){n.pattern=o}if(n.skin==null&&w!=null){n.skin=w}var l=g.attachLayout(n);return l}window.dhtmlXCellTop.apply(this,[g,(u==null?null:u.offsets)]);this.conf.sw=this._detectSW();var m=this;this._getLayout=function(){return this};this.mainInst=(g._layoutMainInst!=null?g._layoutMainInst:null);this._getMainInst=function(){if(this.mainInst!=null){return this.mainInst._getMainInst()}return this};this._init=function(A){var y=(typeof(A)=="string"?this.tplData[A]:A);this.conf.mode=y.mode;if(this.conf.mode=="c"){this.cdata.a=new dhtmlXLayoutCell("a",this)}else{this.cdata.a=new dhtmlXLayoutCell("a",this);this.cdata.b=new dhtmlXLayoutCell("b",this)}for(var x in this.cdata){this.cont.appendChild(this.cdata[x].cell);this.cdata[x].conf.init={w:0.5,h:0.5}}if(this.conf.mode!="c"){var q=this._getMainInst();if(q.conf.sep_idx==null){q.conf.sep_idx=1}else{q.conf.sep_idx++}this.sep=new dhtmlXLayoutSepObject(this.conf.mode,q.conf.sep_idx);this.cont.appendChild(this.sep.sep);this.sep._getLayout=function(){return m._getLayout()};q=null}if(y.cells!=null){for(var x in y.cells){if(y.cells[x].width!=null){this.cdata[x].conf.init.w=y.cells[x].width}if(y.cells[x].height!=null){this.cdata[x].conf.init.h=y.cells[x].height}if(y.cells[x].name!=null){this.cdata[x].conf.name=y.cells[x].name;this.cdata[x].setText(y.cells[x].name)}if(y.cells[x].fsize!=null){this.cdata[x].conf.fsize=y.cells[x].fsize}}}this.setSizes();for(var x in this.cdata){this.cdata[x].conf.init={}}if(y.cells!=null){for(var x in y.cells){if(y.cells[x].layout!=null){this.cdata[x].dataNested=true;this.cdata[x]._layoutMainInst=this;this.cdata[x].attachLayout({pattern:y.cells[x].layout});this.cdata[x]._layoutMainInst=null}}}};this.setSizes=function(E,M,I,x){var F=(this.conf.inited==true&&this._getMainInst()==this&&this.checkEvent("onResizeFinish")==true?{}:false);this._adjustCont();var L=this.cont.offsetWidth;var C=this.cont.offsetHeight;if(this.conf.mode=="c"){var a=0;var N=0;var q=L;var K=C;this.cdata.a._setSize(a,N,q,K,E,I,x);this.callEvent("_onSetSizes",[]);if(F&&(!(this.conf.b_size.w==L&&this.conf.b_size.h==C))){this._callMainEvent("onResizeFinish",[])}this.conf.b_size={w:L,h:C};return}if(typeof(M)=="undefined"){var y=(this.conf.mode=="v"?"w":"h");M=this.conf.autosize;if(this.cdata.a.conf.collapsed){M="b"}else{if(this.cdata.b.conf.collapsed){M="a"}else{if(E=="a"||E=="b"){M=this.conf.nextCell[E]}}}}else{}if(this.conf.mode=="v"){if(M=="a"){if(this.cdata.b.conf.init.w!=null){var J=Math.round(L*this.cdata.b.conf.init.w-this.conf.sw/2)}else{var J=this.cdata.b.conf.size.w}var H=L-J;var D=0;var A=C;var a=0;var N=D;var q=H-a-this.conf.sw;var K=A}else{var a=0;var N=0;if(this.cdata.a.conf.init.w!=null){var q=Math.round(L*this.cdata.a.conf.init.w-this.conf.sw/2)-a}else{var q=this.cdata.a.conf.size.w}var K=C-N;var H=a+q+this.conf.sw;var D=N;var J=L-H;var A=K}this.cdata.a._setSize(a,N,q,K,E,I,x);this.cdata.b._setSize(H,D,J,A,E,I,x);this.sep._setSize(a+q,N,this.conf.sw,K)}else{if(M=="a"){if(this.cdata.b.conf.init.h!=null){var A=Math.round(C*this.cdata.b.conf.init.h-this.conf.sw/2)}else{var A=this.cdata.b.conf.size.h}var H=0;var D=C-A;var J=L-H;var a=H;var N=0;var q=J;var K=D-N-this.conf.sw}else{var a=0;var N=0;var q=L-a;if(this.cdata.a.conf.init.h!=null){var K=Math.round(C*this.cdata.a.conf.init.h-this.conf.sw/2)}else{var K=this.cdata.a.conf.size.h}var H=a;var D=N+K+this.conf.sw;var J=q;var A=C-D}this.cdata.a._setSize(a,N,q,K,E,I,x);this.cdata.b._setSize(H,D,J,A,E,I,x);this.sep._setSize(a,N+K,q,this.conf.sw)}this.callEvent("_onSetSizes",[]);if(F&&(!(this.conf.b_size.w==L&&this.conf.b_size.h==C))){this._callMainEvent("onResizeFinish",[])}this.conf.b_size={w:L,h:C}};this._getAvailWidth=function(){var A=[];for(var E=0;E<this.conf.as_cells.h.length;E++){var x=this.cells(this.conf.as_cells.h[E]);var C=x.layout;var y=C.conf.autosize;if(x.conf.collapsed){x=C.cdata[C.conf.nextCell[x._idd]];y=C.conf.nextCell[y]}A.push(Math.max(0,x.getWidth()-x._getMinWidth(y)));C=x=null}var D=(A.length>0?Math.min.apply(window,A):0);return this.cont.offsetWidth-D};this._getAvailHeight=function(){var C=[];for(var E=0;E<this.conf.as_cells.v.length;E++){var x=this.cells(this.conf.as_cells.v[E]);var A=x.layout;var y=A.conf.autosize;if(x.conf.collapsed){x=A.cdata[A.conf.nextCell[x._idd]];y=A.conf.nextCell[y]}C.push(Math.max(0,x.getHeight()-x._getHdrHeight()-x._getMinHeight(y)));A=x=null}var D=Math.min.apply(window,C);return this.cont.offsetHeight-D};this.setSkin=function(a){this._setBaseSkin(a);this.conf.skin=a};this.unload=function(){this.conf.unloading=true;this.mainInst=null;this.parentLayout=null;if(this.items!=null){for(var y=0;y<this.items.length;y++){this.items[y]=null}this.items=null}if(this.dhxWins!=null){this.dhxWins.unload();this.dhxWins=null}if(this.sep!=null){this.sep._unload();this.sep=null}for(var x in this.cdata){this.cdata[x]._unload();this.cdata[x]=null}this._unloadTop();window.dhx4._eventable(this,"clear");for(var x in this){this[x]=null}m=null};this._getWindowMinDimension=function(y){var a=m._getAvailWidth()+7+7;var x=m._getAvailHeight()+7+31;var q={w:Math.max(a,200),h:Math.max(x,140)};y=null;return q};window.dhx4._eventable(this);this._callMainEvent=function(q,a){return this.callEvent(q,a)};this._init(o||"3E");var r=this._availAutoSize[o];if(r!=null){this.conf.pattern=o;this.setAutoSize(r.h[r.h.length-1],r.v[r.v.length-1])}if(typeof(window.dhtmlXWindows)=="function"){this.dhxWins=new dhtmlXWindows();this.dhxWins.setSkin(this.conf.skin)}this.conf.inited=true;if(this==this._getMainInst()){var s=0;this.items=[];this.forEachItem(function(a){m.items.push(a);a.conf.index=s++})}if(this==this._getMainInst()&&u!=null){if(u.autosize!=null){this.setAutoSize.apply(this,u.autosize)}if(u.cells!=null){for(var c=0;c<u.cells.length;c++){var j=u.cells[c];var v=this.cells(j.id);if(j.width){v.setWidth(j.width)}if(j.height){v.setHeight(j.height)}if(j.text){v.setText(j.text)}if(j.collapsed_text){v.setCollapsedText(j.collapsed_text)}if(j.collapse){v.collapse()}if(j.fix_size){v.fixSize(j.fix_size[0],j.fix_size[1])}if(typeof(j.header)!="undefined"&&window.dhx4.s2b(j.header)==false){v.hideHeader()}}}}u=null;return this}dhtmlXLayoutObject.prototype=new dhtmlXCellTop();dhtmlXLayoutObject.prototype.cells=function(j){for(var c in this.cdata){if(this.cdata[c].conf.name==j){return this.cdata[c]}if(this.cdata[c].dataType=="layout"&&this.cdata[c].dataNested==true&&this.cdata[c].dataObj!=null){var g=this.cdata[c].dataObj.cells(j);if(g!=null){return g}}}return null};dhtmlXLayoutObject.prototype.forEachItem=function(j,g){if(typeof(j)!="function"){return}if(typeof(g)=="undefined"){g=this}for(var c in this.cdata){if(typeof(this.cdata[c].conf.name)!="undefined"){j.apply(g,[this.cdata[c]])}if(this.cdata[c].dataType=="layout"&&this.cdata[c].dataNested==true&&this.cdata[c].dataObj!=null){this.cdata[c].dataObj.forEachItem(j,g)}}g=null};dhtmlXLayoutObject.prototype._forEachSep=function(j,g){if(typeof(j)!="function"){return}if(typeof(g)=="undefined"){g=this}if(this.sep!=null){j.apply(g,[this.sep])}for(var c in this.cdata){if(this.cdata[c].dataType=="layout"&&this.cdata[c].dataNested==true&&this.cdata[c].dataObj!=null){this.cdata[c].dataObj._forEachSep(j,g)}}g=null};dhtmlXLayoutObject.prototype._detectSW=function(){if(this._confGlob.sw==null){this._confGlob.sw={}}if(this._confGlob.sw[this.conf.skin]==null){this._confGlob.sw[this.conf.skin]=window.dhx4.readFromCss("dhxlayout_sep_sw_"+this.conf.skin)}return this._confGlob.sw[this.conf.skin]};dhtmlXLayoutObject.prototype._confGlob={};dhtmlXLayoutObject.prototype.listPatterns=function(){var g=[];for(var c in this.tplData){g.push(c)}return g};dhtmlXLayoutObject.prototype.listAutoSizes=function(){var j=(this.conf.as_cells!=null?(this.conf.as_cells.h).join(";"):"");var g=(this.conf.as_cells!=null?(this.conf.as_cells.v).join(";"):"");var c=this._availAutoSize[this.conf.pattern].h;var a=this._availAutoSize[this.conf.pattern].v;return[j,g,c,a]};dhtmlXLayoutObject.prototype._getCellsNames=function(j){var l={};if(this.cdata[j].conf.name!=null){l[this.cdata[j].conf.name]=true}if(this.cdata[j].dataType=="layout"&&this.cdata[j].dataObj!=null&&this.cdata[j].dataObj.mainInst==this){var c=this.cdata[j].dataObj._getCellsNames("a");var m=this.cdata[j].dataObj._getCellsNames("b");for(var g in c){l[g]=c[g]}for(var g in m){l[g]=m[g]}}return l};dhtmlXLayoutObject.prototype.setAutoSize=function(c,r,u){if(u!==true){var w=this.listAutoSizes();if(w[0]==c&&w[1]==r){return}var o=false;var n=false;for(var g=0;g<w[2].length;g++){o=o||w[2][g]==c}for(var g=0;g<w[3].length;g++){n=n||w[3][g]==r}if(!o||!n){return}}this.conf.as_cells={h:c.split(";"),v:r.split(";")};var j=(this.conf.mode=="v"?"h":"v");for(var v in this.cdata){var l=this._getCellsNames(v);var x=false;for(var g=0;g<this.conf.as_cells[j].length;g++){x=x||l[this.conf.as_cells[j][g]]}if(x){this.conf.autosize=v}if(this.cdata[v].dataType=="layout"&&this.cdata[v].dataObj!=null){this.cdata[v].dataObj.setAutoSize(c,r,true)}}};dhtmlXLayoutObject.prototype.tplData={"1C":{mode:"c",cells:{a:{name:"a"}}},"2E":{mode:"h",cells:{a:{name:"a",fsize:{v:1}},b:{name:"b",fsize:{v:1}}}},"2U":{mode:"v",cells:{a:{name:"a",fsize:{h:1}},b:{name:"b",fsize:{h:1}}}},"3E":{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{name:"b",fsize:{v:[1,2]}},b:{name:"c",fsize:{v:2}}}}}}},"3W":{mode:"v",cells:{a:{name:"a",width:1/3,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{name:"b",fsize:{h:[1,2]}},b:{name:"c",fsize:{h:2}}}}}}},"3J":{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"a",fsize:{h:1,v:2}},b:{name:"c",fsize:{h:1,v:2}}}}},b:{name:"b",fsize:{h:1}}}},"3L":{mode:"v",cells:{a:{name:"a",fsize:{h:1}},b:{layout:{mode:"h",cells:{a:{name:"b",fsize:{h:1,v:2}},b:{name:"c",fsize:{h:1,v:2}}}}}}},"3T":{mode:"h",cells:{a:{name:"a",fsize:{v:1}},b:{layout:{mode:"v",cells:{a:{name:"b",fsize:{h:2,v:1}},b:{name:"c",fsize:{h:2,v:1}}}}}}},"3U":{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"a",fsize:{h:2,v:1}},b:{name:"b",fsize:{h:2,v:1}}}}},b:{name:"c",fsize:{v:1}}}},"4H":{mode:"v",cells:{a:{name:"a",width:1/3,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"b",fsize:{h:[1,2],v:3}},b:{name:"c",fsize:{h:[1,2],v:3}}}}},b:{name:"d",fsize:{h:2}}}}}}},"4I":{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"b",fsize:{h:3,v:[1,2]}},b:{name:"c",fsize:{h:3,v:[1,2]}}}}},b:{name:"d",fsize:{v:2}}}}}}},"4T":{mode:"h",cells:{a:{name:"a",fsize:{v:1}},b:{layout:{mode:"v",cells:{a:{name:"b",width:1/3,fsize:{h:2,v:1}},b:{layout:{mode:"v",cells:{a:{name:"c",fsize:{h:[2,3],v:1}},b:{name:"d",fsize:{h:3,v:1}}}}}}}}}},"4U":{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"a",width:1/3,fsize:{h:2,v:1}},b:{layout:{mode:"v",cells:{a:{name:"b",fsize:{h:[2,3],v:1}},b:{name:"c",fsize:{h:3,v:1}}}}}}}},b:{name:"d",fsize:{v:1}}}},"4E":{mode:"h",cells:{a:{name:"a",height:1/4,fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{name:"b",height:1/3,fsize:{v:[1,2]}},b:{layout:{mode:"h",cells:{a:{name:"c",fsize:{v:[2,3]}},b:{name:"d",fsize:{v:3}}}}}}}}}},"4W":{mode:"v",cells:{a:{name:"a",width:1/4,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{name:"b",width:1/3,fsize:{h:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",fsize:{h:[2,3]}},b:{name:"d",fsize:{h:3}}}}}}}}}},"4A":{mode:"v",cells:{a:{width:1/3,layout:{mode:"h",cells:{a:{name:"a",fsize:{h:1,v:2}},b:{name:"b",fsize:{h:1,v:2}}}}},b:{layout:{mode:"v",cells:{a:{name:"c",fsize:{h:[1,3]}},b:{name:"d",fsize:{h:3}}}}}}},"4L":{mode:"v",cells:{a:{name:"a",width:1/3,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{name:"b",fsize:{h:[1,2]}},b:{layout:{mode:"h",cells:{a:{name:"c",fsize:{h:2,v:3}},b:{name:"d",fsize:{h:2,v:3}}}}}}}}}},"4J":{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{name:"b",fsize:{v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",fsize:{h:3,v:2}},b:{name:"d",fsize:{h:3,v:2}}}}}}}}}},"4F":{mode:"h",cells:{a:{height:1/3,layout:{mode:"v",cells:{a:{name:"a",fsize:{h:2,v:1}},b:{name:"b",fsize:{h:2,v:1}}}}},b:{layout:{mode:"h",cells:{a:{name:"c",fsize:{v:[1,3]}},b:{name:"d",fsize:{v:3}}}}}}},"4G":{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"b",fsize:{h:1,v:[2,3]}},b:{name:"c",fsize:{h:1,v:3}}}}}}}},b:{name:"d",fsize:{h:1}}}},"4C":{mode:"v",cells:{a:{name:"a",fsize:{h:1}},b:{layout:{mode:"h",cells:{a:{name:"b",height:1/3,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"c",fsize:{h:1,v:[2,3]}},b:{name:"d",fsize:{h:1,v:3}}}}}}}}}},"5H":{mode:"v",cells:{a:{width:1/3,name:"a",fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"b",height:1/3,fsize:{h:[1,2],v:3}},b:{layout:{mode:"h",cells:{a:{name:"c",fsize:{h:[1,2],v:[3,4]}},b:{name:"d",fsize:{h:[1,2],v:4}}}}}}}},b:{name:"e",fsize:{h:2}}}}}}},"5I":{mode:"h",cells:{a:{height:1/3,name:"a",fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"b",width:1/3,fsize:{h:3,v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",fsize:{h:[3,4],v:[1,2]}},b:{name:"d",fsize:{h:4,v:[1,2]}}}}}}}},b:{name:"e",fsize:{v:2}}}}}}},"5U":{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"a",width:1/4,fsize:{h:2,v:1}},b:{layout:{mode:"v",cells:{a:{name:"b",width:1/3,fsize:{h:[2,3],v:1}},b:{layout:{mode:"v",cells:{a:{name:"c",fsize:{h:[3,4],v:1}},b:{name:"d",fsize:{h:4,v:1}}}}}}}}}}},b:{name:"e",fsize:{v:1}}}},"5E":{mode:"h",cells:{a:{name:"a",height:1/5,fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{name:"b",height:1/4,fsize:{v:[1,2]}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/3,fsize:{v:[2,3]}},b:{layout:{mode:"h",cells:{a:{name:"d",fsize:{v:[3,4]}},b:{name:"e",fsize:{v:4}}}}}}}}}}}}},"5W":{mode:"v",cells:{a:{name:"a",width:1/5,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{name:"b",width:1/4,fsize:{h:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",width:1/3,fsize:{h:[2,3]}},b:{layout:{mode:"v",cells:{a:{name:"d",fsize:{h:[3,4]}},b:{name:"e",fsize:{h:4}}}}}}}}}}}}},"5K":{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"b",fsize:{h:1,v:[2,3]}},b:{name:"c",fsize:{h:1,v:3}}}}}}}},b:{layout:{mode:"h",cells:{a:{name:"d",fsize:{h:1,v:4}},b:{name:"e",fsize:{h:1,v:4}}}}}}},"5S":{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"a",fsize:{h:1,v:2}},b:{name:"b",fsize:{h:1,v:2}}}}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/3,fsize:{h:1,v:3}},b:{layout:{mode:"h",cells:{a:{name:"d",fsize:{h:1,v:[3,2]}},b:{name:"e",fsize:{h:1,v:4}}}}}}}}}},"5G":{mode:"v",cells:{a:{width:1/3,layout:{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"b",fsize:{h:1,v:[2,3]}},b:{name:"c",fsize:{h:1,v:3}}}}}}}},b:{layout:{mode:"v",cells:{a:{name:"d",fsize:{h:[1,4]}},b:{name:"e",fsize:{h:4}}}}}}},"5C":{mode:"v",cells:{a:{width:2/3,layout:{mode:"v",cells:{a:{name:"a",fsize:{h:2}},b:{name:"b",fsize:{h:[2,1]}}}}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/3,fsize:{h:1,v:3}},b:{layout:{mode:"h",cells:{a:{name:"d",fsize:{h:1,v:[3,4]}},b:{name:"e",fsize:{h:1,v:4}}}}}}}}}},"6H":{mode:"v",cells:{a:{width:1/3,name:"a",fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"b",height:1/4,fsize:{h:[1,2],v:3}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/3,fsize:{h:[1,2],v:[3,4]}},b:{layout:{mode:"h",cells:{a:{name:"d",fsize:{h:[1,2],v:[4,5]}},b:{name:"e",fsize:{h:[1,2],v:5}}}}}}}}}}},b:{name:"f",fsize:{h:2}}}}}}},"6I":{mode:"h",cells:{a:{height:1/3,name:"a",fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"b",width:1/4,fsize:{h:3,v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",width:1/3,fsize:{h:[3,4],v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"d",fsize:{h:[4,5],v:[1,2]}},b:{name:"e",fsize:{h:5,v:[1,2]}}}}}}}}}}},b:{name:"f",fsize:{v:2}}}}}}},"6A":{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"a",height:1/5,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"b",height:1/4,fsize:{h:1,v:[2,3]}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/3,fsize:{h:1,v:[3,4]}},b:{layout:{mode:"h",cells:{a:{name:"d",fsize:{h:1,v:[4,5]}},b:{name:"e",fsize:{h:1,v:5}}}}}}}}}}}}}},b:{name:"f",fsize:{h:1}}}},"6C":{mode:"v",cells:{a:{name:"a",fsize:{h:1}},b:{layout:{mode:"h",cells:{a:{name:"b",height:1/5,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/4,fsize:{h:1,v:[2,3]}},b:{layout:{mode:"h",cells:{a:{name:"d",height:1/3,fsize:{h:1,v:[3,4]}},b:{layout:{mode:"h",cells:{a:{name:"e",fsize:{h:1,v:[4,5]}},b:{name:"f",fsize:{h:1,v:5}}}}}}}}}}}}}}}},"6J":{mode:"v",cells:{a:{width:1/3,layout:{mode:"h",cells:{a:{name:"a",height:1/4,fsize:{h:1,v:2}},b:{layout:{mode:"h",cells:{a:{name:"b",height:1/3,fsize:{h:1,v:[2,3]}},b:{layout:{mode:"h",cells:{a:{name:"c",fsize:{h:1,v:[3,4]}},b:{name:"d",fsize:{h:1,v:4}}}}}}}}}}},b:{layout:{mode:"v",cells:{a:{name:"e",fsize:{h:[1,5]}},b:{name:"f",fsize:{h:5}}}}}}},"6E":{mode:"v",cells:{a:{name:"a",width:1/3,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{name:"b",fsize:{h:[1,2]}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/4,fsize:{h:2,v:3}},b:{layout:{mode:"h",cells:{a:{name:"d",height:1/3,fsize:{h:2,v:[3,4]}},b:{layout:{mode:"h",cells:{a:{name:"e",fsize:{h:2,v:[4,5]}},b:{name:"f",fsize:{h:2,v:5}}}}}}}}}}}}}}}},"6W":{mode:"v",cells:{a:{name:"a",width:1/6,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{name:"b",width:1/5,fsize:{h:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",width:1/4,fsize:{h:[2,3]}},b:{layout:{mode:"v",cells:{a:{name:"d",width:1/3,fsize:{h:[3,4]}},b:{layout:{mode:"v",cells:{a:{name:"e",fsize:{h:[4,5]}},b:{name:"f",fsize:{h:5}}}}}}}}}}}}}}}},"7H":{mode:"v",cells:{a:{name:"a",width:1/3,fsize:{h:1}},b:{layout:{mode:"v",cells:{a:{layout:{mode:"h",cells:{a:{name:"b",height:1/5,fsize:{h:[1,2],v:3}},b:{layout:{mode:"h",cells:{a:{name:"c",height:1/4,fsize:{h:[1,2],v:[3,4]}},b:{layout:{mode:"h",cells:{a:{name:"d",height:1/3,fsize:{h:[1,2],v:[4,5]}},b:{layout:{mode:"h",cells:{a:{name:"e",fsize:{h:[1,2],v:[5,6]}},b:{name:"f",fsize:{h:[1,2],v:6}}}}}}}}}}}}}},b:{name:"g",fsize:{h:2}}}}}}},"7I":{mode:"h",cells:{a:{name:"a",height:1/3,fsize:{v:1}},b:{layout:{mode:"h",cells:{a:{layout:{mode:"v",cells:{a:{name:"b",width:1/5,fsize:{h:3,v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"c",width:1/4,fsize:{h:[3,4],v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"d",width:1/3,fsize:{h:[4,5],v:[1,2]}},b:{layout:{mode:"v",cells:{a:{name:"e",fsize:{h:[5,6],v:[1,2]}},b:{name:"f",fsize:{h:6,v:[1,2]}}}}}}}}}}}}}},b:{name:"g",fsize:{v:2}}}}}}}};dhtmlXLayoutObject.prototype._availAutoSize={"1C":{h:["a"],v:["a"]},"2E":{h:["a;b"],v:["a","b"]},"2U":{h:["a","b"],v:["a;b"]},"3E":{h:["a;b;c"],v:["a","b","c"]},"3W":{h:["a","b","c"],v:["a;b;c"]},"3J":{h:["a;c","b"],v:["a;b","b;c"]},"3L":{h:["a","b;c"],v:["a;b","a;c"]},"3T":{h:["a;b","a;c"],v:["a","b;c"]},"3U":{h:["a;c","b;c"],v:["a;b","c"]},"4H":{h:["a","b;c","d"],v:["a;b;d","a;c;d"]},"4I":{h:["a;b;d","a;c;d"],v:["a","b;c","d"]},"4T":{h:["a;b","a;c","a;d"],v:["a","b;c;d"]},"4U":{h:["a;d","b;d","c;d"],v:["a;b;c","d"]},"4E":{h:["a;b;c;d"],v:["a","b","c","d"]},"4W":{h:["a","b","c","d"],v:["a;b;c;d"]},"4A":{h:["a;b","c","d"],v:["a;c;d","b;c;d"]},"4L":{h:["a","b","c;d"],v:["a;b;c","a;b;d"]},"4J":{h:["a;b;c","a;b;d"],v:["a","b","c;d"]},"4F":{h:["a;c;d","b;c;d"],v:["a;b","c","d"]},"4G":{h:["a;b;c","d"],v:["a;d","b;d","c;d"]},"4C":{h:["a","b;c;d"],v:["a;b","a;c","a;d"]},"5H":{h:["a","b;c;d","e"],v:["a;b;e","a;c;e","a;d;e"]},"5I":{h:["a;b;e","a;c;e","a;d;e"],v:["a","b;c;d","e"]},"5U":{h:["a;e","b;e","c;e","d;e"],v:["a;b;c;d","e"]},"5E":{h:["a;b;c;d;e"],v:["a","b","c","d","e"]},"5W":{h:["a","b","c","d","e"],v:["a;b;c;d;e"]},"5K":{h:["a;b;c","d;e"],v:["a;d","b;d","c;d","a;e","b;e","c;e"]},"5S":{h:["a;b","c;d;e"],v:["a;c","a;d","a;e","b;c","b;d","b;e"]},"5G":{h:["a;b;c","d","e"],v:["a;d;e","b;d;e","c;d;e"]},"5C":{h:["a","b","c;d;e"],v:["a;b;c","a;b;d","a;b;e"]},"6H":{h:["a","b;c;d;e","f"],v:["a;b;f","a;c;f","a;d;f","a;e;f"]},"6I":{h:["a;b;f","a;c;f","a;d;f","a;e;f"],v:["a","b;c;d;e","f"]},"6A":{h:["a;b;c;d;e","f"],v:["a;f","b;f","c;f","d;f","e;f"]},"6C":{h:["a","b;c;d;e;f"],v:["a;b","a;c","a;d","a;e","a;f"]},"6J":{h:["a;b;c;d","e","f"],v:["a;e;f","b;e;f","c;e;f","d;e;f"]},"6E":{h:["a","b","c;d;e;f"],v:["a;b;c","a;b;d","a;b;e","a;b;f"]},"6W":{h:["a","b","c","d","e","f"],v:["a;b;c;d;e;f"]},"7H":{h:["a","b;c;d;e;f","g"],v:["a;b;g","a;c;g","a;d;g","a;e;g","a;f;g"]},"7I":{h:["a;b;g","a;c;g","a;d;g","a;e;g","a;f;g"],v:["a","b;c;d;e;f","g"]}};function dhtmlXLayoutSepObject(g,a){var c=this;this.conf={mode:g,idx:a,blocked:false,locked:false,btn_left:((window.dhx4.isIE6||window.dhx4.isIE7||window.dhx4.isIE8)&&typeof(window.addEventListener)=="undefined"?1:0)};if(window.dhx4.isIE&&navigator.userAgent.indexOf("MSIE 7.0")>=0&&navigator.userAgent.indexOf("Trident")>=0){this.conf.btn_left=1}this.sep=document.createElement("DIV");this.sep.className="dhxlayout_sep";if(window.dhx4.isIE==true){this.sep.onselectstart=function(){return false}}this.sep.className="dhxlayout_sep dhxlayout_sep_resize_"+this.conf.mode;this._setSize=function(j,n,l,m){this.sep.style.left=j+"px";this.sep.style.top=n+"px";this.sep.style.width=Math.max(l,0)+"px";this.sep.style.height=Math.max(m,0)+"px"};this._lockSep=function(j){this.conf.locked=(j==true);this._blockSep()};this._setWH=function(j){var l=this._getLayout();l.conf.sw=(j==null?l._detectSW():Math.max(parseInt(j)||-1,-1));l._getMainInst().setSizes();l=null};this._blockSep=function(){var j=this._getLayout();var l=j.cdata.a.conf.collapsed||j.cdata.b.conf.collapsed||this.conf.locked;j=null;if(this.conf.blocked==l){return}this.sep.className="dhxlayout_sep"+(l?"":" dhxlayout_sep_resize_"+this.conf.mode);this.conf.blocked=l};this._beforeResize=function(l){if(this.conf.blocked){return}if(this.conf.resize!=null&&this.conf.resize.active==true){return}if(l.type=="touchstart"){this.sep.className+=" dhxlayout_sep_resize_actv";var n=(l.pageX||l.touches[0].pageX);var m=(l.pageY||l.touches[0].pageY)}else{if(l.button!==this.conf.btn_left){return}var n=l.clientX;var m=l.clientY}var j=this._getLayout();this.conf.resize={sx:n,sy:m,tx:l.layerX,ty:l.layerY,sep_x:parseInt(this.sep.style.left),sep_y:parseInt(this.sep.style.top),min_wa:j.cdata.a._getAvailWidth("a"),min_wb:j.cdata.b._getAvailWidth("b"),min_ha:j.cdata.a._getAvailHeight("a"),min_hb:j.cdata.b._getAvailHeight("b")};this.conf.resize.nx=this.conf.resize.sep_x;this.conf.resize.ny=this.conf.resize.sep_y;if(typeof(window.addEventListener)=="function"){window.addEventListener("mousemove",this._doOnMouseMove,false);window.addEventListener("mouseup",this._doOnMouseUp,false);window.addEventListener("touchmove",this._doOnMouseMove,false);window.addEventListener("touchend",this._doOnMouseUp,false)}else{document.body.attachEvent("onmousemove",this._doOnMouseMove);document.body.attachEvent("onmouseup",this._doOnMouseUp)}j=null};this._onResize=function(m){if(!this.conf.resize.active){this._initResizeArea();this.conf.resize.active=true}if(this.conf.mode=="v"){var j=(m.type=="mousemove"?m.clientX:(m.pageX||m.touches[0].pageX));var l=this.conf.resize.sx-j;this.conf.resize.nx=this.conf.resize.sep_x-l;if(this.conf.resize.nx>this.conf.resize.sep_x+this.conf.resize.min_wb){this.conf.resize.nx=this.conf.resize.sep_x+this.conf.resize.min_wb}else{if(this.conf.resize.nx<this.conf.resize.sep_x-this.conf.resize.min_wa){this.conf.resize.nx=this.conf.resize.sep_x-this.conf.resize.min_wa}}this.r_sep.style.left=this.conf.resize.nx+"px"}else{var n=(m.type=="mousemove"?m.clientY:(m.pageY||m.touches[0].pageY));var l=this.conf.resize.sy-n;this.conf.resize.ny=this.conf.resize.sep_y-l;if(this.conf.resize.ny>this.conf.resize.sep_y+this.conf.resize.min_hb){this.conf.resize.ny=this.conf.resize.sep_y+this.conf.resize.min_hb}else{if(this.conf.resize.ny<this.conf.resize.sep_y-this.conf.resize.min_ha){this.conf.resize.ny=this.conf.resize.sep_y-this.conf.resize.min_ha}}this.r_sep.style.top=this.conf.resize.ny+"px"}};this._afterResize=function(r){if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousemove",this._doOnMouseMove,false);window.removeEventListener("mouseup",this._doOnMouseUp,false);window.removeEventListener("touchmove",this._doOnMouseMove,false);window.removeEventListener("touchend",this._doOnMouseUp,false)}else{document.body.detachEvent("onmousemove",this._doOnMouseMove);document.body.detachEvent("onmouseup",this._doOnMouseUp)}if(!this.conf.resize.active){this.conf.resize=null;return}if(r.type=="touchend"){this.sep.className=this.sep.className.replace(/\s{0,}dhxlayout_sep_resize_actv/gi,"")}else{if(r.button!==this.conf.btn_left){return}}var n=this._getLayout();var l=n._getMainInst();var o=(l.checkEvent("onPanelResizeFinish")==true?{}:false);if(o!==false){l.forEachItem(function(u){o[u.conf.name]={w:u.conf.size.w,h:u.conf.size.h};u=null})}var m=this.conf.resize.nx-this.conf.resize.sep_x;var j=this.conf.resize.ny-this.conf.resize.sep_y;n.cdata.a._setSize(n.cdata.a.conf.size.x,n.cdata.a.conf.size.y,n.cdata.a.conf.size.w+m,n.cdata.a.conf.size.h+j,"a");n.cdata.b._setSize(n.cdata.b.conf.size.x+m,n.cdata.b.conf.size.y+j,n.cdata.b.conf.size.w-m,n.cdata.b.conf.size.h-j,"b");this._setSize(parseInt(this.r_sep.style.left),parseInt(this.r_sep.style.top),parseInt(this.r_sep.style.width),parseInt(this.r_sep.style.height));if(window.dhx4.isIE){var s=this;window.setTimeout(function(){s._removeResizeArea();s=null},1)}else{this._removeResizeArea()}if(o!==false){var q=[];l.forEachItem(function(u){var v=o[u.conf.name];if(!(v.w==u.conf.size.w&&v.h==u.conf.size.h)){q.push(u.conf.name)}u=null});l._callMainEvent("onPanelResizeFinish",[q])}l=n=null;this.conf.resize.active=false;this.conf.resize=null};this._initResizeArea=function(){if(this.r_sep==null){this.r_sep=document.createElement("DIV");this.r_sep.className="dhxlayout_resize_sep";this.r_sep.style.left=this.sep.style.left;this.r_sep.style.top=this.sep.style.top;this.r_sep.style.width=this.sep.style.width;this.r_sep.style.height=this.sep.style.height;this.sep.parentNode.appendChild(this.r_sep);if(window.dhx4.isIE){this.r_sep.onselectstart=function(){return false}}}if(this.r_area==null){this.r_area=document.createElement("DIV");this.r_area.className="dhxlayout_resize_area";this.sep.parentNode.appendChild(this.r_area);if(window.dhx4.isIE){this.r_area.onselectstart=function(){return false}}if(this.conf.mode=="v"){var j=parseInt(this.r_sep.style.left)-this.conf.resize.min_wa;var n=parseInt(this.r_sep.style.top);var l=this.conf.resize.min_wa+this.conf.resize.min_wb+parseInt(this.r_sep.style.width);var m=parseInt(this.r_sep.style.height)}else{var j=parseInt(this.r_sep.style.left);var n=parseInt(this.r_sep.style.top)-this.conf.resize.min_ha;var l=parseInt(this.r_sep.style.width);var m=this.conf.resize.min_ha+this.conf.resize.min_hb+parseInt(this.r_sep.style.height)}this.r_area.style.left=j+"px";this.r_area.style.top=n+"px";if(!dhtmlXLayoutObject.prototype._confGlob.reszieCover){dhtmlXLayoutObject.prototype._confGlob.reszieCover={};this.r_area.style.width=l+"px";this.r_area.style.height=m+"px";dhtmlXLayoutObject.prototype._confGlob.reszieCover.w=parseInt(this.r_area.style.width)-this.r_area.offsetWidth;dhtmlXLayoutObject.prototype._confGlob.reszieCover.h=parseInt(this.r_area.style.height)-this.r_area.offsetHeight}this.r_area.style.width=l+dhtmlXLayoutObject.prototype._confGlob.reszieCover.w+"px";this.r_area.style.height=m+dhtmlXLayoutObject.prototype._confGlob.reszieCover.h+"px"}document.body.className+=" dhxlayout_resize_"+this.conf.mode};this._removeResizeArea=function(){this.r_sep.onselectstart=null;this.r_sep.parentNode.removeChild(this.r_sep);this.r_sep=null;this.r_area.onselectstart=null;this.r_area.parentNode.removeChild(this.r_area);this.r_area=null;document.body.className=String(document.body.className).replace(/\s{0,}dhxlayout_resize_[vh]/gi,"")};this._doOnMouseDown=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}else{j.cancelBubble=true}c._beforeResize(j)};this._doOnMouseMove=function(j){j=j||event;if(j.preventDefault){j.preventDefault()}else{j.cancelBubble=true}c._onResize(j)};this._doOnMouseUp=function(j){j=j||event;c._afterResize(j)};if(typeof(window.addEventListener)=="function"){this.sep.addEventListener("mousedown",this._doOnMouseDown,false);this.sep.addEventListener("touchstart",this._doOnMouseDown,false)}else{this.sep.attachEvent("onmousedown",this._doOnMouseDown)}this._unload=function(){if(typeof(window.addEventListener)=="function"){this.sep.removeEventListener("mousedown",this._doOnMouseDown,false);this.sep.removeEventListener("touchstart",this._doOnMouseDown,false)}else{this.sep.detachEvent("onmousedown",this._doOnMouseDown)}if(window.dhx4.isIE==true){this.sep.onselectstart=null}this.sep.parentNode.removeChild(this.sep);this.sep=null;for(var j in this){this[j]=null}c=null};return this}dhtmlXLayoutObject.prototype.setSeparatorSize=function(g,j){if(typeof(g)=="number"){var l=this.setSeparatorSize({index:g,current:-1},j);if(l.sep!=null){l.sep._setWH(j)}return}for(var c in this.cdata){if(this.cdata[c].dataType=="layout"&&this.cdata[c].dataNested==true&&this.cdata[c].dataObj!=null){g=this.cdata[c].dataObj.setSeparatorSize(g,j);if(g.sep!=null){return g}}if(c=="a"&&this.sep!=null){g.current++;if(g.index==g.current){return{sep:this.sep}}}}return g};window.dhtmlXLayoutCell=function(j,g){dhtmlXCellObject.apply(this,[j,"_layout"]);var c=this;this.layout=g;this.conf.skin=this.layout.conf.skin;this.conf.mode=this.layout.conf.mode;this.conf.collapsed=false;this.conf.fixed={w:false,h:false};this.conf.docked=true;this.conf.min_width=26;this.conf.min_height=26;this.attachEvent("_onCellUnload",function(){this.cell.childNodes[this.conf.idx.hdr].ondblclick=null;if(this.conf.mode!="c"){this.cell.childNodes[this.conf.idx.hdr].lastChild.ondblclick=null}this._unloadDocking();this.layout=null;c=null});this._hdrInit();this.cell.childNodes[this.conf.idx.hdr].ondblclick=function(){var l=c.layout._getMainInst();l._callMainEvent("onDblClick",[c.conf.name]);l=null};this.attachEvent("_onContentLoaded",function(){var l=this.layout._getMainInst();l._callMainEvent("onContentLoaded",[this.conf.name]);l=null});if(this.conf.mode!="c"){var a=document.createElement("DIV");a.className="dhxlayout_arrow dhxlayout_arrow_"+this.conf.mode+this._idd;this.cell.childNodes[this.conf.idx.hdr].appendChild(a);a.onclick=function(l){if(c.conf.collapsed){c.expand()}else{c.collapse()}};a=null}this.attachEvent("_onBeforeContentAttach",function(l){if(l=="tabbar"||l=="layout"||l=="acc"){this._hideBorders()}if(l=="sidebar"){this._hideBorders();this.showHeader()}});this._initDocking();return this};dhtmlXLayoutCell.prototype=new dhtmlXCellObject();dhtmlXLayoutCell.prototype.getId=function(){return this.conf.name};dhtmlXLayoutCell.prototype._initDocking=function(){var a=this;this.dock=function(){var g=this.layout._getMainInst();if(g.dhxWins==null||this.conf.docked){g=null;return}var c=g.dhxWins.window(this.conf.name);c.close();this._attachFromCell(c);this.conf.docked=true;if(!this.conf.dock_collapsed){this.expand()}g._callMainEvent("onDock",[this.conf.name]);g=c=null};this.undock=function(c,n,l,m){var j=this.layout._getMainInst();if(j.dhxWins==null||this.conf.docked==false){j=null;return}this.conf.dock_collapsed=this.conf.collapsed;if(!this.conf.collapsed){this.collapse()}if(j.dhxWins.window(this.conf.name)!=null){var g=j.dhxWins.window(this.conf.name);g.show()}else{if(c==null){c=20}if(n==null){n=20}if(l==null){l=320}if(m==null){m=200}var g=j.dhxWins.createWindow(this.conf.name,c,n,l,m);g.button("close").hide();g.addUserButton("dock",99,"Dock");g.button("dock").show();g.button("dock").attachEvent("onClick",this._doOnDockClick);g.setText(this.getText());g.attachEvent("onClose",this._doOnDockWinClose)}this.conf.docked=false;g._attachFromCell(this);j._callMainEvent("onUnDock",[this.conf.name]);j=g=null};this._doOnDockClick=function(){a.dock()};this._doOnDockWinClose=function(c){c.hide();return false};this._unloadDocking=function(){a=null}};dhtmlXLayoutCell.prototype._hdrInit=function(){var c="";if(window.dhx4.isIE){if(navigator.userAgent.indexOf("MSIE 9.0")!=-1){c=" dhx_cell_hdr_text_ie9"}else{if(window.dhx4.isIE8){c=" dhx_cell_hdr_text_ie8"}else{if(window.dhx4.isIE7){c=" dhx_cell_hdr_text_ie7"}else{if(window.dhx4.isIE6){c=" dhx_cell_hdr_text_ie6"}}}}}else{if(window.dhx4.isChrome||window.dhx4.isKHTML){c=" dhx_cell_hdr_text_chrome"}}var a=document.createElement("DIV");a.className="dhx_cell_hdr";a.innerHTML="<div class='dhx_cell_hdr_text"+c+"'></div>";this.cell.insertBefore(a,this.cell.childNodes[this.conf.idx.cont]);a=null;this.conf.ofs_nodes.t._getHdrHeight="func";this.conf.hdr={visible:true};this.conf.idx_data.hdr="dhx_cell_hdr";this._updateIdx();this.attachEvent("_onSetSize",this._hdrOnSetSize);this.attachEvent("_onBorderChange",this._hdrOnBorderChange);this.attachEvent("_onViewSave",this._hdrOnViewSave);this.attachEvent("_onViewRestore",this._hdrOnViewRestore)};dhtmlXLayoutCell.prototype.showHeader=function(a){if(this.conf.hdr.visible||this.conf.collapsed){return}if(this.conf.hdr.w_saved>this._getAvailWidth()||this.conf.hdr.h_saved>this._getAvailHeight()){return}this.conf.hdr.w_saved=this.conf.hdr.h_saved=null;this.conf.hdr.visible=true;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr";if(a!==true){this._adjustCont(this._idd)}};dhtmlXLayoutCell.prototype.hideHeader=function(a){if(!this.conf.hdr.visible||this.conf.collapsed){return}this.conf.hdr.w_saved=this._getMinWidth();this.conf.hdr.h_saved=this._getMinHeight();this.conf.hdr.visible=false;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr dhx_cell_hdr_hidden";this._hdrUpdBorder();this._mtbUpdBorder();if(a!==true){this._adjustCont(this._idd)}};dhtmlXLayoutCell.prototype.isHeaderVisible=function(){return(this.conf.hdr.visible==true)};dhtmlXLayoutCell.prototype.showArrow=function(){this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display=""};dhtmlXLayoutCell.prototype.hideArrow=function(){this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display="none"};dhtmlXLayoutCell.prototype.isArrowVisible=function(){return(this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display=="")};dhtmlXLayoutCell.prototype.setText=function(a){this.conf.hdr.text=a;this._hdrUpdText()};dhtmlXLayoutCell.prototype.getText=function(){return this.conf.hdr.text};dhtmlXLayoutCell.prototype.setCollapsedText=function(a){this.conf.hdr.text_collapsed=a;this._hdrUpdText()};dhtmlXLayoutCell.prototype.getCollapsedText=function(){return(this.conf.hdr.text_collapsed!=null?this.conf.hdr.text_collapsed:this.conf.hdr.text)};dhtmlXLayoutCell.prototype._hdrUpdText=function(){var a=(this.conf.collapsed==true&&this.conf.hdr.text_collapsed!=null?this.conf.hdr.text_collapsed:this.conf.hdr.text);this.cell.childNodes[this.conf.idx.hdr].firstChild.innerHTML="<span>"+a+"</span>"};dhtmlXLayoutCell.prototype._hdrUpdBorder=function(){if(this.conf.borders==true){this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr"+(this.conf.hdr.visible?"":" dhx_cell_hdr_hidden")}else{if(!this.conf.hdr.visible){this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr dhx_cell_hdr_hidden_no_borders"}}};dhtmlXLayoutCell.prototype._hdrOnSetSize=function(){if(this.conf.collapsed&&this.conf.mode=="v"){this._fitHdr()}};dhtmlXLayoutCell.prototype._hdrOnBorderChange=function(){this.hideHeader(true);this._hdrUpdBorder()};dhtmlXLayoutCell.prototype._hdrOnViewSave=function(a){this.views[a].hdr_vis=this.conf.hdr.visible};dhtmlXLayoutCell.prototype._hdrOnViewRestore=function(a){if(this.conf.hdr.visible!=this.views[a].hdr_vis){this[this.views[a].hdr_vis?"showHeader":"hideHeader"](true)}this.views[a].hdr_vis=null;delete this.views[a].hdr_vis};dhtmlXLayoutCell.prototype._getHdrHeight=function(a){if(this.conf.collapsed&&this.conf.mode=="v"&&a!==true){return 27}return this.cell.childNodes[this.conf.idx.hdr].offsetHeight};dhtmlXLayoutCell.prototype._fitHdr=function(){if(this.conf.collapsed){if(typeof(dhtmlXLayoutObject.prototype._confGlob.hdrColH)=="undefined"){this.cell.childNodes[this.conf.idx.hdr].style.height=this.cell.offsetHeight+"px";dhtmlXLayoutObject.prototype._confGlob.hdrColH=parseInt(this.cell.childNodes[this.conf.idx.hdr].style.height)-this._getHdrHeight(true)}this.cell.childNodes[this.conf.idx.hdr].style.height=this.cell.offsetHeight+dhtmlXLayoutObject.prototype._confGlob.hdrColH+"px"}else{this.cell.childNodes[this.conf.idx.hdr].style.height=null}};dhtmlXLayoutCell.prototype.expand=function(n){if(!this.conf.collapsed){return true}var g=this.layout;if(this.conf.mode=="v"){var m=(n?g.conf.hh:g.cdata[g.conf.nextCell[this._idd]]._getMinWidth(this._idd));var j=g.cont.offsetWidth-g.conf.sw;if(m+this.conf.size.w_avl>j){g=null;return false}}else{var l=(n?g.conf.hh:g.cdata[g.conf.nextCell[this._idd]]._getMinHeight(this._idd)+g.cdata[g.conf.nextCell[this._idd]]._getHdrHeight());var c=g.cont.offsetHeight-g.conf.sw;if(l+this.conf.size.h_avl>c){g=null;return false}}if(this.conf.docked==false){this.dock();return}this.cell.className=String(this.cell.className).replace(/\s{0,}dhxlayout_collapsed_[hv]/gi,"");this.conf.collapsed=false;if(this.conf.mode=="v"){this.conf.size.w=Math.min(j-m,this.conf.size.w_saved);this.conf.size.w_saved=this.conf.size.w_avl=null}else{this.conf.size.h=Math.min(c-l,this.conf.size.h_saved);this.conf.size.h_saved=this.conf.size.h_avl=null}if(this.conf.mode=="v"){this._fitHdr()}g.setSizes(g.conf.nextCell[this._idd],g.conf.nextCell[this._idd],n==true,"expand");g.sep._blockSep();g=null;this._hdrUpdText();var a=this.layout._getMainInst();a._callMainEvent("onExpand",[this.conf.name]);a=null;return true};dhtmlXLayoutCell.prototype.collapse=function(){if(this.conf.collapsed){return false}var c=this.layout;if(c.cdata[c.conf.nextCell[this._idd]].expand(true)==false){return false}if(this.conf.mode=="v"){this.conf.size.w_saved=this.conf.size.w;this.conf.size.w_avl=this._getMinWidth(this._idd)}else{this.conf.size.h_saved=this.conf.size.h;this.conf.size.h_avl=this._getMinHeight(this._idd)+this._getHdrHeight()}this.cell.className+=" dhxlayout_collapsed_"+this.conf.mode;this.conf.collapsed=true;if(this.conf.mode=="v"){this.conf.size.w=c.conf.hh}else{this.conf.size.h=this._getHdrHeight()}c.setSizes(c.conf.nextCell[this._idd],c.conf.nextCell[this._idd],false,"collapse");c.sep._blockSep();c=null;this._hdrUpdText();var a=this.layout._getMainInst();a._callMainEvent("onCollapse",[this.conf.name]);a=null;return true};dhtmlXLayoutCell.prototype.isCollapsed=function(){return(this.conf.collapsed==true)};dhtmlXLayoutCell.prototype.setMinWidth=function(a){this.conf.min_height=parseInt(h)||0};dhtmlXLayoutCell.prototype.setMinHeight=function(a){this.conf.min_height=parseInt(a)||0};dhtmlXLayoutCell.prototype._getMinWidth=function(c){if(this.dataType=="layout"&&this.dataObj!=null){if(this.dataObj.conf.pattern=="1C"){return Math.max(this.conf.min_width,this.dataObj.cdata.a._getMinWidth(c))}else{if(this.dataObj.conf.mode=="v"){var a=c||this._idd;if(this.dataObj.cdata[a].conf.collapsed){a=this.dataObj.conf.nextCell[a]}return Math.max(this.conf.min_width,this.dataObj.cdata[a]._getMinWidth(c)+this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getWidth()+this.dataObj.conf.sw)}else{return Math.max(this.conf.min_width,this.dataObj.cdata.a._getMinWidth(c),this.dataObj.cdata.b._getMinWidth(c))}}}return Math.max(this.conf.min_width,1)};dhtmlXLayoutCell.prototype._getMinHeight=function(g){var c=0;if(this.conf.idx.menu!=null){c+=this.cell.childNodes[this.conf.idx.menu].offsetHeight}if(this.dataType=="layout"&&this.dataObj!=null){if(this.dataObj.conf.pattern=="1C"){return Math.max(this.conf.min_height,this.dataObj.cdata.a._getMinHeight(g))}else{if(this.dataObj.conf.mode=="h"){var a=g;if(this.dataObj.cdata[a].conf.collapsed){a=this.dataObj.conf.nextCell[a]}return Math.max(this.conf.min_height,this.dataObj.cdata[a]._getMinHeight(g)+this.dataObj.cdata[a]._getHdrHeight()+this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getHeight()+this.dataObj.conf.sw)}else{return Math.max(this.conf.min_height,this.dataObj.cdata.a._getMinHeight(g)+this.dataObj.cdata.a._getHdrHeight(),this.dataObj.cdata.b._getMinHeight(g)+this.dataObj.cdata.b._getHdrHeight())}}}return Math.max(this.conf.min_height,c)};dhtmlXLayoutCell.prototype._getAvailWidth=function(g){if(this.dataType=="layout"&&this.dataObj!=null){if(this.dataObj.conf.pattern=="1C"){return this.dataObj.cdata.a._getAvailWidth(g)}else{if(this.dataObj.conf.mode=="v"){var a=(this.dataObj.cdata.a.conf.collapsed==true);var c=(this.dataObj.cdata.b.conf.collapsed==true);if(g=="a"){return this.dataObj.cdata[c?"a":"b"]._getAvailWidth(g)}else{return this.dataObj.cdata[a?"b":"a"]._getAvailWidth(g)}}else{return Math.min(this.dataObj.cdata.a._getAvailWidth(g),this.dataObj.cdata.b._getAvailWidth(g))}}}return this.cell.offsetWidth-this._getMinWidth()};dhtmlXLayoutCell.prototype._getAvailHeight=function(j){if(this.dataType=="layout"&&this.dataObj!=null){if(this.dataObj.conf.pattern=="1C"){return this.dataObj.cdata.a._getAvailHeight(j)}else{if(this.dataObj.conf.mode=="h"){var c=(this.dataObj.cdata.a.conf.collapsed==true);var g=(this.dataObj.cdata.b.conf.collapsed==true);if(j=="a"){return this.dataObj.cdata[g?"a":"b"]._getAvailHeight(j)}else{return this.dataObj.cdata[c?"b":"a"]._getAvailHeight(j)}}else{return Math.min(this.dataObj.cdata.a._getAvailHeight(j),this.dataObj.cdata.b._getAvailHeight(j))}}}var a=this._getHdrHeight();if(this.conf.mode=="v"&&this.conf.collapsed){a=this.conf.hh}return this.cell.offsetHeight-a-this._getMinHeight()};dhtmlXLayoutCell.prototype.setWidth=function(j){if(this.conf.mode=="v"){if(this.conf.collapsed){return}var l=this.layout;var m=l.cdata[l.conf.nextCell[this._idd]];if(m.conf.collapsed){j=j+l.conf.sw+m._getWidth();n=l=m=null;return}var g=this._getMinWidth(this._idd);var o=l.cont.offsetWidth-m._getMinWidth(this._idd)-l.conf.sw;j=Math.max(g,Math.min(j,o));this.conf.size.w=j;l.setSizes(m._idd,m._idd);l=m=null}else{if(this.layout==null||this.layout.parentLayout==null){return}var n=this.layout.parentLayout;var l=this.layout;var m=l.cdata[l.conf.nextCell[this._idd]];for(var c in n.cdata){if(n.cdata[c].dataObj==l){n.cdata[c].setWidth(j)}}n=l=null}};dhtmlXLayoutCell.prototype.setHeight=function(n){if(this.conf.mode=="h"){if(this.conf.collapsed){return}var j=this.layout;var m=j.cdata[j.conf.nextCell[this._idd]];if(m.conf.collapsed){n=n+j.conf.sw+m._getHeight();var o=(this.layout!=null&&this.layout.parentLayout!=null?this.layout.parentLayout:null);if(o!=null){for(var c in o.cdata){if(o.cdata[c].dataObj==j){o.cdata[c].setHeight(n)}}}o=j=m=null;return}var l=this._getMinHeight(this._idd)+this._getHdrHeight();var g=j.cont.offsetHeight-m._getMinHeight(this._idd)-m._getHdrHeight()-j.conf.sw;n=Math.max(l,Math.min(n,g));this.conf.size.h=n;j.setSizes(m._idd,m._idd);j=m=null}else{if(this.layout==null||this.layout.parentLayout==null){return}var o=this.layout.parentLayout;var j=this.layout;var m=j.cdata[j.conf.nextCell[this._idd]];for(var c in o.cdata){if(o.cdata[c].dataObj==j){o.cdata[c].setHeight(n)}}o=j=null}};dhtmlXLayoutCell.prototype.getWidth=function(){return this.conf.size.w};dhtmlXLayoutCell.prototype.getHeight=function(){return this.conf.size.h};dhtmlXLayoutCell.prototype.fixSize=function(c,j){this.conf.fixed.w=window.dhx4.s2b(c);this.conf.fixed.h=window.dhx4.s2b(j);var a=this.layout._getMainInst();var g={};a.forEachItem(function(l){if(l.conf.fsize!=null){var r=l.getId();var o={h:(l.conf.fixed.w==true),v:(l.conf.fixed.h==true)};for(var m in o){if(o[m]==true&&l.conf.fsize[m]!=null){if(!(l.conf.fsize[m] instanceof Array)){l.conf.fsize[m]=[l.conf.fsize[m]]}for(var n=0;n<l.conf.fsize[m].length;n++){g[l.conf.fsize[m][n]]=true}}}}l=null});a._forEachSep(function(l){l._lockSep(g[l.conf.idx]==true);l=null});a=null};dhtmlXCellObject.prototype.attachLayout=function(a){this.callEvent("_onBeforeContentAttach",["layout"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(typeof(this._layoutMainInst)!="undefined"){c._layoutMainInst=this._layoutMainInst}if(typeof(window.dhtmlXLayoutCell)!="undefined"&&this instanceof dhtmlXLayoutCell){c._isParentCell=true}if(typeof(window.dhtmlXAccordionCell)!="undefined"&&(this instanceof window.dhtmlXAccordionCell)){c._ofs={t:-1,r:-1,l:-1,b:-1}}if(typeof(window.dhtmlXSideBarCell)!="undefined"&&(this instanceof window.dhtmlXSideBarCell)){if(this.conf.skin=="dhx_web"){c._ofs={l:8}}if(this.conf.skin=="dhx_terrace"){c._ofs={l:11}}else{c._ofs={l:-1}}}if(typeof(a)=="string"){a={pattern:a}}if(typeof(a.skin)=="undefined"){a.skin=this.conf.skin}a.parent=c;this.dataType="layout";this.dataObj=new dhtmlXLayoutObject(a);if(this instanceof dhtmlXLayoutCell){this.dataObj.parentLayout=this.layout}c._layoutMainInst=null;a.parent=null;c=a=null;this.callEvent("_onContentAttach",[]);return this.dataObj};function dhtmlXTabBar(c,l){var g=this;this.conf={skin:(window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxtabbar")||"dhx_skyblue"),css:"dhxtabbar",lastActive:null,closeButton:false,align:"left",tabsMode:(l=="bottom"?"bottom":"top"),tabsContCss:(navigator.userAgent.indexOf("Safari")>=0&&navigator.userAgent.indexOf("5.1.7")>=0?" safari_517_fix":""),contZone:true,transSpeed:"0.15s",arwMode:"always",tabsOfs:1,tabsTop:0,url_demand:false,urls:{},autoload:{}};var j;if(c!=null&&typeof(c)=="object"&&typeof(c.tagName)=="undefined"){j=c.parent;if(typeof(c.skin)!="undefined"){this.conf.skin=c.skin}if(typeof(c.mode)!="undefined"){this.conf.tabsMode=(c.mode=="bottom"?"bottom":"top")}if(typeof(c.align)!="undefined"){this.conf.align=(c.align=="right"?"right":"left")}if(typeof(c.close_button)!="undefined"){this.conf.closeButton=window.dhx4.s2b(c.close_button)}if(typeof(c.content_zone)!="undefined"){this.conf.contZone=window.dhx4.s2b(c.content_zone)}if(typeof(c.xml)!="undefined"){this.conf.autoload.xml=c.xml}if(typeof(c.json)!="undefined"){this.conf.autoload.xml=c.json}if(typeof(c.tabs)!="undefined"){this.conf.autoload.tabs=c.tabs}if(typeof(c.onload)!="undefined"){this.conf.autoload.tabs=c.tabs}if(typeof(c.arrows_mode)!="undefined"){this.conf.autoload.arrows_mode=c.arrows_mode}}else{j=c}window.dhtmlXCellTop.apply(this,[j,c.offsets]);if(this.base._ofs!=null&&this.base._ofs.t!=null){this.conf.tabsTop=this.base._ofs.t}this.tabsMode=document.createElement("DIV");this.tabsMode.className="dhxtabbar_tabs_"+this.conf.tabsMode;this.cont.appendChild(this.tabsMode);this.tabsArea=document.createElement("DIV");this.tabsArea.className="dhxtabbar_tabs dhxtabbar_tabs_"+this.conf.tabsMode;this.tabsArea.innerHTML="<div class='dhxtabbar_tabs_ar_left'><div class='dhxtabbar_arrow_img'></div></div><div class='dhxtabbar_tabs_base'><div class='dhxtabbar_tabs_cont_"+this.conf.align+this.conf.tabsContCss+"'><div class='dhxtabbar_tabs_line'></div></div></div><div class='dhxtabbar_tabs_ar_right'><div class='dhxtabbar_arrow_img'></div></div>";this.tabsArea.style.top=(this.conf.tabsMode=="top"?this.conf.tabsTop+"px":"auto");this.tabsMode.appendChild(this.tabsArea);this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px";this.tabsArea.childNodes[0].onclick=function(){if(g.conf.align=="left"){g._moveTabs(1)}else{g._moveTabs(-1)}};this.tabsArea.childNodes[2].onclick=function(){if(g.conf.align=="left"){g._moveTabs(-1)}else{g._moveTabs(1)}};this._onTabsAreaClick=function(m){return this._callMainEvent("onTabClose",[m])};this.tabsArea.onclick=function(n){n=n||event;var m=(n.target||n.srcElement);while(m!=null){if(typeof(m._tabCloseId)!="undefined"){if(g._onTabsAreaClick(m._tabCloseId)!==true){return}g.t[m._tabCloseId].conf.remove=true;g._hideTab(m._tabCloseId);m=null}else{if(typeof(m._tabId)!="undefined"){g._doOnClick(m._tabId);m=null}}if(m!=null){m=m.parentNode;if(m==this){m=null}}}};this.tabsArea.onselectstart=function(m){m=m||event;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}};this._doOnClick=function(m){this.callEvent("onTabClick",[m,this.conf.lastActive]);if(this.t[m].conf.enabled){this._setTabActive(m)}};this.t={};this.addTab=function(m,v,o,s,r,w){if(typeof(w)!="boolean"){w=(this.conf.closeButton==true)}r=window.dhx4.s2b(r);var q=document.createElement("DIV");q.className="dhxtabbar_tab";q.innerHTML="<div class='dhxtabbar_tab_text"+(w?" dhxtabbar_tab_text_close":"")+"'>"+v+"</div>"+(w?"<div class='dhxtabbar_tab_close'></div>":"");q._tabId=m;if(w){q.childNodes[1]._tabCloseId=m}var n=this.tabsArea.childNodes[1].firstChild;if(s!=null&&s+1>0&&s+1<n.childNodes.length){n.insertBefore(q,n.childNodes[s+1])}else{n.appendChild(q)}var x=false;if(typeof(o)=="undefined"||o==null||o=="*"){o=this._getLabelWidth(v,w);x=true}else{o=parseInt(o)}q.style.width=o+"px";var u=new dhtmlXTabBarCell(m,this);this.tabsMode.appendChild(u.cell);this.t[m]={tab:q,cell:u,conf:{text:v,visible:true,active:false,enabled:true,close:w,width:o,autowidth:x}};n=u=null;if(r){this._setTabActive(m)}else{this._adjustCell(m)}if(this.conf.initSeq!=true&&this.conf.arwMode=="auto"){this.setSizes()}};this.setSizes=function(){this._adjustCont();if(this.conf.tabsAreaOfs==null){this.tabsArea.style.width=this.cont.offsetWidth+"px";this.conf.tabsAreaOfs=parseInt(this.tabsArea.style.width)-this.tabsArea.offsetWidth}this.tabsArea.style.width=this.cont.offsetWidth+this.conf.tabsAreaOfs+"px";this._adjustCell(this.conf.lastActive);this._adjustTabs(true);this.callEvent("_onSetSizes",[])};this._adjustCell=function(q){if(!this.conf.contZone||q==null){return}var o=(this.conf.tabsMode=="top"?this.tabsArea.offsetHeight:0)+this.conf.tabsTop;var n=this.cont.offsetHeight-this.tabsArea.offsetHeight-this.conf.tabsTop;var m=this.t[q].cell.dataType;if(this.conf.skin=="dhx_skyblue"&&(m=="layout"||m=="tabbar"||m=="acc")){if(this.conf.tabsMode=="top"){o=o-1}n=n+1}if(q!=this.conf.lastActive){o=-5000;this.t[q].cell.cell.style.visibility="hidden";this.t[q].cell.cell.style.zIndex=0}this.t[q].cell._setSize(0,o,this.cont.offsetWidth,n)};this.setTabsMode=function(m){this.conf.tabsMode=(m=="bottom"?"bottom":"top");this.tabsMode.className="dhxtabbar_tabs_"+this.conf.tabsMode;this.tabsArea.className="dhxtabbar_tabs dhxtabbar_tabs_"+this.conf.tabsMode;this.tabsArea.style.top=(this.conf.tabsMode=="top"?this.conf.tabsTop+"px":"auto");this.setSizes()};this._tabCss=function(r,o){var m=this.t[r].conf.active;var q=!this.t[r].conf.enabled;var n=!this.t[r].conf.visible;return"dhxtabbar_tab"+(n?" dhxtabbar_tab_hidden":(m||q?" dhxtabbar_tab"+(m?"_actv":"")+(q?"_dis":""):""))};this._getLabelWidth=function(o,n){if(this.tabsTextTest==null){this.tabsTextTest=document.createElement("SPAN");this.tabsTextTest.className="dhxtabbar_tabs_text_test_"+this.conf.skin}document.body.appendChild(this.tabsTextTest);this.tabsTextTest.innerHTML=o;var m=this.tabsTextTest.offsetWidth;if(window.dhx4.isIE&&m==0){m=this.tabsTextTest.offsetWidth}m+=(this.conf.skin=="dhx_terrace"?44:35);m+=(n?(this.conf.skin=="dhx_terrace"?14:9):0);document.body.removeChild(this.tabsTextTest);return m};this._adjustTabs=function(r){if(this._checkArrows()==true||r==true){this.tabsArea.childNodes[1].style.left=this.tabsArea.childNodes[0].offsetWidth-1+"px";this.tabsArea.childNodes[1].style.width=Math.max(0,this.tabsArea.offsetWidth-this.tabsArea.childNodes[0].offsetWidth-this.tabsArea.childNodes[2].offsetWidth)+1+"px"}var u=this.tabsArea.childNodes[1];if(u.offsetWidth<5){u=null;return}var m=parseInt(u.childNodes[0].style[this.conf.align]);var o=null;for(var s=0;s<u.childNodes[0].childNodes.length;s++){var v=u.childNodes[0].childNodes[s]._tabId;if(v!=null&&this.t[v].conf.visible){var n=this.t[v].tab.offsetWidth-this.conf.tabsOfs;if(this.t[v].conf.active){if(m<0||u.offsetWidth<n){o={d:1,id:v}}else{if(m+n>u.offsetWidth){o={d:-1,id:v}}}}m+=n}}if(o!=null){this._moveTabs(o.d,o.id)}else{if(u.offsetWidth>m+1){u.childNodes[0].style[this.conf.align]=Math.min(0,parseInt(u.childNodes[0].style[this.conf.align])+(u.offsetWidth-m))+"px"}}u=o=null};this._moveTabs=function(y,r){var o=this.tabsArea.childNodes[1].childNodes[0];var v=0;var A=[];var D=null;for(var m=0;m<o.childNodes.length;m++){var n=o.childNodes[m]._tabId;if(n!=null&&this.t[n].conf.visible){A.push({id:n,w:this.t[n].tab.offsetWidth-this.conf.tabsOfs,ind:v});if(n==r){D=v}v++}}var C=parseInt(this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]);var u=this.tabsArea.offsetWidth-this.tabsArea.childNodes[0].offsetWidth-this.tabsArea.childNodes[2].offsetWidth;var w=null;var s=null;for(var m=0;m<A.length;m++){A[m].x=C;if(w==null&&C>=0&&C+A[m].w>0){w=A[m]}if(C<u&&C+A[m].w<=u){s=A[m]}C+=A[m].w}if(D!=null){var E=A[D]}else{var E=null;if(y>0){if(w==null){if(A.length>0){E=A[A.length-1]}}else{if(w.ind>0&&A.length>=w.ind){E=A[w.ind-1]}}}else{if(s==null){if(A.length>0){E=A[0]}}else{if(A.length>s.ind){E=A[s.ind+1]}}}}if(E!=null){if(y>0){if(C<u){o.style[this.conf.align]=Math.min(0,parseInt(o.style[this.conf.align])+(u-C))+"px"}else{o.style[this.conf.align]=parseInt(o.style[this.conf.align])-E.x+"px"}}else{o.style[this.conf.align]=parseInt(o.style[this.conf.align])-E.x+u-E.w+"px"}}o=E=A=null};this._getNextVisible=function(n,m){return this._getNearVisible(n,m,"next")};this._getPrevVisible=function(n,m){return this._getNearVisible(n,m,"previous")};this._getFirstVisible=function(){return this._getNearVisible(null,false,"first")};this._getNearVisible=function(s,o,r){if(r=="first"){var q=this.tabsArea.childNodes[1].childNodes[0].childNodes[1];r="next"}else{if(s==null||this.t[s]==null){return(o?this._getFirstVisible():null)}var q=this.t[s].tab[r+"Sibling"]}var n=null;while(q!=null&&n==null){var m=q._tabId;if(m!=null&&n==null&&this.t[m].conf.visible){n=m}else{q=q[r+"Sibling"]}}q=null;return n};this._showTab=function(n,m){if(this.t[n]==null){return}if(this.t[n].conf.transActv==true){if(this.t[n].conf.transMode=="show"){return}}else{if(this.t[n].conf.visible==true){return}}if(this.conf.transProp!==false){this.t[n].conf.transActv=true;this.t[n].conf.transMode="show";this.t[n].conf.transProp=this.conf.transProp;this.t[n].conf.transActvId=(m?n:null);if(!this.t[n].conf.transEv){this.t[n].tab.addEventListener(this.conf.transEv,this._doOnTrEnd);this.t[n].conf.transEv=true}this.t[n].conf.visible=true;this.t[n].tab.className=this._tabCss(n);this.t[n].tab.style[this.conf.transProp]=this.conf.transValueWidth;this.t[n].tab.style.width=this.t[n].conf.width+"px";if(this.t[n].tab.clientWidth>=this.t[n].conf.width){this.t[n].tab.style.visibility="visible"}}else{this.t[n].conf.visible=true;this.t[n].tab.style.display="";if(m){this._setTabActive(n)}else{this._adjustTabs()}}};this._hideTab=function(s,m){if(this.t[s]==null){return}if(this.t[s].conf.transActv==true){if(this.t[s].conf.transMode=="hide"){return}}else{if(this.t[s].conf.visible!=true){return}}var n=false;if(this.conf.lastActive==s){this.conf.lastActive=null;this.t[s].conf.active=false;this.t[s].tab.className=this._tabCss(s);n=true}var q=this._getPrevVisible(s);var o=this._getNextVisible(s);var r=(n&&m!==false?(m==true?null:m)||o||q:null);if(this.conf.transProp!==false){this.t[s].conf.transActv=true;this.t[s].conf.transMode="hide";this.t[s].conf.transProp=this.conf.transProp;this.t[s].conf.transActvId=r;this.t[s].conf.visible=false;if(!this.t[s].conf.transEv){this.t[s].tab.addEventListener(this.conf.transEv,this._doOnTrEnd);this.t[s].conf.transEv=true}this.t[s].tab.style.visibility="hidden";this.t[s].tab.className=g._tabCss(s);this.t[s].tab.style[this.conf.transProp]=this.conf.transValueWidth;this.t[s].tab.style.width="0px"}else{this.t[s].tab.style.display="none";this.t[s].conf.visible=false;if(this.conf.contZone){this.t[s].cell.cell.style.visibility="hidden";this.t[s].cell.cell.style.top="-5000px"}if(r!=null){this._setTabActive(r)}this._adjustTabs();if(this.t[s].conf.remove){this._removeTab(s)}}};this._isTabVisible=function(m){return(this.t[m].conf.visible==true)};this._doOnTrEnd=function(){var o=this._tabId;if(g.t[o]==null){return}var m=g.t[o];var n=m.conf.transActvId;if(m.conf.transMode=="hide"){if(m.conf.remove){g._removeTab(o)}else{m.tab.style[m.conf.transProp]="";if(g.conf.contZone){m.cell.cell.style.visibility="hidden";m.cell.cell.style.top="-5000px"}m.conf.transActv=false}}else{if(m.conf.transMode=="show"){m.tab.style[m.conf.transProp]="";m.tab.style.visibility="visible";m.conf.transMode=null;m.conf.transActv=false}}if(n!=null){g._setTabActive(n)}else{g._adjustTabs()}m=null};this.enableTabCloseButton=function(m){this.conf.closeButton=window.dhx4.s2b(m)};this.unload=function(){this.conf.unloading=true;this.clearAll();this.t=null;if(this.tabsTextTest!=null){if(this.tabsTextTest.parentNode){this.tabsTextTest.parentNode.removeChild(this.tabsTextTest)}this.tabsTextTest=null}window.dhx4._enableDataLoading(this,null,null,null,"clear");this.tabsArea.childNodes[0].onclick=null;this.tabsArea.childNodes[2].onclick=null;this.tabsArea.onclick=null;this.tabsArea.onselectstart=null;this.tabsArea.parentNode.removeChild(this.tabsArea);this.tabsArea=null;this.tabsMode.parentNode.removeChild(this.tabsMode);this.tabsMode=null;this._unloadTop();window.dhx4._eventable(this,"clear");for(var m in this){this[m]=null}g=null};this.enableContentZone=function(m){this.conf.contZone=(m==true)};this.setSkin=function(n){this._setBaseSkin(n);this.conf.skin=n;if(this.tabsTextTest!=null){this.tabsTextTest.className="dhxtabbar_tabs_text_test_"+this.conf.skin}for(var m in this.t){this.t[m].cell._resetSizeState();if(this.t[m].conf.autowidth==true){this.t[m].conf.width=this._getLabelWidth(this.t[m].conf.text,this.t[m].conf.close);if(this.t[m].conf.visible){this.t[m].tab.style.width=this.t[m].conf.width+"px"}}}this.conf.tabsAreaOfs=null;this._fixTabsOfs();this.setSizes()};this.setAlign=function(m){m=(m=="left"?"left":"right");if(m==this.conf.align){this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px";return}if(this.conf.transProp!==false){this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp]=""}this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="";this.conf.align=m;this.tabsArea.childNodes[1].childNodes[0].className="dhxtabbar_tabs_cont_"+this.conf.align+this.conf.tabsContCss;this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px";if(this.conf.transProp!==false){this.conf.transValuePos=this.conf.align+" "+this.conf.transSpeed;this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp]=this.conf.transValuePos}};this._initObj=function(r){this.conf.initSeq=true;this.clearAll();var m=false;if(r.settings!=null){if(r.settings.skin!=null){this.setSkin(r.settings.skin)}if(r.settings.closeButton!=null){this.enableTabCloseButton(window.dhx4.s2b(r.settings.closeButton))}if(r.settings.align!=null){this.setAlign(r.settings.align)}if(r.settings.hrefmode=="ajax"){m=true}if(r.settings.hrefmode=="ajax-html"){m=true;this.conf.url_demand=true}}if(r.tabs!=null){for(var o=0;o<r.tabs.length;o++){var n=r.tabs[o];if(typeof(n.id)=="undefined"){n.id=window.dhx4.newId()}if(!isNaN(parseInt(n.width))){n.width=parseInt(n.width)}else{n.width=null}this.addTab(n.id,n.text||n.label||"",n.width,n.index,window.dhx4.s2b(n.selected)||window.dhx4.s2b(n.active),n.close);if(n.content!=null){this.cells(n.id).attachHTMLString(n.content)}else{if(n.href!=null){if(this.conf.url_demand==true){this.conf.urls[n.id]={href:n.href,ajax:m}}else{this.cells(n.id).attachURL(n.href,m)}}}if(typeof(n.enabled)!="undefined"&&window.dhx4.s2b(n.enabled)==false){this.tabs(n.id).disable()}else{if(typeof(n.disabled)!="undefined"&&window.dhx4.s2b(n.disabled)==true){this.tabs(n.id).disable()}}}}this.conf.initSeq=false;if(this.conf.arwMode=="auto"){this.setSizes()}if(this.conf.url_demand==true){this._loadURLOnDemand(this.conf.lastActive)}};this._xmlToObj=function(u){var s={settings:{},tabs:[]};var m=u.getElementsByTagName("tabbar")[0];if(m!=null){for(var v in {skin:1,align:1,closeButton:1,hrefmode:1}){if(m.getAttribute(v)!=null){s.settings[v]=m.getAttribute(v)}}var y=m.getElementsByTagName("tab");for(var n=0;n<y.length;n++){var o={text:(y[n].firstChild.nodeValue||"")};for(var v in {id:1,width:1,close:1,selected:1,active:1,enabled:1,disabled:1,href:1}){if(y[n].getAttribute(v)!=null){o[v]=y[n].getAttribute(v)}}var A=y[n].getElementsByTagName("content")[0];if(A!=null){o.content="";for(var x=0;x<A.childNodes.length;x++){o.content+=(A.childNodes[x].nodeValue||"")}}s.tabs.push(o)}}return s};dhx4._enableDataLoading(this,"_initObj","_xmlToObj","tabbar",{struct:true});var a=window.dhx4.transDetect();this.conf.transProp=a.transProp;this.conf.transEv=a.transEv;this.conf.transValueWidth="width "+this.conf.transSpeed;a=null;if(this.conf.transProp!==false){this.conf.transValuePos=this.conf.align+" "+this.conf.transSpeed;this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp]=this.conf.transValuePos}this._callMainEvent=function(n,m){return this.callEvent(n,m)};window.dhx4._eventable(this);if(this.conf.autoload.json!=null){this.loadStruct(this.conf.autoload.json,this.conf.autoload.onload)}else{if(this.conf.autoload.xml!=null){this.loadStruct(this.conf.autoload.xml,this.conf.autoload.onload)}else{if(this.conf.autoload.tabs!=null){this.loadStruct({tabs:this.conf.autoload.tabs})}}}if(this.conf.autoload.arrows_mode!=null){this.setArrowsMode(this.conf.autoload.arrows_mode)}this._fixTabsOfs();this.setSizes();return this}dhtmlXTabBar.prototype=new dhtmlXCellTop();dhtmlXTabBar.prototype._fixTabsOfs=function(){this.conf.tabsOfs=(this.conf.skin=="dhx_web"?0:1)};dhtmlXTabBar.prototype.cells=dhtmlXTabBar.prototype.tabs=function(a){if(this.t[a]){return this.t[a].cell}return null};dhtmlXTabBar.prototype.getAllTabs=function(){var g=[];for(var c in this.t){g.push(c)}return g};dhtmlXTabBar.prototype._setTabActive=function(c,a){if(!this.t[c]||!this.t[c].conf.visible||this.t[c].conf.active){return}if(typeof(a)=="undefined"){a=true}if(a==true&&this.callEvent("onSelect",[c,this.conf.lastActive])!==true){return}this.setTabInActive();this.t[c].conf.active=true;if(this.conf.contZone){this.t[c].cell.cell.style.visibility="visible";this.t[c].cell.cell.style.top="0px";this.t[c].cell.cell.style.zIndex=1}this.t[c].tab.className=this._tabCss(c);this.conf.lastActive=c;this.setSizes();if(this.conf.url_demand==true){this._loadURLOnDemand(c)}};dhtmlXTabBar.prototype.setTabInActive=function(){if(this.conf.lastActive&&this.t[this.conf.lastActive]){this.t[this.conf.lastActive].conf.active=false;if(this.conf.contZone){this.t[this.conf.lastActive].cell.cell.style.visibility="hidden";this.t[this.conf.lastActive].cell.cell.style.top="-5000px";this.t[this.conf.lastActive].cell.cell.style.zIndex=0}this.t[this.conf.lastActive].tab.className=this._tabCss(this.conf.lastActive);this.conf.lastActive=null}};dhtmlXTabBar.prototype._isTabActive=function(a){return(a==this.conf.lastActive&&this.conf.lastActive!=null)};dhtmlXTabBar.prototype.getActiveTab=function(){return this.conf.lastActive};dhtmlXTabBar.prototype.goToNextTab=function(){var a=this._getNextVisible(this.conf.lastActive,true);if(a!=null){this._setTabActive(a)}};dhtmlXTabBar.prototype.goToPrevTab=function(){var a=this._getPrevVisible(this.conf.lastActive,true);if(a!=null){this._setTabActive(a)}};dhtmlXTabBar.prototype._enableTab=function(c,a){if(!this.t[c]||this.t[c].conf.enabled){return}this.t[c].conf.enabled=true;this.t[c].tab.className=this._tabCss(c);if(a==true){this._setTabActive(c)}};dhtmlXTabBar.prototype._disableTab=function(c,a){if(!this.t[c]||!this.t[c].conf.enabled){return}this.t[c].conf.enabled=false;this.t[c].tab.className=this._tabCss(c);if(a!==false&&this.conf.lastActive==c){if(a==true){a=this._getNextVisible(c)||this._getPrevVisible(c)}this._setTabActive(a)}};dhtmlXTabBar.prototype._isTabEnabled=function(a){return(this.t[a]!=null&&this.t[a].conf.enabled==true)};dhtmlXTabBar.prototype._setTabText=function(j,g,c){if(!this.t[j]){return}var a=false;if(typeof(c)=="undefined"||c==null){c=this._getLabelWidth(g,this.t[j].conf.close);a=true}this.t[j].tab.style.width=c+"px";this.t[j].tab.childNodes[0].innerHTML=g;this.t[j].conf.text=g;this.t[j].conf.width=c;this.t[j].conf.autowidth=a};dhtmlXTabBar.prototype._getTabText=function(a){if(!this.t[a]){return null}return this.t[a].conf.text};dhtmlXTabBar.prototype._removeTab=function(o,g,m){if(!this.t[o]){return}if(m!=true&&this.t[o].conf.remove!=true){this.t[o].conf.remove=true;this._hideTab(o,g);return}if(typeof(g)=="undefined"){g=true}var j=this._getNextVisible(o);var l=this._getPrevVisible(o);if(this.t[o].conf.transEv==true){this.t[o].tab.removeEventListener(this.conf.transEv,this._doOnTrEnd);this.t[o].conf.transEv=false}for(var c in this.t[o].conf){this.t[o].conf[c]=null}this.t[o].conf=null;delete this.t[o].conf;this.t[o].cell._unload();this.t[o].cell=null;this.t[o].tab.parentNode.removeChild(this.t[o].tab);this.t[o].tab=null;this.t[o]=null;delete this.t[o];if(this.conf.lastActive==o&&g!=false){this.conf.lastActive=null;var n=(g==true?(j||l||this._getFirstVisible()):g);if(n!=null){this._setTabActive(n)}}else{if(m!=true){this._adjustTabs()}}};dhtmlXTabBar.prototype.clearAll=function(){for(var c in this.t){this._removeTab(c,false,true)}this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px"};dhtmlXTabBar.prototype.moveTab=function(g,a){if(!this.t[g]||a<0){return}a+=1;var c=this.tabsArea.childNodes[1].firstChild;if(c.childNodes[a]!=this.t[g].tab){c.removeChild(this.t[g].tab);if(a>=c.childNodes.length){c.appendChild(this.t[g].tab)}else{c.insertBefore(this.t[g].tab,c.childNodes[a])}}c=null};dhtmlXTabBar.prototype._getIndex=function(j){var a=-1;var g=this.tabsArea.childNodes[1].firstChild;for(var c=1;c<g.childNodes.length;c++){if(g.childNodes[c]._tabId==j){a=c-1}}g=null;return a};dhtmlXTabBar.prototype.getNumberOfTabs=function(j){var g=0;for(var c in this.t){g+=(j!=true?1:(this.t[c].conf.visible==true?1:0))}return g};dhtmlXTabBar.prototype.forEachCell=dhtmlXTabBar.prototype.forEachTab=function(g){for(var c in this.t){g.apply(window,[this.t[c].cell])}};dhtmlXTabBar.prototype.enableAutoReSize=function(){this._initFSResize()};dhtmlXTabBar.prototype.setArrowsMode=function(a){a={auto:"auto",always:"always"}[String(a)];if(a==null||a==this.conf.mode){return}this.conf.arwMode=a;if(a=="always"){this.tabsArea.childNodes[0].className="dhxtabbar_tabs_ar_left";this.tabsArea.childNodes[2].className="dhxtabbar_tabs_ar_right"}this.setSizes()};dhtmlXTabBar.prototype._checkArrows=function(){var l=false;if(this.conf.arwMode=="auto"){var j=0;for(var g in this.t){j+=this.t[g].tab.offsetWidth}var c=this.tabsArea.childNodes[0];var m=this.tabsArea.childNodes[2];if(j>this.cont.offsetWidth){if(c.className.search(/dhxtabbar_tabs_ar_hidden/)>=0){c.className=c.className.replace(/\s{0,}dhxtabbar_tabs_ar_hidden/,"");m.className=m.className.replace(/\s{0,}dhxtabbar_tabs_ar_hidden/,"");l=true}}else{if(c.className.search(/dhxtabbar_tabs_ar_hidden/)<1){c.className+=" dhxtabbar_tabs_ar_hidden";m.className+=" dhxtabbar_tabs_ar_hidden";l=true}}c=m=null}return l};dhtmlXTabBar.prototype._loadURLOnDemand=function(a){if(a!=null&&this.conf.urls[a]!=null){this.cells(a).attachURL(this.conf.urls[a].href,this.conf.urls[a].ajax);this.conf.urls[a]=null}};window.dhtmlXTabBarCell=function(j,g){dhtmlXCellObject.apply(this,[j,"_tabbar"]);this.tabbar=g;this.conf.skin=this.tabbar.conf.skin;this.conf.tabbar_funcs={show:"_showTab",hide:"_hideTab",isVisible:"_isTabVisible",enable:"_enableTab",disable:"_disableTab",isEnabled:"_isTabEnabled",getIndex:"_getIndex",getText:"_getTabText",setText:"_setTabText",setActive:"_setTabActive",isActive:"_isTabActive",close:"_removeTab"};this._tabbarCall=function(a){return function(){var l=[this._idd];for(var m=0;m<arguments.length;m++){l.push(arguments[m])}return this.tabbar[a].apply(this.tabbar,l)}};for(var c in this.conf.tabbar_funcs){this[c]=this._tabbarCall(this.conf.tabbar_funcs[c])}this.attachEvent("_onCellUnload",function(){this.tabbar=null;for(var l in this.conf.tabbar_funcs){this[l]=null;this.conf.tabbar_funcs[l]=null}this.conf.tabbar_funcs=null});this.attachEvent("_onContentLoaded",function(){this.tabbar._callMainEvent("onContentLoaded",arguments);this.tabbar._callMainEvent("onTabContentLoaded",arguments)});this.attachEvent("_onContentAttach",function(){this.tabbar._adjustCell(this.tabbar.conf.lastActive)});this.attachEvent("_onBeforeContentAttach",function(a){if(a=="sidebar"){this._hideBorders()}})};window.dhtmlXTabBarCell.prototype=new dhtmlXCellObject();dhtmlXCellObject.prototype.attachTabbar=function(a){this.callEvent("_onBeforeContentAttach",["tabbar"]);if(typeof(a)=="string"){a={mode:a}}else{if(typeof(a)!="object"||a==null){a={}}}var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";if(typeof(window.dhtmlXAccordionCell)!="undefined"&&(this instanceof window.dhtmlXAccordionCell)){c._ofs={t:-1}}if(typeof(window.dhtmlXSideBarCell)!="undefined"&&(this instanceof window.dhtmlXSideBarCell)){c._ofs={l:-1}}this._attachObject(c);a.skin=this.conf.skin;a.parent=c;this.dataType="tabbar";this.dataObj=new dhtmlXTabBar(a);a.parent=c=null;a=null;this.callEvent("_onContentAttach",[]);return this.dataObj};function dhtmlXTabBarInitFromHTML(){var z=document.getElementsByTagName("div");for(var i=0;i<z.length;i++){if(z[i].className.indexOf("dhtmlxTabBar")!=-1){var conf={settings:{},tabs:[]};var n=z[i];var id=n.id;n.className="";var k=new Array();for(var j=0;j<n.childNodes.length;j++){if(n.childNodes[j].tagName&&n.childNodes[j].tagName!="!"){k[k.length]=n.childNodes[j]}}var skin=n.getAttribute("skin");if(skin!=null){conf.settings.skin=skin}var w=new dhtmlXTabBar({parent:id,mode:n.getAttribute("mode")});window[id]=w;acs=n.getAttribute("onbeforeinit");if(acs){eval(acs)}align=n.getAttribute("align");if(align){conf.settings.align=align}var cont={};for(var j=0;j<k.length;j++){var m=k[j];var tab={id:m.id,text:m.getAttribute("name"),width:m.getAttribute("width"),selected:m.getAttribute("selected"),active:m.getAttribute("active"),close:m.getAttribute("close")};var href=m.getAttribute("href");if(href){cont[m.id]={href:href}}else{cont[m.id]={cont:m}}conf.tabs.push(tab)}w.loadStruct(conf);for(var a in cont){if(cont[a].href){w.cells(a).attachURL(cont[a].href);cont[a].href=null}else{w.cells(a).attachObject(cont[a].cont);if(cont[a].cont.style.display=="none"){cont[a].cont.style.display=""}cont[a].cont=null}cont[a]=null}var selId=n.getAttribute("select");if(selId!=null){w.tabs(selId).setActive()}else{if(w.getActiveTab()==null){var v=w._getFirstVisible();if(v!=null){w.cells(v).setActive()}}}acs=n.getAttribute("oninit");if(acs){eval(acs)}}}if(typeof(window.addEventListener)=="function"){window.removeEventListener("load",dhtmlXTabBarInitFromHTML,false)}else{window.detachEvent("onload",dhtmlXTabBarInitFromHTML)}}if(typeof(window.addEventListener)=="function"){window.addEventListener("load",dhtmlXTabBarInitFromHTML,false)}else{window.attachEvent("onload",dhtmlXTabBarInitFromHTML)}function dhtmlXSideBar(c){var g=this;this.conf={skin:(c.skin||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxsidebar")||"dhx_skyblue"),css:"dhxsidebar",width:c.width||200,scroll_size:12,scroll_mult:20,close_button:false,icons_path:c.icons_path||"",selected:null};this.setTemplate(c.template);window.dhtmlXCellTop.apply(this,[c.parent,(c==null?null:c.offsets)]);window.dhx4._eventable(this);if(window.navigator.msPointerEnabled==true){this.conf.touch_ms=true;this.conf.touch_start="MSPointerDown",this.conf.touch_end="MSPointerUp"}else{this.conf.touch_ms=false;this.conf.touch_start="touchstart",this.conf.touch_end="touchend"}this.side=document.createElement("DIV");this.side.className="dhxsidebar_side dhxsidebar_tpl_"+this.conf.tpl_name;this.side.innerHTML="<div class='dhxsidebar_side_items'></div>";this.cont.appendChild(this.side);window.setTimeout(function(){if(g!=null&&g.side!=null){g.side.firstChild.style.top="0px"}},1);this.arw=document.createElement("DIV");this.arw.className="dhxsidebar_arrows dhxsidebar_arrows_hidden";this.arw.innerHTML="<div class='dhxsidebar_arrow dhxsidebar_arrow_left'><div class='dhxsidebar_arrow_image'></div></div><div class='dhxsidebar_arrow dhxsidebar_arrow_right'><div class='dhxsidebar_arrow_image'></div></div>";this.cont.appendChild(this.arw);this._doOnArwClick=function(l){l=l||event;if(l.type!="click"&&l.preventDefault){l.preventDefault()}var j=l.target||l.srcElement;if(j.className.match(/dhxsidebar_arrow_image/)!=null){j=j.parentNode}if(j.className.match(/dhxsidebar_arrow_left/)!=null){g._scrollSide(-g.conf.scroll_size)}else{if(j.className.match(/dhxsidebar_arrow_right/)!=null){g._scrollSide(g.conf.scroll_size)}}j=null};if(typeof(window.addEventListener)=="function"){this.arw.addEventListener(this.conf.touch_start,this._doOnArwClick,false);this.arw.addEventListener("click",this._doOnArwClick,false)}else{this.arw.attachEvent("onclick",this._doOnArwClick)}this._doOnSideClick=function(l){l=l||event;var j=l.target||l.srcElement;var m=null;if(l.type=="touchstart"||l.type=="pointerdown"||l.type=="MSPointerDown"){if(l.preventDefault){l.preventDefault()}if(this.className.match(/dhxsidebar_touch/gi)==null){if(l.type=="touchstart"||(l.type=="pointerdown"&&l.pointerType=="touch")){this.className+=" dhxsidebar_touch"}}}while(j!=null&&m==null&&l.type!="pointerdown"&&l.type!="MSPointerDown"){if(typeof(j.className)!="undefined"&&j.className.match(/^dhxsidebar_item/)!=null&&typeof(j._idd)!="undefined"){m=j._idd}else{j=j.parentNode}}if(m!=null){g._setItemActive(m,true)}j=null};if(typeof(window.addEventListener)=="function"){this.side.addEventListener(this.conf.touch_start,this._doOnSideClick,false);this.side.addEventListener(this.conf.touch_end,this._doOnSideClick,false);this.side.addEventListener("mouseup",this._doOnSideClick,false)}else{this.side.attachEvent("onclick",this._doOnSideClick)}this.side.onmouseover=function(){this.className=this.className.replace(/\s*dhxsidebar_touch/gi,"")};this._doOnSideScroll=function(j){j=j||event;var l=(j.type=="mousewheel"?-j.wheelDelta:j.deltaY);g._scrollSide(l/Math.abs(l)*3)};this._scrollSide=function(j){var l=parseInt(this.side.firstChild.style.top||0)-j*this.conf.scroll_mult;if(l+this.side.firstChild.offsetHeight<this.side.clientHeight){l=this.side.clientHeight-this.side.firstChild.offsetHeight}if(l>0){l=0}this.side.firstChild.style.top=l+"px"};if(typeof(window.addEventListener)=="function"){this.side.addEventListener("wheel",this._doOnSideScroll,false)}else{this.side.attachEvent("onmousewheel",this._doOnSideScroll)}this.t={};this.s={};this._adjustCell=function(o){if(o==null){return}var j=this.conf.width;var l=this.cont.offsetWidth-j;var n=0;var m=this.cont.offsetHeight;if(o!=this.conf.selected){n=-5000;this.t[o].cell.cell.style.visibility="hidden";this.t[o].cell.cell.style.zIndex=0}this.t[o].cell._setSize(j,n,l,m)};var a=window.dhx4.transDetect();this.conf.transProp=a.transProp;this.conf.transEv=a.transEv;this.conf.transValue="all 0.1s";this._doOnTrEnd=function(l){var n=this._idd;if(g.t[n]==null){return}var j=g.t[n];var m=j.conf.transActvId;if(j.conf.transMode=="hide"){if(j.conf.remove==true){g._removeItem(n)}else{j.item.style[j.conf.transProp]="";j.cell.cell.style.visibility="hidden";j.cell.cell.style.top="-5000px";j.conf.transActv=false}}else{if(j.conf.transMode=="show"){j.item.style[j.conf.transProp]="";j.item.style.visibility="visible";j.conf.transMode=null;j.conf.transActv=false}}if(m!=null){g._setItemActive(m)}else{g._checkHeight()}j=null};this._initObj=function(j){this.clearAll();if(j.items!=null){this.addItem(j.items)}};this._xmlToObj=function(u){var l=[];var o=u.getElementsByTagName("sidebar");if(o!=null&&o[0]!=null){var m=o[0].getElementsByTagName("item");for(var s=0;s<m.length;s++){var n={};for(var j=0;j<m[s].attributes.length;j++){n[m[s].attributes[j].nodeName]=m[s].attributes[j].nodeValue}l.push(n)}}return{items:l}};dhx4._enableDataLoading(this,"_initObj","_xmlToObj","sidebar",{struct:true});this.unload=function(){this.conf.unloading=true;if(typeof(window.addEventListener)=="function"){this.side.removeEventListener("wheel",this._doOnSideScroll,false)}else{this.side.detachEvent("onmousewheel",this._doOnSideScroll)}this.clearAll();this.s=this.t=null;if(typeof(window.addEventListener)=="function"){this.arw.removeEventListener(this.conf.touch_start,this._doOnArwClick,false);this.arw.removeEventListener("click",this._doOnArwClick,false)}else{this.arw.detachEvent("onclick",this._doOnArwClick)}this.arw.parentNode.removeChild(this.arw);this.arw=null;if(typeof(window.addEventListener)=="function"){this.side.removeEventListener(this.conf.touch_start,this._doOnSideClick,false);this.side.removeEventListener(this.conf.touch_end,this._doOnSideClick,false);this.side.removeEventListener("click",this._doOnSideClick,false)}else{this.side.detachEvent("onclick",this._doOnSideClick)}this.side.onmouseover=null;this.side.parentNode.removeChild(this.side);this.side=null;this._unloadTop();window.dhx4._eventable(this,"clear");window.dhx4._enableDataLoading(this,null,null,null,"clear");g=null};this.setSizes();if(c.items!=null){this._initObj(c)}else{if(c.json!=null){this.loadStruct(c.json,c.onload)}else{if(c.xml!=null){this.loadStruct(c.xml,c.onload)}}}return this}dhtmlXSideBar.prototype=new dhtmlXCellTop();dhtmlXSideBar.prototype._addItem=function(c){var j=(typeof(c.id)!="undefined"?c.id:window.dhx4.newId());if(c.type=="separator"){var g=document.createElement("DIV");g.className="dhxsidebar_sep";this.side.firstChild.appendChild(g);this.s[j]={sep:g};g=null;return}c.icons_path=this.conf.icons_path;var g=document.createElement("DIV");g.className="dhxsidebar_item";g.innerHTML=window.dhx4.template(this.conf.tpl_str,c);g._idd=j;this.side.firstChild.appendChild(g);g.ondragstart=function(){return false};var a=new dhtmlXSideBarCell(j,this);this.cont.appendChild(a.cell);this.t[j]={item:g,cell:a,init:c,conf:{selected:false,visible:true,close:close}};g=null;if(window.dhx4.s2b(c.selected)==true){this._setItemActive(j)}else{this._adjustCell(j)}this._checkHeight()};dhtmlXSideBar.prototype.addItem=function(a){if(!(a instanceof Array)){a=[a]}for(var c=0;c<a.length;c++){this._addItem(a[c])}};dhtmlXSideBar.prototype.items=dhtmlXSideBar.prototype.cells=function(a){if(this.t[a]!=null){return this.t[a].cell}return null};dhtmlXSideBar.prototype.forEachCell=dhtmlXSideBar.prototype.forEachItem=function(g){for(var c in this.t){if(typeof(g)=="function"){g.apply(window,[this.t[c].cell])}else{if(typeof(g)=="string"&&typeof(window[g])=="function"){window[g].apply(window,[this.t[c].cell])}}}};dhtmlXSideBar.prototype.getAllItems=function(){var g=[];for(var c in this.t){g.push(c)}return g};dhtmlXSideBar.prototype.getNumberOfItems=function(){return this.getAllItems().length};dhtmlXSideBar.prototype.clearAll=function(){for(var c in this.t){this._removeItem(c,false,true)}for(var c in this.s){this.removeSep(c)}};dhtmlXSideBar.prototype.setSizes=function(){this._adjustCont();this._adjustSide();this._checkHeight();this._adjustCell(this.conf.selected);this.callEvent("_onSetSizes",[])};dhtmlXSideBar.prototype.setSideWidth=function(a){this.conf.width=a;this.setSizes()};dhtmlXSideBar.prototype._adjustSide=function(){if(this.conf.side_ofs==null){this.conf.side_ofs={};this.side.style.width=this.conf.width+"px";this.side.style.height=this.cont.offsetHeight+"px";this.conf.side_ofs.w=this.side.offsetWidth-parseInt(this.side.style.width);this.conf.side_ofs.h=this.side.offsetHeight-parseInt(this.side.style.height)}this.side.style.width=this.conf.width-this.conf.side_ofs.w+"px";this.side.style.height=this.cont.offsetHeight-this.arw.offsetHeight-this.conf.side_ofs.h+"px";this.arw.style.width=this.side.style.width;this._scrollSide(0)};dhtmlXSideBar.prototype._checkHeight=function(){var a=(this.arw.className.match(/dhxsidebar_arrows_hidden/)!=null);if(this.conf.side_hfix==null){this.conf.side_hfix=this.side.offsetHeight-this.side.clientHeight}if(this.side.firstChild.offsetHeight>this.cont.clientHeight-this.conf.side_hfix){if(a==true){this.arw.className="dhxsidebar_arrows";this._adjustSide()}}else{if(a==false){this.arw.className="dhxsidebar_arrows dhxsidebar_arrows_hidden";this.side.firstChild.style.top="0px";this._adjustSide()}}};dhtmlXSideBar.prototype.removeSep=function(c){if(this.s[c]==null){return}this.side.firstChild.removeChild(this.s[c].sep);this.s[c].sep=null;this.s[c]=null;try{delete this.s[c]}catch(a){}};dhtmlXSideBar.prototype._setItemActive=function(g,c){if(this.conf.selected==g){return}if(typeof(c)=="undefined"){c=false}if(c==true&&this.callEvent("onBeforeSelect",[g,this.conf.selected])!==true){return}var a=null;if(this.conf.selected!=null){a=this.conf.selected;this._setItemInactive(this.conf.selected)}if(this.t[g]!=null){this.conf.selected=g;this.t[g].selected=true;this.t[g].item.className+=" dhxsidebar_item_selected";this.t[g].cell.cell.style.visibility="visible";this.t[g].cell.cell.style.top="0px";this.t[g].cell.cell.style.zIndex=1}else{this.conf.selected=null}this._adjustCell(g);if(c==true){this.callEvent("onSelect",[g,a])}};dhtmlXSideBar.prototype._setItemInactive=function(a){if(this.t[a]==null){return}this.t[a].selected=false;this.t[a].item.className=this.t[a].item.className.replace(/\s{0,}dhxsidebar_item_selected/gi,"");this.t[a].cell.cell.style.visibility="hidden";this.t[a].cell.cell.style.top="-5000px";this.t[a].cell.cell.style.zIndex=0};dhtmlXSideBar.prototype._isItemActive=function(a){return(this.conf.selected==a)};dhtmlXSideBar.prototype._getNextVisible=function(c,a){return this._getNearVisible(c,a,"next")};dhtmlXSideBar.prototype._getPrevVisible=function(c,a){return this._getNearVisible(c,a,"previous")};dhtmlXSideBar.prototype._getFirstVisible=function(){return this._getNearVisible(null,false,"first")};dhtmlXSideBar.prototype._getNearVisible=function(m,c,l){if(l=="first"){var g=this.side.firstChild.firstChild;l="next"}else{if(m==null||this.t[m]==null){return(c?this._getFirstVisible():null)}var g=this.t[m].item[l+"Sibling"]}var j=null;while(g!=null&&j==null){var a=g._idd;if(a!=null&&j==null&&this.t[a].conf.visible){j=a}else{g=g[l+"Sibling"]}}g=null;return j};dhtmlXSideBar.prototype.goToNextItem=function(a){var c=this._getNextVisible(this.conf.selected,true);if(c!=null){this._setItemActive(c,a)}};dhtmlXSideBar.prototype.goToPrevItem=function(a){var c=this._getPrevVisible(this.conf.selected,true);if(c!=null){this._setItemActive(c,a)}};dhtmlXSideBar.prototype.getActiveItem=function(){return this.conf.selected};dhtmlXSideBar.prototype.setTemplate=function(j,c){this.conf.tpl_name=(j!=null&&this.templates[j]!=null?j:"details");this.conf.tpl_str=this.templates[this.conf.tpl_name];if(c!=null){this.conf.icons_path=c}for(var g in this.t){this.t[g].init.icons_path=this.conf.icons_path;this.t[g].item.innerHTML=window.dhx4.template(this.conf.tpl_str,this.t[g].init)}if(this.side!=null){this.side.className="dhxsidebar_side dhxsidebar_tpl_"+this.conf.tpl_name}if(this._scrollSide!=null){this._scrollSide(0);this._checkHeight()}};dhtmlXSideBar.prototype.templates={details:"<img class='dhxsidebar_item_icon' src='#icons_path##icon#' border='0'><div class='dhxsidebar_item_text'>#text#</div>",tiles:"<img class='dhxsidebar_item_icon' src='#icons_path##icon#' border='0'><div class='dhxsidebar_item_text'>#text#</div>",icons:"<img class='dhxsidebar_item_icon' src='#icons_path##icon#' border='0'>",icons_text:"<div class='dhxsidebar_item_icon'><img class='dhxsidebar_item_icon' src='#icons_path##icon#' border='0'></div><div class='dhxsidebar_item_text'>#text#</div>",text:"<div class='dhxsidebar_item_text'>#text#</div>"};window.dhtmlXSideBarCell=function(j,g){dhtmlXCellObject.apply(this,[j,"_sidebar"]);this.sidebar=g;this.conf.skin=this.sidebar.conf.skin;this.conf.sidebar_funcs={show:"_showItem",hide:"_hideItem",isVisible:"_isItemVisible",setActive:"_setItemActive",isActive:"_isItemActive",setText:"_setItemText",getText:"_getItemText",remove:"_removeItem"};this._sidebarCall=function(a){return function(){var l=[this._idd];for(var m=0;m<arguments.length;m++){l.push(arguments[m])}return this.sidebar[a].apply(this.sidebar,l)}};for(var c in this.conf.sidebar_funcs){this[c]=this._sidebarCall(this.conf.sidebar_funcs[c])}this.attachEvent("_onCellUnload",function(){this.sidebar=null;for(var l in this.conf.sidebar_funcs){this[l]=this.conf.sidebar_funcs[l]=null}this.conf.sidebar_funcs=null});this.attachEvent("_onContentLoaded",function(){this.sidebar.callEvent("onContentLoaded",arguments)});this.attachEvent("_onBeforeContentAttach",function(a){if(a=="tabbar"||a=="layout"||a=="acc"||a=="sidebar"){this._hideBorders()}if((this.conf.skin=="dhx_web"||this.conf.skin=="dhx_terrace")&&(a=="menu"||a=="toolbar"||a=="ribbon")){if(this.cell.className.match(/dhx_cell_cont_no_top/gi)==null){this.cell.className+=" dhx_cell_cont_no_top"}}})};dhtmlXSideBarCell.prototype=new dhtmlXCellObject();dhtmlXSideBar.prototype._setItemText=function(j,g){if(this.t[j]!=null){for(var c in g){this.t[j].init[c]=g[c]}this.t[j].init.icons_path=this.conf.icons_path;this.t[j].item.innerHTML=window.dhx4.template(this.conf.tpl_str,this.t[j].init)}};dhtmlXSideBar.prototype._getItemText=function(j){var g={};if(this.t[j]!=null){for(var c in this.t[j].init){g[c]=this.t[j].init[c]}}return g};dhtmlXSideBar.prototype._removeItem=function(o,n,l){if(this.t[o]==null){return}if(l!=true&&this.t[o].conf.remove!=true){this.t[o].conf.remove=true;this._hideItem(o,n);return}if(typeof(n)=="undefined"){n=true}var g=this._getNextVisible(o);var j=this._getPrevVisible(o);if(this.t[o].conf.transEv==true){this.t[o].item.removeEventListener(this.conf.transEv,this._doOnTrEnd);this.t[o].conf.transEv=false}this.t[o].cell._unload();this.t[o].cell=null;this.t[o].item.parentNode.removeChild(this.t[o].item);this.t[o].item=null;for(var c in this.t[o]){this.t[o][c]=null}this.t[o]=null;try{delete this.t[o]}catch(m){}if(this.conf.selected==o&&n!=false){this.conf.selected=null;var n=(n==true?(g||j||this._getFirstVisible()):n);if(n!=null){this._setItemActive(n)}}else{if(l!=true){this._checkHeight()}}};dhtmlXSideBar.prototype._showItem=function(c,a){if(this.t[c]==null||this.t[c].conf.visible==true||this.t[c].conf.transActv==true){return}if(this.conf.transProp!==false){this.t[c].conf.transActv=true;this.t[c].conf.transMode="show";this.t[c].conf.transProp=this.conf.transProp;this.t[c].conf.transActvId=(a?c:null);if(this.t[c].conf.transEv!=true){this.t[c].item.addEventListener(this.conf.transEv,this._doOnTrEnd);this.t[c].conf.transEv=true}this.t[c].conf.visible=true;this.t[c].item.style[this.conf.transProp]=this.conf.transValue;this.t[c].item.className="dhxsidebar_item"}else{this.t[c].conf.visible=true;this.t[c].item.style.display="";if(a==true){this._setItemActive(c)}else{this._checkHeight()}}};dhtmlXSideBar.prototype._hideItem=function(l,j){if(this.t[l]==null||this.t[l].conf.visible!=true||this.t[l].conf.transActv==true){return}var g=false;if(this.conf.selected==l){this.conf.selected=null;this.t[l].conf.active=false;this.t[l].item.className="dhxsidebar_item";g=true}var c=this._getPrevVisible(l);var a=this._getNextVisible(l);var j=(g&&j!==false?(j==true?null:j)||a||c:null);if(this.conf.transProp!==false){this.t[l].conf.transActv=true;this.t[l].conf.transMode="hide";this.t[l].conf.transProp=this.conf.transProp;this.t[l].conf.transActvId=j;this.t[l].conf.visible=false;if(this.t[l].conf.transEv!=true){this.t[l].item.addEventListener(this.conf.transEv,this._doOnTrEnd);this.t[l].conf.transEv=true}this.t[l].item.style[this.conf.transProp]=this.conf.transValue;this.t[l].item.className="dhxsidebar_item dhxsidebar_item_hidden"}else{this.t[l].item.style.display="none";this.t[l].conf.visible=false;this.t[l].cell.cell.style.visibility="hidden";this.t[l].cell.cell.style.top="-5000px";if(j!=null){this._setItemActive(j)}this._checkHeight();if(this.t[l].conf.remove==true){this._removeItem(l)}}};dhtmlXSideBar.prototype._isItemVisible=function(a){return(this.t[a].conf.visible==true)};dhtmlXCellObject.prototype.attachSidebar=function(a){this.callEvent("_onBeforeContentAttach",["sidebar"]);if(a==null){a={}}var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";if(typeof(window.dhtmlXWindowsCell)!="undefined"&&(this instanceof window.dhtmlXWindowsCell)){}else{if(this.conf.skin=="dhx_skyblue"){c._ofs={t:-1,r:-1,b:-1,l:-1}}if(this.conf.skin=="dhx_web"){if(typeof(window.dhtmlXSideBarCell)!="undefined"&&(this instanceof window.dhtmlXSideBarCell)){c._ofs={l:8}}if(typeof(window.dhtmlXLayoutCell)!="undefined"&&(this instanceof window.dhtmlXLayoutCell)){c._ofs={t:2}}if(typeof(window.dhtmlXTabBarCell)!="undefined"&&(this instanceof window.dhtmlXTabBarCell)){c._ofs={t:8}}if(typeof(window.dhtmlXAccordionCell)!="undefined"&&(this instanceof window.dhtmlXAccordionCell)){c._ofs={t:2}}}if(this.conf.skin=="dhx_terrace"){if(typeof(window.dhtmlXSideBarCell)!="undefined"&&(this instanceof window.dhtmlXSideBarCell)){c._ofs={l:-1}}if(typeof(window.dhtmlXLayoutCell)!="undefined"&&(this instanceof window.dhtmlXLayoutCell)){c._ofs={t:-1}}if(typeof(window.dhtmlXTabBarCell)!="undefined"&&(this instanceof window.dhtmlXTabBarCell)){c._ofs={t:-1}}if(typeof(window.dhtmlXAccordionCell)!="undefined"&&(this instanceof window.dhtmlXAccordionCell)){c._ofs={t:-1,r:-1,b:-1,l:-1}}}}this._attachObject(c);a.skin=this.conf.skin;a.parent=c;this.dataType="sidebar";this.dataObj=new dhtmlXSideBar(a);a.parent=c=null;a=null;this.callEvent("_onContentAttach",[]);return this.dataObj};function dhtmlXWindows(o){var m=this;var j={};if(typeof(o)!="undefined"){for(var g in o){j[g]=o[g]}}o=null;this.conf={skin:window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxwins")||"dhx_skyblue",vp_pos_ofs:20,vp_custom:false,ofs_w:null,ofs_h:null,button_last:null,dblclick_tm:300,dblclick_last:null,dblclick_id:null,dblclick_mode:"minmax",dblclick_active:false,dblclick_ev:(navigator.userAgent.indexOf("MSIE 6.0")>=0||navigator.userAgent.indexOf("MSIE 7.0")>=0||navigator.userAgent.indexOf("MSIE 8.0")>=0),fr_cover:(navigator.userAgent.indexOf("MSIE 6.0")>=0)};var c=window.dhx4.transDetect();this.conf.tr={prop:c.transProp,ev:c.transEv,height_open:"height 0.2s cubic-bezier(0.25,0.1,0.25,1)",height_close:"height 0.18s cubic-bezier(0.25,0.1,0.25,1)",op_open:"opacity 0.16s ease-in",op_close:"opacity 0.2s ease-out",op_v_open:"1",op_v_close:"0.4"};if(!j.viewport){this.attachViewportTo(document.body)}else{if(j.viewport.object!=null){this.attachViewportTo(j.viewport.object)}else{if(j.viewport.left!=null&&j.viewport.top!=null&&j.viewport.width!=null&&j.viewport.height!=null){this.setViewport(j.viewport.left,j.viewport.top,j.viewport.width,j.viewport.height,j.viewport.parent)}else{this.attachViewportTo(document.body)}}}this.w={};this.createWindow=function(s,H,E,u,J){var q={};if(arguments.length==1&&typeof(s)=="object"){q=s}else{q.id=s;q.left=H;q.top=E;q.width=u;q.height=J;if(typeof(q.id)=="undefined"||q.id==null){q.id=window.dhx4.newId()}while(this.w[q.id]!=null){q.id=window.dhx4.newId()}}if(q.left==null){q.left=0}if(q.top==null){q.top=0}q.move=(q.move!=null&&window.dhx4.s2b(q.move)==false?false:(q.deny_move!=null&&window.dhx4.s2b(q.deny_move)==true?false:true));q.park=(q.park!=null&&window.dhx4.s2b(q.park)==false?false:(q.deny_park!=null&&window.dhx4.s2b(q.deny_park)==true?false:true));q.resize=(q.resize!=null&&window.dhx4.s2b(q.resize)==false?false:(q.deny_resize!=null&&window.dhx4.s2b(q.deny_resize)==true?false:true));q.keep_in_viewport=(q.keep_in_viewport!=null&&window.dhx4.s2b(q.keep_in_viewport));q.modal=(q.modal!=null&&window.dhx4.s2b(q.modal));q.center=(q.center!=null&&window.dhx4.s2b(q.center));q.text=(q.text!=null?q.text:(q.caption!=null?q.caption:"dhtmlxWindow"));q.header=(!(q.header!=null&&window.dhx4.s2b(q.header)==false));var K=document.createElement("DIV");K.className="dhxwin_active";this.vp.appendChild(K);K._isWindow=true;K._idd=q.id;var A=document.createElement("DIV");A.className="dhxwin_hdr";A.style.zIndex=0;A.innerHTML="<div class='dhxwin_icon'></div><div class='dhxwin_text'><div class='dhxwin_text_inside'>"+q.text+"</div></div><div class='dhxwin_btns'></div>";K.appendChild(A);A.onselectstart=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};A.oncontextmenu=function(a){a=a||event;a.cancelBubble=true;return false};A._isWinHdr=true;A.firstChild._isWinIcon=true;var v=document.createElement("DIV");v.className="dhxwin_brd";K.appendChild(v);var D=document.createElement("DIV");D.className="dhxwin_fr_cover";D.innerHTML="<iframe class='dhxwin_fr_cover_inner' frameborder='0' border='0'></iframe><div class='dhxwin_fr_cover_inner'></div>";K.appendChild(D);this.w[q.id]={win:K,hdr:A,brd:v,fr_cover:D,b:{},conf:{z_id:window.dhx4.newId(),actv:false,modal:false,maxed:false,parked:false,sticked:false,visible:true,header:true,text:q.text,keep_in_vp:q.keep_in_viewport,allow_move:q.move,allow_park:q.park,allow_resize:q.resize,max_w:null,max_h:null,min_w:80,min_h:80}};var w={help:{title:"Help",visible:false},stick:{title:"Stick",visible:false},park:{title:"Park",visible:true},minmax:{title:"Min/Max",visible:true},close:{title:"Close",visible:true}};for(var F in w){var C=new dhtmlXWindowsButton(this,q.id,F,w[F].title,false);if(w[F].visible==false){C.hide()}A.lastChild.appendChild(C.button);this.w[q.id].b[F]=C;C=null}this._winAdjustTitle(q.id);this.w[q.id].win.style.zIndex=window.dhx4.zim.reserve(this.w[q.id].conf.z_id);var I=new dhtmlXWindowsCell(q.id,this);this.w[q.id].win.insertBefore(I.cell,D);this.w[q.id].cell=I;if(typeof(window.addEventListener)=="function"){this.w[q.id].win.addEventListener("mousedown",this._winOnMouseDown,false);this.w[q.id].win.addEventListener("mouseup",this._winOnMouseDown,false);if(this.conf.dblclick_ev){this.w[q.id].win.addEventListener("dblclick",this._winOnMouseDown,false)}if(this.conf.dnd_evs!=null){this.w[q.id].win.addEventListener(this.conf.dnd_evs.start,this._winOnMouseDown,false);if(window.navigator.msPointerEnabled!=true){this.w[q.id].win.addEventListener(this.conf.dnd_evs.start,this._winOnMouseDown,false);this.w[q.id].win.addEventListener(this.conf.dnd_evs.end,this._winOnMouseDown,false)}}}else{this.w[q.id].win.attachEvent("onmousedown",this._winOnMouseDown);this.w[q.id].win.attachEvent("onmouseup",this._winOnMouseDown);if(this.conf.dblclick_ev){this.w[q.id].win.attachEvent("ondblclick",this._winOnMouseDown)}}this._winInitFRM(q.id);this._winSetPosition(q.id,q.left,q.top);this._winSetSize(q.id,q.width,q.height);this._winMakeActive(q.id);if(q.center==true){this.w[q.id].cell.center()}if(q.modal==true){this.w[q.id].cell.setModal(true)}if(q.header==false){this.w[q.id].cell.hideHeader()}f=K=A=v=D=I=null;return this.w[q.id].cell};this._winOnMouseDown=function(r){r=r||event;var a=r.target||r.srcElement;var q={press_type:r.type};if(r.type=="MSPointerDown"){m.conf.ev_skip=true}else{if(m.conf.ev_skip==true){m.conf.ev_skip=false;a=null;return}}while(a!=null&&a._isWindow!=true){if(typeof(a.className)!="undefined"&&q.mode==null){if(typeof(a._buttonName)!="undefined"){q.mode="button";q.button_name=a._buttonName}else{if(a._isWinHdr==true){q.mode="hdr"}else{if(a._isWinIcon==true){q.mode="icon"}}}}a=a.parentNode}if(q.mode==null){q.mode="win"}q.id=(a!=null&&a._isWindow==true?a._idd:null);a=null;if(q.id!=null){m.callEvent("_winMouseDown",[r,q])}};this._winOnParkTrans=function(q){if(q.stopPropagation){q.stopPropagation()}var a=m.w[this._idd];if(q.propertyName=="opacity"){m._winCellClearOpacity(this._idd)}if(q.propertyName=="height"&&a.conf.tr_mode=="park"){if(a.conf.tr_mode=="park"){a.win.style[m.conf.tr.prop]="";if(!a.conf.parked){m._winAdjustCell(this._idd);m._callMainEvent("onParkDown",this._idd);if(a.conf.keep_in_vp){m._winAdjustPosition(this._idd,a.conf.x,a.conf.y)}}else{a.hdr.style.zIndex=3;m._callMainEvent("onParkUp",this._idd)}}}a=null};this.unload=function(){this.conf.unloading=true;if(this._dndInitModule){this._dndUnloadModule()}for(var q in this.w){this._winClose(q)}this.w=null;if(this.cm!=null&&typeof(this._unloadContextMenu)=="function"){this._unloadContextMenu()}window.dhx4._eventable(this,"clear");this.attachViewportTo(null);for(var q in this.conf){this.conf[q]=null;delete this.conf[q]}for(var q in this){this[q]=null}m=q=null};window.dhx4._eventable(this);this.attachEvent("_winMouseDown",this._winMouseDownHandler);if(this._dndInitModule){this._dndInitModule()}if(j.wins!=null){for(var n=0;n<j.wins.length;n++){var l=j.wins[n];this.createWindow(l)}}j=null;return this}dhtmlXWindows.prototype.forEachWindow=function(g){for(var c in this.w){g.apply(window,[this.w[c].cell])}};dhtmlXWindows.prototype.window=function(a){if(this.w[a]!=null){return this.w[a].cell}return null};dhtmlXWindows.prototype.isWindow=function(a){return(this.w[a]!=null)};dhtmlXWindows.prototype.findByText=function(j){var g=[];for(var c in this.w){if((this.w[c].cell.getText()).indexOf(String(j))>=0){g.push(this.w[c])}}return g};dhtmlXWindows.prototype.setSkin=function(g){if(g==this.conf.skin){return}if(this.vp!=null){this.vp.className=String(this.vp.className).replace("dhxwins_vp_"+this.conf.skin," dhxwins_vp_"+g)}for(var c in this.w){this.w[c].cell._resetSizeState();this._winAdjustCell(c);this._winAdjustTitle(c)}this.conf.skin=g};dhtmlXWindows.prototype.getBottommostWindow=function(){return this._getTopBottomWin(false)};dhtmlXWindows.prototype.getTopmostWindow=function(){return this._getTopBottomWin(true)};dhtmlXWindows.prototype._getTopBottomWin=function(l){var j=null;for(var c in this.w){if(this.w[c].conf.visible){var g=false;if(j!=null){g=j.z>this.w[c].win.style.zIndex;if(l){g=!g}}if(j==null||g){j={win:this.w[c].cell,z:this.w[c].win.style.zIndex}}}}return(j?j.win:null)};dhtmlXWindows.prototype._winMakeActive=function(g,l){if(g!=null&&l!==true&&this.w[g].conf.actv==true){return}var x=[];var r=[{name:"modal",value:true},{name:"sticked",value:true},{name:"sticked",value:false}];var o={};for(var c=0;c<r.length;c++){var n=r[c].name;var j=r[c].value;var y=[];for(var u in this.w){var v=this.w[u];if(o[u]==null&&v.conf[n]===j&&v.conf.visible==true){if(g!=u){window.dhx4.zim.clear(v.conf.z_id);y.push([u,Number(v.win.style.zIndex)]);o[u]=true}}v=null}y.sort(function(w,q){return(w[1]<q[1]?1:-1)});if(g!=null&&this.w[g].conf[n]===j&&o[g]==null){window.dhx4.zim.clear(this.w[g].conf.z_id);var m=[[g,Number(this.w[g].win.style.zIndex)]];y=m.concat(y);o[g]=true}x=x.concat(y)}for(var c=x.length-1;c>=0;c--){var u=x[c][0];var v=this.w[u];v.win.style.zIndex=window.dhx4.zim.reserve(v.conf.z_id);if(v.conf.modal&&this.mcover!=null){for(var s in this.mcover){this.mcover[s].style.zIndex=v.win.style.zIndex}}this._winAdjustFRMZIndex(u);if(g==null&&c==0){g=u}v.conf.actv=(g==u);v.win.className=(v.conf.actv?"dhxwin_active":"dhxwin_inactive");v=null}if(g!=null&&this.conf.last_active!=g){this._callMainEvent("onFocus",g)}this.conf.last_active=g};dhtmlXWindows.prototype._vpPull={};dhtmlXWindows.prototype._vpPullAdd=function(){if(this.vp==null){return}var g=null;for(var c in this._vpPull){if(this._vpPull[c].vp==this.vp){this._vpPull[c].count++;g=c}}if(g==null){this._vpPull[window.dhx4.newId()]={vp:this.vp,count:1}}};dhtmlXWindows.prototype._vpPullRemove=function(){if(this.vp==null){return 0}var g=0;for(var c in this._vpPull){if(this._vpPull[c].vp==this.vp){g=--this._vpPull[c].count;if(g==0){this._vpPull[c].vp=null;this._vpPull[c].count=null;delete this._vpPull[c]}}}return g};dhtmlXWindows.prototype.attachViewportTo=function(l){var g=this._vpPullRemove();if(this.conf.vp_custom){while(this.vp.childNodes.length>0){this.vp.removeChild(this.vp.lastChild)}this.vp.parentNode.removeChild(this.vp);this.vp=null}else{if(this.vp!=null&&g==0){this.vp.className=String(this.vp.className).replace(new RegExp("\\s{1,}dhxwins_vp_"+this.conf.skin),"")}}if(l==null){this.vp=null}else{this.vp=(typeof(l)=="string"?document.getElementById(l):l);var j="dhxwins_vp_"+this.conf.skin;if(this.vp.className.indexOf(j)<0){this.vp.className+=" "+j}l=null;for(var c in this.w){this.vp.appendChild(this.w[c].win)}this.conf.vp_custom=false}if(this.vp==document.body){document.body.style.position="static"}this._vpPullAdd()};dhtmlXWindows.prototype.setViewport=function(c,m,j,a,l){var g=document.createElement("DIV");g.style.position="absolute";g.style.left=c+"px";g.style.top=m+"px";g.style.width=j+"px";g.style.height=a+"px";if(typeof(l)=="undefined"||l==null){l=document.body}else{if(typeof(l)=="string"){l=document.getElementById(l)}}l.appendChild(g);this.attachViewportTo(g);this.conf.vp_custom=true;l=g=null};dhtmlXWindows.prototype._winSetPosition=function(j,a,g){var c=this.w[j];if(c.conf.maxed){c.conf.lastMX+=(a-c.conf.x);c.conf.lastMY+=(g-c.conf.y)}c.conf.x=a;c.conf.y=g;c.win.style.left=c.conf.x+"px";c.win.style.top=c.conf.y+"px";this._winAdjustFRMPosition(j);c=null};dhtmlXWindows.prototype._winAdjustPosition=function(n,c,m){var g=this.w[n];if(typeof(c)=="undefined"){c=g.conf.x}if(typeof(m)=="undefined"){m=g.conf.y}var a=(g.conf.keep_in_vp?0:-g.conf.w+this.conf.vp_pos_ofs);var l=(g.conf.keep_in_vp?this.vp.clientWidth-g.conf.w:this.vp.clientWidth-this.conf.vp_pos_ofs);if(c<a){c=a}else{if(c>l){c=l}}var j=(g.conf.keep_in_vp?this.vp.clientHeight-g.conf.h:this.vp.clientHeight-this.conf.vp_pos_ofs);if(m<0){m=0}else{if(m>j){m=j}}if(c!=g.conf.x||m!=g.conf.y){this._winSetPosition(n,c,m)}g=null};dhtmlXWindows.prototype._winSetSize=function(o,m,g,n,c){var j=this.w[o];var a=(m!=null?m:j.conf.w);var l=(g!=null?g:j.conf.h);if(this.conf.ofs_w==null){j.win.style.width=a+"px";j.win.style.height=l+"px";this.conf.ofs_w=j.win.offsetWidth-a;this.conf.ofs_h=j.win.offsetHeight-l}if(j.conf.min_w!=null&&a<j.conf.min_w){a=j.conf.min_w}if(j.conf.max_w!=null&&a>j.conf.max_w){a=j.conf.max_w}if(!j.conf.parked&&j.conf.min_h!=null&&l<j.conf.min_h){l=j.conf.min_h}if(j.conf.max_h!=null&&l>j.conf.max_h){l=j.conf.max_h}if(j.conf.keep_in_vp){if(a>this.vp.clientWidth){a=this.vp.clientWidth}if(l>this.vp.clientHeight){l=this.vp.clientHeight}}j.win.style.width=a-this.conf.ofs_w+"px";j.win.style.height=l-this.conf.ofs_h+"px";j.conf.w=a;j.conf.h=l;this._winAdjustFRMSize(o);if(c){this._winAdjustPosition(o,j.conf.x,j.conf.y)}if(!j.conf.parked&&n!=true){this._winAdjustCell(o)}j=null};dhtmlXWindows.prototype._winMinmax=function(l,g){if(typeof(g)!="undefined"&&this.w[l].conf.maxed==g){return}if(this.w[l].conf.allow_resize==false){return}var c=this.w[l];if(c.conf.parked){this._winPark(l,false)}if(c.conf.maxed){this._winSetSize(l,c.conf.lastMW,c.conf.lastMH);this._winAdjustPosition(l,c.conf.lastMX,c.conf.lastMY);c.conf.maxed=false}else{var a=0;var j=0;if(c.conf.max_w!=null){a=c.conf.x+Math.round(c.conf.w-c.conf.max_w)/2}if(c.conf.max_h!=null){j=Math.max(c.conf.y+Math.round(c.conf.h-c.conf.max_h)/2,0)}c.conf.lastMX=c.conf.x;c.conf.lastMY=c.conf.y;c.conf.lastMW=c.conf.w;c.conf.lastMH=c.conf.h;this._winSetSize(l,this.vp.clientWidth,this.vp.clientHeight);this._winAdjustPosition(l,a,j);c.conf.maxed=true}c.b.minmax.setCss(c.conf.maxed?"minmaxed":"minmax");if(c.conf.maxed){this._callMainEvent("onMaximize",l)}else{this._callMainEvent("onMinimize",l)}c=null};dhtmlXWindows.prototype._winShow=function(c,a){if(this.w[c].conf.visible==true){return}this.w[c].win.style.display="";this.w[c].conf.visible=true;if(a==true||this.conf.last_active==null){this._winMakeActive(c,true)}this._callMainEvent("onShow",c)};dhtmlXWindows.prototype._winHide=function(c,a){if(this.w[c].conf.visible==false){return}this.w[c].win.style.display="none";this.w[c].conf.visible=false;if(this.w[c].conf.actv){this.w[c].conf.actv=false;this.w[c].win.className="dhxwin_inactive";this._winMakeActive(null,true)}this._callMainEvent("onHide",c)};dhtmlXWindows.prototype._winPark=function(g,a){if(this.w[g].conf.allow_park==false){return}if(this.w[g].conf.header==false){return}var c=this.w[g];if(a==true&&this.conf.tr.prop!==false){c.win.style[this.conf.tr.prop]=this.conf.tr[c.conf.parked?"height_open":"height_close"];if(!c.conf.tr_ev){c.win.addEventListener(this.conf.tr.ev,this._winOnParkTrans,false);c.conf.tr_ev=true}}if(c.conf.parked){c.hdr.className=String(c.hdr.className).replace(/\s{1,}dhxwin_hdr_parked/gi,"");c.hdr.style.zIndex=0;c.conf.parked=false;c.conf.tr_mode="park";this._winCellSetOpacity(g,"open",a);this._winSetSize(g,c.conf.w,c.conf.lastPH,(a==true&&this.conf.tr.prop!==false));if(!(a==true&&this.conf.tr.prop!==false)){this._callMainEvent("onParkDown",g);if(c.conf.keep_in_vp){this._winAdjustPosition(g,c.conf.x,c.conf.y)}}if(window.dhx4.isIE8==true&&this.conf.tr.prop==false&&c.cell.cell.className.match(/dhxwin_parked/)!=null){c.cell.cell.className=c.cell.cell.className.replace(/\s{0,}dhxwin_parked/gi,"")}}else{c.conf.lastPH=c.conf.h;c.hdr.className+=" dhxwin_hdr_parked";if(a==false||this.conf.tr.prop==false){c.hdr.style.zIndex=3}c.conf.parked=true;c.conf.tr_mode="park";this._winCellSetOpacity(g,"close",a);this._winSetSize(g,c.conf.w,c.hdr.offsetHeight+this.conf.ofs_h,(a==true&&this.conf.tr.prop!==false));if(!(a==true&&this.conf.tr.prop!==false)){this._callMainEvent("onParkUp",g)}if(window.dhx4.isIE8==true&&this.conf.tr.prop==false&&c.cell.cell.className.match(/dhxwin_parked/)==null){c.cell.cell.className+=" dhxwin_parked"}}c=null};dhtmlXWindows.prototype._winCellSetOpacity=function(n,m,g,l){var c=this.w[n].cell;for(var j in c.conf.idx){if({pr1:true,pr2:true}[j]!=true){if(g==true&&this.conf.tr.prop!=false){c.cell.childNodes[c.conf.idx[j]].style[this.conf.tr.prop]=this.conf.tr["op_"+m]}c.cell.childNodes[c.conf.idx[j]].style.opacity=this.conf.tr["op_v_"+m]}}c=null};dhtmlXWindows.prototype._winCellClearOpacity=function(j){var c=this.w[j].cell;for(var g in c.conf.idx){if({pr1:true,pr2:true}[g]!=true){if(this.conf.tr.prop!=false){c.cell.childNodes[c.conf.idx[g]].style[this.conf.tr.prop]=""}}}c=null};dhtmlXWindows.prototype._winStick=function(c,a){if(typeof(a)!="undefined"&&this.w[c].conf.sticked==a){return}this.w[c].conf.sticked=!this.w[c].conf.sticked;this.w[c].b.stick.setCss(this.w[c].conf.sticked?"sticked":"stick");this._winMakeActive(this.conf.last_active,true);if(this.w[c].conf.sticked){this._callMainEvent("onStick",c)}else{this._callMainEvent("onUnStick",c)}};dhtmlXWindows.prototype._winClose=function(j){if(this._callMainEvent("onClose",j)!==true&&this.conf.unloading!=true){return}var g=this.w[j];if(g.conf.fs_mode){g.cell.setToFullScreen(false)}if(g.conf.modal){this._winSetModal(j,false)}window.dhx4.zim.clear(g.conf.z_id);if(this.cm!=null&&this.cm.icon[j]!=null){this._detachContextMenu("icon",j,null)}if(typeof(window.addEventListener)=="function"){g.win.removeEventListener("mousedown",this._winOnMouseDown,false);g.win.removeEventListener("mouseup",this._winOnMouseDown,false);if(this.conf.dblclick_ev){g.win.removeEventListener("dblclick",this._winOnMouseDown,false)}if(this.conf.dnd_evs!=null){g.win.removeEventListener(this.conf.dnd_evs.start,this._winOnMouseDown,false);if(window.navigator.msPointerEnabled!=true){g.win.removeEventListener(this.conf.dnd_evs.start,this._winOnMouseDown,false);g.win.removeEventListener(this.conf.dnd_evs.end,this._winOnMouseDown,false)}}}else{g.win.detachEvent("onmousedown",this._winOnMouseDown);g.win.detachEvent("onmouseup",this._winOnMouseDown);if(this.conf.dblclick_ev){g.win.attachEvent("ondblclick",this._winOnMouseDown)}}for(var c in g.b){this._winRemoveButton(j,c,true)}g.b=null;g.cell._unload();g.cell=null;g.brd.parentNode.removeChild(g.brd);g.brd=null;if(g.fr_cover!=null){g.fr_cover.parentNode.removeChild(g.fr_cover);g.fr_cover=null}if(g.fr_m_cover!=null){g.fr_m_cover.parentNode.removeChild(g.fr_m_cover);g.fr_m_cover=null}g.hdr._isWinHdr=true;g.hdr.firstChild._isWinIcon=true;g.hdr.onselectstart=null;g.hdr.parentNode.removeChild(g.hdr);g.hdr=null;for(var c in g.conf){g.conf[c]=null;delete g.conf[c]}g.conf=null;g.win._idd=null;g.win._isWindow=null;g.win.parentNode.removeChild(g.win);g.win=null;g=null;this.w[j]=null;delete this.w[j];if(!this.conf.unloading){this._winMakeActive(null,true)}};dhtmlXWindows.prototype._winSetModal=function(n,j,m){if(this.w[n].conf.modal==j){return}if(typeof(m)=="undefined"){m=true}var g=this.w[n];if(j==true&&g.conf.modal==false){if(this.conf.last_modal!=null){this._winSetModal(this.conf.last_modal,false,false)}if(this.mcover==null){var l=document.createElement("DIV");l.className="dhxwins_mcover";this.vp.insertBefore(l,g.fr_m_cover||g.win);this.mcover={d:l};if(this.conf.fr_cover){this.mcover.f=document.createElement("IFRAME");this.mcover.f.className="dhxwins_mcover";this.mcover.f.border=0;this.mcover.f.frameBorder=0;this.vp.insertBefore(this.mcover.f,l)}l=null}else{if(this.mcover.d.nextSibling!=(g.fr_m_cover||g.win)){this.vp.insertBefore(this.mcover.d,g.fr_m_cover||g.win);if(this.mcover.f!=null){this.vp.insertBefore(this.mcover.f,this.mcover.d)}}}g.conf.modal=true;this.conf.last_modal=n;this._winMakeActive(n,true)}else{if(j==false&&g.conf.modal==true){g.conf.modal=false;this.conf.last_modal=null;if(m&&this.mcover!=null){for(var c in this.mcover){this.vp.removeChild(this.mcover[c]);this.mcover[c]=null}this.mcover=null}}}g=null};dhtmlXWindows.prototype._winMouseDownHandler=function(g,c){var a=g.target||g.srcElement;if(g.button>=2){return}if(c.mode=="button"){if(c.press_type=="mousedown"){this.conf.button_last=c.button_name}else{if((c.press_type=="mouseup"&&c.button_name==this.conf.button_last)||c.press_type=="MSPointerDown"){this.conf.button_last=null;if(this._winButtonClick(c.id,c.button_name,g)!==true){return}}}}if((c.press_type=="mousedown"||c.press_type=="dblclick")&&c.mode=="hdr"){this.conf.dblclick_active=false;if(this.conf.dblclick_ev==true){if(c.press_type=="dblclick"){this.conf.dblclick_active=true}}else{if(this.conf.dblclick_last==null){this.conf.dblclick_last=new Date().getTime();this.dblclick_id=c.id}else{var a=new Date().getTime();if(this.conf.dblclick_last+this.conf.dblclick_tm>a&&this.dblclick_id==c.id){this.conf.dblclick_active=true;this.conf.dblclick_last=null;this.dblclick_id=null}else{this.conf.dblclick_last=a;this.dblclick_id=c.id}}}if(this.conf.dblclick_active){this._winDoHeaderDblClick(c.id);return}}if(c.press_type=="mousedown"||(this.conf.dnd_evs!=null&&c.press_type==this.conf.dnd_evs.start)){this._winMakeActive(c.id)}if(c.press_type=="touchend"){}};dhtmlXWindows.prototype._winDoHeaderDblClick=function(a){if(this.conf.dblclick_mode=="minmax"){this._winMinmax(a);return}if(this.conf.dblclick_mode=="park"){this._winPark(a,true);return}if(typeof(this.conf.dblclick_mode)=="function"){this.conf.dblclick_mode.apply(window,[a]);return}if(typeof(window[this.conf.dblclick_mode])=="function"){window[this.conf.dblclick_mode].apply(window,[a]);return}};dhtmlXWindows.prototype._winAdjustCell=function(c){var r=this.w[c];var q=1;var o=(r.conf.header?r.hdr.offsetHeight:1);var j=r.win.clientWidth-2;var s=r.win.clientHeight-o-1;r.brd.style.left=q+"px";r.brd.style.top=o+"px";if(r.conf.brd==null){r.brd.style.width=j+"px";r.brd.style.height=s+"px";r.conf.brd={w:j-r.brd.offsetWidth,h:s-r.brd.offsetHeight}}r.brd.style.width=j+r.conf.brd.w+"px";r.brd.style.height=s+r.conf.brd.h+"px";var g=5;var a=1+g;var n=(r.conf.header?o:o+g);var l=r.brd.clientWidth;var m=r.brd.clientHeight;r.cell._setSize(a,n,l,m);r.fr_cover.style.left=a+"px";r.fr_cover.style.top=n+"px";r.fr_cover.style.width=l+"px";r.fr_cover.style.height=m+"px";r=null};dhtmlXWindows.prototype._winAdjustTitle=function(j){var a=this.w[j].hdr.childNodes[0];var g=this.w[j].hdr.childNodes[1];var c=this.w[j].hdr.childNodes[2];g.style.paddingLeft=a.offsetWidth+12+"px";g.style.paddingRight=c.offsetWidth+10+"px";g=c=a=null};dhtmlXWindows.prototype._callMainEvent=function(c,j){var a=this.w[j];if(a.cell.checkEvent(c)){var g=a.cell._callMainEvent(c,[a.cell])}else{var g=this.callEvent(c,[a.cell])}a=null;return g};dhtmlXWindows.prototype._winInitFRM=function(g){if(this.conf.fr_cover!=true){return}var a=this.w[g];var c=document.createElement("IFRAME");c.className="dhxwin_main_fr_cover";c.border=0;c.frameBorder=0;c.style.zIndex=a.win.style.zIndex;a.win.parentNode.insertBefore(c,a.win);a.fr_m_cover=c;c=null};dhtmlXWindows.prototype._winAdjustFRMSize=function(c){var a=this.w[c];if(a.fr_m_cover!=null){a.fr_m_cover.style.width=a.conf.w+"px";a.fr_m_cover.style.height=a.conf.h+"px"}a=null};dhtmlXWindows.prototype._winAdjustFRMPosition=function(c){var a=this.w[c];if(a.fr_m_cover!=null){a.fr_m_cover.style.left=a.win.style.left;a.fr_m_cover.style.top=a.win.style.top}a=null};dhtmlXWindows.prototype._winAdjustFRMZIndex=function(c){var a=this.w[c];if(a.fr_m_cover!=null){a.fr_m_cover.style.zIndex=a.win.style.zIndex}a=null};function dhtmlXWindowsCell(l,j){dhtmlXCellObject.apply(this,[l,"_wins"]);this.wins=j;this.cell._winId=l;this.conf.skin=this.wins.conf.skin;this.attachEvent("_onCellUnload",function(){if(this._unloadResize){this._unloadResize()}window.dhx4._eventable(this.cell,"clear");this.cell._winId=null;this.wins=null;this.setText=null;this.getText=null;this.allowMove=null;this.denyMove=null;this.isMovable=null;this.allowResize=null;this.denyResize=null;this.isResizable=null;this.maximize=null;this.minimize=null;this.isMaximized=null;this.setPosition=null;this.getPosition=null;this.adjustPosition=null;this.park=null;this.isParked=null;this.allowPark=null;this.denyPark=null;this.isParkable=null;this.show=null;this.hide=null;this.isHidden=null;this.stick=null;this.unstick=null;this.isSticked=null;this.setDimension=null;this.getDimension=null;this.setMinDimension=null;this.getMinDimension=null;this.setMaxDimension=null;this.getMaxDimension=null;this.keepInViewport=null;this.center=null;this.centerOnScreen=null;this.bringToTop=null;this.bringToBottom=null;this.isOnTop=null;this.isOnBottom=null;this.showHeader=null;this.hideHeader=null;this.setModal=null;this.isModal=null;this.close=null;this._adjustByCont=null;this.button=null;this.addUserButton=null;this.removeUserButton=null;g=null});this.attachEvent("_onContentLoaded",function(){this.wins._callMainEvent("onContentLoaded",this._idd)});this.attachEvent("_onContentMouseDown",function(m,a){this.wins.callEvent("_winMouseDown",[a,{id:m,mode:"win"}])});this._callMainEvent=function(m,a){return this.callEvent(m,a)};this.conf.tr={};for(var c in this.wins.conf.tr){this.conf.tr[c]=this.wins.conf.tr[c]}if(this.conf.tr.prop!=false){}if(this._initResize){this._initResize()}window.dhx4._eventable(this.cell);var g=this;this.cell.attachEvent("_setCellSize",function(a,o){var m=g.wins.w[this._winId].conf.w-g.conf.size.w;var n=g.wins.w[this._winId].conf.h-g.conf.size.h;g.setDimension(a+m,o+n)});return this}dhtmlXWindowsCell.prototype=new dhtmlXCellObject();dhtmlXWindowsCell.prototype.setText=function(a){this.wins.w[this._idd].conf.text=a;this.wins.w[this._idd].hdr.childNodes[1].firstChild.innerHTML=a};dhtmlXWindowsCell.prototype.getText=function(){return this.wins.w[this._idd].conf.text};dhtmlXWindowsCell.prototype.allowMove=function(){this.wins.w[this._idd].conf.allow_move=true};dhtmlXWindowsCell.prototype.denyMove=function(){this.wins.w[this._idd].conf.allow_move=false};dhtmlXWindowsCell.prototype.isMovable=function(){return(this.wins.w[this._idd].conf.allow_move==true)};dhtmlXWindowsCell.prototype.allowResize=function(){this.wins.w[this._idd].conf.allow_resize=true;this.wins.w[this._idd].b.minmax.enable()};dhtmlXWindowsCell.prototype.denyResize=function(){this.wins.w[this._idd].conf.allow_resize=false;this.wins.w[this._idd].b.minmax.disable()};dhtmlXWindowsCell.prototype.isResizable=function(){return(this.wins.w[this._idd].conf.allow_resize==true)};dhtmlXWindowsCell.prototype.maximize=function(){this.wins._winMinmax(this._idd,true)};dhtmlXWindowsCell.prototype.minimize=function(){this.wins._winMinmax(this._idd,false)};dhtmlXWindowsCell.prototype.isMaximized=function(){return(this.wins.w[this._idd].conf.maxed==true)};dhtmlXWindowsCell.prototype.setPosition=function(a,c){this.wins._winSetPosition(this._idd,a,c)};dhtmlXWindowsCell.prototype.getPosition=function(){var a=this.wins.w[this._idd];var c=[a.conf.x,a.conf.y];a=null;return c};dhtmlXWindowsCell.prototype.adjustPosition=function(){this.wins._winAdjustPosition(this._idd)};dhtmlXWindowsCell.prototype.park=function(){this.wins._winPark(this._idd,true)};dhtmlXWindowsCell.prototype.isParked=function(){return(this.wins.w[this._idd].conf.parked==true)};dhtmlXWindowsCell.prototype.allowPark=function(){this.wins.w[this._idd].conf.allow_park=true;this.wins.w[this._idd].b.park.enable()};dhtmlXWindowsCell.prototype.denyPark=function(){this.wins.w[this._idd].conf.allow_park=false;this.wins.w[this._idd].b.park.disable()};dhtmlXWindowsCell.prototype.isParkable=function(){return(this.wins.w[this._idd].conf.allow_park==true)};dhtmlXWindowsCell.prototype.show=function(a){this.wins._winShow(this._idd,window.dhx4.s2b(a))};dhtmlXWindowsCell.prototype.hide=function(){this.wins._winHide(this._idd)};dhtmlXWindowsCell.prototype.isHidden=function(){return(this.wins.w[this._idd].conf.visible!=true)};dhtmlXWindowsCell.prototype.stick=function(){this.wins._winStick(this._idd,true)};dhtmlXWindowsCell.prototype.unstick=function(){this.wins._winStick(this._idd,false)};dhtmlXWindowsCell.prototype.isSticked=function(){return(this.wins.w[this._idd].conf.sticked==true)};dhtmlXWindowsCell.prototype.setDimension=function(g,a){var c=this.wins.w[this._idd];if(c.conf.parked){this.wins._winPark(this._idd,false)}if(c.conf.maxed){if(g!=null){c.conf.lastMW=g}if(a!=null){c.conf.lastMH=a}this.wins._winMinmax(this._idd)}else{this.wins._winSetSize(this._idd,g,a,false,true)}c=null};dhtmlXWindowsCell.prototype.getDimension=function(){var a=this.wins.w[this._idd];var c=[a.conf.w,a.conf.h];a=null;return c};dhtmlXWindowsCell.prototype.setMinDimension=function(g,a){var c=this.wins.w[this._idd];c.conf.min_w=g;c.conf.min_h=a;this.wins._winSetSize(this._idd,c.conf.w,c.conf.h);c=null};dhtmlXWindowsCell.prototype.getMinDimension=function(){var a=this.wins.w[this._idd];var c=[a.conf.min_w,a.conf.min_h];a=null;return c};dhtmlXWindowsCell.prototype.setMaxDimension=function(g,a){var c=this.wins.w[this._idd];c.conf.max_w=g;c.conf.max_h=a;this.wins._winSetSize(this._idd,c.conf.w,c.conf.h);c=null};dhtmlXWindowsCell.prototype.getMaxDimension=function(){var a=this.wins.w[this._idd];var c=[a.conf.max_w,a.conf.max_h];a=null;return c};dhtmlXWindowsCell.prototype.keepInViewport=function(a){this.wins.w[this._idd].conf.keep_in_vp=window.dhx4.s2b(a)};dhtmlXWindowsCell.prototype.center=function(){var g=this.wins.vp;var c=this.wins.w[this._idd];var a=Math.round((g.clientWidth-c.conf.w)/2);var j=Math.round((g.clientHeight-c.conf.h)/2);this.wins._winSetPosition(this._idd,a,j);g=c=null};dhtmlXWindowsCell.prototype.centerOnScreen=function(){var c=this.wins.w[this._idd];var m=window.dhx4.screenDim();var l=window.dhx4.absLeft(this.wins.vp);var j=window.dhx4.absTop(this.wins.vp);var g=this.wins.vp.parentNode;while(g!=null){if(g.scrollLeft){l=l-g.scrollLeft}if(g.scrollTop){j=j-g.scrollTop}g=g.parentNode}var a=Math.round((m.right-m.left-c.conf.w)/2);var n=Math.round((m.bottom-m.top-c.conf.h)/2);this.wins._winAdjustPosition(this._idd,a-l,n-j);d=c=null};dhtmlXWindowsCell.prototype.bringToTop=function(){this.wins._winMakeActive(this._idd,true)};dhtmlXWindowsCell.prototype.bringToBottom=function(){var a=(this.wins.w[this._idd].conf.actv?null:this.wins.conf.last_active);window.dhx4.zim.clear(this.wins.w[this._idd].conf.z_id);this.wins.w[this._idd].win.style.zIndex=0;this.wins._winMakeActive(a,true)};dhtmlXWindowsCell.prototype.isOnTop=function(){return(this.wins.w[this._idd].conf.actv==true)};dhtmlXWindowsCell.prototype.isOnBottom=function(){var g={id:null,z:+Infinity};for(var c in this.wins.w){if(this.wins.w[c].conf.visible&&this.wins.w[c].win.style.zIndex<g.z){g.id=c;g.z=this.wins.w[c].win.style.zIndex}}return(g.id==this._idd)};dhtmlXWindowsCell.prototype.showHeader=function(){var a=this.wins.w[this._idd];if(a.conf.header==false){a.hdr.className=String(a.hdr.className).replace(/\s{0,}dhxwin_hdr_hidden/gi,"");a.brd.className=String(a.brd.className).replace(/\s{0,}dhxwin_hdr_hidden/gi,"");this.conf.cells_cont=null;a.conf.brd=null;a.conf.header=true;this.wins._winAdjustCell(this._idd)}a=null};dhtmlXWindowsCell.prototype.hideHeader=function(){var a=this.wins.w[this._idd];if(a.conf.header==true){if(a.conf.parked){this.wins._winPark(this._idd,false)}a.hdr.className+=" dhxwin_hdr_hidden";a.brd.className+=" dhxwin_hdr_hidden";this.conf.cells_cont=null;a.conf.brd=null;a.conf.header=false;this.wins._winAdjustCell(this._idd)}a=null};dhtmlXWindowsCell.prototype.setModal=function(a){this.wins._winSetModal(this._idd,window.dhx4.s2b(a))};dhtmlXWindowsCell.prototype.isModal=function(){return(this.wins.w[this._idd].conf.modal==true)};dhtmlXWindowsCell.prototype._adjustByCont=function(a,c){a+=this.wins.w[this._idd].conf.w-this.conf.size.w;c+=this.wins.w[this._idd].conf.h-this.conf.size.h;this.wins._winSetSize(this._idd,a,c)};dhtmlXWindowsCell.prototype.close=function(){this.wins._winClose(this._idd)};dhtmlXWindowsCell.prototype.setIconCss=function(a){this.wins.w[this._idd].hdr.firstChild.className="dhxwin_icon "+a;this.wins._winAdjustTitle(this._idd)};dhtmlXWindowsCell.prototype.setToFullScreen=function(c){c=window.dhx4.s2b(c);var a=this.wins.w[this._idd];if(a.conf.fs_mode==c){a=null;return}if(this.wins.fsn==null){this.wins.fsn=document.createElement("DIV");this.wins.fsn.className=this.wins.vp.className+" dhxwins_vp_fs";document.body.appendChild(this.wins.fsn)}if(c){this.wins.fsn.appendChild(a.win);this.maximize();this.hideHeader()}else{this.wins.vp.appendChild(a.win);this.minimize();this.showHeader();if(this.wins.fsn.childNodes.length==0){this.wins.fsn.parentNode.removeChild(this.wins.fsn);this.wins.fsn=null}}a.conf.fs_mode=c;a=null};dhtmlXWindowsCell.prototype.button=function(a){if(a=="minmax1"||a=="minmax2"){a="minmax"}return this.wins.w[this._idd].b[a]};dhtmlXWindowsCell.prototype.addUserButton=function(m,l,g){var a=new dhtmlXWindowsButton(this.wins,this._idd,m,g,true);var j=null;var c=this.wins.w[this._idd].hdr.lastChild;if(isNaN(l)){l=0}else{if(l<0){l=0}}if(c.childNodes[l]!=null){j=c.childNodes[l]}if(j!=null){c.insertBefore(a.button,j)}else{c.appendChild(a.button)}this.wins.w[this._idd].b[m]=a;a=j=c=null;this.wins._winAdjustTitle(this._idd)};dhtmlXWindowsCell.prototype.removeUserButton=function(a){if(this.wins.w[this._idd].b[a]==null||this.wins.w[this._idd].b[a].conf.custom!=true){return}this.wins._winRemoveButton(this._idd,a)};window.dhtmlXWindowsButton=function(l,c,a,j,g){this.conf={wins:l,winId:c,name:a,enabled:true,visible:true,custom:true};this.button=document.createElement("DIV");this.button._buttonName=a;this.button.title=j;this.enable=function(){this.conf.enabled=true;this.setCss(this.conf.css)};this.disable=function(){this.conf.enabled=false;this.setCss(this.conf.css)};this.isEnabled=function(){return(this.conf.enabled==true)};this.show=function(){this.button.style.display="";this.conf.visible=true;this.conf.wins._winAdjustTitle(this.conf.winId)};this.hide=function(){this.button.style.display="none";this.conf.visible=false;this.conf.wins._winAdjustTitle(this.conf.winId)};this.isHidden=function(){return(this.conf.visible==false)};this.setCss=function(n){this.conf.css=n;var m=(this.conf.enabled?"":"_dis");this.button.className="dhxwin_button"+m+" dhxwin_button_"+this.conf.css+m};this._doOnClick=function(m){return this.callEvent("onClick",[this.conf.wins.w[this.conf.winId].cell,this])};this.unload=function(m){dhx4._eventable(this,"clear");this.button._buttonName=null;this.button.parentNode.removeChild(this.button);if(this.conf.wins.cm!=null&&this.conf.wins.cm.button[this.conf.winId]!=null&&this.conf.wins.cm.button[this.conf.winId][this.conf.name]!=null){this.conf.wins._detachContextMenu("button",this.conf.winId,this.conf.name)}this.button=null;this.enable=null;this.disable=null;this.isEnabled=null;this.show=null;this.hide=null;this.isHidden=null;this.setCss=null;this.unload=null;if(m!=true){this.conf.wins._winAdjustTitle(this.conf.winId)}this.conf.wins=null;this.conf.winId=null;this.conf=null};this.setCss(a);dhx4._eventable(this);return this};dhtmlXWindows.prototype._winButtonClick=function(g,a,c){if(!this.w[g].b[a].isEnabled()){return true}if(this.w[g].b[a]._doOnClick()!==true){return}if(a=="help"){this._callMainEvent("onHelp",g)}if(a=="park"){this._winPark(g,true)}if(a=="minmax"){this._winMinmax(g)}if(a=="stick"){this._winStick(g);return false}if(a=="close"){this._winClose(g);return false}return true};dhtmlXWindows.prototype._winRemoveButton=function(g,a,c){this.w[g].b[a].unload(c);this.w[g].b[a]=null;delete this.w[g].b[a]};dhtmlXWindows.prototype._dndInitModule=function(){var a=this;this.conf.dnd_tm=null;this.conf.dnd_time=0;if(window.navigator.msPointerEnabled==true){this.conf.dnd_evs={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}}else{this.conf.dnd_evs={start:"touchstart",move:"touchmove",end:"touchend"}}this._dndOnMouseDown=function(j,l){if(a.conf.dblclick_active){return}if(j.preventDefault){j.preventDefault()}else{j.returnValue=false}if(a._callMainEvent("onBeforeMoveStart",l)!==true){return}a.conf.dnd={id:l,x:a._dndPos(j,"X"),y:a._dndPos(j,"Y"),ready:true,css:false,css_touch:false,css_vp:false,tr:null,mode:"def",moved:false,prevent:false};if(a.w[l].conf.keep_in_vp){a.conf.dnd.minX=0;a.conf.dnd.maxX=a.vp.clientWidth-a.w[l].conf.w;a.conf.dnd.minY=0;a.conf.dnd.maxY=a.vp.clientHeight-a.w[l].conf.h}else{a.conf.dnd.minX=-a.w[l].conf.w+a.conf.vp_pos_ofs;a.conf.dnd.maxX=a.vp.clientWidth-a.conf.vp_pos_ofs;a.conf.dnd.minY=0;a.conf.dnd.maxY=a.vp.clientHeight-a.conf.vp_pos_ofs}var c=["MozTransform","WebkitTransform","OTransform","msTransform","transform"];for(var g=0;g<c.length;g++){if(document.documentElement.style[c[g]]!=null&&a.conf.dnd.tr==null){a.conf.dnd.tr=c[g];a.conf.dnd.mode="tr"}}if(a.conf.dnd.mode=="tr"){a.w[l].win.style[a.conf.dnd.tr]="translate(0px,0px)"}if(j.type==a.conf.dnd_evs.start){if(a.conf.dnd.css_touch==false){a.w[l].win.className+=" dhxwin_dnd_touch";a.conf.dnd.css_touch=true}if(a.conf.dnd.css_vp==false){a.vp.className+=" dhxwins_vp_dnd";a.conf.dnd.css_vp=true}}else{a._dndInitEvents()}};this._dndOnMouseMove=function(l){l=l||event;var j=a.conf.dnd;var c=a._dndPos(l,"X")-j.x;var m=a._dndPos(l,"Y")-j.y;if(l.type==a.conf.dnd_evs.move){if(j.moved!=true&&(Math.abs(c)>20||Math.abs(m)>20)){if(a.conf.dnd_tm!=null){window.clearTimeout(a.conf.dnd_tm);a.conf.dnd_tm=null}window.removeEventListener(a.conf.dnd_evs.start,a._dndOnMouseMove,false);return}}if(j.ready!=true){return}var g=a.w[j.id];if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}if(j.css!=true){if(j.css_touch==false){g.win.className+=" dhxwin_dnd"}g.fr_cover.className+=" dhxwin_fr_cover_dnd";j.css=true}if(j.css_vp!=true){a.vp.className+=" dhxwins_vp_dnd";j.css_vp=true}j.newX=g.conf.x+c;j.newY=g.conf.y+m;if(j.mode=="tr"){j.newX=Math.min(Math.max(j.newX,j.minX),j.maxX);c=j.newX-g.conf.x;j.newY=Math.min(Math.max(j.newY,j.minY),j.maxY);m=j.newY-g.conf.y;g.win.style[j.tr]="translate("+c+"px,"+m+"px)"}else{if(j.newX<j.minX||j.newX>j.maxX){j.newX=Math.min(Math.max(j.newX,j.minX),j.maxX)}else{j.x=a._dndPos(l,"X")}if(j.newY<j.minY||j.newY>j.maxY){j.newY=Math.min(Math.max(j.newY,j.minY),j.maxY)}else{j.y=a._dndPos(l,"Y")}a._winSetPosition(j.id,j.newX,j.newY)}j.moved=true;g=j=null};this._dndOnMouseUp=function(j){j=j||event;if(a.conf.dnd!=null){var g=a.conf.dnd;var c=a.w[g.id];if(g.newX!=null){if(g.mode=="tr"){a._winSetPosition(g.id,g.newX,g.newY);c.win.style[g.tr]="translate(0px,0px)"}}if(g.css==true){if(g.css_touch==false){c.win.className=String(c.win.className).replace(/\s{0,}dhxwin_dnd/gi,"")}c.fr_cover.className=String(c.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_dnd/gi,"")}if(g.css_touch==true){c.win.className=String(c.win.className).replace(/\s{0,}dhxwin_dnd_touch/gi,"")}if(g.css_vp==true){a.vp.className=String(a.vp.className).replace(/\s{0,}dhxwins_vp_dnd/gi,"")}a._dndUnloadEvents();if(g.moved==true){a._callMainEvent("onMoveFinish",g.id)}else{a._callMainEvent("onMoveCancel",g.id)}c=g=a.conf.dnd=null}if(window.dhx4.isIE==true&&j.type==a.conf.dnd_evs.end&&window.navigator.msPointerEnabled==true){document.body.style.msTouchAction="";window.removeEventListener(a.conf.dnd_evs.end,a._dndOnMouseUp,false);window.removeEventListener(a.conf.dnd_evs.move,a._dndOnMouseMove,false);if(a.conf.dnd_tm!=null){window.clearTimeout(a.conf.dnd_tm)}a.conf.dnd_tm=null}};this._dndOnSelectStart=function(c){c=c||event;if(c.preventDefault){c.preventDefault()}else{c.returnValue=false}return false};this._dndInitEvents=function(){if(typeof(window.addEventListener)=="function"){window.addEventListener("mousemove",this._dndOnMouseMove,false);window.addEventListener("mouseup",this._dndOnMouseUp,false);window.addEventListener("selectstart",this._dndOnSelectStart,false)}else{document.body.attachEvent("onmousemove",this._dndOnMouseMove);document.body.attachEvent("onmouseup",this._dndOnMouseUp);document.body.attachEvent("onselectstart",this._dndOnSelectStart)}};this._dndUnloadEvents=function(){if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousemove",this._dndOnMouseMove,false);window.removeEventListener("mouseup",this._dndOnMouseUp,false);window.removeEventListener("selectstart",this._dndOnSelectStart,false)}else{document.body.detachEvent("onmousemove",this._dndOnMouseMove);document.body.detachEvent("onmouseup",this._dndOnMouseUp);document.body.detachEvent("onselectstart",this._dndOnSelectStart)}};this._dndUnloadModule=function(){this.detachEvent(this.conf.dnd_evid);this.conf.dnd_evid=null;this._dndOnMouseDown=null;this._dndOnMouseMove=null;this._dndOnMouseUp=null;this._dndOnSelectStart=null;this._dndInitEvents=null;this._dndUnloadEvents=null;this._dndInitModule=null;this._dndUnloadModule=null;a=null};this._dndPos=function(g,c){var j=g[this.conf.dnd_ev_prefix+c];if(j==null){j=e.touches[0][this.conf.dnd_ev_prefix+c]}return j};this.conf.dnd_evid=this.attachEvent("_winMouseDown",function(g,c){if(g.type==this.conf.dnd_evs.start){if(c.mode=="hdr"){if(this.w[c.id].conf.maxed&&this.w[c.id].conf.max_w==null&&this.w[c.id].conf.max_h==null){return}this.conf.dnd_ev_prefix="page";this.conf.dnd={x:this._dndPos(g,"X"),y:this._dndPos(g,"Y")};if(this.conf.dnd_time<1){this._dndOnMouseDown(g,c.id)}else{if(this.conf.dnd_tm!=null){window.clearTimeout(this.conf.dnd_tm)}this.conf.dnd_tm=window.setTimeout(function(){a._dndOnMouseDown(g,c.id)},this.conf.dnd_time)}if(window.dhx4.isIE==true&&window.navigator.msPointerEnabled==true){document.body.style.msTouchAction="none";window.addEventListener(this.conf.dnd_evs.end,this._dndOnMouseUp,false)}window.addEventListener(this.conf.dnd_evs.move,this._dndOnMouseMove,false)}return false}if(g.type==this.conf.dnd_evs.end){if(this.conf.dnd_tm!=null){window.clearTimeout(this.conf.dnd_tm);this.conf.dnd_tm=null}this._dndOnMouseUp();window.removeEventListener(this.conf.dnd_evs.move,this._dndOnMouseMove,false);return false}if(g.button>=2){return}this.conf.dnd_ev_prefix="client";if(!(c.mode=="hdr"&&g.type=="mousedown"&&this.w[c.id].conf.allow_move==true)){return}if(this.w[c.id].conf.maxed&&this.w[c.id].conf.max_w==null&&this.w[c.id].conf.max_h==null){return}if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}this._dndOnMouseDown(g,c.id);return false})};dhtmlXWindowsCell.prototype._initResize=function(){var a=this;var c=navigator.userAgent;this.conf.resize={b_width:6,c_type:(c.indexOf("MSIE 10.0")>0||c.indexOf("MSIE 9.0")>0||c.indexOf("MSIE 8.0")>0||c.indexOf("MSIE 7.0")>0||c.indexOf("MSIE 6.0")>0)};this._rOnCellMouseMove=function(n){if(a.wins.conf.resize_actv==true||a.wins.w[a._idd].conf.allow_resize==false||a.conf.progress==true||a.wins.w[a._idd].conf.maxed==true||a.wins.w[a._idd].conf.fs_mode==true){var l=a.wins.w[a._idd].brd;if(l.style.cursor!="default"){l.style.cursor="default"}l=null;return}n=n||event;var v=a.wins.w[a._idd].brd;var g=a.conf.resize;var q=(a.wins.w[a._idd].conf.header==false);var s=n.clientX;var o=n.clientY;var j=window.dhx4.absLeft(v);var u=window.dhx4.absTop(v);var m="";if(s<=j+g.b_width){m="w"}else{if(s>=j+v.offsetWidth-g.b_width){m="e"}}if(o>=u+v.offsetHeight-g.b_width){m="s"+m}else{if(q&&o<=u+g.b_width){m="n"+m}}if(m==""){m=false}if(g.mode!=m){g.mode=m;if(m==false){v.style.cursor="default"}else{v.style.cursor=m+"-resize"}}v=g=null};this._rOnCellMouseDown=function(m){if(a.conf.resize.mode==false){return}if(a.conf.progress==true){return}if(a.wins.w[a._idd].conf.allow_resize==false){return}if(a.wins.w[a._idd].conf.fs_mode==true){return}if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}if(a.wins._callMainEvent("onBeforeResizeStart",a._idd)!==true){return}var g=a.wins.w[a._idd];var l=a.conf.resize;a.wins.conf.resize_actv=true;l.min_w=g.conf.min_w;l.min_h=g.conf.min_h;l.max_w=g.conf.max_w||+Infinity;l.max_h=g.conf.max_h||+Infinity;if(g.cell.dataType=="layout"&&g.cell.dataObj!=null&&typeof(g.cell.dataObj._getWindowMinDimension)=="function"){var j=g.cell.dataObj._getWindowMinDimension(g.cell);l.min_w=Math.max(j.w,l.min_w);l.min_h=Math.max(j.h,l.min_h)}l.vp_l=a.wins.conf.vp_pos_ofs;l.vp_r=a.wins.vp.clientWidth-a.wins.conf.vp_pos_ofs;l.vp_b=a.wins.vp.clientHeight-a.wins.conf.vp_pos_ofs;l.x=m.clientX;l.y=m.clientY;if(typeof(window.addEventListener)=="function"){window.addEventListener("mousemove",a._rOnWinMouseMove,false);window.addEventListener("mouseup",a._rOnWinMouseUp,false);window.addEventListener("selectstart",a._rOnSelectStart,false)}else{document.body.attachEvent("onmousemove",a._rOnWinMouseMove);document.body.attachEvent("onmouseup",a._rOnWinMouseUp);document.body.attachEvent("onselectstart",a._rOnSelectStart)}l.resized=false;l.vp_cursor=a.wins.vp.style.cursor;a.wins.vp.style.cursor=l.mode+"-resize";g=l=null};this._rOnWinMouseMove=function(m){m=m||event;var j=a.wins.w[a._idd];var l=a.conf.resize;if(!l.resized){j.fr_cover.className+=" dhxwin_fr_cover_resize";l.resized=true}var g=m.clientX-l.x;var n=m.clientY-l.y;if(l.mode.indexOf("e")>=0){l.rw=Math.min(Math.max(j.conf.w+g,l.min_w),l.max_w);l.rx=null;if(j.conf.x+l.rw<l.vp_l){l.rw=l.vp_l-j.conf.x}else{if(j.conf.x+l.rw>a.wins.vp.clientWidth){l.rw=a.wins.vp.clientWidth-j.conf.x}}}else{if(l.mode.indexOf("w")>=0){l.rw=Math.min(Math.max(j.conf.w-g,l.min_w),l.max_w);l.rx=j.conf.x+j.conf.w-l.rw;if(l.rx<0){l.rw=l.rw+l.rx;l.rx=0}else{if(l.rx>l.vp_r){l.rw=l.rw-l.vp_r;l.rx=l.vp_r}}}}if(l.mode.indexOf("s")>=0){l.rh=Math.min(Math.max(j.conf.h+n,l.min_h),l.max_h);l.ry=null;if(j.conf.y+l.rh>a.wins.vp.clientHeight){l.rh=a.wins.vp.clientHeight-j.conf.y}}else{if(l.mode.indexOf("n")>=0){l.rh=Math.min(Math.max(j.conf.h-n,l.min_h),l.max_h);l.ry=j.conf.y+j.conf.h-l.rh;if(l.ry<0){l.rh=l.rh+l.ry;l.ry=0}else{if(l.ry>l.vp_b){l.rh=l.rh-l.vp_b;l.ry=l.vp_b}}}}a._rAdjustSizer();j=l=null};this._rOnWinMouseUp=function(){var j=a.conf.resize;var g=a.wins.w[a._idd];a.wins.conf.resize_actv=false;a.wins.vp.style.cursor=j.vp_cursor;g.fr_cover.className=String(g.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_resize/gi,"");if(j.resized){a.wins._winSetSize(a._idd,j.rw,j.rh);if(j.rx==null){j.rx=g.conf.x}if(j.ry==null){j.ry=g.conf.y}if(j.rx!=g.conf.x||j.ry!=g.conf.y){a.wins._winSetPosition(a._idd,j.rx,j.ry)}}if(j.obj!=null){j.obj.parentNode.removeChild(j.obj);j.obj=null}if(j.objFR!=null){j.objFR.parentNode.removeChild(j.objFR);j.objFR=null}if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousemove",a._rOnWinMouseMove,false);window.removeEventListener("mouseup",a._rOnWinMouseUp,false);window.removeEventListener("selectstart",a._rOnSelectStart,false)}else{document.body.detachEvent("onmousemove",a._rOnWinMouseMove);document.body.detachEvent("onmouseup",a._rOnWinMouseUp);document.body.detachEvent("onselectstart",a._rOnSelectStart)}if(j.resized==true){if(a.dataType=="layout"&&a.dataObj!=null){a.dataObj.callEvent("onResize",[])}a.wins._callMainEvent("onResizeFinish",a._idd)}else{a.wins._callMainEvent("onResizeCancel",a._idd)}j.mode="";g=j=null};this._rOnSelectStart=function(g){g=g||event;if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false};this._rInitSizer=function(){var j=a.conf.resize;var g=a.wins.w[a._idd];j.obj=document.createElement("DIV");j.obj.className="dhxwin_resize";j.obj.style.zIndex=g.win.style.zIndex;j.obj.style.cursor=j.mode+"-resize";a.wins.vp.appendChild(j.obj);if(a.wins.conf.fr_cover==true){j.objFR=document.createElement("IFRAME");j.objFR.className="dhxwin_resize_fr_cover";j.objFR.style.zIndex=j.obj.style.zIndex;a.wins.vp.insertBefore(j.objFR,j.obj)}j.rx=g.conf.x;j.ry=g.conf.y;j.rw=g.conf.w;j.rh=g.conf.h;j=null};this._rAdjustSizer=function(){var g=a.conf.resize;if(!g.obj){this._rInitSizer()}g.obj.style.width=g.rw+"px";g.obj.style.height=g.rh+"px";if(g.rx!=null){g.obj.style.left=g.rx+"px"}if(g.ry!=null){g.obj.style.top=g.ry+"px"}if(g.objFR!=null){g.objFR.style.width=g.obj.style.width;g.objFR.style.height=g.obj.style.height;if(g.rx!=null){g.objFR.style.left=g.obj.style.left}if(g.ry!=null){g.objFR.style.top=g.obj.style.top}}g=null};if(typeof(window.addEventListener)=="function"){this.wins.w[this._idd].brd.addEventListener("mousemove",this._rOnCellMouseMove,false);this.wins.w[this._idd].brd.addEventListener("mousedown",this._rOnCellMouseDown,false)}else{this.wins.w[this._idd].brd.attachEvent("onmousemove",this._rOnCellMouseMove);this.wins.w[this._idd].brd.attachEvent("onmousedown",this._rOnCellMouseDown)}this._unloadResize=function(){if(typeof(window.addEventListener)=="function"){this.wins.w[this._idd].brd.removeEventListener("mousemove",this._rOnCellMouseMove,false);this.wins.w[this._idd].brd.removeEventListener("mousedown",this._rOnCellMouseDown,false)}else{this.wins.w[this._idd].brd.detachEvent("onmousemove",this._rOnCellMouseMove);this.wins.w[this._idd].brd.detachEvent("onmousedown",this._rOnCellMouseDown)}this._initResize=null;this._rOnCellMouseMove=null;this._rOnCellMouseDown=null;this._rOnWinMouseMove=null;this._rOnWinMouseUp=null;this._rOnSelectStart=null;this._rInitSizer=null;this._rAdjustSizer=null;this._unloadResize=null;this.conf.resize=null;a=null}};dhtmlXWindows.prototype.attachContextMenu=function(a){return this._renderContextMenu("icon",null,null,a)};dhtmlXWindows.prototype.getContextMenu=function(){if(this.cm!=null&&this.cm.global!=null){return this.cm.global}return null};dhtmlXWindows.prototype.detachContextMenu=function(){this._detachContextMenu("icon",null,null)};dhtmlXWindowsCell.prototype.attachContextMenu=function(a){return this.wins._renderContextMenu("icon",this._idd,null,a)};dhtmlXWindowsCell.prototype.getContextMenu=function(){if(this.wins.cm!=null&&this.wins.cm.icon[this._idd]!=null){return this.wins.cm.icon[this._idd]}return null};dhtmlXWindowsCell.prototype.detachContextMenu=function(){this.wins._detachContextMenu("icon",this._idd,null)};dhtmlXWindowsButton.prototype.attachContextMenu=function(a){return this.conf.wins._renderContextMenu("button",this.conf.winId,this.conf.name,a)};dhtmlXWindowsButton.prototype.getContextMenu=function(){if(this.conf.wins.cm==null||this.conf.wins.cm.button[this.conf.winId]==null){return null}if(this.conf.wins.cm.button[this.conf.winId][this.conf.name]!=null){return this.conf.wins.cm.button[this.conf.winId][this.conf.name]}return null};dhtmlXWindowsButton.prototype.detachContextMenu=function(){this.conf.wins._detachContextMenu("button",this.conf.winId,this.conf.name)};dhtmlXWindows.prototype._renderContextMenu=function(n,m,g,c){var j=this;var a=false;if(this.cm==null){this.cm={global:null,icon:{},button:{}};a=true}if(m==null){if(this.cm.global!=null){return}}else{if(n=="icon"){if(this.cm.icon[m]!=null){return}}else{if(n=="button"){if(this.cm.button[m]!=null&&this.cm.button[m][g]!=null){return}}}}if(c==null){c={}}c.parent=null;c.context=true;var l=new dhtmlXMenuObject(c);l.setAutoHideMode(false);l.attachEvent("onShow",function(){this.conf.wins_menu_open=true});l.attachEvent("onHide",function(){this.conf.wins_menu_open=false;j.conf.opened_menu=null});if(m==null){this.cm.global=l}else{if(n=="icon"){this.cm.icon[m]=l}else{if(n=="button"){if(this.cm.button[m]==null){this.cm.button[m]={}}this.cm.button[m][g]=l}}}if(a){this._showContextMenu=function(s,r){if(s.button>=2){return}if(r.mode=="icon"&&r.id!=null&&r.press_type=="mousedown"){var u=this.cm.icon[r.id]||this.cm.global;if(u==null){return}s.cancelBubble=true;var q=this.w[r.id].hdr.firstChild;if(u.conf.wins_menu_open&&this.conf.opened_menu==r.id){u.hideContextMenu()}else{this._hideContextMenu();u.showContextMenu(window.dhx4.absLeft(q),window.dhx4.absTop(q)+q.offsetHeight);this.conf.opened_menu=r.id}u=q=null}if(r.mode=="button"&&r.id!=null&&r.press_type=="mousedown"){if(this.cm.button[r.id]==null||this.cm.button[r.id][r.button_name]==null){return}s.cancelBubble=true;this.conf.button_last=null;var u=this.cm.button[r.id][r.button_name];var o=this.w[r.id].b[r.button_name].button;if(u.conf.wins_menu_open&&this.conf.opened_menu==r.id){u.hideContextMenu()}else{this._hideContextMenu();u.showContextMenu(window.dhx4.absLeft(o),window.dhx4.absTop(o)+o.offsetHeight);this.conf.opened_menu=r.id}u=o=null}};this._hideContextMenu=function(u){if(u!=null){u=u||event;if(u.type=="keydown"&&u.keyCode!=27){return}var s=u.target||u.srcElement;var q=true;while(s!=null&&q==true){if(s.className!=null&&s.className.search(/SubLevelArea_Polygon/)>=0){q=false}else{s=s.parentNode}}}if(q||u==null){if(j.cm.global!=null){j.cm.global.hideContextMenu()}for(var r in j.cm.icon){if(j.cm.icon[r]!=null){j.cm.icon[r].hideContextMenu()}}for(var r in j.cm.button){for(var o in j.cm.button[r]){if(j.cm.button[r][o]!=null){j.cm.button[r][o].hideContextMenu()}}}}};this._detachContextMenu=function(r,q,o){if(this.cm==null){return}if(q==null){if(this.cm.global!=null){this.cm.global.unload();this.cm.global=null}}else{if(r=="icon"){if(this.cm.icon[q]!=null){this.cm.icon[q].unload();this.cm.icon[q]=null}}else{if(r=="button"){if(this.cm.button[q]!=null&&this.cm.button[q][o]!=null){this.cm.button[q][o].unload();this.cm.button[q][o]=null}}}}};this.attachEvent("_winMouseDown",this._showContextMenu);if(typeof(window.addEventListener)=="function"){window.addEventListener("mousedown",this._hideContextMenu,false);window.addEventListener("keydown",this._hideContextMenu,false)}else{document.body.attachEvent("onmousedown",this._hideContextMenu);document.body.attachEvent("onkeydown",this._hideContextMenu)}this._unloadContextMenu=function(){this._detachContextMenu("icon",null,null);this.cm=null;if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousedown",this._hideContextMenu,false);window.removeEventListener("keydown",this._hideContextMenu,false)}else{document.body.detachEvent("onmousedown",this._hideContextMenu);document.body.detachEvent("onkeydown",this._hideContextMenu)}j=null}}return l};if(!window.dhtmlx){window.dhtmlx={}}(function(){var r=null;function u(A,x){var y=A.callback;s(false);A.box.parentNode.removeChild(A.box);r=A.box=null;if(y){y(x)}}function a(y){if(r){y=y||event;var x=y.which||event.keyCode;if(dhtmlx.message.keyboard){if(x==13||x==32){u(r,true)}if(x==27){u(r,false)}}if(y.preventDefault){y.preventDefault()}return !(y.cancelBubble=true)}}if(document.attachEvent){document.attachEvent("onkeydown",a)}else{document.addEventListener("keydown",a,true)}function s(y){if(!s.cover){s.cover=document.createElement("DIV");s.cover.onkeydown=a;s.cover.className="dhx_modal_cover";document.body.appendChild(s.cover)}var x=document.body.scrollHeight;s.cover.style.display=y?"inline-block":"none"}function m(y,x){return"<div class='dhtmlx_popup_button' result='"+x+"' ><div>"+y+"</div></div>"}function g(y){if(!v.area){v.area=document.createElement("DIV");v.area.className="dhtmlx_message_area";v.area.style[v.position]="5px";document.body.appendChild(v.area)}v.hide(y.id);var x=document.createElement("DIV");x.innerHTML="<div>"+y.text+"</div>";x.className="dhtmlx-info dhtmlx-"+y.type;x.onclick=function(){if(y){v.hide(y.id)}y=null};if(v.position=="bottom"&&v.area.firstChild){v.area.insertBefore(x,v.area.firstChild)}else{v.area.appendChild(x)}if(y.expire>0){v.timers[y.id]=window.setTimeout(function(){v.hide(y.id)},y.expire)}v.pull[y.id]=x;x=null;return y.id}function n(y,C,F){var E=document.createElement("DIV");E.className=" dhtmlx_modal_box dhtmlx-"+y.type;E.setAttribute("dhxbox",1);var x="";if(y.width){E.style.width=y.width}if(y.height){E.style.height=y.height}if(y.title){x+='<div class="dhtmlx_popup_title">'+y.title+"</div>"}x+='<div class="dhtmlx_popup_text"><span>'+(y.content?"":y.text)+'</span></div><div  class="dhtmlx_popup_controls">';if(C){x+=m(y.ok||"OK",true)}if(F){x+=m(y.cancel||"Cancel",false)}if(y.buttons){for(var A=0;A<y.buttons.length;A++){x+=m(y.buttons[A],A)}}x+="</div>";E.innerHTML=x;if(y.content){var D=y.content;if(typeof D=="string"){D=document.getElementById(D)}if(D.style.display=="none"){D.style.display=""}E.childNodes[y.title?1:0].appendChild(D)}E.onclick=function(J){J=J||event;var I=J.target||J.srcElement;if(!I.className){I=I.parentNode}if(I.className=="dhtmlx_popup_button"){var H=I.getAttribute("result");H=(H=="true")||(H=="false"?false:H);u(y,H)}};y.box=E;if(C||F){r=y}return E}function w(C,D,F){var E=C.tagName?C:n(C,D,F);if(!C.hidden){s(true)}document.body.appendChild(E);var A=C.left||Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth)-E.offsetWidth)/2));var H=C.top||Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight)-E.offsetHeight)/2));if(C.position=="top"){E.style.top="-3px"}else{E.style.top=H+"px"}E.style.left=A+"px";E.onkeydown=a;E.focus();if(C.hidden){dhtmlx.modalbox.hide(E)}return E}function q(x){return w(x,true,false)}function c(x){return w(x,true,true)}function l(x){return w(x)}function o(y,x,A){if(typeof y!="object"){if(typeof x=="function"){A=x;x=""}y={text:y,type:x,callback:A}}return y}function j(A,y,x,C){if(typeof A!="object"){A={text:A,type:y,expire:x,id:C}}A.id=A.id||v.uid();A.expire=A.expire||v.expire;return A}dhtmlx.alert=function(){var x=o.apply(this,arguments);x.type=x.type||"confirm";return q(x)};dhtmlx.confirm=function(){var x=o.apply(this,arguments);x.type=x.type||"alert";return c(x)};dhtmlx.modalbox=function(){var x=o.apply(this,arguments);x.type=x.type||"alert";return l(x)};dhtmlx.modalbox.hide=function(x){while(x&&x.getAttribute&&!x.getAttribute("dhxbox")){x=x.parentNode}if(x){x.parentNode.removeChild(x);s(false);r=null}};var v=dhtmlx.message=function(C,A,y,D){C=j.apply(this,arguments);C.type=C.type||"info";var x=C.type.split("-")[0];switch(x){case"alert":return q(C);case"confirm":return c(C);case"modalbox":return l(C);default:return g(C);break}};v.seed=(new Date()).valueOf();v.uid=function(){return v.seed++};v.expire=4000;v.keyboard=true;v.position="top";v.pull={};v.timers={};v.hideAll=function(){for(var x in v.pull){v.hide(x)}};v.hide=function(y){var x=v.pull[y];if(x&&x.parentNode){window.setTimeout(function(){x.parentNode.removeChild(x);x=null},2000);x.className+=" hidden";if(v.timers[y]){window.clearTimeout(v.timers[y])}delete v.pull[y]}}})();if(!window.dhx){dhx={}}dhx.assert=function(c,a){if(!c){dhx.assert_error(a)}};dhx.assert_error=function(message){dhx.log("error",message);if(dhx.message&&typeof message=="string"){dhx.message({type:"debug",text:message,expire:-1})}if(dhx.debug!==false){eval("debugger;")}};dhx.assert_core_ready=function(){if(window.dhx_on_core_ready){dhx_on_core_ready()}};dhx.version="3.0";dhx.codebase="./";dhx.name="Core";dhx.clone=function(c){var a=dhx.clone._function;a.prototype=c;return new a()};dhx.clone._function=function(){};dhx.extend=function(g,c,a){dhx.assert(g,"Invalid mixing target");dhx.assert(c,"Invalid mixing source");if(g._dhx_proto_wait){dhx.PowerArray.insertAt.call(g._dhx_proto_wait,c,1);return g}for(var j in c){if(!g[j]||a){g[j]=c[j]}}if(c.defaults){dhx.extend(g.defaults,c.defaults)}if(c.$init){c.$init.call(g)}return g};dhx.copy=function(a){dhx.assert(a,"Invalid mixing target");if(arguments.length>1){var c=arguments[0];a=arguments[1]}else{var c=(dhx.isArray(a)?[]:{})}for(var g in a){if(a[g]&&typeof a[g]=="object"&&!dhx.isDate(a[g])){c[g]=(dhx.isArray(a[g])?[]:{});dhx.copy(c[g],a[g])}else{c[g]=a[g]}}return c};dhx.single=function(g){var a=null;var c=function(j){if(!a){a=new g({})}if(a._reinit){a._reinit.apply(a,arguments)}return a};return c};dhx.protoUI=function(){if(dhx.debug_proto){dhx.log("UI registered: "+arguments[0].name)}var g=arguments;var a=g[0].name;var c=function(l){if(!c){return dhx.ui[a].prototype}var n=c._dhx_proto_wait;if(n){var m=[n[0]];for(var j=1;j<n.length;j++){m[j]=n[j];if(m[j]._dhx_proto_wait){m[j]=m[j].call(dhx,m[j].name)}if(m[j].prototype&&m[j].prototype.name){dhx.ui[m[j].prototype.name]=m[j]}}dhx.ui[a]=dhx.proto.apply(dhx,m);if(c._dhx_type_wait){for(var j=0;j<c._dhx_type_wait.length;j++){dhx.Type(dhx.ui[a],c._dhx_type_wait[j])}}c=n=null}if(this!=dhx){return new dhx.ui[a](l)}else{return dhx.ui[a]}};c._dhx_proto_wait=Array.prototype.slice.call(arguments,0);return dhx.ui[a]=c};dhx.proto=function(){if(dhx.debug_proto){dhx.log("Proto chain:"+arguments[0].name+"["+arguments.length+"]")}var m=arguments;var l=m[0];var c=!!l.$init;var o=[];dhx.assert(l,"Invalid mixing target");for(var j=m.length-1;j>0;j--){dhx.assert(m[j],"Invalid mixing source");if(typeof m[j]=="function"){m[j]=m[j].prototype}if(m[j].$init){o.push(m[j].$init)}if(m[j].defaults){var g=m[j].defaults;if(!l.defaults){l.defaults={}}for(var a in g){if(dhx.isUndefined(l.defaults[a])){l.defaults[a]=g[a]}}}if(m[j].type&&l.type){for(var a in m[j].type){if(!l.type[a]){l.type[a]=m[j].type[a]}}}for(var n in m[j]){if(!l[n]){l[n]=m[j][n]}}}if(c){o.push(l.$init)}l.$init=function(){for(var r=0;r<o.length;r++){o[r].apply(this,arguments)}};var q=function(r){this.$ready=[];dhx.assert(this.$init,"object without init method");this.$init(r);if(this._parseSettings){this._parseSettings(r,this.defaults)}for(var s=0;s<this.$ready.length;s++){this.$ready[s].call(this)}};q.prototype=l;l=m=null;return q};dhx.bind=function(c,a){return function(){return c.apply(a,arguments)}};dhx.require=function(c,o,n){if(typeof c!="string"){var m=c.length||0;var l=o;if(!m){for(var a in c){m++}o=function(){m--;if(m===0){l.apply(this,arguments)}};for(var a in c){dhx.require(a,o,n)}}else{o=function(){if(m){m--;dhx.require(c[c.length-m-1],o,n)}else{return l.apply(this,arguments)}};o()}return}if(dhx._modules[c]!==true){if(c.substr(-4)==".css"){var j=dhx.html.create("LINK",{type:"text/css",rel:"stylesheet",href:dhx.codebase+c});document.head.appendChild(j);if(o){o.call(n||window)}return}var g=arguments[4];if(!o){dhx.exec(dhx.ajax().sync().get(dhx.codebase+c).responseText);dhx._modules[c]=true}else{if(!dhx._modules[c]){dhx._modules[c]=[[o,n]];dhx.ajax(dhx.codebase+c,function(s){dhx.exec(s);var r=dhx._modules[c];dhx._modules[c]=true;for(var q=0;q<r.length;q++){r[q][0].call(r[q][1]||window,!q)}})}else{dhx._modules[c].push([o,n])}}}};dhx._modules={};dhx.exec=function(code){if(window.execScript){window.execScript(code)}else{window.eval(code)}};dhx.wrap=function(c,a){if(!c){return a}return function(){var g=c.apply(this,arguments);a.apply(this,arguments);return g}};dhx.isUndefined=function(c){return typeof c=="undefined"};dhx.delay=function(j,c,g,a){return window.setTimeout(function(){var l=j.apply(c,(g||[]));j=c=g=null;return l},a||1)};dhx.uid=function(){if(!this._seed){this._seed=(new Date).valueOf()}this._seed++;return this._seed};dhx.toNode=function(a){if(typeof a=="string"){return document.getElementById(a)}return a};dhx.toArray=function(a){return dhx.extend((a||[]),dhx.PowerArray,true)};dhx.toFunctor=function(str){return(typeof(str)=="string")?eval(str):str};dhx.isArray=function(a){return Array.isArray?Array.isArray(a):(Object.prototype.toString.call(a)==="[object Array]")};dhx.isDate=function(a){return a instanceof Date};dhx._events={};dhx.event=function(j,g,a,c){j=dhx.toNode(j);var l=dhx.uid();if(c){a=dhx.bind(a,c)}dhx._events[l]=[j,g,a];if(j.addEventListener){j.addEventListener(g,a,false)}else{if(j.attachEvent){j.attachEvent("on"+g,a)}}return l};dhx.eventRemove=function(c){if(!c){return}dhx.assert(this._events[c],"Removing non-existing event");var a=dhx._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]};dhx.log=function(c,g,a){if(arguments.length==1){g=c;c="log"}if(window.console&&console.log){c=c.toLowerCase();if(window.console[c]){window.console[c](g||"unknown error")}else{window.console.log(c+": "+g)}if(a){window.console.log(a)}}};dhx.log_full_time=function(a){dhx._start_time_log=new Date();dhx.log("Timing start ["+a+"]");window.setTimeout(function(){var c=new Date();dhx.log("Timing end ["+a+"]:"+(c.valueOf()-dhx._start_time_log.valueOf())/1000+"s")},1)};dhx.log_time=function(a){var g="_start_time_log"+a;if(!dhx[g]){dhx[g]=new Date();dhx.log("Info","Timing start ["+a+"]")}else{var c=new Date();dhx.log("Info","Timing end ["+a+"]:"+(c.valueOf()-dhx[g].valueOf())/1000+"s");dhx[g]=null}};dhx.debug_code=function(a){a.call(dhx)};dhx.EventSystem={$init:function(){if(!this._evs_events){this._evs_events={};this._evs_handlers={};this._evs_map={}}},blockEvent:function(){this._evs_events._block=true},unblockEvent:function(){this._evs_events._block=false},mapEvent:function(a){dhx.extend(this._evs_map,a,true)},on_setter:function(a){if(a){for(var c in a){if(typeof a[c]=="function"){this.attachEvent(c,a[c])}}}},callEvent:function(g,l){if(this._evs_events._block){return true}g=g.toLowerCase();var j=this._evs_events[g.toLowerCase()];var a=true;if(dhx.debug){dhx.log("info","["+this.name+"] event:"+g,l)}if(j){for(var c=0;c<j.length;c++){if(j[c].apply(this,(l||[]))===false){a=false}}}if(this._evs_map[g]&&!this._evs_map[g].callEvent(g,l)){a=false}return a},attachEvent:function(c,a,j){dhx.assert(a,"Invalid event handler for "+c);c=c.toLowerCase();j=j||dhx.uid();a=dhx.toFunctor(a);var g=this._evs_events[c]||dhx.toArray();g.push(a);this._evs_events[c]=g;this._evs_handlers[j]={f:a,t:c};return j},detachEvent:function(j){if(!this._evs_handlers[j]){return}var c=this._evs_handlers[j].t;var a=this._evs_handlers[j].f;var g=this._evs_events[c];g.remove(a);delete this._evs_handlers[j]},hasEvent:function(a){a=a.toLowerCase();return this._evs_events[a]?true:false}};dhx.extend(dhx,dhx.EventSystem);dhx.PowerArray={removeAt:function(c,a){if(c>=0){this.splice(c,(a||1))}},remove:function(a){this.removeAt(this.find(a))},insertAt:function(c,g){if(!g&&g!==0){this.push(c)}else{var a=this.splice(g,(this.length-g));this[g]=c;this.push.apply(this,a)}},find:function(c){for(var a=0;a<this.length;a++){if(c==this[a]){return a}}return -1},each:function(a,g){for(var c=0;c<this.length;c++){a.call((g||this),this[c])}},map:function(a,g){for(var c=0;c<this.length;c++){this[c]=a.call((g||this),this[c])}return this},filter:function(a,g){for(var c=0;c<this.length;c++){if(!a.call((g||this),this[c])){this.splice(c,1);c--}}return this}};dhx.env={};(function(){if(navigator.userAgent.indexOf("Mobile")!=-1){dhx.env.mobile=true}if(dhx.env.mobile||navigator.userAgent.indexOf("iPad")!=-1||navigator.userAgent.indexOf("Android")!=-1){dhx.env.touch=true}if(navigator.userAgent.indexOf("Opera")!=-1){dhx.env.isOpera=true}else{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=true}dhx.env.transform=false;dhx.env.transition=false;var g={};g.names=["transform","transition"];g.transform=["transform","WebkitTransform","MozTransform","OTransform","msTransform"];g.transition=["transition","WebkitTransition","MozTransition","OTransition","msTransition"];var o=document.createElement("DIV");for(var m=0;m<g.names.length;m++){var l=g[g.names[m]];for(var c=0;c<l.length;c++){if(typeof o.style[l[c]]!="undefined"){dhx.env[g.names[m]]=l[c];break}}}o.style[dhx.env.transform]="translate3d(0,0,0)";dhx.env.translate=(o.style[dhx.env.transform])?"translate3d":"translate";var n="";var a=false;if(dhx.env.isOpera){n="-o-";a="O"}if(dhx.env.isFF){n="-Moz-"}if(dhx.env.isWebKit){n="-webkit-"}if(dhx.env.isIE){n="-ms-"}dhx.env.transformCSSPrefix=n;dhx.env.transformPrefix=a||(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={_native_on_selectstart:0,denySelect:function(){if(!dhx._native_on_selectstart){dhx._native_on_selectstart=document.onselectstart}document.onselectstart=dhx.html.stopEvent},allowSelect:function(){if(dhx._native_on_selectstart!==0){document.onselectstart=dhx._native_on_selectstart||null}dhx._native_on_selectstart=0},index:function(c){var a=0;while(c=c.previousSibling){a++}return a},_style_cache:{},createCss:function(g){var j="";for(var c in g){j+=c+":"+g[c]+";"}var a=this._style_cache[j];if(!a){a="s"+dhx.uid();this.addStyle("."+a+"{"+j+"}");this._style_cache[j]=a}return a},addStyle:function(c){var a=document.createElement("style");a.setAttribute("type","text/css");a.setAttribute("media","screen");if(a.styleSheet){a.styleSheet.cssText=c}else{a.appendChild(document.createTextNode(c))}document.getElementsByTagName("head")[0].appendChild(a)},create:function(c,a,g){a=a||{};var j=document.createElement(c);for(var l in a){j.setAttribute(l,a[l])}if(a.style){j.style.cssText=a.style}if(a["class"]){j.className=a["class"]}if(g){j.innerHTML=g}return j},getValue:function(a){a=dhx.toNode(a);if(!a){return""}return dhx.isUndefined(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,g,a){if(!c){return}if(g&&g.parentNode){g.parentNode.insertBefore(c,g)}else{a.appendChild(c)}},locate:function(c,j){if(c.tagName){var a=c}else{c=c||event;var a=c.target||c.srcElement}while(a){if(a.getAttribute){var g=a.getAttribute(j);if(g){return g}}a=a.parentNode}return null},offset:function(j){if(j.getBoundingClientRect){var n=j.getBoundingClientRect();var o=document.body;var c=document.documentElement;var a=window.pageYOffset||c.scrollTop||o.scrollTop;var l=window.pageXOffset||c.scrollLeft||o.scrollLeft;var m=c.clientTop||o.clientTop||0;var q=c.clientLeft||o.clientLeft||0;var r=n.top+a-m;var g=n.left+l-q;return{y:Math.round(r),x:Math.round(g)}}else{var r=0,g=0;while(j){r=r+parseInt(j.offsetTop,10);g=g+parseInt(j.offsetLeft,10);j=j.offsetParent}return{y:r,x:g}}},posRelative:function(a){a=a||event;if(!dhx.isUndefined(a.offsetX)){return{x:a.offsetX,y:a.offsetY}}else{return{x:a.layerX,y:a.layerY}}},pos:function(a){a=a||event;if(a.pageX||a.pageY){return{x:a.pageX,y:a.pageY}}var c=((dhx.env.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()}return dhx.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"),"")}};dhx.ready=function(a){if(this._ready){a.call()}else{this._ready_code.push(a)}};dhx._ready_code=[];(function(){var a=document.getElementsByTagName("SCRIPT");dhx.assert(a.length,"Can't locate codebase");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(){dhx4.callEvent("onReady",[]);dhx.delay(function(){dhx._ready=true;for(var c=0;c<dhx._ready_code.length;c++){dhx._ready_code[c].call()}dhx._ready_code=[]})})})();dhx.locale=dhx.locale||{};dhx.assert_core_ready();dhx.ready(function(){dhx.event(document.body,"click",function(a){dhx4.callEvent("onClick",[a||event])})});(function(){var g={};var c=new RegExp("(\\r\\n|\\n)","g");var a=new RegExp('(\\")',"g");dhx.Template=function(l){if(typeof l=="function"){return l}if(g[l]){return g[l]}l=(l||"").toString();if(l.indexOf("->")!=-1){l=l.split("->");switch(l[0]){case"html":l=dhx.html.getValue(l[1]);break;case"http":l=new dhx.ajax().sync().get(l[1],{uid:dhx.uid()}).responseText;break;default:break}}l=(l||"").toString();l=l.replace(c,"\\n");l=l.replace(a,'\\"');l=l.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"');l=l.replace(/\{common\.([^}\(]*)\}/g,"\"+(common.$1||'')+\"");l=l.replace(/\{common\.([^\}\(]*)\(\)\}/g,'"+(common.$1?common.$1.apply(this, arguments):"")+"');l=l.replace(/\{obj\.([^}]*)\}/g,'"+(obj.$1)+"');l=l.replace("{obj}",'"+obj+"');l=l.replace(/#([^#'";, ]+)#/gi,'"+(obj.$1)+"');try{g[l]=Function("obj","common",'return "'+l+'";')}catch(j){dhx.assert_error("Invalid template:"+l)}return g[l]};dhx.Template.empty=function(){return""};dhx.Template.bind=function(j){return dhx.bind(dhx.Template(j),this)};dhx.Type=function(o,n){if(o._dhx_proto_wait){if(!o._dhx_type_wait){o._dhx_type_wait=[]}o._dhx_type_wait.push(n);return}if(typeof o=="function"){o=o.prototype}if(!o.types){o.types={"default":o.type};o.type.name="default"}var j=n.name;var m=o.type;if(j){m=o.types[j]=dhx.clone(n.baseType?o.types[n.baseType]:o.type)}for(var l in n){if(l.indexOf("template")===0){m[l]=dhx.Template(n[l])}else{m[l]=n[l]}}return j}})();dhx.Settings={$init:function(){this._settings=this.config={}},define:function(c,a){if(typeof c=="object"){return this._parseSeetingColl(c)}return this._define(c,a)},_define:function(c,a){var g=this[c+"_setter"];return this._settings[c]=g?g.call(this,a,c):a},_parseSeetingColl:function(g){if(g){for(var c in g){this._define(c,g[c])}}},_parseSettings:function(g,a){var c={};if(a){c=dhx.extend(c,a)}if(typeof g=="object"&&!g.tagName){dhx.extend(c,g,true)}this._parseSeetingColl(c)},_mergeSettings:function(a,g){for(var c in g){switch(typeof a[c]){case"object":a[c]=this._mergeSettings((a[c]||{}),g[c]);break;case"undefined":a[c]=g[c];break;default:break}}return a},debug_freid_c_id:true,debug_freid_a_name:true};dhx.ajax=function(a,c,g){if(arguments.length!==0){var j=new dhx.ajax();if(g){j.master=g}return j.get(a,null,c)}if(!this.getXHR){return new dhx.ajax()}return this};dhx.ajax.count=0;dhx.ajax.prototype={master:null,getXHR:function(){if(dhx.env.isIE){return new ActiveXObject("Microsoft.xmlHTTP")}else{return new XMLHttpRequest()}},send:function(l,q,n){var c=this.getXHR();if(!dhx.isArray(n)){n=[n]}if(typeof q=="object"){var m=[];for(var g in q){var o=q[g];if(o===null||o===dhx.undefined){o=""}m.push(g+"="+encodeURIComponent(o))}q=m.join("&")}if(q&&this.request==="GET"){l=l+(l.indexOf("?")!=-1?"&":"?")+q;q=null}c.open(this.request,l,!this._sync);if(this.request==="POST"){c.setRequestHeader("Content-type","application/x-www-form-urlencoded")}var j=this;c.onreadystatechange=function(){if(!c.readyState||c.readyState==4){if(dhx.debug_time){dhx.log_full_time("data_loading")}dhx.ajax.count++;if(n&&j){for(var a=0;a<n.length;a++){if(n[a]){var r=(n[a].success||n[a]);if(c.status>=400||(!c.status&&!c.responseText)){r=n[a].error}if(r){r.call((j.master||j),c.responseText,c.responseXML,c)}}}}if(j){j.master=null}n=j=null}};c.send(q||null);return c},get:function(a,g,c){if(arguments.length==2){c=g;g=null}this.request="GET";return this.send(a,g,c)},post:function(a,g,c){this.request="POST";return this.send(a,g,c)},put:function(a,g,c){this.request="PUT";return this.send(a,g,c)},del:function(a,g,c){this.request="DELETE";return this.send(a,g,c)},sync:function(){this._sync=true;return this},bind:function(a){this.master=a;return this}};dhx.send=function(g,c,n,m){var j=dhx.html.create("FORM",{target:(m||"_self"),action:g,method:(n||"POST")},"");for(var a in c){var l=dhx.html.create("INPUT",{type:"hidden",name:a,value:c[a]},"");j.appendChild(l)}j.style.display="none";document.body.appendChild(j);j.submit();document.body.removeChild(j)};dhx.AtomDataLoader={$init:function(a){this.data={};if(a){this._settings.datatype=a.datatype||"json";this.$ready.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},debug_freid_c_datatype:true,debug_freid_c_dataFeed:true,load:function(a,c){if(a.$proxy){a.load(this,typeof c=="string"?c:"json");return}this.callEvent("onXLS",[]);if(typeof c=="string"){this.data.driver=dhx.DataDriver[c];c=arguments[2]}else{if(!this.data.driver){this.data.driver=dhx.DataDriver.json}}var g=[{success:this._onLoad,error:this._onLoadError}];if(c){if(dhx.isArray(c)){g.push.apply(g,c)}else{g.push(c)}}return dhx.ajax(a,g,this)},parse:function(c,a){this.callEvent("onXLS",[]);this.data.driver=dhx.DataDriver[a||"json"];this._onLoad(c,null)},_onLoad:function(n,c,a,g){var l=this.data.driver;var j=l.toObject(n,c);if(j){var m=l.getRecords(j)[0];this.data=(l?l.getDetails(m):n)}else{this._onLoadError(n,c,a)}this.callEvent("onXLE",[])},_onLoadError:function(g,a,c){this.callEvent("onXLE",[]);this.callEvent("onLoadError",arguments);dhx4.callEvent("onLoadError",[g,a,c,this])},_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",[]);dhx.ajax(a,function(m,j,g){this._ignore_feed=true;var l=dhx.DataDriver.toObject(m,j);if(l){this.setValues(l.getDetails(l.getRecords()[0]))}else{this._onLoadError(m,j,g)}this._ignore_feed=false;this.callEvent("onXLE",[])},this);return false}};dhx.DataDriver={};dhx.DataDriver.json={toObject:function(data){if(!data){data="[]"}if(typeof data=="string"){try{eval("dhx.temp="+data)}catch(e){dhx.assert_error(e);return null}data=dhx.temp}if(data.data){var t=data.data.config={};for(var key in data){if(key!="data"){t[key]=data[key]}}data=data.data}return data},getRecords:function(a){if(a&&!dhx.isArray(a)){return[a]}return a},getDetails:function(a){if(typeof a=="string"){return{id:dhx.uid(),value:a}}return a},getInfo:function(c){var a=c.config;if(!a){return{}}return{_size:(a.total_count||0),_from:(a.pos||0),_parent:(a.parent||0),_config:(a.config),_key:(a.dhx_security)}},child:"data"};dhx.DataDriver.html={toObject:function(c){if(typeof c=="string"){var a=null;if(c.indexOf("<")==-1){a=dhx.toNode(c)}if(!a){a=document.createElement("DIV");a.innerHTML=c}return a.getElementsByTagName(this.tag)}return c},getRecords:function(c){var g=[];for(var a=0;a<c.childNodes.length;a++){var j=c.childNodes[a];if(j.nodeType==1){g.push(j)}}return g},getDetails:function(a){return dhx.DataDriver.xml.tagToObject(a)},getInfo:function(a){return{_size:0,_from:0}},tag:"LI"};dhx.DataDriver.jsarray={toObject:function(data){if(typeof data=="string"){eval("dhx.temp="+data);return dhx.temp}return data},getRecords:function(a){return a},getDetails:function(g){var a={};for(var c=0;c<g.length;c++){a["data"+c]=g[c]}return a},getInfo:function(a){return{_size:0,_from:0}}};dhx.DataDriver.csv={toObject:function(a){return a},getRecords:function(a){return a.split(this.row)},getDetails:function(g){g=this.stringToArray(g);var a={};for(var c=0;c<g.length;c++){a["data"+c]=g[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:","};dhx.DataDriver.xml={_isValidXML:function(a){if(!a||!a.documentElement){return null}if(a.getElementsByTagName("parsererror").length){return null}return a},toObject:function(g,a){if(this._isValidXML(c)){return c}if(typeof g=="string"){var c=this.fromString(g.replace(/^[\s]+/,""))}else{c=g}if(this._isValidXML(c)){return c}return null},getRecords:function(a){return this.xpath(a,this.records)},records:"/*/item",child:"item",config:"/*/config",getDetails:function(a){return this.tagToObject(a,{})},getInfo:function(c){var a=this.xpath(c,this.config);if(a.length){a=this.assignTypes(this.tagToObject(a[0],{}))}else{a=null}return{_size:(c.documentElement.getAttribute("total_count")||0),_from:(c.documentElement.getAttribute("pos")||0),_parent:(c.documentElement.getAttribute("parent")||0),_config:a,_key:(c.documentElement.getAttribute("dhx_security")||null)}},xpath:function(j,q){if(window.XPathResult){var g=j;if(j.nodeName.indexOf("document")==-1){j=j.ownerDocument}var n=[];var c=j.evaluate(q,g,null,XPathResult.ANY_TYPE,null);var o=c.iterateNext();while(o){n.push(o);o=c.iterateNext()}return n}else{var m=true;try{if(typeof(j.selectNodes)=="undefined"){m=false}}catch(l){}if(m){return j.selectNodes(q)}else{var a=q.split("/").pop();return j.getElementsByTagName(a)}}},assignTypes:function(c){for(var a in c){var g=c[a];if(typeof g=="object"){this.assignTypes(g)}else{if(typeof g=="string"){if(g===""){continue}if(g=="true"){c[a]=true}else{if(g=="false"){c[a]=false}else{if(g==g*1){c[a]=c[a]*1}}}}}}return c},tagToObject:function(g,q){q=q||{};var l=false;var j=g.attributes;if(j&&j.length){for(var n=0;n<j.length;n++){q[j[n].name]=j[n].value}l=true}var c=g.childNodes;var o={};for(var n=0;n<c.length;n++){if(c[n].nodeType==1){var m=c[n].tagName;if(typeof q[m]!="undefined"){if(!dhx.isArray(q[m])){q[m]=[q[m]]}q[m].push(this.tagToObject(c[n],{}))}else{q[c[n].tagName]=this.tagToObject(c[n],{})}l=true}}if(!l){return this.nodeValue(g)}q.value=q.value||this.nodeValue(g);return q},nodeValue:function(a){if(a.firstChild){return a.firstChild.data}return""},fromString:function(g){try{if(window.DOMParser){return(new DOMParser()).parseFromString(g,"text/xml")}if(window.ActiveXObject){var a=new ActiveXObject("Microsoft.xmlDOM");a.loadXML(g);return a}}catch(c){dhx.assert_error(c);return null}dhx.assert_error("Load from xml string is not supported")}};dhx.DataLoader=dhx.proto({$init:function(a){a=a||"";this._ajax_queue=dhx.toArray();this.data=new dhx.DataStore();this.data.attachEvent("onClearAll",dhx.bind(this._call_onclearall,this));this.data.attachEvent("onServerConfig",dhx.bind(this._call_on_config,this));this.data.feed=this._feed},_feed:function(g,a,c){if(this._load_count){return this._load_count=[g,a,c]}else{this._load_count=true}this._feed_last=[g,a];this._feed_common.call(this,g,a,c)},_feed_common:function(j,c,g){var a=this.data.url;if(j<0){j=0}this.load(a+((a.indexOf("?")==-1)?"?":"&")+(this.dataCount()?("continue=true&"):"")+"start="+j+"&count="+c,[this._feed_callback,g])},_feed_callback:function(){var a=this._load_count;var c=this._feed_last;this._load_count=false;if(typeof a=="object"&&(a[0]!=c[0]||a[1]!=c[1])){this.data.feed.apply(this,a)}},load:function(a,c){var g=dhx.AtomDataLoader.load.apply(this,arguments);this._ajax_queue.push(g);if(!this.data.url){this.data.url=a}},loadNext:function(g,l,j,c,a){if(this._settings.datathrottle&&!a){if(this._throttle_request){window.clearTimeout(this._throttle_request)}this._throttle_request=dhx.delay(function(){this.loadNext(g,l,j,c,true)},this,0,this._settings.datathrottle);return}if(!l&&l!==0){l=this.dataCount()}this.data.url=this.data.url||c;if(this.callEvent("onDataRequest",[l,g,j,c])&&this.data.url){this.data.feed.call(this,l,g,j)}},_maybe_loading_already:function(c,g){var a=this._feed_last;if(this._load_count&&a){if(a[0]<=g&&(a[1]+a[0]>=c+g)){return true}}return false},_onLoad:function(j,c,a){this._ajax_queue.remove(a);var g=this.data.driver.toObject(j,c);if(g){this.data._parse(g)}else{return this._onLoadError(j,c,a)}this._call_onready();this.callEvent("onXLE",[])},removeMissed_setter:function(a){return this.data._removeMissed=a},scheme_setter:function(a){this.data.scheme(a)},dataFeed_setter:function(a){this.data.attachEvent("onBeforeFilter",dhx.bind(function(n,m){if(this._settings.dataFeed){var l={};if(!n&&!m){return}if(typeof n=="function"){if(!m){return}n(m,l)}else{l={text:m}}this.clearAll();var c=this._settings.dataFeed;var j=[];if(typeof c=="function"){return c.call(this,m,l)}for(var g in l){j.push("dhx_filter["+g+"]="+encodeURIComponent(l[g]))}this.load(c+(c.indexOf("?")<0?"?":"&")+j.join("&"),this._settings.datatype);return false}},this));return a},debug_freid_c_ready:true,debug_freid_c_datathrottle:true,_call_onready:function(){if(this._settings.ready&&!this._ready_was_used){var a=dhx.toFunctor(this._settings.ready);if(a){dhx.delay(a,this,arguments)}this._ready_was_used=true}},_call_onclearall:function(){for(var a=0;a<this._ajax_queue.length;a++){this._ajax_queue[a].abort()}this._ajax_queue=dhx.toArray()},_call_on_config:function(a){this._parseSeetingColl(a)}},dhx.AtomDataLoader);dhx.DataStore=function(){this.name="DataStore";dhx.extend(this,dhx.EventSystem);this.setDriver("json");this.pull={};this.order=dhx.toArray();this._marks={}};dhx.DataStore.prototype={setDriver:function(a){dhx.assert(dhx.DataDriver[a],"incorrect DataDriver");this.driver=dhx.DataDriver[a]},_parse:function(g,a){this.callEvent("onParse",[this.driver,g]);if(this._filter_order){this.filter()}var j=this.driver.getInfo(g);if(j._key){dhx.securityKey=j._key}if(j._config){this.callEvent("onServerConfig",[j._config])}var c=this.driver.getRecords(g);this._inner_parse(j,c);if(this._scheme_group&&this._group_processing){this._group_processing(this._scheme_group)}if(this._scheme_sort){this.blockEvent();this.sort(this._scheme_sort);this.unblockEvent()}this.callEvent("onStoreLoad",[this.driver,g]);this.refresh()},_inner_parse:function(c,o){var r=(c._from||0)*1;var n=true;var q=false;if(r===0&&this.order[0]){if(this._removeMissed){q={};for(var l=0;l<this.order.length;l++){q[this.order[l]]=true}}n=false;r=this.order.length}var g=0;for(var l=0;l<o.length;l++){var s=this.driver.getDetails(o[l]);var a=this.id(s);if(!this.pull[a]){this.order[g+r]=a;g++}else{if(n&&this.order[g+r]){g++}}if(this.pull[a]){dhx.extend(this.pull[a],s,true);if(this._scheme_update){this._scheme_update(this.pull[a])}if(q){delete q[a]}}else{this.pull[a]=s;if(this._scheme_init){this._scheme_init(s)}}}if(q){this.blockEvent();for(var m in q){this.remove(m)}this.unblockEvent()}if(!this.order[c._size-1]){this.order[c._size-1]=dhx.undefined}},id:function(a){return a.id||(a.id=dhx.uid())},changeId:function(c,a){if(this.pull[c]){this.pull[a]=this.pull[c]}this.pull[a].id=a;this.order[this.order.find(c)]=a;if(this._filter_order){this._filter_order[this._filter_order.find(c)]=a}if(this._marks[c]){this._marks[a]=this._marks[c];delete this._marks[c]}this.callEvent("onIdChange",[c,a]);if(this._render_change_id){this._render_change_id(c,a)}delete this.pull[c]},item:function(a){return this.pull[a]},update:function(c,a){if(dhx.isUndefined(a)){a=this.item(c)}if(this._scheme_update){this._scheme_update(a)}if(this.callEvent("onBeforeUpdate",[c,a])===false){return false}this.pull[c]=a;this.callEvent("onStoreUpdated",[c,a,"update"])},refresh:function(a){if(this._skip_refresh){return}if(a){this.callEvent("onStoreUpdated",[a,this.pull[a],"paint"])}else{this.callEvent("onStoreUpdated",[null,null,null])}},silent:function(c,a){this._skip_refresh=true;c.call(a||this);this._skip_refresh=false},getRange:function(j,g){if(j){j=this.indexById(j)}else{j=(this.$min||this.startOffset)||0}if(g){g=this.indexById(g)}else{g=Math.min(((this.$max||this.endOffset)||Infinity),(this.dataCount()-1));if(g<0){g=0}}if(j>g){var c=g;g=j;j=c}return this.getIndexRange(j,g)},getIndexRange:function(j,g){g=Math.min((g||Infinity),this.dataCount()-1);var a=dhx.toArray();for(var c=(j||0);c<=g;c++){a.push(this.item(this.order[c]))}return a},dataCount:function(){return this.order.length},exists:function(a){return !!(this.pull[a])},move:function(a,j){dhx.assert(a>=0&&j>=0,"DataStore::move","Incorrect indexes");var g=this.idByIndex(a);var c=this.item(g);this.order.removeAt(a);this.order.insertAt(g,Math.min(this.order.length,j));this.callEvent("onStoreUpdated",[g,c,"move"])},scheme:function(a){this._scheme={};this._scheme_init=a.$init;this._scheme_update=a.$update;this._scheme_serialize=a.$serialize;this._scheme_group=a.$group;this._scheme_sort=a.$sort;for(var c in a){if(c.substr(0,1)!="$"){this._scheme[c]=a[c]}}},sync:function(j,g,a){if(typeof j=="string"){j=$$("source")}if(typeof g!="function"){a=g;g=null}if(dhx.debug_bind){this.debug_sync_master=j;dhx.log("[sync] "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id+" <= "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id)}this._backbone_source=false;if(j.name!="DataStore"){if(j.data&&j.data.name=="DataStore"){j=j.data}else{this._backbone_source=true}}var c=dhx.bind(function(o,l,n){if(this._backbone_source){if(!o){return}if(o.indexOf("change")===0){if(o=="change"){this.pull[l.id]=l.attributes;this.refresh(l.id);return}else{return}}if(o=="reset"){n=l}this.order=[];this.pull={};this._filter_order=null;for(var m=0;m<n.models.length;m++){var q=n.models[m].id;this.order.push(q);this.pull[q]=n.models[m].attributes}}else{this._filter_order=null;this.order=dhx.toArray([].concat(j.order));this.pull=j.pull}if(g){this.silent(g)}if(this._on_sync){this._on_sync()}if(dhx.debug_bind){dhx.log("[sync:request] "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id+" <= "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id)}this.callEvent("onSyncApply",[]);if(!a){this.refresh()}else{a=false}},this);if(this._backbone_source){j.bind("all",c)}else{this._sync_events=[j.attachEvent("onStoreUpdated",c),j.attachEvent("onIdChange",dhx.bind(function(l,m){this.changeId(l,m)},this))]}c()},add:function(m,c){if(this._scheme){for(var g in this._scheme){if(dhx.isUndefined(m[g])){m[g]=this._scheme[g]}}}if(this._scheme_init){this._scheme_init(m)}var n=this.id(m);var a=arguments[2]||this.order;var l=a.length;if(dhx.isUndefined(c)||c<0){c=l}if(c>l){dhx.log("Warning","DataStore:add","Index of out of bounds");c=Math.min(a.length,c)}if(this.callEvent("onBeforeAdd",[n,m,c])===false){return false}dhx.assert(!this.exists(n),"Not unique ID");this.pull[n]=m;a.insertAt(n,c);if(this._filter_order){var j=this._filter_order.length;if(!c&&this.order.length){j=0}this._filter_order.insertAt(n,j)}this.callEvent("onAfterAdd",[n,c]);this.callEvent("onStoreUpdated",[n,m,"add"]);return n},remove:function(g){if(dhx.isArray(g)){for(var a=0;a<g.length;a++){this.remove(g[a])}return}if(this.callEvent("onBeforeDelete",[g])===false){return false}dhx.assert(this.exists(g),"Not existing ID in remove command"+g);var c=this.item(g);this.order.remove(g);if(this._filter_order){this._filter_order.remove(g)}delete this.pull[g];if(this._marks[g]){delete this._marks[g]}this.callEvent("onAfterDelete",[g]);this.callEvent("onStoreUpdated",[g,c,"delete"])},clearAll:function(){this.pull={};this.order=dhx.toArray();this._filter_order=this.url=null;this.callEvent("onClearAll",[]);this.refresh()},idByIndex:function(a){if(a>=this.order.length||a<0){dhx.log("Warning","DataStore::idByIndex Incorrect index")}return this.order[a]},indexById:function(c){var a=this.order.find(c);if(!this.pull[c]){dhx.log("Warning","DataStore::indexById Non-existing ID: "+c)}return a},next:function(c,a){return this.order[this.indexById(c)+(a||1)]},first:function(){return this.order[0]},last:function(){return this.order[this.order.length-1]},previous:function(c,a){return this.order[this.indexById(c)-(a||1)]},sort:function(l,c,a){var g=l;if(typeof l=="function"){g={as:l,dir:c}}else{if(typeof l=="string"){g={by:l.replace(/#/g,""),dir:c,as:a}}}var j=[g.by,g.dir,g.as];if(!this.callEvent("onBeforeSort",j)){return}this._sort_core(g);this.refresh();this.callEvent("onAfterSort",j)},_sort_core:function(a){if(this.order.length){var g=this._sort._create(a);var c=this.getRange(this.first(),this.last());c.sort(g);this.order=c.map(function(j){dhx.assert(j,"Client sorting can't be used with dynamic loading");return this.id(j)},this)}},_filter_reset:function(a){if(this._filter_order&&!a){this.order=this._filter_order;delete this._filter_order}},_filter_core:function(g,l,c){var j=dhx.toArray();for(var a=0;a<this.order.length;a++){var m=this.order[a];if(g(this.item(m),l)){j.push(m)}}if(!c||!this._filter_order){this._filter_order=this.order}this.order=j},filter:function(j,g,a){if(!this.callEvent("onBeforeFilter",[j,g])){return}this._filter_reset(a);if(!this.order.length){return}if(j){var c=j;g=g||"";if(typeof j=="string"){j=j.replace(/#/g,"");if(typeof g=="function"){c=function(l){return g(l[j])}}else{g=g.toString().toLowerCase();c=function(m,l){dhx.assert(m,"Client side filtering can't be used with dynamic loading");return(m[j]||"").toString().toLowerCase().indexOf(l)!=-1}}}this._filter_core(c,g,a,this._filterMode)}this.refresh();this.callEvent("onAfterFilter",[])},each:function(g,c){for(var a=0;a<this.order.length;a++){g.call((c||this),this.item(this.order[a]))}},_methodPush:function(a,c){return function(){return a[c].apply(a,arguments)}},addMark:function(l,j,a,c){var g=this._marks[l]||{};this._marks[l]=g;if(!g[j]){g[j]=c||true;if(a){this.item(l).$css=(this.item(l).$css||"")+" "+j;this.refresh(l)}}return g[j]},removeMark:function(l,j,a){var g=this._marks[l];if(g&&g[j]){delete g[j]}if(a){var c=this.item(l).$css;if(c){this.item(l).$css=c.replace(j,"");this.refresh(l)}}},hasMark:function(g,c){var a=this._marks[g];return(a&&a[c])},provideApi:function(j,c){this.debug_bind_master=j;if(c){this.mapEvent({onbeforesort:j,onaftersort:j,onbeforeadd:j,onafteradd:j,onbeforedelete:j,onafterdelete:j,onbeforeupdate:j})}var g=["sort","add","remove","exists","idByIndex","indexById","item","update","refresh","dataCount","filter","next","previous","clearAll","first","last","serialize","sync","addMark","removeMark","hasMark"];for(var a=0;a<g.length;a++){j[g[a]]=this._methodPush(this,g[a])}},serialize:function(){var j=this.order;var a=[];for(var c=0;c<j.length;c++){var g=this.pull[j[c]];if(this._scheme_serialize){g=this._scheme_serialize(g);if(g===false){continue}}a.push(g)}return a},_sort:{_create:function(a){return this._dir(a.dir,this._by(a.by,a.as))},_as:{date:function(g,c){g=g-0;c=c-0;return g>c?1:(g<c?-1:0)},"int":function(g,c){g=g*1;c=c*1;return g>c?1:(g<c?-1:0)},string_strict:function(g,c){g=g.toString();c=c.toString();return g>c?1:(g<c?-1:0)},string:function(g,c){if(!c){return 1}if(!g){return -1}g=g.toString().toLowerCase();c=c.toString().toLowerCase();return g>c?1:(g<c?-1:0)}},_by:function(c,a){if(!c){return a}if(typeof a!="function"){a=this._as[a||"string"]}dhx.assert(a,"Invalid sorting method");return function(j,g){return a(j[c],g[c])}},_dir:function(c,a){if(c=="asc"||!c){return a}return function(j,g){return a(j,g)*-1}}}};dhx.BaseBind={debug_freid_ignore:{id:true},bind:function(l,j,g){if(typeof l=="string"){l=dhx.ui.get(l)}if(l._initBindSource){l._initBindSource()}if(this._initBindSource){this._initBindSource()}if(!l.getBindData){dhx.extend(l,dhx.BindSource)}if(!this._bind_ready){var m=this.render;if(this.filter){var c=this._settings.id;this.data._on_sync=function(){l._bind_updated[c]=false}}this.render=function(){if(this._in_bind_processing){return}this._in_bind_processing=true;var n=this.callEvent("onBindRequest");this._in_bind_processing=false;return m.apply(this,((n===false)?arguments:[]))};if(this.getValue||this.getValues){this.save=function(){if(this.validate&&!this.validate()){return}l.setBindData((this.getValue?this.getValue:this.getValues()),this._settings.id)}}this._bind_ready=true}l.addBind(this._settings.id,j,g);if(dhx.debug_bind){dhx.log("[bind] "+this.name+"@"+this._settings.id+" <= "+l.name+"@"+l._settings.id)}var a=this._settings.id;this.attachEvent(this.touchable?"onAfterRender":"onBindRequest",function(){return l.getBindData(a)});if(!this._settings.dataFeed&&this.loadNext){this.data.attachEvent("onStoreLoad",function(){l._bind_updated[a]=false})}if(this.isVisible(this._settings.id)){this.refresh()}},unbind:function(a){return this._unbind(a)},_unbind:function(g){g.removeBind(this._settings.id);var c=(this._sync_events||(this.data?this.data._sync_events:0));if(c&&g.data){for(var a=0;a<c.length;a++){g.data.detachEvent(c[a])}}}};dhx.BindSource={$init:function(){this._bind_hash={};this._bind_updated={};this._ignore_binds={};this._bind_specific_rules(this)},saveBatch:function(a){this._do_not_update_binds=true;a.call(this);this._do_not_update_binds=false;this._update_binds()},setBindData:function(c,a){if(a){this._ignore_binds[a]=true}if(dhx.debug_bind){dhx.log("[bind:save] "+this.name+"@"+this._settings.id+" <= @"+a)}if(this.setValue){this.setValue(c)}else{if(this.setValues){this.setValues(c)}else{var g=this.getCursor();if(g){c=dhx.extend(this.item(g),c,true);this.update(g,c)}}}this.callEvent("onBindUpdate",[c,a]);if(this.save){this.save()}if(a){this._ignore_binds[a]=false}},getBindData:function(a,g){if(this._bind_updated[a]){return false}var c=dhx.ui.get(a);if(c.isVisible(c._settings.id)){this._bind_updated[a]=true;if(dhx.debug_bind){dhx.log("[bind:request] "+this.name+"@"+this._settings.id+" => "+c.name+"@"+c._settings.id)}this._bind_update(c,this._bind_hash[a][0],this._bind_hash[a][1]);if(g&&c.filter){c.refresh()}}},addBind:function(a,g,c){this._bind_hash[a]=[g,c]},removeBind:function(a){delete this._bind_hash[a];delete this._bind_updated[a];delete this._ignore_binds[a]},_bind_specific_rules:function(a){if(a.filter){dhx.extend(this,dhx.CollectionBind)}else{if(a.setValue){dhx.extend(this,dhx.ValueBind)}else{dhx.extend(this,dhx.RecordBind)}}},_update_binds:function(){if(!this._do_not_update_binds){for(var a in this._bind_hash){if(this._ignore_binds[a]){continue}this._bind_updated[a]=false;this.getBindData(a,true)}}},_bind_update_common:function(g,c,a){if(g.setValue){g.setValue(a?a[c]:a)}else{if(!g.filter){if(!a&&g.clear){g.clear()}else{if(g._check_data_feed(a)){g.setValues(dhx.clone(a))}}}else{g.data.silent(function(){this.filter(c,a)})}}g.callEvent("onBindApply",[a,c,this])}};dhx.DataValue=dhx.proto({name:"DataValue",isVisible:function(){return true},$init:function(a){this.data=""||a;var c=(a&&a.id)?a.id:dhx.uid();this._settings={id:c};dhx.ui.views[c]=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 true},$init:function(a){this.data=a||{};var c=(a&&a.id)?a.id:dhx.uid();this._settings={id:c};dhx.ui.views[c]=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(){if(!this.data.order.length&&!this.data._filter_order&&!this._settings.dataFeed){return false}return true},$init:function(a){this.data.provideApi(this,true);var c=(a&&a.id)?a.id:dhx.uid();this._settings.id=c;dhx.ui.views[c]=this;this.data.attachEvent("onStoreLoad",dhx.bind(function(){this.callEvent("onBindRequest",[])},this))},refresh:function(){this.callEvent("onBindRequest",[])}},dhx.DataLoader,dhx.EventSystem,dhx.BaseBind,dhx.Settings);dhx.ValueBind={$init:function(){this.attachEvent("onChange",this._update_binds)},_bind_update:function(l,j,g){var c=this.getValue()||"";if(g){c=g(c)}if(l.setValue){l.setValue(c)}else{if(!l.filter){var a={};a[j]=c;if(l._check_data_feed(c)){l.setValues(a)}}else{l.data.silent(function(){this.filter(j,c)})}}l.callEvent("onBindApply",[c,j,this])}};dhx.RecordBind={$init:function(){this.attachEvent("onChange",this._update_binds)},_bind_update:function(g,c){var a=this.getValues()||null;this._bind_update_common(g,c,a)}};dhx.CollectionBind={$init:function(){this._cursor=null;this.attachEvent("onSelectChange",function(c){var a=this.getSelected();this.setCursor(a?(a.id||a):null)});this.attachEvent("onAfterCursorChange",this._update_binds);this.data.attachEvent("onStoreUpdated",dhx.bind(function(g,a,c){if(g&&g==this.getCursor()&&c!="paint"){this._update_binds()}},this));this.data.attachEvent("onClearAll",dhx.bind(function(){this._cursor=null},this));this.data.attachEvent("onIdChange",dhx.bind(function(c,a){if(this._cursor==c){this._cursor=a}},this))},setCursor:function(a){if(a==this._cursor||(a!==null&&!this.item(a))){return}this.callEvent("onBeforeCursorChange",[this._cursor]);this._cursor=a;this.callEvent("onAfterCursorChange",[a])},getCursor:function(){return this._cursor},_bind_update:function(g,c){var a=this.item(this.getCursor())||this._settings.defaultData||null;this._bind_update_common(g,c,a)}};if(!dhx.ui){dhx.ui={}}if(!dhx.ui.views){dhx.ui.views={};dhx.ui.get=function(a){if(a._settings){return a}return dhx.ui.views[a]}}dhtmlXDataStore=function(c){var g=new dhx.DataCollection(c);var a="_dp_init";g[a]=function(l){var j="_methods";l[j]=["dummy","dummy","changeId","dummy"];this.data._old_names={add:"inserted",update:"updated","delete":"deleted"};this.data.attachEvent("onStoreUpdated",function(o,m,n){if(o&&!l._silent){l.setUpdated(o,true,this._old_names[n])}});j="_getRowData";l[j]=function(r,m){var o=this.obj.data.item(r);var q={id:r};q[this.action_param]=this.obj.getUserData(r);if(o){for(var n in o){q[n]=o[n]}}return q};this.changeId=function(n,m){this.data.changeId(n,m);l._silent=true;this.data.callEvent("onStoreUpdated",[m,this.item(m),"update"]);l._silent=false};j="_clearUpdateFlag";l[j]=function(){};this._userdata={}};g.dummy=function(){};g.setUserData=function(m,j,l){this._userdata[m]=l};g.getUserData=function(l,j){return this._userdata[l]};g.dataFeed=function(j){this.define("dataFeed",j)};dhx.extend(g,dhx.BindSource);return g};if(window.dhtmlXDataView){dhtmlXDataView.prototype._initBindSource=function(){this.isVisible=function(){if(!this.data.order.length&&!this.data._filter_order&&!this._settings.dataFeed){return false}return true};var a="_settings";this._settings=this._settings||this[a];if(!this._settings.id){this._settings.id=dhx.uid()}this.unbind=dhx.BaseBind.unbind;this.unsync=dhx.BaseBind.unsync;dhx.ui.views[this._settings.id]=this}}if(window.dhtmlXChart){dhtmlXChart.prototype._initBindSource=function(){this.isVisible=function(){if(!this.data.order.length&&!this.data._filtered_state&&!this._settings.dataFeed){return false}return true};var a="_settings";this._settings=this._settings||this[a];if(!this._settings.id){this._settings.id=dhx.uid()}this.unbind=dhx.BaseBind.unbind;this.unsync=dhx.BaseBind.unsync;dhx.ui.views[this._settings.id]=this}}dhx.BaseBind.unsync=function(a){return dhx.BaseBind._unbind.call(this,a)};dhx.BaseBind.unbind=function(a){return dhx.BaseBind._unbind.call(this,a)};dhx.BaseBind.legacyBind=function(){return dhx.BaseBind.bind.apply(this,arguments)};dhx.BaseBind.legacySync=function(a,c){if(this._initBindSource){this._initBindSource()}if(a._initBindSource){a._initBindSource()}this.attachEvent("onAfterEditStop",function(g){this.save(g);return true});this.attachEvent("onDataRequest",function(l,j){for(var g=l;g<l+j;g++){if(!a.data.order[g]){a.loadNext(j,l);return false}}});this.save=function(m){if(!m){m=this.getCursor()}var l=this.item(m);var g=a.item(m);for(var j in l){if(j.indexOf("$")!==0){g[j]=l[j]}}a.refresh(m)};if(a&&a.name=="DataCollection"){return a.data.sync.apply(this.data,arguments)}else{return this.data.sync.apply(this.data,arguments)}};if(window.dhtmlXForm){dhtmlXForm.prototype.bind=function(a){dhx.BaseBind.bind.apply(this,arguments);a.getBindData(this._settings.id)};dhtmlXForm.prototype.unbind=function(a){dhx.BaseBind._unbind.call(this,a)};dhtmlXForm.prototype._initBindSource=function(){if(dhx.isUndefined(this._settings)){this._settings={id:dhx.uid(),dataFeed:this._server_feed};dhx.ui.views[this._settings.id]=this}};dhtmlXForm.prototype._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.load(a);return false};dhtmlXForm.prototype.setValues=dhtmlXForm.prototype.setFormData;dhtmlXForm.prototype.getValues=function(){return this.getFormData(false,true)};dhtmlXForm.prototype.dataFeed=function(a){if(this._settings){this._settings.dataFeed=a}else{this._server_feed=a}};dhtmlXForm.prototype.refresh=dhtmlXForm.prototype.isVisible=function(a){return true}}if(window.scheduler){if(!window.Scheduler){window.Scheduler={}}Scheduler.$syncFactory=function(a){a.sync=function(g,l){if(this._initBindSource){this._initBindSource()}if(g._initBindSource){g._initBindSource()}var j="_process_loading";var c=function(r){a.clearAll();var m=g.data.order;var q=g.data.pull;var n=[];for(var o=0;o<m.length;o++){if(l&&l.copy){n[o]=dhx.clone(q[m[o]])}else{n[o]=q[m[o]]}}a[j](n);a.callEvent("onSyncApply",[])};this.save=function(o){if(!o){o=this.getCursor()}var n=this.item(o);var m=g.item(o);if(this.callEvent("onStoreSave",[o,n,m])){dhx.extend(g.item(o),n,true);g.update(o)}};this.item=function(m){return this.getEvent(m)};this._sync_events=[g.data.attachEvent("onStoreUpdated",function(o,m,n){c.call(this)}),g.data.attachEvent("onIdChange",function(n,m){combo.changeOptionId(n,m)})];this.attachEvent("onEventChanged",function(m){this.save(m)});this.attachEvent("onEventAdded",function(n,m){if(!g.data.pull[n]){g.add(m)}});this.attachEvent("onEventDeleted",function(m){if(g.data.pull[m]){g.remove(m)}});c()};a.unsync=function(c){dhx.BaseBind._unbind.call(this,c)};a._initBindSource=function(){if(!this._settings){this._settings={id:dhx.uid()}}}};Scheduler.$syncFactory(window.scheduler)}if(window.dhtmlXCombo){dhtmlXCombo.prototype.bind=function(){dhx.BaseBind.bind.apply(this,arguments)};dhtmlXCombo.unbind=function(a){dhx.BaseBind._unbind.call(this,a)};dhtmlXCombo.unsync=function(a){dhx.BaseBind._unbind.call(this,a)};dhtmlXCombo.prototype.dataFeed=function(a){if(this._settings){this._settings.dataFeed=a}else{this._server_feed=a}};dhtmlXCombo.prototype.sync=function(c,j){if(this._initBindSource){this._initBindSource()}if(c._initBindSource){c._initBindSource()}var g=this;var a=function(l){g.clearAll();g.addOption(this.serialize());g.callEvent("onSyncApply",[])};this._sync_events=[c.data.attachEvent("onStoreUpdated",function(n,l,m){a.call(this)}),c.data.attachEvent("onIdChange",function(m,l){g.changeOptionId(m,l)})];a.call(c)};dhtmlXCombo.prototype._initBindSource=function(){if(dhx.isUndefined(this._settings)){this._settings={id:dhx.uid(),dataFeed:this._server_feed};dhx.ui.views[this._settings.id]=this;this.data={silent:dhx.bind(function(a){a.call(this)},this)};dhx4._eventable(this.data);this.attachEvent("onChange",function(){this.callEvent("onSelectChange",[this.getSelectedValue()])});this.attachEvent("onXLE",function(){this.callEvent("onBindRequest",[])})}};dhtmlXCombo.prototype.item=function(a){return this.getOption(a)};dhtmlXCombo.prototype.getSelected=function(){return this.getSelectedValue()};dhtmlXCombo.prototype.isVisible=function(){if(!this.optionsArr.length&&!this._settings.dataFeed){return false}return true};dhtmlXCombo.prototype.refresh=function(){this.render(true)}}if(window.dhtmlXGridObject){dhtmlXGridObject.prototype.bind=function(a,g,c){dhx.BaseBind.bind.apply(this,arguments)};dhtmlXGridObject.prototype.unbind=function(a){dhx.BaseBind._unbind.call(this,a)};dhtmlXGridObject.prototype.unsync=function(a){dhx.BaseBind._unbind.call(this,a)};dhtmlXGridObject.prototype.dataFeed=function(a){if(this._settings){this._settings.dataFeed=a}else{this._server_feed=a}};dhtmlXGridObject.prototype.sync=function(a,q){if(this._initBindSource){this._initBindSource()}if(a._initBindSource){a._initBindSource()}var c=this;var o="_parsing";var g="_parser";var m="_locator";var j="_process_store_row";var n="_get_store_data";this.save=function(r){if(!r){r=this.getCursor()}dhx.extend(a.item(r),this.item(r),true);a.update(r)};var l=function(x){var u=c.getCursor?c.getCursor():null;var w=0;if(c._legacy_ignore_next){w=c._legacy_ignore_next;c._legacy_ignore_next=false}else{c.clearAll()}var s=this.dataCount();if(s){c[o]=true;for(var r=w;r<s;r++){var v=this.order[r];if(!v){continue}if(w&&c.rowsBuffer[r]){continue}c.rowsBuffer[r]={idd:v,data:this.pull[v]};c.rowsBuffer[r][g]=c[j];c.rowsBuffer[r][m]=c[n];c.rowsAr[v]=this.pull[v]}if(!c.rowsBuffer[s-1]){c.rowsBuffer[s-1]=dhtmlx.undefined;c.xmlFileUrl=c.xmlFileUrl||this.url}if(c.pagingOn){c.changePage()}else{if(c._srnd&&c._fillers){c._update_srnd_view()}else{c.render_dataset();c.callEvent("onXLE",[])}}c[o]=false}if(u&&c.setCursor){c.setCursor(c.rowsAr[u]?u:null)}c.callEvent("onSyncApply",[])};this._sync_events=[a.data.attachEvent("onStoreUpdated",function(u,r,s){if(s=="delete"){c.deleteRow(u);c.data.callEvent("onStoreUpdated",[u,r,s])}else{if(s=="update"){c.callEvent("onSyncUpdate",[r,s]);c.update(u,r);c.data.callEvent("onStoreUpdated",[u,r,s])}else{if(s=="add"){c.callEvent("onSyncUpdate",[r,s]);c.add(u,r,this.indexById(u));c.data.callEvent("onStoreUpdated",[u,r,s])}else{l.call(this)}}}}),a.data.attachEvent("onStoreLoad",function(s,r){c.xmlFileUrl=a.data.url;c._legacy_ignore_next=s.getInfo(r)._from}),a.data.attachEvent("onIdChange",function(s,r){c.changeRowId(s,r)})];c.attachEvent("onDynXLS",function(u,s){for(var r=u;r<u+s;r++){if(!a.data.order[r]){a.loadNext(s,u);return false}}c._legacy_ignore_next=u;l.call(a.data)});l.call(a.data);c.attachEvent("onEditCell",function(r,w,u,s,v){if(r==2&&s!=v){this.save(w)}return true});c.attachEvent("onClearAll",function(){var r="_f_rowsBuffer";this[r]=null});if(q&&q.sort){c.attachEvent("onBeforeSorting",function(u,s,r){if(s=="connector"){return false}var v=this.getColumnId(u);a.sort("#"+v+"#",(r=="asc"?"asc":"desc"),(s=="int"?s:"string"));c.setSortImgState(true,u,r);return false})}if(q&&q.filter){c.attachEvent("onFilterStart",function(u,r){var s="_con_f_used";if(c[s]&&c[s].length){return false}a.data.silent(function(){a.filter();for(var v=0;v<u.length;v++){if(r[v]==""){continue}var w=c.getColumnId(u[v]);a.filter("#"+w+"#",r[v],v!=0)}});a.refresh();return false});c.collectValues=function(r){var s=this.getColumnId(r);return(function(w){var u=[];var v={};this.data.each(function(y){var x=y[w];if(!v[x]){v[x]=true;u.push(x)}});u.sort();return u}).call(a,s)}}if(q&&q.select){c.attachEvent("onRowSelect",function(r){a.setCursor(r)})}c.clearAndLoad=function(r){a.clearAll();a.load(r)}};dhtmlXGridObject.prototype._initBindSource=function(){if(dhx.isUndefined(this._settings)){this._settings={id:dhx.uid(),dataFeed:this._server_feed};dhx.ui.views[this._settings.id]=this;this.data={silent:dhx.bind(function(g){g.call(this)},this)};dhx4._eventable(this.data);var a="_cCount";for(var c=0;c<this[a];c++){if(!this.columnIds[c]){this.columnIds[c]="cell"+c}}this.attachEvent("onSelectStateChanged",function(g){this.callEvent("onSelectChange",[g])});this.attachEvent("onSelectionCleared",function(){this.callEvent("onSelectChange",[null])});this.attachEvent("onEditCell",function(g,j){if(g===2&&this.getCursor){if(j&&j==this.getCursor()){this._update_binds()}}return true});this.attachEvent("onXLE",function(){this.callEvent("onBindRequest",[])})}};dhtmlXGridObject.prototype.item=function(m){if(m===null){return null}var l=this.getRowById(m);if(!l){return null}var a="_attrs";var j=dhx.copy(l[a]);j.id=m;var g=this.getColumnsNum();for(var c=0;c<g;c++){j[this.columnIds[c]]=this.cells(m,c).getValue()}return j};dhtmlXGridObject.prototype.update=function(m,l){for(var j=0;j<this.columnIds.length;j++){var g=this.columnIds[j];if(!dhx.isUndefined(l[g])){this.cells(m,j).setValue(l[g])}}var c="_attrs";var a=this.getRowById(m)[c];for(var g in l){a[g]=l[g]}this.callEvent("onBindUpdate",[m])};dhtmlXGridObject.prototype.add=function(n,m,g){var a=[];for(var l=0;l<this.columnIds.length;l++){var j=this.columnIds[l];a[l]=dhx.isUndefined(m[j])?"":m[j]}this.addRow(n,a,g);var c="_attrs";this.getRowById(n)[c]=dhx.copy(m)};dhtmlXGridObject.prototype.getSelected=function(){return this.getSelectedRowId()};dhtmlXGridObject.prototype.isVisible=function(){var a="_f_rowsBuffer";if(!this.rowsBuffer.length&&!this[a]&&!this._settings.dataFeed){return false}return true};dhtmlXGridObject.prototype.refresh=function(){this.render_dataset()};dhtmlXGridObject.prototype.filter=function(m,l){if(this._settings.dataFeed){var j={};if(!m&&!l){return}if(typeof m=="function"){if(!l){return}m(l,j)}else{if(dhx.isUndefined(m)){j=l}else{j[m]=l}}this.clearAll();var a=this._settings.dataFeed;if(typeof a=="function"){return a.call(this,l,j)}var g=[];for(var c in j){g.push("dhx_filter["+c+"]="+encodeURIComponent(j[c]))}this.load(a+(a.indexOf("?")<0?"?":"&")+g.join("&"));return false}if(l===null){return this.filterBy(0,function(){return false})}this.filterBy(0,function(n,o){return m.call(this,o,l)})}}if(window.dhtmlXTreeObject){dhtmlXTreeObject.prototype.bind=function(){dhx.BaseBind.bind.apply(this,arguments)};dhtmlXTreeObject.prototype.unbind=function(a){dhx.BaseBind._unbind.call(this,a)};dhtmlXTreeObject.prototype.dataFeed=function(a){if(this._settings){this._settings.dataFeed=a}else{this._server_feed=a}};dhtmlXTreeObject.prototype._initBindSource=function(){if(dhx.isUndefined(this._settings)){this._settings={id:dhx.uid(),dataFeed:this._server_feed};dhx.ui.views[this._settings.id]=this;this.data={silent:dhx.bind(function(a){a.call(this)},this)};dhx4._eventable(this.data);this.attachEvent("onSelect",function(a){this.callEvent("onSelectChange",[a])});this.attachEvent("onEdit",function(a,c){if(a===2){if(c&&c==this.getCursor()){this._update_binds()}}return true})}};dhtmlXTreeObject.prototype.item=function(a){if(a===null){return null}return{id:a,text:this.getItemText(a)}};dhtmlXTreeObject.prototype.getSelected=function(){return this.getSelectedItemId()};dhtmlXTreeObject.prototype.isVisible=function(){return true};dhtmlXTreeObject.prototype.refresh=function(){};dhtmlXTreeObject.prototype.filter=function(m,l){if(this._settings.dataFeed){var j={};if(!m&&!l){return}if(typeof m=="function"){if(!l){return}m(l,j)}else{if(dhx.isUndefined(m)){j=l}else{j[m]=l}}this.deleteChildItems(0);var a=this._settings.dataFeed;if(typeof a=="function"){return a.call(this,[(data.id||data),data])}var g=[];for(var c in j){g.push("dhx_filter["+c+"]="+encodeURIComponent(j[c]))}this.loadXML(a+(a.indexOf("?")<0?"?":"&")+g.join("&"));return false}};dhtmlXTreeObject.prototype.update=function(c,a){if(!dhx.isUndefined(a.text)){this.setItemText(c,a.text)}}}function dataProcessor(a){this.serverProcessor=a;this.action_param="!nativeeditor_status";this.object=null;this.updatedRows=[];this.autoUpdate=true;this.updateMode="cell";this._tMode="GET";this._headers=null;this._payload=null;this.post_delim="_";this._waitMode=0;this._in_progress={};this._invalid={};this.mandatoryFields=[];this.messages=[];this.styles={updated:"font-weight:bold;",inserted:"font-weight:bold;",deleted:"text-decoration : line-through;",invalid:"background-color:FFE0E0;",invalid_cell:"border-bottom:2px solid red;",error:"color:red;",clear:"font-weight:normal;text-decoration:none;"};this.enableUTFencoding(true);dhx4._eventable(this);return this}dataProcessor.prototype={setTransactionMode:function(c,a){if(typeof c=="object"){this._tMode=c.mode||this._tMode;this._headers=this._headers||c.headers;this._payload=this._payload||c.payload}else{this._tMode=c;this._tSend=a}if(this._tMode=="REST"){this._tSend=false;this._endnm=true}},escape:function(a){if(this._utf){return encodeURIComponent(a)}else{return escape(a)}},enableUTFencoding:function(a){this._utf=dhx4.s2b(a)},setDataColumns:function(a){this._columns=(typeof a=="string")?a.split(","):a},getSyncState:function(){return !this.updatedRows.length},enableDataNames:function(a){this._endnm=dhx4.s2b(a)},enablePartialDataSend:function(a){this._changed=dhx4.s2b(a)},setUpdateMode:function(c,a){this.autoUpdate=(c=="cell");this.updateMode=c;this.dnd=a},ignore:function(c,a){this._silent_mode=true;c.call(a||window);this._silent_mode=false},setUpdated:function(j,g,l){if(this._silent_mode){return}var c=this.findRow(j);l=l||"updated";var a=this.obj.getUserData(j,this.action_param);if(a&&l=="updated"){l=a}if(g){this.set_invalid(j,false);this.updatedRows[c]=j;this.obj.setUserData(j,this.action_param,l);if(this._in_progress[j]){this._in_progress[j]="wait"}}else{if(!this.is_invalid(j)){this.updatedRows.splice(c,1);this.obj.setUserData(j,this.action_param,"")}}if(!g){this._clearUpdateFlag(j)}this.markRow(j,g,l);if(g&&this.autoUpdate){this.sendData(j)}},_clearUpdateFlag:function(a){},markRow:function(m,g,l){var j="";var c=this.is_invalid(m);if(c){j=this.styles[c];g=true}if(this.callEvent("onRowMark",[m,g,l,c])){j=this.styles[g?l:"clear"]+j;this.obj[this._methods[0]](m,j);if(c&&c.details){j+=this.styles[c+"_cell"];for(var a=0;a<c.details.length;a++){if(c.details[a]){this.obj[this._methods[1]](m,a,j)}}}}},getState:function(a){return this.obj.getUserData(a,this.action_param)},is_invalid:function(a){return this._invalid[a]},set_invalid:function(g,c,a){if(a){c={value:c,details:a,toString:function(){return this.value.toString()}}}this._invalid[g]=c},checkBeforeUpdate:function(a){return true},sendData:function(a){if(this._waitMode&&(this.obj.mytype=="tree"||this.obj._h2)){return}if(this.obj.editStop){this.obj.editStop()}if(typeof a=="undefined"||this._tSend){return this.sendAllData()}if(this._in_progress[a]){return false}this.messages=[];if(this.getState(a)!=="deleted"){if(!this.checkBeforeUpdate(a)&&this.callEvent("onValidationError",[a,this.messages])){return false}}this._beforeSendData(this._getRowData(a),a)},_beforeSendData:function(a,c){if(!this.callEvent("onBeforeUpdate",[c,this.getState(c),a])){return false}this._sendData(a,c)},serialize:function(j,l){if(typeof j=="string"){return j}if(typeof l!="undefined"){return this.serialize_one(j,"")}else{var a=[];var g=[];for(var c in j){if(j.hasOwnProperty(c)){a.push(this.serialize_one(j[c],c+this.post_delim));g.push(c)}}a.push("ids="+this.escape(g.join(",")));if(dhtmlx.security_key){a.push("dhx_security="+dhtmlx.security_key)}return a.join("&")}},serialize_one:function(j,c){if(typeof j=="string"){return j}var a=[];for(var g in j){if(j.hasOwnProperty(g)){if((g=="id"||g==this.action_param)&&this._tMode=="REST"){continue}a.push(this.escape((c||"")+g)+"="+this.escape(j[g]))}}return a.join("&")},_sendData:function(l,m){if(!l){return}if(!this.callEvent("onBeforeDataSending",m?[m,this.getState(m),l]:[null,null,l])){return false}if(m){this._in_progress[m]=(new Date()).valueOf()}var r=this;var q=function(u){var w=[];if(m){w.push(m)}else{if(l){for(var v in l){w.push(v)}}}return r.afterUpdate(r,u,w)};var c=this.serverProcessor+(this._user?(dhtmlx.url(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+this.obj.getUserData(0,"version")].join("&")):"");if(this._tMode=="GET"){dhx4.ajax.get(c+((c.indexOf("?")!=-1)?"&":"?")+this.serialize(l,m),q)}else{if(this._tMode=="POST"){dhx4.ajax.post(c,this.serialize(l,m),q)}else{if(this._tMode=="REST"){var g=this.getState(m);var j=c.replace(/(\&|\?)editing\=true/,"");var n=j.split("?");if(n[1]){n[1]="?"+n[1]}var o="";var a="post";if(g=="inserted"){o=this.serialize(l,m)}else{if(g=="deleted"){a="DELETE";j=n[0]+m+n[1]}else{a="PUT";o=this.serialize(l,m);j=n[0]+m+n[1]}}if(this._payload){for(var s in this._payload){j=j+(j.indexOf("?")===-1?"?":"&")+this.escape(s)+"="+this.escape(this._payload[s])}}dhx4.ajax.query({url:j,method:a,headers:this._headers,data:o,callback:q})}}}this._waitMode++},sendAllData:function(){if(!this.updatedRows.length){return}this.messages=[];var c=true;for(var a=0;a<this.updatedRows.length;a++){if(this.getState(this.updatedRows[a])!=="deleted"){c&=this.checkBeforeUpdate(this.updatedRows[a])}}if(!c&&!this.callEvent("onValidationError",["",this.messages])){return false}if(this._tSend){this._sendData(this._getAllData())}else{for(var a=0;a<this.updatedRows.length;a++){if(!this._in_progress[this.updatedRows[a]]){if(this.is_invalid(this.updatedRows[a])){continue}this._beforeSendData(this._getRowData(this.updatedRows[a]),this.updatedRows[a]);if(this._waitMode&&(this.obj.mytype=="tree"||this.obj._h2)){return}}}}},_getAllData:function(j){var c={};var a=false;for(var g=0;g<this.updatedRows.length;g++){var l=this.updatedRows[g];if(this._in_progress[l]||this.is_invalid(l)){continue}if(!this.callEvent("onBeforeUpdate",[l,this.getState(l),this._getRowData(l)])){continue}c[l]=this._getRowData(l,l+this.post_delim);a=true;this._in_progress[l]=(new Date()).valueOf()}return a?c:null},setVerificator:function(c,a){this.mandatoryFields[c]=a||(function(g){return(g!=="")})},clearVerificator:function(a){this.mandatoryFields[a]=false},findRow:function(c){var a=0;for(a=0;a<this.updatedRows.length;a++){if(c==this.updatedRows[a]){break}}return a},defineAction:function(a,c){if(!this._uActions){this._uActions=[]}this._uActions[a]=c},afterUpdateCallback:function(c,n,m,l){var a=c;var j=(m!="error"&&m!="invalid");if(!j){this.set_invalid(c,m)}if((this._uActions)&&(this._uActions[m])&&(!this._uActions[m](l))){return(delete this._in_progress[a])}if(this._in_progress[a]!="wait"){this.setUpdated(c,false)}var g=c;switch(m){case"inserted":case"insert":if(n!=c){this.obj[this._methods[2]](c,n);c=n}break;case"delete":case"deleted":this.obj.setUserData(c,this.action_param,"true_deleted");this.obj[this._methods[3]](c);delete this._in_progress[a];return this.callEvent("onAfterUpdate",[c,m,n,l]);break}if(this._in_progress[a]!="wait"){if(j){this.obj.setUserData(c,this.action_param,"")}delete this._in_progress[a]}else{delete this._in_progress[a];this.setUpdated(n,true,this.obj.getUserData(c,this.action_param))}this.callEvent("onAfterUpdate",[g,m,n,l])},afterUpdate:function(o,n,a){if(window.JSON){try{var u=JSON.parse(n.xmlDoc.responseText);var j=u.action||this.getState(a)||"updated";var c=u.sid||a[0];var g=u.tid||a[0];o.afterUpdateCallback(c,g,j,u);o.finalizeUpdate();return}catch(q){}}var s=dhx4.ajax.xmltop("data",n.xmlDoc);if(!s||s.tagName=="DIV"){return this.cleanUpdate(a)}var r=dhx4.ajax.xpath("//data/action",s);if(!r.length){return this.cleanUpdate(a)}for(var m=0;m<r.length;m++){var l=r[m];var j=l.getAttribute("type");var c=l.getAttribute("sid");var g=l.getAttribute("tid");o.afterUpdateCallback(c,g,j,l)}o.finalizeUpdate()},cleanUpdate:function(c){if(c){for(var a=0;a<c.length;a++){delete this._in_progress[c[a]]}}},finalizeUpdate:function(){if(this._waitMode){this._waitMode--}if((this.obj.mytype=="tree"||this.obj._h2)&&this.updatedRows.length){this.sendData()}this.callEvent("onAfterUpdateFinish",[]);if(!this.updatedRows.length){this.callEvent("onFullSync",[])}},init:function(a){this.obj=a;if(this.obj._dp_init){this.obj._dp_init(this)}},setOnAfterUpdate:function(a){this.attachEvent("onAfterUpdate",a)},enableDebug:function(a){},setOnBeforeUpdateHandler:function(a){this.attachEvent("onBeforeDataSending",a)},setAutoUpdate:function(g,c){g=g||2000;this._user=c||(new Date()).valueOf();this._need_update=false;this._loader=null;this._update_busy=false;this.attachEvent("onAfterUpdate",function(j,m,n,l){this.afterAutoUpdate(j,m,n,l)});this.attachEvent("onFullSync",function(){this.fullSync()});var a=this;window.setInterval(function(){a.loadUpdate()},g)},afterAutoUpdate:function(a,g,j,c){if(g=="collision"){this._need_update=true;return false}else{return true}},fullSync:function(){if(this._need_update==true){this._need_update=false;this.loadUpdate()}return true},getUpdates:function(a,c){if(this._update_busy){return false}else{this._update_busy=true}this._loader=this._loader||new dtmlXMLLoaderObject(true);this._loader.async=true;this._loader.waitCall=c;this._loader.loadXML(a)},_v:function(a){if(a.firstChild){return a.firstChild.nodeValue}return""},_a:function(a){var g=[];for(var c=0;c<a.length;c++){g[c]=this._v(a[c])}return g},loadUpdate:function(){var c=this;var a=this.obj.getUserData(0,"version");var g=this.serverProcessor+dhtmlx.url(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+a].join("&");g=g.replace("editing=true&","");this.getUpdates(g,function(){var m=c._loader.doXPath("//userdata");c.obj.setUserData(0,"version",c._v(m[0]));var j=c._loader.doXPath("//update");if(j.length){c._silent_mode=true;for(var n=0;n<j.length;n++){var l=j[n].getAttribute("status");var q=j[n].getAttribute("id");var o=j[n].getAttribute("parent");switch(l){case"inserted":c.callEvent("insertCallback",[j[n],q,o]);break;case"updated":c.callEvent("updateCallback",[j[n],q,o]);break;case"deleted":c.callEvent("deleteCallback",[j[n],q,o]);break}}c._silent_mode=false}c._update_busy=false;c=null})}};if(window.dataProcessor&&!dataProcessor.prototype.init_original){dataProcessor.prototype.init_original=dataProcessor.prototype.init;dataProcessor.prototype.init=function(a){this.init_original(a);a._dataprocessor=this;this.setTransactionMode("POST",true);this.serverProcessor+=(this.serverProcessor.indexOf("?")!=-1?"&":"?")+"editing=true"}};
\ No newline at end of file