function arrayCopy(b){var a=new Array(b.length);for(i in b){if(typeof(b[i])=="array"){a[i]=arrayCopy(b[i])}else{a[i]=b[i]}}return a}function TreeMenu(d,c,e,a,f,b){this.iconpath=d;this.myname=c;this.linkTarget=e;this.defaultClass=a;this.usePersistence=f;this.noTopLevelImages=b;this.n=new Array();this.output="";this.nodeRefs=new Array();this.branches=new Array();this.branchStatus=new Array();this.layerRelations=new Array();this.childParents=new Array();this.cookieStatuses=new Array();this.preloadImages()}TreeMenu.prototype.addItem=function(a){newIndex=this.n.length;this.n[newIndex]=a;return this.n[newIndex]};TreeMenu.prototype.preloadImages=function(){var d=new Image;d.src=this.iconpath+"/plustop.gif";var a=new Image;a.src=this.iconpath+"/plusbottom.gif";var e=new Image;e.src=this.iconpath+"/plus.gif";var g=new Image;g.src=this.iconpath+"/minustop.gif";var f=new Image;f.src=this.iconpath+"/minusbottom.gif";var c=new Image;c.src=this.iconpath+"/minus.gif";var b=new Image;b.src=this.iconpath+"/branchtop.gif";var l=new Image;l.src=this.iconpath+"/branchbottom.gif";var h=new Image;h.src=this.iconpath+"/branch.gif";var k=new Image;k.src=this.iconpath+"/linebottom.gif";var m=new Image;m.src=this.iconpath+"/line.gif"};TreeMenu.prototype.drawMenu=function(){var g="";var a="";var c="";var q="";var r=arguments[0]?arguments[0]:this.n;var b=arguments[1]?arguments[1]:[];var x=arguments[2]?arguments[2]:"";var t=arguments[3]?arguments[3]:false;var w=arguments[4]?arguments[4]:"inline";var q=arguments[5]?arguments[5]:null;var l=b.length;for(var v=0;v<r.length;v++){b[l]=v+1;c=this.myname+"_node_"+this.implode("_",b);this.nodeRefs[c]=r[v];this.childParents[c]=q;if(v==0&&q==null){a=r.length>1?"top":"single"}else{if(v==(r.length-1)){a="bottom"}else{a=""}}if(!this.doesMenu()||(q==null&&(r.length==1||this.noTopLevelImages))){t=true}else{if(r[v].expanded){t=true}else{t=false}}w=this.checkParentVisibility(c)?w:"none";if(r[v].n.length>0){this.branchStatus[c]=t;this.branches[this.branches.length]=c}if(!this.layerRelations[q]){this.layerRelations[q]=new Array()}this.layerRelations[q][this.layerRelations[q].length]=c;var o=r[v].n.length&&this.doesMenu()&&r[v].isDynamic?(t?"minus":"plus"):"branch";var e=t&&r[v].expandedIcon?r[v].expandedIcon:r[v].icon;var s=r[v].icon?this.stringFormat('<img src="{0}/{1}" class=menuimg align="top" id="icon_{2}">',this.iconpath,e,c):"";var m="";for(j in r[v].events){m+=this.stringFormat('{0}="{1}" ',j,r[v].events[j])}var d=this.doesMenu()?this.stringFormat('<div id="{0}" style="display: {1}" class="{2}">',c,w,(r[v].cssClass?r[v].cssClass:this.defaultClass)):this.stringFormat('<div class="{0}">',r[v].cssClass?r[v].cssClass:this.defaultClass);var k=this.doesMenu()&&r[v].n.length&&r[v].isDynamic?this.stringFormat('onmousedown="{0}.toggleBranch(\'{1}\', true)" style="cursor: pointer; cursor: hand"',this.myname,c):"";var u=this.stringFormat('<img class=menuimg src="{0}/{1}{2}.gif" align="top" border="0" name="img_{3}" {4}>',this.iconpath,o,a,c,k);var n=r[v].linkTarget?r[v].linkTarget:this.linkTarget;var f=r[v].link?this.stringFormat('<span class=draggable><a href="{0}" target="{1}">',r[v].link,n):"";var p=r[v].link?"</a></span>":"";this.output+=this.stringFormat("{0}<nobr>{1}{2}{3}{4}<span {5}>{6}</span>{7}</nobr><br></div>",d,x,q==null&&(r.length==1||this.noTopLevelImages)?"":u,s,f,m,r[v].title,p);if(r[v].n.length){if(q==null&&(r.length==1||this.noTopLevelImages)){var h=""}else{if(v<(r.length-1)){var h=x+this.stringFormat('<img class=menuimg src="{0}/line.gif" align="top">',this.iconpath)}else{var h=x+this.stringFormat('<img class=menuimg src="{0}/linebottom.gif" align="top">',this.iconpath)}}this.drawMenu(r[v].n,arrayCopy(b),h,r[v].expanded,t?"inline":"none",c)}}};TreeMenu.prototype.writeOutput=function(){document.write(this.output)};TreeMenu.prototype.toggleBranch=function(layerID,updateStatus){var currentDisplay=this.getLayer(layerID).style.display;var newDisplay=(this.branchStatus[layerID]&&currentDisplay=="inline")?"none":"inline";var fireEvents=arguments[2]!=null?arguments[2]:true;for(var i=0;i<this.layerRelations[layerID].length;i++){if(this.branchStatus[this.layerRelations[layerID][i]]){this.toggleBranch(this.layerRelations[layerID][i],false)}this.getLayer(this.layerRelations[layerID][i]).style.display=newDisplay}if(updateStatus){this.branchStatus[layerID]=!this.branchStatus[layerID];if(this.doesPersistence()&&!arguments[2]&&this.usePersistence){this.setExpandedStatusForCookie(layerID,this.branchStatus[layerID])}if(fireEvents){nodeObject=this.nodeRefs[layerID];if(nodeObject.ontoggle!=null){eval(nodeObject.ontoggle)}if(newDisplay=="none"&&nodeObject.oncollapse!=null){eval(nodeObject.oncollapse)}else{if(newDisplay=="inline"&&nodeObject.onexpand!=null){eval(nodeObject.onexpand)}}}this.swapImage(layerID)}this.swapIcon(layerID)};TreeMenu.prototype.swapImage=function(a){var c=document.images["img_"+a].src;var b=/^(.*)(plus|minus)(bottom|top|single)?.gif$/;if(matches=c.match(b)){document.images["img_"+a].src=this.stringFormat("{0}{1}{2}{3}",matches[1],matches[2]=="plus"?"minus":"plus",matches[3]?matches[3]:"",".gif")}};TreeMenu.prototype.swapIcon=function(a){if(document.images["icon_"+a]){var c=document.images["icon_"+a].src;if(this.nodeRefs[a].icon&&this.nodeRefs[a].expandedIcon){var b=(c.indexOf(this.nodeRefs[a].expandedIcon)==-1?this.nodeRefs[a].expandedIcon:this.nodeRefs[a].icon);document.images["icon_"+a].src=this.iconpath+"/"+b}}};TreeMenu.prototype.doesMenu=function(){return(is_ie4up||is_nav6up||is_gecko||is_opera7)};TreeMenu.prototype.doesPersistence=function(){return(is_ie4up||is_gecko||is_nav6up||is_opera7)};TreeMenu.prototype.getLayer=function(a){if(is_ie4){return document.all(a)}else{if(document.getElementById(a)){return document.getElementById(a)}else{if(document.all&&document.all(a)){return document.all(a)}}}};TreeMenu.prototype.setExpandedStatusForCookie=function(a,b){this.cookieStatuses[a]=b;this.saveCookie()};TreeMenu.prototype.getExpandedStatusFromCookie=function(a){if(this.cookieStatuses[a]){return this.cookieStatuses[a]}return false};TreeMenu.prototype.saveCookie=function(){var b=new Array();for(var a in this.cookieStatuses){if(this.cookieStatuses[a]==true){b[b.length]=a}}document.cookie="TreeMenuBranchStatus="+b.join(":")};TreeMenu.prototype.loadCookie=function(){var d=document.cookie.split("; ");for(var c=0;c<d.length;c++){var a=d[c].split("=");if("TreeMenuBranchStatus"==a[0]&&a[1]){var e=a[1].split(":");for(var b=0;b<e.length;b++){this.cookieStatuses[e[b]]=true}}}};TreeMenu.prototype.resetBranches=function(){if(!this.doesPersistence()){return false}this.loadCookie();for(var b=0;b<this.branches.length;b++){var a=this.getExpandedStatusFromCookie(this.branches[b]);if(a==true&&this.branchStatus[this.branches[b]]!=true){if(this.checkParentVisibility(this.branches[b])){this.toggleBranch(this.branches[b],true,false)}else{this.branchStatus[this.branches[b]]=true;this.swapImage(this.branches[b])}}}};TreeMenu.prototype.checkParentVisibility=function(a){if(this.in_array(this.childParents[a],this.branches)&&this.branchStatus[this.childParents[a]]&&this.checkParentVisibility(this.childParents[a])){return true}else{if(this.childParents[a]==null){return true}}return false};TreeMenu.prototype.stringFormat=function(c){var a=0;for(var b=1;b<arguments.length;b++){while((a=c.indexOf("{"+(b-1)+"}",a))!=-1){c=c.substring(0,a)+arguments[b]+c.substr(a+3)}}return c};TreeMenu.prototype.implode=function(d,b){var a="";for(var c=0;c<b.length;c++){if(c==0){a+=b[c]}else{a+=d+b[c]}}return a};TreeMenu.prototype.in_array=function(c,a){for(var b=0;b<a.length;b++){if(a[b]==c){return true}}return false};function TreeNode(h,e,f,d,c,b,g,a){this.title=h;this.icon=e;this.expandedIcon=a;this.link=f;this.expanded=d;this.isDynamic=c;this.cssClass=b;this.linkTarget=g;this.n=new Array();this.events=new Array();this.handlers=null;this.oncollapse=null;this.onexpand=null;this.ontoggle=null}TreeNode.prototype.addItem=function(a){newIndex=this.n.length;this.n[newIndex]=a;return this.n[newIndex]};TreeNode.prototype.setEvent=function(a,b){switch(a.toLowerCase()){case"onexpand":this.onexpand=b;break;case"oncollapse":this.oncollapse=b;break;case"ontoggle":this.ontoggle=b;break;default:this.events[a]=b}};var agt=navigator.userAgent.toLowerCase();var is_major=parseInt(navigator.appVersion);var is_minor=parseFloat(navigator.appVersion);var is_nav=((agt.indexOf("mozilla")!=-1)&&(agt.indexOf("spoofer")==-1)&&(agt.indexOf("compatible")==-1)&&(agt.indexOf("opera")==-1)&&(agt.indexOf("webtv")==-1)&&(agt.indexOf("hotjava")==-1));var is_nav6up=(is_nav&&(is_major>=5));var is_gecko=(agt.indexOf("gecko")!=-1);var is_ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));var is_ie4=(is_ie&&(is_major==4)&&(agt.indexOf("msie 4")!=-1));var is_ie4up=(is_ie&&(is_major>=4));var is_opera=(agt.indexOf("opera")!=-1);var is_opera7=(is_opera&&is_major>=7)||agt.indexOf("opera 7")!=-1;if(agt.indexOf("konqueror")!=-1){var is_nav=false;var is_nav6up=false;var is_gecko=false;var is_ie=true;var is_ie4=true;var is_ie4up=true};
