function dtmlXMLLoaderObject(C,E,D,A){this.xmlDoc="";if(arguments.length==2){this.async=true}else{this.async=D}this.onloadAction=C||null;this.mainObject=E||null;this.waitCall=null;this.rSeed=A||false;return this}dtmlXMLLoaderObject.prototype.waitLoadFunction=function(A){this.check=function(){if(A.onloadAction!=null){if((!A.xmlDoc.readyState)||(A.xmlDoc.readyState==4)){A.onloadAction(A.mainObject,null,null,null,A);if(A.waitCall){A.waitCall();A.waitCall=null}A=null}}};return this.check};dtmlXMLLoaderObject.prototype.getXMLTopNode=function(C){if(this.xmlDoc.responseXML){var A=this.xmlDoc.responseXML.getElementsByTagName(C);var E=A[0]}else{var E=this.xmlDoc.documentElement}if(E){this._retry=false;return E}if((_isIE)&&(!this._retry)){var D=this.xmlDoc.responseText;this._retry=true;this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=false;this.xmlDoc.loadXML(D);return this.getXMLTopNode(C)}dhtmlxError.throwError("LoadXML","Incorrect XML",[this.xmlDoc,this.mainObject]);return document.createElement("DIV")};dtmlXMLLoaderObject.prototype.loadXMLString=function(C){try{var D=new DOMParser();this.xmlDoc=D.parseFromString(C,"text/xml")}catch(A){this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=this.async;this.xmlDoc.loadXML(C)}this.onloadAction(this.mainObject);if(this.waitCall){this.waitCall();this.waitCall=null}};dtmlXMLLoaderObject.prototype.loadXML=function(D,C,A){if(this.rSeed){D+=((D.indexOf("?")!=-1)?"&":"?")+"a_dhx_rSeed="+(new Date()).valueOf()}this.filePath=D;if(window.XMLHttpRequest){this.xmlDoc=new XMLHttpRequest();this.xmlDoc.open(C?"POST":"GET",D,this.async);if(C){this.xmlDoc.setRequestHeader("Content-type","application/x-www-form-urlencoded")}this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.send(null||A)}else{if(document.implementation&&document.implementation.createDocument){this.xmlDoc=document.implementation.createDocument("","",null);this.xmlDoc.onload=new this.waitLoadFunction(this);this.xmlDoc.load(D)}else{this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");this.xmlDoc.open(C?"POST":"GET",D,this.async);if(C){this.xmlDoc.setRequestHeader("Content-type","application/x-www-form-urlencoded")}this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.send(null||A)}}};dtmlXMLLoaderObject.prototype.destructor=function(){this.onloadAction=null;this.mainObject=null;this.xmlDoc=null;return null};function callerFunction(A,C){this.handler=function(D){if(!D){D=event}A(D,C);return true};return this.handler}function getAbsoluteLeft(C){var D=C.offsetLeft;var A=C.offsetParent;while(A!=null){D+=A.offsetLeft;A=A.offsetParent}return D}function getAbsoluteTop(D){var C=D.offsetTop;var A=D.offsetParent;while(A!=null){C+=A.offsetTop;A=A.offsetParent}return C}function convertStringToBoolean(A){if(typeof (A)=="string"){A=A.toLowerCase()}switch(A){case"1":case"true":case"yes":case"y":case 1:case true:return true;break;default:return false}}function getUrlSymbol(A){if(A.indexOf("?")!=-1){return"&"}else{return"?"}}function dhtmlDragAndDropObject(){this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;if(window.dhtmlDragAndDrop){return window.dhtmlDragAndDrop}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(window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false}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;if((A)&&(A.preventDefault)){A.preventDefault();return false}return false};dhtmlDragAndDropObject.prototype.callDrag=function(D){if(!D){D=window.event}dragger=window.dhtmlDragAndDrop;if((D.button==0)&&(_isIE)){return dragger.stopDrag()}if(!dragger.dragNode){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode,D);if(!dragger.dragNode){return dragger.stopDrag()}dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute()}if(dragger.dragNode.parentNode!=window.document.body){var A=dragger.gldragNode;if(dragger.gldragNode.old){A=dragger.gldragNode.old}A.parentNode.removeChild(A);var C=dragger.dragNode.pWindow;if(_isIE){var F=document.createElement("Div");F.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=F.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=D.clientX+15+(dragger.fx?dragger.fx*(-1):0)+(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=D.clientY+3+(dragger.fy?dragger.fy*(-1):0)+(document.body.scrollTop||document.documentElement.scrollTop)+"px";if(!D.srcElement){var E=D.target}else{E=D.srcElement}dragger.checkLanding(E,D.clientX,D.clientY)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(F){if(window.name){var D=parent.frames[window.name].frameElement.offsetParent;var E=0;var C=0;while(D){E+=D.offsetLeft;C+=D.offsetTop;D=D.offsetParent}if((parent.dhtmlDragAndDrop)){var A=parent.dhtmlDragAndDrop.calculateFramePosition(1);E+=A.split("_")[0]*1;C+=A.split("_")[1]*1}if(F){return E+"_"+C}else{this.fx=E}this.fy=C}return"0_0"};dhtmlDragAndDropObject.prototype.checkLanding=function(C,A,D){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,D)}else{if((C)&&(C.tagName!="BODY")){this.checkLanding(C.parentNode,A,D)}else{if(this.lastLanding){this.lastLanding.dragLanding._dragOut(this.lastLanding,A,D)}this.lastLanding=0;if(this._onNotFound){this._onNotFound()}}}};dhtmlDragAndDropObject.prototype.stopDrag=function(C,D){dragger=window.dhtmlDragAndDrop;if(!D){dragger.stopFrameRoute();var A=dragger.lastLanding;dragger.lastLanding=null;if(A){A.dragLanding._drag(dragger.dragStartNode,dragger.dragStartObject,A)}}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(C){if(C){window.dhtmlDragAndDrop.stopDrag(1,1)}for(var A=0;A<window.frames.length;A++){if((window.frames[A]!=C)&&(window.frames[A].dhtmlDragAndDrop)){window.frames[A].dhtmlDragAndDrop.stopFrameRoute(window)}}if((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=C)){parent.dhtmlDragAndDrop.stopFrameRoute(window)}};dhtmlDragAndDropObject.prototype.initFrameRoute=function(C,D){if(C){window.dhtmlDragAndDrop.preCreateDragCopy();window.dhtmlDragAndDrop.dragStartNode=C.dhtmlDragAndDrop.dragStartNode;window.dhtmlDragAndDrop.dragStartObject=C.dhtmlDragAndDrop.dragStartObject;window.dhtmlDragAndDrop.dragNode=C.dhtmlDragAndDrop.dragNode;window.dhtmlDragAndDrop.gldragNode=C.dhtmlDragAndDrop.dragNode;window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;window.waitDrag=0;if(((!_isIE)&&(D))&&((!_isFF)||(_FFrv<1.8))){window.dhtmlDragAndDrop.calculateFramePosition()}}if((parent.dhtmlDragAndDrop)&&(parent!=window)&&(parent!=C)){parent.dhtmlDragAndDrop.initFrameRoute(window)}for(var A=0;A<window.frames.length;A++){if((window.frames[A]!=C)&&(window.frames[A].dhtmlDragAndDrop)){window.frames[A].dhtmlDragAndDrop.initFrameRoute(window,((!C||D)?1:0))}}};var _isFF=false;var _isIE=false;var _isOpera=false;var _isKHTML=false;var _isMacOS=false;if(navigator.userAgent.indexOf("Macintosh")!=-1){_isMacOS=true}if((navigator.userAgent.indexOf("Safari")!=-1)||(navigator.userAgent.indexOf("Konqueror")!=-1)){_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}else{_isFF=true;var _FFrv=parseFloat(navigator.userAgent.split("rv:")[1])}}}function isIE(){if(navigator.appName.indexOf("Microsoft")!=-1){if(navigator.userAgent.indexOf("Opera")==-1){return true}}return false}dtmlXMLLoaderObject.prototype.doXPath=function(D,A){if((_isOpera)||(_isKHTML)){return this.doXPathOpera(D,A)}if(_isIE){if(!A){if(!this.xmlDoc.nodeName){A=this.xmlDoc.responseXML}else{A=this.xmlDoc}}return A.selectNodes(D)}else{var F=A;if(!A){if(!this.xmlDoc.nodeName){A=this.xmlDoc.responseXML}else{A=this.xmlDoc}}if(A.nodeName.indexOf("document")!=-1){F=A}else{F=A;A=A.ownerDocument}var H=new Array();var C=A.evaluate(D,F,null,XPathResult.ANY_TYPE,null);var E=C.iterateNext();while(E){H[H.length]=E;E=C.iterateNext()}return H}};if((window.Node)&&(!_isKHTML)){Node.prototype.removeNode=function(D){var C=this;if(Boolean(D)){return this.parentNode.removeChild(C)}else{var A=document.createRange();A.selectNodeContents(C);return this.parentNode.replaceChild(A.extractContents(),C)}}}function _dhtmlxError(C,A,D){if(!this.catches){this.catches=new Array()}return this}_dhtmlxError.prototype.catchError=function(C,A){this.catches[C]=A};_dhtmlxError.prototype.throwError=function(C,A,D){if(this.catches[C]){return this.catches[C](C,A,D)}if(this.catches.ALL){return this.catches.ALL(C,A,D)}return null};window.dhtmlxError=new _dhtmlxError();dtmlXMLLoaderObject.prototype.doXPathOpera=function(D,A){var F=D.replace(/[\/]+/gi,"/").split("/");var E=null;var C=1;if(!F.length){return[]}if(F[0]=="."){E=[A]}else{if(F[0]==""){E=this.xmlDoc.responseXML.getElementsByTagName(F[C].replace(/\[[^\]]*\]/g,""));C++}else{return[]}}for(C;C<F.length;C++){E=this._getAllNamedChilds(E,F[C])}if(F[C-1].indexOf("[")!=-1){E=this._filterXPath(E,F[C-1])}return E};dtmlXMLLoaderObject.prototype._filterXPath=function(C,A){var E=new Array();var A=A.replace(/[^\[]*\[\@/g,"").replace(/[\[\]\@]*/g,"");for(var D=0;D<C.length;D++){if(C[D].getAttribute(A)){E[E.length]=C[D]}}return E};dtmlXMLLoaderObject.prototype._getAllNamedChilds=function(C,A){var F=new Array();for(var E=0;E<C.length;E++){for(var D=0;D<C[E].childNodes.length;D++){if(C[E].childNodes[D].tagName==A){F[F.length]=C[E].childNodes[D]}}}return F};function dhtmlXHeir(C,A){for(c in A){if(typeof (A[c])=="function"){C[c]=A[c]}}return C}function dhtmlxEvent(C,D,A){if(C.addEventListener){C.addEventListener(D,A,false)}else{if(C.attachEvent){C.attachEvent("on"+D,A)}}}var globalActiveDHTMLGridObject;String.prototype._dhx_trim=function(){return this.replace(/&nbsp;/g," ").replace(/(^[ \t]*)|([ \t]*$)/g,"")};function dhtmlxArray(A){return dhtmlXHeir((A||new Array()),new _dhtmlxArray())}function _dhtmlxArray(){return this}_dhtmlxArray.prototype._dhx_find=function(C){for(var A=0;A<this.length;A++){if(C==this[A]){return A}}return -1};_dhtmlxArray.prototype._dhx_delAt=function(C){if(Number(C)<0||this.length==0){return false}for(var A=C;A<this.length;A++){this[A]=this[A+1]}this.length--};_dhtmlxArray.prototype._dhx_insertAt=function(D,C){this[this.length]=null;for(var A=this.length-1;A>=D;A--){this[A]=this[A-1]}this[D]=C};_dhtmlxArray.prototype._dhx_removeAt=function(C){for(var A=C;A<this.length;A++){this[A]=this[A+1]}this.length--};_dhtmlxArray.prototype._dhx_swapItems=function(A,D){var C=this[A];this[A]=this[D];this[D]=C};function dhtmlXGridObject(id){if(_isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}if(id){if(typeof (id)=="object"){this.entBox=id;this.entBox.id="cgrid2_"+(new Date()).getTime()}else{this.entBox=document.getElementById(id)}}else{this.entBox=document.createElement("DIV");this.entBox.id="cgrid2_"+(new Date()).getTime()}this._tttag=this._tttag||"rows";this._cttag=this._cttag||"cell";this._rttag=this._rttag||"row";var self=this;this._wcorr=0;this.nm=this.entBox.nm||"grid";this.cell=null;this.row=null;this.editor=null;this._f2kE=true;this._dclE=true;this.combos=new Array(0);this.defVal=new Array(0);this.rowsAr=new Array(0);this.rowsCol=new dhtmlxArray(0);this._maskArr=new Array(0);this.selectedRows=new dhtmlxArray(0);this.rowsBuffer=new Array(new dhtmlxArray(0),new dhtmlxArray(0));this.loadedKidsHash=null;this.UserData=new Array(0);this.styleSheet=document.styleSheets;this.entBox.className="gridbox";this.entBox.style.width=this.entBox.getAttribute("width")||(window.getComputedStyle?window.getComputedStyle(this.entBox,null)["width"]:(this.entBox.currentStyle?this.entBox.currentStyle.width:0))||"100%";this.entBox.style.height=this.entBox.getAttribute("height")||(window.getComputedStyle?window.getComputedStyle(this.entBox,null)["height"]:(this.entBox.currentStyle?this.entBox.currentStyle.height:0))||"100%";this.entBox.style.cursor="default";this.entBox.onselectstart=function(){return false};this.obj=document.createElement("TABLE");this.obj.cellSpacing=0;this.obj.cellPadding=0;this.obj.style.width="100%";this.obj.style.tableLayout="fixed";this.obj.className="obj";this.obj._rows=function(i){return this.rows[i+1]};this.obj._rowslength=function(){return this.rows.length-1};this.hdr=document.createElement("TABLE");this.hdr.style.border="1px solid gray";this.hdr.cellSpacing=0;this.hdr.cellPadding=0;if((!_isOpera)||(_OperaRv>=9)){this.hdr.style.tableLayout="fixed"}this.hdr.className="hdr";this.hdr.width="100%";this.xHdr=document.createElement("TABLE");this.xHdr.cellPadding=0;this.xHdr.cellSpacing=0;var r=this.xHdr.insertRow(0);var c=r.insertCell(0);r.insertCell(1).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";c.appendChild(this.hdr);this.objBuf=document.createElement("DIV");this.objBuf.appendChild(this.obj);this.entCnt=document.createElement("TABLE");this.entCnt.insertRow(0).insertCell(0);this.entCnt.insertRow(1).insertCell(0);this.entCnt.cellPadding=0;this.entCnt.cellSpacing=0;this.entCnt.width="100%";this.entCnt.height="100%";this.entCnt.style.tableLayout="fixed";this.objBox=document.createElement("DIV");this.objBox.style.width="100%";this.objBox.style.height=this.entBox.style.height;this.objBox.style.overflow="auto";this.objBox.style.position="relative";this.objBox.appendChild(this.objBuf);this.objBox.className="objbox";this.hdrBox=document.createElement("DIV");this.hdrBox.style.width="100%";if(((_isOpera)&&(_OperaRv<9))){this.hdrSizeA=25}else{this.hdrSizeA=100}this.hdrBox.style.height=this.hdrSizeA+"px";if(_isIE){this.hdrBox.style.overflowX="hidden"}else{this.hdrBox.style.overflow="hidden"}this.hdrBox.style.position="relative";this.hdrBox.appendChild(this.xHdr);this.preloadImagesAr=new Array(0);this.sortImg=document.createElement("IMG");this.sortImg.style.display="none";this.hdrBox.insertBefore(this.sortImg,this.xHdr);this.entCnt.rows[0].cells[0].vAlign="top";this.entCnt.rows[0].cells[0].appendChild(this.hdrBox);this.entCnt.rows[1].cells[0].appendChild(this.objBox);this.entBox.appendChild(this.entCnt);this.entBox.grid=this;this.objBox.grid=this;this.hdrBox.grid=this;this.obj.grid=this;this.hdr.grid=this;this.cellWidthPX=new Array(0);this.cellWidthPC=new Array(0);this.cellWidthType=this.entBox.cellwidthtype||"px";this.delim=this.entBox.delimiter||",";this._csvDelim=",";this.hdrLabels=(this.entBox.hdrlabels||"").split(",");this.columnIds=(this.entBox.columnids||"").split(",");this.columnColor=(this.entBox.columncolor||"").split(",");this.cellType=dhtmlxArray((this.entBox.cellstype||"").split(","));this.cellAlign=(this.entBox.cellsalign||"").split(",");this.initCellWidth=(this.entBox.cellswidth||"").split(",");this.fldSort=(this.entBox.fieldstosort||"").split(",");this.imgURL=this.entBox.imagesurl||"gridCfx/";this.isActive=false;this.isEditable=true;this.raNoState=this.entBox.ranostate||null;this.chNoState=this.entBox.chnostate||null;this.selBasedOn=(this.entBox.selbasedon||"cell").toLowerCase();this.selMultiRows=this.entBox.selmultirows||false;this.multiLine=this.entBox.multiline||false;this.noHeader=this.entBox.noheader||false;this.dynScroll=this.entBox.dynscroll||false;this.dynScrollPageSize=0;this.dynScrollPos=0;this.xmlFileUrl=this.entBox.xmlfileurl||"";this.recordsNoMore=this.entBox.infinitloading||true;this.useImagesInHeader=false;this.pagingOn=false;this.rowsBufferOutSize=0;this.onCheckbox=this.onEnter=this.onRowSelect=this.onEditCell=function(){return true};dhtmlxEvent(window,"unload",function(){try{self.destructor()}catch(e){}});this.loadXML=function(url,afterCall){if(this._dload){this._dload=url;this._askRealRows();return true}if(this._xmlaR){this.setXMLAutoLoading(url)}if(url.indexOf("?")!=-1){var s="&"}else{var s="?"}var obj=this;if(this.onXLS){this.onXLS(this)}if(afterCall){this.xmlLoader.waitCall=afterCall}this.xmlLoader.loadXML(url+""+s+"rowsLoaded="+this.getRowsNum()+"&lastid="+this.getRowId(this.getRowsNum()-1)+"&sn="+Date.parse(new Date()))};this.setSkin=function(name){this.entBox.className="gridbox gridbox_"+name;switch(name){case"xp":this._srdh=22;break;case"gray":this._borderFix=(_isIE?1:0);break}};this.doLoadDetails=function(obj){var root=self.xmlLoader.getXMLTopNode(self._tttag);if(root.tagName!="DIV"){if(!self.xmlLoader.xmlDoc.nodeName){self.parseXML(self.xmlLoader.xmlDoc.responseXML)}else{self.parseXML(self.xmlLoader.xmlDoc)}}if(self.pagingOn){self.createPagingBlock()}};this.xmlLoader=new dtmlXMLLoaderObject(this.doLoadDetails,window,true,this.no_cashe);if(_isIE){this.preventIECashing(true)}this.dragger=new dhtmlDragAndDropObject();this._doOnScroll=function(e,mode){if(this._onSCRL){this._onSCRL(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}this.setSortImgPos(null,true);if(mode){return }if(!this.pagingOn&&this.objBox.scrollTop+this.hdrSizeA+this.objBox.offsetHeight>this.objBox.scrollHeight){if(this._xml_ready&&(this.objBox._oldScrollTop!=this.objBox.scrollTop)&&this.addRowsFromBuffer()){this.objBox.scrollTop=this.objBox.scrollHeight-(this.hdrSizeA+1+this.objBox.offsetHeight);this.objBox._oldScrollTop=this.objBox.scrollTop}}if(this._dload){if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}this._dLoadTimer=window.setTimeout(function(){self._askRealRows()},500)}};this.attachToObject=function(obj){obj.appendChild(this.entBox)};this.init=function(fl){this.lastClicked=null;this.resized=null;this.fldSorted=null;this.gridWidth=0;this.gridHeight=0;this.cellWidthPX=new Array(0);this.cellWidthPC=new Array(0);if(this.hdr.rows.length>0){this.clearAll(true)}if(this.cellType._dhx_find("tree")!=-1){this.loadedKidsHash=new Hashtable();this.loadedKidsHash.put("hashOfParents",new Hashtable())}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}if(_isIE){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.setHeaderCol(i,this.hdrLabels[i])}if(col_ex==0){hdrRow._childIndexes=null}this._cCount=this.hdrLabels.length;if(_isIE){window.setTimeout(function(){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){tar.style.position="absolute"}else{tar.style.height="auto"}for(var i=0;i<this.hdrLabels.length;i++){tar.appendChild(document.createElement("TH"))}}this.setColumnIds();if(this.multiLine==-1){this.multiLine=true}if(this.multiLine!=true){this.obj.className+=" row20px"}this.sortImg.style.position="absolute";this.sortImg.style.display="none";this.sortImg.src=this.imgURL+"sort_desc.gif";this.sortImg.defLeft=0;this.entCnt.rows[0].style.display="";if(this.noHeader){this.entCnt.rows[0].style.display="none"}else{this.noHeader=false}this.setSizes();this.attachHeader();this.attachHeader(0,0,"_aFoot");if(fl){this.parseXML()}this.obj.scrollTop=0;if(this.dragAndDropOff){this.dragger.addDragLanding(this.entBox,this)}if(this._initDrF){this._initD()}};this.setSizes=function(fl){if((!this.noHeader)&&((!this.hdr.rows[0])||(!this.hdrBox.offsetWidth))){return }if(fl&&this.gridWidth==this.entBox.offsetWidth&&this.gridHeight==this.entBox.offsetHeight){return false}else{if(fl){this.gridWidth=this.entBox.offsetWidth;this.gridHeight=this.entBox.offsetHeight}}if((!this.hdrBox.offsetHeight)&&(this.hdrBox.offsetHeight>0)){this.entCnt.rows[0].cells[0].height=this.hdrBox.offsetHeight+"px"}var gridWidth=parseInt(this.entBox.offsetWidth);var gridHeight=parseInt(this.entBox.offsetHeight);var _isVSroll=(this.objBox.scrollHeight>this.objBox.offsetHeight);if(((!this._ahgr)&&(_isVSroll))||((this._ahgrM)&&(this._ahgrM<this.objBox.scrollHeight))){gridWidth-=(this._scrFix||(_isFF?19:16))}var len=this.hdr.rows[0].cells.length;for(var i=0;i<this._cCount;i++){if(this.cellWidthType=="px"&&this.cellWidthPX.length<len){this.cellWidthPX[i]=this.initCellWidth[i]-this._wcorr}else{if(this.cellWidthType=="%"&&this.cellWidthPC.length<len){this.cellWidthPC[i]=this.initCellWidth[i]}}if(this.cellWidthPC.length!=0){this.cellWidthPX[i]=parseInt(gridWidth*this.cellWidthPC[i]/100)}}var wcor=this.entBox.offsetWidth-this.entBox.clientWidth;var summ=0;var fcols=new Array();for(var i=0;i<this._cCount;i++){if(this.initCellWidth[i]=="*"){fcols[fcols.length]=i}else{summ+=parseInt(this.cellWidthPX[i])}}if(fcols.length){var ms=Math.floor((gridWidth-summ-1-wcor)/fcols.length);if(ms<0){ms=1}for(var i=0;i<fcols.length;i++){this.cellWidthPX[fcols[i]]=ms-this._wcorr;summ+=ms}}this.chngCellWidth();var summ=0;for(var i=0;i<this._cCount;i++){summ+=parseInt(this.cellWidthPX[i])}if(_isOpera){summ-=1}this.objBuf.style.width=summ+"px";this.objBuf.childNodes[0].style.width=summ+"px";this.doOnScroll(0,1);this.hdr.style.border="0px solid gray";var zheight=this.hdr.offsetHeight+(this._borderFix?this._borderFix:0);if(this._ahgr){if(this.objBox.scrollHeight){if(_isIE){var z2=this.objBox.scrollHeight}else{var z2=this.objBox.childNodes[0].scrollHeight}var scrfix=((this.objBox.offsetWidth<this.objBox.scrollWidth)?(_isFF?20:18):1);if(this._ahgrMA){z2=this.entBox.parentNode.offsetHeight-zheight-scrfix}if(this._ahgrM){z2=(z2>this._ahgrM?this._ahgrM:z2)*1}gridHeight=z2+zheight+scrfix;this.entBox.style.height=gridHeight+"px"}}var aRow=this.entCnt.rows[1].cells[0].childNodes[0];if(!this.noHeader){aRow.style.top=(zheight-this.hdrBox.offsetHeight+(_isFF?0:(1-wcor)))+"px"}aRow.style.height=(((gridHeight-zheight-1)<0&&_isIE)?20:(gridHeight-zheight-1))-(this.ftr?this.ftr.offsetHeight:0)+"px";if(this.ftr){this.entCnt.style.height=this.entBox.offsetHeight-this.ftr.offsetHeight+"px"}if(this._dload){this._dloadSize=Math.floor(parseInt(this.entBox.style.height)/20)+2}};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,""));var el=window;var self=this;if(el.addEventListener){if((_isFF)&&(_FFrv<1.8)){el.addEventListener("resize",function(){if(!self.entBox){return }var z=self.entBox.style.width;self.entBox.style.width="1px";window.setTimeout(function(){self.entBox.style.width=z;self.setSizes()},10)},false)}else{el.addEventListener("resize",function(){if(self.setSizes){self.setSizes()}},false)}}else{if(el.attachEvent){el.attachEvent("onresize",function(){if(self._resize_timer){window.clearTimeout(self._resize_timer)}if(self.setSizes){self._resize_timer=window.setTimeout(function(){self.setSizes()},500)}})}}};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])-2}}}};this.enableMultiline=function(state){this.multiLine=convertStringToBoolean(state)};this.enableMultiselect=function(state){this.selMultiRows=convertStringToBoolean(state)};this.setImagePath=function(path){this.imgURL=path};this.changeCursorState=function(ev){var el=ev.target||ev.srcElement;if(el.tagName!="TD"){el=this.getFirstParentOfType(el,"TD")}if((el.tagName=="TD")&&(this._drsclmn)&&(!this._drsclmn[el._cellIndex])){return }if((el.offsetWidth-(ev.offsetX||(parseInt(this.getPosition(el,this.hdrBox))-ev.layerX)*-1))<10){el.style.cursor="E-resize"}else{el.style.cursor="default"}if(_isOpera){this.hdrBox.scrollLeft=this.objBox.scrollLeft}};this.startColResize=function(ev){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 }this.entBox.onmousemove=function(e){this.grid.doColResize(e||window.event,el,startW,x,tabW)};document.body.onmouseup=new Function("","document.getElementById('"+this.entBox.id+"').grid.stopColResize()")}};this.stopColResize=function(){this.entBox.onmousemove="";document.body.onmouseup="";this.setSizes();this.doOnScroll(0,1);if(this.onRSE){this.onRSE(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.onRSI)&&(!this.onRSI(el._cellIndex,fcolW,this))){return }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++){this._setColumnSizeR(el._cellIndexS+i*1,a_sizes[i])}}else{this._setColumnSizeR(el._cellIndex,fcolW)}this.doOnScroll(0,1);if(_isOpera){this.setSizes()}this.objBuf.childNodes[0].style.width=""};this._setColumnSizeR=function(ind,fcolW){if(fcolW>(this._drsclmW?(this._drsclmW[ind]||10):10)){this.obj.firstChild.firstChild.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-=(this._scrFix||(_isFF?19:16))}var pcWidth=Math.round(fcolW/gridWidth*100);this.cellWidthPC[ind]=pcWidth}}};this.setSortImgState=function(state,ind,direction){if(!convertStringToBoolean(state)){this.sortImg.style.display="none";return }if(direction=="ASC"){this.sortImg.src=this.imgURL+"sort_asc.gif"}else{this.sortImg.src=this.imgURL+"sort_desc.gif"}this.sortImg.style.display="";this.fldSorted=this.hdr.rows[0].cells[ind];this.setSortImgPos(ind)};this.setSortImgPos=function(ind,mode){if(!ind){var el=this.fldSorted}else{var el=this.hdr.rows[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){globalActiveDHTMLGridObject=this;this.isActive=true}else{this.isActive=false}};this._doClick=function(ev){var selMethod=0;var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");var fl=true;if(this.selMultiRows!=false){if(ev.shiftKey&&this.row!=null){selMethod=1}if(ev.ctrlKey){selMethod=2}}this.doClick(el,fl,selMethod)};this._doContClick=function(ev){var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if((!el)||(el.parentNode.idd===undefined)){return true}if(ev.button==2){if((this.onRCL)&&(!this.onRCL(el.parentNode.idd,el._cellIndex,ev))){return }if(this._ctmndx){if((this.onBCM)&&(!this.onBCM(el.parentNode.idd,el._cellIndex,this))){return true}el.contextMenuId=el.parentNode.idd+"_"+el._cellIndex;el.contextMenu=this._ctmndx;el.a=this._ctmndx._contextStart;if(_isIE){ev.srcElement.oncontextmenu=function(){event.cancelBubble=true;return false}}el.a(el,ev);el.a=null}}return true};this.doClick=function(el,fl,selMethod){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"&&(this.rowsCol._dhx_find(this.rowsAr[el.parentNode.idd])!=-1||this.rowsBuffer[0]._dhx_find(el.parentNode.idd)!=-1)){if(this.onSSC){var initial=this.getSelectedId()}var prow=this.row;if(selMethod==0){this.clearSelection()}else{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}this.clearSelection();for(var i=0;i<this.rowsCol.length;i++){if((i>=strt&&i<=end)&&(this.rowsCol[i])&&(!this.rowsCol[i]._sRow)){if((!this.onBFS)||(this.onBFS(this.rowsCol[i].idd,psid))){this.rowsCol[i].className+=" rowselected";this.selectedRows[this.selectedRows.length]=this.rowsCol[i]}}}}else{if(selMethod==2){if(el.parentNode.className.indexOf("rowselected")!=-1){el.parentNode.className=el.parentNode.className.replace("rowselected","");this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode));var skipRowSelection=true}}}}this.editStop();this.cell=el;if((prow==el.parentNode)&&(this._chRRS)){fl=false}this.row=el.parentNode;if((!skipRowSelection)&&(!this.row._sRow)){if((!this.onBFS)||(this.onBFS(this.row.idd,psid))){this.row.className+=" rowselected";if(this.selectedRows._dhx_find(this.row)==-1){this.selectedRows[this.selectedRows.length]=this.row}}else{this.row=true}}if(this.selBasedOn=="cell"){if(this.cell.parentNode.className.indexOf("rowselected")!=-1){this.cell.className=this.cell.className.replace(/cellselected/g,"")+" cellselected"}}if(selMethod!=1){this.lastClicked=el.parentNode}var rid=this.row.idd;var cid=this.cell.cellIndex;if(fl){setTimeout(function(){self.onRowSelect(rid,cid)},100)}if(this.onSSC){var afinal=this.getSelectedId();if(initial!=afinal){this.onSSC(afinal)}}}this.isActive=true;this.moveToVisible(this.cell)};this.selectCell=function(r,cInd,fl,preserve,edit){if(!fl){fl=false}if(typeof (r)!="object"){r=this.rowsCol[r]}var c=r.childNodes[cInd];if(preserve){this.doClick(c,fl,3)}else{this.doClick(c,fl)}if(edit){this.editCell()}};this.moveToVisible=function(cell_obj,onlyVScroll){try{var distance=cell_obj.offsetLeft+cell_obj.offsetWidth+20;if(distance>(this.objBox.offsetWidth+this.objBox.scrollLeft)){var scrollLeft=distance-this.objBox.offsetWidth}else{if(cell_obj.offsetLeft<this.objBox.scrollLeft){var scrollLeft=cell_obj.offsetLeft-5}}if((scrollLeft)&&(!onlyVScroll)){this.objBox.scrollLeft=scrollLeft}var distance=cell_obj.offsetTop+cell_obj.offsetHeight+20;if(distance>(this.objBox.offsetHeight+this.objBox.scrollTop)){var scrollTop=distance-this.objBox.offsetHeight}else{if(cell_obj.offsetTop<this.objBox.scrollTop){var scrollTop=cell_obj.offsetTop-5}}if(scrollTop){this.objBox.scrollTop=scrollTop}}catch(er){}};this.editCell=function(){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}c.className+=" editable";if(this.onEditCell(0,this.row.idd,this.cell._cellIndex)!=false){this._Opera_stop=(new Date).valueOf();this.editor.edit();this.onEditCell(1,this.row.idd,this.cell._cellIndex)}else{this.editor=null}}};this.editStop=function(){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.cell.className=this.cell.className.replace("editable","");if(this.editor.detach()){this.cell.wasChanged=true}var g=this.editor;this.editor=null;var z=this.onEditCell(2,this.row.idd,this.cell._cellIndex,g.getValue(),g.val);if((typeof (z)=="string")||(typeof (z)=="number")){g.setValue(z)}else{if(!z){g.setValue(g.val)}}}};this.doKey=function(ev){if(!ev){return true}if((ev.target||ev.srcElement).value!==window.undefined){var zx=(ev.target||ev.srcElement);if((!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.onKPR)&&(!this.onKPR(ev.keyCode,ev.ctrlKey,ev.shiftKey))){return false}try{var type=this.cellType[this.cell._cellIndex];if(ev.keyCode==13&&(ev.ctrlKey||ev.shiftKey)){var rowInd=this.rowsCol._dhx_find(this.row);if(window.event.ctrlKey&&rowInd!=this.rowsCol.length-1){if(this.row.rowIndex==this.obj._rowslength()-1&&this.dynScroll&&this.dynScroll!="false"){this.doDynScroll("dn")}this.selectCell(this.rowsCol[rowInd+1],this.cell._cellIndex,true)}else{if(ev.shiftKey&&rowInd!=0){if(this.row.rowIndex==0&&this.dynScroll&&this.dynScroll!="false"){this.doDynScroll("up")}this.selectCell(this.rowsCol[rowInd-1],this.cell._cellIndex,true)}}_isIE?ev.returnValue=false:ev.preventDefault()}if(ev.keyCode==13&&!ev.ctrlKey&&!ev.shiftKey){this.editStop();this.onEnter(this.row.idd,this.cell._cellIndex);_isIE?ev.returnValue=false:ev.preventDefault()}if(ev.keyCode==9&&!ev.shiftKey){this.editStop();var aind=this.cell._cellIndex;var arow=this.row;aind++;if(aind>=this.obj.rows[0].childNodes.length){aind=0;arow=this.rowsCol[this.rowsCol._dhx_find(this.row)+1];if(!arow){aind=this.row.childNodes.length-1;return true}}this.selectCell(arow||this.row,aind,((arow)&&(this.row!=arow)));this.editCell();_isIE?ev.returnValue=false:ev.preventDefault()}else{if(ev.keyCode==9&&ev.shiftKey){this.editStop();var aind=this.cell._cellIndex-1;var arow=this.row;if(aind<0){aind=this.obj.rows[0].childNodes.length-1;arow=this.rowsCol[this.rowsCol._dhx_find(this.row)-1];if(!arow){aind=0;return true}}this.selectCell(arow||this.row,aind,((arow)&&(this.row!=arow)));this.editCell();_isIE?ev.returnValue=false:ev.preventDefault()}}if(ev.keyCode==40||ev.keyCode==38){if(this.editor&&this.editor.combo){if(ev.keyCode==40){this.editor.shiftNext()}if(ev.keyCode==38){this.editor.shiftPrev()}return false}else{var rowInd=this.row.rowIndex;if(ev.keyCode==38&&rowInd!=1){this.selectCell(this.obj._rows(rowInd-2),this.cell._cellIndex,true)}else{if(this.pagingOn&&ev.keyCode==38&&rowInd==1&&this.currentPage!=1){this.changePage(this.currentPage-1);this.selectCell(this.obj.rows[this.obj.rows.length-1],this.cell._cellIndex,true)}else{if(ev.keyCode==40&&rowInd!=this.rowsCol.length&&rowInd!=this.obj.rows.length-1){this.selectCell(this.obj._rows(rowInd),this.cell._cellIndex,true)}else{if(this.pagingOn&&ev.keyCode==40&&(this.row!=this.rowsCol[this.rowsCol.length-1]||this.rowsBuffer[0].length>0||!this.recordsNoMore)){this.changePage(this.currentPage+1);this.selectCell(this.obj._rows(0),this.cell._cellIndex,true)}}}}}_isIE?ev.returnValue=false:ev.preventDefault()}if((ev.keyCode==113)&&(this._f2kE)){this.editCell();return false}if(ev.keyCode==32){var c=this.cell;var ed=cells4(c);if(ed.changeState()!=false){_isIE?ev.returnValue=false:ev.preventDefault()}}if(ev.keyCode==27&&this.oe!=false){this.editStop();_isIE?ev.returnValue=false:ev.preventDefault()}if(ev.keyCode==33||ev.keyCode==34){if(this.pagingOn){if(ev.keyCode==33){this.changePage(this.currentPage-1)}else{this.changePage(this.currentPage+1)}}this.selectCell(this.getRowIndex(this.row.idd)+this.rowsBufferOutSize*(ev.keyCode!=33?1:-1),this.cell._cellIndex,true);_isIE?ev.returnValue=false:ev.preventDefault()}if(!this.editor){if(ev.keyCode==37&&this.cellType._dhx_find("tree")!=-1){this.collapseKids(this.row);_isIE?ev.returnValue=false:ev.preventDefault()}if(ev.keyCode==39&&this.cellType._dhx_find("tree")!=-1){this.expandKids(this.row);_isIE?ev.returnValue=false:ev.preventDefault()}}return true}catch(er){return true}};this.getRow=function(cell){if(!cell){cell=window.event.srcElement}if(cell.tagName!="TD"){cell=cell.parentElement}r=cell.parentElement;if(this.cellType[cell._cellIndex]=="lk"){eval(this.onLink+"('"+this.getRowId(r.rowIndex)+"',"+cell._cellIndex+")")}this.selectCell(r,cell._cellIndex,true)};this.selectRow=function(r,fl,preserve){if(typeof (r)!="object"){r=this.rowsCol[r]}this.selectCell(r,0,fl,preserve)};this.sortRows=function(col,type,order){while(this.addRowsFromBuffer(true)){}if(this.cellType._dhx_find("tree")!=-1){return this.sortTreeRows(col,type,order)}var self=this;var arrTS=new Array();var atype=this.cellType[col];for(var i=0;i<this.rowsCol.length;i++){arrTS[this.rowsCol[i].idd]=this.cells3(this.rowsCol[i],col).getValue()}this._sortRows(col,type,order,arrTS)};this._sortRows=function(col,type,order,arrTS){var sort="sort";if(this._sst){sort="stablesort"}if(type=="str"){this.rowsCol[sort](function(a,b){if(order=="asc"){return arrTS[a.idd]>arrTS[b.idd]?1:-1}else{return arrTS[a.idd]<arrTS[b.idd]?1:-1}})}else{if(type=="int"){this.rowsCol[sort](function(a,b){var aVal=parseFloat(arrTS[a.idd])||-99999999999999;var bVal=parseFloat(arrTS[b.idd])||-99999999999999;if(order=="asc"){return aVal-bVal}else{return bVal-aVal}})}else{if(type=="date"){this.rowsCol[sort](function(a,b){var aVal=Date.parse(new Date(arrTS[a.idd])||new Date("01/01/1900"));var bVal=Date.parse(new Date(arrTS[b.idd])||new Date("01/01/1900"));if(order=="asc"){return aVal-bVal}else{return bVal-aVal}})}}}if(this.dynScroll&&this.dynScroll!="false"){alert("not implemented yet")}else{if(this.pagingOn){this.changePage(this.currentPage);if(this.onGridReconstructed){this.onGridReconstructed()}}else{var tb=this.obj.firstChild;if(tb.tagName=="TR"){tb=this.obj}for(var i=0;i<this.rowsCol.length;i++){if(this.rowsCol[i]!=this.obj._rows(i)){tb.insertBefore(this.rowsCol[i],this.obj._rows(i))}}}}if(this.onGridReconstructed){this.onGridReconstructed()}};this.setXMLAutoLoading=function(filePath,bufferSize){if(arguments.length==0){return(this._xmlaR=true)}this.recordsNoMore=false;this.xmlFileUrl=filePath;this.rowsBufferOutSize=bufferSize||this.rowsBufferOutSize==0?40:this.rowsBufferOutSize};this.enableBuffering=function(bufferSize){this.rowsBufferOutSize=bufferSize||this.rowsBufferOutSize==0?40:this.rowsBufferOutSize};this.addRowsFromBuffer=function(stopBeforeServerCall){if(this.rowsBuffer[0].length==0){if(!this.recordsNoMore&&!stopBeforeServerCall){if((this.xmlFileUrl!="")&&(!this._startXMLLoading)){this._startXMLLoading=true;this.loadXML(this.xmlFileUrl)}}else{return false}}var cnt=Math.min(this.rowsBufferOutSize,this.rowsBuffer[0].length);for(var i=0;i<cnt;i++){if(this.rowsBuffer[1][0].tagName=="TR"){this._insertRowAt(this.rowsBuffer[1][0],-1,this.pagingOn)}else{var rowNode=this.rowsBuffer[1][0];this._insertRowAt(this.createRowFromXMLTag(rowNode),-1,this.pagingOn)}this.rowsBuffer[0]._dhx_removeAt(0);this.rowsBuffer[1]._dhx_removeAt(0)}return this.rowsBuffer[0].length!=0};this.createRowFromXMLTag=function(rowNode){if(rowNode.tagName=="TR"){return rowNode}var tree=this.cellType._dhx_find("tree");var rId=rowNode.getAttribute("id");var r=this._fillRowFromXML(this._prepareRow(rId),rowNode,tree,null);this.rowsAr[rId]=r;return r};this.setMultiselect=function(fl){this.selMultiRows=convertStringToBoolean(fl)};this._onDblClickRow=function(){};this.setOnDblClickRow=function(f1){this._onDblClickRow=f1};this.wasDblClicked=function(ev){this._onDblClickRow();var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if(el){var rowId=el.parentNode.idd;return((this.onRowDblClicked)?this.onRowDblClicked(rowId,el._cellIndex):true)}};this._onHeaderClick=function(e){var that=this.grid;var el=that.getFirstParentOfType(_isIE?event.srcElement:e.target,"TD");if((this.grid.onHeaderClick)&&(!this.grid.onHeaderClick(el._cellIndexS))){return false}if(this.grid.resized==null){that.sortField(el._cellIndexS)}};this.deleteSelectedItem=function(){var num=this.selectedRows.length;if(num==0){return }var tmpAr=this.selectedRows;this.selectedRows=new dhtmlxArray(0);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.getSelectedId=function(){var selAr=new Array(0);for(var i=0;i<this.selectedRows.length;i++){selAr[selAr.length]=this.selectedRows[i].idd}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])+((_isFF)?2:0)};this.setColWidth=function(ind,value){if(this.cellWidthType=="px"){this.cellWidthPX[ind]=parseInt(value)}else{this.cellWidthPC[ind]=parseInt(value)}this.setSizes()};this.getRowById=function(id){var row=this.rowsAr[id];if(row){return row}else{if(this._dload){var ind=this.rowsBuffer[0]._dhx_find(id);if(ind>=0){this._askRealRows(ind);return this.getRowById(id)}}else{if(this.pagingOn){var ind=this.rowsBuffer[0]._dhx_find(id);if(ind>=0){var r=this.createRowFromXMLTag(this.rowsBuffer[1][ind]);this.rowsBuffer[1][ind]=r;return r}else{return null}}else{if(this._slowParse){return this._seekAndDeploy(id)}}}}return null};this.getRowByIndex=function(ind){if(this.rowsCol.length<=ind){if((this.rowsCol.length+this.rowsBuffer[0].length)<=ind){return null}else{var indInBuf=ind-this.rowsCol.length-1;var r=this.createRowFromXMLTag(this.rowsBuffer[1][indInBuf]);return r}}else{return this.rowsCol[ind]}};this.getRowIndex=function(row_id){var ind=this.rowsCol._dhx_find(this.getRowById(row_id));if(ind!=-1){return ind}else{ind=this.rowsBuffer[0]._dhx_find(row_id);if(ind!=-1){return ind+this.rowsCol.length}return -1}};this.getRowId=function(ind){var z=this.rowsCol[parseInt(ind)];if(z){return z.idd}return(this.rowsBuffer[0][this._dload?ind:(ind-this.rowsCol.length-1)]||null)};this.setRowId=function(ind,row_id){var r=this.rowsCol[ind];this.changeRowId(r.idd,row_id)};this.changeRowId=function(oldRowId,newRowId){var row=this.rowsAr[oldRowId];row.idd=newRowId;if(this.UserData[oldRowId]){this.UserData[newRowId]=this.UserData[oldRowId];this.UserData[oldRowId]=null}if(this.loadedKidsHash){var oldHash=this.loadedKidsHash.get(oldRowId);if(oldHash!=null){for(var z=0;z<oldHash.length;z++){oldHash[z].parent_id=newRowId}this.loadedKidsHash.put(newRowId,oldHash);this.loadedKidsHash.remove(oldRowId)}var parentsHash=this.loadedKidsHash.get("hashOfParents");if(parentsHash!=null){if(parentsHash.get(oldRowId)!=null){parentsHash.put(newRowId,row);parentsHash.remove(oldRowId);this.loadedKidsHash.put("hashOfParents",parentsHash)}}}this.rowsAr[oldRowId]=null;this.rowsAr[newRowId]=row};this.setColumnIds=function(ids){if(ids){this.columnIds=ids.split(",")}if(this.hdr.rows.length>0){if(this.hdr.rows[0].cells.length>=this.columnIds.length){for(var i=0;i<this.columnIds.length;i++){this.hdr.rows[0].cells[i].column_id=this.columnIds[i]}}}};this.getColIndexById=function(id){for(var i=0;i<this.hdr.rows[0].cells.length;i++){if(this.hdr.rows[0].cells[i].column_id==id){return i}}};this.getColumnId=function(cin){return this.hdr.rows[0].cells[cin].column_id};this.getHeaderCol=function(cin){var z=this.hdr.rows[1];return z.cells[z._childIndexes?z._childIndexes[parseInt(cin)]:cin].innerHTML};this.setRowTextBold=function(row_id){this.getRowById(row_id).style.fontWeight="bold"};this.setRowTextStyle=function(row_id,styleString){var r=this.getRowById(row_id);for(var i=0;i<r.childNodes.length;i++){var pfix="";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 }if(ind<r.childNodes.length){var pfix="";if(_isIE){r.childNodes[ind].style.cssText=pfix+"width:"+r.childNodes[ind].style.width+";"+styleString}else{r.childNodes[ind].style.cssText=pfix+"width:"+r.childNodes[ind].style.width+";"+styleString}}};this.setRowTextNormal=function(row_id){this.getRowById(row_id).style.fontWeight="normal"};this.isItemExists=function(row_id){if(this.getRowById(row_id)!=null){return true}else{return false}};this.getRowsNum=function(){if(this._dload){return this.limit}return this.rowsCol.length+this.rowsBuffer[0].length};this.getColumnCount=function(){return this.hdr.rows[0].cells.length};this.moveRowUp=function(row_id){var r=this.getRowById(row_id);var rInd=this.rowsCol._dhx_find(r);if(this.isTreeGrid()){if(this.rowsCol[rInd].parent_id!=this.rowsCol[rInd-1].parent_id){return }this.collapseKids(r)}this.rowsCol._dhx_swapItems(rInd,rInd-1);if(r.previousSibling){r.parentNode.insertBefore(r,r.previousSibling);this.setSizes()}};this.moveRowDown=function(row_id){var r=this.getRowById(row_id);var rInd=this.rowsCol._dhx_find(r);if(this.isTreeGrid()){if(this.rowsCol[rInd].parent_id!=this.rowsCol[rInd+1].parent_id){return }}this.rowsCol._dhx_swapItems(rInd,rInd+1);if(r.nextSibling){if(r.nextSibling.nextSibling){r.parentNode.insertBefore(r,r.nextSibling.nextSibling)}else{r.parentNode.appendChild(r)}this.setSizes()}};this.cells=function(row_id,col){if(arguments.length==0){return this.cells4(this.cell)}else{var c=this.getRowById(row_id)}var cell=(c._childIndexes?c.childNodes[c._childIndexes[col]]:c.childNodes[col]);return this.cells4(cell)};this.cells2=function(row_index,col){var c=this.rowsCol[parseInt(row_index)];var cell=(c._childIndexes?c.childNodes[c._childIndexes[col]]:c.childNodes[col]);return this.cells4(cell)};this.cells3=function(row,col){var cell=(row._childIndexes?row.childNodes[row._childIndexes[col]]:row.childNodes[col]);return this.cells4(cell)};this.cells4=function(cell){if(!cell._cellType){return eval("new eXcell_"+this.cellType[cell._cellIndex]+"(cell)")}else{return eval("new eXcell_"+cell._cellType+"(cell)")}};this.getCombo=function(col_ind){if(this.cellType[col_ind].indexOf("co")==0){if(!this.combos[col_ind]){this.combos[col_ind]=new dhtmlXGridComboObject()}return this.combos[col_ind]}else{return null}};this.setUserData=function(row_id,name,value){try{if(row_id==""){row_id="gridglobaluserdata"}if(!this.UserData[row_id]){this.UserData[row_id]=new Hashtable()}this.UserData[row_id].put(name,value)}catch(er){alert("UserData Error:"+er.description)}};this.getUserData=function(row_id,name){if(row_id==""){row_id="gridglobaluserdata"}var z=this.UserData[row_id];return(z?z.get(name):"")};this.setEditable=function(fl){if(fl!="true"&&fl!=1&&fl!=true){ifl=true}else{ifl=false}for(var j=0;j<this.cellType.length;j++){if(this.cellType[j].indexOf("ra")==0||this.cellType[j]=="ch"){for(var i=0;i<this.rowsCol.length;i++){var z=this.rowsCol[i].cells[j];if((z.childNodes.length>0)&&(z.firstChild.nodeType==1)){this.rowsCol[i].cells[j].firstChild.disabled=ifl}}}}this.isEditable=!ifl};this.setSelectedRow=function(row_id,multiFL,show,call){if(!call){call=false}this.selectCell(this.getRowById(row_id),0,call,multiFL);if(arguments.length>2&&show==true){this.moveToVisible(this.getRowById(row_id).cells[0],true)}};this.clearSelection=function(){this.editStop();for(var i=0;i<this.selectedRows.length;i++){this.selectedRows[i].className=this.selectedRows[i].className.replace(/rowselected/g,"")}this.selectedRows=new dhtmlxArray(0);this.row=null;if(this.cell!=null){this.cell.className=this.cell.className.replace(/cellselected/g,"");this.cell=null}};this.copyRowContent=function(from_row_id,to_row_id){var frRow=this.getRowById(from_row_id);if(!this.isTreeGrid()){for(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.setHeaderCol=function(col,label){var z=this.hdr.rows[1];var col=(z._childIndexes?z._childIndexes[col]:col);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}else{z.cells[col].style.textAlign="left";z.cells[col].innerHTML="<img src='"+this.imgURL+""+label+"' onerror='this.src = \""+this.imgURL+"imageloaderror.gif\"'>";var a=new Image();a.src=this.imgURL+""+label.replace(/(\.[a-z]+)/,".desc$1");this.preloadImagesAr[this.preloadImagesAr.length]=a;var b=new Image();b.src=this.imgURL+""+label.replace(/(\.[a-z]+)/,".asc$1");this.preloadImagesAr[this.preloadImagesAr.length]=b}};this.clearAll=function(header){this.limit=this._limitC=0;this.editStop();if(this._dload){this.objBox.scrollTop=0;this.limit=this._limitC||0;this._initDrF=true}var len=this.rowsCol.length;if(this.loadedKidsHash!=null){this.loadedKidsHash.clear();this.loadedKidsHash.put("hashOfParents",new Hashtable())}len=this.obj._rowslength();for(var i=len-1;i>=0;i--){var t_r=this.obj._rows(i);t_r.parentNode.removeChild(t_r)}if(header){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)}}this.row=null;this.cell=null;this._hrrar=null;this.rowsCol=new dhtmlxArray(0);this.rowsAr=new Array(0);this.rowsBuffer=new Array(new dhtmlxArray(0),new dhtmlxArray(0));this.UserData=new Array(0);if(this.pagingOn){this.changePage(1)}if((this._hideShowColumn)&&(this.hdr.rows[0])){for(var i=0;i<this.hdr.rows[0].length;i++){this._hideShowColumn(i,"")}}this._hrrar=new Array();if(this._sst){this.enableStableSorting(true)}this.setSizes()};this.sortField=function(ind,repeatFl){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"){if((((this.sortImg.src.indexOf("_desc.gif")==-1)&&(!repeatFl))||((this.sortImg.style.filter!="")&&(repeatFl)))&&(this.fldSorted==el)){var sortType="desc";this.sortImg.src=this.imgURL+"sort_desc.gif"}else{var sortType="asc";this.sortImg.src=this.imgURL+"sort_asc.gif"}if((this.onCLMS)&&(!this.onCLMS(ind,this,sortType))){return }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(/\.[ascde]+\./,".")}cel.src=cel.src.replace(/(\.[a-z]+)/,"."+sortType+"$1")}this.sortRows(el._cellIndex,this.fldSort[el._cellIndex],sortType);this.fldSorted=el;var c=this.hdr.rows[1];var real_el=c._childIndexes?c._childIndexes[el._cellIndex]:el._cellIndex;this.setSortImgPos(this.hdr.rows[1].childNodes[real_el]._cellIndex)}};this.enableHeaderImages=function(fl){this.useImagesInHeader=fl};this.setHeader=function(hdrStr,splitSign){var arLab=hdrStr.split(this.delim);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]="";arSrt[arSrt.length]="na"}this.splitSign=splitSign||"#cspan";this.hdrLabels=arLab;this.cellWidth=arWdth;this.cellType=arTyp;this.cellAlign=arAlg;this.cellVAlign=arVAlg;this.fldSort=arSrt};this.getColType=function(cell_index){return this.cellType[cell_index]};this.getColTypeById=function(col_id){return this.cellType[this.getColIndexById(col_id)]};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]}}}};this.setColSorting=function(sortStr){this.fldSort=sortStr.split(this.delim)};this.setColAlign=function(alStr){this.cellAlign=alStr.split(this.delim)};this.setColVAlign=function(alStr){this.cellVAlign=alStr.split(this.delim)};this.setMultiLine=function(fl){if(fl==true){this.multiLine=-1}};this.setNoHeader=function(fl){if(fl==true){this.noHeader=true}};this.showRow=function(rowID){this.moveToVisible(this.getRowById(rowID).cells[0],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"];for(var i=0;i<prefs.length;i++){if(this.ssModifier[i]){if(_isIE){this.styleSheet[0].addRule(prefs[i],this.ssModifier[i])}else{this.styleSheet[0].insertRule(prefs[i]+"{"+this.ssModifier[i]+"}",0)}}}};this.setColumnColor=function(clr){this.columnColor=clr.split(this.delim)};this.enableAlterCss=function(cssE,cssU){if(cssE||cssU){this.setOnGridReconstructedHandler(function(){this._fixAlterCss()})}this._cssEven=cssE;this._cssUnEven=cssU};this._fixAlterCss=function(ind){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].className.indexOf("rowselected")!=-1){if(j%2==1){this.rowsCol[i].className=this._cssUnEven+" rowselected"}else{this.rowsCol[i].className=this._cssEven+" rowselected"}}else{if(j%2==1){this.rowsCol[i].className=this._cssUnEven}else{this.rowsCol[i].className=this._cssEven}}j++}}};this.doDynScroll=function(fl){if(!this.dynScroll||this.dynScroll=="false"){return false}this.setDynScrollPageSize();var tmpAr=new Array(0);if(fl&&fl=="up"){this.dynScrollPos=Math.max(this.dynScrollPos-this.dynScrollPageSize,0)}else{if(fl&&fl=="dn"&&this.dynScrollPos+this.dynScrollPageSize<this.rowsCol.length){if(this.dynScrollPos+this.dynScrollPageSize+this.rowsBufferOutSize>this.rowsCol.length){this.addRowsFromBuffer()}this.dynScrollPos+=this.dynScrollPageSize}}var start=Math.max(this.dynScrollPos-this.dynScrollPageSize,0);for(var i=start;i<this.rowsCol.length;i++){if(i>=this.dynScrollPos&&i<this.dynScrollPos+this.dynScrollPageSize){tmpAr[tmpAr.length]=this.rowsCol[i]}this.rowsCol[i].removeNode(true)}for(var i=0;i<tmpAr.length;i++){this.obj.childNodes[0].appendChild(tmpAr[i]);if(this.obj.offsetHeight>this.objBox.offsetHeight){this.dynScrollPos-=(this.dynScrollPageSize-i)}}this.setSizes()};this.setDynScrollPageSize=function(){if(this.dynScroll&&this.dynScroll!="false"){var rowsH=0;try{var rowH=this.obj._rows(0).scrollHeight}catch(er){var rowH=20}for(var i=0;i<1000;i++){rowsH=i*rowH;if(this.objBox.offsetHeight<rowsH){break}}this.dynScrollPageSize=i+2;this.rowsBufferOutSize=this.dynScrollPageSize*4}};this.dhx_attachEvent=function(original,catcher){if((!this[original])||(!this[original].dhx_addEvent)){var z=new this.dhx_eventCatcher(this);z.dhx_addEvent(this[original]);this[original]=z}this[original].dhx_addEvent(catcher)};this.dhx_eventCatcher=function(obj){var dhx_catch=new Array();var m_obj=obj;var z=function(){if(dhx_catch){var res=true}for(var i=0;i<dhx_catch.length;i++){if(!dhx_catch[i].apply(m_obj,arguments)){res=false}}return res};z.dhx_addEvent=function(ev){if(typeof (ev)!="function"){ev=eval(ev)}if(ev){dhx_catch[dhx_catch.length]=ev}};return z};this.setOnRowSelectHandler=function(func,anyClick){this.dhx_attachEvent("onRowSelect",func);this._chRRS=(!convertStringToBoolean(anyClick))};this.setOnScrollHandler=function(func){this.dhx_attachEvent("_onSCRL",func)};this.setOnEditCellHandler=function(func){this.dhx_attachEvent("onEditCell",func)};this.setOnCheckHandler=function(func){this.dhx_attachEvent("onCheckbox",func)};this.setOnEnterPressedHandler=function(func){this.dhx_attachEvent("onEnter",func)};this.setOnBeforeRowDeletedHandler=function(func){this.dhx_attachEvent("onBeforeRowDeleted",func)};this.setOnRowAddedHandler=function(func){this.dhx_attachEvent("onRowAdded",func)};this.setOnGridReconstructedHandler=function(func){this.dhx_attachEvent("onGridReconstructed",func)};this.getPosition=function(oNode,pNode){if(!pNode){var 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){if(document.documentElement.scrollTop){iTop+=document.documentElement.scrollTop}if(document.documentElement.scrollLeft){iLeft+=document.documentElement.scrollLeft}}else{if(!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop}}}return new Array(iLeft,iTop)};this.getFirstParentOfType=function(obj,tag){while(obj.tagName!=tag&&obj.tagName!="BODY"){obj=obj.parentNode}return obj};this.setColumnCount=function(cnt){alert("setColumnCount method deprecated")};this.showContent=function(){alert("showContent method deprecated")};this.objBox.onscroll=new Function("","this.grid._doOnScroll()");if((!_isOpera)||(_OperaRv>8.5)){this.hdr.onmousemove=new Function("e","this.grid.changeCursorState(e||window.event)");this.hdr.onmousedown=new Function("e","this.grid.startColResize(e||window.event)")}this.obj.onmousemove=this._drawTooltip;this.obj.onclick=new Function("e","this.grid._doClick(e||window.event);if(this.grid._sclE)this.grid.editCell(e||window.event);(e||event).cancelBubble=true;");this.entBox.onmousedown=new Function("e","return this.grid._doContClick(e||window.event);");this.obj.ondblclick=new Function("e","if(!this.grid.wasDblClicked(e||window.event)){return false};if(this.grid._dclE)this.grid.editCell(e||window.event);(e||event).cancelBubble=true;");this.hdr.onclick=this._onHeaderClick;this.hdr.ondblclick=this._onHeaderDblClick;if(!document.body._dhtmlxgrid_onkeydown){dhtmlxEvent(document,"keydown",new Function("e","if(globalActiveDHTMLGridObject)return globalActiveDHTMLGridObject.doKey(e||window.event);return true;"));document.body._dhtmlxgrid_onkeydown=true}dhtmlxEvent(document.body,"click",function(){if(self.editStop){self.editStop()}return true});this.entBox.onbeforeactivate=new Function("","this.grid.setActive();event.cancelBubble=true;");this.entBox.onbeforedeactivate=new Function("","this.grid.isActive=-1;event.cancelBubble=true;");this.doOnRowAdded=function(row){};return this}dhtmlXGridObject.prototype.isTreeGrid=function(){return(this.cellType._dhx_find("tree")!=-1)};dhtmlXGridObject.prototype.addRow=function(A,E,D){var C=this._addRow(A,E,D);if(this.onRowAdded){this.onRowAdded(A)}if(this.onRowCr){this.onRowCr(C.idd,C,null)}if(this.pagingOn){this.changePage(this.currentPage)}this.setSizes();return C};dhtmlXGridObject.prototype._prepareRow=function(A){var D=document.createElement("TR");D.idd=A;D.grid=this;for(var C=0;C<this.hdr.rows[0].cells.length;C++){var E=document.createElement("TD");if(this._enbCid){E.id="c_"+D.idd+"_"+C}E._cellIndex=C;if(this.dragAndDropOff){this.dragger.addDraggableItem(E,this)}E.align=this.cellAlign[C];E.style.verticalAlign=this.cellVAlign[C];E.bgColor=this.columnColor[C]||"";D.appendChild(E)}return D};dhtmlXGridObject.prototype._fillRow=function(C,E){if(!this._parsing_){this.editStop()}this.math_off=true;this.math_req=false;if(typeof (E)!="object"){E=(E||"").split(this.delim)}for(var A=0;A<C.childNodes.length;A++){if((A<E.length)||(this.defVal[A])){var D=E[A];if((this.defVal[A])&&((D=="")||(D===window.undefined))){D=this.defVal[A]}if(this._dload){this.editor=this.cells3(C,C.childNodes[A]._cellIndex)}else{this.editor=this.cells4(C.childNodes[A])}this.editor.setValue(D);this.editor=this.editor.destructor()}else{var D="&nbsp;";C.childNodes[A].innerHTML=D;C.childNodes[A]._clearCell=true}}this.math_off=false;if((this.math_req)&&(!this._parsing_)){for(var A=0;A<this.hdr.rows[0].cells.length;A++){this._checkSCL(C.childNodes[A])}this.math_req=false}return C};dhtmlXGridObject.prototype._insertRowAt=function(D,E,C){if(E<0){E=this.rowsCol.length}if((arguments.length<2)||(E===window.undefined)){E=this.rowsCol.length}else{if(E>this.rowsCol.length){E=this.rowsCol.length}}if(!C){if((E==(this.obj.rows.length-1))||(!this.rowsCol[E])){if(_isKHTML){this.obj.appendChild(D)}else{this.obj.firstChild.appendChild(D)}}else{this.rowsCol[E].parentNode.insertBefore(D,this.rowsCol[E])}}this.rowsAr[D.idd]=D;this.rowsCol._dhx_insertAt(E,D);if(this._cssEven){if(E%2==1){D.className+=" "+this._cssUnEven}else{D.className+=" "+this._cssEven}if(E!=(this.rowsCol.length-1)){this._fixAlterCss(E+1)}}this.doOnRowAdded(D);if((this.math_req)&&(!this._parsing_)){for(var A=0;A<this.hdr.rows[0].cells.length;A++){this._checkSCL(D.childNodes[A])}this.math_req=false}return D};dhtmlXGridObject.prototype._addRow=function(C,F,D){var E=this._fillRow(this._prepareRow(C),F);if(D>this.rowsCol.length&&D<(this.rowsCol.length+this.rowsBuffer[0].length)){var A=D-this.rowsCol.length;this.rowsBuffer[0]._dhx_insertAt(A,C);this.rowsBuffer[1]._dhx_insertAt(A,E);return E}return this._insertRowAt(E,D)};dhtmlXGridObject.prototype.setRowHidden=function(H,D){var C=convertStringToBoolean(D);var F=this.getRowById(H);if(!F){return }if(F.expand===""){this.collapseKids(F)}if((D)&&(F.style.display!="none")){F.style.display="none";var E=this.selectedRows._dhx_find(F);if(E!=-1){F.className=F.className.replace("rowselected","");for(var A=0;A<F.childNodes.length;A++){F.childNodes[A].className=F.childNodes[A].className.replace(/cellselected/g,"")}this.selectedRows._dhx_removeAt(E)}if(this.onGridReconstructed){this.onGridReconstructed()}}if((!D)&&(F.style.display=="none")){F.style.display="";if(this.onGridReconstructed){this.onGridReconstructed()}}};dhtmlXGridObject.prototype.enableRowsHover=function(C,A){this._hvrCss=A;if(convertStringToBoolean(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}}};dhtmlXGridObject.prototype.enableEditEvents=function(C,D,A){this._sclE=convertStringToBoolean(C);this._dclE=convertStringToBoolean(D);this._f2kE=convertStringToBoolean(A)};dhtmlXGridObject.prototype.enableLightMouseNavigation=function(A){if(convertStringToBoolean(A)){if(!this._elmn){this.entBox._onclick=this.entBox.onclick;this.entBox.onclick=function(){return true};this.obj.onclick=function(C){var D=this.grid.getFirstParentOfType(C?C.target:event.srcElement,"TD");this.grid.editStop();this.grid.doClick(D);this.grid.editCell();(C||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=function(){return true};this.obj.onmousemove=this.obj._onmousemove;this._elmn=false}}};dhtmlXGridObject.prototype._unsetRowHover=function(C,D){if(D){that=this}else{that=this.grid}if((that._lahRw)&&(that._lahRw!=D)){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}};dhtmlXGridObject.prototype._setRowHover=function(C){var D=this.grid.getFirstParentOfType(C?C.target:event.srcElement,"TD");if(D){this.grid._unsetRowHover(0,D);D=D.parentNode;for(var A=0;A<D.childNodes.length;A++){D.childNodes[A].className+=" "+this.grid._hvrCss}this.grid._lahRw=D}this._honmousemove(C)};dhtmlXGridObject.prototype._autoMoveSelect=function(A){if(!this.grid.editor){var C=this.grid.getFirstParentOfType(A?A.target:event.srcElement,"TD");if(C.parentNode.idd){this.grid.doClick(C,true,0)}}this._onmousemove(A)};dhtmlXGridObject.prototype.destructor=function(){var A;this.xmlLoader=this.xmlLoader.destructor();for(var C=0;C<this.rowsCol.length;C++){if(this.rowsCol[C]){this.rowsCol[C].grid=null}}for(C in this.rowsAr){if(this.rowsAr[C]){this.rowsAr[C]=null}}this.rowsCol=new dhtmlxArray();this.rowsAr=new Array();this.entBox.innerHTML="";this.entBox.onclick=function(){};this.entBox.onmousedown=function(){};this.entBox.onbeforeactivate=function(){};this.entBox.onbeforedeactivate=function(){};this.entBox.onbeforedeactivate=function(){};for(A in this){if((this[A])&&(this[A].m_obj)){this[A].m_obj=null}this[A]=null}if(this==globalActiveDHTMLGridObject){globalActiveDHTMLGridObject=null}return null};dhtmlXGridObject.prototype.getSortingState=function(){var A=new Array();if(this.fldSorted){A[0]=this.fldSorted._cellIndex;A[1]=(this.sortImg.src.indexOf("sort_desc.gif")!=-1)?"DES":"ASC"}return A};dhtmlXGridObject.prototype.enableAutoHeigth=function(C,A){this._ahgr=convertStringToBoolean(C);this._ahgrM=A||null;if(A=="auto"){this._ahgrM=null;this._ahgrMA=true;this._activeResize()}};dhtmlXGridObject.prototype.enableStableSorting=function(A){this._sst=convertStringToBoolean(A);this.rowsCol.stablesort=function(F){for(var E=0;E<this.length-1;E++){for(var D=E;D<this.length;D++){if(F(this[E],this[D])){var C=this[D];this[D]=this[E];this[E]=C}}}}};dhtmlXGridObject.prototype.enableKeyboardSupport=function(A){this._htkebl=!convertStringToBoolean(A)};dhtmlXGridObject.prototype.enableContextMenu=function(A){this._ctmndx=A};dhtmlXGridObject.prototype.setOnBeforeContextMenu=function(A){this.dhx_attachEvent("onBCM",A)};dhtmlXGridObject.prototype.setOnRightClick=function(A){this.dhx_attachEvent("onRCL",A)};dhtmlXGridObject.prototype.setScrollbarWidthCorrection=function(A){this._scrFix=parseInt(A)};dhtmlXGridObject.prototype.enableTooltips=function(C){this._enbTts=C.split(",");for(var A=0;A<this._enbTts.length;A++){this._enbTts[A]=convertStringToBoolean(this._enbTts[A])}};dhtmlXGridObject.prototype.enableResizing=function(C){this._drsclmn=C.split(",");for(var A=0;A<this._drsclmn.length;A++){this._drsclmn[A]=convertStringToBoolean(this._drsclmn[A])}};dhtmlXGridObject.prototype.setColumnMinWidth=function(A,C){if(arguments.length==2){if(!this._drsclmW){this._drsclmW=new Array()}this._drsclmW[C]=A}else{this._drsclmW=A.split(",")}};dhtmlXGridObject.prototype.enableCellIds=function(A){this._enbCid=convertStringToBoolean(A)};dhtmlXGridObject.prototype.lockRow=function(A,D){var C=this.getRowById(A);if(C){C._locked=convertStringToBoolean(D);if((this.cell)&&(this.cell.parentNode.idd==A)){this.editStop()}}};dhtmlXGridObject.prototype._getRowArray=function(D){var C=new Array();for(var A=0;A<D.childNodes.length;A++){C[A]=this.cells3(D,A).getValue()}return C};dhtmlXGridObject.prototype.parseXML=function(xml,startIndex){this._xml_ready=true;var pid=null;var zpid=null;if(!xml){try{var xmlDoc=eval(this.entBox.id+"_xml").XMLDocument}catch(er){var xmlDoc=this.loadXML(this.xmlFileUrl)}}else{if(typeof (xml)=="object"){var xmlDoc=xml}else{if(xml.indexOf(".")!=-1){if(this.xmlFileUrl==""){this.xmlFileUrl=xml}var xmlDoc=this.loadXML(xml);return }else{var xmlDoc=eval(xml).XMLDocument}}}var ar=new Array();var idAr=new Array();var tree=this.cellType._dhx_find("tree");var rowsCol=this.xmlLoader.doXPath("//rows/row",xmlDoc);if(rowsCol.length==0){this.recordsNoMore=true;var top=this.xmlLoader.doXPath("//rows",xmlDoc);var pid=(top[0].getAttribute("parent")||0);if((tree!=-1)&&(this.rowsAr[pid])){var tree_r=this.rowsAr[pid].childNodes[tree];tree_r.innerHTML=tree_r.innerHTML.replace(/\/(plus)\.gif/,"/blank.gif")}}else{pid=(rowsCol[0].parentNode.getAttribute("parent")||null);zpid=this.getRowById(pid);if(zpid){zpid._xml_await=false}else{pid=null}startIndex=this.getRowIndex(pid)+1}var gudCol=this.xmlLoader.doXPath("//rows/userdata",xmlDoc);if(gudCol.length>0){this.UserData.gridglobaluserdata=new Hashtable();for(var j=0;j<gudCol.length;j++){this.UserData.gridglobaluserdata.put(gudCol[j].getAttribute("name"),gudCol[j].firstChild?gudCol[j].firstChild.data:"")}}if(tree==-1){tree=this.cellType._dhx_find("3d")}if(this._innerParse(rowsCol,startIndex,tree,pid)==-1){return }if(zpid){this.expandKids(zpid)}if(this.dynScroll&&this.dynScroll!="false"){this.doDynScroll()}if(tree!=-1){var oCol=this.xmlLoader.doXPath("//row[@open]",xmlDoc);for(var i=0;i<oCol.length;i++){this.openItem(oCol[i].getAttribute("id"))}}this.setSizes();if(_isOpera){this.obj.style.border=1;this.obj.style.border=0}this._startXMLLoading=false;if(this.onXLE){this.onXLE(this,rowsCol.length)}};dhtmlXGridObject.prototype._postRowProcessing=function(F,C){var H=C.getAttribute("id");var I=C.getAttribute("style");var D=this.xmlLoader.doXPath("./userdata",C);if(D.length>0){this.UserData[H]=new Hashtable();for(var A=0;A<D.length;A++){this.UserData[H].put(D[A].getAttribute("name"),D[A].firstChild?D[A].firstChild.data:"")}}var E=C.getAttribute("class");if(E){F.className+=" "+E}if(C.getAttribute("locked")){F._locked=true}if(C.getAttribute("selected")==true){this.setSelectedRow(H,this.selMultiRows,false,C.getAttribute("call")==true)}if(C.getAttribute("expand")=="1"){F.expand=""}if(I){this.setRowTextStyle(H,I)}if(this.onRowCr){this.onRowCr(F.idd,F,C)}};dhtmlXGridObject.prototype._fillRowFromXML=function(A,E,K,F){var J=this.xmlLoader.doXPath("./cell",E);var I=new Array(0);for(var C=0;C<J.length;C++){var D=J[C];var H=D.getAttribute("type");if(D.firstChild){D=D.firstChild.data}else{D=""}if(C!=K){I[I.length]=D}else{I[I.length]=F+"^"+D+"^"+((E.getAttribute("xmlkids")||A._xml)?"1":"0")+"^"+(J[C].getAttribute("image")||"leaf.gif")}if(H){A.childNodes[C]._cellType=H}}if(this._c_order){I=this._swapColumns(I)}for(var C=0;C<J.length;C++){css1=J[C].getAttribute("class");if(css1){A.childNodes[C].className+=" "+css1}}this._fillRow(A,I);if((A.parentNode)&&(A.parentNode.tagName)){this._postRowProcessing(A,E)}return A};dhtmlXGridObject.prototype._innerParse=function(J,K,L,I,F){F=F||0;var E=F+this._ads_count;var C=null;var D;for(var F;F<J.length;F++){if((I)||(F<this.rowsBufferOutSize||this.rowsBufferOutSize==0)){this._parsing_=true;var A=J[F].getAttribute("id");C=this._prepareRow(A);if(L!=-1){D=this.xmlLoader.doXPath("./row",J[F]);if((D.length!=0)&&(this._slowParse)){C._xml=D}}C=this._fillRowFromXML(C,J[F],L,I);if(K){C=this._insertRowAt(C,K);K++}else{C=this._insertRowAt(C)}this._postRowProcessing(C,J[F]);this._parsing_=false}else{var H=this.rowsBuffer[0].length;this.rowsBuffer[1][H]=J[F];this.rowsBuffer[0][H]=J[F].getAttribute("id")}if((L!=-1)&&(D.length!=0)&&(!this._slowParse)){K=this._innerParse(D,K,L,A)}}if(this.pagingOn&&this.rowsBuffer[0].length>0){this.changePage(this.currentPage)}if((C)&&(this._checkSCL)){for(var F=0;F<this.hdr.rows[0].cells.length;F++){this._checkSCL(C.childNodes[F])}}return K};dhtmlXGridObject.prototype.getCheckedRows=function(A){var D=new Array();for(var C=0;C<this.rowsCol.length;C++){if(this.cells3(this.rowsCol[C],A).getValue()!="0"){D[D.length]=this.rowsCol[C].idd}}return D.join(",")};dhtmlXGridObject.prototype._drawTooltip=function(D){var E=this.grid.getFirstParentOfType(D?D.target:event.srcElement,"TD");if((this.grid.editor)&&(this.grid.editor.cell==E)){return true}var C=E.parentNode;if(C.idd==window.unknown){return true}if((this.grid._enbTts)&&(!this.grid._enbTts[E._cellIndex])){(D?D.target:event.srcElement).title="";return true}var A=this.grid.cells(C.idd,E._cellIndex);if(A){(D?D.target:event.srcElement).title=A.getTitle?A.getTitle():(A.getValue()||"").toString().replace(/<[^>]*>/gi,"")}return true};dhtmlXGridObject.prototype.enableCellWidthCorrection=function(A){if(_isFF){this._wcorr=parseInt(A)}};dhtmlXGridObject.prototype.getAllItemIds=function(C){var A=new Array(0);for(i=0;i<this.rowsCol.length;i++){A[A.length]=this.rowsCol[i].idd}for(i=0;i<this.rowsBuffer[0].length;i++){A[A.length]=this.rowsBuffer[0][i]}return A.join(C||",")};dhtmlXGridObject.prototype.deleteRow=function(A,D){if(!D){D=this.getRowById(A)}if(!this.rowsAr[A]){return }this.editStop();if(typeof (this.onBeforeRowDeleted)=="function"&&this.onBeforeRowDeleted(A)==false){return false}if(D!=null){if(this.cellType._dhx_find("tree")!=-1){this._removeTrGrRow(D)}if(D.parentNode){D.parentNode.removeChild(D)}var E=this.rowsCol._dhx_find(D);if(E!=-1){this.rowsCol._dhx_removeAt(E)}else{E=this.rowsBuffer[0]._dhx_find(A);if(E>=0){this.rowsBuffer[0]._dhx_removeAt(E);this.rowsBuffer[1]._dhx_removeAt(E)}}D=null}for(var C=0;C<this.selectedRows.length;C++){if(this.selectedRows[C].idd==A){this.selectedRows._dhx_removeAt(C)}}this.rowsAr[A]=null;if(this.onGridReconstructed){this.onGridReconstructed()}if(this.pagingOn){this.changePage()}this.setSizes();return true};dhtmlXGridObject.prototype.preventIECashing=function(A){this.no_cashe=convertStringToBoolean(A);this.xmlLoader.rSeed=this.no_cashe};dhtmlXGridObject.prototype.enableColumnAutoSize=function(A){this._eCAS=convertStringToBoolean(A)};dhtmlXGridObject.prototype._onHeaderDblClick=function(D){var C=this.grid;var A=C.getFirstParentOfType(_isIE?event.srcElement:D.target,"TD");if(!C._eCAS){return false}C.adjustColumnSize(A._cellIndexS)};dhtmlXGridObject.prototype.adjustColumnSize=function(E){var D=this.hdr.rows[1].childNodes[E].childNodes[0];this._setColumnSizeR(E,20);var A=D.scrollWidth;var C=this.obj._rowslength();for(var F=0;F<C;F++){if(_isFF||_isOpera){var H=this.obj._rows(F).childNodes[E].innerHTML.replace(/<[^>]*>/g,"").length*7}else{var H=this.obj._rows(F).childNodes[E].scrollWidth}if(H>A){A=H}}A+=2;this._setColumnSizeR(E,A);this.setSizes()};dhtmlXGridObject.prototype.attachHeader=function(A,E,C){if(typeof (A)=="string"){A=A.split(this.delim)}C=C||"_aHead";if(this.hdr.rows.length){if(A){this._createHRow([A,E],this[(C=="_aHead")?"hdr":"ftr"])}else{if(this[C]){for(var D=0;D<this[C].length;D++){this.attachHeader.apply(this,this[C][D])}}}}else{if(!this[C]){this[C]=new Array()}this[C][this[C].length]=[A,E,C]}};dhtmlXGridObject.prototype._createHRow=function(C,K){if(!K){this.entBox.style.position="relative";var H=document.createElement("DIV");H.className="ftr";this.entBox.appendChild(H);var L=document.createElement("TABLE");L.cellPadding=L.cellSpacing=0;if(!_isIE){L.width="100%";L.style.paddingRight="20px"}L.style.tableLayout="fixed";H.appendChild(L);L.appendChild(document.createElement("TBODY"));this.ftr=K=L;var F=L.insertRow(0);for(var D=0;D<this.hdrLabels.length;D++){F.appendChild(document.createElement("TH"));F.childNodes[D]._cellIndex=D}if(_isIE){F.style.position="absolute"}else{F.style.height="auto"}}var E=C[1];var H=document.createElement("TR");K.rows[0].parentNode.appendChild(H);for(var D=0;D<C[0].length;D++){if(C[0][D]=="#cspan"){var I=H.cells[H.cells.length-1];I.colSpan=(I.colSpan||1)+1;continue}if((C[0][D]=="#rspan")&&(K.rows.length>1)){var N=K.rows.length-2;var M=false;var I=null;while(!M){var I=K.rows[N];for(var A=0;A<I.cells.length;A++){if(I.cells[A]._cellIndex==D){M=A+1;break}}N--}I=I.cells[M-1];I.rowSpan=(I.rowSpan||1)+1;if(!_isKHTML){continue}C[0][D]=""}var J=document.createElement("TD");J._cellIndex=J._cellIndexS=D;J.innerHTML=C[0][D];if(E){J.style.cssText=E[D]}H.appendChild(J)}};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._val){return this.cell._val}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.align){return this.cell.align}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.bgColor=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.setValue=function(A){if((typeof (A)!="number")&&(!A||A.toString()._dhx_trim()=="")){A="&nbsp;";this.cell._clearCell=true}this.setCValue(A)};dhtmlXGridCellObject.prototype.setCValue=function(C,A){this.cell.innerHTML=C;if(this.grid._onCCH){this.grid._onCCH(this.cell.parentNode.idd,this.cell._cellIndex,A||C)}};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(E){var A=E;var D=0;var C=0;while(A.tagName!="BODY"){D+=A.offsetLeft;C+=A.offsetTop;A=A.offsetParent}return new Array(D,C)}}eXcell.prototype=new dhtmlXGridCellObject;function eXcell_ed(A){try{this.cell=A;this.grid=this.cell.parentNode.grid}catch(C){}this.edit=function(){this.cell.atag=((!this.grid.multiLine)&&(_isKHTML||_isMacOS||_isFF))?"INPUT":"TEXTAREA";this.val=this.getValue();this.obj=document.createElement(this.cell.atag);this.obj.style.height=(this.cell.offsetHeight-(_isIE?6:4))+"px";this.obj.className="dhx_combo_edit";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.align;this.obj.onclick=function(D){(D||event).cancelBubble=true};this.obj.onmousedown=function(D){(D||event).cancelBubble=true};this.obj.value=this.val;this.cell.innerHTML="";this.cell.appendChild(this.obj);if(_isFF){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(D){if(!D){D=event}D.cancelBubble=true;return true};if(this.grid.cellType[this.cell._cellIndex]=="price"){this.obj.onkeydown=function(D){soNum(D||event);FormataValor((D||event).keyCode,this,7)};}if(this.grid.cellType[this.cell._cellIndex]=="date"){this.obj.onkeydown=function(D){soNum(D||event)};this.obj.onkeypress=function(D){datas(this,D||event)};this.obj.maxLength=10}this.obj.focus();this.obj.select();};this.getValue=function(){if((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName==this.cell.atag))){return this.cell.firstChild.value}else{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_edn(A){try{this.cell=A;this.grid=this.cell.parentNode.grid}catch(C){}this.edit=function(){this.val=this.getValue();this.obj=document.createElement(_isKHTML?"INPUT":"TEXTAREA");this.obj.className="dhx_combo_edit";this.obj.style.height=(this.cell.offsetHeight-4)+"px";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.align;this.obj.onclick=function(D){(D||event).cancelBubble=true};this.obj.value=this.val;this.cell.innerHTML="";this.cell.appendChild(this.obj);this.obj.onselectstart=function(D){if(!D){D=event}D.cancelBubble=true;return true};this.obj.focus();this.obj.focus()};this.getValue=function(){if((this.cell.firstChild)&&(this.cell.firstChild.tagName=="TEXTAREA")){return this.cell.firstChild.value}else{return this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(),this.cell._cellIndex)}};this.detach=function(){var D=this.obj.value;this.setValue(D);return this.val!=this.getValue()}}eXcell_edn.prototype=new eXcell;eXcell_edn.prototype.setValue=function(A){if(!A||A.toString()._dhx_trim()==""){A="0"}this.setCValue(this.grid._aplNF(A,this.cell._cellIndex))};function eXcell_ch(A){try{this.cell=A;this.grid=this.cell.parentNode.grid;this.cell.obj=this}catch(C){}this.disabledF=function(D){if((D==true)||(D==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(){if((!this.grid.isEditable)||(this.cell.parentNode._locked)){return }if(this.grid.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.grid.onEditCell(1,this.cell.parentNode.idd,this.cell._cellIndex);this.grid.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(D){return null}};this.isCheckbox=function(){return true};this.isChecked=function(){if(this.getValue()=="1"){return true}else{return false}};this.setChecked=function(D){this.setValue(D.toString())};this.detach=function(){return this.val!=this.getValue()}}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='this.parentNode.obj.changeState()'>",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(){if((!this.grid.isEditable)||(this.cell.parentNode._locked)){return }if(this.grid.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.grid.onEditCell(1,this.cell.parentNode.idd,this.cell._cellIndex);if(typeof (this.grid.onCheckbox)=="function"){this.grid.onCheckbox(this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1"))}for(var C=0;C<this.grid.getRowsNum();C++){if(this.grid.cells2(C,this.cell._cellIndex).isChecked()&&this.grid.cells2(C,this.cell._cellIndex).cell!=this.cell){this.grid.cells2(C,this.cell._cellIndex).setValue("0");this.grid.onEditCell(1,this.grid.rowsCol[C].idd,this.cell._cellIndex)}}}else{this.editor=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){C="1";this.cell.chstate="1"}else{C="0";this.cell.chstate="0"}var A=this;this.setCValue("<img src='"+this.grid.imgURL+"radio_chk"+C+".gif' onclick='this.parentNode.obj.changeState()'>",this.cell.chstate)};function eXcell_txt(A){try{this.cell=A;this.grid=this.cell.parentNode.grid}catch(C){}this.edit=function(){this.val=this.getValue();this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_textarea";this.obj.onclick=function(H){(H||event).cancelBubble=true};var E=this.grid.getPosition(this.cell);if(!this.cell._clearCell){this.obj.value=this.cell.innerHTML.replace(/<br[^>]*>/gi,"\n")}this.obj.style.display="";this.obj.style.textAlign=this.cell.align;if(_isFF){var D=document.createElement("DIV");D.appendChild(this.obj);D.style.overflow="auto";D.className="dhx_textarea";this.obj.style.margin="0px 0px 0px 0px";this.obj.style.border="0px";this.obj=D}document.body.appendChild(this.obj);this.obj.onkeydown=function(I){var H=(I||event);if(H.keyCode==9){globalActiveDHTMLGridObject.entBox.focus();globalActiveDHTMLGridObject.doKey({keyCode:H.keyCode,shiftKey:H.shiftKey,srcElement:"0"});return false}};this.obj.style.left=E[0]+"px";this.obj.style.top=E[1]+this.cell.offsetHeight+"px";if(this.cell.scrollWidth<200){var F=200}else{var F=this.cell.scrollWidth}this.obj.style.width=F+(_isFF?18:16)+"px";if(_isFF){this.obj.firstChild.style.width=parseInt(this.obj.style.width)+"px";this.obj.firstChild.style.height=this.obj.offsetHeight-3+"px"}this.obj.focus();if(_isFF){this.obj.firstChild.focus()}else{this.obj.focus()}};this.detach=function(){var D="";if(_isFF){D=this.obj.firstChild.value}else{D=this.obj.value}if(D==""){this.cell._clearCell=true}else{this.cell._clearCell=false}this.setValue(D);document.body.removeChild(this.obj);return this.val!=this.getValue()};this.getValue=function(){if(this.cell.firstChild){if(this.cell.firstChild.tagName=="TEXTAREA"){return this.obj.firstChild.value}else{if(this.cell.firstChild.tagName=="DIV"){return this.obj.firstChild.firstChild.value}}}if((!_isIE)&&(!this.grid.multiLine)){return this.cell.innerHTML}else{return this.cell.innerHTML.replace(/<br[^>]*>/gi,"\n")._dhx_trim()}}}eXcell_txt.prototype=new eXcell;eXcell_txt.prototype.setValue=function(A){if(!A||A.toString()._dhx_trim()==""){A="&nbsp;";this.cell._clearCell=true}if((!_isIE)&&(!this.grid.multiLine)){this.setCValue(A,A)}else{this.setCValue(A.replace(/\n/g,"<br/>"),A)}};function eXcell_co(A){try{this.cell=A;this.grid=this.cell.parentNode.grid;this.combo=this.grid.getCombo(this.cell._cellIndex);this.editable=true}catch(C){}this.shiftNext=function(){var D=this.list.options[this.list.selectedIndex+1];if(D){D.selected=true}this.obj.value=this.list.value;return true};this.shiftPrev=function(){var D=this.list.options[this.list.selectedIndex-1];if(D){D.selected=true}this.obj.value=this.list.value;return true};this.edit=function(){this.val=this.getValue();this.text=this.cell.innerHTML._dhx_trim();var F=this.grid.getPosition(this.cell);this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_combo_edit";this.obj.style.height=(this.cell.offsetHeight-4)+"px";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.align;this.obj.onclick=function(K){(K||event).cancelBubble=true};this.obj.value=this.text;this.list=document.createElement("SELECT");this.list.editor_obj=this;this.list.className="dhx_combo_select";this.list.style.width=this.cell.offsetWidth+"px";this.list.style.left=F[0]+"px";this.list.style.top=F[1]+this.cell.offsetHeight+"px";this.list.onclick=function(M){var L=M||window.event;var K=L.target||L.srcElement;if(K.tagName=="OPTION"){K=K.parentNode}K.editor_obj.setValue(K.value);K.editor_obj.editable=false;K.editor_obj.grid.editStop()};var D=this.combo.getKeys();var H=false;var J=0;for(var E=0;E<D.length;E++){var I=this.combo.get(D[E]);this.list.options[this.list.options.length]=new Option(I,D[E]);if(D[E]==this.val||I==this.val){J=this.list.options.length-1;H=true}}if(H==false){this.list.options[this.list.options.length]=new Option(this.text,this.val===null?"":this.val);J=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[J].selected=true;this.obj.focus();this.obj.focus();if(!this.editable){this.obj.style.visibility="hidden"}};this.getValue=function(){return((this.cell.combo_value==window.undefined)?"":this.cell.combo_value)};this.getText=function(){return this.cell.innerHTML};this.detach=function(){if(this.val!=this.getValue()){this.cell.wasChanged=true}if(this.list.parentNode!=null){if(this.editable){if(this.obj.value._dhx_trim()!=this.text){this.setValue(this.obj.value)}else{this.setValue(this.val)}}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.setValue=function(A){if((A||"").toString()._dhx_trim()==""){A=null}if(A!==null){this.setCValue(this.grid.getCombo(this.cell._cellIndex).get(A)||A,A)}else{this.setCValue("&nbsp;",A)}this.cell.combo_value=A};function eXcell_coro(A){this.base=eXcell_co;this.base(A);this.editable=false}eXcell_coro.prototype=new eXcell_co;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 D=this.grid.getPosition(this.cell);this.colorPanel(4,this.obj);document.body.appendChild(this.obj);this.obj.style.left=D[0]+"px";this.obj.style.top=D[1]+this.cell.offsetHeight+"px"};this.toolDNum=function(D){if(D.length==1){D="0"+D}return D};this.colorPanel=function(K,N){var I=document.createElement("TABLE");N.appendChild(I);I.cellSpacing=0;I.editor_obj=this;I.style.cursor="default";I.style.cursor="table-layout:fixed";I.onclick=function(S){var Q=S||window.event;var O=Q.target||Q.srcElement;var P=O.parentNode.parentNode.parentNode.editor_obj;P.setValue(O.style.backgroundColor);P.grid.editStop()};var F=256/K;for(var H=0;H<=(256/F);H++){var D=I.insertRow(H);for(var J=0;J<=(256/F);J++){for(var E=0;E<=(256/F);E++){R=new Number(F*H)-(H==0?0:1);G=new Number(F*J)-(J==0?0:1);B=new Number(F*E)-(E==0?0:1);var M=this.toolDNum(R.toString(16))+""+this.toolDNum(G.toString(16))+""+this.toolDNum(B.toString(16));var L=D.insertCell(J);L.width="10px";L.innerHTML="&nbsp;";L.title=M.toUpperCase();L.style.backgroundColor="#"+M;if(this.val!=null&&"#"+M.toUpperCase()==this.val.toUpperCase()){L.style.border="2px solid white"}}}}};this.getValue=function(){return this.cell.firstChild.style?this.cell.firstChild.style.backgroundColor:""};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.cell.offsetHeight-2)+";background-color:"+(A||"")+";border:0px;'>&nbsp;</div>",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.tit:"")}else{if(this.cell.firstChild.tagName=="A"){var D=this.cell.firstChild.firstChild.src+(this.cell.titFl!=null?"^"+this.cell.tit:"");D+="^"+this.cell.lnk;if(this.cell.trg){D+="^"+this.cell.trg}return D}}};this.getTitle=function(){return this.cell.tit}}eXcell_img.prototype=new eXcell;eXcell_img.prototype.setValue=function(D){var C=D;if(D.indexOf("^")!=-1){var A=D.split("^");D=A[0];C=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='"+(D||"")._dhx_trim()+"' border='0'>",D);if(this.cell.lnk){this.cell.innerHTML="<a href='"+this.cell.lnk+"' target='"+this.cell.trg+"'>"+this.cell.innerHTML+"</a>"}this.cell.tit=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){var A="green";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(D){if(!D||isNaN(Number(D))){D=0}if(D>0){var C="green";var A="dyn_up.gif"}else{if(D==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%;'><img src='"+this.grid.imgURL+""+A+"' height='15' style='position:absolute;top:0px;left:0px;'><span style='width:100%;color:"+C+";'>"+D+"</span></div>",D)};function eXcell_ro(A){this.cell=A;this.grid=this.cell.parentNode.grid;this.edit=function(){}}eXcell_ro.prototype=new eXcell;function dhtmlXGridComboObject(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();this.put=function(C,D){for(var A=0;A<this.keys.length;A++){if(this.keys[A]==C){this.values[A]=D;return true}}this.values[this.values.length]=D;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;function eXcell_link(A){this.cell=A;this.grid=this.cell.parentNode.grid;this.edit=function(){};this.getValue=function(){if(this.cell.firstChild.getAttribute){return this.cell.firstChild.innerHTML+"^"+this.cell.firstChild.getAttribute("href")}else{return""}};this.setValue=function(D){var C=D.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(){return this.cell.firstChild.getAttribute("href")};function eXcell_date(A){this.base=eXcell_ed;this.base(A);this.getValue=function(){return this.cell.childNodes[0].innerHTML.toString()._dhx_trim()||""}}eXcell_date.prototype=new eXcell_ed;eXcell_date.prototype.setValue=function(A){this.setCValue("<span style='padding-right:2px;'>"+A+"</span>",A)};