home *** CD-ROM | disk | FTP | other *** search
/ Chip: 2001 Haziran / CHIP Haziran2001.iso / prog / share / 16 / setup.exe / %AppDir% / AddIns / AutoCloseTimer.ext next >
Encoding:
Text File  |  2001-04-24  |  18.2 KB  |  646 lines

  1. This AddIn will automaticlly close any opened menus after a defined period of time if the mouse is not over any menu.
  2. ***
  3. //COPYRIGHT
  4.     
  5.     var nStyle = new Array;
  6.     var hStyle = new Array;
  7.     var nLayer = new Array;
  8.     var hLayer = new Array;
  9.     var nTCode = new Array;
  10.     
  11.     var AnimStep = 0;
  12.     var AnimHnd = 0;
  13.     var HTHnd = new Array;
  14.     var DoFormsTweak = true;
  15.     
  16.     var mFrame;
  17.     var cFrame;
  18.     
  19.     var OpenMenus = new Array;
  20.     var SelCommand;
  21.     var nOM = 0;
  22.     
  23.     var mX;
  24.     var mY;
  25.     var xOff = 0;
  26.     
  27.     var HideSpeed = 200;
  28.     
  29.     var TimerHideDelay = 2000;
  30.     var TimerHideHnd = 0;
  31.     var IsOverHS = false;
  32.     
  33. //BROWSERDETECTION
  34.     
  35.     if((!IsWin&&IE)||SM) {
  36.     frames.self = window;
  37.     frames.top = top;
  38.     }
  39.     
  40.     if(IE)
  41.     xOff = (SM&&!OP)?-9:2;
  42. //CODEFRAME
  43.     
  44. //FX
  45.     
  46. //STYLECODE
  47.  
  48.     function GetCurCmd(e) {
  49.         //IE
  50.         //This function will return the current command under the mouse pointer.
  51.         //It will return null if the mouse is not over any command.
  52.         //------------------------------
  53.         //Version 1.3
  54.         //
  55.         if(SM)
  56.             var cc = e;
  57.         else
  58.             var cc = mFrame.window.event.srcElement;
  59.         while(cc.id=="") {
  60.             cc = cc.parentElement;
  61.             if(cc==null)
  62.                 break;
  63.         }
  64.         return cc;
  65.     }
  66.  
  67.     function HoverSel(mode, imgLName, imgRName, e) {
  68.         //IE
  69.         //This is the function called every time the mouse pointer is moved over a command.
  70.         //------------------------------
  71.         //mode: 0 if the mouse is moving over the command and 1 if is moving away.
  72.         //imgLName: Name of the left image object, if any.
  73.         //imgRName: Name of the right image object, if any.
  74.         //------------------------------
  75.         //Version 9.3
  76.         //
  77.         var imgL = new Image;
  78.         var imgLRsc = new Image;
  79.         var imgR = new Image;
  80.         var imgRRsc = new Image;
  81.         var nStyle;
  82.         var mc;
  83.         
  84.         if(mode==0 && OpenMenus[nOM].SelCommand!=null)
  85.             HoverSel(1);
  86.         
  87.         if(imgLName!="_")
  88.             var imgL = eval("mFrame.document.images['"+imgLName+"']");
  89.         if(imgRName!="_")
  90.             var imgR = eval("mFrame.document.images['"+imgRName+"']");
  91.         
  92.         if(mode==0) {
  93.             mc = GetCurCmd(e);
  94.             if(nOM>1)
  95.                 if(mc==OpenMenus[nOM-1].SelCommand)
  96.                     return false;
  97.             if(OpenMenus[nOM].SelCommand || nOM>1)
  98.                 while(!InMenu()&&nOM>1)
  99.                     Hide();
  100.             if(imgLName!='_') imgLRsc = eval(imgLName+"On");
  101.             if(imgRName!='_') imgRRsc = eval(imgRName+"On");
  102.             OpenMenus[nOM].SelCommand = mc;
  103.             OpenMenus[nOM].SelCommandPar = [imgLName,imgRName,SM?mc.getAttribute("style"):mc.style.cssText];
  104.             if(SM)
  105.                 mc.setAttribute("style", GetCStyle(mc.style) + hStyle[mc.id]);
  106.             else
  107.                 mc.style.cssText = GetCStyle(mc.style) + hStyle[mc.id];
  108.         } else {
  109.             mc = (mode==1)?OpenMenus[nOM].SelCommand:OpenMenus[nOM].Opener;
  110.             imgLName = (mode==1)?OpenMenus[nOM].SelCommandPar[0]:OpenMenus[nOM].OpenerPar[0];
  111.             imgRName = (mode==1)?OpenMenus[nOM].SelCommandPar[1]:OpenMenus[nOM].OpenerPar[1];
  112.             nStyle = (mode==1)?OpenMenus[nOM].SelCommandPar[2]:OpenMenus[nOM].OpenerPar[2];
  113.             mc.style.background = "";
  114.             if(SM)
  115.                 mc.setAttribute("style", nStyle);
  116.             else
  117.                 mc.style.cssText = nStyle;
  118.             if(imgLName!='_') imgLRsc = eval(imgLName+"Off");
  119.             if(imgRName!='_') imgRRsc = eval(imgRName+"Off");
  120.             window.status = "";
  121.             OpenMenus[nOM].SelCommand = null;            
  122.         }
  123.         
  124.         if(imgLName!='_') {
  125.             imgL = eval("mFrame.document.images."+imgLName);
  126.             imgL.src = imgLRsc.src;
  127.         }
  128.         if(imgRName!='_') {
  129.             imgR = eval("mFrame.document.images."+imgRName);
  130.             imgR.src = imgRRsc.src;
  131.         }
  132.         
  133.         return true;
  134.     }
  135.  
  136.     function NSHoverSel(mode, mc, bcolor) {
  137.         //NS
  138.         //This is the function called every time the mouse pointer is moved over or away from a command.
  139.         //------------------------------
  140.         //mode: 0 if the mouse is moving over the command and 1 if is moving away.
  141.         //mc: Name of the layer that corresponds to the selected command.
  142.         //n: Unique ID that identifies this command. Used to retrieve the data from the nLayer or hLayer array.
  143.         //bcolor: Background color of the command. Ignored if the group uses a background image.
  144.         //w: Width of the command's layer.
  145.         //h: Height of the command's layer.
  146.         //------------------------------
  147.         //Version 10.5
  148.         //
  149.         var n;
  150.         var LayerHTM;
  151.         
  152.         window.clearTimeout(CBparseInt(HTHnd[nOM]));HTHnd[nOM] = 0;
  153.         if(!nOM) return false;
  154.         
  155.         if(mode==0 && OpenMenus[nOM].SelCommand!=null)
  156.             NSHoverSel(1);
  157.         
  158.         if(mode==0) {
  159.             mc = mc.parentLayer.layers[mc.name.substr(0, mc.name.indexOf("EH"))];
  160.             n = CBparseInt(mc.name.substr(2));
  161.             if(nOM>1)
  162.                 if(mc==OpenMenus[nOM-1].SelCommand)
  163.                     return false;
  164.             while(!InMenu()&&nOM>1)
  165.                 Hide();
  166.             LayerHTM = hLayer[n];
  167.             OpenMenus[nOM].SelCommand = mc;
  168.             OpenMenus[nOM].SelCommandPar = mc.bgColor;
  169.             mc.bgColor = bcolor;
  170.         } else {
  171.             mc = (mode==1)?OpenMenus[nOM].SelCommand:OpenMenus[nOM].Opener;
  172.             bcolor = (mode==1)?OpenMenus[nOM].SelCommandPar:OpenMenus[nOM].OpenerPar;
  173.             n = CBparseInt(mc.name.substr(2));
  174.             LayerHTM = nLayer[n];
  175.             if(mc.parentLayer.background.src!="")
  176.                 mc.bgColor = null;
  177.             else
  178.                 mc.bgColor = bcolor;
  179.             window.status = "";
  180.             OpenMenus[nOM].SelCommand = null;
  181.         }
  182.         mc.clip.width = mc.parentLayer.parentLayer.clip.width - 2*mc.parentLayer.left;
  183.         mc.document.open();
  184.         mc.document.write(LayerHTM);
  185.         mc.document.close();
  186.         
  187.         return true;
  188.     }
  189.  
  190.     function Hide() {
  191.         //IE,NS
  192.         //This function hides the last opened group and it keeps hiding all the groups until
  193.         //no more groups are opened or the mouse is over one of them.
  194.         //Also takes care of reseting any highlighted commands.
  195.         //------------------------------
  196.         //Version 3.2
  197.         //
  198.         window.clearTimeout(HTHnd[nOM]);HTHnd[nOM] = 0;
  199.         window.clearTimeout(AnimHnd);AnimHnd = 0;
  200.         
  201.         if(OpenMenus[nOM].SelCommand!=null) {
  202.             if(IE) HoverSel(1);
  203.             if(NS) NSHoverSel(1);
  204.         }
  205.         if(OpenMenus[nOM].Opener!=null) {
  206.             if(IE) HoverSel(3);
  207.             if(NS) NSHoverSel(3);
  208.         }
  209.         
  210.         OpenMenus[nOM].visibility = "hidden";
  211.         nOM--;
  212.         
  213.         if(nOM>0)
  214.             if(!InMenu())
  215.                 HTHnd[nOM] = window.setTimeout("Hide()", HideSpeed/4);
  216.         
  217.         if(nOM==0)
  218.             FormsTweak("visible");
  219.     }
  220.  
  221.     function ShowMenu(mName, x, y, isCascading) {
  222.         //IE,NS
  223.         //This is the main function to show the menus when a hotspot is triggered or a cascading command is activated.
  224.         //------------------------------
  225.         //mName: Name of the <div> or <layer> to be shown.
  226.         //x: Left position of the menu.
  227.         //y: Top position of the menu.
  228.         //isCascading: True if the menu has been triggered from a command, and not from a hotspot.
  229.         //------------------------------
  230.         //Version 14.0
  231.         //
  232.         window.clearTimeout(CBparseInt(HTHnd[nOM]));HTHnd[nOM] = 0;
  233.         x = CBparseInt(x);y = CBparseInt(y);
  234.         
  235.         if(AnimHnd && nOM>0) {
  236.             AnimStep=101;
  237.             Animate();
  238.         }
  239.         if(IE)
  240.             if(SM)
  241.                 var Menu = mFrame.document.getElementById(mName);
  242.             else
  243.                 var Menu = mFrame.document.all[mName];
  244.         if(NS)
  245.             var Menu = mFrame.document.layers[mName];
  246.         if(!Menu)
  247.             return false;
  248.         if(IE)
  249.             Menu = Menu.style;
  250.         if(Menu==OpenMenus[nOM])
  251.             return false;
  252.             
  253.         if(!isCascading)
  254.             HideAll();
  255.             
  256.         Menu.Opener = nOM>0?OpenMenus[nOM].SelCommand:null;
  257.         Menu.OpenerPar = nOM>0?OpenMenus[nOM].SelCommandPar:null;
  258.         Menu.SelCommand = null;
  259.         if(OP) {
  260.             Menu.width = Menu.pixelWidth;
  261.             Menu.height = Menu.pixelHeight;
  262.         }
  263.         
  264.         var pW = GetWidthHeight()[0] + GetLeftTop()[0];
  265.         var pH = GetWidthHeight()[1] + GetLeftTop()[1];
  266.         
  267.         if(IE) {
  268.             if(isCascading) {
  269.                 x = CBparseInt(OpenMenus[nOM].left) + CBparseInt(OpenMenus[nOM].width) - 6;
  270.                 y = CBparseInt(OpenMenus[nOM].SelCommand.style.top) + CBparseInt(OpenMenus[nOM].top) - y;
  271.                 Menu.left = (x+CBparseInt(Menu.width)>pW)?CBparseInt(OpenMenus[nOM].left) - CBparseInt(Menu.width) + 6:x;
  272.                 Menu.top =  (y+CBparseInt(Menu.height)>pH)?pH - CBparseInt(Menu.height):y;
  273.             } else {
  274.                 Menu.left = (x+CBparseInt(Menu.width)>pW)?pW - CBparseInt(Menu.width):x;
  275.                 Menu.top =  (y+CBparseInt(Menu.height)>pH)?pH - CBparseInt(Menu.height):y;
  276.             }
  277.             if(IsWin&&!SM)
  278.                 Menu.clip = "rect(0 0 0 0)";
  279.         }
  280.         if(NS) {
  281.             if(isCascading) {
  282.                 x = OpenMenus[nOM].left + OpenMenus[nOM].clip.width - 6;
  283.                 y = OpenMenus[nOM].top + OpenMenus[nOM].SelCommand.top;
  284.                 x = (x+Menu.w>pW)?OpenMenus[nOM].left - Menu.w + 6:x;
  285.                 y = (y+Menu.h>pH)?pH - Menu.h:y;
  286.             } else {
  287.                 x = (x+Menu.w>pW)?pW - Menu.w:x;
  288.                 y = (y+Menu.h>pH)?pH - Menu.h:y;
  289.             }
  290.             Menu.clip.width = 0;
  291.             Menu.clip.height = 0;
  292.             Menu.moveToAbsolute(x,y);
  293.         }
  294.         if(isCascading)
  295.             Menu.zIndex = CBparseInt(OpenMenus[nOM].zIndex) + 1;
  296.         Menu.visibility = "visible";
  297.         OpenMenus[++nOM] = Menu;
  298.         HTHnd[nOM] = 0;
  299.         if((IE&&IsWin&&!SM)||NS)
  300.             AnimHnd = window.setTimeout("Animate()", 10);
  301.         FormsTweak("hidden");
  302.         
  303.         if(!isCascading)
  304.             IsOverHS = true;
  305.         window.clearTimeout(TimerHideHnd);
  306.         TimerHideHnd = window.setTimeout("AutoHide()", TimerHideDelay);
  307.         
  308.         return true;
  309.     }
  310.  
  311.     function Animate() {
  312.         //IE,NS
  313.         //This function is called by ShowMenu every time a new group must be displayed and produces the predefined unfolding effect.
  314.         //Currently is disabled for Navigator, because of some weird bugs we found with the clip property of the layers.
  315.         //------------------------------
  316.         //Version 1.9
  317.         //
  318.         var r = '';
  319.         var nw = nh = 0;
  320.         switch(fx) {
  321.             case 1:
  322.                 if(IE) r = "0 " + AnimStep + "% " + AnimStep + "% 0";
  323.                 if(NS) nw = AnimStep; nh = AnimStep;
  324.                 break;
  325.             case 2:
  326.                 if(IE) r = "0 100% " + AnimStep + "% 0";
  327.                 if(NS) nw = 100; nh = AnimStep;
  328.                 break;
  329.             case 3:
  330.                 if(IE) r = "0 " + AnimStep + "% 100% 0";
  331.                 if(NS) nw = AnimStep; nh = 100;
  332.                 break;
  333.             case 0:
  334.                 if(IE) r = "0 100% 100% 0";
  335.                 if(NS) nw = 100; nh = 100;
  336.                 break;
  337.         }
  338.         if(OpenMenus[nOM]) {
  339.             with(OpenMenus[nOM]) {
  340.                 if(IE)
  341.                     clip =  "rect(" + r + ")";
  342.                 if(NS) {
  343.                     clip.width = w*(nw/100);
  344.                     clip.height = h*(nh/100);
  345.                 }
  346.             }
  347.             AnimStep += 20;
  348.             if(AnimStep<=100)
  349.                 AnimHnd = window.setTimeout("Animate()",25);
  350.             else {
  351.                 window.clearTimeout(AnimHnd);
  352.                 AnimStep = 0;
  353.                 AnimHnd = 0;
  354.             }
  355.         }
  356.     }
  357.  
  358.     function InMenu() {
  359.         //IE,NS
  360.         //This function returns true if the mouse pointer is over the last opened menu.
  361.         //------------------------------
  362.         //Version 1.6
  363.         //
  364.         var m = OpenMenus[nOM];
  365.         if(!m)
  366.             return false;
  367.         if(IE&&!SM)
  368.             SetPointerPos();            
  369.         var l = CBparseInt(m.left) + xOff;
  370.         var r = l+(IE?CBparseInt(m.width):m.clip.width) - xOff;
  371.         var t = CBparseInt(m.top) + xOff;
  372.         var b = t+(IE?CBparseInt(m.height):m.clip.height) - xOff;
  373.         return ((mX>=l && mX<=r) && (mY>=t && mY<=b));
  374.     }
  375.  
  376.     function SetPointerPos(e) {
  377.         //IE,NS
  378.         //This function sets the mX and mY variables with the current position of the mouse pointer.
  379.         //------------------------------
  380.         //e: Only used under Navigator, corresponds to the Event object.
  381.         //------------------------------
  382.         //Version 1.0
  383.         //
  384.         if(IE) {
  385.             if(!SM) {
  386.                 if(mFrame!=cFrame||event==null)
  387.                     if(mFrame.window.event==null)
  388.                         return;
  389.                     else
  390.                         e = mFrame.window.event;
  391.                 else
  392.                     e = event;
  393.             }
  394.             mX = e.clientX + GetLeftTop()[0];
  395.             mY = e.clientY + GetLeftTop()[1];
  396.         }
  397.         if(NS) {
  398.             mX = e.pageX;
  399.             mY = e.pageY;
  400.         }
  401.     }
  402.  
  403.     function HideMenus(e) {
  404.         //IE,NS
  405.         //This function checks if the mouse pointer is on a valid position and if the current menu should be kept visible.
  406.         //The function is called every time the mouse pointer is moved over the document area.
  407.         //------------------------------
  408.         //e: Only used under Navigator, corresponds to the Event object.
  409.         //------------------------------
  410.         //Version 25.0
  411.         //
  412.         if(nOM>0) {
  413.             SetPointerPos(e);
  414.             if(OpenMenus[nOM].SelCommand!=null)
  415.                 if(!InMenu()&&!HTHnd[nOM])
  416.                     HTHnd[nOM] = window.setTimeout("if(nOM>0)if(!InMenu())Hide()", HideSpeed);
  417.         }
  418.     }
  419.  
  420.     function FormsTweak(state) {
  421.         //IE
  422.         //This is an undocumented function, which can be used to hide every listbox (or combo) element on a page.
  423.         //This can be useful if the menus will be displayed over an area where is a combo box, which is an element that cannot be placed behind the menus and it will always appear over the menus resulting in a very undesirable effect.
  424.         //------------------------------
  425.         //Version 2.0
  426.         //
  427.         if(DoFormsTweak && IE)
  428.             for(var f = 0; f <= (mFrame.document.forms.length - 1); f++)
  429.                 for(var e = 0; e <= (mFrame.document.forms[f].elements.length - 1); e++)
  430.                     if(mFrame.document.forms[f].elements[e].type=="select-one")
  431.                         mFrame.document.forms[f].elements[e].style.visibility = state;
  432.     }
  433.  
  434.     function execURL(url, tframe) {
  435.         //IE,NS
  436.         //This function is called every time a command is triggered to jump to another page or execute some javascript code.
  437.         //------------------------------
  438.         //url: Encrypted URL that must be opened or executed.
  439.         //tframe: If the url is a document location, tframe is the target frame where this document will be opened.
  440.         //------------------------------
  441.         //Version 1.1
  442.         //
  443.         HideAll();
  444.         window.setTimeout("execURL2('" + url + "', '" + tframe + "')", 100);
  445.     }
  446.  
  447.     function execURL2(url, tframe) {
  448.         //IE,NS
  449.         //This function is called every time a command is triggered to jump to another page or execute some javascript code.
  450.         //------------------------------
  451.         //url: Encrypted URL that must be opened or executed.
  452.         //tframe: If the url is a document location, tframe is the target frame where this document will be opened.
  453.         //------------------------------
  454.         //Version 1.0
  455.         //
  456.         var fObj = eval(rStr(tframe));
  457.         url = rStr(url);
  458.         url.indexOf("javascript")!=url.indexOf("vbscript")?eval(url):fObj.location.href = url;
  459.     }
  460.  
  461.     function rStr(s) {
  462.         //IE,NS
  463.         //This function is used to decrypt the URL parameter from the triggered command.
  464.         //------------------------------
  465.         //Version 1.1
  466.         //
  467.         s = xrep(s,"\x1E","'");
  468.         s = xrep(s,"\x1D","\x22");
  469.         s = xrep(s,"\x1C",",");
  470.         return s;
  471.     }
  472.  
  473.     function xrep(s, f, n) {
  474.         //IE,NS
  475.         //This function looks for any occurrence of the f string and replaces it with the n string.
  476.         //------------------------------
  477.         //Version 1.0
  478.         //
  479.         var tmp = s.split(f);
  480.         return tmp.join(n);
  481.     }
  482.  
  483.     function hNSCClick(e) {
  484.         //NS
  485.         //This function executes the selected command's trigger code.
  486.         //------------------------------
  487.         //Version 1.0
  488.         //
  489.         eval(this.TCode);
  490.     }
  491.  
  492.     function CBparseInt(n) {
  493.         //NS
  494.         //his function fixes a bug in Navigator's parseInt() function for the Mac.
  495.         //-----------------------------
  496.         //ersion 1.0
  497.         //
  498.         if(typeof(n)=="number"||typeof(n)=="string")
  499.             return (!IsWin&&!SM?n:parseInt(n))*1;
  500.         return 0;
  501.     }
  502.  
  503.     function HideAll() {
  504.         //IE,NS
  505.         //This function will hide all the currently opened menus.
  506.         //------------------------------
  507.         //Version 1.0
  508.         //
  509.         while(nOM>0)
  510.             Hide();
  511.     }
  512.  
  513.     function GetLeftTop() {
  514.         //IE,NS
  515.         //This function returns the scroll bars position on the menus frame.
  516.         //------------------------------
  517.         //Version 1.0
  518.         //
  519.         if(IE)
  520.             return [OP?0:SM?mFrame.scrollX:mFrame.document.body.scrollLeft,OP?0:SM?mFrame.scrollY:mFrame.document.body.scrollTop];
  521.         if(NS)
  522.             return [mFrame.pageXOffset,mFrame.pageYOffset];
  523.     }
  524.  
  525.     function tHideAll() {
  526.         //IE,NS
  527.         //This function is called when the mouse is moved away from a hotspot to close any opened menu.
  528.         //------------------------------
  529.         //Version 1.0
  530.         //
  531.         IsOverHS = false;
  532.         HTHnd[nOM] = window.setTimeout("if(!InMenu()&&nOM==1)HideAll(); else HTHnd[nOM]=0;", HideSpeed);
  533.     }
  534.  
  535.     function GetWidthHeight() {
  536.         //IE,NS
  537.         //This function returns the width and height of the menus frame.
  538.         //------------------------------
  539.         //Version 1.0
  540.         //
  541.         if(IE&&!SM)
  542.             return [mFrame.document.body.clientWidth,mFrame.document.body.clientHeight];
  543.         if(NS||SM)
  544.             return [mFrame.innerWidth,mFrame.innerHeight];
  545.     }
  546.  
  547.     function GetCStyle(cmc) {
  548.         //IE,SM
  549.         //This functions completes the style of command with all the common
  550.         //parameters from the original style code.
  551.         //------------------------------
  552.         //Version 1.0
  553.         //
  554.         return "position: absolute; left:" + cmc.left + 
  555.                "; top: " + cmc.top + 
  556.                "; width: " + (OP?cmc.pixelWidth:cmc.width) + 
  557.                "; height: " + (OP?cmc.pixelHeight:cmc.height) + "; ";
  558.     }
  559.  
  560.     function SetUpEvents() {
  561.         //IE,NS
  562.         //This function initializes the frame variables and setups the event handling.
  563.         //------------------------------
  564.         //Version 1.2
  565.         //
  566.         onerror = errHandler;
  567.         if(typeof(mFrame)=="undefined")
  568.         //MENUFRAME
  569.         if(typeof(mFrame)=="undefined")
  570.             window.setTimeout("SetUpEvents()",10);
  571.         else {
  572.             if(NS) {
  573.                 mFrame.captureEvents(Event.MOUSEMOVE);
  574.                 mFrame.onmousemove = HideMenus;
  575.                 mFrame.window.captureEvents(Event.MOUSEDOWN);
  576.                 PrepareEvents();
  577.             }
  578.             if(IE) {
  579.                 document.onmousemove = HideMenus;
  580.                 mFrame.document.onmousemove = document.onmousemove;
  581.             }
  582.         }
  583.     }
  584.  
  585.     function errHandler(sMsg,sUrl,sLine) {
  586.         //E,NS
  587.         //his function will trap any errors generated by the scripts and filter the unhandled ones.
  588.         //-----------------------------
  589.         //ersion 1.0
  590.         //
  591.         if(sMsg.substr(0,16)!="Access is denied"&&sMsg!="Permission denied")
  592.             alert("DHTML Menu Builder Java Script Error\n" +
  593.                   "\nDescription: " + sMsg +
  594.                   "\nSource: " + sUrl +
  595.                   "\nLine: "+sLine);
  596.         return true;
  597.     }
  598.  
  599.     function PrepareEvents() {
  600.         //NS
  601.         //This function is called right after the menus are rendered.
  602.         //It has been designed to attach the OnClick event to the <layer> tag. This is being
  603.         //done this way because Navigator does not support a click inline event capturing on
  604.         //the layer tag... duh!
  605.         //------------------------------
  606.         //Version 2.1
  607.         //
  608.         for(var l=0; l<mFrame.document.layers.length; l++) {
  609.             var lo = mFrame.document.layers[l];
  610.             if(lo.layers.length) {
  611.                 lo.w = lo.clip.width;
  612.                 lo.h = lo.clip.height;
  613.                 for(var sl=0; sl<lo.layers[0].layers.length; sl++) {
  614.                     var slo = mFrame.document.layers[l].layers[0].layers[sl];
  615.                     if(slo.name.indexOf("EH")>0) {
  616.                         slo.document.onmouseup = hNSCClick;
  617.                         slo.document.TCode = nTCode[slo.name.split("EH")[1]];
  618.                     }                    
  619.                 }
  620.             }
  621.         }
  622.     }
  623.  
  624.     function AutoHide() {
  625.         //IE,NS
  626.         //
  627.         //
  628.         var original_nOM = nOM;
  629.         var OktoClose = true;
  630.         for(;nOM>0;nOM--)
  631.             if(InMenu()) {
  632.                 OktoClose = false;
  633.                 break;
  634.             }
  635.         nOM = original_nOM;
  636.         if(OktoClose&&!IsOverHS)
  637.             HideAll();
  638.         
  639.         TimerHideHnd = window.setTimeout("AutoHide()", TimerHideDelay);
  640.         
  641.     }
  642.  
  643. //BROWSERCODE
  644. //EXPAND
  645.  
  646.