home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2001 January / PCpro_2001_01.IMG / library / toolbar.js
Encoding:
Text File  |  2000-01-24  |  18.5 KB  |  622 lines

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