function Node(c,f,a,b,i,g,h,d,e){this.id=c;this.pid=f;this.name=a;this.url=b;this.title=i;this.target=g;this.icon=h;this.iconOpen=d;this._io=e||false;this._is=false;this._ls=false;this._hc=false;this._ai=0;this._p}function dTree(b,a){this.config={target:null,folderLinks:true,useSelection:true,useCookies:true,useLines:true,useIcons:true,useStatusText:false,closeSameLevel:false,inOrder:false,iconRoot:a};this.icon={root:this.config.iconRoot+"img/base.gif",folder:this.config.iconRoot+"img/folder.gif",folderOpen:this.config.iconRoot+"img/folderopen.gif",node:this.config.iconRoot+"img/page.gif",empty:this.config.iconRoot+"img/empty.gif",line:this.config.iconRoot+"img/line.gif",join:this.config.iconRoot+"img/join.gif",joinBottom:this.config.iconRoot+"img/joinbottom.gif",plus:this.config.iconRoot+"img/plus.gif",plusBottom:this.config.iconRoot+"img/plusbottom.gif",minus:this.config.iconRoot+"img/minus.gif",minusBottom:this.config.iconRoot+"img/minusbottom.gif",nlPlus:this.config.iconRoot+"img/nolines_plus.gif",nlMinus:this.config.iconRoot+"img/nolines_minus.gif"};this.obj=b;this.aNodes=[];this.aIndent=[];this.root=new Node(-1);this.selectedNode=null;this.selectedFound=false;this.completed=false}dTree.prototype.add=function(c,f,a,b,i,g,h,d,e){this.aNodes[this.aNodes.length]=new Node(c,f,a,b,i,g,h,d,e)};dTree.prototype.openAll=function(){this.oAll(true)};dTree.prototype.closeAll=function(){this.oAll(false)};dTree.prototype.toString=function(){var a='<div class="dtree">\n';if(document.getElementById){if(this.config.useCookies){this.selectedNode=this.getSelected()}a+=this.addNode(this.root)}else{a+="Browser not supported."}a+="</div>";if(!this.selectedFound){this.selectedNode=null}this.completed=true;return a};dTree.prototype.addNode=function(a){var b="";var d=0;if(this.config.inOrder){d=a._ai}for(d;d<this.aNodes.length;d++){if(this.aNodes[d].pid==a.id){var c=this.aNodes[d];c._p=a;c._ai=d;this.setCS(c);if(!c.target&&this.config.target){c.target=this.config.target}if(c._hc&&!c._io&&this.config.useCookies){c._io=this.isOpen(c.id)}if(!this.config.folderLinks&&c._hc){c.url=null}if(this.config.useSelection&&c.id==this.selectedNode&&!this.selectedFound){c._is=true;this.selectedNode=d;this.selectedFound=true}b+=this.node(c,d);if(c._ls){break}}}return b};dTree.prototype.node=function(a,c){var b='<div class="dTreeNode">'+this.indent(a,c);if(this.config.useIcons){if(!a.icon){a.icon=(this.root.id==a.pid)?this.icon.root:((a._hc)?this.icon.folder:this.icon.node)}if(!a.iconOpen){a.iconOpen=(a._hc)?this.icon.folderOpen:this.icon.node}if(this.root.id==a.pid){a.icon=this.icon.root;a.iconOpen=this.icon.root}b+='<img id="i'+this.obj+c+'" src="'+((a._io)?a.iconOpen:a.icon)+'" alt="" />'}if(a.url){b+='<a id="s'+this.obj+c+'" class="'+((this.config.useSelection)?((a._is?"nodeSel":"node")):"node")+'" href="'+a.url+'"';if(a.title){b+=' title="'+a.title+'"'}if(a.target){b+=' target="'+a.target+'"'}if(this.config.useStatusText){b+=" onmouseover=\"window.status='"+a.name+"';return true;\" onmouseout=\"window.status='';return true;\" "}if(this.config.useSelection&&((a._hc&&this.config.folderLinks)||!a._hc)){b+=' onclick="javascript: '+this.obj+".s("+c+');"'}b+=">"}else{if((!this.config.folderLinks||!a.url)&&a._hc&&a.pid!=this.root.id){b+='<a href="javascript: '+this.obj+".o("+c+');" class="node">'}}b+=a.name;if(a.url||((!this.config.folderLinks||!a.url)&&a._hc)){b+="</a>"}b+="</div>";if(a._hc){b+='<div id="d'+this.obj+c+'" class="clip" style="display:'+((this.root.id==a.pid||a._io)?"block":"none")+';">';b+=this.addNode(a);b+="</div>"}this.aIndent.pop();return b};dTree.prototype.indent=function(a,c){var b="";if(this.root.id!=a.pid){for(var d=0;d<this.aIndent.length;d++){b+='<img src="'+((this.aIndent[d]==1&&this.config.useLines)?this.icon.line:this.icon.empty)+'" alt="" />'}(a._ls)?this.aIndent.push(0):this.aIndent.push(1);if(a._hc){b+='<a href="javascript: '+this.obj+".o("+c+');"><img id="j'+this.obj+c+'" src="';if(!this.config.useLines){b+=(a._io)?this.icon.nlMinus:this.icon.nlPlus}else{b+=((a._io)?((a._ls&&this.config.useLines)?this.icon.minusBottom:this.icon.minus):((a._ls&&this.config.useLines)?this.icon.plusBottom:this.icon.plus))}b+='" alt="" /></a>'}else{b+='<img src="'+((this.config.useLines)?((a._ls)?this.icon.joinBottom:this.icon.join):this.icon.empty)+'" alt="" />'}}return b};dTree.prototype.setCS=function(a){var b;for(var c=0;c<this.aNodes.length;c++){if(this.aNodes[c].pid==a.id){a._hc=true}if(this.aNodes[c].pid==a.pid){b=this.aNodes[c].id}}if(b==a.id){a._ls=true}};dTree.prototype.getSelected=function(){var a=this.getCookie("cs"+this.obj);return(a)?a:null};dTree.prototype.s=function(b){if(!this.config.useSelection){return}var a=this.aNodes[b];if(a._hc&&!this.config.folderLinks){return}if(this.selectedNode!=b){if(this.selectedNode||this.selectedNode==0){eOld=document.getElementById("s"+this.obj+this.selectedNode);eOld.className="node"}eNew=document.getElementById("s"+this.obj+b);eNew.className="nodeSel";this.selectedNode=b;if(this.config.useCookies){this.setCookie("cs"+this.obj,a.id)}}};dTree.prototype.o=function(b){var a=this.aNodes[b];this.nodeStatus(!a._io,b,a._ls);a._io=!a._io;if(this.config.closeSameLevel){this.closeLevel(a)}if(this.config.useCookies){this.updateCookie()}};dTree.prototype.oAll=function(a){for(var b=0;b<this.aNodes.length;b++){if(this.aNodes[b]._hc&&this.aNodes[b].pid!=this.root.id){this.nodeStatus(a,b,this.aNodes[b]._ls);this.aNodes[b]._io=a}}if(this.config.useCookies){this.updateCookie()}};dTree.prototype.openTo=function(b,a,c){if(!c){for(var e=0;e<this.aNodes.length;e++){if(this.aNodes[e].id==b){b=e;break}}}var d=this.aNodes[b];if(d.pid==this.root.id||!d._p){return}d._io=true;d._is=a;if(this.completed&&d._hc){this.nodeStatus(true,d._ai,d._ls)}if(this.completed&&a){this.s(d._ai)}else{if(a){this._sn=d._ai}}this.openTo(d._p._ai,false,true)};dTree.prototype.closeLevel=function(a){for(var b=0;b<this.aNodes.length;b++){if(this.aNodes[b].pid==a.pid&&this.aNodes[b].id!=a.id&&this.aNodes[b]._hc){this.nodeStatus(false,b,this.aNodes[b]._ls);this.aNodes[b]._io=false;this.closeAllChildren(this.aNodes[b])}}};dTree.prototype.closeAllChildren=function(a){for(var b=0;b<this.aNodes.length;b++){if(this.aNodes[b].pid==a.id&&this.aNodes[b]._hc){if(this.aNodes[b]._io){this.nodeStatus(false,b,this.aNodes[b]._ls)}this.aNodes[b]._io=false;this.closeAllChildren(this.aNodes[b])}}};dTree.prototype.nodeStatus=function(a,c,b){eDiv=document.getElementById("d"+this.obj+c);eJoin=document.getElementById("j"+this.obj+c);if(this.config.useIcons){eIcon=document.getElementById("i"+this.obj+c);eIcon.src=(a)?this.aNodes[c].iconOpen:this.aNodes[c].icon}eJoin.src=(this.config.useLines)?((a)?((b)?this.icon.minusBottom:this.icon.minus):((b)?this.icon.plusBottom:this.icon.plus)):((a)?this.icon.nlMinus:this.icon.nlPlus);eDiv.style.display=(a)?"block":"none"};dTree.prototype.clearCookie=function(){var a=new Date();var b=new Date(a.getTime()-1000*60*60*24);this.setCookie("co"+this.obj,"cookieValue",b);this.setCookie("cs"+this.obj,"cookieValue",b)};dTree.prototype.setCookie=function(f,e,a,d,b,c){document.cookie=escape(f)+"="+escape(e)+(a?"; expires="+a.toGMTString():"")+(d?"; path="+d:"")+(b?"; domain="+b:"")+(c?"; secure":"")};dTree.prototype.getCookie=function(e){var d="";var b=document.cookie.indexOf(escape(e)+"=");if(b!=-1){var c=b+(escape(e)+"=").length;var a=document.cookie.indexOf(";",c);if(a!=-1){d=unescape(document.cookie.substring(c,a))}else{d=unescape(document.cookie.substring(c))}}return(d)};dTree.prototype.updateCookie=function(){var a="";for(var b=0;b<this.aNodes.length;b++){if(this.aNodes[b]._io&&this.aNodes[b].pid!=this.root.id){if(a){a+="."}a+=this.aNodes[b].id}}this.setCookie("co"+this.obj,a)};dTree.prototype.isOpen=function(c){var b=this.getCookie("co"+this.obj).split(".");for(var a=0;a<b.length;a++){if(b[a]==c){return true}}return false};if(!Array.prototype.push){Array.prototype.push=function array_push(){for(var a=0;a<arguments.length;a++){this[this.length]=arguments[a]}return this.length}}if(!Array.prototype.pop){Array.prototype.pop=function array_pop(){lastElement=this[this.length-1];this.length=Math.max(this.length-1,0);return lastElement}};