home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / ChipCD_1.03.iso / servis / msiecu / 501sp3 / MS02-066_soubory / toolbar.js < prev   
Text File  |  2002-11-25  |  37KB  |  1,187 lines

  1. var RTL = false;
  2. var scFlag = false;
  3. var scrollcount = 0;
  4. if (document.dir == 'rtl')
  5.      RTL = true;
  6. var Strict_Compat = false;
  7. var ToolBar_Supported = false;
  8. var Frame_Supported   = false;
  9. var DoInstrumentation = false;
  10. var doImage = doImage;
  11. var TType = TType;
  12.  
  13. if (navigator.userAgent.indexOf("MSIE")    != -1 && 
  14.     navigator.userAgent.indexOf("Windows") != -1 && 
  15.     navigator.appVersion.substring(0,1) > 3)
  16. {
  17.     ToolBar_Supported = true;
  18.     if(!RTL){
  19.         if (document.compatMode == "CSS1Compat")
  20.         {
  21.             //alert("strict!");
  22.             Strict_Compat = true;
  23.         }
  24.     }    
  25. }
  26.  
  27. if(doImage == null)
  28. {
  29.     var a= new Array();
  30.     a[0] = prepTrackingString(window.location.hostname,7);
  31.     if (TType == null)
  32.     {    
  33.         a[1] = prepTrackingString('PV',8);
  34.     }
  35.     else
  36.     {
  37.         a[1] = prepTrackingString(TType,8);
  38.     }
  39.     a[2] = prepTrackingString(window.location.pathname,0);
  40.     if( '' != window.document.referrer)
  41.     {
  42.         a[a.length] = prepTrackingString(window.document.referrer,5);
  43.     }
  44.     
  45.     if (navigator.userAgent.indexOf("SunOS") == -1 && navigator.userAgent.indexOf("Linux") == -1)
  46.     {
  47.         buildIMG(a);
  48.     }
  49. }    
  50.  
  51. if (ToolBar_Supported)
  52. {
  53.     
  54.     var newLineChar = String.fromCharCode(10);
  55.     var char34 = String.fromCharCode(34);
  56.     var LastMSMenu = "";
  57.     var LastICPMenu = "";
  58.     var CurICPMenu = "";
  59.     var IsMSMenu = false;
  60.     var IsMenuDropDown = true;
  61.     var HTMLStr;
  62.     var FooterStr;
  63.     var TBLStr;
  64.     var x = 0;
  65.     var y = 0;
  66.     var x2 = 0;
  67.     var y2 = 0;
  68.     var x3 = 0;
  69.     var MSMenuWidth;
  70.     var ToolbarMinWidth;
  71.     var ToolbarMenu;
  72.     var ToolbarBGColor;
  73.     var ToolbarLoaded = false;
  74.     var aDefMSColor  = new Array(3);
  75.     var aDefICPColor = new Array(3);
  76.     var aCurMSColor  = new Array(3);
  77.     var aCurICPColor = new Array(3);
  78.     var MSFont;
  79.     var ICPFont;
  80.     var MSFTFont;
  81.     var ICPFTFont;
  82.     var MaxMenu = 30;
  83.     var TotalMenu = 0;
  84.     var arrMenuInfo = new Array(30);
  85.     var bFstICPTBMenu = true;
  86.     var bFstICPFTMenu = true;
  87.     
  88.     // Output style sheet and toolbar ID
  89.     document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");
  90.  
  91.     // Build Footer template
  92.     if ( !RTL ){
  93.         FooterStr = "<TABLE ID='idFooter1' STYLE='background-color:white;' cellSpacing='0' cellPadding='0' border='0'>" +
  94.             "<TR VALIGN='BOTTOM'><TD ID='idPosition' WIDTH='185'> </TD><TD ID='idFooterDate1' STYLE='background-color:white;height:30' NOWRAP><!--ICP_FOOTERDATE1_TITLES--></TD></TR>" +
  95.             "<TR VALIGN='BOTTOM'><TD COLSPAN='2' ID='idFooterDate2' STYLE='background-color:white;height:13;width:100%' NOWRAP><!--ICP_FOOTERDATE2_TITLES--></TD></TR>" +
  96.             "</TABLE><TABLE ID='idFooter' STYLE='background-color:white;width:100%' cellSpacing='0' cellPadding='0' border='0'>" +
  97.             "<TR VALIGN='MIDDLE'><TD ID='idFooterRow1' STYLE='background-color:white;height:20;width:100%' NOWRAP><!--ICP_FOOTERMENU_TITLES--></TD></TR>" +
  98.             "<TR VALIGN='MIDDLE'><TD ID='idFooterRow2' STYLE='background-color:white;height:30;width:100%' NOWRAP><!--MS_FOOTERMENU_TITLES--></TD></TR>" +
  99.             "</TABLE>";
  100.     }else if(RTL){
  101.         // Shailr - Not sure if I need this code yet. 
  102.         // RTL Correction: Check if <html> or <body> have the dir="rtl" attribute
  103.         var isRTL = false;
  104.         var isIE5 = navigator.appVersion.indexOf("MSIE 4") == -1;
  105.  
  106.         if (isIE5)
  107.         {
  108.             if (document.body.dir == 'rtl' || document.dir == 'rtl')
  109.                 isRTL = true;
  110.         }
  111.         else // test RTL in IE4
  112.         {
  113.             var ht = document.body.outerHTML;
  114.             ht = ht.substring(1, ht.indexOf(">")).toLowerCase();
  115.             //if (ht.indexOf("dir=rtl") > -1) isRTL = true;
  116.             if ((ht.indexOf("iedir=rtl") > -1) || (ht.indexOf("dir=rtl") > -1)) isRTL = true;
  117.         }
  118.         // End of RTL Correction.
  119.         
  120.         // MNP1 addition - Build Footer template 
  121.         FooterStr = "<TABLE ID='idFooter1' STYLE='background-color:white;' cellSpacing='0' cellPadding='0' border='0'>" +
  122.         "<TR VALIGN='BOTTOM'><TD ID='idPosition' WIDTH='185'> </TD><TD ID='idFooterDate1' STYLE='background-color:white;height:30' NOWRAP><!--ICP_FOOTERDATE1_TITLES--></TD></TR>" +
  123.         "<TR VALIGN='BOTTOM'><TD COLSPAN='2' ID='idFooterDate2' STYLE='background-color:white;height:13;width:100%' NOWRAP><!--ICP_FOOTERDATE2_TITLES--></TD></TR>" +
  124.         "</TABLE><TABLE ID='idFooter' STYLE='background-color:white;width:100%' cellSpacing='0' cellPadding='0' border='0'>" +
  125.         "<TR VALIGN='MIDDLE'><TD ID='idFooterRow1' STYLE='background-color:white;height:20;width:100%' NOWRAP><!--ICP_FOOTERMENU_TITLES--></TD></TR>" +
  126.         "<TR VALIGN='MIDDLE'><TD ID='idFooterRow2' STYLE='background-color:white;height:30;width:100%' NOWRAP><!--MS_FOOTERMENU_TITLES--></TD></TR>" +
  127.         "</TABLE>";
  128.     //end of MNP1 addition
  129.         //isRTL = true;
  130.     }        
  131.  
  132.     // Build toolbar template
  133.     
  134.     HTMLStr = "<DIV ID='idToolbar'     STYLE='background-color:white;width:100%;'>";
  135.     HTMLStr += "<DIV ID='idRow1'        STYLE='position:relative;height:20px;'>";
  136.     //HTMLStr += "<DIV ID='idICPBanner'   STYLE='position:absolute;top:0px;left:0px;height:60px;width:250px;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>";
  137.  
  138.     if (!RTL){
  139.         //HTMLStr = "<DIV ID='idToolbar'     STYLE='background-color:white;width:100%'>";
  140.         //HTMLStr += "<DIV ID='idRow1'        STYLE='position:relative;height:20px;'>";
  141.         HTMLStr += "<DIV ID='idICPBanner'   STYLE='position:absolute;top:0px;left:0px;height:60px;width:250px;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>";
  142.         HTMLStr += "<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0px;left:250px;height:20px;width:18px;overflow:hidden;vertical-align:top;'><IMG SRC='/library/toolbar/images/curve.gif' BORDER=0></DIV>";
  143.         HTMLStr += "<DIV ID='idMSMenuPane'  STYLE='position:absolute;top:0px;left:250px;height:20px;width:10px;background-color:black;float:right;' NOWRAP><!--MS_MENU_TITLES--></DIV>";
  144.         HTMLStr += "</DIV>";
  145.     }else if(RTL){
  146.         TBLStr  = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR STYLE='height:20;vertical-align:middle'><!--ICP_MENU_TITLES--></TR></TABLE>";
  147.         //HTMLStr = "<DIV ID='idToolbar'     STYLE='background-color:white;width:100%'>";
  148.         //HTMLStr += "<DIV ID='idRow1'        STYLE='position:relative;height:20;'>";
  149.         HTMLStr += "<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>";
  150.         HTMLStr += "<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0;left:250;height:20;width:18;overflow:hidden;vertical-align:top;'><IMG SRC='/library/toolbar/iw/images/curve.gif' BORDER=0></DIV>";
  151.         // RTL Correction: added: dir='ltr' (forcing LTR!), added:   (prevents last menu problem)
  152.         HTMLStr += "<DIV dir='ltr' lang='he' ID='idMSMenuPane'  STYLE='position:absolute;top:0;left:250;height:20;width:10;color:white;background-color:black;float:left;' NOWRAP><!--MS_MENU_TITLES--> </DIV>";
  153.         HTMLStr += "</DIV>";
  154.     }
  155.     if(!RTL){
  156.         HTMLStr += "<DIV ID='idRow2' STYLE='position:relative;left:250px;height:40px;'>";
  157.         HTMLStr += "<DIV ID='idADSBanner'   STYLE='position:absolute;top:0px;left:0px;height:40px;width:200px;vertical-align:top;overflow:hidden;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>";
  158.         HTMLStr += "<DIV ID='idMSCBanner'   STYLE='position:absolute;top:0px;left:180px;height:40px;width:112px;vertical-align:top;overflow:hidden;' ALIGN=RIGHT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>";
  159.         HTMLStr += "</DIV>";
  160.     }else if(RTL){
  161.         HTMLStr += "<DIV ID='idRow2' STYLE='position:relative;left:000;height:40px;'>" ; // RTL Correction: was left:250
  162.         HTMLStr += "<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>";
  163.         HTMLStr += "<DIV ID='idMSCBanner'   STYLE='position:absolute;top:0;left:200;height:40;width:112;vertical-align:top;overflow:hidden;' ALIGN=LEFT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>";
  164.         HTMLStr += "</DIV>";
  165.     }    
  166.     if(!RTL){
  167.         HTMLStr += "<DIV ID='idRow3' STYLE='position:relative;height:20px;width:100%'>";
  168.         // zIndex Correction
  169.         HTMLStr += "<DIV ID='idICPMenuPane' STYLE='position:absolute;top:0px;left:0px;height:20px;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>";
  170.         HTMLStr += "</DIV>";
  171.         HTMLStr += "</DIV>";
  172.     }else if (RTL){
  173.         HTMLStr += "<DIV ID='idRow3' STYLE='position:relative;height:20px;width:100%'>";
  174.         // RTL Correction: added: dir='rtl'
  175.         HTMLStr += "<DIV dir='rtl' ID='idICPMenuPane' STYLE='position:absolute;top:0;left:0;height:20px;color:white;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>";
  176.         HTMLStr += "</DIV>";
  177.         HTMLStr += "</DIV>";
  178.         HTMLStr += "<SCRIPT FOR=idToolbar EVENT=onresize>resizeToolbar();</SCRIPT>";
  179.         HTMLStr += "<SCRIPT FOR=idToolbar EVENT=onmouseover>hideMenu();</SCRIPT>";
  180.     }
  181.     HTMLStr +=     "<SCRIPT TYPE='text/javascript'>" + 
  182.         "   var ToolbarMenu = StartMenu;" + 
  183.         "</SCRIPT>" + 
  184.     "<DIV WIDTH=100%>";        
  185.     
  186.  
  187.     // Define event handlers
  188.     if(!RTL){
  189.         window.onresize  = resizeToolbar;
  190.         window.onscroll  = scrollbaroptions;
  191.     }    
  192.  
  193.     // Intialize global variables
  194.     ToolbarBGColor    = "white";                        // toolbar background color
  195.     
  196.     if (Strict_Compat)
  197.     {
  198.         MSFont  = "bold x-small Arial";
  199.         ICPFont = "bold x-small Verdana";
  200.     }
  201.     else
  202.     {
  203.         if( !RTL ){
  204.             MSFont  = "xx-small Verdana";
  205.             ICPFont = "bold xx-small Verdana";
  206.         }else if(RTL){
  207.             MSFont  = "x-small Arial";     // RTL Correction: (was Verdana)
  208.             ICPFont = "bold x-small Arial"; // RTL Correction: (was Verdana)
  209.             //MNP1 RTL revision
  210.             MSFTFont = "11px Arial";
  211.             ICPFTFont = "bold 11px Arial"
  212.             //end
  213.         }    
  214.     }
  215.     
  216.     aDefMSColor[0]    = aCurMSColor[0]  = "black";    // bgcolor;
  217.     aDefMSColor[1]    = aCurMSColor[1]  = "white";    // text font color
  218.     aDefMSColor[2]  = aCurMSColor[2]  = "red";        // mouseover font color
  219.     
  220.     aDefICPColor[0]    = aCurICPColor[0] = "#6699CC";    // bgcolor;
  221.     aDefICPColor[1] = aCurICPColor[1] = "white";    // text font color
  222.     aDefICPColor[2] = aCurICPColor[2] = "red";        // mouseover font color
  223.  
  224. }
  225.  
  226. // The hard-coded numbers in functions - drawToolbar() & resizeToolbar()
  227. // correspond to the dimension of the four gif files:
  228. //        ICP_BANNER: 60h x 250w
  229. //        ADS_BANNER: 40h x 200w
  230. //        MSC_BANNER: 40h x 112w
  231. //        Curve:        20h x 18w
  232.  
  233. function drawFooter(sLastUpdated, position)
  234. {
  235.     if(!RTL){    
  236.         var re = "<!--TEMPCOLOR-->";
  237.         var sUpdatedDate = "";
  238.  
  239.         if (ToolbarBGColor.toUpperCase() == "WHITE" || ToolbarBGColor.toUpperCase() == "#FFFFFF")
  240.         {
  241.             while (FooterStr.indexOf(re) != -1)
  242.                 FooterStr = FooterStr.replace(re, "000000");
  243.         }
  244.         else
  245.         {
  246.             while (FooterStr.indexOf(re) != -1)
  247.                 FooterStr = FooterStr.replace(re, aDefICPColor[1]);
  248.         }
  249.  
  250.         var re2 = "<!--TEMPCOLOR2-->";
  251.  
  252.         while (FooterStr.indexOf(re2) != -1)
  253.             FooterStr = FooterStr.replace(re2, aDefICPColor[2]);
  254.     }else if (RTL){
  255.             var re = /<!--TEMPCOLOR-->/g;
  256.             var sUpdatedDate = "";
  257.             if (ToolbarBGColor.toUpperCase() == "WHITE" || ToolbarBGColor.toUpperCase() == "#FFFFFF")
  258.                 FooterStr = FooterStr.replace(re, "000000");
  259.             else
  260.                 FooterStr = FooterStr.replace(re, aDefICPColor[1]);
  261.             var re2 = /<!--TEMPCOLOR2-->/g;
  262.             FooterStr = FooterStr.replace(re2, aDefICPColor[2]);
  263.     }
  264.     sUpdatedDate = "<SPAN STYLE='font:" + MSFont + "'>"
  265.  
  266.     if (typeof sLastUpdated != "undefined")
  267.         sUpdatedDate += sLastUpdated;
  268.  
  269.     sUpdatedDate += "</SPAN>"; 
  270.  
  271.     FooterStr = FooterStr.replace("<!--ICP_FOOTERDATE1_TITLES-->", sUpdatedDate);
  272.  
  273.     document.body.innerHTML += FooterStr;
  274.     idFooterRow1.style.backgroundColor  = aDefICPColor[0];
  275.     idFooterRow2.style.backgroundColor  = ToolbarBGColor;    
  276.     
  277.     if (typeof sLastUpdated == "undefined")
  278.         idFooter1.style.display = "none";
  279.  
  280.     if (typeof position != "undefined")
  281.         idPosition.width = position;    
  282. }
  283.  
  284. function drawToolbar()
  285. {
  286.     HTMLStr += "</DIV>";
  287.     document.write(HTMLStr);
  288.     ToolbarLoaded = true;
  289.  
  290.     MSMenuWidth     = Math.max(idMSMenuPane.offsetWidth, (200+112));
  291.     ToolbarMinWidth = (250+18) + MSMenuWidth;
  292.  
  293.     idToolbar.style.backgroundColor     = ToolbarBGColor;
  294.     idMSMenuPane.style.backgroundColor  = aDefMSColor[0];
  295.     idICPMenuPane.style.backgroundColor = aDefICPColor[0];
  296.     if (RTL){
  297.         idMSMenuPane.style.color            = aDefMSColor[1];
  298.         idICPMenuPane.style.color            = aDefICPColor[1];
  299.     }
  300.     resizeToolbar();
  301.  
  302.     for (i = 0; i < TotalMenu; i++) 
  303.     {
  304.         thisMenu = document.all(arrMenuInfo[i].IDStr);
  305.         if (thisMenu != null)
  306.         {
  307.             if (arrMenuInfo[i].IDStr == LastMSMenu && arrMenuInfo[i].type == "R")
  308.             {
  309.                 //Last MSMenu has to be absolute width
  310.                 arrMenuInfo[i].type = "A";
  311.                 arrMenuInfo[i].unit = 200;
  312.             }
  313.             if (arrMenuInfo[i].type == "A")
  314.                 if(!RTL){
  315.                     thisMenu.style.width = arrMenuInfo[i].unit + 'px';
  316.                 }else{
  317.                     thisMenu.style.width = arrMenuInfo[i].unit;
  318.                 }    
  319.             else 
  320.                 thisMenu.style.width = Math.round(arrMenuInfo[i].width * arrMenuInfo[i].unit) + 'em';
  321.         }
  322.     }
  323. }
  324. function resizeToolbar()
  325. {
  326.     scFlag = false;
  327.     scrollcount = 0;
  328.     if (ToolBar_Supported == false) return;
  329.  
  330.     w = Math.max(ToolbarMinWidth, document.body.clientWidth) - ToolbarMinWidth;
  331.     if ( !RTL ){
  332.         if (document.all("idMSMenuCurve"))
  333.         {    
  334.             idMSMenuCurve.style.left  = (250+w) + 'px';
  335.             idMSMenuPane.style.left   = (250+w+18) + 'px';
  336.             idMSMenuPane.style.width  = MSMenuWidth  + 'px';
  337.             idADSBanner.style.left    = (w+18)  + 'px';
  338.             idMSCBanner.style.left    = (w+18+200)  + 'px';
  339.             idMSCBanner.style.width   = (MSMenuWidth - 200)  + 'px';
  340.             idICPMenuPane.style.width = ToolbarMinWidth + w  + 'px';
  341.         }
  342.     }else if( RTL ){
  343.         idMSMenuCurve.style.left  = MSMenuWidth;    // RTL Correction: was (250+w);
  344.         idMSMenuPane.style.left   = 0;            // RTL Correction: was (250+w+18);
  345.         idMSMenuPane.style.width  = MSMenuWidth;
  346.         idADSBanner.style.left    = 112;        // RTL Correction: was (w+18);
  347.         idMSCBanner.style.left    = 0;            // RTL Correction: was (w+18+200);
  348.         idMSCBanner.style.width   = (MSMenuWidth - 200);
  349.         idICPMenuPane.style.width = ToolbarMinWidth + w;
  350.         idICPBanner.style.left    = MSMenuWidth + 18 + w; // RTL Correction: line added for ICPBanner positioning
  351.     }
  352.         
  353. }
  354.  
  355. function setToolbarBGColor(color)
  356. {    
  357.     ToolbarBGColor = color;
  358.     if (ToolbarLoaded == true)
  359.         idToolbar.style.backgroundColor = ToolbarBGColor;
  360. }    
  361.  
  362. function setBannerColor(bannerColor, bgColor, fontColor, mouseoverColor)
  363. {
  364.     if (bannerColor.toUpperCase() != "WHITE" && bannerColor.toUpperCase() != "FFFFFF")
  365.         bgColor = bannerColor;
  366.  
  367.     setToolbarBGColor(bannerColor);
  368.     setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor);
  369. }
  370.  
  371. function setMSMenuFont(sFont)
  372. {    
  373.     MSFont = sFont;
  374. }
  375.  
  376. function setICPMenuFont(sFont)
  377. {    
  378.     ICPFont = sFont;
  379. }
  380.  
  381. function setDefaultMSMenuColor(bgColor, fontColor, mouseoverColor)
  382. {    
  383.     if (bgColor   != "")      aDefMSColor[0] = bgColor;
  384.     if (fontColor != "")      aDefMSColor[1] = fontColor;
  385.     if (mouseoverColor != "") aDefMSColor[2] = mouseoverColor;
  386. }
  387.  
  388. function setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor)
  389. {    
  390.     if (bgColor   != "")      aDefICPColor[0] = bgColor;
  391.     if (fontColor != "")      aDefICPColor[1] = fontColor;
  392.     if (mouseoverColor != "") aDefICPColor[2] = mouseoverColor;
  393. }
  394.  
  395. function setICPMenuColor(MenuIDStr, bgColor, fontColor, mouseoverColor)
  396. {    
  397.     if (ToolbarLoaded == false) return;
  398.  
  399.     // Reset previous ICP Menu color if any
  400.     if (CurICPMenu != "")
  401.     {
  402.         PrevID = CurICPMenu.substring(4);
  403.         CurICPMenu = "";
  404.         setICPMenuColor(PrevID, aDefICPColor[0], aDefICPColor[1], aDefICPColor[2]);
  405.     }
  406.  
  407.     var    id = "AM_" + "ICP_" + MenuIDStr;
  408.     var thisMenu = document.all(id);
  409.     if (thisMenu != null)
  410.     {
  411.         CurICPMenu = "ICP_" + MenuIDStr;
  412.         aCurICPColor[0] = bgColor;
  413.         aCurICPColor[1] = fontColor;
  414.         aCurICPColor[2] = mouseoverColor;
  415.  
  416.         // Change menu color
  417.         if (bgColor != "")
  418.             thisMenu.style.backgroundColor = bgColor;
  419.         if (fontColor != "")
  420.             thisMenu.style.color = fontColor;
  421.  
  422.         // Change subMenu color
  423.         id = "ICP_" + MenuIDStr;
  424.         thisMenu = document.all(id);
  425.         if (thisMenu != null)
  426.         {
  427.             if (bgColor != "")
  428.                 thisMenu.style.backgroundColor = bgColor;
  429.             
  430.             if (fontColor != "")
  431.             {
  432.                 i = 0;
  433.                 id = "AS_" + "ICP_" + MenuIDStr;
  434.                 thisMenu = document.all.item(id,i);
  435.                 while (thisMenu != null)
  436.                 {
  437.                     thisMenu.style.color = fontColor;
  438.                     i += 1;
  439.                     thisMenu = document.all.item(id,i);
  440.                 }
  441.             }
  442.         }
  443.     }
  444. }
  445.  
  446. function setAds(Gif,Url,AltStr)
  447. {    setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
  448. }
  449.  
  450. function setICPBanner(Gif,Url,AltStr)
  451. {    
  452.     if(RTL){
  453.         if (Gif.indexOf("training_banner_training.gif") > 0){
  454.             Gif = "training_banner_training.gif";
  455.         }
  456.     }    
  457.     setBanner(Gif,Url,AltStr,"<!--BEG_ICP_BANNER-->","<!--END_ICP_BANNER-->");
  458. }
  459.  
  460. function setMSBanner(Gif,Url,AltStr)
  461. {    tempGif = "/library/toolbar/images/" + Gif;
  462.     setBanner(tempGif,Url,AltStr,"<!--BEG_MSC_BANNER-->","<!--END_MSC_BANNER-->");
  463. }
  464.  
  465. function setBanner(BanGif, BanUrl, BanAltStr, BanBegTag, BanEndTag)
  466. {
  467.     begPos = HTMLStr.indexOf(BanBegTag);
  468.     endPos = HTMLStr.indexOf(BanEndTag) + BanEndTag.length;
  469.     SubStr = HTMLStr.substring(begPos, endPos);
  470.     SrcStr = "";
  471.     if (BanUrl != "")
  472.         SrcStr += "<A Target='_top' HREF='" + formatURL(BanUrl, BanGif) + "'>";
  473.     SrcStr += "<IMG SRC='" + BanGif + "' ALT='" + BanAltStr + "' BORDER=0>";
  474.     if (BanUrl != "")
  475.         SrcStr += "</A>";
  476.     SrcStr = BanBegTag + SrcStr + BanEndTag;
  477.     HTMLStr = HTMLStr.replace(SubStr, SrcStr);    
  478. }
  479.  
  480. function setICPSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
  481. {    tempID = "ICP_" + MenuIDStr;
  482.     setSubMenuWidth(tempID, WidthType, WidthUnit);
  483. }
  484.  
  485. function setMSSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
  486. {    tempID = "MS_" + MenuIDStr;
  487.     setSubMenuWidth(tempID, WidthType, WidthUnit);
  488. }
  489.  
  490. function setSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
  491. {
  492.     var fFound = false;
  493.     if (TotalMenu == MaxMenu)
  494.     {
  495.         alert("Unable to process menu. Maximum of " + MaxMenu + " reached.");
  496.         return;
  497.     }
  498.     
  499.     for (i = 0; i < TotalMenu; i++)
  500.         if (arrMenuInfo[i].IDStr == MenuIDStr)
  501.         {
  502.             fFound = true;
  503.             break;
  504.         }
  505.  
  506.     if (!fFound)
  507.     {
  508.         arrMenuInfo[i] = new menuInfo(MenuIDStr);
  509.         TotalMenu += 1;
  510.     }
  511.  
  512.     if (!fFound && WidthType.toUpperCase().indexOf("DEFAULT") != -1)
  513.     {
  514.         arrMenuInfo[i].type = "A";
  515.         arrMenuInfo[i].unit = 160;
  516.     }
  517.     else
  518.     {
  519.         arrMenuInfo[i].type = (WidthType.toUpperCase().indexOf("ABSOLUTE") != -1)? "A" : "R";
  520.         arrMenuInfo[i].unit = WidthUnit;
  521.     }
  522. }
  523.  
  524. // This function creates a menuInfo object instance.
  525. function menuInfo(MenuIDStr)
  526. {
  527.     this.IDStr = MenuIDStr;
  528.     this.type  = "";
  529.     this.unit  = 0;
  530.     this.width = 0;
  531.     this.count = 0;
  532. }
  533.  
  534. function updateSubMenuWidth(MenuIDStr)
  535. {
  536.     for (i = 0; i < TotalMenu; i++)
  537.         if (arrMenuInfo[i].IDStr == MenuIDStr)
  538.         {
  539.             if (arrMenuInfo[i].width < MenuIDStr.length) 
  540.                 arrMenuInfo[i].width = MenuIDStr.length;
  541.             arrMenuInfo[i].count = arrMenuInfo[i].count + 1;
  542.             break;
  543.         }
  544. }
  545.  
  546. function addICPMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
  547. {     
  548.     if(RTL){
  549.         if (LastICPMenu == "") HTMLStr = HTMLStr.replace("<!--ICP_MENU_TITLES-->", TBLStr);
  550.     }    
  551.  
  552.     if (addICPMenu.arguments.length > 4)
  553.         TargetStr = addICPMenu.arguments[4];
  554.     else
  555.         TargetStr = "_top";
  556.     tempID = "ICP_" + MenuIDStr;
  557.     addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, true); 
  558.     if (RTL){
  559.         LastICPMenu = tempID;
  560.     }else{
  561.         bFstICPTBMenu=false;        
  562.     }
  563. }
  564.  
  565. function addMSMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
  566. {    
  567.     TargetStr = "_top";
  568.     tempID = "MS_" + MenuIDStr;
  569.     //alert(" TempID: " + tempID +  " MenuDisplayString: " + MenuDisplayStr + " Menu Help String :" + MenuHelpStr + " MenuUrl:" + MenuURLStr + " Target:" + TargetStr);
  570.     addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, false); 
  571.     LastMSMenu = tempID;
  572. }
  573.  
  574. function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, bICPMenu)
  575. {
  576.     cFont   = bICPMenu? ICPFont : MSFont;
  577.     cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
  578.     cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  579.     cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
  580.     if (RTL){
  581.         cStyle  = "font:" + cFont + ";background-color:" + cColor0 + ";color:" + cColor1 + ";";
  582.         if (MenuHelpStr == "") MenuHelpStr = MenuDisplayStr; // Shailr. This line should have been before the line MenuStr = newLineChar; but I am tryig to avoid another if..else
  583.     }
  584.     tagStr  = bICPMenu? "<!--ICP_MENU_TITLES-->" : "<!--MS_MENU_TITLES-->";
  585.     
  586.     MenuStr = newLineChar;
  587.     if (!RTL){
  588.         if ((bICPMenu == false && LastMSMenu != "") || (bICPMenu == true && bFstICPTBMenu==false))
  589.             MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'>| </SPAN>"; 
  590.         MenuStr += "<A TARGET='" + TargetStr + "' TITLE='" + MenuHelpStr + "'" +
  591.                 "   ID='AM_" + MenuIDStr + "'" +
  592.                 "   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";background-color:" + cColor0 + ";color:" + cColor1 + ";'";
  593.         if (MenuURLStr != "")
  594.         {
  595.             if (bICPMenu)
  596.                 MenuStr += " HREF='" + formatURL(MenuURLStr, ("ICP_" + MenuDisplayStr)) + "'";
  597.             else
  598.                 MenuStr += " HREF='" + formatURL(MenuURLStr, ("MS_" + MenuDisplayStr)) + "'";
  599.         }
  600.         else
  601.             MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
  602.         MenuStr +=     " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "'); hideMenu();" + char34 + 
  603.                     " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
  604.                     " " + MenuDisplayStr + " </a>";
  605.         MenuStr += tagStr;
  606.     }
  607.     if ( RTL ){
  608.             if (bICPMenu) 
  609.             MenuStr += "<TD STYLE='" + cStyle + "' ID='AM_" + MenuIDStr + "' NOWRAP>";
  610.             else{
  611.                 // RTL Correction: added: dir='rtl' (for MSMenu)
  612.                 MenuStr += "<SPAN dir='rtl' STYLE='" + cStyle + "'>";
  613.                 if (LastMSMenu != "") MenuStr += "|"; 
  614.                 MenuStr += " ";
  615.             }
  616.         MenuStr += "<A STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + ";'" +
  617.                "   TARGET='" + TargetStr + "'" +
  618.                "   TITLE=" + char34 + MenuHelpStr + char34;
  619.         if (MenuURLStr != "")
  620.             MenuStr += " HREF='" + formatURL(MenuURLStr, ((bICPMenu? "ICP_":"MS_") + MenuDisplayStr)) + "'";
  621.         else
  622.             MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
  623.         MenuStr += " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "'); hideMenu();" + char34 + 
  624.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
  625.                 " " + MenuDisplayStr + " </a>";
  626.         if (bICPMenu) 
  627.             MenuStr += " </TD><TD STYLE='" + cStyle + "'>|</TD>";
  628.         else
  629.             MenuStr += "</SPAN>";
  630.             MenuStr += tagStr;
  631.     }
  632.     HTMLStr = HTMLStr.replace(tagStr, MenuStr);    
  633.     setSubMenuWidth(MenuIDStr,"default",0);
  634. }
  635.  
  636. function addICPSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
  637. {    
  638.     if (addICPSubMenu.arguments.length > 3)
  639.         TargetStr = addICPSubMenu.arguments[3];
  640.     else
  641.         TargetStr = "_top";
  642.     tempID = "ICP_" + MenuIDStr;
  643.     addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,true); 
  644. }
  645.  
  646. function addMSSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
  647. {    
  648.     TargetStr = "_top";
  649.     tempID = "MS_" + MenuIDStr;
  650.     //alert("TempID: " + tempID + "\nSubMenuStr: " + SubMenuStr + "\n SubMenuURLStr: " + SubMenuURLStr + "\n TargetStr: " + TargetStr);
  651.     addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,false); 
  652. }
  653.  
  654. function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
  655. {
  656.     cFont   = bICPMenu? ICPFont : MSFont;
  657.     cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
  658.     cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  659.     cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
  660.     
  661.     var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
  662.     if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
  663.     InstrumentStr = MenuIDStr.substring(0 , MenuPos) + "|" + SubMenuStr;
  664.     URLStr        = formatURL(SubMenuURLStr, InstrumentStr);
  665.  
  666.     var LookUpTag  = "<!--" + MenuIDStr + "-->";
  667.     var sPos = HTMLStr.indexOf(LookUpTag);
  668.     if (sPos <= 0)
  669.     {
  670.         HTMLStr += newLineChar + newLineChar +
  671.         "<SPAN ID='" + MenuIDStr + "'";
  672.         if (!RTL){
  673.             HTMLStr +=     " STYLE='display:none;position:absolute;width:160px;background-color:" + cColor0 + ";padding-top:0px;padding-left:0px;padding-bottom:20px;z-index:9px;'";
  674.         }else if (RTL){
  675.             HTMLStr +=     " STYLE='display:none;position:absolute;width:160;background-color:" + cColor0 + ";padding-top:0;padding-left:0;padding-bottom:20;z-index:9;'";
  676.         }
  677.         HTMLStr += "onmouseout='hideMenu();'>";        
  678.         if (Frame_Supported == false || bICPMenu == false)
  679.         if (!RTL){
  680.             HTMLStr += "<HR  STYLE='position:absolute;left:0px;top:0px;color:" + cColor1 + "' SIZE=1>";
  681.             HTMLStr += "<DIV STYLE='position:relative;left:0px;top:8px;'>";
  682.         } else if (RTL){
  683.             HTMLStr += "<HR  STYLE='position:absolute;left:0;top:0;color:" + cColor1 + "' SIZE=1>";
  684.             HTMLStr += "<DIV STYLE='right:0;top:8;' dir='rtl'>";
  685.         }    
  686.     }
  687.  
  688.     TempStr = newLineChar +
  689.                 "<A ID='AS_" + MenuIDStr + "'" +
  690.                 "   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + "'" +
  691.                 "   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
  692.                 " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
  693.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
  694.                 " " + SubMenuStr + "</A><BR>" + LookUpTag;
  695.     if (sPos <= 0)
  696.         HTMLStr += TempStr + "</DIV></SPAN>";
  697.     else
  698.         HTMLStr = HTMLStr.replace(LookUpTag, TempStr);    
  699.  
  700.     updateSubMenuWidth(MenuIDStr);    
  701. }
  702.  
  703. function addICPSubMenuLine(MenuIDStr)
  704. {    
  705.     tempID = "ICP_" + MenuIDStr;
  706.     addSubMenuLine(tempID,true);
  707. }
  708.  
  709. function addMSSubMenuLine(MenuIDStr)
  710. {    
  711.     tempID = "MS_" + MenuIDStr;
  712.     addSubMenuLine(tempID,false);
  713. }
  714.  
  715. function addSubMenuLine(MenuIDStr, bICPMenu)
  716. {
  717.     var LookUpTag = "<!--" + MenuIDStr + "-->";
  718.     var sPos = HTMLStr.indexOf(LookUpTag);
  719.     if (sPos > 0)
  720.     {
  721.         cColor  = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  722.         TempStr = newLineChar + "<HR STYLE='color:" + cColor + "' SIZE=1>" + LookUpTag;
  723.         HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
  724.     }
  725. }
  726.  
  727. function addMSFooterMenu(MenuDisplayStr, MenuURLStr)
  728. {
  729.     addFooterMenu(MenuDisplayStr, MenuURLStr, false)
  730. }
  731.  
  732. function addICPFooterMenu(MenuDisplayStr, MenuURLStr)
  733. {
  734.     addFooterMenu(MenuDisplayStr, MenuURLStr, true)
  735.     bFstICPFTMenu = false;
  736. }
  737.  
  738. function addFooterMenu(MenuDisplayStr, MenuURLStr, bICPMenu)
  739. {
  740.     cFont   = bICPMenu? ICPFont : MSFont;
  741.     cColor1 = aDefICPColor[1];
  742.     cColor2 = aDefICPColor[2];
  743.  
  744.     tagStr  = bICPMenu? "<!--ICP_FOOTERMENU_TITLES-->" : "<!--MS_FOOTERMENU_TITLES-->";
  745.  
  746.     MenuStr = "";
  747.  
  748.     if ((bICPMenu) && bFstICPFTMenu == false)
  749.         MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'> |</SPAN>";
  750.  
  751.     if ((bICPMenu == false) && (MenuURLStr == ''))
  752.         MenuStr += "<SPAN STYLE='font:" + cFont + ";color:<!--TEMPCOLOR-->'> " + MenuDisplayStr + " </SPAN>";
  753.     else
  754.     {
  755.         MenuStr += " <A TARGET='_top' STYLE='";
  756.         if (bICPMenu)
  757.             MenuStr += "text-decoration:none;";
  758.         MenuStr += "cursor:hand;font:" + cFont + ";" 
  759.         
  760.         if (bICPMenu)
  761.             MenuStr += "color:" + cColor1 + ";'";
  762.         else
  763.             MenuStr += "color:<!--TEMPCOLOR-->" + ";'";
  764.  
  765.         MenuStr += " HREF='" + MenuURLStr + "'";
  766.     
  767.         MenuStr +=     " onmouseout=" + char34 + "this.style.color = '";
  768.  
  769.         if (bICPMenu) 
  770.             MenuStr += cColor1;
  771.         else
  772.             MenuStr += "<!--TEMPCOLOR-->";
  773.         MenuStr += "'" + char34 + " onmouseover=" + char34 + "this.style.color = '"
  774.         
  775.         if (bICPMenu)
  776.             MenuStr += cColor2
  777.         else
  778.             MenuStr += "<!--TEMPCOLOR2-->";
  779.  
  780.         MenuStr += "'" + char34 + ">" + MenuDisplayStr + "</A> ";    
  781.     }
  782.  
  783.     MenuStr += tagStr;
  784.     
  785.     FooterStr = FooterStr.replace(tagStr, MenuStr);    
  786. }
  787.  
  788. function mouseMenu(id, MenuIDStr) 
  789. {
  790.     IsMSMenu   = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  791.     IsMouseout = (id.toUpperCase().indexOf("OUT") != -1);
  792.  
  793.     if (IsMouseout)
  794.     {
  795.         color = IsMSMenu? aDefMSColor[1] : aDefICPColor[1];
  796.         if (MenuIDStr == CurICPMenu && aCurICPColor[1] != "") 
  797.             color = aCurICPColor[1];
  798.     }
  799.     else
  800.     {
  801.         color = IsMSMenu? aDefMSColor[2] : aDefICPColor[2];
  802.         if (MenuIDStr == CurICPMenu && aCurICPColor[2] != "") 
  803.             color = aCurICPColor[2];
  804.     }
  805.     window.event.srcElement.style.color = color;
  806. }
  807.  
  808. function doMenu(MenuIDStr) 
  809. {
  810.     var thisMenu = document.all(MenuIDStr);
  811.     if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu) 
  812.     {
  813.         window.event.cancelBubble = true;
  814.         return false;
  815.     }
  816.     // Reset dropdown menu
  817.     window.event.cancelBubble = true;
  818.     ToolbarMenu.style.display = "none";
  819.     showElement("SELECT");
  820.     showElement("OBJECT");
  821.     ToolbarMenu = thisMenu;
  822.     IsMSMenu = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  823.  
  824.     // Set dropdown menu display position
  825.     x  = window.event.srcElement.offsetLeft +
  826.           window.event.srcElement.offsetParent.offsetLeft;
  827.     if (RTL){
  828.         // RTL correction:
  829.         var ICPstart = 0;
  830.         if (!IsMSMenu)
  831.         {
  832.             if (isIE5)
  833.                 ICPstart = window.event.srcElement.offsetParent.offsetParent.offsetLeft;
  834.             else // for IE4 we must use...
  835.                 ICPstart = window.event.srcElement.offsetParent.offsetParent.offsetParent.offsetParent.offsetWidth -
  836.                     window.event.srcElement.offsetParent.offsetParent.offsetWidth;
  837.             x += ICPstart;
  838.         }
  839.         x -= thisMenu.style.posWidth;
  840.         x += IsMSMenu ? 8 : -2;
  841.         if (x < 0) x = 0;
  842.         // End of RTL Correction
  843.     
  844.     }      
  845.     if (MenuIDStr == LastMSMenu){ 
  846.         if (!RTL){
  847.             x += (window.event.srcElement.offsetWidth - thisMenu.style.posWidth);
  848.         }else if (RTL){
  849.             if (x < 0) x = 0;
  850.         }    
  851.     }
  852.     x2 = x + window.event.srcElement.offsetWidth;
  853.     y  = (IsMSMenu)? 
  854.          (idRow1.offsetHeight) :
  855.          (idRow1.offsetHeight + idRow2.offsetHeight + idRow3.offsetHeight);
  856.     if (RTL){
  857.             // Get main menu width
  858.             // RTL Correction:
  859.         if (IsMSMenu)
  860.             x2 = window.event.srcElement.offsetLeft - window.event.srcElement.offsetWidth;
  861.         else
  862.             x2 = window.event.srcElement.offsetParent.offsetLeft + ICPstart;
  863.         // End of RTL Correction.
  864.         // Get dropdown menu width
  865.         x3 = x + 160;
  866.         for (i = 0; i < TotalMenu; i++){
  867.             if (arrMenuInfo[i].IDStr == MenuIDStr)
  868.             {
  869.                 x3 = x+ arrMenuInfo[i].unit;
  870.                 break;
  871.             }
  872.         }
  873.     
  874.     }     
  875.          
  876.     thisMenu.style.top  = y;
  877.     thisMenu.style.left = x;
  878.     thisMenu.style.clip = "rect(0 0 0 0)";
  879.     thisMenu.style.display = "block";
  880.     thisMenu.style.zIndex = 102;
  881.  
  882.     // delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
  883.     window.setTimeout("showMenu()", 2);
  884.     return true;
  885. }
  886.  
  887. function showMenu() 
  888. {
  889.     if (ToolbarMenu != null) 
  890.     { 
  891.         IsMenuDropDown = (Frame_Supported && IsMSMenu == false)? false : true;
  892.         if (IsMenuDropDown == false)
  893.         {
  894.             y = (y - ToolbarMenu.offsetHeight - idRow3.offsetHeight);
  895.             if (y < 0) y = 0;
  896.             ToolbarMenu.style.top = y;
  897.         }
  898.         y2 = y + ToolbarMenu.offsetHeight;
  899.  
  900.         ToolbarMenu.style.clip = "rect(auto auto auto auto)";
  901.         hideElement("SELECT");
  902.         hideElement("OBJECT");
  903.         if (!RTL)
  904.             x2 = x + ToolbarMenu.offsetWidth;
  905.             hideElement("IFRAME");  //FRANKLO
  906.     }
  907. }
  908.  
  909.  
  910. function hideMenu()
  911. {
  912.     if (ToolbarMenu != null && ToolbarMenu != StartMenu) 
  913.     {
  914.         // Don't hide the menu if the mouse move between the menu and submenus
  915.  
  916.         if (!RTL){
  917.             cY = event.clientY + document.body.scrollTop;
  918.             cX = event.clientX; 
  919.             if (document.body.offsetWidth > x && scFlag) {
  920.                 cX = x + 9;
  921.             }
  922.             if ( (cX >= (x+5) && cX<=x2) &&
  923.              ((IsMenuDropDown == true  && cY > (y-10) && cY <= y2)      ||
  924.               (IsMenuDropDown == false && cY >= y     && cY <= (y2+10)) ))
  925.             {
  926.                 window.event.cancelBubble = true;
  927.                 return; 
  928.             }
  929.         }else if(RTL){
  930.             var cX = event.clientX //+ document.body.scrollLeft;
  931.             // RTL correction: considers left scrollbar width!
  932.             if (isRTL) cX -= 16;
  933.             var cY = event.clientY + document.body.scrollTop;
  934.             var bHideMenu = true;
  935.             if (cX > document.body.scrollLeft && document.body.scrollLeft > 1){
  936.                 cX = x3;    //x + 9;
  937.             }
  938.             if (IsMenuDropDown == true)
  939.             {// RTL Correction: cY-8 instead of cY
  940.                 if ( cY-8 >= (y - idRow3.offsetHeight) && cY < y)
  941.                 {// RTL Correction: [x,x2] --> [x2,x3]
  942.                     if (cX >= (x2+5) && cX <= x3) bHideMenu = false;
  943.                 }
  944.                 else if (cY >= y && cY <= y2)
  945.                 {
  946.                     if (cX > (x+5) && cX <= x3) bHideMenu = false;
  947.                 }
  948.             }
  949.             else
  950.             {
  951.                 if (cY >= y2 && cY < (y2 + idRow3.offsetHeight))
  952.                 {// RTL Correction: [x,x2] --> [x2,x3]
  953.                     if (cX >= (x2+5) && cX <= x3) bHideMenu = false;
  954.                 }
  955.                 else if (cY >= y && cY <= y2)
  956.                 {
  957.                     if (cX > (x+5) && cX <= x3) bHideMenu = false;
  958.                 }
  959.             }
  960.  
  961.             if (! bHideMenu) 
  962.             {
  963.                 window.event.cancelBubble = true;
  964.                 return; 
  965.             }
  966.         }    
  967.  
  968.         ToolbarMenu.style.display = "none";
  969.         ToolbarMenu = StartMenu;
  970.         window.event.cancelBubble = true;
  971.  
  972.         showElement("SELECT");
  973.         showElement("OBJECT");
  974.         if(!RTL){
  975.             showElement("IFRAME"); //FRANKLO
  976.         }    
  977.     }
  978. }
  979.  
  980. function hideElement(elmID)
  981. {
  982.     for (i = 0; i < document.all.tags(elmID).length; i++)
  983.     {
  984.         obj = document.all.tags(elmID)[i];
  985.         if (! obj || ! obj.offsetParent)
  986.             continue;
  987.  
  988.         // Find the element's offsetTop and offsetLeft relative to the BODY tag.
  989.         objLeft   = obj.offsetLeft;
  990.         objTop    = obj.offsetTop;
  991.         objParent = obj.offsetParent;
  992.         while (objParent.tagName.toUpperCase() != "BODY")
  993.         {
  994.             objLeft  += objParent.offsetLeft;
  995.             objTop   += objParent.offsetTop;
  996.             objParent = objParent.offsetParent;
  997.         }
  998.         // Adjust the element's offsetTop relative to the dropdown menu
  999.         objTop = objTop - y;
  1000.  
  1001.         if (x > (objLeft + obj.offsetWidth) || objLeft > (x + ToolbarMenu.offsetWidth))
  1002.             ;
  1003.         else if (objTop > ToolbarMenu.offsetHeight)
  1004.             ;
  1005.         else if (IsMSMenu && (y + ToolbarMenu.offsetHeight) <= 80)
  1006.             ;
  1007.         else
  1008.             obj.style.visibility = "hidden";
  1009.     }
  1010. }
  1011.  
  1012. function showElement(elmID)
  1013. {
  1014.     for (i = 0; i < document.all.tags(elmID).length; i++)
  1015.     {
  1016.         obj = document.all.tags(elmID)[i];
  1017.         if (! obj || ! obj.offsetParent)
  1018.             continue;
  1019.         obj.style.visibility = "";
  1020.     }
  1021. }
  1022.  
  1023. function formatURL(URLStr, InstrumentStr)
  1024. {
  1025.     var tempStr = URLStr;
  1026.  
  1027.     if (DoInstrumentation && URLStr != "" )
  1028.     {
  1029.         var ParamPos1 = URLStr.indexOf("?");
  1030.         var ParamPos2 = URLStr.lastIndexOf("?");
  1031.         var ParamPos3 = URLStr.toLowerCase().indexOf("target=");
  1032.         var ParamPos4 = URLStr.indexOf("#");
  1033.         var Bookmark  = "";
  1034.         var URL = URLStr;
  1035.         if (ParamPos4 >= 0)
  1036.         {
  1037.              URL = URLStr.substr(0, ParamPos4);
  1038.             Bookmark = URLStr.substr(ParamPos4);
  1039.         }
  1040.         
  1041.         if (ParamPos1 == -1)
  1042.             tempStr = "?MSCOMTB=";
  1043.         else if (ParamPos1 == ParamPos2 && ParamPos3 == -1)    
  1044.             tempStr = "&MSCOMTB=";
  1045.         else if (ParamPos1 == ParamPos2 && ParamPos3 != -1)    
  1046.             tempStr = "?MSCOMTB=";
  1047.         else if (ParamPos1 < ParamPos2)
  1048.             tempStr = "&MSCOMTB=";
  1049.  
  1050.         tempStr = URL + tempStr + InstrumentStr.replace(" ","%20") + Bookmark;
  1051.     }
  1052.     return tempStr;
  1053. }
  1054.  
  1055. function prepTrackingString(ts, type)
  1056. {
  1057.     var rArray;
  1058.     var rString;
  1059.     var pName = '';
  1060.     if (0 == type)
  1061.     {
  1062.         pName = 'p=';
  1063.         rString = ts.substring(1);
  1064.         rArray = rString.split('/');
  1065.     }
  1066.     if (1 == type)
  1067.     {
  1068.         pName = 'qs=';
  1069.         rString = ts.substring(1);
  1070.         rArray = rString.split('&');        
  1071.     }
  1072.     if (2 == type)
  1073.     {
  1074.         pName = 'f=';
  1075.         rString = escape(ts);
  1076.         return pName + rString;
  1077.     }
  1078.     if (3 == type)
  1079.     {
  1080.         pName = 'tPage=';
  1081.         rString = escape(ts);
  1082.         return pName+rString;
  1083.     }
  1084.     if (4 == type)
  1085.     {
  1086.         pName = 'sPage=';
  1087.         rString = escape(ts);
  1088.         return pName + rString;
  1089.     }
  1090.     if (5 == type)
  1091.     {
  1092.         pName = 'r=';
  1093.         rString = escape(ts);
  1094.         return pName + rString;
  1095.     }
  1096.     if (6 == type)
  1097.     {
  1098.         pName = 'MSID=';
  1099.         rString = escape(ts);
  1100.         return pName + rString;
  1101.     }
  1102.     if (7 == type)
  1103.     {
  1104.         pName = 'source=';
  1105.         rString = ts.toLowerCase();
  1106.         if(rString.indexOf("microsoft.com") != -1)
  1107.         {
  1108.             rString = rString.substring(0,rString.indexOf("microsoft.com"));
  1109.             if('' == rString)
  1110.             {
  1111.                 rString = "www";
  1112.             }    
  1113.             else
  1114.             {
  1115.                 rString = rString.substring(0,rString.length -1);
  1116.             }
  1117.         }
  1118.         return pName + rString;
  1119.     }
  1120.     if (8 == type)
  1121.     {
  1122.         pName = 'TYPE=';
  1123.         rString = escape(ts);
  1124.         return pName + rString;
  1125.     }
  1126.     rString = '';
  1127.     if(null != rArray)
  1128.     {
  1129.         if(0 == type)
  1130.         {
  1131.             for( j=0; j < rArray.length - 1; j++)
  1132.             {    
  1133.                 rString += rArray[j] + '_';  
  1134.             } 
  1135.         }
  1136.         else
  1137.         {
  1138.             for( j=0; j < rArray.length  ; j++)
  1139.             {
  1140.                 rString += rArray[j] + '_';  
  1141.             } 
  1142.         }
  1143.     }
  1144.     rString = rString.substring(0, rString.length - 1);           
  1145.     return pName + rString;
  1146. }
  1147.  
  1148. function buildIMG(pArr)
  1149. {
  1150.     var TG = '<LAYER visibility="hide"><div style="display:none;"><IMG src="' + location.protocol + '//c.microsoft.com/trans_pixel.asp?';
  1151.     for(var i=0; i<pArr.length; i++)
  1152.     {
  1153.         if(0 == i)
  1154.         {
  1155.             TG +=  pArr[i];
  1156.         }
  1157.         else
  1158.         {
  1159.             TG += '&' + pArr[i];
  1160.         }
  1161.     }
  1162.     TG +='" height="0" width="0" hspace="0" vspace="0" Border="0"></div></layer>';
  1163.     if (!RTL){
  1164.         document.writeln(TG);
  1165.         return;
  1166.     }else if (RTL){
  1167.         document.write(TG);
  1168.     }    
  1169. }
  1170.  
  1171. function setToolbarLocale(toolbarLocale)
  1172. {
  1173.     document.writeln("<" + "script language='JavaScript' src='/library/toolbar/loc/global-" + toolbarLocale + ".js' type='text/javascript'></" + "script>");
  1174.     return;
  1175. }
  1176. function scrollbaroptions(){
  1177. scrollcount ++;
  1178. if ( scrollcount < 3  )
  1179.     {
  1180.         scFlag = true;
  1181.     }else{
  1182.         scrollcount = 0;
  1183.         scFlag = false;
  1184.     }    
  1185. }
  1186.  
  1187.