home *** CD-ROM | disk | FTP | other *** search
/ Chip 2009 November / Chip_2009.11_CD.iso / Chip_WPI / WPIScripts / dhtmlXTree.js < prev    next >
Encoding:
JavaScript  |  2006-05-17  |  52.5 KB  |  1,922 lines

  1. /*
  2. Copyright Scand LLC http://www.scbr.com
  3. This version of Software is free for using in non-commercial applications. For commercial use please contact info@scbr.com to obtain license
  4. */ 
  5.  
  6.  
  7.  
  8. function dhtmlXTreeObject(htmlObject,width,height,rootId){
  9.  this._isOpera=(navigator.userAgent.indexOf('Opera')!= -1);
  10.  
  11.  if(typeof(htmlObject)!="object")
  12.  this.parentObject=document.getElementById(htmlObject);
  13.  else
  14.  this.parentObject=htmlObject;
  15.  
  16.  this.xmlstate=0;
  17.  this.mytype="tree";
  18.  this.smcheck=true;
  19.  this.width=width;
  20.  this.height=height;
  21.  this.rootId=rootId;
  22.  this.childCalc=null;
  23.  this.def_img_x="18px";
  24.  this.def_img_y="18px";
  25.  
  26.  this.style_pointer="pointer";
  27.  if(navigator.appName == 'Microsoft Internet Explorer')this.style_pointer="hand";
  28.  
  29.  this._aimgs=true;
  30.  this.htmlcA=" [";
  31.  this.htmlcB="]";
  32.  this.lWin=window;
  33.  this.cMenu=0;
  34.  this.mlitems=0;
  35.  this.dadmode=0;
  36.  this.slowParse=false;
  37.  this.autoScroll=true;
  38.  this.hfMode=0;
  39.  this.nodeCut=0;
  40.  this.XMLsource=0;
  41.  this.XMLloadingWarning=0;
  42.  this._globalIdStorage=new Array();
  43.  this.globalNodeStorage=new Array();
  44.  this._globalIdStorageSize=0;
  45.  this.treeLinesOn=true;
  46.  this.checkFuncHandler=0;
  47.  this.openFuncHandler=0;
  48.  this.dblclickFuncHandler=0;
  49.  this.tscheck=false;
  50.  this.timgen=true;
  51.  
  52.  this.dpcpy=false;
  53.  
  54.  this.imPath="treeGfx/";
  55.  this.checkArray=new Array("iconUnCheckAll.gif","iconCheckAll.gif","iconCheckGray.gif","iconUncheckDis.gif");
  56.  this.lineArray=new Array("line2.gif","line3.gif","line4.gif","blank.gif","blank.gif");
  57.  this.minusArray=new Array("minus2.gif","minus3.gif","minus4.gif","minus.gif","minus5.gif");
  58.  this.plusArray=new Array("plus2.gif","plus3.gif","plus4.gif","plus.gif","plus5.gif");
  59.  this.imageArray=new Array("leaf.gif","folderOpen.gif","folderClosed.gif");
  60.  this.cutImg= new Array(0,0,0);
  61.  this.cutImage="but_cut.gif";
  62.  
  63.  this.dragger= new dhtmlDragAndDropObject();
  64.  
  65.  this.htmlNode=new dhtmlXTreeItemObject(this.rootId,"",0,this);
  66.  this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display="none";
  67.  this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className="hiddenRow";
  68.  
  69.  this.allTree=this._createSelf();
  70.  this.allTree.appendChild(this.htmlNode.htmlNode);
  71.  this.allTree.onselectstart=new Function("return false;");
  72.  this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this);
  73.  
  74.  this.selectionBar=document.createElement("DIV");
  75.  this.selectionBar.className="selectionBar";
  76.  this.selectionBar.innerHTML=" ";
  77.  
  78.  if(this.allTree.offsetWidth>20)this.selectionBar.style.width=(this.allTree.offsetWidth-20)+"px";
  79.  this.selectionBar.style.display="none";
  80.  
  81.  this.allTree.appendChild(this.selectionBar);
  82.  
  83.  
  84.  
  85.  
  86.  return this;
  87. };
  88.  
  89.  
  90. function dhtmlXTreeItemObject(itemId,itemText,parentObject,treeObject,actionHandler,mode){
  91.  this.htmlNode="";
  92.  this.acolor="";
  93.  this.scolor="";
  94.  this.tr=0;
  95.  this.childsCount=0;
  96.  this.tempDOMM=0;
  97.  this.tempDOMU=0;
  98.  this.dragSpan=0;
  99.  this.dragMove=0;
  100.  this.span=0;
  101.  this.closeble=1;
  102.  this.childNodes=new Array();
  103.  this.userData=new Object();
  104.  
  105.  this.checkstate=0;
  106.  this.treeNod=treeObject;
  107.  this.label=itemText;
  108.  this.parentObject=parentObject;
  109.  this.actionHandler=actionHandler;
  110.  this.images=new Array(treeObject.imageArray[0],treeObject.imageArray[1],treeObject.imageArray[2]);
  111.  
  112.  
  113.  this.id=treeObject._globalIdStorageAdd(itemId,this);
  114.  if(this.treeNod.checkBoxOff)this.htmlNode=this.treeNod._createItem(1,this,mode);
  115.  else this.htmlNode=this.treeNod._createItem(0,this,mode);
  116.  
  117.  this.htmlNode.objBelong=this;
  118.  return this;
  119. };
  120.  
  121.  
  122.  
  123.  dhtmlXTreeObject.prototype._globalIdStorageAdd=function(itemId,itemObject){
  124.  if(this._globalIdStorageFind(itemId,1,1)){d=new Date();itemId=d.valueOf()+"_"+itemId;return this._globalIdStorageAdd(itemId,itemObject);}
  125.  this._globalIdStorage[this._globalIdStorageSize]=itemId;
  126.  this.globalNodeStorage[this._globalIdStorageSize]=itemObject;
  127.  this._globalIdStorageSize++;
  128.  return itemId;
  129. };
  130.  
  131.  dhtmlXTreeObject.prototype._globalIdStorageSub=function(itemId){
  132.  for(var i=0;i<this._globalIdStorageSize;i++)
  133.  if(this._globalIdStorage[i]==itemId)
  134. {
  135.  this._globalIdStorage[i]=this._globalIdStorage[this._globalIdStorageSize-1];
  136.  this.globalNodeStorage[i]=this.globalNodeStorage[this._globalIdStorageSize-1];
  137.  this._globalIdStorageSize--;
  138.  this._globalIdStorage[this._globalIdStorageSize]=0;
  139.  this.globalNodeStorage[this._globalIdStorageSize]=0;
  140. }
  141. };
  142.  
  143.  
  144.  dhtmlXTreeObject.prototype._globalIdStorageFind=function(itemId,skipXMLSearch,skipParsing){
  145.  
  146.  for(var i=0;i<this._globalIdStorageSize;i++)
  147.  if(this._globalIdStorage[i]==itemId)
  148. {
  149.  return this.globalNodeStorage[i];
  150. }
  151.  
  152.  
  153.  return null;
  154. };
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  dhtmlXTreeObject.prototype._drawNewTr=function(htmlObject,node)
  164. {
  165.  var tr =document.createElement('tr');
  166.  var td1=document.createElement('td');
  167.  var td2=document.createElement('td');
  168.  td1.appendChild(document.createTextNode(" "));
  169.  td2.colSpan=3;
  170.  td2.appendChild(htmlObject);
  171.  tr.appendChild(td1);tr.appendChild(td2);
  172.  return tr;
  173. };
  174.  
  175.  dhtmlXTreeObject.prototype.loadXMLString=function(xmlString,afterCall){
  176.  this.xmlstate=1;
  177.  this.XMLLoader.loadXMLString(xmlString);this.waitCall=afterCall||0;};
  178.  
  179.  dhtmlXTreeObject.prototype.loadXML=function(file,afterCall){
  180.  this.xmlstate=1;
  181.  this.XMLLoader.loadXML(file);this.waitCall=afterCall||0;};
  182.  
  183.  dhtmlXTreeObject.prototype._attachChildNode=function(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs,beforeNode){
  184.  if(beforeNode)parentObject=beforeNode.parentObject;
  185.  if(((parentObject.XMLload==0)&&(this.XMLsource))&&(!this.XMLloadingWarning))
  186. {
  187.  parentObject.XMLload=1;this.loadXML(this.XMLsource+getUrlSymbol(this.XMLsource)+"itemId="+escape(parentObject.id));
  188. }
  189.  
  190.  var Count=parentObject.childsCount;
  191.  var Nodes=parentObject.childNodes;
  192.  
  193.  if(beforeNode)
  194. {
  195.  var ik,jk;
  196.  for(ik=0;ik<Count;ik++)
  197.  if(Nodes[ik]==beforeNode)
  198. {
  199.  for(jk=Count;jk!=ik;jk--)
  200.  Nodes[1+jk]=Nodes[jk];
  201.  break;
  202. }
  203.  ik++;
  204.  Count=ik;
  205. }
  206.  
  207.  if((!itemActionHandler)&&(this.aFunc))itemActionHandler=this.aFunc;
  208.  
  209.  if(optionStr){
  210.  var tempStr=optionStr.split(",");
  211.  for(var i=0;i<tempStr.length;i++)
  212. {
  213.  switch(tempStr[i])
  214. {
  215.  case "TOP": if(parentObject.childsCount>0){beforeNode=new Object;beforeNode.tr=parentObject.childNodes[0].tr.previousSibling;}
  216.  for(ik=0;ik<Count;ik++)
  217.  Nodes[ik+Count]=Nodes[ik+Count-1];
  218.  Count=0;
  219.  break;
  220. }
  221. };
  222. };
  223.  
  224.  Nodes[Count]=new dhtmlXTreeItemObject(itemId,itemText,parentObject,this,itemActionHandler,1);
  225.  
  226.  if(image1)Nodes[Count].images[0]=image1;
  227.  if(image2)Nodes[Count].images[1]=image2;
  228.  if(image3)Nodes[Count].images[2]=image3;
  229.  
  230.  parentObject.childsCount++;
  231.  var tr=this._drawNewTr(Nodes[Count].htmlNode);
  232.  if(this.XMLloadingWarning)
  233.  Nodes[Count].htmlNode.parentNode.parentNode.style.display="none";
  234.  
  235.  
  236.  
  237.  if((beforeNode)&&(beforeNode.tr.nextSibling))
  238.  parentObject.htmlNode.childNodes[0].insertBefore(tr,beforeNode.tr.nextSibling);
  239.  else
  240.  if((this.parsingOn)&&(this.parsingOn==parentObject.id))
  241. {
  242.  this.parsedArray[this.parsedArray.length]=tr;
  243. }
  244.  else 
  245.  parentObject.htmlNode.childNodes[0].appendChild(tr);
  246.  
  247.  if((beforeNode)&&(!beforeNode.span))beforeNode=null;
  248.  
  249.  if(this.XMLsource)if((childs)&&(childs!=0))Nodes[Count].XMLload=0;else Nodes[Count].XMLload=1;
  250.  
  251.  Nodes[Count].tr=tr;
  252.  tr.nodem=Nodes[Count];
  253.  
  254.  if(parentObject.itemId==0)
  255.  tr.childNodes[0].className="hitemIddenRow";
  256.  
  257.  if(optionStr){
  258.  var tempStr=optionStr.split(",");
  259.  
  260.  for(var i=0;i<tempStr.length;i++)
  261. {
  262.  switch(tempStr[i])
  263. {
  264.  case "SELECT": this.selectItem(itemId,false);break;
  265.  case "CALL": this.selectItem(itemId,true);break;
  266.  case "CHILD": Nodes[Count].XMLload=0;break;
  267.  case "CHECKED": 
  268.  if(this.XMLloadingWarning)
  269.  this.setCheckList+=","+itemId;
  270.  else
  271.  this.setCheck(itemId,1);
  272.  break;
  273.  case "HCHECKED":
  274.  this._setCheck(Nodes[Count],"notsure");
  275.  break;
  276.  case "OPEN": Nodes[Count].openMe=1;break;
  277. }
  278. };
  279. };
  280.  
  281.  if(!this.XMLloadingWarning)
  282. {
  283.  if(this._getOpenState(parentObject)<0)
  284.  this.openItem(parentObject.id);
  285.  
  286.  if(beforeNode)
  287. {
  288.  this._correctPlus(beforeNode);
  289.  this._correctLine(beforeNode);
  290. }
  291.  this._correctPlus(parentObject);
  292.  this._correctLine(parentObject);
  293.  this._correctPlus(Nodes[Count]);
  294.  if(parentObject.childsCount>=2)
  295. {
  296.  this._correctPlus(Nodes[parentObject.childsCount-2]);
  297.  this._correctLine(Nodes[parentObject.childsCount-2]);
  298. }
  299.  if(parentObject.childsCount!=2)this._correctPlus(Nodes[0]);
  300.  if(this.tscheck)this._correctCheckStates(parentObject);
  301. }
  302.  if(this.cMenu)this.cMenu.setContextZone(Nodes[Count].span,Nodes[Count].id);
  303.  return Nodes[Count];
  304. };
  305.  
  306.  
  307.  dhtmlXTreeObject.prototype.insertNewChild=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs){
  308.  return this.insertNewItem(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs);
  309. }
  310.  
  311.  
  312.  dhtmlXTreeObject.prototype.insertNewItem=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs){
  313.  var parentObject=this._globalIdStorageFind(parentId);
  314.  if(!parentObject)return(-1);
  315.  return this._attachChildNode(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs);
  316. };
  317.  
  318.  dhtmlXTreeObject.prototype.insertNewChild=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs){
  319.  return this.insertNewItem(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs);
  320. }
  321.  
  322.  dhtmlXTreeObject.prototype._parseXMLTree=function(dhtmlObject,node,parentId,level){
  323.  
  324.  
  325.  if(!dhtmlObject.parsCount)dhtmlObject.parsCount=1;else dhtmlObject.parsCount++;
  326.  
  327.  dhtmlObject.XMLloadingWarning=1;
  328.  var nodeAskingCall="";
  329.  if(!node){
  330.  node=dhtmlObject.XMLLoader.getXMLTopNode("tree");
  331.  parentId=node.getAttribute("id");
  332.  dhtmlObject.parsingOn=parentId;
  333.  dhtmlObject.parsedArray=new Array();
  334.  dhtmlObject.setCheckList="";
  335. }
  336.  
  337.  
  338.  if(node.getAttribute("order"))
  339.  dhtmlObject._reorderXMLBranch(node);
  340.  
  341.  
  342.  for(var i=0;i<node.childNodes.length;i++)
  343. {
  344.  if((node.childNodes[i].nodeType==1)&&(node.childNodes[i].tagName == "item"))
  345. {
  346.  var nodx=node.childNodes[i];
  347.  var name=nodx.getAttribute("text");
  348.  var cId=nodx.getAttribute("id");
  349.  if((!dhtmlObject.waitUpdateXML)||(dhtmlObject.waitUpdateXML.toString().search(","+cId+",")!=-1))
  350. {
  351.  var im0=nodx.getAttribute("im0");
  352.  var im1=nodx.getAttribute("im1");
  353.  var im2=nodx.getAttribute("im2");
  354.  
  355.  var aColor=nodx.getAttribute("aCol");
  356.  var sColor=nodx.getAttribute("sCol");
  357.  
  358.  var chd=nodx.getAttribute("child");
  359.  
  360.  
  361.  var atop=nodx.getAttribute("top");
  362.  var aopen=nodx.getAttribute("open");
  363.  var aselect=nodx.getAttribute("select");
  364.  var acall=nodx.getAttribute("call");
  365.  var achecked=nodx.getAttribute("checked");
  366.  var closeable=nodx.getAttribute("closeable");
  367.  var tooltip = nodx.getAttribute("tooltip");
  368.  var nocheckbox = nodx.getAttribute("nocheckbox");
  369.  var style = nodx.getAttribute("style");
  370.  
  371.  var zST="";
  372.  if(aselect)zST+=",SELECT";
  373.  if(atop)zST+=",TOP";
  374.  
  375.  if(acall)nodeAskingCall=cId;
  376.  if(achecked==-1)zST+=",HCHECKED";
  377.  else if(achecked)zST+=",CHECKED";
  378.  if(aopen)zST+=",OPEN";
  379.  
  380.  var temp=dhtmlObject._globalIdStorageFind(parentId);
  381.  temp.XMLload=1;
  382.  var newNode=dhtmlObject.insertNewItem(parentId,cId,name,0,im0,im1,im2,zST,chd);
  383.  
  384.  if(tooltip)newNode.span.parentNode.title=tooltip;
  385.  if(style)newNode.span.style.cssText+=(";"+style);
  386.  if(nocheckbox){
  387.  newNode.span.parentNode.previousSibling.previousSibling.childNodes[0].style.display='none';
  388.  newNode.nocheckbox=true;
  389. }
  390.  
  391.  newNode._acc=chd||0;
  392.  
  393.  
  394.  if(dhtmlObject.parserExtension)dhtmlObject.parserExtension._parseExtension(node.childNodes[i],dhtmlObject.parserExtension,cId,parentId);
  395.  
  396.  dhtmlObject.setItemColor(newNode,aColor,sColor);
  397.  
  398.  if((closeable=="0")||(closeable=="1"))dhtmlObject.setItemCloseable(newNode,closeable);
  399.  var zcall="";
  400.  if((!dhtmlObject.slowParse)||(dhtmlObject.waitUpdateXML))
  401. {
  402.  zcall=dhtmlObject._parseXMLTree(dhtmlObject,node.childNodes[i],cId,1);
  403. }
  404.  else{
  405.  if(node.childNodes[i].childNodes.length>0){
  406.  for(var a=0;a<node.childNodes[i].childNodes.length;a++)
  407.  if(node.childNodes[i].childNodes[a].tagName=="item"){
  408.  newNode.unParsed=node.childNodes[i];
  409.  break;
  410. }
  411. }
  412. }
  413.  
  414.  if(zcall!="")nodeAskingCall=zcall;
  415.  
  416. }
  417.  else dhtmlObject._parseXMLTree(dhtmlObject,node.childNodes[i],cId,1);
  418. }
  419.  else
  420.  if((node.childNodes[i].nodeType==1)&&(node.childNodes[i].tagName == "userdata"))
  421. {
  422.  var name=node.childNodes[i].getAttribute("name");
  423.  if((name)&&(node.childNodes[i].childNodes[0])){
  424.  if((!dhtmlObject.waitUpdateXML)||(dhtmlObject.waitUpdateXML.toString().search(","+parentId+",")!=-1))
  425.  dhtmlObject.setUserData(parentId,name,node.childNodes[i].childNodes[0].data);
  426. };
  427. };
  428. };
  429.  
  430.  if(!level){
  431.  if(dhtmlObject.waitUpdateXML)
  432.  dhtmlObject.waitUpdateXML="";
  433.  else{
  434.  
  435.  var parsedNodeTop=dhtmlObject._globalIdStorageFind(dhtmlObject.parsingOn);
  436.  for(var i=0;i<dhtmlObject.parsedArray.length;i++)
  437.  parsedNodeTop.htmlNode.childNodes[0].appendChild(dhtmlObject.parsedArray[i]);
  438.  dhtmlObject.parsingOn=0;
  439.  
  440.  dhtmlObject.lastLoadedXMLId=parentId;
  441.  
  442.  dhtmlObject.XMLloadingWarning=0;
  443.  var chArr=dhtmlObject.setCheckList.split(",");
  444.  for(var n=0;n<chArr.length;n++)
  445.  if(chArr[n])dhtmlObject.setCheck(chArr[n],1);
  446.  dhtmlObject._redrawFrom(dhtmlObject);
  447.  
  448.  if(nodeAskingCall!="")dhtmlObject.selectItem(nodeAskingCall,true);
  449.  if(dhtmlObject.waitCall)dhtmlObject.waitCall();
  450. }
  451. }
  452.  
  453.  
  454.  if(dhtmlObject.parsCount==1){
  455.  dhtmlObject.xmlstate=1;
  456. }
  457.  dhtmlObject.parsCount--;
  458.  
  459.  return nodeAskingCall;
  460. };
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  dhtmlXTreeObject.prototype._redrawFrom=function(dhtmlObject,itemObject){
  468.  if(!itemObject){
  469.  var tempx=dhtmlObject._globalIdStorageFind(dhtmlObject.lastLoadedXMLId);
  470.  dhtmlObject.lastLoadedXMLId=-1;
  471.  if(!tempx)return 0;
  472. }
  473.  else tempx=itemObject;
  474.  var acc=0;
  475.  
  476.  for(var i=0;i<tempx.childsCount;i++)
  477. {
  478.  if(!itemObject)tempx.childNodes[i].htmlNode.parentNode.parentNode.style.display="";
  479.  if(tempx.childNodes[i].openMe==1)
  480. {
  481.  this._openItem(tempx.childNodes[i]);
  482.  tempx.childNodes[i].openMe=0;
  483. }
  484.  
  485.  dhtmlObject._redrawFrom(dhtmlObject,tempx.childNodes[i]);
  486.  
  487.  if(this.childCalc!=null){
  488.  
  489.  if((tempx.childNodes[i].unParsed)||((!tempx.childNodes[i].XMLload)&&(this.XMLsource)))
  490. {
  491.  
  492.  if(tempx.childNodes[i]._acc)
  493.  tempx.childNodes[i].span.innerHTML=tempx.childNodes[i].label+this.htmlcA+tempx.childNodes[i]._acc+this.htmlcB;
  494.  else 
  495.  tempx.childNodes[i].span.innerHTML=tempx.childNodes[i].label;
  496. }
  497.  
  498.  if((tempx.childNodes[i].childNodes.length)&&(this.childCalc))
  499. {
  500.  if(this.childCalc==1)
  501. {
  502.  tempx.childNodes[i].span.innerHTML=tempx.childNodes[i].label+this.htmlcA+tempx.childNodes[i].childsCount+this.htmlcB;
  503. }
  504.  if(this.childCalc==2)
  505. {
  506.  var zCount=tempx.childNodes[i].childsCount-(tempx.childNodes[i].pureChilds||0);
  507.  if(zCount)
  508.  tempx.childNodes[i].span.innerHTML=tempx.childNodes[i].label+this.htmlcA+zCount+this.htmlcB;
  509.  if(tempx.pureChilds)tempx.pureChilds++;else tempx.pureChilds=1;
  510. }
  511.  if(this.childCalc==3)
  512. {
  513.  tempx.childNodes[i].span.innerHTML=tempx.childNodes[i].label+this.htmlcA+tempx.childNodes[i]._acc+this.htmlcB;
  514. }
  515.  if(this.childCalc==4)
  516. {
  517.  var zCount=tempx.childNodes[i]._acc;
  518.  if(zCount)
  519.  tempx.childNodes[i].span.innerHTML=tempx.childNodes[i].label+this.htmlcA+zCount+this.htmlcB;
  520. }
  521. }
  522.  else if(this.childCalc==4){
  523.  acc++;
  524. }
  525.  
  526.  acc+=tempx.childNodes[i]._acc;
  527.  
  528.  if(this.childCalc==3){
  529.  acc++;
  530. }
  531.  
  532. }
  533.  
  534.  
  535.  
  536. };
  537.  
  538.  if((!tempx.unParsed)&&((tempx.XMLload)||(!this.XMLsource)))
  539.  tempx._acc=acc;
  540.  dhtmlObject._correctLine(tempx);
  541.  dhtmlObject._correctPlus(tempx);
  542. };
  543.  
  544.  
  545.  dhtmlXTreeObject.prototype._createSelf=function(){
  546.  var div=document.createElement('div');
  547.  div.className="containerTableStyle";
  548.  div.style.width=this.width;
  549.  div.style.height=this.height;
  550.  this.parentObject.appendChild(div);
  551.  return div;
  552. };
  553.  
  554.  
  555.  dhtmlXTreeObject.prototype._xcloseAll=function(itemObject)
  556. {
  557.  if(this.rootId!=itemObject.id)this._HideShow(itemObject,1);
  558.  for(var i=0;i<itemObject.childsCount;i++)
  559.  this._xcloseAll(itemObject.childNodes[i]);
  560. };
  561.  
  562.  dhtmlXTreeObject.prototype._xopenAll=function(itemObject)
  563. {
  564.  this._HideShow(itemObject,2);
  565.  for(var i=0;i<itemObject.childsCount;i++)
  566.  this._xopenAll(itemObject.childNodes[i]);
  567. };
  568.  
  569.  dhtmlXTreeObject.prototype._correctPlus=function(itemObject){
  570.  
  571.  var workArray=this.lineArray;
  572.  if((this.XMLsource)&&(!itemObject.XMLload))
  573. {
  574.  var workArray=this.plusArray;
  575.  itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0].src=this.imPath+itemObject.images[2];
  576. }
  577.  else
  578.  if((itemObject.childsCount)||(itemObject.unParsed))
  579. {
  580.  if((itemObject.htmlNode.childNodes[0].childNodes[1])&&(itemObject.htmlNode.childNodes[0].childNodes[1].style.display!="none"))
  581. {
  582.  if(!itemObject.wsign)var workArray=this.minusArray;
  583.  itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0].src=this.imPath+itemObject.images[1];
  584. }
  585.  else
  586. {
  587.  if(!itemObject.wsign)var workArray=this.plusArray;
  588.  itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0].src=this.imPath+itemObject.images[2];
  589. }
  590. }
  591.  else
  592. {
  593.  itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0].src=this.imPath+itemObject.images[0];
  594. }
  595.  
  596.  
  597.  var tempNum=2;
  598.  if(!itemObject.treeNod.treeLinesOn)itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[0].childNodes[0].src=this.imPath+workArray[3];
  599.  else{
  600.  if(itemObject.parentObject)tempNum=this._getCountStatus(itemObject.id,itemObject.parentObject);
  601.  itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[0].childNodes[0].src=this.imPath+workArray[tempNum];
  602. }
  603. };
  604.  
  605.  
  606.  dhtmlXTreeObject.prototype._correctLine=function(itemObject){
  607.  var sNode=itemObject.parentObject;
  608.  try{
  609.  if(sNode)
  610.  if((this._getLineStatus(itemObject.id,sNode)==0)||(!this.treeLinesOn))
  611. {
  612.  for(var i=1;i<=itemObject.childsCount;i++)
  613. {
  614.  itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundImage="";
  615.  itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundRepeat="";
  616. }
  617. }
  618.  else
  619.  for(var i=1;i<=itemObject.childsCount;i++)
  620. {
  621.  itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundImage="url("+this.imPath+"line1.gif)";
  622.  itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundRepeat="repeat-y";
  623. }
  624. }
  625.  catch(e){};
  626. };
  627.  
  628.  dhtmlXTreeObject.prototype._getCountStatus=function(itemId,itemObject){
  629.  try{
  630.  if(itemObject.childsCount<=1){if(itemObject.id==this.rootId)return 4;else return 0;}
  631.  
  632.  if(itemObject.htmlNode.childNodes[0].childNodes[1].nodem.id==itemId)if(!itemObject.id)return 2;else return 1;
  633.  if(itemObject.htmlNode.childNodes[0].childNodes[itemObject.childsCount].nodem.id==itemId)return 0;
  634. }
  635.  catch(e){};
  636.  return 1;
  637. };
  638.  
  639.  dhtmlXTreeObject.prototype._getLineStatus =function(itemId,itemObject){
  640.  if(itemObject.htmlNode.childNodes[0].childNodes[itemObject.childsCount].nodem.id==itemId)return 0;
  641.  return 1;
  642. }
  643.  
  644.  
  645.  dhtmlXTreeObject.prototype._HideShow=function(itemObject,mode){
  646.  if((this.XMLsource)&&(!itemObject.XMLload)){itemObject.XMLload=1;this.loadXML(this.XMLsource+getUrlSymbol(this.XMLsource)+"id="+escape(itemObject.id));return;};
  647.  
  648.  var Nodes=itemObject.htmlNode.childNodes[0].childNodes;var Count=Nodes.length;
  649.  if(Count>1){
  650.  if(((Nodes[1].style.display!="none")||(mode==1))&&(mode!=2)){
  651.  
  652.  this.allTree.childNodes[0].border = "1";
  653.  this.allTree.childNodes[0].border = "0";
  654.  nodestyle="none";
  655. }
  656.  else nodestyle="";
  657.  
  658.  for(var i=1;i<Count;i++)
  659.  Nodes[i].style.display=nodestyle;
  660. }
  661.  this._correctPlus(itemObject);
  662. }
  663.  
  664.  dhtmlXTreeObject.prototype._getOpenState=function(itemObject){
  665.  if(!itemObject)return;
  666.  var z=itemObject.htmlNode.childNodes[0].childNodes;
  667.  if(z.length<=1)return 0;
  668.  if(z[1].style.display!="none")return 1;
  669.  else return -1;
  670. }
  671.  
  672.  
  673.  
  674.  
  675.  dhtmlXTreeObject.prototype.onRowClick2=function(){
  676.  if(this.parentObject.treeNod.dblclickFuncHandler)if(!this.parentObject.treeNod.dblclickFuncHandler(this.parentObject.id))return 0;
  677.  if((this.parentObject.closeble)&&(this.parentObject.closeble!="0"))
  678.  this.parentObject.treeNod._HideShow(this.parentObject);
  679.  else
  680.  this.parentObject.treeNod._HideShow(this.parentObject,2);
  681. };
  682.  
  683.  dhtmlXTreeObject.prototype.onRowClick=function(){
  684.  if(this.parentObject.treeNod.openFuncHandler)if(!this.parentObject.treeNod.openFuncHandler(this.parentObject.id,this.parentObject.treeNod._getOpenState(this.parentObject)))return 0;
  685.  if((this.parentObject.closeble)&&(this.parentObject.closeble!="0"))
  686.  this.parentObject.treeNod._HideShow(this.parentObject);
  687.  else
  688.  this.parentObject.treeNod._HideShow(this.parentObject,2);
  689. };
  690.  
  691.  
  692.  
  693.  dhtmlXTreeObject.prototype.onRowClickDown=function(){
  694.  var that=this.parentObject.treeNod;
  695.  that._selectItem(this.parentObject);
  696. };
  697.  
  698.  dhtmlXTreeObject.prototype._selectItem=function(node){
  699.  if(this.lastSelected){
  700.  this._unselectItem(this.lastSelected.parentObject);
  701. }
  702.  var z=node.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0];
  703.  z.className="selectedTreeRow";
  704.  this.lastSelected=z.parentNode;
  705. }
  706.  
  707.  dhtmlXTreeObject.prototype._unselectItem=function(node){
  708.  node.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].className="standartTreeRow";
  709. }
  710.  
  711.  dhtmlXTreeObject.prototype.onRowSelect=function(e,htmlObject,mode){
  712.  
  713.  if(!htmlObject)htmlObject=this.parentObject.span.parentNode;
  714.  htmlObject.parentObject.span.className="selectedTreeRow";
  715.  
  716.  
  717.  if(htmlObject.parentObject.scolor)htmlObject.parentObject.span.style.color=htmlObject.parentObject.scolor;
  718.  if((htmlObject.parentObject.treeNod.lastSelected)&&(htmlObject.parentObject.treeNod.lastSelected!=htmlObject))
  719. {
  720.  var lastId=htmlObject.parentObject.treeNod.lastSelected.parentObject.id;
  721.  htmlObject.parentObject.treeNod.lastSelected.parentObject.span.className="standartTreeRow";
  722.  if(htmlObject.parentObject.treeNod.lastSelected.parentObject.acolor)htmlObject.parentObject.treeNod.lastSelected.parentObject.span.style.color=htmlObject.parentObject.treeNod.lastSelected.parentObject.acolor;
  723. }
  724.  else var lastId="";
  725.  htmlObject.parentObject.treeNod.lastSelected=htmlObject;
  726.  if(!mode){
  727.  if(window.event)e=event;
  728.  
  729.  if((e)&&(e.button==2)&&(htmlObject.parentObject.treeNod.arFunc))
  730. {htmlObject.parentObject.treeNod.arFunc(htmlObject.parentObject.id);}
  731.  if(htmlObject.parentObject.actionHandler)htmlObject.parentObject.actionHandler(htmlObject.parentObject.id,lastId);
  732. }
  733. };
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740. dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
  741.  if(!this.tscheck)return;
  742.  if(dhtmlObject.id==this.rootId)return;
  743.  
  744.  var act=dhtmlObject.htmlNode.childNodes[0].childNodes;
  745.  var flag1=0;var flag2=0;
  746.  if(act.length<2)return;
  747.  for(var i=1;i<act.length;i++)
  748.  if(act[i].nodem.checkstate==0)flag1=1;
  749.  else if(act[i].nodem.checkstate==1)flag2=1;
  750.  else{flag1=1;flag2=1;break;}
  751.  
  752.  if((flag1)&&(flag2))this._setCheck(dhtmlObject,"notsure");
  753.  else if(flag1)this._setCheck(dhtmlObject,false);
  754.  else this._setCheck(dhtmlObject,true);
  755.  
  756.  this._correctCheckStates(dhtmlObject.parentObject);
  757. }
  758.  
  759.  
  760.  dhtmlXTreeObject.prototype.onCheckBoxClick=function(e){
  761.  if(this.treeNod.tscheck)
  762.  if(this.parentObject.checkstate==1)this.treeNod._setSubChecked(false,this.parentObject);
  763.  else this.treeNod._setSubChecked(true,this.parentObject);
  764.  else
  765.  if(this.parentObject.checkstate==1)this.treeNod._setCheck(this.parentObject,false);
  766.  else this.treeNod._setCheck(this.parentObject,true);
  767.  this.treeNod._correctCheckStates(this.parentObject.parentObject);
  768.  if(this.treeNod.checkFuncHandler)return(this.treeNod.checkFuncHandler(this.parentObject.id,this.parentObject.checkstate));
  769.  else return true;
  770. };
  771.  
  772.  dhtmlXTreeObject.prototype._createItem=function(acheck,itemObject,mode){
  773.  var table=document.createElement('table');
  774.  table.cellSpacing=0;table.cellPadding=0;
  775.  table.border=0;
  776.  if(this.hfMode)table.style.tableLayout="fixed";
  777.  table.style.margin=0;table.style.padding=0;
  778.  
  779.  var tbody=document.createElement('tbody');
  780.  var tr=document.createElement('tr');
  781.  
  782.  var td1=document.createElement('td');
  783.  td1.className="standartTreeImage";
  784.  var img0=document.createElement((itemObject.id==this.rootId)?"div":"img");
  785.  img0.border="0";
  786.  if(itemObject.id!=this.rootId)img0.align="absmiddle";
  787.  td1.appendChild(img0);img0.style.padding=0;img0.style.margin=0;
  788.  
  789.  var td11=document.createElement('td');
  790.  
  791.  var inp=document.createElement((itemObject.id==this.rootId)?"div":"img");
  792.  inp.checked=0;inp.src=this.imPath+this.checkArray[0];inp.style.width="16px";inp.style.height="16px";
  793.  
  794.  if(!acheck)(((_isOpera)||(_isKHTML))?td11:inp).style.display="none";
  795.  
  796.  
  797.  
  798.  td11.appendChild(inp);
  799.  if(itemObject.id!=this.rootId)inp.align="absmiddle";
  800.  inp.onclick=this.onCheckBoxClick;
  801.  inp.treeNod=this;
  802.  inp.parentObject=itemObject;
  803.  td11.width="20px";
  804.  
  805.  var td12=document.createElement('td');
  806.  td12.className="standartTreeImage";
  807.  var img=document.createElement((itemObject.id==this.rootId)?"div":"img");img.onmousedown=this._preventNsDrag;img.ondragstart=this._preventNsDrag;
  808.  img.border="0";
  809.  if(this._aimgs){
  810.  img.parentObject=itemObject;
  811.  if(itemObject.id!=this.rootId)img.align="absmiddle";
  812.  img.onclick=this.onRowSelect;}
  813.  if(!mode)img.src=this.imPath+this.imageArray[0];
  814.  td12.appendChild(img);img.style.padding=0;img.style.margin=0;
  815.  if(this.timgen)
  816. {img.style.width=this.def_img_x;img.style.height=this.def_img_y;}
  817.  else
  818. {img.style.width="0px";img.style.height="0px";}
  819.  
  820.  
  821.  var td2=document.createElement('td');
  822.  td2.className="standartTreeRow";
  823.  
  824.  itemObject.span=document.createElement('span');
  825.  itemObject.span.className="standartTreeRow";
  826.  if(this.mlitems)itemObject.span.style.width=this.mlitems;
  827.  else td2.noWrap=true;
  828.  if(!_isKHTML)td2.style.width="100%";
  829.  
  830.  
  831.  itemObject.span.innerHTML=itemObject.label;
  832.  td2.appendChild(itemObject.span);
  833.  td2.parentObject=itemObject;td1.parentObject=itemObject;
  834.  td2.onclick=this.onRowSelect;td1.onclick=this.onRowClick;td2.ondblclick=this.onRowClick2;
  835.  if(this.ettip)td2.title=itemObject.label;
  836.  
  837.  if(this.dragAndDropOff){
  838.  if(this._aimgs){this.dragger.addDraggableItem(td12,this);td12.parentObject=itemObject;}
  839.  this.dragger.addDraggableItem(td2,this);
  840. }
  841.  
  842.  itemObject.span.style.paddingLeft="5px";itemObject.span.style.paddingRight="5px";td2.style.verticalAlign="";
  843.  td2.style.fontSize="10pt";td2.style.cursor=this.style_pointer;
  844.  tr.appendChild(td1);tr.appendChild(td11);tr.appendChild(td12);
  845.  tr.appendChild(td2);
  846.  tbody.appendChild(tr);
  847.  table.appendChild(tbody);
  848.  
  849.  if(this.arFunc){
  850.  
  851.  tr.oncontextmenu=Function("this.childNodes[0].parentObject.treeNod.arFunc(this.childNodes[0].parentObject.id);return false;");
  852. }
  853.  return table;
  854. };
  855.  
  856.  
  857.  
  858.  
  859.  dhtmlXTreeObject.prototype.setImagePath=function(newPath){this.imPath=newPath;};
  860.  
  861.  
  862.  
  863.  
  864.  dhtmlXTreeObject.prototype.setOnRightClickHandler=function(func){if(typeof(func)=="function")this.arFunc=func;else this.arFunc=eval(func);};
  865.  
  866.  
  867.  dhtmlXTreeObject.prototype.setOnClickHandler=function(func){if(typeof(func)=="function")this.aFunc=func;else this.aFunc=eval(func);};
  868.  
  869.  
  870.  
  871.  dhtmlXTreeObject.prototype.setXMLAutoLoading=function(filePath){this.XMLsource=filePath;};
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  dhtmlXTreeObject.prototype.setOnCheckHandler=function(func){if(typeof(func)=="function")this.checkFuncHandler=func;else this.checkFuncHandler=eval(func);};
  878.  
  879.  
  880.  
  881.  dhtmlXTreeObject.prototype.setOnOpenHandler=function(func){if(typeof(func)=="function")this.openFuncHandler=func;else this.openFuncHandler=eval(func);};
  882.  
  883.  
  884.  dhtmlXTreeObject.prototype.setOnDblClickHandler=function(func){if(typeof(func)=="function")this.dblclickFuncHandler=func;else this.dblclickFuncHandler=eval(func);};
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  dhtmlXTreeObject.prototype.openAllItems=function(itemId)
  896. {
  897.  var temp=this._globalIdStorageFind(itemId);
  898.  if(!temp)return 0;
  899.  this._xopenAll(temp);
  900. };
  901.  
  902.  
  903.  dhtmlXTreeObject.prototype.getOpenState=function(itemId){
  904.  var temp=this._globalIdStorageFind(itemId);
  905.  if(!temp)return "";
  906.  return this._getOpenState(temp);
  907. };
  908.  
  909.  
  910.  dhtmlXTreeObject.prototype.closeAllItems=function(itemId)
  911. {
  912.  var temp=this._globalIdStorageFind(itemId);
  913.  if(!temp)return 0;
  914.  this._xcloseAll(temp);
  915. };
  916.  
  917.  
  918.  
  919.  dhtmlXTreeObject.prototype.setUserData=function(itemId,name,value){
  920.  var sNode=this._globalIdStorageFind(itemId);
  921.  if(!sNode)return;
  922.  if(name=="hint")sNode.htmlNode.childNodes[0].childNodes[0].title=value;
  923.  sNode.userData["t_"+name]=value;
  924.  if(!sNode._userdatalist)sNode._userdatalist=name;
  925.  else sNode._userdatalist+=","+name;
  926. };
  927.  
  928.  
  929.  dhtmlXTreeObject.prototype.getUserData=function(itemId,name){
  930.  var sNode=this._globalIdStorageFind(itemId);
  931.  if(!sNode)return;
  932.  return sNode.userData["t_"+name];
  933. };
  934.  
  935.  
  936.  dhtmlXTreeObject.prototype.getSelectedItemId=function()
  937. {
  938.  if(this.lastSelected)
  939.  if(this._globalIdStorageFind(this.lastSelected.parentObject.id))
  940.  return this.lastSelected.parentObject.id;
  941.  return("");
  942. };
  943.  
  944.  
  945.  dhtmlXTreeObject.prototype.getItemColor=function(itemId)
  946. {
  947.  var temp=this._globalIdStorageFind(itemId);
  948.  if(!temp)return 0;
  949.  
  950.  var res= new Object();
  951.  if(temp.acolor)res.acolor=temp.acolor;
  952.  if(temp.acolor)res.scolor=temp.scolor;
  953.  return res;
  954. };
  955.  
  956.  dhtmlXTreeObject.prototype.setItemColor=function(itemId,defaultColor,selectedColor)
  957. {
  958.  if((itemId)&&(itemId.span))
  959.  var temp=itemId;
  960.  else
  961.  var temp=this._globalIdStorageFind(itemId);
  962.  if(!temp)return 0;
  963.  else{
  964.  if((this.lastSelected)&&(temp.tr==this.lastSelected.parentObject.tr))
  965. {if(selectedColor)temp.span.style.color=selectedColor;}
  966.  else
  967. {if(defaultColor)temp.span.style.color=defaultColor;}
  968.  
  969.  if(selectedColor)temp.scolor=selectedColor;
  970.  if(defaultColor)temp.acolor=defaultColor;
  971. }
  972. };
  973.  
  974.  
  975.  dhtmlXTreeObject.prototype.getItemText=function(itemId)
  976. {
  977.  var temp=this._globalIdStorageFind(itemId);
  978.  if(!temp)return 0;
  979.  return(temp.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML);
  980. };
  981.  
  982.  dhtmlXTreeObject.prototype.getParentId=function(itemId)
  983. {
  984.  var temp=this._globalIdStorageFind(itemId);
  985.  if((!temp)||(!temp.parentObject))return "";
  986.  return temp.parentObject.id;
  987. };
  988.  
  989.  
  990.  
  991.  
  992.  dhtmlXTreeObject.prototype.changeItemId=function(itemId,newItemId)
  993. {
  994.  var temp=this._globalIdStorageFind(itemId);
  995.  if(!temp)return 0;
  996.  temp.id=newItemId;
  997.  temp.span.contextMenuId=newItemId;
  998.  for(var i=0;i<this._globalIdStorageSize;i++)
  999.  if(this._globalIdStorage[i]==itemId)
  1000. {
  1001.  this._globalIdStorage[i]=newItemId;
  1002. }
  1003. };
  1004.  
  1005.  
  1006.  
  1007.  dhtmlXTreeObject.prototype.doCut=function(){
  1008.  if(this.nodeCut)this.clearCut();
  1009.  this.nodeCut=this.lastSelected;
  1010.  if(this.nodeCut)
  1011. {
  1012.  var tempa=this.nodeCut.parentObject;
  1013.  this.cutImg[0]=tempa.images[0];
  1014.  this.cutImg[1]=tempa.images[1];
  1015.  this.cutImg[2]=tempa.images[2];
  1016.  tempa.images[0]=tempa.images[1]=tempa.images[2]=this.cutImage;
  1017.  this._correctPlus(tempa);
  1018. }
  1019. };
  1020.  
  1021.  
  1022.  dhtmlXTreeObject.prototype.doPaste=function(itemId){
  1023.  var temp=this._globalIdStorageFind(itemId);
  1024.  if(!temp)return 0;
  1025.  if(this.nodeCut){
  1026.  if((!this._checkParenNodes(this.nodeCut.parentObject.id,temp))&&(id!=this.nodeCut.parentObject.parentObject.id))
  1027.  this._moveNode(temp,this.nodeCut.parentObject);
  1028.  this.clearCut();
  1029. }
  1030. };
  1031.  
  1032.  
  1033.  dhtmlXTreeObject.prototype.clearCut=function(){
  1034.  if(this.nodeCut)
  1035. {
  1036.  var tempa=this.nodeCut.parentObject;
  1037.  tempa.images[0]=this.cutImg[0];
  1038.  tempa.images[1]=this.cutImg[1];
  1039.  tempa.images[2]=this.cutImg[2];
  1040.  if(tempa.parentObject)this._correctPlus(tempa);
  1041.  if(tempa.parentObject)this._correctLine(tempa);
  1042.  this.nodeCut=0;
  1043. }
  1044. };
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  dhtmlXTreeObject.prototype._moveNode=function(itemObject,targetObject){
  1050.  
  1051.  var mode=this.dadmodec;
  1052.  if(mode==1)
  1053. {
  1054.  var z=targetObject;
  1055.  if(this.dadmodefix<0)
  1056. {
  1057.  
  1058.  while(true){
  1059.  z=this._getPrevNode(z);
  1060.  if((z==-1)){z=this.htmlNode;break;}
  1061.  if((z.tr.style.display=="")||(!z.parentObject))break;
  1062.  
  1063.  
  1064. }
  1065.  
  1066.  var nodeA=z;
  1067.  var nodeB=targetObject;
  1068.  
  1069. }
  1070.  else
  1071. {
  1072.  while(true){
  1073.  z=this._getNextNode(z);
  1074.  if((z==-1)){z=this.htmlNode;break;}
  1075.  if((z.tr.style.display=="")||(!z.parentObject))break;
  1076.  
  1077.  
  1078. }
  1079.  
  1080.  var nodeB=z;
  1081.  var nodeA=targetObject;
  1082. }
  1083.  
  1084.  
  1085.  if(this._getNodeLevel(nodeA,0)>this._getNodeLevel(nodeB,0))
  1086. {
  1087.  return this._moveNodeTo(itemObject,nodeA.parentObject);
  1088. }
  1089.  else
  1090. {
  1091.  
  1092.  return this._moveNodeTo(itemObject,nodeB.parentObject,nodeB);
  1093. }
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099. }
  1100.  else return this._moveNodeTo(itemObject,targetObject);
  1101.  
  1102. }
  1103.  
  1104.  
  1105.  
  1106. dhtmlXTreeObject.prototype._fixNodesCollection=function(target,zParent){
  1107.  var flag=0;var icount=0;
  1108.  var Nodes=target.childNodes;
  1109.  var Count=target.childsCount-1;
  1110.  
  1111.  if(zParent==Nodes[Count])return;
  1112.  for(var i=0;i<Count;i++)
  1113.  if(Nodes[i]==Nodes[Count]){Nodes[i]=Nodes[i+1];Nodes[i+1]=Nodes[Count];}
  1114.  
  1115.  
  1116.  for(var i=0;i<Count+1;i++)
  1117. {
  1118.  if(flag){
  1119.  var temp=Nodes[i];
  1120.  Nodes[i]=flag;
  1121.  flag=temp;
  1122. }
  1123.  else 
  1124.  if(Nodes[i]==zParent){flag=Nodes[i];Nodes[i]=Nodes[Count];}
  1125. }
  1126. };
  1127.  
  1128.  
  1129.  
  1130.  dhtmlXTreeObject.prototype._moveNodeTo=function(itemObject,targetObject,beforeNode){
  1131.  
  1132.  if(targetObject.mytype)
  1133.  var framesMove=(itemObject.treeNod.lWin!=targetObject.lWin);
  1134.  else
  1135.  var framesMove=(itemObject.treeNod.lWin!=targetObject.treeNod.lWin);
  1136.  
  1137.  if(this.dragFunc)if(!this.dragFunc(itemObject.id,targetObject.id,(beforeNode?beforeNode.id:null),itemObject.treeNod,targetObject.treeNod))return false;
  1138.  if((targetObject.XMLload==0)&&(this.XMLsource))
  1139. {
  1140.  targetObject.XMLload=1;this.loadXML(this.XMLsource+getUrlSymbol(this.XMLsource)+"id="+escape(targetObject.id));
  1141. }
  1142.  this.openItem(targetObject.id);
  1143.  
  1144.  var oldTree=itemObject.treeNod;
  1145.  var c=itemObject.parentObject.childsCount;
  1146.  var z=itemObject.parentObject;
  1147.  
  1148.  if((framesMove)||(oldTree.dpcpy))
  1149.  itemObject=this._recreateBranch(itemObject,targetObject,beforeNode);
  1150.  else
  1151. {
  1152.  
  1153.  var Count=targetObject.childsCount;var Nodes=targetObject.childNodes;
  1154.  Nodes[Count]=itemObject;
  1155.  itemObject.treeNod=targetObject.treeNod;
  1156.  targetObject.childsCount++;
  1157.  
  1158.  var tr=this._drawNewTr(Nodes[Count].htmlNode);
  1159.  
  1160.  if(!beforeNode)
  1161. {
  1162.  targetObject.htmlNode.childNodes[0].appendChild(tr);
  1163.  if(this.dadmode==1)this._fixNodesCollection(targetObject,beforeNode);
  1164. }
  1165.  else 
  1166. {
  1167.  targetObject.htmlNode.childNodes[0].insertBefore(tr,beforeNode.tr);
  1168.  this._fixNodesCollection(targetObject,beforeNode);
  1169.  Nodes=targetObject.childNodes;
  1170. }
  1171.  
  1172.  
  1173. }
  1174.  if(!oldTree.dpcpy){
  1175.  itemObject.parentObject.htmlNode.childNodes[0].removeChild(itemObject.tr);
  1176.  if((!beforeNode)||(targetObject!=itemObject.parentObject)){
  1177.  for(var i=0;i<z.childsCount;i++){
  1178.  if(z.childNodes[i].id==itemObject.id){
  1179.  z.childNodes[i]=0;
  1180.  break;}}}
  1181.  else z.childNodes[z.childsCount-1]=0;
  1182.  
  1183.  oldTree._compressChildList(z.childsCount,z.childNodes);
  1184.  z.childsCount--;
  1185. }
  1186.  
  1187.  
  1188.  if((!framesMove)&&(!oldTree.dpcpy)){
  1189.  itemObject.tr=tr;
  1190.  tr.nodem=itemObject;
  1191.  itemObject.parentObject=targetObject;
  1192.  
  1193.  if(oldTree!=targetObject.treeNod){if(itemObject.treeNod._registerBranch(itemObject,oldTree))return;this._clearStyles(itemObject);this._redrawFrom(this,itemObject.parentObject);};
  1194.  
  1195.  this._correctPlus(targetObject);
  1196.  this._correctLine(targetObject);
  1197.  this._correctLine(itemObject);
  1198.  this._correctPlus(itemObject);
  1199.  
  1200.  
  1201.  if(beforeNode)
  1202. {
  1203.  
  1204.  this._correctPlus(beforeNode);
  1205.  
  1206. }
  1207.  else 
  1208.  if(targetObject.childsCount>=2)
  1209. {
  1210.  
  1211.  this._correctPlus(Nodes[targetObject.childsCount-2]);
  1212.  this._correctLine(Nodes[targetObject.childsCount-2]);
  1213. }
  1214.  
  1215.  this._correctPlus(Nodes[targetObject.childsCount-1]);
  1216.  
  1217.  
  1218.  
  1219.  if(this.tscheck)this._correctCheckStates(targetObject);
  1220.  if(oldTree.tscheck)oldTree._correctCheckStates(z);
  1221.  
  1222. }
  1223.  
  1224.  
  1225.  
  1226.  if(c>1){oldTree._correctPlus(z.childNodes[c-2]);
  1227.  oldTree._correctLine(z.childNodes[c-2]);
  1228. }
  1229.  
  1230.  oldTree._correctPlus(z);
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  if(this.dropFunc)this.dropFunc(itemObject.id,targetObject.id,(beforeNode?beforeNode.id:null),itemObject.treeNod,targetObject.treeNod);
  1236.  return itemObject.id;
  1237. };
  1238.  
  1239.  
  1240. dhtmlXTreeObject.prototype._checkParenNodes=function(itemId,htmlObject,shtmlObject){
  1241.  if(shtmlObject){if(shtmlObject.parentObject.id==htmlObject.id)return 1;}
  1242.  if(htmlObject.id==itemId)return 1;
  1243.  if(htmlObject.parentObject)return this._checkParenNodes(itemId,htmlObject.parentObject);else return 0;
  1244. };
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  dhtmlXTreeObject.prototype._clearStyles=function(itemObject){
  1250.  var td1=itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[1];
  1251.  var td3=td1.nextSibling.nextSibling;
  1252.  
  1253.  itemObject.span.innerHTML=itemObject.label;
  1254.  
  1255.  if(this.checkBoxOff){td1.childNodes[0].style.display="";td1.childNodes[0].onclick=this.onCheckBoxClick;}
  1256.  else td1.childNodes[0].style.display="none";
  1257.  td1.childNodes[0].treeNod=this;
  1258.  
  1259.  this.dragger.removeDraggableItem(td3);
  1260.  if(this.dragAndDropOff)this.dragger.addDraggableItem(td3,this);
  1261.  td3.childNodes[0].className="standartTreeRow";
  1262.  td3.onclick=this.onRowSelect;td3.ondblclick=this.onRowClick2;
  1263.  td1.previousSibling.onclick=this.onRowClick;
  1264.  
  1265.  this._correctLine(itemObject);
  1266.  this._correctPlus(itemObject);
  1267.  for(var i=0;i<itemObject.childsCount;i++)this._clearStyles(itemObject.childNodes[i]);
  1268.  
  1269. };
  1270.  
  1271.  dhtmlXTreeObject.prototype._registerBranch=function(itemObject,oldTree){
  1272.  
  1273.  itemObject.id=this._globalIdStorageAdd(itemObject.id,itemObject);
  1274.  itemObject.treeNod=this;
  1275.  if(oldTree)oldTree._globalIdStorageSub(itemObject.id);
  1276.  for(var i=0;i<itemObject.childsCount;i++)
  1277.  this._registerBranch(itemObject.childNodes[i],oldTree);
  1278.  return 0;
  1279. };
  1280.  
  1281.  
  1282.  
  1283.  dhtmlXTreeObject.prototype.enableThreeStateCheckboxes=function(mode){this.tscheck=convertStringToBoolean(mode);};
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  dhtmlXTreeObject.prototype.enableTreeImages=function(mode){this.timgen=convertStringToBoolean(mode);};
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  dhtmlXTreeObject.prototype.enableFixedMode=function(mode){this.hfMode=convertStringToBoolean(mode);};
  1296.  
  1297.  
  1298.  dhtmlXTreeObject.prototype.enableCheckBoxes=function(mode){this.checkBoxOff=convertStringToBoolean(mode);};
  1299.  
  1300.  dhtmlXTreeObject.prototype.setStdImages=function(image1,image2,image3){
  1301.  this.imageArray[0]=image1;this.imageArray[1]=image2;this.imageArray[2]=image3;};
  1302.  
  1303.  
  1304.  dhtmlXTreeObject.prototype.enableTreeLines=function(mode){
  1305.  this.treeLinesOn=convertStringToBoolean(mode);
  1306. }
  1307.  
  1308.  
  1309.  dhtmlXTreeObject.prototype.setImageArrays=function(arrayName,image1,image2,image3,image4,image5){
  1310.  switch(arrayName){
  1311.  case "plus": this.plusArray[0]=image1;this.plusArray[1]=image2;this.plusArray[2]=image3;this.plusArray[3]=image4;this.plusArray[4]=image5;break;
  1312.  case "minus": this.minusArray[0]=image1;this.minusArray[1]=image2;this.minusArray[2]=image3;this.minusArray[3]=image4;this.minusArray[4]=image5;break;
  1313. }
  1314. };
  1315.  
  1316.  
  1317.  dhtmlXTreeObject.prototype.openItem=function(itemId){
  1318.  var temp=this._globalIdStorageFind(itemId);
  1319.  if(!temp)return 0;
  1320.  else return this._openItem(temp);
  1321. };
  1322.  
  1323.  
  1324.  dhtmlXTreeObject.prototype._openItem=function(item){
  1325.  this._HideShow(item,2);
  1326.  if((item.parentObject)&&(this._getOpenState(item.parentObject)<0))
  1327.  this._openItem(item.parentObject);
  1328. };
  1329.  
  1330.  
  1331.  dhtmlXTreeObject.prototype.closeItem=function(itemId){
  1332.  if(this.rootId==itemId)return 0;
  1333.  var temp=this._globalIdStorageFind(itemId);
  1334.  if(!temp)return 0;
  1335.  if(temp.closeble)
  1336.  this._HideShow(temp,1);
  1337. };
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  dhtmlXTreeObject.prototype.getLevel=function(itemId){
  1366.  var temp=this._globalIdStorageFind(itemId);
  1367.  if(!temp)return 0;
  1368.  return this._getNodeLevel(temp,0);
  1369. };
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  dhtmlXTreeObject.prototype.setItemCloseable=function(itemId,flag)
  1375. {
  1376.  flag=convertStringToBoolean(flag);
  1377.  if((itemId)&&(itemId.span))
  1378.  var temp=itemId;
  1379.  else 
  1380.  var temp=this._globalIdStorageFind(itemId);
  1381.  if(!temp)return 0;
  1382.  temp.closeble=flag;
  1383. };
  1384.  
  1385.  
  1386.  dhtmlXTreeObject.prototype._getNodeLevel=function(itemObject,count){
  1387.  if(itemObject.parentObject)return this._getNodeLevel(itemObject.parentObject,count+1);
  1388.  return(count);
  1389. };
  1390.  
  1391.  
  1392.  dhtmlXTreeObject.prototype.hasChildren=function(itemId){
  1393.  var temp=this._globalIdStorageFind(itemId);
  1394.  if(!temp)return 0;
  1395.  else 
  1396. {
  1397.  if((this.XMLsource)&&(!temp.XMLload))return true;
  1398.  else 
  1399.  return temp.childsCount;
  1400. };
  1401. };
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  dhtmlXTreeObject.prototype.setItemText=function(itemId,newLabel,newTooltip)
  1408. {
  1409.  var temp=this._globalIdStorageFind(itemId);
  1410.  if(!temp)return 0;
  1411.  temp.label=newLabel;
  1412.  temp.span.innerHTML=newLabel;
  1413.  temp.span.parentNode.title=newTooltip||"";
  1414. };
  1415.  
  1416.  dhtmlXTreeObject.prototype.refreshItem=function(itemId){
  1417.  if(!itemId)itemId=this.rootId;
  1418.  var temp=this._globalIdStorageFind(itemId);
  1419.  this.deleteChildItems(itemId);
  1420.  this.loadXML(this.XMLsource+getUrlSymbol(this.XMLsource)+"id="+escape(itemId));
  1421. };
  1422.  
  1423.  
  1424.  dhtmlXTreeObject.prototype.setItemImage2=function(itemId,image1,image2,image3){
  1425.  var temp=this._globalIdStorageFind(itemId);
  1426.  if(!temp)return 0;
  1427.  temp.images[1]=image2;
  1428.  temp.images[2]=image3;
  1429.  temp.images[0]=image1;
  1430.  this._correctPlus(temp);
  1431. };
  1432.  
  1433.  dhtmlXTreeObject.prototype.setItemImage=function(itemId,image1,image2)
  1434. {
  1435.  var temp=this._globalIdStorageFind(itemId);
  1436.  if(!temp)return 0;
  1437.  if(image2)
  1438. {
  1439.  temp.images[1]=image1;
  1440.  temp.images[2]=image2;
  1441. }
  1442.  else temp.images[0]=image1;
  1443.  this._correctPlus(temp);
  1444. };
  1445.  
  1446.  
  1447.  
  1448.  dhtmlXTreeObject.prototype.getSubItems =function(itemId)
  1449. {
  1450.  var temp=this._globalIdStorageFind(itemId);
  1451.  if(!temp)return 0;
  1452.  
  1453.  var z="";
  1454.  for(i=0;i<temp.childsCount;i++)
  1455.  if(!z)z=temp.childNodes[i].id;
  1456.  else z+=","+temp.childNodes[i].id;
  1457.  return z;
  1458. };
  1459.  
  1460.  dhtmlXTreeObject.prototype.getAllSubItems =function(itemId){
  1461.  return this._getAllSubItems(itemId);
  1462. }
  1463.  
  1464.  
  1465.  dhtmlXTreeObject.prototype._getAllSubItems =function(itemId,z,node)
  1466. {
  1467.  if(node)temp=node;
  1468.  else{
  1469.  var temp=this._globalIdStorageFind(itemId);
  1470. };
  1471.  if(!temp)return 0;
  1472.  
  1473.  z="";
  1474.  for(var i=0;i<temp.childsCount;i++)
  1475. {
  1476.  if(!z)z=temp.childNodes[i].id;
  1477.  else z+=","+temp.childNodes[i].id;
  1478.  var zb=this._getAllSubItems(0,z,temp.childNodes[i])
  1479.  if(zb)z+=","+zb;
  1480. }
  1481.  return z;
  1482. };
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  dhtmlXTreeObject.prototype.selectItem=function(itemId,mode){
  1488.  mode=convertStringToBoolean(mode);
  1489.  var temp=this._globalIdStorageFind(itemId);
  1490.  if(!temp)return 0;
  1491.  if(this._getOpenState(temp.parentObject)==-1)
  1492.  this.openItem(itemId);
  1493.  
  1494.  if(mode)
  1495.  this.onRowSelect(0,temp.htmlNode.childNodes[0].childNodes[0].childNodes[3],false);
  1496.  else
  1497.  this.onRowSelect(0,temp.htmlNode.childNodes[0].childNodes[0].childNodes[3],true);
  1498. };
  1499.  
  1500.  
  1501.  dhtmlXTreeObject.prototype.getSelectedItemText=function()
  1502. {
  1503.  if(this.lastSelected)
  1504.  return this.lastSelected.parentObject.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML;
  1505.  else return("");
  1506. };
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  dhtmlXTreeObject.prototype._compressChildList=function(Count,Nodes)
  1513. {
  1514.  Count--;
  1515.  for(var i=0;i<Count;i++)
  1516. {
  1517.  if(Nodes[i]==0){Nodes[i]=Nodes[i+1];Nodes[i+1]=0;}
  1518. };
  1519. };
  1520.  
  1521.  dhtmlXTreeObject.prototype._deleteNode=function(itemId,htmlObject,skip){
  1522.  
  1523.  if(!skip){
  1524.  this._globalIdStorageRecSub(htmlObject);
  1525. }
  1526.  
  1527.  if((!htmlObject)||(!htmlObject.parentObject))return 0;
  1528.  var tempos=0;var tempos2=0;
  1529.  if(htmlObject.tr.nextSibling)tempos=htmlObject.tr.nextSibling.nodem;
  1530.  if(htmlObject.tr.previousSibling)tempos2=htmlObject.tr.previousSibling.nodem;
  1531.  
  1532.  var sN=htmlObject.parentObject;
  1533.  var Count=sN.childsCount;
  1534.  var Nodes=sN.childNodes;
  1535.  for(var i=0;i<Count;i++)
  1536. {
  1537.  if(Nodes[i].id==itemId){
  1538.  if(!skip)sN.htmlNode.childNodes[0].removeChild(Nodes[i].tr);
  1539.  Nodes[i]=0;
  1540.  break;
  1541. }
  1542. }
  1543.  this._compressChildList(Count,Nodes);
  1544.  if(!skip){
  1545.  sN.childsCount--;
  1546. }
  1547.  
  1548.  if(tempos){
  1549.  this._correctPlus(tempos);
  1550.  this._correctLine(tempos);
  1551. }
  1552.  if(tempos2){
  1553.  this._correctPlus(tempos2);
  1554.  this._correctLine(tempos2);
  1555. }
  1556.  if(this.tscheck)this._correctCheckStates(sN);
  1557. };
  1558.  
  1559.  dhtmlXTreeObject.prototype.setCheck=function(itemId,state){
  1560.  state=convertStringToBoolean(state);
  1561.  var sNode=this._globalIdStorageFind(itemId);
  1562.  if(!sNode)return;
  1563.  if((this.tscheck)&&(this.smcheck))this._setSubChecked(state,sNode);
  1564.  else this._setCheck(sNode,state);
  1565.  if(this.smcheck)
  1566.  this._correctCheckStates(sNode.parentObject);
  1567. };
  1568.  
  1569.  dhtmlXTreeObject.prototype._setCheck=function(sNode,state){
  1570.  var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
  1571.  
  1572.  if(state=="notsure")sNode.checkstate=2;
  1573.  else if(state)sNode.checkstate=1;else sNode.checkstate=0;
  1574.  
  1575.  
  1576.  z.src=this.imPath+this.checkArray[sNode.checkstate];
  1577. };
  1578.  
  1579.  
  1580. dhtmlXTreeObject.prototype.setSubChecked=function(itemId,state){
  1581.  var sNode=this._globalIdStorageFind(itemId);
  1582.  this._setSubChecked(state,sNode);
  1583.  this._correctCheckStates(sNode.parentObject);
  1584. }
  1585.  
  1586.  
  1587. dhtmlXTreeObject.prototype._setSubCheckedXML=function(state,sNode){
  1588.  if(!sNode)return;
  1589.  for(var i=0;i<sNode.childNodes.length;i++){
  1590.  var tag=sNode.childNodes[i];
  1591.  if((tag)&&(tag.tagName=="item")){
  1592.  if(state)tag.setAttribute("checked",1);
  1593.  else tag.setAttribute("checked","");
  1594.  this._setSubCheckedXML(state,tag);
  1595. }
  1596. }
  1597. }
  1598.  
  1599.  
  1600.  
  1601.  dhtmlXTreeObject.prototype._setSubChecked=function(state,sNode){
  1602.  state=convertStringToBoolean(state);
  1603.  if(!sNode)return;
  1604.  if(sNode.unParsed)
  1605.  this._setSubCheckedXML(state,sNode.unParsed)
  1606.  for(var i=0;i<sNode.childsCount;i++)
  1607. {
  1608.  this._setSubChecked(state,sNode.childNodes[i]);
  1609. };
  1610.  var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
  1611.  
  1612.  if(state)sNode.checkstate=1;
  1613.  else sNode.checkstate=0;
  1614.  
  1615.  z.src=this.imPath+this.checkArray[sNode.checkstate];
  1616. };
  1617.  
  1618.  
  1619.  dhtmlXTreeObject.prototype.isItemChecked=function(itemId){
  1620.  var sNode=this._globalIdStorageFind(itemId);
  1621.  if(!sNode)return;
  1622.  return sNode.checkstate;
  1623. };
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  dhtmlXTreeObject.prototype.getAllChecked=function(){
  1631.  return this._getAllChecked("","",1);
  1632. }
  1633.  
  1634.  dhtmlXTreeObject.prototype.getAllCheckedBranches=function(){
  1635.  return this._getAllChecked("","",0);
  1636. }
  1637.  
  1638.  
  1639.  dhtmlXTreeObject.prototype._getAllChecked=function(htmlNode,list,mode){
  1640.  if(!htmlNode)htmlNode=this.htmlNode;
  1641.  if(((mode)&&(htmlNode.checkstate==1))||((!mode)&&(htmlNode.checkstate>0)))
  1642.  if(!htmlNode.nocheckbox){if(list)list+=","+htmlNode.id;else list=htmlNode.id;}
  1643.  var j=htmlNode.childsCount;
  1644.  for(var i=0;i<j;i++)
  1645. {
  1646.  list=this._getAllChecked(htmlNode.childNodes[i],list,mode);
  1647. };
  1648.  if(htmlNode.unParsed)
  1649.  list=this._getAllCheckedXML(htmlNode.unParsed,list,mode);
  1650.  
  1651.  if(list)return list;else return "";
  1652. };
  1653.  
  1654.  
  1655.  dhtmlXTreeObject.prototype._getAllCheckedXML=function(htmlNode,list,mode){
  1656.  var j=htmlNode.childNodes.length;
  1657.  for(var i=0;i<j;i++)
  1658. {
  1659.  var tNode=htmlNode.childNodes[i];
  1660.  if(tNode.tagName=="item")
  1661. {
  1662.  var z=tNode.getAttribute("checked");
  1663.  if((z!=null)&&(z!="")&&(z!="0"))
  1664.  if(((z=="-1")&&(!mode))||(z!="-1"))
  1665.  if(list)list+=","+tNode.getAttribute("id");
  1666.  else list=htmlNode.id;
  1667.  
  1668.  list=this._getAllChecked(tNode,list,mode);
  1669. }
  1670. };
  1671.  
  1672.  if(list)return list;else return "";
  1673. };
  1674.  
  1675.  
  1676.  
  1677.  dhtmlXTreeObject.prototype.deleteChildItems=function(itemId)
  1678. {
  1679.  var sNode=this._globalIdStorageFind(itemId);
  1680.  if(!sNode)return;
  1681.  var j=sNode.childsCount;
  1682.  for(var i=0;i<j;i++)
  1683. {
  1684.  this._deleteNode(sNode.childNodes[0].id,sNode.childNodes[0]);
  1685. };
  1686. };
  1687.  
  1688.  
  1689. dhtmlXTreeObject.prototype.deleteItem=function(itemId,selectParent){
  1690.  this._deleteItem(itemId,selectParent);
  1691.  
  1692.  this.allTree.childNodes[0].border = "1";
  1693.  this.allTree.childNodes[0].border = "0";
  1694. }
  1695.  
  1696. dhtmlXTreeObject.prototype._deleteItem=function(itemId,selectParent,skip){
  1697.  selectParent=convertStringToBoolean(selectParent);
  1698.  var sNode=this._globalIdStorageFind(itemId);
  1699.  if(!sNode)return;
  1700.  if(selectParent)this.selectItem(this.getParentId(this.getSelectedItemId()),1);
  1701.  else
  1702.  if(sNode==this.lastSelected.parentObject)
  1703.  this.lastSelected=null;
  1704.  if(!skip){
  1705.  this._globalIdStorageRecSub(sNode);
  1706.  
  1707. };
  1708.  var zTemp=sNode.parentObject;
  1709.  this._deleteNode(itemId,sNode,skip);
  1710.  this._correctPlus(zTemp);
  1711.  this._correctLine(zTemp);
  1712.  return zTemp;
  1713.  
  1714.  
  1715. };
  1716.  
  1717.  
  1718.  dhtmlXTreeObject.prototype._globalIdStorageRecSub=function(itemObject){
  1719.  for(var i=0;i<itemObject.childsCount;i++)
  1720. {
  1721.  this._globalIdStorageRecSub(itemObject.childNodes[i]);
  1722.  this._globalIdStorageSub(itemObject.childNodes[i].id);
  1723. };
  1724.  this._globalIdStorageSub(itemObject.id);
  1725. };
  1726.  
  1727.  
  1728.  dhtmlXTreeObject.prototype.insertNewNext=function(parentItemId,itemId,itemName,itemActionHandler,image1,image2,image3,optionStr,childs){
  1729.  var sNode=this._globalIdStorageFind(parentItemId);
  1730.  if((!sNode)||(!sNode.parentObject))return(0);
  1731.  
  1732.  this._attachChildNode(0,itemId,itemName,itemActionHandler,image1,image2,image3,optionStr,childs,sNode);
  1733.  
  1734. };
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  dhtmlXTreeObject.prototype.getItemIdByIndex=function(itemId,index){
  1740.  var z=this._globalIdStorageFind(itemId);
  1741.  if((!z)||(index>z.childsCount))return null;
  1742.  return z.childNodes[index].id;
  1743. };
  1744.  
  1745.  
  1746.  dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(itemId,index){
  1747.  var z=this._globalIdStorageFind(itemId);
  1748.  if((!z)||(index>z.childsCount))return null;
  1749.  return z.childNodes[index].id;
  1750. };
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  dhtmlXTreeObject.prototype.setDragHandler=function(func){if(typeof(func)=="function")this.dragFunc=func;else this.dragFunc=eval(func);};
  1758.  
  1759.  
  1760.  dhtmlXTreeObject.prototype._clearMove=function(htmlNode){
  1761.  if((htmlNode.parentObject)&&(htmlNode.parentObject.span)){
  1762.  htmlNode.parentObject.span.className='standartTreeRow';
  1763.  if(htmlNode.parentObject.acolor)htmlNode.parentObject.span.style.color=htmlNode.parentObject.acolor;
  1764. }
  1765.  
  1766.  this.selectionBar.style.display="none";
  1767.  
  1768.  this.allTree.className="containerTableStyle";
  1769. };
  1770.  
  1771.  
  1772.  dhtmlXTreeObject.prototype.enableDragAndDrop=function(mode){
  1773.  this.dragAndDropOff=convertStringToBoolean(mode);
  1774.  if(this.dragAndDropOff)this.dragger.addDragLanding(this.allTree,this);
  1775. };
  1776.  
  1777.  
  1778.  
  1779.  dhtmlXTreeObject.prototype._setMove=function(htmlNode,x,y){
  1780.  if(htmlNode.parentObject.span){
  1781.  
  1782.  var a1=getAbsoluteTop(htmlNode);
  1783.  var a2=getAbsoluteTop(this.allTree);
  1784.  
  1785.  this.dadmodec=this.dadmode;
  1786.  this.dadmodefix=0;
  1787.  
  1788.  
  1789.  if(this.dadmodec==0)
  1790. {
  1791.  htmlNode.parentObject.span.className='selectedTreeRow';
  1792.  if(htmlNode.parentObject.scolor)htmlNode.parentObject.span.style.color=htmlNode.parentObject.scolor;
  1793. }
  1794.  else{
  1795.  htmlNode.parentObject.span.className='standartTreeRow';
  1796.  if(htmlNode.parentObject.acolor)htmlNode.parentObject.span.style.color=htmlNode.parentObject.acolor;
  1797.  this.selectionBar.style.top=a1-a2+16+this.dadmodefix+"px";
  1798.  this.selectionBar.style.left="5px";
  1799.  this.selectionBar.style.display="";
  1800. }
  1801.  
  1802.  
  1803.  if(this.autoScroll)
  1804. {
  1805.  
  1806.  if((a1-a2-parseInt(this.allTree.scrollTop))>(parseInt(this.allTree.offsetHeight)-50))
  1807.  this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20;
  1808.  
  1809.  if((a1-a2)<(parseInt(this.allTree.scrollTop)+30))
  1810.  this.allTree.scrollTop=parseInt(this.allTree.scrollTop)-20;
  1811. }
  1812. }
  1813. };
  1814.  
  1815.  
  1816.  
  1817.  
  1818. dhtmlXTreeObject.prototype._createDragNode=function(htmlObject){
  1819.  dhtmlObject=htmlObject.parentObject;
  1820.  if(this.lastSelected)this._clearMove(this.lastSelected);
  1821.  var dragSpan=document.createElement('div');
  1822.  dragSpan.innerHTML=dhtmlObject.label;
  1823.  dragSpan.style.position="absolute";
  1824.  dragSpan.className="dragSpanDiv";
  1825.  return dragSpan;
  1826. }
  1827.  
  1828.  
  1829.  
  1830. dhtmlXTreeObject.prototype._preventNsDrag=function(e){
  1831.  if((e)&&(e.preventDefault)){e.preventDefault();return false;}
  1832.  return false;
  1833. }
  1834.  
  1835. dhtmlXTreeObject.prototype._drag=function(sourceHtmlObject,dhtmlObject,targetHtmlObject){
  1836.  
  1837.  if(this._autoOpenTimer)clearTimeout(this._autoOpenTimer);
  1838.  
  1839.  if(!targetHtmlObject.parentObject){
  1840.  targetHtmlObject=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
  1841.  this.dadmodec=0;
  1842. }
  1843.  
  1844.  this._clearMove(targetHtmlObject);
  1845.  var z=targetHtmlObject.parentObject.treeNod;
  1846.  z._clearMove("");
  1847.  
  1848.  if((!this.dragMove)||(this.dragMove()))
  1849. {
  1850.  var newID=this._moveNode(sourceHtmlObject.parentObject,targetHtmlObject.parentObject);
  1851.  z.selectItem(newID);
  1852. }
  1853.  
  1854.  try{}
  1855.  catch(e){
  1856.  return;
  1857. }
  1858. }
  1859.  
  1860. dhtmlXTreeObject.prototype._dragIn=function(htmlObject,shtmlObject,x,y){
  1861.  if(!htmlObject.parentObject)
  1862. {
  1863.  
  1864.  
  1865.  this.allTree.className="containerTableStyle selectionBox";
  1866.  
  1867.  return htmlObject;
  1868.  
  1869. }
  1870.  
  1871.  if((!this._checkParenNodes(shtmlObject.parentObject.id,htmlObject.parentObject,shtmlObject.parentObject))&&(htmlObject.parentObject.id!=shtmlObject.parentObject.id))
  1872. {
  1873.  htmlObject.parentObject.span.parentNode.appendChild(this.selectionBar);
  1874.  this._setMove(htmlObject,x,y);
  1875.  if(this._getOpenState(htmlObject.parentObject)<0)
  1876.  this._autoOpenTimer=window.setTimeout(new callerFunction(this._autoOpenItem,this),1000);
  1877.  this._autoOpenId=htmlObject.parentObject.id;
  1878.  return htmlObject;
  1879. }
  1880.  else return 0;
  1881. }
  1882. dhtmlXTreeObject.prototype._autoOpenItem=function(e,treeObject){
  1883.  treeObject.openItem(treeObject._autoOpenId);
  1884. };
  1885. dhtmlXTreeObject.prototype._dragOut=function(htmlObject){
  1886. this._clearMove(htmlObject);
  1887. if(this._autoOpenTimer)clearTimeout(this._autoOpenTimer);
  1888. }
  1889.  
  1890.  
  1891.  
  1892.  
  1893. dhtmlXTreeObject.prototype._getNextNode=function(item,mode){
  1894.  if((!mode)&&(item.childsCount))return item.childNodes[0];
  1895.  if(item==this.htmlNode)
  1896.  return -1;
  1897.  if((item.tr)&&(item.tr.nextSibling)&&(item.tr.nextSibling.nodem))
  1898.  return item.tr.nextSibling.nodem;
  1899.  
  1900.  return this._getNextNode(item.parentObject,true);
  1901. };
  1902.  
  1903.  
  1904. dhtmlXTreeObject.prototype._lastChild=function(item){
  1905.  if(item.childsCount)
  1906.  return this._lastChild(item.childNodes[item.childsCount-1]);
  1907.  else return item;
  1908. };
  1909.  
  1910.  
  1911. dhtmlXTreeObject.prototype._getPrevNode=function(node,mode){
  1912.  if((node.tr)&&(node.tr.previousSibling)&&(node.tr.previousSibling.nodem))
  1913.  return this._lastChild(node.tr.previousSibling.nodem);
  1914.  
  1915.  if(node.parentObject)
  1916.  return node.parentObject;
  1917.  else return -1;
  1918. };
  1919.  
  1920.  
  1921.  
  1922.