home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / tema / Ricany / TOOLBAR.JS < prev    next >
Text File  |  1999-01-01  |  18KB  |  578 lines

  1. var StyleStr = "";
  2. var ToolBar_Supported = false;
  3. var Frame_Supported   = false;
  4. var DoInstrumentation = false;
  5. var HTMLStr = "";
  6.  
  7. //alert(navigator.userAgent);
  8. if (navigator.userAgent.indexOf("MSIE")    != -1 && 
  9.     navigator.userAgent.indexOf("Windows") != -1 && 
  10.     navigator.appVersion.substring(0,1) > 3)
  11. {
  12.     ToolBar_Supported = true;
  13.     StyleStr =    "<STYLE type='text/css'>" +
  14.                 " A:link            { color:#003399; }" +
  15.                 " A:visited            { color:#003399; }" +
  16.                 " A:hover            { color:red;     }" +
  17.                 ".MSMenu            { font-weight:bold;font-size:xx-small;font-family:Verdana,Arial;text-decoration:none;cursor:hand;}" +
  18.                 ".ICPMenu            { font-weight:bold;font-size:xx-small;font-family:Verdana,Arial;text-decoration:none;cursor:hand;}" +
  19.                 "</STYLE>";
  20. }
  21.  
  22. if (ToolBar_Supported)
  23. {
  24.     var newLineChar = String.fromCharCode(10);
  25.     var char34 = String.fromCharCode(34);
  26.     var LockMSMenu = false;
  27.     var LockICPMenu = false;
  28.     var LastMSMenu = "";
  29.     var CurICPMenu = "";
  30.     var IsMSMenu = false;
  31.     var IsMenuDropDown = true;
  32.     var HTMLStr;
  33.     var x = 0;
  34.     var y = 0;
  35.     var x2 = 0;
  36.     var y2 = 0;
  37.     var MSMenuWidth;
  38.     var ToolbarMinWidth;
  39.     var ToolbarMenu;
  40.     var ToolbarBGColor;
  41.     var ToolbarLoaded = false;
  42.     var aDefMSColor  = new Array(3);
  43.     var aDefICPColor = new Array(3);
  44.     var aCurMSColor  = new Array(3);
  45.     var aCurICPColor = new Array(3);
  46.     
  47.  
  48.     // Output style sheet and toolbar ID
  49.     document.write(StyleStr);
  50.     document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");
  51.  
  52.     // Build toolbar template
  53.     HTMLStr = 
  54.         "<DIV ID='idToolbar'     STYLE='background-color:white;width:100%'>" +
  55.         "<DIV ID='idRow1'        STYLE='position:relative;height:20;'>" +
  56.         
  57.         "<DIV ID='idICPBanner'   STYLE='position:absolute;top:0;left:0;height:60;width:780;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>" +
  58.         "<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0;left:50;height:20;width:0;overflow:hidden;vertical-align:top;'><IMG SRC='ban.gif' BORDER=0></DIV>" +
  59.         "<DIV ID='idMSMenuPane'  CLASS='MSMenuPane' STYLE='position:absolute;top:0;left:250;height:20;width:10;background-color:blue;float:right;' NOWRAP><!--MS_MENU_TITLES--></DIV>" + 
  60.         "</DIV>" +
  61.         "<DIV ID='idRow2' STYLE='position:relative;left:250;height:40;'>" +
  62.         "<DIV ID='idADSBanner'   STYLE='position:absolute;top:0;left:0;height:40;width:300;vertical-align:top;overflow:hidden;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>" +
  63.         "<DIV ID='idMSCBanner'   STYLE='position:absolute;top:0;left:200;height:40;width:112;vertical-align:top;overflow:hidden;' ALIGN=RIGHT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>" +
  64.         "</DIV>" +
  65.         "<DIV ID='idRow3' STYLE='position:relative;height:20;width:100%'>" +
  66.         "<DIV ID='idICPMenuPane' CLASS='ICPMenuPane' STYLE='position:absolute;top:0;left:0;height:20;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>" +
  67.         "</DIV>" +
  68.         "</DIV>" + 
  69.         
  70.         "<SCRIPT TYPE='text/javascript'>" + 
  71.         "   var ToolbarMenu = StartMenu;" + 
  72.         
  73.         "</SCRIPT>" + 
  74.         "<DIV WIDTH=100%>";
  75.  
  76.     // Define event handlers
  77.     window.onresize  = resizeToolbar;
  78.     document.onmouseover = hideMenu;
  79.  
  80.     // Intialize global variables
  81.     ToolbarBGColor    = "white";            // toolbar background color
  82.     
  83.     aDefMSColor[1]    = aCurMSColor[1]  = "blue";    // bgcolor;
  84.     aDefMSColor[1]    = aCurMSColor[1]  = "white";    // text font color
  85.     aDefMSColor[2]  = aCurMSColor[2]  = "red";    // mouseover font color
  86.     
  87.     aDefICPColor[0]    = aCurICPColor[0] = "#6699CC";    // bgcolor;
  88.     aDefICPColor[1] = aCurICPColor[1] = "white";    // text font color
  89.     aDefICPColor[2] = aCurICPColor[2] = "red";    // mouseover font color
  90. }
  91.  
  92. // The hard-coded numbers in functions - drawToolbar() & resizeToolbar()
  93. // correspond to the dimension of the four gif files:
  94. //        ICP_BANNER: 60h x 250w
  95. //        ADS_BANNER: 40h x 200w
  96. //        MSC_BANNER: 40h x 112w
  97. //        Curve:        20h x 18w
  98.  
  99. function drawToolbar()
  100. {
  101.     HTMLStr += "</DIV>";
  102.     document.write(HTMLStr);
  103.     ToolbarLoaded = true;
  104.  
  105.     MSMenuWidth     = Math.max(idMSMenuPane.offsetWidth, (200+112));
  106.     ToolbarMinWidth = (250+18) + MSMenuWidth;
  107.  
  108.     idToolbar.style.backgroundColor     = ToolbarBGColor;
  109.     idMSMenuPane.style.backgroundColor  = aDefMSColor[0];
  110.     idICPMenuPane.style.backgroundColor = aDefICPColor[0];
  111.     resizeToolbar();
  112. }
  113.  
  114. function resizeToolbar()
  115. {
  116.     if (ToolBar_Supported == false) return;
  117.  
  118.     w = Math.max(ToolbarMinWidth, document.body.clientWidth) - ToolbarMinWidth;
  119.     
  120.     idMSMenuCurve.style.left  = (50+w);
  121.     idMSMenuPane.style.left   = (50+w+18);
  122.     idMSMenuPane.style.width  = MSMenuWidth;
  123.  
  124.     idADSBanner.style.left    = (w+18);
  125.  
  126.     idMSCBanner.style.left    = (w+18+200);
  127.     idMSCBanner.style.width   = (MSMenuWidth - 200);
  128.     
  129.     idICPMenuPane.style.width = ToolbarMinWidth + w;
  130. }
  131.  
  132. function setToolbarBGColor(color)
  133. {    
  134.     ToolbarBGColor = color;
  135.     if (ToolbarLoaded == true)
  136.         idToolbar.style.backgroundColor = ToolbarBGColor;
  137. }    
  138.  
  139. function setDefaultMSMenuColor(bgColor, fontColor, mouseoverColor)
  140. {    
  141.     if (bgColor   != "")      aDefMSColor[0] = bgColor;
  142.     if (fontColor != "")      aDefMSColor[1] = fontColor;
  143.     if (mouseoverColor != "") aDefMSColor[2] = mouseoverColor;
  144. }
  145.  
  146. function setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor)
  147. {    
  148.     if (bgColor   != "")      aDefICPColor[0] = bgColor;
  149.     if (fontColor != "")      aDefICPColor[1] = fontColor;
  150.     if (mouseoverColor != "") aDefICPColor[2] = mouseoverColor;
  151. }
  152.  
  153. function setICPMenuColor(MenuIDStr, bgColor, fontColor, mouseoverColor)
  154. {    
  155.     if (ToolbarLoaded == false) return;
  156.  
  157.     // Reset previous ICP Menu color if any
  158.     if (CurICPMenu != "")
  159.     {
  160.         PrevID = CurICPMenu.substring(4);
  161.         CurICPMenu = "";
  162.         setICPMenuColor(PrevID, aDefICPColor[0], aDefICPColor[1], aDefICPColor[2]);
  163.     }
  164.  
  165.     var    id = "AM_" + "ICP_" + MenuIDStr;
  166.     var thisMenu = document.all(id);
  167.     if (thisMenu != null)
  168.     {
  169.         CurICPMenu = "ICP_" + MenuIDStr;
  170.         aCurICPColor[0] = bgColor;
  171.         aCurICPColor[1] = fontColor;
  172.         aCurICPColor[2] = mouseoverColor;
  173.  
  174.         // Change menu color
  175.         if (bgColor != "")
  176.             thisMenu.style.backgroundColor = bgColor;
  177.         if (fontColor != "")
  178.             thisMenu.style.color = fontColor;
  179.  
  180.         // Change subMenu color
  181.         id = "ICP_" + MenuIDStr;
  182.         thisMenu = document.all(id);
  183.         if (thisMenu != null)
  184.         {
  185.             if (bgColor != "")
  186.                 thisMenu.style.backgroundColor = bgColor;
  187.             
  188.             if (fontColor != "")
  189.             {
  190.                 i = 0;
  191.                 id = "AS_" + "ICP_" + MenuIDStr;
  192.                 thisMenu = document.all.item(id,i);
  193.                 while (thisMenu != null)
  194.                 {
  195.                     thisMenu.style.color = fontColor;
  196.                     i += 1;
  197.                     thisMenu = document.all.item(id,i);
  198.                 }
  199.             }
  200.         }
  201.     }
  202. }
  203.  
  204. /**** Banner functions ****
  205.  ****/
  206. function setAds(Gif,Url,AltStr)
  207. {    setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
  208. }
  209.  
  210. function setICPBanner(Gif,Url,AltStr)
  211. {    setBanner(Gif,Url,AltStr,"<!--BEG_ICP_BANNER-->","<!--END_ICP_BANNER-->");
  212. }
  213.  
  214. function setMSBanner(Gif,Url,AltStr)
  215. {    tempGif = "" + Gif;
  216.     setBanner(tempGif,Url,AltStr,"<!--BEG_MSC_BANNER-->","<!--END_MSC_BANNER-->");
  217. }
  218.  
  219. function setBanner(BanGif, BanUrl, BanAltStr, BanBegTag, BanEndTag)
  220. {
  221.     begPos = HTMLStr.indexOf(BanBegTag);
  222.     endPos = HTMLStr.indexOf(BanEndTag) + BanEndTag.length;
  223.     
  224.     SubStr = HTMLStr.substring(begPos, endPos);
  225.     SrcStr = "";
  226.     if (BanUrl != "")
  227.         SrcStr += "<A HREF='" + formatURL(BanUrl, BanGif) + "'>";
  228.     SrcStr += "<IMG SRC='" + BanGif + "' ALT='" + BanAltStr + "' BORDER=0>";
  229.     if (BanUrl != "")
  230.         SrcStr += "</A>";
  231.     SrcStr = BanBegTag + SrcStr + BanEndTag;
  232.     HTMLStr = HTMLStr.replace(SubStr, SrcStr);
  233.     
  234. }
  235.  
  236. /**** Add Menu Function ***
  237.  ****/
  238. function addICPMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
  239. {     
  240.     if (LockICPMenu == true) return;
  241.  
  242.     if (addICPMenu.arguments.length > 4)
  243.         TargetStr = addICPMenu.arguments[4];
  244.     else
  245.         TargetStr = "_top";
  246.     tempID = "ICP_" + MenuIDStr;
  247.     addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, true); 
  248. }
  249.  
  250. function addMSMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
  251. {    
  252.     if (LockICPMenu == true) return;
  253.     TargetStr = "_top";
  254.     tempID = "MS_" + MenuIDStr;
  255.     addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, false); 
  256.     LastMSMenu = tempID;
  257. }
  258.  
  259. function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, bICPMenu)
  260. {
  261.     cStyle  = bICPMenu? "ICPMenu"        : "MSMenu";
  262.     cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
  263.     cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  264.     cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
  265.     tagStr  = bICPMenu? "<!--ICP_MENU_TITLES-->" : "<!--MS_MENU_TITLES-->";
  266.  
  267.     MenuStr = newLineChar;
  268.     if (bICPMenu == false && LastMSMenu != "")
  269.         MenuStr += "<SPAN CLASS='" + cStyle + "' STYLE='color:" + cColor1 + "'>| </SPAN>"; 
  270.     MenuStr += "<A TARGET='" + TargetStr + "' TITLE='" + MenuHelpStr + "'" +
  271.                "   ID='AM_" + MenuIDStr + "'" +
  272.                "   CLASS='" + cStyle + "'" +
  273.                "   STYLE='background-color:" + cColor0 + ";color:" + cColor1 + ";'";
  274.                
  275.     if (MenuURLStr != "")
  276.     {
  277.         if (bICPMenu)
  278.             MenuStr += " HREF='" + formatURL(MenuURLStr, ("ICP_" + MenuDisplayStr)) + "'";
  279.         else
  280.             MenuStr += " HREF='" + formatURL(MenuURLStr, ("MS_" + MenuDisplayStr)) + "'";
  281.     }
  282.     MenuStr +=     " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
  283.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
  284.                 " " + MenuDisplayStr + " </a>";
  285.     if (bICPMenu)
  286.         MenuStr += "<SPAN CLASS='" + cStyle + "' STYLE='color:" + cColor1 + "'> |</SPAN>";
  287.     MenuStr += tagStr;
  288.     
  289.     HTMLStr = HTMLStr.replace(tagStr, MenuStr);    
  290. }
  291.  
  292. /**** Add SubMenu Function ****
  293.  ****/
  294. function addICPSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
  295. {    
  296.     if (addICPSubMenu.arguments.length > 3)
  297.         TargetStr = addICPSubMenu.arguments[3];
  298.     else
  299.         TargetStr = "_top";
  300.     tempID = "ICP_" + MenuIDStr;
  301.     addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,true); 
  302. }
  303.  
  304. function addMSSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
  305. {    
  306.     TargetStr = "_top";
  307.     tempID = "MS_" + MenuIDStr;
  308.     addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,false); 
  309. }
  310.  
  311. function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
  312. {
  313.     cStyle  = bICPMenu? "ICPMenu"       : "MSMenu";
  314.     cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
  315.     cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  316.     cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
  317.     
  318.     var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
  319.     if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
  320.     InstrumentStr = MenuIDStr.substring(0 , MenuPos) + " | " + SubMenuStr;;
  321.     URLStr        = formatURL(SubMenuURLStr, InstrumentStr);
  322.  
  323.     var LookUpTag  = "<!--" + MenuIDStr + "-->";
  324.     var sPos = HTMLStr.indexOf(LookUpTag);
  325.     if (sPos <= 0)
  326.     {
  327.         HTMLStr += newLineChar + newLineChar +
  328.                 "<SPAN ID='" + MenuIDStr + "'" +
  329.                 " STYLE='display:none;position:absolute;width:160;background-color:" + cColor0 + ";padding-top:0;padding-left:0;padding-bottom:20;z-index:9;'" +
  330.                 " onmouseover='keepMenu();'>";
  331.  
  332.         if (Frame_Supported == false || bICPMenu == false)
  333.         {
  334.             HTMLStr +=
  335.                 "<HR  STYLE='position:absolute;left:0;top:0;color:" + cColor1 + "' SIZE=1>";
  336.         }
  337.         HTMLStr +=
  338.                 "<DIV STYLE='position:relative;left:0;top:8;'>" +
  339.                 "<A ID='AS_" + MenuIDStr + "'" +
  340.                 "   CLASS='" + cStyle + "'" + 
  341.                 "   STYLE='color:" + cColor1 + "'" +
  342.                 "   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
  343.                 " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
  344.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
  345.                 " " + SubMenuStr + "</A><BR>" + LookUpTag +
  346.                 "</DIV>" +
  347.                 "</SPAN>";
  348.     }
  349.     else
  350.     {
  351.         TempStr = newLineChar +
  352.                 "<A ID='AS_" + MenuIDStr + "'" +
  353.                 "   CLASS='" + cStyle + "'" + 
  354.                 "   STYLE='color:" + cColor1 + "'" +
  355.                 "   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
  356.                 " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
  357.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
  358.                 " " + SubMenuStr + "</A><BR>" + LookUpTag;
  359.         HTMLStr = HTMLStr.replace(LookUpTag, TempStr);    
  360.     }
  361. }
  362.  
  363. /**** Add SubMenuLine Functions ****
  364.  ****/
  365. function addICPSubMenuLine(MenuIDStr)
  366. {    
  367.     tempID = "ICP_" + MenuIDStr;
  368.     addSubMenuLine(tempID,true);
  369. }
  370.  
  371. function addMSSubMenuLine(MenuIDStr)
  372. {    
  373.     tempID = "MS_" + MenuIDStr;
  374.     addSubMenuLine(tempID,false);
  375. }
  376.  
  377. function addSubMenuLine(MenuIDStr, bICPMenu)
  378. {
  379.     var LookUpTag = "<!--" + MenuIDStr + "-->";
  380.     var sPos = HTMLStr.indexOf(LookUpTag);
  381.     if (sPos > 0)
  382.     {
  383.         cColor  = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  384.         TempStr = newLineChar + "<HR STYLE='color:" + cColor + "' SIZE=1>" + LookUpTag;
  385.         HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
  386.     }
  387. }
  388.  
  389. /**** Event Functions ****
  390.  ****/
  391.  
  392. // Change menu mouseover / mouseout color
  393. function mouseMenu(id, MenuIDStr) 
  394. {
  395.     IsMSMenu   = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  396.     IsMouseout = (id.toUpperCase().indexOf("OUT") != -1);
  397.  
  398.     if (IsMouseout)
  399.     {
  400.         color = IsMSMenu? aDefMSColor[1] : aDefICPColor[1];
  401.         if (MenuIDStr == CurICPMenu && aCurICPColor[1] != "") 
  402.             color = aCurICPColor[1];
  403.     }
  404.     else
  405.     {
  406.         color = IsMSMenu? aDefMSColor[2] : aDefICPColor[2];
  407.         if (MenuIDStr == CurICPMenu && aCurICPColor[2] != "") 
  408.             color = aCurICPColor[2];
  409.     }
  410.     window.event.srcElement.style.color = color;
  411. }
  412.  
  413. function doMenu(MenuIDStr) 
  414. {
  415.     var thisMenu = document.all(MenuIDStr);
  416.     if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu) 
  417.     {
  418.         window.event.cancelBubble = true;
  419.         return false;
  420.     }
  421.  
  422.     // Reset dropdown menu
  423.     window.event.cancelBubble = true;
  424.     ToolbarMenu.style.display = "none";
  425.     showElement("SELECT");
  426.     showElement("OBJECT");
  427.     ToolbarMenu = thisMenu;
  428.     IsMSMenu = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  429.  
  430.     // Set dropdown menu display position
  431.     x  = window.event.srcElement.offsetLeft +
  432.           window.event.srcElement.offsetParent.offsetLeft;
  433.     if (MenuIDStr == LastMSMenu)
  434.     {
  435.         x += (window.event.srcElement.offsetWidth - 200);
  436.         x2 = x + 200;
  437.     }
  438.     else
  439.     {
  440.         x2 = x + window.event.srcElement.offsetWidth;
  441.     }
  442.     y  = (IsMSMenu)? 
  443.          (idRow1.offsetHeight) :
  444.          (idRow1.offsetHeight + idRow2.offsetHeight + idRow3.offsetHeight);
  445.     thisMenu.style.top  = y;
  446.     thisMenu.style.left = x;
  447.     thisMenu.style.clip = "rect(0 0 0 0)";
  448.     thisMenu.style.display = "block";
  449.  
  450.     // delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
  451.     window.setTimeout("showMenu()", 2);
  452.     return true;
  453. }
  454.  
  455. function showMenu() 
  456. {
  457.     if (ToolbarMenu != null) 
  458.     { 
  459.         IsMenuDropDown = (Frame_Supported && IsMSMenu == false)? false : true;
  460.         if (IsMenuDropDown == false)
  461.         {
  462.             y = (y - ToolbarMenu.offsetHeight - idRow3.offsetHeight);
  463.             if (y < 0) y = 0;
  464.             ToolbarMenu.style.top = y;
  465.         }
  466.         y2 = y + ToolbarMenu.offsetHeight;
  467.  
  468.         ToolbarMenu.style.clip = "rect(auto auto auto auto)";
  469.         hideElement("SELECT");
  470.         hideElement("OBJECT");
  471.     }
  472. }
  473.  
  474. function hideMenu()
  475. {
  476.     if (ToolbarMenu != null && ToolbarMenu != StartMenu) 
  477.     {
  478.         // Don't hide the menu if the mouse move between the menu and submenus
  479.         cY = event.clientY + document.body.scrollTop;
  480.         if ( (event.clientX >= x && event.clientX <= x2 && event.clientX != (x+1)) &&
  481.              ((IsMenuDropDown == true  && cY > (y-10) && cY <= y2)      ||
  482.               (IsMenuDropDown == false && cY >= y     && cY <= (y2+10)) ))
  483.         {
  484.             window.event.cancelBubble = true;
  485.             return; 
  486.         }
  487.  
  488.         ToolbarMenu.style.display = "none";
  489.         ToolbarMenu = StartMenu;
  490.         window.event.cancelBubble = true;
  491.  
  492.         showElement("SELECT");
  493.         showElement("OBJECT");
  494.     }
  495. }
  496.  
  497. function keepMenu()
  498. {
  499.     window.event.cancelBubble = true;
  500. }
  501.  
  502. function hideElement(elmID)
  503. {
  504.     // Hide any element that overlaps with the dropdown menu
  505.     for (i = 0; i < document.all.tags(elmID).length; i++)
  506.     {
  507.         obj = document.all.tags(elmID)[i];
  508.  
  509.         // Find the element's offsetTop and offsetLeft relative to the BODY tag.
  510.         objLeft   = obj.offsetLeft;
  511.         objTop    = obj.offsetTop;
  512.         objParent = obj.offsetParent;
  513.         while (objParent.tagName.toUpperCase() != "BODY")
  514.         {
  515.             objLeft  += objParent.offsetLeft;
  516.             objTop   += objParent.offsetTop;
  517.             objParent = objParent.offsetParent;
  518.         }
  519.         // Adjust the element's offsetTop relative to the dropdown menu
  520.         objTop = objTop - y;
  521.  
  522.         if (x > (objLeft + obj.offsetWidth) || objLeft > (x + ToolbarMenu.offsetWidth))
  523.             ;
  524.         else if (objTop > ToolbarMenu.offsetHeight)
  525.             ;
  526.         else if (IsMSMenu && (y + ToolbarMenu.offsetHeight) <= 80)
  527.             ;
  528.         else
  529.         {
  530.             obj.style.visibility = "hidden";
  531.         }
  532.     }
  533. }
  534.  
  535. function showElement(elmID)
  536. {
  537.     // Display any element that was hiddend
  538.     for (i = 0; i < document.all.tags(elmID).length; i++)
  539.         document.all.tags(elmID)[i].style.visibility = "";
  540. }
  541.  
  542. function formatURL(URLStr, InstrumentStr)
  543. {
  544.     var tempStr = URLStr;
  545.  
  546.     if (DoInstrumentation && URLStr != "" )
  547.     {
  548.         var ParamPos1 = URLStr.indexOf("?");
  549.         var ParamPos2 = URLStr.lastIndexOf("?");
  550.         var ParamPos3 = URLStr.toLowerCase().indexOf("target=");
  551.  
  552.         if (ParamPos1 == -1)
  553.             tempStr = "?MSCOMTB=";
  554.         else if (ParamPos1 == ParamPos2 && ParamPos3 == -1)    
  555.             tempStr = "&MSCOMTB=";
  556.         else if (ParamPos1 == ParamPos2 && ParamPos3 != -1)    
  557.             tempStr = "?MSCOMTB=";
  558.         else if (ParamPos1 < ParamPos2)
  559.             tempStr = "&MSCOMTB=";
  560.  
  561.         tempStr = URLStr + tempStr + InstrumentStr;
  562.     }
  563.     return tempStr;
  564. }
  565.  
  566. function Lock(FunctionName )
  567. {
  568.     var FName = FunctionName.toUpperCase();
  569.     if ( FName == "ADDICPMenu" )
  570.     {
  571.         LockICPMenu = true;
  572.     }
  573.     else if ( FName == "ADDMSMenu" )
  574.     {
  575.         LockMSMenu = true;    
  576.     }
  577. }
  578.