home *** CD-ROM | disk | FTP | other *** search
- // DO NOT CHANGE this file as it will cause the 1st JAVA Navigator to malfunction
- //===============================================================================
- function getBrowser()
- {
- this.IE4 = (navigator.userAgent.indexOf('MSIE 4') != -1) ? true : false
- this.IE5 = (navigator.userAgent.indexOf('MSIE 5') != -1) ? true : false
- this.IE = (this.IE4||this.IE5)
-
- this.vVersion = parseInt( navigator.appVersion )
- this.NS = ((navigator.appName=='Netscape') && (this.vVersion>=4))
- this.NS4 = ((navigator.appName=='Netscape') && (this.vVersion==4))
- this.NS5 = ((navigator.appName=='Netscape') && (this.vVersion==5))
- this.NO = ((navigator.appName=='Netscape') && (this.vVersion<4))
- }
- Browser = new getBrowser()
-
- //-------------------------------------------------------------------
- function mouseOver(iSel)
- {
-
- iSelOld=this.selectedNode
- if (this.items[iSelOld]!=null)
- {
- if (this.items[iSelOld].hasImage) this.items[iSelOld].imgObject.document.images[this.name+'IPointer'+iSelOld].src = this.image.PointerN.src
- this.items[iSelOld].treeview.setBGColor(this.color.BackGround)
- this.items[iSelOld].treeview.write(this.items[iSelOld].ForeGround)
- this.items[iSelOld].selected = false
- }
-
- if (this.items[iSel]!=null)
- {
- this.selectedNode = iSel
- this.href = this.items[iSel].href
- if (this.items[iSel].hasImage) this.items[iSel].imgObject.document.images[this.name+'IPointer'+iSel].src = this.image.PointerS.src
- this.items[iSel].treeview.setBGColor(this.color.moBackGround)
- this.items[iSel].treeview.write(this.items[iSel].moForeGround)
- this.items[iSel].selected = true
- this.onSelect()
- }
-
- }
-
- //-------------------------------------------------------------------
- function mouseExit(iSel)
- {
- if (!this.items[iSel].selected) this.items[iSel].treeview.setBGColor(this.color.BackGround)
- }
-
- //-------------------------------------------------------------------
- function mouseClick(iSel)
- {
- if (this.href==null) return
- if (top.frames.length == 0) location.href=this.href
- else top.frames[1].location.href = this.href
- }
-
- //-------------------------------------------------------------------
- function executeLink()
- {
- if (top.frames.length == 0)
- location.href=this.href
- else
- top.frames[1].location.href = this.href
-
- }
- TreeNode.count = 0
-
- //-------------------------------------------------------------------
- function setBGColor(cColor)
- {
- if (Browser.NS) this.document.bgColor = cColor
- else if (Browser.IE) this.css.backgroundColor = cColor
- }
-
- //-------------------------------------------------------------------
- function TreeView(obj,level,frame)
- {
- if (!Browser.NS5 && !TreeView.done && !frame) initTreeView()
- this.frame = frame || self
- if (Browser.IE)
- {
- this.element = this.event = this.frame.document.all[obj]
- this.css = this.frame.document.all[obj].style
- this.left = this.element.offsetLeft
- this.top = this.element.offsetTop
- this.width = this.element.offsetWidth
- this.height = this.element.offsetHeight
- this.document = document
- }
- else if (Browser.NS)
- {
- if (Browser.NS4)
- {
- if (!frame)
- {
- if (!level) var level = TreeView.levelArray[obj]
- if (!TreeViewTest(obj,level)) return
- this.css = (level)? eval("document."+level+".document."+obj) : document.layers[obj]
- }
- else this.css = (level)? eval("frame.document."+level+".document."+obj) : frame.document.layers[obj]
- this.element = this.event = this.css
- this.document = this.css.document
- }
- else if (Browser.NS5)
- {
- this.element = document.getElementById(obj)
- this.css = this.element.style
- this.document = document
- }
- this.left = this.css.left
- this.top = this.css.top
- this.width = this.css.clip.width
- this.height = this.css.clip.height
- }
-
- this.id = obj
- this.level = level
- this.obj = obj + "TreeView"
- eval(this.obj + "=this")
- }
-
- //-------------------------------------------------------------------
- function showAtTreeView(xPos,yPos)
- {
- this.left = xPos
- this.top = yPos
- if (Browser.NS)
- {
- this.css.left = this.left
- this.css.top = this.top
- }
- else
- {
- this.css.pixelLeft = this.left
- this.css.pixelTop = this.top
- }
- }
-
- //-------------------------------------------------------------------
- function showTreeView()
- {
- this.css.visibility = (Browser.NS4)? "show" : "visible"
- }
-
- //-------------------------------------------------------------------
- function hideTreeView()
- {
- this.css.visibility = (Browser.NS4)? "hide" : "hidden"
- }
-
- //-------------------------------------------------------------------
- TreeView.prototype.showAt = showAtTreeView
- TreeView.prototype.show = showTreeView
- TreeView.prototype.hide = hideTreeView
-
- TreeViewTest = new Function('return true')
-
- //-------------------------------------------------------------------
- function initTreeView(vLevel) {
-
- if (!TreeView.done) TreeView.done = true
- if (Browser.IE)
- {
- for (var i=0; i<document.all.tags("DIV").length; i++)
- {
- var temp = document.all.tags("DIV")[i].id
- var idx = temp.indexOf("Div")
- if (idx > 0)
- {
- eval(temp.substr(0,idx)+' = new TreeView("'+temp+'")')
- }
- }
- }
- else if (Browser.NS)
- {
- if (vLevel) ref = eval('document.'+vLevel+'.document')
- else {vLevel = ''; ref = document;}
- for (var i=0; i<ref.layers.length; i++)
- {
- var temp = ref.layers[i].name
- TreeView.levelArray[temp] = vLevel
- var idx = temp.indexOf("Div")
- if (idx > 0)
- {
- eval(temp.substr(0,idx)+' = new TreeView("'+temp+'","'+vLevel+'")')
- }
- if (ref.layers[i].document.layers.length > 0)
- {
- TreeView.refArray[TreeView.refArray.length] = (vLevel=='')? ref.layers[i].name : vLevel+'.document.'+ref.layers[i].name
- }
- }
- if (TreeView.refArray.i < TreeView.refArray.length)
- {
- initTreeView(TreeView.refArray[TreeView.refArray.i++])
- }
- }
- return true
- }
-
- //-------------------------------------------------------------------
- TreeView.levelArray = new Array()
- TreeView.refArray = new Array()
- TreeView.refArray.i = 0
- TreeView.done = false
-
- //-------------------------------------------------------------------
- function positionTreeView(top,right,bottom,left)
- {
- if (Browser.NS)
- {
- if (top!=null) this.css.clip.top = top
- if (right!=null) this.css.clip.right = right
- if (bottom!=null) this.css.clip.bottom = bottom
- if (left!=null) this.css.clip.left = left
- } else
- {
- if ((top!=null) && (right!=null) && (bottom!=null) && (left!=null) )
- {
- var coord = this.css.clip.split("rect(")[1].split(")")[0].split("px")
- top = Number(coord[0])
- right = Number(coord[1])
- bottom = Number(coord[2])
- left = Number(coord[3])
- this.css.clip = "rect("+top+"px "+right+"px "+bottom+"px "+left+"px)"
- }
- }
- }
-
-
- //-------------------------------------------------------------------
- function setTreeView(top,right,bottom,left)
- {
- if (Browser.IE)
- {
- if (arguments.length==4) this.position(top,right,bottom,left)
- }
- }
-
- //-------------------------------------------------------------------
- TreeView.prototype.set = setTreeView
- TreeView.prototype.position = positionTreeView
-
- //-------------------------------------------------------------------
- function wirteTreeView(sHTML)
- {
- if (Browser.IE)
- {
- this.event.innerHTML = sHTML
- }
- else if (Browser.NS)
- {
- this.document.open()
- this.document.write(sHTML)
- this.document.close()
- }
- }
-
- TreeView.prototype.write = wirteTreeView
-
- //-------------------------------------------------------------------
- function createCSS(obj,left,top,width,height,color,vis,z,other)
- {
-
- var sCSS = (left!=null && top!=null)? '#'+obj+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+obj+' {position:relative;'
- if (arguments.length>=4 && width!=null) sCSS += ' width:'+width+'px;'
- if (arguments.length>=5 && height!=null) {
- sCSS += ' height:'+height+'px;'
- if (arguments.length<9 || other.indexOf('clip')==-1) sCSS += ' clip:rect(0px '+width+'px '+height+'px 0px);'
- }
- if (arguments.length>=6 && color!=null) sCSS += (Browser.NS)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
- if (arguments.length>=7 && vis!=null) sCSS += ' visibility:'+vis+';'
- if (arguments.length>=8 && z!=null) sCSS += ' z-index:'+z+';'
- if (arguments.length==9 && other!=null) sCSS += ' '+other
- sCSS += '}'
- return sCSS
- }
-
- //-------------------------------------------------------------------
- function writeCSS(sCSS)
- {
- document.write('<STYLE TYPE="text/css">\n'+sCSS+'</STYLE>')
- }
-
- //-------------------------------------------------------------------
- function TreeNode(xPos, yPos, mnuWidth, mnuHeight)
- {
- this.name = "TreeNode"+(TreeNode.count++)
- this.left = xPos
- this.top = yPos
- this.width = mnuWidth
- if (arguments.length==4)
- {
- this.nodeHeight = mnuHeight
- this.nodeHeightSet = true
- this.height = -1
- }
- else {
- this.nodeHeight = null
- this.nodeHeightSet = false
- this.height = (Browser.NS)? -1 : 1000
- }
-
- this.visibility = 'inherit'
- this.nodeOpen = false
- this.Tree = null
-
- this.Font = 'Arial'
- this.FontSize = 10
- this.color = new Object()
- this.color.ForeGround = '#000000'
- this.color.BackGround = '#FFFFFF'
- this.color.moForeGround = '#FFFFFF'
- this.color.moBackGround = '#0000FF'
- this.color.Border = '#000000'
-
- this.image = new Object()
- this.items = new Array()
-
- this.selectedNode = null
- this.obj = this.name + "TreeNode"
- eval(this.obj + "=this")
-
- this.add = addTreeNode
- this.build = buildTreeNode
- this.activate = activateTreeNode
- this.deselect = deselectTreeNode
- this.onSelect = executeLink
- this.setPointers = imgPointers
-
- this.mouseOver = mouseOver
- this.mouseExit = mouseExit
- this.mouseClick = mouseClick
-
- }
-
- //-------------------------------------------------------------------
- function imgPointers(imgPointerN,imgPointerS,imgWidth,imgHeight)
- {
- this.image.width = imgWidth
- this.image.height = imgHeight
- this.image.PointerN = new Image()
- this.image.PointerN.src = imgPointerN
- this.image.PointerS = new Image()
- this.image.PointerS.src = imgPointerS
- }
-
- //-------------------------------------------------------------------
- function addTreeNode(value)
- {
- var i = this.items.length
- this.items[i] = new Array()
- this.items[i].selected = false
- this.items[i].href = value
- arguments[1]=' '+arguments[1]
- this.items[i].text = arguments[1]
- this.items[i].ForeGround = '<div class="'+this.name+'ForeGround">'+arguments[1]+'</div>'
- this.items[i].moForeGround = '<div class="'+this.name+'moForeGround">'+arguments[1]+'</div>'
- if (this.nodeHeight)
- {
- this.height += this.nodeHeight+1
- this.items[i].top = i*this.nodeHeight+i*1
- }
- else this.items[i].top = 0
- }
-
- //-------------------------------------------------------------------
- function buildTreeNode()
- {
- this.css = ''
- this.css += createCSS(this.name+'TreeNode',this.left,this.top,this.width,this.height,this.color.Border,(this.nodeHeightSet)?this.visibility:'hidden')
- for (var i=0;i<this.items.length;i++)
- {
- this.css += createCSS(this.name+'I'+i,0,this.items[i].top,this.width,this.nodeHeight,this.color.BackGround)
- if (this.items[i].hasImage) this.css += createCSS(this.name+'IPointer'+i,this.width-this.image.width,this.items[i].top)
- this.css += createCSS(this.name+'IC'+i,0,this.items[i].top,this.width,this.nodeHeight)
- }
- this.css += '.'+this.name+'ForeGround {font-family:"'+this.Font+'"; font-size:'+this.FontSize+'pt; color:'+this.color.ForeGround+'; background-color:transparent; margin-left:'+1+'px;}\n'+
- '.'+this.name+'moForeGround {font-family:"'+this.Font+'"; font-size:'+this.FontSize+'pt; color:'+this.color.moForeGround+'; background-color:transparent; margin-left:'+1+'px;}\n'
-
- this.div = '<div id="'+this.name+'TreeNode">'
- for (var i=0;i<this.items.length;i++)
- {
- this.div += '<div id="'+this.name+'I'+i+'">'+this.items[i].ForeGround+'</div>'
- if (this.items[i].hasImage) this.div += '<div id="'+this.name+'IPointer'+i+'"><img name="'+this.name+'IPointer'+i+'" src="'+this.image.PointerN.src+'" width='+this.image.width+' height='+this.image.height+'></div>'
- this.div += '<div id="'+this.name+'IC'+i+'"></div>'
- }
- this.div += '</div>'
- }
-
- //-------------------------------------------------------------------
- function activateTreeNode()
- {
- if (Browser.IE) this.height -= 1001
- this.treeview = new TreeView(this.name+'TreeNode')
- this.treeview.set()
-
- for (var i=0;i<this.items.length;i++)
- {
- this.items[i].treeview = new TreeView(this.name+'I'+i)
- this.items[i].treeview.setBGColor = setBGColor
- this.items[i].treeview2 = new TreeView(this.name+'IC'+i)
- if (Browser.NS) this.items[i].treeview2.event.captureEvents(Event.MOUSEDOWN)
- this.items[i].treeview2.event.onmouseover = new Function(this.obj+'.mouseOver('+i+'); return false;')
- this.items[i].treeview2.event.onmouseout = new Function(this.obj+'.mouseExit('+i+'); return false;')
- this.items[i].treeview2.event.onmousedown = new Function(this.obj+'.mouseClick('+i+'); return false;')
- if (!this.nodeHeightSet)
- {
- this.nodeHeight = (Browser.NS)? this.items[0].treeview.document.height : this.items[0].treeview.event.offsetHeight
- this.items[i].treeview.showAt(null,i*this.nodeHeight+1*i)
- this.items[i].treeview2.showAt(null,i*this.nodeHeight+1*i)
- if (Browser.NS) {
- this.items[i].treeview.set()
- this.items[i].treeview.position(0,this.width,this.nodeHeight,0)
- this.items[i].treeview2.set()
- this.items[i].treeview2.position(0,this.width,this.nodeHeight,0)
- }
- this.height += this.nodeHeight+1
- }
- if (this.items[i].hasImage)
- {
- this.items[i].imgObject = new TreeView(this.name+'IPointer'+i)
- }
- }
- if (!this.nodeHeightSet)
- {
- this.treeview.position(0,this.width,this.height,0)
- if (Browser.IE) this.treeview.css.height = this.height
- }
- this.treeview.css.visibility = this.visibility
- }
-
- //-------------------------------------------------------------------
- function deselectTreeNode(iSel)
- {
- if (this.items[iSel]==null) return
- if (this.items[iSel].selected)
- {
- this.items[iSel].selected = false
- if (this.items[iSel].hasImage) this.items[iSel].imgObject.document.images[this.name+'IPointer'+iSel].src = this.image.PointerN.src
- this.items[iSel].treeview.setBGColor(this.color.BackGround)
- this.items[iSel].treeview.write(this.items[iSel].ForeGround)
- }
- }
-
- //-------------------------------------------------------------------
- function Tree()
- {
-
- this.name = "Tree"+(Tree.count++)
- this.obj = this.name + "TreeObject"
- eval(this.obj + "=this")
- if (arguments.length==4)
- {
- this.isChild = false
- this.left = arguments[0]
- this.top = arguments[1]
- this.width = arguments[2]
- this.nodeHeight = arguments[3]
- this.subOnSelect = false
- this.topOffset = -1
- this.leftOffset = 0
- }
- else
- {
- this.isChild = true
- this.parent = arguments[0]
- var index = arguments[1]
- this.parent.node.items[index].hasImage = true
- this.parent.node.items[index].hasChild = true
- this.parent.node.items[index].child = this
- this.left = this.parent.width
- this.top = this.parent.node.items[index].top
- this.width = (arguments.length==3)? arguments[2] : this.parent.width
- this.nodeHeight = this.parent.nodeHeight
- this.childShown = null
- this.subOnSelect = this.parent.subOnSelect
- this.topOffset = this.parent.topOffset
- this.leftOffset = this.parent.leftOffset
- }
-
- this.visibility = 'hidden'
- this.zIndex = null
- this.nodeOpen = false
-
- this.node = new TreeNode(1,1,this.width-2,this.nodeHeight)
- this.node.visibility = 'inherit'
- this.node.Tree = this
-
- if (this.isChild)
- {
- this.node.image = this.parent.node.image
- this.node.color = this.parent.node.color
- this.node.Font = this.parent.node.Font
- this.node.FontSize = this.parent.node.FontSize
- }
-
- this.nodesChildren = ''
- this.nodeChildren = ''
-
- this.build = buildTree
- this.activate = activateTree
- this.showMenu = showTreeMenu
- this.hideMenu = hideTreeMenu
- this.show = showTree
- this.select = selectTree
- if (this.isChild) this.onSelect = this.parent.onSelect
- else this.onSelect = new Function()
- }
-
- //-------------------------------------------------------------------
- function buildTree(write)
- {
- for (var i=0;i<this.node.items.length;i++)
- {
- if (this.node.items[i].hasChild)
- {
- this.node.items[i].child.nodeOpen = this.nodeOpen
- this.node.items[i].child.build()
- }
- }
- this.node.nodeOpen = this.nodeOpen
- this.node.build()
- this.css = createCSS(this.name,this.left+this.topOffset ,this.top+this.leftOffset ,null,null,null,(this.isChild)?'hidden':this.visibility,this.zIndex)+
- createCSS(this.name+'P',0,0,this.width,this.node.height+2,this.node.color.Border)+
- this.node.css+
- this.nodesChildren
-
- this.div = '<div id="'+this.name+'">'+
- '<div id="'+this.name+'P">'+this.node.div+'</div>'+this.nodeChildren+'</div>\n'
-
- if (this.isChild)
- {
- this.parent.nodesChildren += this.css
- this.parent.nodeChildren += this.div
- }
- }
-
- //-------------------------------------------------------------------
- function activateTree()
- {
- this.node.activate()
- this.treeview = new TreeView(this.name)
- this.height = this.node.height+2
- if (Browser.NS && !this.isChild)
- {
- this.treeview.set()
- this.treeview.position(0,this.width,this.height,0)
- }
- this.node.onSelect = new Function(this.obj+'.select(); return false;')
- for (var idx=0;idx<this.node.items.length;idx++)
- {
- if (this.node.items[idx].hasChild) this.node.items[idx].child.activate()
- }
- }
-
- //-------------------------------------------------------------------
- function selectTree()
- {
- var idx = this.node.selectedNode
- if (idx!=null)
- {
- if (this.childShown==idx)
- {
- this.hideMenu(this.childShown)
- }
- else
- {
- this.hideMenu()
- if (this.node.items[idx].hasChild) this.showMenu(idx)
- if (!this.node.items[idx].hasChild || this.subOnSelect) this.onSelect()
- }
- }
- }
-
- //-------------------------------------------------------------------
- function hideTreeMenu()
- {
- var idx = this.childShown
- if (idx!=null && this.node.items[idx]!=null)
- {
- this.childShown = null
- this.node.items[idx].child.treeview.hide()
- this.node.items[idx].child.hideMenu()
- if (this.node.items[idx].child.node.selectedNode!=null)
- {
- this.node.items[idx].child.node.deselect(this.node.items[idx].child.node.selectedNode)
- }
- if (Browser.NS && !this.isChild) this.treeview.position(0,this.width,this.height,0)
- }
- }
-
- //-------------------------------------------------------------------
- function showTreeMenu(iSel)
- {
- if (Browser.NS && !this.isChild) this.treeview.position(0,this.treeview.width,this.treeview.height,0)
- this.node.items[iSel].child.treeview.show()
- this.childShown = iSel
- }
-
- //-------------------------------------------------------------------
- function showTree(fshow)
- {
- if (fshow)
- {
- this.treeview.css.visibility = 'inherit'
- this.visible = true
- } else
- {
- this.hideMenu()
- this.node.deselect(this.node.selectedNode)
- this.treeview.hide()
- this.visible = false
- }
- }
-
- Tree.count = 0
-
-