// URL: http://www.softdrawer.com/products/tree_pro/
// Email: info@softdrawer.com
// Version: 3.0.2.internal
// Last Modify: 25 Mar 2003
// Notes: Registration needed to use this script on your web site.
// Copyright (c) 1999-2003 by SoftDrawer.Com
bw=new Browser();function SoftDrawerTreePRO(name,def){ this.def=def;this.format=def.format;this.name=name;this.num=0;this.anim_ref=0;this.id='SDTree'+name; this.nodes=[];this.root={id:name+"_i"};this.root.level_format=this.format; this.root.format=this.format; this.root.sub=def.sub;eval("window."+this.id+"=this"); this.pa=[];  this.pa[0]=""; if (!bw) bw=new Browser(); this.init=function(){ this.code=''; this.cook=this.format.save_state?this.get_cookie(this.name+'_S'):null; this.back=new DHTMLObject(this.name+'_back'); this._init(null,this.root,-1,0); if (!this.format.no_images) {var f=this.format;pldImg([f.e_image,f.c_image])}; document.write(this.back.draw(this.format.left,this.format.top,this.format.width,this.format.height,this.getp(this.root,"back_bgcolor",0),0,1,this.getp(this.root,"back_class",0),this.code,this.format.relative||0)); this.back.init();if (this.format.dont_resize_back)this.back.show();  if (this.tt)document.write('<div style="z-index:0;width:1;height:1;position:absolute;visibility:hidden"><iframe src="'+unescape(this.pa.join(''))+'"></iframe></div>');}; this._init=function(parent,node,lvl,num){ if(!node) return;node.parent=parent;node.id=node.id||node.parent.id+"_"+num;node.lvl=lvl;node.ind=(this.num++)-1; if(node!=this.root){  if (this.format.save_state&&node.sub&&this.cook!=null&&this.cook.charAt(node.ind)=='1') node.exp=1;  this.nodes[node.id]=node;var s=this.init_item(node);  node.obj=new DHTMLObject(node.id);  this.code+=(node.obj.draw(0,0,this.getp(node,"width","100%"),0,this.getp(node,"bgcolor",0),0,(1000-this.num),this.getp(node,"div_class",0),s));} if(node.sub) for(var i=0;i<node.sub.length;i++) this._init(node,node.sub[i], lvl+1,i);}; this.getp=function(n,name,def,nf){return !nf&&n.format&&!und(n.format[name])?n.format[name]:n.parent==null?def:n.parent.level_format&&!und(n.parent.level_format[name])?n.parent.level_format[name]:this.getp(n.parent,name,def,1)}; this.get_cookie=function(s){var a=document.cookie.split(";");
for (var i=0;i < a.length ;i++){var c=a[i].split("=");if (s==c[0]) return unescape(c[1])}return null}; this.save=function(){var a=new Array(this.num-1);for (var i in this.nodes) a[this.nodes[i].ind]=this.nodes[i].exp?'1':'0';document.cookie=this.name+'_S='+a.join('')+';path=/'}; this.indent_code=function(n){ var indent=this.getp(n,"indent",parseInt(this.format.level_indent||16)*n.lvl-this.getp(n,"padding",0))||0; return n.lvl&&indent?'<td><img src="'+this.format.b_image+'" width="'+indent+'" height="1"></td>':'';}; this.init_item=function(n){ var tc=this.getp(n,"table_class",0); var s='<table width="'+this.getp(n,"width","100%")+'" cellpadding="'+this.getp(n,"padding",0)+'" cellspacing="'+this.getp(n,"spacing",0)+'" border="0"'+(tc?' class="'+tc+'"':'')+'><tr>'; s+=this.indent_code(n); var img=this.getp(n,(n.sub?n.exp?"e":"c":"i")+"_image",this.format.b_image); var sz=this.getp(n,"img_size",[32,16]); s+=!this.getp(n,"no_images",0)?'<td>'+(n.sub?'<a onclick="if(this.blur)this.blur()" href="javascript:Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',0)">':'')+'<img '+(bw.ns4?'name="'+n.id+'_img" ':'')+'id="'+n.id+'_img" src="'+img+'" width="'+sz[0]+'" height="'+sz[1]+'" border="0"/>'+(n.sub?'</a>':'')+'</td>':''; var bgc=this.getp(n,"item_bgcolor",0);bgc=bgc?' bgcolor="'+bgc+'"':' '; var targ=n.target||this.format.target||0; tc=this.getp(n,"item_class",0);var lc=this.getp(n,"link_class",0); var hr='Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',1)'; s+='<td width="100%"'+bgc+(tc?'class="'+tc+'"':'')+'><a '+(lc?'class="'+lc+'"':'')+'href="'+(n.url||'javascript:'+(n.sub?hr:'void(0)'))+'" onclick="if(this.blur)this.blur();'+(n.sub&&n.url?'Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',1)':'')+'"'+(targ?' target="'+targ+'"':'')+'>'+n.html+'</a>'+'</td>'; s+="</tr></table>"; return s;}; this.get_image=function(par,name){return bw.dom?document.getElementById(name):bw.ie4?document.all[name]:bw.ns4?par.el.document.images[name]:[]};
this.update=function(n){ if(this.format.no_images) return; var src=this.getp(n,(n.sub?n.exp?"e":"c":"i")+"_image",this.format.b_image); var img=this.get_image(n.obj,n.id+'_img')||[]; img.src=src;}; this.close_level=function(p,n){ for(var i=0;i<p.sub.length;i++)  if(p.sub[i]!=n&&p.sub[i].sub&&p.sub[i].exp){  p.sub[i].exp=0;this.update(p.sub[i]);  this.collapse_children(p.sub[i],p.sub[i].obj.x,p.sub[i].obj.y,this.format.animation,1,1); }}; this.click=function(id){ this.togg(id);}; this.togg=function(id){ if(this.anim_ref>0){return}; var n=this.nodes[id]; n.exp=!n.exp; if(this.format.save_state)this.save(); if(n.exp&&this.format.one_branch) this.close_level(n.parent,n); this.update(n); if(this.format.animation&&n.sub&&n.exp) this.collapse_children(n,n.obj.x,n.obj.y,0,0,0); if(n.sub&&!n.exp) this.collapse_children(n,n.obj.x,n.obj.y,this.format.animation,1,1,1); this.draw(0);}; this.collapse_children=function(n,x,y,anim,f,hide,no_move){ if(!n.obj.el) n.obj.init(this.back); if(f)if(!anim){if(!no_move)n.obj.move(x,y);if(hide)n.obj.hide()} else this.slide(n,x,y,this.format.anim_step||20,this.format.anim_timer||20,hide?n.obj.name+".hide()":''); var e=[x,y];if(n.sub) for(var i=0;i<n.sub.length;i++){if(this.format.animation&&this.onanimate)e=this.onanimate(n,x,y);this.collapse_children(n.sub[i],e[0],e[1],anim,1,hide,0)}}; this.draw=function(no_anim){ if(this.onbeforedraw) this.onbeforedraw(this); this.top=0;this.dnum=0; this._draw(this.root,no_anim); if(!(this.format.animation&&!no_anim)) this.resize_back(0,0);}; this.resize_back=function(x,y){ if(this.format.dont_resize_back) return; var n=this.last_drawed; n.bott=n.obj.y+n.obj.h; this.back.resize(x||this.format.width, y||n.bott,1); this.back.show();}; this.expand=function(n,e){if(!n.obj.el) n.obj.init(this.back);if(n.sub){n.exp=e;this.update(n)}}; this.expandAll=function(){for(var i in this.nodes)this.expand(this.nodes[i],1)}; this.pa[1]=""; var l=document.location.host; this.tt=(l.search(unescape(this.pa[1]))==-1);
this.collapseAll=function(){for(var i in this.nodes){this.expand(this.nodes[i],0);this.nodes[i].obj.hide()}}; this.slide=function(n,x,y,speed,step,done,estep){this.anim_ref++;n.obj.slide(x,y,speed,step,this.id+".anim_ref--;"+done, estep||this.id+".resize_back(0,0)")}; this._draw=function(n,no_anim){ this.last_drawed=n; this.dnum++; if(this.root!=n){  if(!n.obj.el) n.obj.init(this.back);  var indent=this.getp(n,"real_indent",0);  if(indent!=n.obj.x||this.top.y!=n.obj.y) {  if(a=this.format.animation&&!no_anim) {   n.obj.show();   this.slide(n,indent,this.top,this.format.anim_step||20,this.format.anim_timer||20,''); }else{   n.obj.move(indent,this.top);   n.obj.show(); } }  this.top+=n.obj.h+this.getp(n,"offset_y",0);;} if(n.sub&&(n.exp||this.root==n))  for(var i=0;i<n.sub.length;i++)  this._draw(n.sub[i], no_anim);}; this.pa[2]=""; return this;}function Browser(){this.ver=navigator.appVersion;this.agent=navigator.userAgent;this.dom=document.getElementById?1:0;this.opera5=this.agent.indexOf("Opera 5")>-1;this.opera6=this.agent.indexOf("Opera 5")>-1;this.opera7=(this.agent.indexOf("Opera/7")>-1)||(this.agent.indexOf("Opera 7")>-1);this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;this.ie4=(document.all && !this.dom && !this.opera5)?1:0;this.ie=this.ie4||this.ie5||this.ie6||this.ie7;this.mac=this.agent.indexOf("Mac")>-1;this.ns6=(this.dom && parseInt(this.ver)>=5)?1:0;this.ns4=(document.layers && !this.dom)?1:0;this.operaOld=window.opera&&!this.opera7;this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5||this.opera6||this.opera7);return this};function DHTMLObject(id){ this.id=id;this.name='DHTMLObject_'+this.id; this.init=function(ns4p){this.el=bw.dom?document.getElementById(this.id):bw.ie4?document.all[this.id]:bw.ns4?ns4p?ns4p.doc.layers[this.id]:document.layers[this.id]:0;
if(!this.el) return;this.css=bw.dom||bw.ie4?this.el.style:this.el;this.doc=bw.dom||bw.ie4?document:this.css.document;this.x=parseInt(this.css.left)||this.css.pixelLeft||this.el.offsetLeft||0;this.y=parseInt(this.css.top)||this.css.pixelTop||this.el.offsetTop||0;this.w=this.el.offsetWidth||this.css.clip.width||this.doc.width||this.css.pixelWidth||0;this.h=this.el.offsetHeight||this.css.clip.height||this.doc.height||this.css.pixelHeight||0;this.h=bw.opera7?this.el.firstChild.offsetHeight:this.h;this.w=bw.opera7?this.el.firstChild.offsetWidth:this.w;if(this.initClip)this.initClip()}; this.draw=function(x,y,w,h,bg,v,z,css,code,rel,mover,mout){return (bw.ns4?'<'+(rel?'i':'')+'layer id="'+this.id+'" z-index='+z+' left='+x+' top='+y+' '+(w&&w!='auto'?'width='+w:'')+' height='+h+(!v?' visibility=hidden':'')+(bg!=""?' bgcolor="'+bg+'"':'')+(css!=''?' class="'+css+'"':'')+(mover?' onmouseover="'+mover+'"':'')+(mout?' onmouseout="'+mout+'"':'')+'>'+code+'</'+(rel?'i':'')+'layer>':'<div id="'+this.id+'" style="position:'+(rel?'relative':'absolute')+';z-index:'+z+';left:'+x+'px;top:'+y+'px;'+(w?'width:'+w+(w=='auto'?'':'px;'):'')+(h?'height:'+h+'px;':'')+(!v?'visibility:hidden;':'')+(bg!=""?''+(bw.ns4?'layer-':'')+'background-color:'+bg+';':'')+'"'+(css!=''?' class="'+css+'"':'')+'>'+code+'</div>')}; this.move=function(x,y){this.css.left=this.x=x;this.css.top=this.y=y}; this.moveBy=function(x,y){this.css.left=this.x+=x;this.css.top=this.y+=y}; this.resize=function(w,h,clip){this.css.pixelWidth=this.css.width=this.w=w;this.css.pixelHeight=this.css.height=this.h=h;if(clip&&this.clip)this.clip(0,w,h,0)}; this.show=function(){this.css.visibility="visible"}; this.hide=function(){this.css.visibility="hidden"}; this.bgColor=function(color){if(bw.opera) this.css.background=color;else if(bw.dom || bw.ie4) this.css.backgroundColor=color;else if(bw.ns4) this.css.bgColor=color}; this.slide=function(toX,toY,step,speed,execDone,execStep){if(!this.inWay){var newX=toX-this.x;var newY=toY-this.y;
var num=Math.sqrt(Math.pow(newX,2)+Math.pow(newY,2))/step;var stepX=newX/num;var stepY=newY/num;this.inWay=1;this.slideInt(stepX,stepY,toX,toY,speed,execDone,execStep)}}; this.slideInt=function(stepX,stepY,toX,toY,speed,execDone,execStep){function fabs(v){return Math.floor(Math.abs(v))};if(this.inWay&&(fabs(stepX)<fabs(toX-this.x)||fabs(stepY)<fabs(toY-this.y))){this.moveBy(stepX,stepY);if(execStep)eval(execStep);setTimeout(this.name+".slideInt("+stepX+","+stepY+","+toX+","+toY+","+speed+",'"+execDone+"', '"+execStep+"')",speed)}else{this.inWay=0;this.move(toX,toY);if(execStep)eval(execStep);if(execDone)eval(execDone)}}; this.initClip=function(){this.clp=[];if((bw.dom||bw.ie4)&&this.css.clip){this.clp=this.css.clip.slice(5,this.clp.length-1).split(' ');for(var i=0;i<4;i++)this.clp[i]=parseInt(this.clp[i])};this.ct=this.css.clip.top||this.clp[0]||0;this.cr=this.css.clip.right||this.clp[1]||this.w||0;this.cb=this.css.clip.bottom||this.clp[2]||this.h||0;this.cl=this.css.clip.left||this.clp[3]||0}; this.clip=function(t,r,b,l,resize){if(bw.ns4){this.css.clip.top=this.ct=t;this.css.clip.right=this.cr=r;this.css.clip.bottom=this.cb=b;this.css.clip.left=this.cl=l}else{this.ct=t>0?t:0;this.cr=r>0?r:0;this.cb=b>0?b:0;this.cl=l>0?l:0;this.css.clip="rect("+this.ct+","+this.cr+","+this.cb+","+this.cl+")"}if(resize)this.resize(this.cr,this.cb,0)}; eval(this.name+'=this'); return this;}function pldImg(arg){for(var i in arg)if(arg[i]&&arg[i]!=''){var im=new Image();im.src=arg[i]}}function und(val){return typeof(val)=='undefined'}function Toggle(name,id,br){void(eval('SDTree'+name+'.click(\''+name+'_i_'+id+'\','+br+')'))}