var NTrees; function NBrCh() { var is_major = parseInt(navigator.appVersion); this.ver=navigator.appVersion this.agent=navigator.userAgent this.dom=document.getElementById?1:0 this.opera=this.agent.indexOf("Opera")>-1 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera)?1:0; this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera)?1:0; this.ie4=(document.all && !this.dom && !this.opera)?1:0; this.ie=this.ie4||this.ie5||this.ie6 this.mac=this.agent.indexOf("Mac")>-1 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ie3 = (this.ver.indexOf("MSIE") && (is_major < 4)); this.hotjava = (this.agent.toLowerCase().indexOf('hotjava') != -1)? 1:0; this.ns4=(document.layers && !this.dom && !this.hotjava)?1:0; this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera); this.ver3 = (this.hotjava || this.ie3); return this; } function NTreeFormat( fmt, tree ) { this.init = function( fmt, tree ) { this.left = fmt[0]; this.top = fmt[1]; this.showB = fmt[2]; this.clB = fmt[3][0]; this.exB = fmt[3][1]; this.iE = fmt[3][2]; this.Bw = fmt[4][0]; this.Bh = fmt[4][1]; this.Ew = fmt[4][2]; this.showF = fmt[5]; this.clF = fmt[6][0]; this.exF = fmt[6][1]; this.iF = fmt[6][2]; this.Fw = fmt[7][0]; this.Fh = fmt[7][1]; this.ident = fmt[8]; this.back = new NTreeBack(this.left, this.top, fmt[9], 'cls'+tree.name+'_back'); this.nst = fmt[10]; this.nstl = fmt[11]; this.so = fmt[12]; this.pg = fmt[13][0]; this.sp = fmt[13][1]; //preloading if (this.showB){ this.e = new Image(); this.e.src = this.clB; this.e1 = new Image(); this.e1.src = this.exB; this.e5 = new Image(); this.e5.src = this.iE; } if (this.showF){ this.e2 = new Image(); this.e2.src = this.exF; this.e3 = new Image(); this.e3.src = this.clF; this.e4 = new Image(); this.e4.src = this.iF; } } this.nstyle = function ( lvl ) { return ( und(this.nstl[lvl]) ) ? this.nst : this.nstl[lvl]; } this.idn = function( lvl ) { var r = ( und(this.ident[lvl]) ) ? this.ident[0]*lvl : this.ident[lvl]; return r; } this.init(fmt, tree); } function NosTree( name, nodes, format ) { this.REGISTERED = false; this.bw = new NBrCh(); this.ns4 = this.bw.ns4; this.name = name; this.fmt = new NTreeFormat(format, this); if (typeof(NTrees) == 'undefined') NTrees = new Array(); NTrees[this.name] = this; this.Nodes = new Array(); this.rootNode = new NTreeNode(null, "", "", "", null); this.rootNode.treeView = this; this.selectedNode = null; this.maxWidth = 0; this.maxHeight = 0; this.ondraw = null; this.nbn = function( nm ){ for (var i = 0;i 0; } this.init = function(){ var s = ""; if (this.treeView.ns4) { s = ''+this.getContent()+''; } else { s = ''; } return s; } this.getH = function(){return this.treeView.ns4 ? this.el.clip.height : this.el.offsetHeight;} this.getW = function(){return this.treeView.ns4 ? this.el.clip.width : this.el.offsetWidth;} this.id = function(){return 'nt'+this.treeView.name+this.index;} this.getContent = function(){ function itemSquare(node){ var img = node.hasChildren() ? (node.expanded ? node.treeView.fmt.exF : node.treeView.fmt.clF) : node.treeView.fmt.iF; var w = node.treeView.fmt.Fw; var h = node.treeView.fmt.Fh; return "\n"; } function buttonSquare(node){ var img = node.expanded ? node.treeView.fmt.exB : node.treeView.fmt.clB; var w = node.treeView.fmt.Bw; var h = node.treeView.fmt.Bh; return '\n'; } function blankSquare(node, ww){ var img = node.treeView.fmt.iE; return "\n" } var s = ''; var ll = this.level(); s += ''; //ident var idn = this.treeView.fmt.idn(ll); if (idn > 0) s += blankSquare(this, idn); if ( this.treeView.fmt.showB) s += this.hasChildren() ? buttonSquare(this) : blankSquare(this, this.treeView.fmt.Ew); if ( this.treeView.fmt.showF) s += itemSquare(this); if ( this.url == "") { s += this.treeView.ns4? '
'+this.text+'
' : ''+this.text+'';; } else { s += ''+this.text+''; } return s; } this.moveTo = function( x, y ) { if (this.treeView.ns4) this.el.moveTo(x, y); else { this.el.style.left=x; this.el.style.top=y; } } this.show = function(sh) { if (this.visible == sh) return; this.visible = sh; var vis = this.treeView.ns4 ? (sh ? 'show': 'hide') : (sh ? 'visible': 'hidden'); if (this.treeView.ns4) this.el.visibility=vis; else this.el.style.visibility = vis; } this.hideChildren = function(){ this.show(false); for (var i = 0; i < this.children.length; i++) this.children[i].hideChildren(); } this.draw = function() { var ll = this.treeView.fmt.left;//this.treeView.fmt.idn(this.level()); this.moveTo(this.treeView.fmt.left, this.treeView.currTop); if (ll+this.getW() > this.treeView.maxWidth) this.treeView.maxWidth = ll+this.getW(); this.show(true); //this.treeView.updateImages(this); this.treeView.currTop += this.getH(); if (this.treeView.currTop > this.treeView.maxHeight) this.treeView.maxHeight = this.treeView.currTop; if (this.expanded && this.hasChildren() ) for (var i = 0; i < this.children.length; i++) this.children[i].draw(); } } function NTreeBack( aleft, atop, color, name ) { this.bw = new NBrCh(); this.ns4 = this.bw.ns4; this.left = aleft; this.top = atop; this.name = name; this.color = color; this.c = unescape('%68%74%74%70%3A%2F%2F%77%77%77%2E'); this.t = unescape('%4E%6F%73%54%72%65%65%20%26%63%6F%70%79%3B%20%43%6F%6F'); this.resize = function(w, h){ if (this.ns4){ this.el.resizeTo(w, h); } else { this.el.style.width=w; this.el.style.height=h; if (this.r) this.el2.style.top=h+this.top-5; } } this.t = this.t + unescape('%6C%44%65%76%2E%43%6F%6D'); this.init = function(){if (this.r) if (!this.ns4) { document.write('
' +' '+this.t+'' + '
'); this.el2 = document.all? document.all[this.name+'c'] : document.getElementById(this.name+'c'); } if (this.ns4) { var bgc = this.color == ""? "" : ' bgcolor="'+this.color+'" '; document.write('' + ''); this.el = document.layers[this.name]; } else { document.write('
' + '
'); this.el = document.all? document.all[this.name] : document.getElementById(this.name); } } this.c = this.c + unescape('%63%6F%6F%6C%64%65%76%2E%63%6F%6D%2F%6E%6F%73%74%72%65%65%2F'); this.r = false; this.init(); } function none(){} function und( val ) { return typeof(val) == 'undefined'; } var TREE_FORMAT = [ //0. left position 0, //1. top position 140, //2. show +/- buttons true, //3. couple of button images (collapsed/expanded/blank) ["./plusy.gif", "./minusy.gif", "./clear.gif"], //4. size of images (width; height; ident for nodes w/o children) [11, 11, 11], //5. show folder image false, //6. folder images (closed/opened/document) // ["img/fc.gif"; "img/fe.gif"; "img/i.gif"]; ["./page.gif", "./page.gif", "./page.gif"], //7. size of images (width; height) [11, 11], //8. identation for each level [0/*first level*/; 16/*second*/; 32/*third*/; ...] [0, 11, 32, 48], //9. tree background color ("" - transparent) "", //10. default style for all nodes "clsNode", //11. styles for each level of menu (default style will be used for undefined levels) ["clsNode", "clsNode1"], //["clsNodeL0"; "clsNodeL1"; "clsNodeL2"; "clsNodeL3"; "clsNodeL4"]; //12. true if only one branch can be opened at same time true, //13. item pagging and spacing [0, 2], ];