function dhtmlXTreeObject(e,c,b,a){this._isOpera=(navigator.userAgent.indexOf("Opera")!=-1);if(typeof(e)!="object"){this.parentObject=document.getElementById(e)}else{this.parentObject=e}this.xmlstate=0;this.mytype="tree";this.smcheck=true;this.width=c;this.height=b;this.rootId=a;this.childCalc=null;this.def_img_x="10px";this.def_img_y="8px";this.style_pointer="pointer";if(navigator.appName=="Microsoft Internet Explorer"){this.style_pointer="hand"}this._aimgs=true;this.htmlcA=" [";this.htmlcB="]";this.lWin=window;this.cMenu=0;this.mlitems=0;this.dadmode=0;this.slowParse=false;this.autoScroll=true;this.hfMode=0;this.nodeCut=0;this.XMLsource=0;this.XMLloadingWarning=0;this._globalIdStorage=new Array();this.globalNodeStorage=new Array();this._globalIdStorageSize=0;this.treeLinesOn=true;this.checkFuncHandler=0;this.openFuncHandler=0;this.dblclickFuncHandler=0;this.tscheck=false;this.timgen=true;this.dpcpy=false;this.imPath="treeGfx/";this.checkArray=new Array("iconUnCheckAll.gif","iconCheckAll.gif","iconCheckGray.gif","iconUncheckDis.gif");this.lineArray=new Array("line2.gif","line3.gif","line4.gif","blank.gif","blank.gif");this.minusArray=new Array("minus2.gif","minus3.gif","minus4.gif","minus.gif","minus5.gif");this.plusArray=new Array("plus2.gif","plus3.gif","plus4.gif","plus.gif","plus5.gif");this.imageArray=new Array("leaf.gif","folderOpen.gif","folderClosed.gif");this.cutImg=new Array(0,0,0);this.cutImage="but_cut.gif";this.dragger=new dhtmlDragAndDropObject();this.htmlNode=new dhtmlXTreeItemObject(this.rootId,"",0,this);this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display="none";this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className="hiddenRow";this.allTree=this._createSelf();this.allTree.appendChild(this.htmlNode.htmlNode);this.allTree.onselectstart=new Function("return false;");this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this);this.selectionBar=document.createElement("DIV");this.selectionBar.className="selectionBar";this.selectionBar.innerHTML=" ";if(this.allTree.offsetWidth>20){this.selectionBar.style.width=(this.allTree.offsetWidth-20)+"px"}this.selectionBar.style.display="none";this.allTree.appendChild(this.selectionBar);return this}function dhtmlXTreeItemObject(g,b,c,a,e,f){this.htmlNode="";this.acolor="";this.scolor="";this.tr=0;this.childsCount=0;this.tempDOMM=0;this.tempDOMU=0;this.dragSpan=0;this.dragMove=0;this.span=0;this.closeble=1;this.childNodes=new Array();this.userData=new Object();this.checkstate=0;this.treeNod=a;this.label=b;this.parentObject=c;this.actionHandler=e;this.images=new Array(a.imageArray[0],a.imageArray[1],a.imageArray[2]);this.id=a._globalIdStorageAdd(g,this);if(this.treeNod.checkBoxOff){this.htmlNode=this.treeNod._createItem(1,this,f)}else{this.htmlNode=this.treeNod._createItem(0,this,f)}this.htmlNode.objBelong=this;return this}dhtmlXTreeObject.prototype._globalIdStorageAdd=function(b,a){if(this._globalIdStorageFind(b,1,1)){d=new Date();b=d.valueOf()+"_"+b;return this._globalIdStorageAdd(b,a)}this._globalIdStorage[this._globalIdStorageSize]=b;this.globalNodeStorage[this._globalIdStorageSize]=a;this._globalIdStorageSize++;return b};dhtmlXTreeObject.prototype._globalIdStorageSub=function(b){for(var a=0;a0){m=new Object;m.tr=s.childNodes[0].tr.previousSibling}for(o=0;o=2){this._correctPlus(q[s.childsCount-2]);this._correctLine(q[s.childsCount-2])}if(s.childsCount!=2){this._correctPlus(q[0])}if(this.tscheck){this._correctCheckStates(s)}}if(this.cMenu){this.cMenu.setContextZone(q[a].span,q[a].id)}return q[a]};dhtmlXTreeObject.prototype.insertNewChild=function(c,j,k,b,g,f,e,a,h){return this.insertNewItem(c,j,k,b,g,f,e,a,h)};dhtmlXTreeObject.prototype.insertNewItem=function(c,j,k,b,g,f,e,a,h){var l=this._globalIdStorageFind(c);if(!l){return(-1)}return this._attachChildNode(l,j,k,b,g,f,e,a,h)};dhtmlXTreeObject.prototype.insertNewChild=function(c,j,k,b,g,f,e,a,h){return this.insertNewItem(c,j,k,b,g,f,e,a,h)};dhtmlXTreeObject.prototype._parseXMLTree=function(t,x,A,e){if(!t.parsCount){t.parsCount=1}else{t.parsCount++}t.XMLloadingWarning=1;var o="";if(!x){x=t.XMLLoader.getXMLTopNode("tree");A=x.getAttribute("id");t.parsingOn=A;t.parsedArray=new Array();t.setCheckList=""}if(x.getAttribute("order")){t._reorderXMLBranch(x)}for(var B=0;B0){for(var H=0;H1){if(((e[1].style.display!="none")||(f==1))&&(f!=2)){this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0";nodestyle="none"}else{nodestyle=""}for(var c=1;cthis._getNodeLevel(c,0)){return this._moveNodeTo(a,e.parentObject)}else{return this._moveNodeTo(a,c.parentObject,c)}}else{return this._moveNodeTo(a,b)}};dhtmlXTreeObject.prototype._fixNodesCollection=function(j,g){var b=0;var e=0;var h=j.childNodes;var a=j.childsCount-1;if(g==h[a]){return}for(var f=0;f=2){this._correctPlus(m[n.childsCount-2]);this._correctLine(m[n.childsCount-2])}}this._correctPlus(m[n.childsCount-1]);if(this.tscheck){this._correctCheckStates(n)}if(a.tscheck){a._correctCheckStates(j)}}if(h>1){a._correctPlus(j.childNodes[h-2]);a._correctLine(j.childNodes[h-2])}a._correctPlus(j);if(this.dropFunc){this.dropFunc(l.id,n.id,(k?k.id:null),l.treeNod,n.treeNod)}return l.id};dhtmlXTreeObject.prototype._checkParenNodes=function(c,b,a){if(a){if(a.parentObject.id==b.id){return 1}}if(b.id==c){return 1}if(b.parentObject){return this._checkParenNodes(c,b.parentObject)}else{return 0}};dhtmlXTreeObject.prototype._clearStyles=function(a){var e=a.htmlNode.childNodes[0].childNodes[0].childNodes[1];var b=e.nextSibling.nextSibling;a.span.innerHTML=a.label;if(this.checkBoxOff){e.childNodes[0].style.display="";e.childNodes[0].onclick=this.onCheckBoxClick}else{e.childNodes[0].style.display="none"}e.childNodes[0].treeNod=this;this.dragger.removeDraggableItem(b);if(this.dragAndDropOff){this.dragger.addDraggableItem(b,this)}b.childNodes[0].className="standartTreeRow";b.onclick=this.onRowSelect;b.ondblclick=this.onRowClick2;e.previousSibling.onclick=this.onRowClick;this._correctLine(a);this._correctPlus(a);for(var c=0;c0))){if(!e.nocheckbox){if(c){c+=","+e.id}else{c=e.id}}}var a=e.childsCount;for(var b=0;bb.childsCount)){return null}return b.childNodes[a].id};dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(c,a){var b=this._globalIdStorageFind(c);if((!b)||(a>b.childsCount)){return null}return b.childNodes[a].id};dhtmlXTreeObject.prototype.setDragHandler=function(func){if(typeof(func)=="function"){this.dragFunc=func}else{this.dragFunc=eval(func)}};dhtmlXTreeObject.prototype._clearMove=function(a){if((a.parentObject)&&(a.parentObject.span)){a.parentObject.span.className="standartTreeRow";if(a.parentObject.acolor){a.parentObject.span.style.color=a.parentObject.acolor}}this.selectionBar.style.display="none";this.allTree.className="containerTableStyle"};dhtmlXTreeObject.prototype.enableDragAndDrop=function(a){this.dragAndDropOff=convertStringToBoolean(a);if(this.dragAndDropOff){this.dragger.addDragLanding(this.allTree,this)}};dhtmlXTreeObject.prototype._setMove=function(e,b,f){if(e.parentObject.span){var c=getAbsoluteTop(e);var a=getAbsoluteTop(this.allTree);this.dadmodec=this.dadmode;this.dadmodefix=0;if(this.dadmodec==0){e.parentObject.span.className="selectedTreeRow";if(e.parentObject.scolor){e.parentObject.span.style.color=e.parentObject.scolor}}else{e.parentObject.span.className="standartTreeRow";if(e.parentObject.acolor){e.parentObject.span.style.color=e.parentObject.acolor}this.selectionBar.style.top=c-a+16+this.dadmodefix+"px";this.selectionBar.style.left="5px";this.selectionBar.style.display=""}if(this.autoScroll){if((c-a-parseInt(this.allTree.scrollTop))>(parseInt(this.allTree.offsetHeight)-50)){this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20}if((c-a)<(parseInt(this.allTree.scrollTop)+30)){this.allTree.scrollTop=parseInt(this.allTree.scrollTop)-20}}}};dhtmlXTreeObject.prototype._createDragNode=function(b){dhtmlObject=b.parentObject;if(this.lastSelected){this._clearMove(this.lastSelected)}var a=document.createElement("div");a.innerHTML=dhtmlObject.label;a.style.position="absolute";a.className="dragSpanDiv";return a};dhtmlXTreeObject.prototype._preventNsDrag=function(a){if((a)&&(a.preventDefault)){a.preventDefault();return false}return false};dhtmlXTreeObject.prototype._drag=function(g,h,a){if(this._autoOpenTimer){clearTimeout(this._autoOpenTimer)}if(!a.parentObject){a=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];this.dadmodec=0}this._clearMove(a);var f=a.parentObject.treeNod;f._clearMove("");if((!this.dragMove)||(this.dragMove())){var b=this._moveNode(g.parentObject,a.parentObject);f.selectItem(b)}try{}catch(c){return}};dhtmlXTreeObject.prototype._dragIn=function(c,b,a,e){if(!c.parentObject){this.allTree.className="containerTableStyle selectionBox";return c}if((!this._checkParenNodes(b.parentObject.id,c.parentObject,b.parentObject))&&(c.parentObject.id!=b.parentObject.id)){c.parentObject.span.parentNode.appendChild(this.selectionBar);this._setMove(c,a,e);if(this._getOpenState(c.parentObject)<0){this._autoOpenTimer=window.setTimeout(new callerFunction(this._autoOpenItem,this),1000)}this._autoOpenId=c.parentObject.id;return c}else{return 0}};dhtmlXTreeObject.prototype._autoOpenItem=function(b,a){a.openItem(a._autoOpenId)};dhtmlXTreeObject.prototype._dragOut=function(a){this._clearMove(a);if(this._autoOpenTimer){clearTimeout(this._autoOpenTimer)}};dhtmlXTreeObject.prototype._getNextNode=function(a,b){if((!b)&&(a.childsCount)){return a.childNodes[0]}if(a==this.htmlNode){return -1}if((a.tr)&&(a.tr.nextSibling)&&(a.tr.nextSibling.nodem)){return a.tr.nextSibling.nodem}return this._getNextNode(a.parentObject,true)};dhtmlXTreeObject.prototype._lastChild=function(a){if(a.childsCount){return this._lastChild(a.childNodes[a.childsCount-1])}else{return a}};dhtmlXTreeObject.prototype._getPrevNode=function(a,b){if((a.tr)&&(a.tr.previousSibling)&&(a.tr.previousSibling.nodem)){return this._lastChild(a.tr.previousSibling.nodem)}if(a.parentObject){return a.parentObject}else{return -1}};