home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / servis / patch / www / patch_soubory / toolbar.js < prev   
Encoding:
Text File  |  2002-02-05  |  22.4 KB  |  750 lines

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