home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / Chip_2002-05_cd1.bin / internet / novarise / Menu.js < prev    next >
Text File  |  2002-02-20  |  18KB  |  647 lines

  1. if(NS4){ 
  2.     Layer.prototype.dw = function(str){ 
  3.         this.document.write(str); 
  4.         this.document.close(); 
  5.     } 
  6.     origWidth = innerWidth; 
  7.     origHeight = innerHeight; 
  8.     onresize = function (){ 
  9.         if (innerWidth==origWidth && innerHeight==origHeight) return; 
  10.         initVars(); 
  11.         NSresized=true; 
  12.         location.reload(); 
  13.     } 
  14. isLoaded = false; 
  15. NSresized = false; 
  16.  
  17. isWin = (navigator.appVersion.indexOf("Win") != -1) 
  18. if (!isWin && !isMac) NSfontOver = false; 
  19.  
  20. mSecsVis = secondsVisible*1000; 
  21.  
  22. imgStr = "<IMG SRC='" + imgSrc + "' WIDTH=" + imgSiz + " HEIGHT=" + imgSiz +" BORDER=0 VSPACE=2 ALIGN=RIGHT>"; 
  23.  
  24. areCreated = false; 
  25. menuLoc = null; 
  26.  
  27. function initVars() { 
  28.     if(areCreated) { 
  29.         for(i=1; i<topCount; i++) { 
  30.             cur = eval("elMenu"+i); 
  31.             clearTimeout(cur.hideTimer); 
  32.             cur.hideTimer=null; 
  33.         } 
  34.         clearTimeout(allTimer); 
  35.     } 
  36.     topCount = 1; 
  37.     areCreated = false; 
  38.     beingCreated = false; 
  39.     isOverMenu = false; 
  40.     currentMenu = null; 
  41.     allTimer = null; 
  42.  
  43. initVars(); 
  44.  
  45. function startIt() { 
  46.     isLoaded = true; 
  47.     menuLoc = window; 
  48.     if (clickKill) { 
  49.         if (NS4) document.captureEvents(Event.MOUSEDOWN); 
  50.         document.onmousedown = clicked; 
  51.     } 
  52.     makeTop();     
  53.  
  54. function makeTop(){ 
  55.     beingCreated = true; 
  56.  
  57.     while(eval("window.arMenu" + topCount)) { 
  58.         (NS4) ? makeMenuNS(false,topCount) : makeMenuIE(false,topCount); 
  59.         topCount++ 
  60.     } 
  61.  
  62. //    status = (topCount-1) + " Hierarchical Menu Trees Created" 
  63.     areCreated = true; 
  64.     beingCreated = false; 
  65.  
  66.  
  67. function setObj(isChild,parMenu){ 
  68.  
  69.     if (!isChild) { 
  70.         this.menuWidth = this.array[0] ? this.array[0] : menuWidth; 
  71.         this.menuLeft = this.array[1]; 
  72.         this.menuTop = this.array[2]; 
  73.         this.menuFontColor = this.array[6] ? this.array[3] : fntCol; 
  74.         this.menuFontOver = this.array[4] ? this.array[4] : overFnt; 
  75.         this.menuBGColor = this.array[5] ? this.array[5] : backCol; 
  76.         this.menuBGOver = this.array[6] ? this.array[6] : overCol; 
  77.  
  78.         this.menuBorCol = this.array[7] ? this.array[7] : borCol; 
  79.         this.menuSeparatorCol = this.array[8] ? this.array[8] : separatorCol; 
  80.         this.treeParent = this; 
  81.         this.startChild = this; 
  82.  
  83.     } 
  84.     else { 
  85.         this.menuWidth = parMenu.menuWidth; 
  86.  
  87.         this.menuLeft = parMenu.menuLeft; 
  88.         this.menuTop = parMenu.menuTop; 
  89.         this.menuFontColor = parMenu.menuFontColor; 
  90.         this.menuFontOver = parMenu.menuFontOver; 
  91.         this.menuBGColor = parMenu.menuBGColor; 
  92.         this.menuBGOver = parMenu.menuBGOver; 
  93.  
  94.         this.menuBorCol = parMenu.menuBorCol; 
  95.         this.menuSeparatorCol = parMenu.menuSeparatorCol; 
  96.         this.treeParent = parMenu.treeParent; 
  97.  
  98.     } 
  99.  
  100.     this.maxItems = (isChild) ? this.array.length/3 : (this.array.length-9)/3; 
  101.     this.hasParent = isChild; 
  102.     this.itemCount = 0; 
  103.  
  104.  
  105. function makeMenuNS(isChild,menuCount,parMenu,parItem) { 
  106.  
  107.     menu = new Object() 
  108.     menu.lyrid = "elMenu" + menuCount; 
  109.     menu.array = eval("arMenu" + menuCount); 
  110.     menu.menuWidth = menu.array[0] ? menu.array[0] : menuWidth; 
  111.     menu.menuBGColor = menu.array[5] ? menu.array[5] : backCol; 
  112.  
  113.     menu.setObj = setObj; 
  114.     menu.setObj(isChild,parMenu); 
  115.  
  116.     menu.itemStr = ""; 
  117.  
  118.     while (menu.itemCount < menu.maxItems) { 
  119.         menu.itemCount++; 
  120.     //    status = "Creating Hierarchical Menus: " + menuCount + " / " + menu.itemCount; 
  121.         itemName = "item" + menuCount + "_" + menu.itemCount; 
  122.  
  123.         arrayPointer = (isChild) ? (menu.itemCount-1)*3 :((menu.itemCount-1)*3)+9; 
  124.         htmStr = menu.array[arrayPointer]; 
  125.         hasMore = menu.array[arrayPointer + 2]; 
  126.         if (fntBold) htmStr = htmStr.bold(); 
  127.         if (fntItal) htmStr = htmStr.italics(); 
  128.         htmStr = "<FONT FACE='" + fntFam + "' POINT-SIZE=" + fntSiz + ">" + htmStr+ "</FONT>"; 
  129.         htmStrOver = htmStr.fontcolor(menu.menuFontOver); 
  130.         htmStr = htmStr.fontcolor(menu.menuFontColor); 
  131.         htmStr = (hasMore) ? imgStr + htmStr : htmStr; 
  132.         htmStrOver = (hasMore) ? imgStr + htmStrOver : htmStrOver; 
  133.  
  134.         eval("menu."+ itemName + "= new Object()") 
  135.         eval("menu."+ itemName + ".htmStr = htmStr");  
  136.         eval("menu."+ itemName + ".htmStrOver = htmStrOver");  
  137.         menu.itemStr += "<LAYER ID=" + itemName + " WIDTH="+ menu.menuWidth + " BGCOLOR="+ menu.menuBGColor +" LEFT="+ (borWid + itemPad) +">"; 
  138.         menu.itemStr += "<LAYER WIDTH="+ (menu.menuWidth-(borWid*2)-itemPad) +">"+ htmStr +"</LAYER>"; 
  139.         menu.itemStr += "<LAYER LEFT="+ (-itemPad) + " TOP="+ (-itemPad) +"></LAYER>"; 
  140.         menu.itemStr += "</LAYER>"; 
  141.         if (hasMore) { 
  142.             menu.item = "document.elMenu"+ menuCount +".document."+ itemName; 
  143.             makeMenuNS(true,menuCount + "_" + menu.itemCount,menu,menu.item); 
  144.             menu = menu.parentMenu; 
  145.         } 
  146.     } 
  147.     menu.beginStr = "<LAYER ID=elMenu" + menuCount + " LEFT=0 TOP=0 Z-INDEX=500 VISIBILITY=HIDE WIDTH="+ menu.menuWidth +" BGCOLOR="+ menu.menuBorCol +">"; 
  148.     document.write(menu.beginStr + menu.itemStr + "</LAYER>"); 
  149.     eval("elMenu"+menuCount +"=document.elMenu"+menuCount); 
  150.     menuLyr = eval("elMenu"+menuCount); 
  151.     menuLyr.array = menu.array; 
  152.  
  153.     menuLyr.hasParent = isChild; 
  154.     if (!isChild) menuLyr.startChild = menuLyr; 
  155.      
  156.     itemColl = menuLyr.document.layers; 
  157.     for (var i=0; i<itemColl.length; i++) { 
  158.         it = itemColl[i]; 
  159.         it.menuObj = menu; 
  160.         it.setup = itemSetup; 
  161.         it.setup(i+1,menuLyr.array); 
  162.         menuLyr.lastItem = it; 
  163.     } 
  164.  
  165.     menuLyr.menuObj = menu; 
  166.     menuLyr.setup = menuSetup; 
  167.     menuLyr.setup(isChild,parMenu); 
  168.     menu.parentMenu = parMenu; 
  169.  
  170.  
  171. function makeMenuIE(isChild,menuCount,parMenu) { 
  172.  
  173.     menu = new Object() 
  174.     menu.lyrid = "elMenu" + menuCount; 
  175.     menu.array = eval("arMenu" + menuCount); 
  176.     menu.menuWidth = menu.array[0] ? menu.array[0] : menuWidth; 
  177.     menu.menuBGColor = menu.array[5] ? menu.array[5] : backCol; 
  178.  
  179.     menu.setObj = setObj; 
  180.     menu.setObj(isChild,parMenu); 
  181.  
  182.     menu.itemStr = ""; 
  183.     while (menu.itemCount < menu.maxItems) { 
  184.         menu.itemCount++; 
  185.     //    status = "Creating Hierarchical Menus: " + menuCount + " / " + menu.itemCount; 
  186.  
  187.         itemName = "item" + menuCount + "_" + menu.itemCount; 
  188.  
  189.         arrayPointer = (isChild) ? (menu.itemCount-1)*3 :((menu.itemCount-1)*3)+9; 
  190.         dispText = menu.array[arrayPointer]; 
  191.         linkText = menu.array[arrayPointer + 1]; 
  192.         hasMore = menu.array[arrayPointer + 2]; 
  193.         htmStr = (hasMore) ? imgStr + dispText : dispText; 
  194.         menu.itemStr += "<SPAN ID=" + itemName + " STYLE='width:" + menu.menuWidth + ";background-color:"+ menu.menuBGColor +";"; 
  195.         menu.itemStr += "padding:"+ itemPad +";color:"+ menu.menuFontColor +";"; 
  196.         menu.itemStr += "font-size:"+ fntSiz +"pt;font-weight:"+ ((fntBold) ? "bold;" : "normal;"); 
  197.         menu.itemStr += "font-style:"+ ((fntItal) ? "italic;" : "normal;"); 
  198.         menu.itemStr += "font-family:"+ fntFam +";"; 
  199.         if(menu.itemCount < menu.maxItems)menu.itemStr += "border-bottom:"+ separator + "px "+ menu.menuSeparatorCol +" solid;"; 
  200.         menu.itemStr += "cursor:"+ ((linkText) ? "hand;" : "default;"); 
  201.         menu.itemStr += "'>" + htmStr + "</SPAN><BR>"; 
  202.  
  203.         if (hasMore) { 
  204.             makeMenuIE(true,menuCount + "_" + menu.itemCount,menu); 
  205.             menu = menu.parentMenu; 
  206.         }     
  207.     } 
  208.  
  209.     menu.beginStr = "<DIV ID=elMenu" + menuCount + " onSelectStart='return false' STYLE='position:absolute;left:0;top:0;z-index:500;"; 
  210.     menu.beginStr += "width:"+ menu.menuWidth +";"; 
  211.     menu.beginStr += "border:"+ borWid +" "+ menu.menuBorCol +" "+ borSty +";"; 
  212.     menu.beginStr += "'>"; 
  213.     document.write( menu.beginStr + menu.itemStr + "</DIV>"); 
  214.     menuLyr = eval("elMenu"+menuCount); 
  215.     menuLyr.array = menu.array; 
  216.  
  217.  
  218.     menuLyr.hasParent = isChild; 
  219.     if (!isChild) menuLyr.startChild = menuLyr; 
  220.  
  221.  
  222.     itemColl = menuLyr.children.tags("SPAN"); 
  223.     for (var i=0; i<itemColl.length; i++) { 
  224.         it = itemColl(i); 
  225.         it.menuObj = menu; 
  226.         it.setup = itemSetup; 
  227.         it.setup(i+1,menuLyr.array); 
  228.         menuLyr.lastItem = it; 
  229.     } 
  230.  
  231.     menuLyr.menuObj = menu; 
  232.     menuLyr.setup = menuSetup; 
  233.     menuLyr.setup(isChild,parMenu); 
  234.     menu.parentMenu = parMenu; 
  235.  
  236. function itemSetup(whichItem,whichArray) { 
  237.     this.onmouseover = itemOver; 
  238.     this.onmouseout = itemOut; 
  239.  
  240.     this.container = (NS4) ? this.parentLayer : this.offsetParent; 
  241.  
  242.     arrayPointer = (this.menuObj.hasParent) ? (whichItem-1)*3 : ((whichItem-1)*3)+9; 
  243.  
  244.     this.linkText = whichArray[arrayPointer + 1]; 
  245.     this.hasMore = whichArray[arrayPointer + 2]; 
  246.  
  247.     if (this.hasMore) { 
  248.         this.child = eval("elMenu" + this.id.substr(4)); 
  249.         this.child.parentMenu = this.container; 
  250.         this.child.parentItem = this; 
  251.     } 
  252.  
  253.     if (this.linkText) { 
  254.         if (NS4) { 
  255.             this.captureEvents(Event.MOUSEUP) 
  256.             this.onmouseup = linkIt; 
  257.         } 
  258.         else { 
  259.             this.onclick = linkIt; 
  260.         } 
  261.     } 
  262.  
  263.     if (NS4) { 
  264.         this.htmStr = eval("this.menuObj."+ this.id + ".htmStr"); 
  265.         this.htmStrOver = eval("this.menuObj."+ this.id + ".htmStrOver"); 
  266.         if (whichItem != 1)    this.top = this.siblingBelow.top + this.siblingBelow.clip.height + separator; 
  267.         else this.top = (borWid + itemPad) 
  268.  
  269.         this.clip.top = this.clip.left = -itemPad; 
  270.         this.clip.right = (this.menuObj.menuWidth-(borWid*2)-itemPad); 
  271.         this.txtLyr = this.document.layers[0]; 
  272.         this.clip.bottom = this.txtLyr.document.height+itemPad; 
  273.         this.dummyLyr = this.document.layers[1]; 
  274.         this.dummyLyr.clip.width = this.clip.width; 
  275.         this.dummyLyr.clip.height = this.clip.height; 
  276.     } 
  277. }     
  278.  
  279. function menuSetup(hasParent,openCont) { 
  280.     this.onmouseover = menuOver; 
  281.     this.onmouseout = menuOut; 
  282.      
  283.     this.showIt = showIt; 
  284.     this.keepInWindow = keepInWindow; 
  285.     this.hideTree = hideTree 
  286.     this.hideParents = hideParents; 
  287.     this.hideChildren = hideChildren; 
  288.     this.hideTop = hideTop; 
  289.     this.hasChildVisible = false; 
  290.     this.isOn = false; 
  291.     this.hideTimer = null; 
  292.  
  293.  
  294.     this.menuWidth = this.menuObj.menuWidth; 
  295.     this.menuLeft = this.menuObj.menuLeft; 
  296.     this.menuTop = this.menuObj.menuTop; 
  297.     this.menuFontColor = this.menuObj.menuFontColor; 
  298.     this.menuFontOver = this.menuObj.menuFontOver; 
  299.     this.menuBGColor = this.menuObj.menuBGColor; 
  300.  
  301.     this.childOverlap = (perCentOver != null) ? ((perCentOver/100) * this.menuWidth) : childOverlap; 
  302.     this.currentItem = null; 
  303.     this.hideSelf = hideSelf; 
  304.          
  305.     this.hasParent = hasParent 
  306.  
  307.     if (NS4) { 
  308.         this.fullHeight = this.lastItem.top + this.lastItem.clip.bottom + borWid; 
  309.         this.clip.top = 0; 
  310.         this.clip.right = this.menuWidth; 
  311.         this.clip.bottom = this.fullHeight; 
  312.     } 
  313.     else { 
  314.         this.fullHeight = this.scrollHeight; 
  315.         this.showIt(false); 
  316.         this.moveTo = moveTo; 
  317.     } 
  318.  
  319. function popUp(menuName,e){ 
  320.     if (NS4 && NSresized) startIt(); 
  321.     if (!isLoaded) return; 
  322.     linkEl = (NS4) ? e.target : event.srcElement; 
  323.     if (clickStart) linkEl.onclick = popMenu; 
  324.     if (!beingCreated && !areCreated) startIt(); 
  325.     linkEl.menuName = (IE4) ? menuName : "document."+menuName;     
  326.     if (!clickStart) popMenu(e); 
  327.  
  328. function popMenu(e){ 
  329.     if (!isLoaded || !areCreated) return true; 
  330.  
  331.     eType = (NS4) ? e.type : event.type; 
  332.     if (clickStart && eType != "click") return true; 
  333.     hideAll(); 
  334.  
  335.     linkEl = (NS4) ? e.target : event.srcElement; 
  336.      
  337.     currentMenu = eval(linkEl.menuName); 
  338.     currentMenu.hasParent = false; 
  339.     currentMenu.menuObj.treeParent.startChild = currentMenu; 
  340.      
  341.     if (IE4) menuLocBod = document.body; 
  342.     xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? e.pageX : (event.clientX + menuLocBod.scrollLeft); 
  343.     yPos = (currentMenu.menuTop) ? currentMenu.menuTop : (NS4) ? e.pageY : (event.clientY + menuLocBod.scrollTop); 
  344.  
  345.     currentMenu.moveTo(xPos,yPos); 
  346.     currentMenu.keepInWindow() 
  347.     currentMenu.isOn = true; 
  348.     currentMenu.showIt(true); 
  349.  
  350.     return false; 
  351.  
  352. function menuOver(e) { 
  353.     this.isOn = true; 
  354.     isOverMenu = true; 
  355.     currentMenu = this; 
  356.     if (this.hideTimer) clearTimeout(this.hideTimer); 
  357.  
  358. function menuOut() { 
  359.     if (IE4 && event.srcElement.contains(event.toElement)) return; 
  360.     this.isOn = false; 
  361.     isOverMenu = false; 
  362.     status = ""; 
  363.     if (!clickKill) allTimer = setTimeout("currentMenu.hideTree()",10);   
  364.  
  365. function itemOver(){ 
  366.     if (keepHilite) { 
  367.         if (this.container.currentItem && this.container.currentItem != this) { 
  368.             if (NS4) { 
  369.                 this.container.currentItem.bgColor = this.menuObj.menuBGColor; 
  370.                 if (NSfontOver) this.container.currentItem.txtLyr.dw(this.container.currentItem.htmStr); 
  371.             } 
  372.             else { 
  373.                 with (this.container.currentItem.style) { 
  374.                     backgroundColor = this.menuObj.menuBGColor; 
  375.                     color = this.menuObj.menuFontColor; 
  376.                 } 
  377.             } 
  378.         } 
  379.     } 
  380.  
  381.     if (IE4) { 
  382.         if (event.srcElement.tagName == "IMG") return; 
  383.         this.style.backgroundColor = this.menuObj.menuBGOver; 
  384.         this.style.color = this.menuObj.menuFontOver; 
  385.     } 
  386.     else { 
  387.         this.bgColor = this.menuObj.menuBGOver; 
  388.         if (NSfontOver)    this.txtLyr.dw(this.htmStrOver); 
  389.     } 
  390.  
  391.     status = this.linkText; 
  392.  
  393.     this.container.currentItem = this; 
  394.  
  395.     if (this.container.hasChildVisible) { 
  396.         this.container.hideChildren(this); 
  397.     } 
  398.  
  399.     if (this.hasMore) { 
  400.         horOffset = (this.menuObj.menuWidth - this.container.childOverlap); 
  401.  
  402.         if (NS4) { 
  403.             this.childX = this.container.left + horOffset; 
  404.             this.childY = this.pageY + childOffset; 
  405.         } 
  406.         else { 
  407.             this.childX = this.container.style.pixelLeft + horOffset; 
  408.             this.childY = this.offsetTop + this.container.style.pixelTop + childOffset; 
  409.         } 
  410.  
  411.         this.child.moveTo(this.childX,this.childY); 
  412.         this.child.keepInWindow(); 
  413.         this.container.hasChildVisible = true; 
  414.         this.container.visibleChild = this.child; 
  415.         this.child.showIt(true); 
  416.     } 
  417.  
  418. function itemOut() { 
  419.     if (IE4) { 
  420.         if (event.srcElement.contains(event.toElement) 
  421.      || (event.fromElement.tagName=="IMG" && event.toElement.contains(event.fromElement))) 
  422.         return; 
  423.         if (!keepHilite) { 
  424.             this.style.backgroundColor = this.menuObj.menuBGColor; 
  425.             this.style.color = this.menuObj.menuFontColor; 
  426.         } 
  427.     } 
  428.     else { 
  429.         if (!keepHilite) { 
  430.             this.bgColor = this.menuObj.menuBGColor; 
  431.             if (NSfontOver) this.txtLyr.dw(this.htmStr); 
  432.         } 
  433.         if (!isOverMenu && !clickKill) { 
  434.             allTimer = setTimeout("currentMenu.hideTree()",10);  
  435.         } 
  436.     } 
  437.  
  438. function moveTo(xPos,yPos) { 
  439.     this.style.pixelLeft = xPos; 
  440.     this.style.pixelTop = yPos; 
  441.  
  442. function showIt(on) { 
  443.     if (NS4) { 
  444.         this.visibility = (on) ? "show" : "hide"; 
  445.         if (keepHilite && this.currentItem) { 
  446.             this.currentItem.bgColor = this.menuBGColor; 
  447.             if (NSfontOver) this.currentItem.txtLyr.dw(this.currentItem.htmStr); 
  448.         } 
  449.     } 
  450.     else { 
  451.         this.style.visibility = (on) ? "visible" : "hidden"; 
  452.         if (keepHilite && this.currentItem) { 
  453.             with (this.currentItem.style) { 
  454.                 backgroundColor = this.menuBGColor; 
  455.                 color = this.menuFontColor; 
  456.             } 
  457.         } 
  458.     } 
  459.     this.currentItem = null; 
  460.  
  461. function keepInWindow() { 
  462.     scrBars = 20; 
  463.     botScrBar = scrBars; 
  464.     rtScrBar = scrBars; 
  465.     if (NS4) { 
  466.         winRight = (pageXOffset + innerWidth) - rtScrBar; 
  467.         rightPos = this.left + this.menuWidth; 
  468.     
  469.         if (rightPos > winRight) { 
  470.             if (this.hasParent) { 
  471.                 parentLeft = this.parentMenu.left; 
  472.                 newLeft = ((parentLeft-this.menuWidth) + this.childOverlap); 
  473.                 this.left = newLeft; 
  474.             } 
  475.             else { 
  476.                 dif = rightPos - winRight; 
  477.                 this.left -= dif; 
  478.             } 
  479.         } 
  480.  
  481.         winBot = (pageYOffset + innerHeight) - botScrBar ; 
  482.         botPos = this.top + this.fullHeight; 
  483.  
  484.         if (botPos > winBot) { 
  485.             dif = botPos - winBot; 
  486.             this.top -= dif; 
  487.         } 
  488.          
  489.         winLeft = pageXOffset; 
  490.         leftPos = this.left; 
  491.  
  492.         if (leftPos < winLeft) { 
  493.             if (this.hasParent) { 
  494.                 parentLeft = this.parentMenu.left; 
  495.                 newLeft = ((parentLeft+this.menuWidth) - this.childOverlap); 
  496.                 this.left = newLeft; 
  497.             } 
  498.             else { 
  499.                 this.left = 5; 
  500.             } 
  501.         } 
  502.     } 
  503.     else { 
  504.         winRight = (document.body.scrollLeft + document.body.clientWidth) - rtScrBar; 
  505.         rightPos = this.style.pixelLeft + this.menuWidth; 
  506.      
  507.         if (rightPos > winRight) { 
  508.             if (this.hasParent) { 
  509.                 parentLeft = this.parentMenu.style.pixelLeft; 
  510.                 newLeft = ((parentLeft - this.menuWidth) + this.childOverlap); 
  511.                 this.style.pixelLeft = newLeft; 
  512.             } 
  513.             else { 
  514.                 dif = rightPos - winRight; 
  515.                 this.style.pixelLeft -= dif; 
  516.             } 
  517.         } 
  518.  
  519.         winBot = (document.body.scrollTop + document.body.clientHeight) - botScrBar; 
  520.         botPos = this.style.pixelTop + this.fullHeight; 
  521.  
  522.         if (botPos > winBot) { 
  523.             dif = botPos - winBot; 
  524.             this.style.pixelTop -= dif; 
  525.         } 
  526.          
  527.         winLeft = document.body.scrollLeft; 
  528.         leftPos = this.style.pixelLeft; 
  529.  
  530.         if (leftPos < winLeft) { 
  531.             if (this.hasParent) { 
  532.                 parentLeft = this.parentMenu.style.pixelLeft; 
  533.                 newLeft = ((parentLeft+this.menuWidth) - this.childOverlap); 
  534.                 this.style.pixelLeft = newLeft; 
  535.             } 
  536.             else { 
  537.                 this.style.pixelLeft = 5; 
  538.             } 
  539.         } 
  540.     } 
  541.  
  542. function linkIt() { 
  543.     if (this.linkText.indexOf("javascript")!=-1) eval(this.linkText) 
  544.     else location.href = this.linkText; 
  545.  
  546. function popDown(menuName){ 
  547.     if (!isLoaded || !areCreated) return; 
  548.     whichEl = eval(menuName); 
  549.     whichEl.isOn = false; 
  550.     if (!clickKill) whichEl.hideTop(); 
  551.  
  552. function hideAll() { 
  553.     for(i=1; i<topCount; i++) { 
  554.         temp = eval("elMenu" + i + ".startChild"); 
  555.         temp.isOn = false; 
  556.         if (temp.hasChildVisible) temp.hideChildren(); 
  557.         temp.showIt(false); 
  558.     }     
  559.  
  560. function hideTree() {  
  561.     allTimer = null; 
  562.     if (isOverMenu) return; 
  563.     if (this.hasChildVisible) { 
  564.         this.hideChildren(); 
  565.     } 
  566.     this.hideParents(); 
  567.  
  568. function hideTop() { 
  569.     whichEl = this; 
  570.     (clickKill) ? whichEl.hideSelf() : (this.hideTimer = setTimeout("whichEl.hideSelf()",mSecsVis)); 
  571.  
  572. function hideSelf() { 
  573.     this.hideTimer = null; 
  574.     if (!this.isOn && !isOverMenu) {  
  575.         this.showIt(false); 
  576.     } 
  577.  
  578. function hideParents() { 
  579.     tempMenu = this; 
  580.     while (tempMenu.hasParent) { 
  581.         tempMenu.showIt(false); 
  582.         tempMenu.parentMenu.isOn = false;         
  583.         tempMenu = tempMenu.parentMenu; 
  584.     } 
  585.     tempMenu.hideTop(); 
  586.  
  587. function hideChildren(item) { 
  588.     tempMenu = this.visibleChild; 
  589.     while (tempMenu.hasChildVisible) { 
  590.         tempMenu.visibleChild.showIt(false); 
  591.         tempMenu.hasChildVisible = false; 
  592.         tempMenu = tempMenu.visibleChild; 
  593.     } 
  594.  
  595.     if (!this.isOn || !item.hasMore || this.visibleChild != this.child) { 
  596.         this.visibleChild.showIt(false); 
  597.         this.hasChildVisible = false; 
  598.     } 
  599.  
  600. function clicked() { 
  601.     if (!isOverMenu && currentMenu!=null && !currentMenu.isOn) { 
  602.         whichEl = currentMenu; 
  603.         whichEl.hideTree(); 
  604.     } 
  605.  
  606. window.onerror = handleErr; 
  607.  
  608. function handleErr(){ 
  609.     arAccessErrors = ["permission","access"]; 
  610.     mess = arguments[0].toLowerCase(); 
  611.     found = false; 
  612.     for (i=0;i<arAccessErrors.length;i++) { 
  613.         errStr = arAccessErrors[i]; 
  614.         if (mess.indexOf(errStr)!=-1) found = true; 
  615.     } 
  616.     return found; 
  617.  
  618. startIt(); 
  619.  
  620.