home *** CD-ROM | disk | FTP | other *** search
/ 221.214.14.186 / 221.214.14.186.tar / 221.214.14.186 / zb / bs / zc.files / fw_menu.js < prev    next >
Text File  |  2003-08-28  |  30KB  |  824 lines

  1. window.onresize = function (){
  2.     if (mywidth <= 778) {
  3.     ScreenOffset = 0;
  4.     }else{
  5.     ScreenOffset = (mywidth - 778)/2;
  6.     }
  7. }
  8.  
  9. function initScreen(){
  10. var ScreenOffset;
  11. if (mywidth <= 778) {
  12.     ScreenOffset = 0;
  13. }else{
  14.     ScreenOffset = (mywidth - 778)/2;
  15. }
  16. return ScreenOffset;
  17. }
  18.  
  19. function MM_displayStatusMsg(msgStr)  { //v3.0
  20.     status=msgStr; document.MM_returnValue = true;
  21. }
  22.  
  23. function MM_findObj(n, d) { //v3.0
  24.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  25.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  26.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  27.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
  28. }
  29. function MM_swapImage() { //v3.0
  30.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  31.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  32. }
  33. function MM_swapImgRestore() { //v3.0
  34.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  35. }
  36.  
  37. function MM_preloadImages() { //v3.0
  38.  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  39.    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  40.    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  41. }
  42.  
  43. function navChange(formName, popupName, target) {
  44.     var popup = document[formName].elements[popupName];
  45.     if (popup.options[popup.selectedIndex].value != "") {
  46.         window.open(popup.options[popup.selectedIndex].value, target);
  47.         popup.selectedIndex=0;
  48.     }
  49. }
  50.  
  51. function fwLoadMenus() {
  52.         
  53.   if (window.fw_menu_0) return;
  54. //╒Γ└∩╠φ╝╙╫╙▓╦╡Ñ
  55.    
  56.     window.fw_menu_3_2 = new Menu("═°╥│╓╞╫≈","location='/doc/webpage'");
  57.    fw_menu_3_2.addMenuItem("Dreamweaver","location='/doc/webpage/dreamweaver'");
  58.    fw_menu_3_2.addMenuItem("Golive","location='/doc/webpage/golive'");
  59.    fw_menu_3_2.addMenuItem("HTML","location='/doc/webpage/html'");
  60.    fw_menu_3_2.addMenuItem("CSS","location='/doc/webpage/css'");
  61.    fw_menu_3_2.addMenuItem("╞Σ ╦√","location='/doc/webpage/other'");
  62.     
  63.     window.fw_menu_3_3= new Menu("═╝╨╬═╝╧±","location='/doc/graph'");
  64. fw_menu_3_3.addMenuItem("Fireworks","location='/doc/graph/fireworks'");
  65. fw_menu_3_3.addMenuItem("Photoshop","location='/doc/graph/photoshop'");
  66. fw_menu_3_3.addMenuItem("Photoimapct","location='/doc/graph/photoimpact'");
  67. fw_menu_3_3.addMenuItem("Freehand","location='/doc/graph/freehand'");
  68. fw_menu_3_3.addMenuItem("CorelDraw","location='/doc/graph/coreldraw'");
  69. fw_menu_3_3.addMenuItem("Illustrator","location='/doc/graph/illustrator'");
  70.  
  71. window.fw_menu_3_4= new Menu("═°┬τ╢α├╜╠σ","location='/doc/multimedia'");
  72. fw_menu_3_4.addMenuItem("Flash","location='/doc/multimedia/flash'");  
  73. fw_menu_3_4.addMenuItem("╥⌠╗¡╠∞╠├","location='/doc/multimedia/audio'"); 
  74.  
  75.  
  76.  
  77. //window.fw_menu_6_1= new Menu("╓╨╬─╘¡┤┤╫≈╞╖","location='/show/book'");
  78. //fw_menu_6_1.addMenuItem("С˵","location='/show/book/story'");
  79. //fw_menu_6_1.addMenuItem("╩½╕Φ","location='/show/book/poesy'");
  80. //fw_menu_6_1.addMenuItem("╔ó╬─","location='/show/book/essay'");
  81.  
  82.   window.fw_menu_0 = new Menu();
  83.   fw_menu_0.addMenuItem("╒╛╡π╨┬╬┼","location='/news/site'");
  84.   fw_menu_0.addMenuItem("╥╡╜τ╨┬╬┼","location='/news/cnnews'");
  85.   //fw_menu_0.addMenuItem("╣·═Γ╨┬╬┼","location='/news/ennews'");
  86.  
  87.   window.fw_menu_1 = new Menu();
  88.   fw_menu_1.addMenuItem("flyingbird","location='/people/flyingbird'");
  89.   //fw_menu_1.addMenuItem("blue","location='/people/blue'");
  90.   //fw_menu_1.addMenuItem("mengjue","location='/people/mengjue'");
  91.  
  92.   window.fw_menu_2 = new Menu();
  93.   //fw_menu_2.addMenuItem("═°╒╛╜Γ╬÷","location='/tech/web'");
  94.   //fw_menu_2.addMenuItem("╠╪╨º╜Γ╬÷","location='/tech/effect'");
  95.   //fw_menu_2.addMenuItem("Flash╘┤┬δ╜Γ╬÷","location='/tech/flash'");
  96.  
  97.   window.fw_menu_3 = new Menu();
  98.   fw_menu_3.addMenuItem("╓╨╬─░∩╓·","location='/help'");
  99.   fw_menu_3.addMenuItem(fw_menu_3_2,"location='/doc/webpage'");
  100.   fw_menu_3.addMenuItem(fw_menu_3_3,"location='/doc/graph'");
  101.   fw_menu_3.addMenuItem(fw_menu_3_4,"location='/doc/multimedia'");
  102.   fw_menu_3.addMenuItem("═°┬τ▒α│╠","location='/doc/program'");
  103.   fw_menu_3.addMenuItem("▓σ╝■┬╦╛╡","location='/doc/plugin'");
  104.   fw_menu_3.addMenuItem("╝╞╦π╗·╝╝╩⌡","location='/doc/other'");
  105.  
  106.   window.fw_menu_4 = new Menu();
  107.   fw_menu_4.addMenuItem("dreamweaver ╫╩╘┤","location='/download/dreamweaver'");
  108.  fw_menu_4.addMenuItem("fireworks ╫╩╘┤","location='/download/fireworks'");
  109.   fw_menu_4.addMenuItem("photoshop ╫╩╘┤","location='/download/photoshop'");
  110.  fw_menu_4.addMenuItem("flash ╫╩╘┤","location='/download/flash'");
  111.   fw_menu_4.addMenuItem("╥⌠╨º╫╩╘┤","location='/download/sound'");
  112.   fw_menu_4.addMenuItem("┬█╠│╛½╗¬╧┬╘╪","location='/download/forum'");
  113.   fw_menu_4.addMenuItem("╣²═∙╩²┬δ╘╙╓╛","location='/download/magazine'");
  114.  
  115.   window.fw_menu_5 = new Menu();
  116.   fw_menu_5.addMenuItem("╛¡╡Σ═╞╝÷","location='/design/class'");
  117.   //fw_menu_5.addMenuItem("└╢╔½╗Ñ╢»","location='/design/site'");
  118.   fw_menu_5.addMenuItem("╥╒╬─╜Γ╬÷","location='/design/comment'");
  119.   fw_menu_5.addMenuItem("╩²┬δ╫≈╞╖╒╣└└","location='/design/show'");
  120.   fw_menu_5.addMenuItem("╩²┬δ╔Φ╝╞▒╚╚ⁿ","location='/design/designgame'");
  121.   fw_menu_5.addMenuItem("├ⁿ╠Γ┤┤╫≈","location='/design/theme'");
  122.   fw_menu_5.addMenuItem("╖╟╩≤▒Ω╫≈╞╖","location='/design/hand'");
  123.  
  124.  
  125.   window.fw_menu_6 = new Menu();
  126.   fw_menu_6.addMenuItem("╨í╦╡","location='/show/book/story'");
  127.   fw_menu_6.addMenuItem("╩½╕Φ","location='/show/book/poesy'");
  128.   fw_menu_6.addMenuItem("╦µ▒╩","location='/show/book/essay'");
  129.  
  130.   window.fw_menu_7 = new Menu();
  131.   //fw_menu_7.addMenuItem("╘╙╓╛Σ»└└","location='/maillist'");
  132.   //fw_menu_7.addMenuItem("╢⌐╘─╘╙╓╛","location='/maillist/sub.asp'");
  133.   //fw_menu_7.addMenuItem("╘╙╓╛═╢╕σ","location='/maillist/subdoc.asp'");
  134.  
  135.   window.fw_menu_8 = new Menu();
  136.   fw_menu_8.addMenuItem("╝╝╩⌡╠╓┬█╟°","location='/bbs/category.asp?category=%BC%BC%CA%F5%CC%D6%C2%DB%C7%F8'");
  137.   fw_menu_8.addMenuItem("╤º╧░╣ñ╫≈╜╗┴≈╟°","location='/bbs/category.asp?category=%D1%A7%CF%B0%B9%A4%D7%F7%BD%BB%C1%F7%C7%F8'");
  138.  
  139.   fw_menu_8.writeMenus();
  140. }
  141. // fwLoadMenus()
  142.  
  143. /**
  144.  * fw_menu 24OCT2000 Version 4.0
  145.  * John Ahlquist, October 2000
  146.  * Copyright (c) 2000 Macromedia, Inc.
  147.  *
  148.  * based on menu.js
  149.  * by gary smith, July 1997
  150.  * Copyright (c) 1997-1999 Netscape Communications Corp.
  151.  *
  152.  * Netscape grants you a royalty free license to use or modify this
  153.  * software provided that this copyright notice appears on all copies.
  154.  * This software is provided "AS IS," without a warranty of any kind.
  155.  */
  156.  
  157. function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh) {
  158. this.version = "990702 [Menu; menu.js]";
  159.     this.type = "Menu";
  160.     this.menuWidth = 110;
  161.     this.menuItemHeight = 20;
  162.     this.fontSize = fs||12;
  163.     this.fontWeight = "plain";
  164.     this.fontFamily = fnt||"MS Shell Dlg";
  165.     this.fontColor = fclr||"#ffffff";
  166.     this.fontColorHilite = fhclr||"#FFFFFF";
  167.     this.bgColor = "#666666";
  168.     this.menuBorder = 1;
  169.     this.menuItemBorder = 1;
  170.     this.menuItemBgColor = bg||"#999999";
  171.     this.menuLiteBgColor = "#cccccc";
  172.     this.menuBorderBgColor = "#666666";
  173.     this.menuHiliteBgColor = bgh||"#555555";
  174.     this.menuContainerBgColor = "#cccccc";
  175.     this.childMenuIcon = "/js/arrows.gif";
  176.  
  177.     this.items = new Array();
  178.     this.actions = new Array();
  179.     this.childMenus = new Array();
  180.  
  181.     this.hideOnMouseOut = true;
  182.  
  183.     
  184.  
  185.     this.addMenuItem = addMenuItem;
  186.     this.addMenuSeparator = addMenuSeparator;
  187.     this.writeMenus = writeMenus;
  188.     this.FW_showMenu = FW_showMenu;
  189.     this.onMenuItemOver = onMenuItemOver;
  190.     this.onMenuItemAction = onMenuItemAction;
  191.     this.hideMenu = hideMenu;
  192.     this.hideChildMenu = hideChildMenu;
  193.  
  194.     if (!window.menus) window.menus = new Array();
  195.     this.label = label || "menuLabel" + window.menus.length;
  196.     window.menus[this.label] = this;
  197.     window.menus[window.menus.length] = this;
  198.     if (!window.activeMenus) window.activeMenus = new Array();
  199. }
  200.  
  201. function addMenuItem(label, action) {
  202.     this.items[this.items.length] = label;
  203.     this.actions[this.actions.length] = action;
  204. }
  205.  
  206. function addMenuSeparator() {
  207.     this.items[this.items.length] = "separator";
  208.     this.actions[this.actions.length] = "";
  209.     this.menuItemBorder = 0;
  210. }
  211.  
  212. // For NS6. 
  213.  
  214. function FIND(item) {
  215.     if (document.all) return(document.all[item]);
  216.     if (document.getElementById) return(document.getElementById(item));
  217.     return(false);
  218. }
  219.  
  220. function writeMenus(container) {    
  221.     if (window.triedToWriteMenus) return;
  222.  
  223.     if (!container && document.layers) {
  224.         window.delayWriteMenus = this.writeMenus;
  225.         var timer = setTimeout('delayWriteMenus()', 250);
  226.         container = new Layer(100);
  227.         clearTimeout(timer);
  228.     } else if (document.all || document.hasChildNodes) {        
  229.         document.writeln('<SPAN ID="menuContainer"></SPAN>');
  230.         container = FIND("menuContainer");
  231.     }
  232.  
  233.     window.fwHideMenuTimer = null;
  234.     if (!container) return;    
  235.     window.triedToWriteMenus = true; 
  236.     container.isContainer = true;
  237.     container.menus = new Array();
  238.     for (var i=0; i<window.menus.length; i++) 
  239.         container.menus[i] = window.menus[i];
  240.     window.menus.length = 0;
  241.     var countMenus = 0;
  242.     var countItems = 0;
  243.     var top = 0;
  244.     var content = '';
  245.     var lrs = false;
  246.     var theStat = "";
  247.     var tsc = 0;
  248.     if (document.layers) lrs = true;
  249.     for (var i=0; i<container.menus.length; i++, countMenus++) {
  250.         var menu = container.menus[i];
  251.         if (menu.bgImageUp) {
  252.             menu.menuBorder = 0;
  253.             menu.menuItemBorder = 0;
  254.         }
  255.         if (lrs) {
  256.             var menuLayer = new Layer(100, container);
  257.             var lite = new Layer(100, menuLayer);
  258.             lite.top = menu.menuBorder-2;
  259.             lite.left = menu.menuBorder-2;
  260.             var body = new Layer(100, lite);
  261.             body.top = menu.menuBorder;
  262.             body.left = menu.menuBorder;
  263.         } else {
  264.             content += ''+
  265.             '<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;z-index:1;left:10;top:'+ (i * 100) +';visibility:hidden;">\n'+
  266.             '  <DIV ID="menuLite'+ countMenus +'" STYLE="position:absolute;z-index:1;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;" onMouseOut="mouseoutMenu();">\n'+
  267.             '     <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;">\n'+
  268.             '';
  269.         }
  270.         var x=i;
  271.         for (var i=0; i<menu.items.length; i++) {
  272.             var item = menu.items[i];
  273.             var childMenu = false;
  274.             var defaultHeight = menu.fontSize+6;
  275.             //set01
  276.             var defaultIndent = 6;
  277.             if (item.label) {
  278.                 item = item.label;
  279.                 childMenu = true;
  280.             }
  281.             menu.menuItemHeight = menu.menuItemHeight || defaultHeight;
  282.             menu.menuItemIndent = menu.menuItemIndent || defaultIndent;
  283.             var itemProps = 'font-family:' + menu.fontFamily +';font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + ';';
  284.             if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';
  285.             if (document.all) 
  286.                 itemProps += 'font-size:' + menu.fontSize + ';" onMouseOver="onMenuItemOver(null,this);" onClick="onMenuItemAction(null,this);';
  287.             else if (!document.layers) {
  288.                 itemProps += 'font-size:' + menu.fontSize + 'px;'; // zilla wants 12px.
  289.             }
  290.             var l;
  291.             if (lrs) {
  292.                 l = new Layer(800,body);
  293.             }
  294.             var dTag    = '<DIV ID="menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
  295.             var dClose = '</DIV>'
  296.             if (menu.bgImageUp) {
  297.                 menu.menuBorder = 0;
  298.                 menu.menuItemBorder = 0;
  299.                 dTag    = '<DIV ID="menuItem'+ countItems +'" STYLE="background:url('+menu.bgImageUp+');position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';
  300.                 if (document.layers) {
  301.                     dTag = '<LAYER BACKGROUND="'+menu.bgImageUp+'" ID="menuItem'+ countItems +'" TOP="'+ (i * menu.menuItemHeight) +'" style="' + itemProps +'">';
  302.                     dClose = '</LAYER>';
  303.                 }
  304.             }
  305.             var textProps = 'position:absolute;left:' + menu.menuItemIndent + ';top:3;';
  306.             if (lrs) {
  307.                 textProps +=itemProps;
  308.                 dTag = "";
  309.                 dClose = "";
  310.             }
  311.  
  312.             var dText    = '<DIV ID="menuItemText'+ countItems +'" STYLE="' + textProps + 'color:'+ menu.fontColor +';">'+ item +' </DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="' + textProps + 'top:3;color:'+ menu.fontColorHilite +';visibility:hidden;">'+ item +' </DIV>';
  313.             if (item == "separator") {
  314.                 content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n' + dClose);
  315.             } else if (childMenu) {
  316.                 content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;"><IMG SRC="'+ menu.childMenuIcon +'"></DIV>\n' + dClose);
  317.             } else {
  318.                 content += ( dTag + dText + dClose);
  319.             }
  320.             if (lrs) {
  321.                 l.document.open("text/html");
  322.                 l.document.writeln(content);
  323.                 l.document.close();    
  324.                 content = '';
  325.                 theStat += "-";
  326.                 tsc++;
  327.                 if (tsc > 50) {
  328.                     tsc = 0;
  329.                     theStat = "";
  330.                 }
  331.                 status = theStat;
  332.             }
  333.             countItems++;  
  334.         }
  335.         if (lrs) {
  336.             // focus layer
  337.             var focusItem = new Layer(100, body);
  338.             focusItem.visiblity="hidden";
  339.             focusItem.document.open("text/html");
  340.             focusItem.document.writeln(" ");
  341.             focusItem.document.close();    
  342.         } else {
  343.           content += '      <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);"> </DIV>\n';
  344.           content += '   </DIV>\n  </DIV>\n</DIV>\n';
  345.         }
  346.         i=x;
  347.     }
  348.     if (document.layers) {        
  349.         container.clip.width = window.innerWidth;
  350.         container.clip.height = window.innerHeight;
  351.         container.onmouseout = mouseoutMenu;
  352.         container.menuContainerBgColor = this.menuContainerBgColor;
  353.         for (var i=0; i<container.document.layers.length; i++) {
  354.             proto = container.menus[i];
  355.             var menu = container.document.layers[i];
  356.             container.menus[i].menuLayer = menu;
  357.             container.menus[i].menuLayer.Menu = container.menus[i];
  358.             container.menus[i].menuLayer.Menu.container = container;
  359.             var body = menu.document.layers[0].document.layers[0];
  360.             body.clip.width = proto.menuWidth || body.clip.width;
  361.             body.clip.height = proto.menuHeight || body.clip.height;
  362.             for (var n=0; n<body.document.layers.length-1; n++) {
  363.                 var l = body.document.layers[n];
  364.                 l.Menu = container.menus[i];
  365.                 l.menuHiliteBgColor = proto.menuHiliteBgColor;
  366.                 l.document.bgColor = proto.menuItemBgColor;
  367.                 l.saveColor = proto.menuItemBgColor;
  368.                 l.onmouseover = proto.onMenuItemOver;
  369.                 l.onclick = proto.onMenuItemAction;
  370.                 l.action = container.menus[i].actions[n];
  371.                 l.focusItem = body.document.layers[body.document.layers.length-1];
  372.                 l.clip.width = proto.menuWidth || body.clip.width + proto.menuItemIndent;
  373.                 l.clip.height = proto.menuItemHeight || l.clip.height;
  374.                 if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;
  375.                 l.hilite = l.document.layers[1];
  376.                 if (proto.bgImageUp) l.background.src = proto.bgImageUp;
  377.                 l.document.layers[1].isHilite = true;
  378.                 if (l.document.layers[0].id.indexOf("menuSeparator") != -1) {
  379.                     l.hilite = null;
  380.                     l.clip.height -= l.clip.height / 2;
  381.                     l.document.layers[0].document.bgColor = proto.bgColor;
  382.                     l.document.layers[0].clip.width = l.clip.width -2;
  383.                     l.document.layers[0].clip.height = 1;
  384.                     l.document.layers[1].document.bgColor = proto.menuLiteBgColor;
  385.                     l.document.layers[1].clip.width = l.clip.width -2;
  386.                     l.document.layers[1].clip.height = 1;
  387.                     l.document.layers[1].top = l.document.layers[0].top + 1;
  388.                 } else if (l.document.layers.length > 2) {
  389.                     l.childMenu = container.menus[i].items[n].menuLayer;
  390.                     l.document.layers[2].left = l.clip.width -13;
  391.                     l.document.layers[2].top = (l.clip.height / 2) -4;
  392.                     l.document.layers[2].clip.left += 3;
  393.                     l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
  394.                 }
  395.             }
  396.             body.document.bgColor = proto.bgColor;
  397.             body.clip.width  = l.clip.width +proto.menuBorder;
  398.             body.clip.height = l.top + l.clip.height +proto.menuBorder;
  399.             var focusItem = body.document.layers[n];
  400.             focusItem.clip.width = body.clip.width;
  401.             focusItem.Menu = l.Menu;
  402.             focusItem.top = -30;
  403.             focusItem.captureEvents(Event.MOUSEDOWN);
  404.             focusItem.onmousedown = onMenuItemDown;
  405.             menu.document.bgColor = proto.menuBorderBgColor;
  406.             var lite = menu.document.layers[0];
  407.             lite.document.bgColor = proto.menuLiteBgColor;
  408.             lite.clip.width = body.clip.width +1;
  409.             lite.clip.height = body.clip.height +1;
  410.             menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;
  411.             menu.clip.height = body.clip.height + (proto.menuBorder * 3);
  412.         }
  413.     } else {
  414.         if ((!document.all) && (container.hasChildNodes)) {
  415.             container.innerHTML=content;
  416.         } else {
  417.             container.document.open("text/html");
  418.             container.document.writeln(content);
  419.             container.document.close();    
  420.         }
  421.         if (!FIND("menuLayer0")) return;
  422.         var menuCount = 0;
  423.         for (var x=0; x<container.menus.length; x++) {
  424.             var menuLayer = FIND("menuLayer" + x);
  425.             container.menus[x].menuLayer = "menuLayer" + x;
  426.             menuLayer.Menu = container.menus[x];
  427.             menuLayer.Menu.container = "menuLayer" + x;
  428.             menuLayer.style.zIndex = 1;
  429.             var s = menuLayer.style;
  430.             s.top = s.pixelTop = -300;
  431.             s.left = s.pixelLeft = -300;
  432.  
  433.             var menu = container.menus[x];
  434.             menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;
  435.             menuLayer.style.backgroundColor = menu.menuBorderBgColor;
  436.             var top = 0;
  437.             for (var i=0; i<container.menus[x].items.length; i++) {
  438.                 var l = FIND("menuItem" + menuCount);
  439.                 l.Menu = container.menus[x];
  440.                 if (l.addEventListener) { // ns6
  441.                     l.style.width = menu.menuItemWidth;    
  442.                     l.style.height = menu.menuItemHeight;
  443.                     l.style.top = top;
  444.                     l.addEventListener("mouseover", onMenuItemOver, false);
  445.                     l.addEventListener("click", onMenuItemAction, false);
  446.                     l.addEventListener("mouseout", mouseoutMenu, false);
  447.                 } else { //ie
  448.                     l.style.pixelWidth = menu.menuItemWidth;    
  449.                     l.style.pixelHeight = menu.menuItemHeight;
  450.                     l.style.pixelTop = top;
  451.                 }
  452.                 top = top + menu.menuItemHeight+menu.menuItemBorder;
  453.                 l.style.fontSize = menu.fontSize;
  454.                 l.style.backgroundColor = menu.menuItemBgColor;
  455.                 l.style.visibility = "inherit";
  456.                 l.saveColor = menu.menuItemBgColor;
  457.                 l.menuHiliteBgColor = menu.menuHiliteBgColor;
  458.                 l.action = container.menus[x].actions[i];
  459.                 l.hilite = FIND("menuItemHilite" + menuCount);
  460.                 l.focusItem = FIND("focusItem" + x);
  461.                 l.focusItem.style.pixelTop = l.focusItem.style.top = -30;
  462.                 var childItem = FIND("childMenu" + menuCount);
  463.                 if (childItem) {
  464.                     l.childMenu = container.menus[x].items[i].menuLayer;
  465.                     childItem.style.pixelLeft = childItem.style.left = menu.menuItemWidth -11;
  466.                     childItem.style.pixelTop = childItem.style.top =(menu.menuItemHeight /2) -4;
  467.                     //childItem.style.pixelWidth = 30 || 7;
  468.                     //childItem.style.clip = "rect(0 7 7 3)";
  469.                     l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
  470.                 }
  471.                 var sep = FIND("menuSeparator" + menuCount);
  472.                 if (sep) {
  473.                     sep.style.clip = "rect(0 " + (menu.menuItemWidth - 3) + " 1 0)";
  474.                     sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;    
  475.                     sep.style.backgroundColor = menu.bgColor;
  476.                     sep = FIND("menuSeparatorLite" + menuCount);
  477.                     sep.style.clip = "rect(1 " + (menu.menuItemWidth - 3) + " 2 0)";
  478.                     sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;    
  479.                     sep.style.backgroundColor = menu.menuLiteBgColor;
  480.                     l.style.height = l.style.pixelHeight = menu.menuItemHeight/2;
  481.                     l.isSeparator = true
  482.                     top -= (menu.menuItemHeight - l.style.pixelHeight)
  483.                 } else {
  484.                     l.style.cursor = "hand"
  485.                 }
  486.                 menuCount++;
  487.             }
  488.             menu.menuHeight = top-1;
  489.             var lite = FIND("menuLite" + x);
  490.             var s = lite.style;
  491.             s.height = s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2);
  492.             s.width = s.pixelWidth = menu.menuItemWidth + (menu.menuBorder * 2);
  493.             s.backgroundColor = menu.menuLiteBgColor;
  494.  
  495.             var body = FIND("menuFg" + x);
  496.             s = body.style;
  497.             s.height = s.pixelHeight = menu.menuHeight + menu.menuBorder;
  498.             s.width = s.pixelWidth = menu.menuItemWidth + menu.menuBorder;
  499.             s.backgroundColor = menu.bgColor;
  500.  
  501.             s = menuLayer.style;
  502.             s.width = s.pixelWidth  = menu.menuItemWidth + (menu.menuBorder * 4);
  503.             s.height = s.pixelHeight  = menu.menuHeight+(menu.menuBorder*4);
  504.         }
  505.     }
  506.     if (document.captureEvents) {    
  507.         document.captureEvents(Event.MOUSEUP);
  508.     }
  509.     if (document.addEventListener) {    
  510.         document.addEventListener("mouseup", onMenuItemOver, false);
  511.     }
  512.     if (document.layers && window.innerWidth) {
  513.         window.onresize = NS4resize;
  514.         window.NS4sIW = window.innerWidth;
  515.         window.NS4sIH = window.innerHeight;
  516.     }
  517.     document.onmouseup = mouseupMenu;
  518.     window.fwWroteMenu = true;
  519.     status = "";
  520. }
  521.  
  522. function NS4resize() {
  523.     if (NS4sIW < window.innerWidth || 
  524.         NS4sIW > window.innerWidth || 
  525.         NS4sIH > window.innerHeight || 
  526.         NS4sIH < window.innerHeight ) 
  527.     {
  528.         window.location.reload();
  529.     }    
  530. }
  531.  
  532. function onMenuItemOver(e, l) {
  533.     FW_clearTimeout();
  534.     l = l || this;
  535.     a = window.ActiveMenuItem;
  536.     if (document.layers) {
  537.         if (a) {
  538.             a.document.bgColor = a.saveColor;
  539.             if (a.hilite) a.hilite.visibility = "hidden";
  540.             if (a.Menu.bgImageOver) {
  541.                 a.background.src = a.Menu.bgImageUp;
  542.             }
  543.             a.focusItem.top = -100;
  544.             a.clicked = false;
  545.         }
  546.         if (l.hilite) {
  547.             l.document.bgColor = l.menuHiliteBgColor;
  548.             l.zIndex = 1;
  549.             l.hilite.visibility = "inherit";
  550.             l.hilite.zIndex = 2;
  551.             l.document.layers[1].zIndex = 1;
  552.             l.focusItem.zIndex = this.zIndex +2;
  553.         }
  554.         if (l.Menu.bgImageOver) {
  555.             l.background.src = l.Menu.bgImageOver;
  556.         }
  557.         l.focusItem.top = this.top;
  558.         l.Menu.hideChildMenu(l);
  559.     } else if (l.style && l.Menu) {
  560.         if (a) {
  561.             a.style.backgroundColor = a.saveColor;
  562.             if (a.hilite) a.hilite.style.visibility = "hidden";
  563.             if (a.Menu.bgImageUp) {
  564.                 a.style.background = "url(" + a.Menu.bgImageUp +")";;
  565.             }
  566.         } 
  567.         if (l.isSeparator) return;
  568.         l.style.backgroundColor = l.menuHiliteBgColor;
  569.         l.zIndex = 1;  // magic IE 4.5 mac happy doohicky.    jba
  570.         if (l.Menu.bgImageOver) {
  571.             l.style.background = "url(" + l.Menu.bgImageOver +")";
  572.         }
  573.         if (l.hilite) {
  574.             l.style.backgroundColor = l.menuHiliteBgColor;
  575.             l.hilite.style.visibility = "inherit";
  576.         }
  577.         l.focusItem.style.top = l.focusItem.style.pixelTop = l.style.pixelTop;
  578.         l.focusItem.style.zIndex = l.zIndex +1;
  579.         l.Menu.hideChildMenu(l);
  580.     } else {
  581.         return; // not a menu - magic IE 4.5 mac happy doohicky.  jba
  582.     }
  583.     window.ActiveMenuItem = l;
  584. }
  585.  
  586. function onMenuItemAction(e, l) {
  587.     l = window.ActiveMenuItem;
  588.     if (!l) return;
  589.     hideActiveMenus();
  590.     if (l.action) {
  591.         eval("" + l.action);
  592.     }
  593.     window.ActiveMenuItem = 0;
  594. }
  595.  
  596. function FW_clearTimeout()
  597. {
  598.     if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer);
  599.     fwHideMenuTimer = null;
  600.     fwDHFlag = false;
  601. }
  602. function FW_startTimeout()
  603. {
  604.     fwStart = new Date();
  605.     fwDHFlag = true;
  606.     fwHideMenuTimer = setTimeout("fwDoHide()", 1000);
  607. }
  608.  
  609. function fwDoHide()
  610. {
  611.     if (!fwDHFlag) return;
  612.     var elapsed = new Date() - fwStart;
  613.     if (elapsed < 1000) {
  614.         fwHideMenuTimer = setTimeout("fwDoHide()", 1100-elapsed);
  615.         return;
  616.     }
  617.     fwDHFlag = false;
  618.     hideActiveMenus();
  619.     window.ActiveMenuItem = 0;
  620. }
  621.  
  622. function FW_showMenu(menu, x, y, child) {
  623.     if (!window.fwWroteMenu) return;
  624.     FW_clearTimeout();
  625.     if (document.layers) {
  626.         if (menu) {
  627.             var l = menu.menuLayer || menu;
  628.             l.left = 1;
  629.             l.top = 1;
  630.             hideActiveMenus();
  631.             if (this.visibility) l = this;
  632.             window.ActiveMenu = l;
  633.         } else {
  634.             var l = child;
  635.         }
  636.         if (!l) return;
  637.         for (var i=0; i<l.layers.length; i++) {                
  638.             if (!l.layers[i].isHilite) 
  639.                 l.layers[i].visibility = "inherit";
  640.             if (l.layers[i].document.layers.length > 0) 
  641.                 FW_showMenu(null, "relative", "relative", l.layers[i]);
  642.         }
  643.         if (l.parentLayer) {
  644.             if (x != "relative") 
  645.                 l.parentLayer.left = x + ScreenOffset || window.pageX || 0;
  646.             if (l.parentLayer.left + l.clip.width > window.innerWidth) 
  647.                 l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
  648.             if (y != "relative") 
  649.                 l.parentLayer.top = y || window.pageY || 0;
  650.             if (l.parentLayer.isContainer) {
  651.                 l.Menu.xOffset = window.pageXOffset;
  652.                 l.Menu.yOffset = window.pageYOffset;
  653.                 l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
  654.                 l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
  655.                 if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
  656.             }
  657.         }
  658.         l.visibility = "inherit";
  659.         if (l.Menu) l.Menu.container.visibility = "inherit";
  660.     } else if (FIND("menuItem0")) {
  661.         var l = menu.menuLayer || menu;    
  662.         hideActiveMenus();
  663.         if (typeof(l) == "string") {
  664.             l = FIND(l);
  665.         }
  666.         window.ActiveMenu = l;
  667.         var s = l.style;
  668.         s.visibility = "inherit";
  669.         if (x != "relative") 
  670.             s.left = s.pixelLeft = x + ScreenOffset || (window.pageX + document.body.scrollLeft) || 0;
  671.         if (y != "relative") 
  672.             s.top = s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
  673.         l.Menu.xOffset = document.body.scrollLeft;
  674.         l.Menu.yOffset = document.body.scrollTop;
  675.     }
  676.     if (menu) {
  677.         window.activeMenus[window.activeMenus.length] = l;
  678.     }
  679. }
  680.  
  681. function onMenuItemDown(e, l) {
  682.     var a = window.ActiveMenuItem;
  683.     if (document.layers) {
  684.         if (a) {
  685.             a.eX = e.pageX;
  686.             a.eY = e.pageY;
  687.             a.clicked = true;
  688.         }
  689.     }
  690. }
  691.  
  692. function mouseupMenu(e)
  693. {
  694.     hideMenu(true, e);
  695.     hideActiveMenus();
  696.     return true;
  697. }
  698.  
  699. function mouseoutMenu()
  700. {
  701.     hideMenu(false, false);
  702.     return true;
  703. }
  704.  
  705.  
  706. function hideMenu(mouseup, e) {
  707.     var a = window.ActiveMenuItem;
  708.     if (a && document.layers) {
  709.         a.document.bgColor = a.saveColor;
  710.         a.focusItem.top = -30;
  711.         if (a.hilite) a.hilite.visibility = "hidden";
  712.         if (mouseup && a.action && a.clicked && window.ActiveMenu) {
  713.              if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) {
  714.                 setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2);
  715.             }
  716.         }
  717.         a.clicked = false;
  718.         if (a.Menu.bgImageOver) {
  719.             a.background.src = a.Menu.bgImageUp;
  720.         }
  721.     } else if (window.ActiveMenu && FIND("menuItem0")) {
  722.         if (a) {
  723.             a.style.backgroundColor = a.saveColor;
  724.             if (a.hilite) a.hilite.style.visibility = "hidden";
  725.             if (a.Menu.bgImageUp) {
  726.                 a.style.background = "url(" + a.Menu.bgImageUp +")";;
  727.             }
  728.         }
  729.     }
  730.     if (!mouseup && window.ActiveMenu) {
  731.         if (window.ActiveMenu.Menu) {
  732.             if (window.ActiveMenu.Menu.hideOnMouseOut) {
  733.                 FW_startTimeout();
  734.             }
  735.             return(true);
  736.         }
  737.     }
  738.     return(true);
  739. }
  740.  
  741. function PxToNum(pxStr)
  742. { // pxStr == 27px, we want 27.
  743.     if (pxStr.length > 2) {
  744.         n = Number(pxStr.substr(0, pxStr.length-2));
  745.         return(n);
  746.     }
  747.     return(0);
  748. }
  749.  
  750. function hideChildMenu(hcmLayer) {
  751.     FW_clearTimeout();
  752.     var l = hcmLayer;
  753.     for (var i=0; i < l.Menu.childMenus.length; i++) {
  754.         var theLayer = l.Menu.childMenus[i];
  755.         if (document.layers) {
  756.             theLayer.visibility = "hidden";
  757.         } else {
  758.             theLayer = FIND(theLayer);
  759.             theLayer.style.visibility = "hidden";
  760.         }
  761.         theLayer.Menu.hideChildMenu(theLayer);
  762.     }
  763.  
  764.     if (l.childMenu) {
  765.         var childMenu = l.childMenu;
  766.         if (document.layers) {
  767.             l.Menu.FW_showMenu(null,null,null,childMenu.layers[0]);
  768.             childMenu.zIndex = l.parentLayer.zIndex +1;
  769.             childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top + l.Menu.menuItemHeight/3;
  770.             if (childMenu.left + childMenu.clip.width > window.innerWidth) {
  771.                 childMenu.left = l.parentLayer.left - childMenu.clip.width + l.Menu.menuLayer.left + 15;
  772.                 l.Menu.container.clip.left -= childMenu.clip.width;
  773.             } else {
  774.                 childMenu.left = l.parentLayer.left + l.parentLayer.clip.width  + l.Menu.menuLayer.left -5;
  775.             }
  776.             var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left;
  777.             if (w > l.Menu.container.clip.width)  
  778.                 l.Menu.container.clip.width = w;
  779.             var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top;
  780.             if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h;
  781.             l.document.layers[1].zIndex = 0;
  782.             childMenu.visibility = "inherit";
  783.         } else if (FIND("menuItem0")) {
  784.             childMenu = FIND(l.childMenu);
  785.             var menuLayer = FIND(l.Menu.menuLayer);
  786.             var s = childMenu.style;
  787.             s.zIndex = menuLayer.style.zIndex+1;
  788.             if (document.all) { // ie case.
  789.                 s.pixelTop = l.style.pixelTop + menuLayer.style.pixelTop + l.Menu.menuItemHeight/3;
  790.                 s.left = s.pixelLeft = (menuLayer.style.pixelWidth) + menuLayer.style.pixelLeft -5;
  791.             } else { // zilla case
  792.                 var top = PxToNum(l.style.top) + PxToNum(menuLayer.style.top) + l.Menu.menuItemHeight/3;
  793.                 var left = (PxToNum(menuLayer.style.width)) + PxToNum(menuLayer.style.left) -5;
  794.                 s.top = top;
  795.                 s.left = left;
  796.             }
  797.             childMenu.style.visibility = "inherit";
  798.         } else {
  799.             return;
  800.         }
  801.         window.activeMenus[window.activeMenus.length] = childMenu;
  802.     }
  803. }
  804.  
  805. function hideActiveMenus() {
  806.     if (!window.activeMenus) return;
  807.     for (var i=0; i < window.activeMenus.length; i++) {
  808.         if (!activeMenus[i]) continue;
  809.         if (activeMenus[i].visibility && activeMenus[i].Menu) {
  810.             activeMenus[i].visibility = "hidden";
  811.             activeMenus[i].Menu.container.visibility = "hidden";
  812.             activeMenus[i].Menu.container.clip.left = 0;
  813.         } else if (activeMenus[i].style) {
  814.             var s = activeMenus[i].style;
  815.             s.visibility = "hidden";
  816.             s.left = -200;
  817.             s.top = -200;
  818.         }
  819.     }
  820.     if (window.ActiveMenuItem) {
  821.         hideMenu(false, false);
  822.     }
  823.     window.activeMenus.length = 0;
  824. }