function Pnode(id,pid,open,ls){this.id=id;this.pid=pid;this._io=open||false;this._ls=ls}function pTree(objName){this.icon={root:'/dtree/img/base.gif',folder:'/dtree/img/folder.gif',folderOpen:'dtree/img/folderopen.gif',node:'/dtree/img/page.gif',empty:'/dtree/img/empty.gif',line:'/dtree/img/line.gif',join:'/dtree/img/join.gif',joinBottom:'/dtree/img/joinbottom.gif',plus:'/dtree/img/plus.gif',plusBottom:'/dtree/img/plusbottom.gif',minus:'/dtree/img/minus.gif',minusBottom:'/dtree/img/minusbottom.gif',nlPlus:'/dtree/img/nolines_plus.gif',nlMinus:'/dtree/img/nolines_minus.gif'};this.obj=objName;this.aNodes=[];this.rozwin=false}pTree.prototype.add=function(id,pid,open,ls){this.aNodes[this.aNodes.length]=new Pnode(id,pid,open,ls)};pTree.prototype.openAll=function(){this.rozwin=!this.rozwin;this.oAll(this.rozwin)};pTree.prototype.closeAll=function(){this.oAll(false)};pTree.prototype.o=function(ID){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].id==ID){var cn=this.aNodes[n];this.nodeStatus(!cn._io,ID,this.aNodes[n]._ls);cn._io=!cn._io;this.closeLevel(cn);break}}};pTree.prototype.oAll=function(status){for(var n=0;n<this.aNodes.length;n++){var ID=this.aNodes[n].id;this.nodeStatus(status,ID,this.aNodes[n]._ls);this.aNodes[n]._io=status}};pTree.prototype.closeLevel=function(node){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].pid==node.pid&&this.aNodes[n].id!=node.id&&this.aNodes[n]._io==true){this.nodeStatus(false,this.aNodes[n].id,this.aNodes[n]._ls);this.aNodes[n]._io=false;this.closeAllChildren(this.aNodes[n])}}};pTree.prototype.closeAllChildren=function(node){for(var n=0;n<this.aNodes.length;n++){if(this.aNodes[n].pid==node.id){if(this.aNodes[n]._io)this.nodeStatus(false,this.aNodes[n].id,this.aNodes[n]._ls);this.aNodes[n]._io=false;this.closeAllChildren(this.aNodes[n])}}};pTree.prototype.nodeStatus=function(stan,ID,last){eDiv=document.getElementById("c"+ID);eJoin=document.getElementById("i"+ID);eFolder=document.getElementById("j"+ID);eJoin.src=(last)?((stan)?this.icon.minusBottom:this.icon.plusBottom):((stan)?this.icon.minus:this.icon.plus);eFolder.src=(stan)?this.icon.folderOpen:this.icon.folder;eDiv.style.display=(stan)?'block':'none'};