home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 August / INTERNET94.ISO / pc / software / windows / mail / ft_gate_office / jscript / old / dropfunction.js next >
Encoding:
Text File  |  2001-02-16  |  25.0 KB  |  685 lines

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