home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri Kaikille K-CD 2001 #16 / K-CD_2001-16.iso / 16 / DATA1.CAB / HTML_HELP / bsscdht2.js < prev    next >
Text File  |  2001-09-12  |  35KB  |  1,227 lines

  1. //////////BSSCDHTML Section 2//////////
  2. // RoboHELP« Dynamic HTML Effects Script
  3. // Copyright ⌐ 1998-2000 eHelp Corporation.  All rights reserved.
  4.  
  5. // Version=3.56
  6.  
  7. // Warning:  Do not modify this file.  It is generated by RoboHELP« and changes will be overwritten.
  8.  
  9.  
  10.  
  11. function RemoveNavBar()
  12. {
  13.     // See if we are in a popup and if so remove the NavBar
  14.     if (BSSCPopup_IsPopup()) {
  15.  
  16.         if (gbIE4) {
  17.             var tempColl = document.all.tags("DIV");
  18.             for (var iDiv = 0; iDiv < tempColl.length; iDiv++) {
  19.                 if (tempColl(iDiv).id == "NavBar") {
  20.                     tempColl(iDiv).style.visibility = gBsStyVisHide;
  21.                     if (gbIE5) {
  22.                         tempColl(iDiv).style.position = "absolute";
  23.                     }
  24.                     tempColl(iDiv).style.pixelTop = "-100px";
  25.                     break;
  26.                 }
  27.             }
  28.         } else if (gbNav4) {
  29.             for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  30.                 if (document.layers[iLayer].id == "NavBar") {
  31.                     document.layers[iLayer].visibility = gBsStyVisHide;
  32.                 }
  33.             }
  34.             if ((document.images.length > 0) && (document.images[0].src.indexOf('bsscnav1.gif') != -1)) {
  35.                 document.links[0].href = "javascript:void(null);";
  36.             }
  37.         }
  38.     }
  39.     
  40.     return;
  41. }
  42.  
  43.  
  44.  
  45. //////////////////////////////////////////////////////////////////////////////////////////////
  46. //
  47. //    Begin DHTML Popup Functions
  48. //
  49. //////////////////////////////////////////////////////////////////////////////////////////////
  50. //variables used to isolate the browser type
  51. var gBsDoc            = null;            
  52. var gBsSty            = null;
  53. var gBsHtm            = null;
  54. var gBsStyVisShow    = null;
  55. var gBsStyVisHide    = null;
  56. var gBsClientWidth    = 640;
  57. var gBsClientHeight = 480;
  58. var gBsBrowser        = null;
  59.  
  60. // here is the varible for judge popup windows size. these parameter is for IE5.0, it may need adjust for others.
  61. var gBRateH_W        = 0.618; // 1.618 Golden cut.
  62. var gBMaxXOfParent    = 0.8; 
  63. var gBMaxYOfParent    = 0.8;
  64. var gBscrollHeight   = 16;
  65. var gBscrollWidth   =  16;
  66. var gBpermitXDelta    = 3;
  67. var gBpermitYDelta    = 3;
  68.  
  69.  
  70.  
  71. //the browser information itself
  72. function _BSPSBrowserItself()
  73. {
  74.     var agent  = navigator.userAgent.toLowerCase();
  75.     this.major = parseInt(navigator.appVersion);
  76.     this.minor = parseFloat(navigator.appVersion);
  77.     this.ns    = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
  78.     this.ns2   = ((this.ns) && (this.major == 2));
  79.     this.ns3   = ((this.ns) && (this.major == 3));
  80.     this.ns4   = ((this.ns) && (this.major >= 4));
  81.     this.ie       = (agent.indexOf("msie") != -1);
  82.     this.ie3   = ((this.ie) && (this.major == 2));
  83.     this.ie4   = ((this.ie) && (this.major >= 4));
  84.     this.op3   = (agent.indexOf("opera") != -1);
  85.  
  86.     if (this.ns4)
  87.     {
  88.         gBsDoc        = "document";
  89.         gBsSty        = "";
  90.         gBsHtm        = ".document";
  91.         gBsStyVisShow    = "show";
  92.         gBsStyVisHide    = "hide";
  93.  
  94.     }
  95.     else if (this.ie4)
  96.     {
  97.         gBsDoc         = "document.all";
  98.         gBsSty         = ".style";
  99.         gBsHtm         = "";
  100.         gBsStyVisShow    = "visible";
  101.         gBsStyVisHide    = "hidden";
  102.     }
  103. }
  104.  
  105. //Here is the browser type 
  106. function _BSPSGetBrowserInfo()
  107. {
  108.     gBsBrowser    = new _BSPSBrowserItself();
  109. }
  110.  
  111. //Get client size info
  112. function _BSPSGetClientSize()
  113. {
  114.     if (gBsBrowser.ns4)
  115.     {
  116.         gBsClientWidth    = innerWidth;
  117.         gBsClientHeight = innerHeight;
  118.  
  119.     }
  120.     else if (gBsBrowser.ie4)
  121.     {
  122.         gBsClientWidth    = document.body.clientWidth;
  123.         gBsClientHeight = document.body.clientHeight;
  124.     }
  125. }
  126.  
  127.  
  128. var gstrPopupID = 'BSSCPopup';
  129. var gstrPopupShadowID = 'BSSCPopupShadow';
  130. var gstrPopupTopicID = 'BSSCPopupTopic';
  131. var gstrPopupIFrameID = 'BSSCPopupIFrame';
  132. var gstrPopupIFrameName = 'BSSCPopupIFrameName';
  133.  
  134. var gstrPopupSecondWindowName = 'BSSCPopup';
  135.  
  136. var    gPopupDiv = null;
  137. var gPopupDivStyle = null;
  138. var    gPopupShadow = null;
  139. var    gPopupTopic = null;
  140. var gPopupIFrame = null;
  141. var gPopupIFrameStyle = null;
  142. var gPopupWindow = null;
  143. var gnPopupClickX = 0;
  144. var gnPopupClickY = 0;
  145.  
  146. var gnPopupScreenClickX = 0;
  147. var gnPopupScreenClickY = 0;
  148.  
  149. var gbPopupTimeoutExpired = false;
  150.  
  151. var gbScriptName = "EHELP_DHTM";
  152. var gbPathofJS = "";
  153.  
  154.  
  155. if (gbIE4) {
  156.     var aScripts = document.scripts;
  157.     var aScript = null;
  158.     var i = 0;
  159.     for (i = 0; i < aScripts.length ; i ++ )
  160.     {
  161.         if (aScripts[i].name == gbScriptName) {
  162.             aScript = aScripts[i];
  163.             break;
  164.         }
  165.         
  166.     }
  167.  
  168.     if (aScript != null) {
  169.         var nPathPos = 0;
  170.         var strCurrentSrc = "";
  171.         strCurrentSrc = aScript.src;
  172.         var nPathPos1 = strCurrentSrc.lastIndexOf("\\");
  173.         var nPathPos2 = strCurrentSrc.lastIndexOf("/");
  174.         if (nPathPos1 > nPathPos2)
  175.             nPathPos = nPathPos1 + 1;
  176.         else
  177.             nPathPos = nPathPos2 + 1;
  178.  
  179.         gbPathofJS = strCurrentSrc.substring(0, nPathPos);
  180.     }
  181. }
  182.  
  183. // Replace point - Used by SingleSource 
  184. // var gbBlankPageForIFrame = gbPathofJS + "_blank.htm";
  185. var gbBlankPageForIFrame = "about:blank";
  186.  
  187. if (BSSCPopup_IsPopup()) {
  188.     document.write("<base target=\"_parent\">");
  189. }
  190.  
  191. function DHTMLPopupSupport()
  192. {
  193.     if ((gbIE4) && (!gbMac)) {
  194.         return true;
  195.     }
  196.     return false;
  197. }
  198.  
  199.  
  200.  
  201. function BSSCPopup_IsPopup()
  202. {
  203.     if (DHTMLPopupSupport() && (this.name == gstrPopupIFrameName)) {
  204.         return true;
  205.     } else if ((gbNav4 || gbIE4) && (this.name == gstrPopupID)) {
  206.         return true;
  207.     } else {
  208.         return false;
  209.     }
  210. }
  211.  
  212. var gbBsPopupDivInit = false;
  213. function _BSSCCreatePopupDiv()
  214. {
  215.     if (!gbBsPopupDivInit) {
  216.         if (DHTMLPopupSupport()) {
  217.             document.write("<DIV ID='" + gstrPopupID + "' STYLE='position:absolute; width:0; height:0; top:-100; left:0; z-index:600; visibility:hidden;'>");
  218.             document.write("<DIV ID='" + gstrPopupShadowID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#C0C0C0;\"></DIV>");
  219.             document.write("<DIV ID='" + gstrPopupTopicID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#FFFFFF;border:1px #000000 outset;\">");
  220.             document.write("<IFRAME ID='" + gstrPopupIFrameID + "' name='" + gstrPopupIFrameName + "' src = '" + gbBlankPageForIFrame + "' frameborder=0 scrolling=auto></IFRAME>");
  221.             document.write("</DIV></DIV>");
  222.         }
  223.     }
  224.     gbBsPopupDivInit = true;
  225. }
  226.  
  227. function BSSCPopup_Timeout()
  228. {
  229.     if ((gPopupIFrame.document.readyState == "complete") &&
  230.         (gPopupIFrame.document.body != null) && 
  231.         (gPopupIFrame.location.href.indexOf(gbBlankPageForIFrame) == -1)) {
  232.         window.gPopupDivStyle.visibility = gBsStyVisShow;
  233.         BSSCPopup_TimeoutReal();
  234.     } else {
  235.         setTimeout("BSSCPopup_Timeout()", 100);
  236.     }
  237. }
  238.  
  239. function BSSCPopup_TimeoutReal()
  240. {
  241.     window.gbPopupTimeoutExpired = true;
  242.  
  243.     if (gPopupIFrame.document) {
  244.         BSSCPopup_ChangeTargettoParent(gPopupIFrame.document);
  245.         gPopupIFrame.document.body.onclick = BSSCPopupClicked;
  246.     }
  247.     document.onmousedown = BSSCPopupParentClicked;
  248. }
  249.  
  250. function BSSCPopup_ChangeTargettoParent(tagsObject)
  251. {
  252.     var collA = tagsObject.all.tags("A");
  253.     var j = 0;
  254.     if (collA != null) {
  255.         for (j = 0; j < collA.length; j ++ )
  256.         {
  257.             collA[j].target = "_parent";
  258.         }
  259.  
  260.     }
  261. }
  262.  
  263. function BSPSPopupTopicWinHelp(strURL)
  264. {
  265.     _BSSCPopup(strURL);
  266.     return;
  267. }
  268.  
  269. function _BSSCPopup(strURL)
  270. {
  271.     if (DHTMLPopupSupport()) {
  272.  
  273.         // If we are already in a popup, replace the contents
  274.         if (BSSCPopup_IsPopup()) {
  275.  
  276.             location.href = strURL;
  277.             parent.window.gbPopupTimeoutExpired = false;
  278.             if (gbMac) {
  279.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 400);
  280.             } else {
  281.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 100);
  282.             }
  283.             
  284.         } else {
  285.             var tempColl = document.all.tags("DIV");
  286.             for (var iDiv = 0; iDiv < tempColl.length; iDiv++) {
  287.                 if (tempColl(iDiv).id == gstrPopupID) {
  288.                     gPopupDiv = tempColl(iDiv);
  289.                 }
  290.                 if (tempColl(iDiv).id == gstrPopupShadowID) {
  291.                     gPopupShadow = tempColl(iDiv);
  292.                 }
  293.                 if (tempColl(iDiv).id == gstrPopupTopicID) {
  294.                     gPopupTopic = tempColl(iDiv);
  295.                 }
  296.             }
  297.             
  298.             gPopupIFrame = eval("gPopupDiv.document.frames['" + gstrPopupIFrameName + "']");
  299.             gPopupDivStyle = eval("gPopupDiv" + gBsSty);
  300.             gPopupIFrameStyle = eval(gBsDoc + "['" + gstrPopupIFrameName + "']" + gBsSty);
  301.  
  302.  
  303.             // Load the requested URL into the IFRAME
  304.             gPopupIFrame.location.href = strURL;
  305.             window.gbPopupTimeoutExpired = false;
  306.             if (gbMac) {
  307.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 400);
  308.             } else {
  309.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 100);
  310.             }
  311.         }
  312.  
  313.     } else {
  314.         _BSSCPopup2(strURL);
  315.     }
  316.     return;
  317. }
  318.  
  319.  
  320. function _BSSCPopup2(strURL)
  321. {
  322.     if (window.name == gstrPopupSecondWindowName) {
  323.         window.location = strURL;
  324.     } else {
  325.  
  326.         BSSCHidePopupWindow();
  327.         var nX = 0;
  328.         var nY = 0;
  329.         var nHeight = 300;
  330.         var nWidth = 400;
  331.         _BSPSGetClientSize();
  332.         if (gBsBrowser.ns4) {
  333.             nX = window.screenX + (window.outerWidth - window.innerWidth) + window.gnPopupClickX;
  334.             nY = window.screenY + (window.outerHeight - window.innerHeight) + window.gnPopupClickY;
  335.         } else {
  336.             nX = window.gnPopupScreenClickX;
  337.             nY = window.gnPopupScreenClickY;
  338.         }
  339.         if (nY + nHeight + 40 > screen.availHeight) {
  340.             nY = screen.availHeight - nHeight - 40;
  341.         }
  342.         if (nX + nWidth + 40 > screen.availWidth) {
  343.             nX = screen.availWidth - nWidth - 40;
  344.         }
  345.         // Launch a separate window
  346.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes";
  347.         if (gBsBrowser.ns) {
  348.             strParam += ",OuterHeight=" + nHeight + ",OuterWidth=" + nWidth;
  349.             strParam += ",screenX=" + nX + ",screenY=" + nY;
  350.             strParam += ",dependent=yes";
  351.         }
  352.         else {
  353.             strParam += ",height=" + nHeight + ",width=" + nWidth;
  354.             strParam += ",left=" + nX + ",top=" + nY;
  355.         }
  356.         window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam);
  357.         if (gBsBrowser.ns4) {
  358.             window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE);
  359.             window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  360.             window.gPopupWindow.onblur = NonIEPopup_HandleBlur;
  361.         }
  362.         else if (gBsBrowser.ie4)
  363.         {
  364.             window.gPopupWindow.focus();
  365.         }
  366.     }
  367.     return;
  368. }
  369.  
  370. function NonIEPopup_HandleBlur(e)
  371. {
  372.     window.gPopupWindow.focus();
  373. }
  374.  
  375. function NonIEPopup_HandleClick(e)
  376. {
  377.     // Because navigator will give the event to the handler before the hyperlink, let's
  378.     // first route the event to see if we are clicking on a Popup menu in a popup.
  379.     document.routeEvent(e);
  380.  
  381.     // If a popup menu is active then don't do anything with the click
  382.     if (window.gPopupWindow.gbInPopupMenu) {
  383.         window.gPopupWindow.captureEvents(Event.CLICK);
  384.         window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  385.         return false;
  386.     }
  387.  
  388.     // Close the popup window
  389.     if (e.target.href != null) {
  390.         window.location.href = e.target.href;
  391.         if (e.target.href.indexOf("BSSCPopup") == -1) {
  392.             this.close();
  393.         }
  394.     } else {
  395.         this.close();
  396.     }
  397.     return false;
  398. }
  399.  
  400. function BSSCPopup_AfterLoad(strURL)
  401. {    
  402.     if (typeof(window.gPopupIFrame.document) == "unknown") {
  403.         _BSSCPopup2(strURL);
  404.         return;
  405.     }
  406.     if ((window.gPopupIFrame.document.readyState == "complete") &&
  407.         (window.gPopupIFrame.document.body != null) && 
  408.         (window.gPopupIFrame.location.href.indexOf(gbBlankPageForIFrame) == -1)) {
  409.         BSSCPopup_ResizeAfterLoad(strURL);
  410.     }  else {
  411.         setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 200);
  412.     }
  413. }
  414.  
  415.  
  416. function BSSCPopup_ResizeAfterLoad(strURL)
  417. {
  418.     window.gPopupDivStyle.visibility = gBsStyVisHide;
  419.  
  420.     // Determine the width and height for the window
  421.     //var size = new BSSCSize(0, 0);
  422.     //BSSCGetContentSize(window.gPopupIFrame, size);
  423.     //var nWidth = size.x;
  424.     //var nHeight = size.y;
  425.  
  426.  
  427.     _BSPSGetClientSize();
  428.  
  429.     var size = new BSSCSize(0, 0);
  430.  
  431.     BSSCGetContentSize(window.gPopupIFrame, size);
  432.  
  433.     // Determine the width and height for the window
  434.     var nWidth = size.x;
  435.     var nHeight = size.y;
  436.         
  437.     window.gPopupDivStyle.width = nWidth;
  438.     window.gPopupDivStyle.height = nHeight;
  439.  
  440.     // Determine the position of the window
  441.     var nClickX = window.gnPopupClickX;
  442.     var nClickY = window.gnPopupClickY;
  443.     var nTop = 0;
  444.     var nLeft = 0;
  445.  
  446.     if (nClickY + nHeight + 20 < gBsClientHeight + document.body.scrollTop) {
  447.         nTop = nClickY + 10;
  448.     } else {
  449.         nTop = (document.body.scrollTop + gBsClientHeight) - nHeight - 20;
  450.     }
  451.     if (nClickX + nWidth < gBsClientWidth + document.body.scrollLeft) {
  452.         nLeft = nClickX;
  453.     } else {
  454.         nLeft = (document.body.scrollLeft + gBsClientWidth) - nWidth - 8;
  455.     }
  456.     
  457.     if (nTop < document.body.scrollTop ) nTop  = document.body.scrollTop + 1;
  458.     if (nLeft< document.body.scrollLeft) nLeft = document.body.scrollLeft + 1;
  459.  
  460.  
  461.     window.gPopupDivStyle.left = nLeft;
  462.     window.gPopupDivStyle.top = nTop;
  463.  
  464.     // Set the location of the background blocks
  465.     window.gPopupShadow.style.left = 6;
  466.     window.gPopupShadow.style.top = 6;
  467.     if (gbIE55)
  468.     {
  469.         window.gPopupShadow.style.left = 4;
  470.         window.gPopupShadow.style.top = 4;
  471.     }
  472.     window.gPopupShadow.style.width = nWidth;
  473.     window.gPopupShadow.style.height = nHeight;
  474.     window.gPopupTopic.style.width = nWidth;
  475.     window.gPopupTopic.style.height = nHeight;
  476.     if (gbIE55)
  477.     {
  478.         window.gPopupShadow.style.width = nWidth + 2;
  479.         window.gPopupShadow.style.height = nHeight + 2;
  480.         window.gPopupTopic.style.width = nWidth + 2;
  481.         window.gPopupTopic.style.height = nHeight + 2;
  482.     }
  483.  
  484.  
  485.     if (gbMac) {
  486.         // Total hack on the iMac to get the IFrame to position properly
  487.         window.gPopupIFrameStyle.pixelLeft = 100;
  488.         window.gPopupIFrameStyle.pixelLeft = 0;
  489.         // Explicitly call BSSCOnLoad because the Mac doesn't seem to do it
  490.         window.gPopupIFrame.window.BSSCOnLoad();
  491.     }
  492.     //var nOriWidth = window.gPopupIFrameStyle.width
  493.  
  494.     window.gPopupIFrameStyle.width = nWidth;
  495.     window.gPopupIFrameStyle.height = nHeight;
  496.     if (gbIE55)
  497.     {
  498.         window.gPopupIFrameStyle.top = 0;
  499.         window.gPopupIFrameStyle.left = 0;
  500.     }
  501.  
  502.     gPopupIFrame.location.href = strURL;  // reload again, this will fix the bookmark misunderstand in IE5.
  503.  
  504.     if (gbIE55)
  505.     {
  506.         window.gPopupDivStyle.visibility = gBsStyVisShow;
  507.     }
  508.  
  509.     setTimeout("BSSCPopup_Timeout();", 100);
  510.     
  511.     return false;
  512. }
  513.  
  514.  
  515. function    BSSCSize(x, y)
  516. {
  517.     this.x = x;
  518.     this.y = y;
  519. }
  520.  
  521. function BSSCGetContentSize(thisWindow, size)
  522. {
  523.     if (!((gBsBrowser.ie4) || (gBsBrowser.ns4)))
  524.         return;
  525.  
  526.     if (gbMac) {
  527.         size.x = 300;
  528.         size.y = 300;
  529.         return;
  530.     }
  531.  
  532.     // Resize the width until it is wide enough to handle the content
  533.     // The trick is to start wide and determine when the scrollHeight changes
  534.     // because then we know a scrollbar is necessary. We can then go back
  535.     // to the next widest size (for no scrollbar)
  536.  
  537.     var ClientRate = gBsClientHeight / gBsClientWidth;
  538.  
  539.     var GoldenSize = new BSSCSize(0,0);
  540.     GoldenSize.x = gBsClientWidth * gBMaxXOfParent;
  541.     GoldenSize.y = gBsClientHeight *gBMaxYOfParent ;
  542.  
  543.     if (ClientRate > gBRateH_W) {
  544.         GoldenSize.y = GoldenSize.x * gBRateH_W;
  545.     }
  546.     else {
  547.         GoldenSize.x = GoldenSize.y / gBRateH_W;
  548.     }
  549.  
  550.     // Try to using parent specified max x.
  551.     var x = 0;
  552.     var maxgoldx = GoldenSize.x;
  553.     var maxx = gBsClientWidth * gBMaxXOfParent;
  554.     
  555.     // This double resize causes the document to re-render (and we need it to)
  556.     thisWindow.moveTo(10000,10000); // this is used to fix the flash on IE4.
  557.     thisWindow.resizeTo(1, 1);
  558.     thisWindow.resizeTo(1, 1);
  559.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  560.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  561.         
  562.     var miny = thisWindow.document.body.scrollHeight + gBscrollHeight;
  563.     
  564.     if (miny > GoldenSize.y) // the popup does not fix in the parent wanted golden area. so try to expand itself as large as it can
  565.     {
  566.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  567.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  568.         
  569.         miny =     thisWindow.document.body.scrollHeight + gBscrollHeight;
  570.         maxy = gBsClientHeight * gBMaxYOfParent;
  571.         
  572.         if (miny > maxy) { // the popup must have a scroll, OK let it be.
  573.             miny = maxy;
  574.             size.x = maxx;
  575.             size.y = maxy;
  576.         }
  577.         else { // popup still can fit in the parent area by someway. now we choose the same h/w rate as parent.
  578.             size.y = miny;
  579.             
  580.             //  downsize from maxx , now I try to using binary divide.
  581.             x = maxx;
  582.             deltax = -maxx/2;
  583.             //j = 0;
  584.             while (true) {
  585.                 x = x + deltax;
  586.                 thisWindow.resizeTo(x, miny);
  587.                 thisWindow.resizeTo(x, miny);
  588.                 diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * ClientRate;
  589.                 if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  590.                     deltax = Math.abs(deltax) /2;
  591.                 else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  592.                     deltax = -Math.abs(deltax) /2;
  593.                 else 
  594.                     // the y is close enough to wanted.
  595.                     break;
  596.                 if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  597.                     break;
  598.                 //j ++;
  599.                 
  600.             }
  601.             size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth;
  602.             size.y = thisWindow.document.body.scrollHeight;// + gBscrollHeight;    
  603.             thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  604.             
  605.         // Handle absurd cases just in case IE flakes
  606.     //        if (size.y < 100) {
  607.     //            size.y = 100;
  608.     //        }
  609.         }
  610.     }
  611.     else {
  612.         //  downsize from maxgoldx , now I try to using binary divide.
  613.         x = maxgoldx;
  614.         deltax = -maxgoldx/2;
  615.         //i = 0;
  616.         while (true) {
  617.             x = x + deltax;
  618.             thisWindow.resizeTo(x, miny);
  619.             thisWindow.resizeTo(x, miny);
  620.             diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * gBRateH_W;
  621.             if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  622.                 deltax = Math.abs(deltax) /2;
  623.             else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  624.                 deltax = -Math.abs(deltax) /2;
  625.             else 
  626.                 // the y is close enough to wanted.
  627.                 break;
  628.             if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  629.                 break;
  630.             //i ++;
  631.                 
  632.         }
  633.         size.x = thisWindow.document.body.scrollWidth ;//+ gBscrollWidth;
  634.         size.y = thisWindow.document.body.scrollHeight ;//+ gBscrollHeight;    
  635.         thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  636.     }
  637.  
  638.     if ((gbIE4) && (!gbIE5))
  639.     {
  640.         size.x = size.x + 16;    //reserve a width for scrollbar (IE 4.0 only)
  641.     }
  642.  
  643.     thisWindow.resizeTo(size.x, size.y);
  644.     thisWindow.resizeTo(size.x, size.y);
  645.  
  646.     return;
  647. }
  648.  
  649.  
  650.  
  651. function BSSCPopupParentClicked()
  652. {
  653.     BSSCPopupClicked();
  654.     return;
  655. }
  656.  
  657.  
  658. function BSSCPopupClicked()
  659. {
  660.     if (!window.gbPopupTimeoutExpired) {
  661.         return false;
  662.     }
  663.  
  664.     if (gPopupIFrame.window.gbInPopupMenu) {
  665.         return false;
  666.     }
  667.  
  668.     // Give the user a message about javascript calls through objects.
  669.     if ((gPopupIFrame.window.event != null) &&
  670.         (gPopupIFrame.window.event.srcElement != null) &&
  671.         (gPopupIFrame.window.event.srcElement.tagName == "A") &&
  672.         (gPopupIFrame.window.event.srcElement.href.indexOf("javascript:") == 0) &&
  673.         (gPopupIFrame.window.event.srcElement.href.indexOf(".") != -1)) {
  674.         gPopupIFrame.window.event.cancelBubble = true;
  675.         alert('Hyperlinks to objects do not work in popups.');
  676.         return false;
  677.     }
  678.  
  679.     document.onclick = null;
  680.     document.onmousedown = null;
  681.  
  682.     // Simply hide the popup
  683.     gPopupDivStyle.visibility = gBsStyVisHide;
  684.     gPopupIFrame.location.href = gbBlankPageForIFrame;
  685.  
  686.     window.gbPopupTimeoutExpired = false;
  687.  
  688.  
  689.     return true;
  690. }
  691.  
  692.  
  693. //trace the mouse over's position for hotspot
  694. function  BSPSPopupOnMouseOver(event)
  695. {
  696.     if (gBsBrowser.ie4) {
  697.         window.gnPopupClickX = event.clientX + document.body.scrollLeft;
  698.         window.gnPopupClickY = event.clientY + document.body.scrollTop;
  699.         window.gnPopupScreenClickX = event.screenX;
  700.         window.gnPopupScreenClickY = event.screenY;
  701.     } else if (gBsBrowser.ns4) {
  702.         window.gnPopupClickX = event.pageX;
  703.         window.gnPopupClickY = event.pageY;
  704.     }
  705. }
  706.  
  707. function BSSCHidePopupWindow()
  708. {
  709.     if (window.gPopupWindow != null) {
  710.         if (gBsBrowser.ns4) {
  711.             if ((typeof window.gPopupWindow != "undefined") && (!window.gPopupWindow.closed)) {
  712.                 window.gPopupWindow.close();
  713.                 window.gPopupWindow = null;
  714.             }
  715.         }
  716.     }
  717.  
  718.     return;
  719. }
  720.  
  721. var gbPopupMenuTimeoutExpired = false;
  722. var gbInPopupMenu = false;
  723. var gbPopupMenuTopicList = null;
  724.  
  725. //////////////////////////////////////////////////////////////////////////////////////////
  726. //
  727. // Popup Menu code
  728. //
  729. //////////////////////////////////////////////////////////////////////////////////////////
  730.  
  731.  
  732. function _WritePopupMenuLayer()
  733. {
  734.     if (gbNav4) {
  735. //Do not try to write ininle styles for NS!  NS can not handle it and will not stop downloading the html page...
  736.        var strStyle = "";
  737.        strStyle += "<style>";
  738.        strStyle += "<!--"
  739.        strStyle += "div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}";
  740.        strStyle += "-->";
  741.        strStyle += "</style>";
  742.        document.write(strStyle);
  743.        document.write("<DIV CLASS='WebHelpPopupMenu' ID='PopupMenu'></DIV>");
  744.     } else {         document.write("<DIV ID='PopupMenu' STYLE='position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;'></DIV>");
  745.            if (gbIE4) {
  746.         document.write("<STYLE TYPE='text/css'>");
  747.         if (gbMac) {
  748.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:10pt; text-decoration:none;}");
  749.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:10pt; text-decoration:none;}");
  750.         } else {
  751.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:8pt; text-decoration:none;}");
  752.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:8pt; text-decoration:none;}");
  753.         }
  754.         document.write("</STYLE>");
  755.            }
  756.     }
  757. }
  758.  
  759. //Define variable arguments as: strTitle, strUrl
  760. function PopupMenuTopicEntry() 
  761. {
  762.     this.strTitle = PopupMenuTopicEntry.arguments[0];
  763.     this.strURL = PopupMenuTopicEntry.arguments[1];
  764. }
  765.  
  766. // If the topic list is set, it is an array of TopicEntry objects (defined in WebHelp3.js)
  767. function PopupMenu_SetTopicList(aPopupTopicArray)
  768. {
  769.     gbPopupMenuTopicList = aPopupTopicArray;
  770. }
  771.  
  772. //Seek for the bsscright frame 
  773. function _SeekFrameByName( cRoot, strName )
  774. {
  775.     if( cRoot == null )    return null;
  776.     if( cRoot.frames == null )    return null;
  777.     if( cRoot.frames[strName] != null )    return cRoot.frames[strName];
  778.     for (var i=0; i<cRoot.frames.length; i++)
  779.     {
  780.         var cObj = _SeekFrameByName( cRoot.frames(i).document, strName );
  781.         if( cObj != null )        return cObj;
  782.     };
  783.     return null;
  784. }
  785. function _GetFrameByName( cRoot, strName )
  786. {
  787.     if( cRoot == null )    return null;
  788.     var cRet = _SeekFrameByName(cRoot, strName);
  789.     if( cRet != null )    return cRet;
  790.     return _GetFrameByName( cRoot.parent, strName );
  791. }
  792.  
  793. function _PopupMenu_Invoke(fn_arguments)
  794. {
  795.     if ((!gbIE4 && !gbNav4) || ((gbMac) && (gbIE4) && (window.event.srcElement.tagName == "AREA"))) {
  796.     
  797.         var argLen     = fn_arguments.length;
  798.  
  799.         // Create the window that the hyperlinks will go into
  800.         var nHeight = argLen * 15;
  801.         var nWidth = 400;
  802.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  803.         strParam += ",height=" + nHeight + ",width=200";
  804.         strParam += ",resizable";
  805.  
  806.         // Create a temporary window first to ensure the real popup comes up on top
  807.         var wndTemp = window.open("", "temp", strParam);
  808.  
  809.         // Create the real popup window
  810.         var wndPopupLinks = window.open("", "popuplinks", strParam);
  811.  
  812.         // Close the temporary
  813.         wndTemp.close();
  814.  
  815.         wndPopupLinks.document.open("text/html");
  816.         wndPopupLinks.document.write("<html><head></head>");
  817.         wndPopupLinks.document.write("<body onBlur=\'self.focus();\'>");
  818.         var strParaLine = "";
  819.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  820.             strParaLine = "";
  821.             strParaLine += "<a href=\"javascript:";
  822.             if (gbIE) {
  823.                 strParaLine += "onBlur=null; ";
  824.             }
  825.             strParaLine += "opener.location=\'";
  826.             strParaLine += fn_arguments[2 * i + 3];
  827.             strParaLine += "\';close();\"";
  828.             if (fn_arguments[1] != '') {
  829.                 strParaLine += " TARGET='" + fn_arguments[1] + "'";
  830.             }
  831.             strParaLine += ">";
  832.             strParaLine += fn_arguments[2 * i + 2];
  833.             strParaLine += "</a>";
  834.             strParaLine += "<br>";
  835.             wndPopupLinks.document.write(strParaLine);
  836.         }
  837.         wndPopupLinks.document.write("</body></html>");
  838.         wndPopupLinks.document.close();
  839.         window.gbInPopupMenu = true;
  840.         if (!gbIE) {
  841.             wndPopupLinks.focus();
  842.         }
  843.  
  844.         return false;
  845.     }
  846.  
  847.     // Make sure we have reasonable arguments
  848.     var argLen = fn_arguments.length;
  849.     if (argLen < 3) {
  850.         return false;
  851.     }
  852.  
  853.     // Check to see if we only have one target
  854.     var strTarget = "";
  855.     if (((argLen < 5) && ((isNaN(fn_arguments[2])) || (gbPopupMenuTopicList == null))) ||
  856.         ((argLen < 4) && ((!isNaN(fn_arguments[2])) && (gbPopupMenuTopicList != null)))) {
  857.  
  858.         // Get the place that we will be putting the topic into
  859.         var targetDoc = null;
  860.         if (fn_arguments[1] == '') {
  861.             targetDoc = window.document;
  862.         } else {
  863.             targetDoc = _GetFrameByName( parent, fn_arguments[1] );
  864.             if (targetDoc == null) {
  865.                 targetDoc  = window.document;
  866.             }
  867.             //if (gbIE4) {
  868.             //        targetDoc = eval("top.document.frames['" + fn_arguments[1] + "']");
  869.             //    } else if (gbNav4) {
  870.             //    targetDoc = eval("window.top." + fn_arguments[1] + ".document");
  871.             //}
  872.             strTarget = "TARGET='" + fn_arguments[1] + "'";
  873.         }
  874.         if (isNaN(fn_arguments[2]) ||  (gbPopupMenuTopicList == null)) {
  875.             targetDoc.location.href = fn_arguments[3];
  876.         } else {
  877.             targetDoc.location.href = gbPopupMenuTopicList[fn_arguments[2]].strURL;
  878.         }
  879.         return false;
  880.     }
  881.     
  882.     var strMenu = "";
  883.     if (gbNav4) {
  884.         strMenu = '<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=3 BGCOLOR="#c0c0c0">';
  885.     } else {
  886.         strMenu = '<TABLE STYLE="border:2px outset white;" CELLSPACING=0';
  887.         if (gbMac) {
  888.             strMenu += ' CELLPADDING=4';
  889.         } else {
  890.             strMenu += ' CELLPADDING=2';
  891.         }    
  892.         strMenu += ' BGCOLOR=#c0c0c0>';
  893.     }
  894.  
  895.     // Add each of the items
  896.     var i = 2;
  897.     while (i <= argLen - 1) {
  898.         strMenu += '<TR><TD><NOBR>'
  899.         // If the destination is a number then look it up in the topic list
  900.         if (isNaN(fn_arguments[i]) ||  (gbPopupMenuTopicList == null)) {
  901.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + fn_arguments[i + 1] + '"' + strTarget;
  902.         } else {
  903.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + gbPopupMenuTopicList[fn_arguments[i]].strURL + '"' + strTarget;
  904.         }
  905.         strMenu += ' onclick="PopupMenu_HandleClick(event);"';
  906.         strMenu += ' onmouseover="PopupMenu_Over(event);"';
  907.         strMenu += ' onmouseout="PopupMenu_Out(event);"';
  908.         strMenu += '>';
  909.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  910.             strMenu += '<SPAN CLASS="PopupNotOver">' + fn_arguments[i] + '</SPAN>';
  911.         } else {
  912.             strMenu += '<SPAN CLASS="PopupNotOver">' + gbPopupMenuTopicList[fn_arguments[i]].strTitle + '</SPAN>';
  913.         }
  914.         strMenu += '</A></DIV></NOBR></TD></TR>';
  915.  
  916.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  917.             i += 2;
  918.         } else {
  919.             i += 1;
  920.         }
  921.     }
  922.     strMenu += "</TABLE>";
  923.  
  924.     if (gbMac) {
  925.     // totally hack. because ie5 in mac need something. </TABLE> is one of them. mac is mad.
  926.         strMenu +="<TABLE></TABLE>";
  927.     }
  928.  
  929.     var layerPopup = null;
  930.     var stylePopup = null;
  931.     var nEventX = 0;
  932.     var nEventY = 0;
  933.     var nWindowWidth = 0;
  934.     if (gbIE4) {
  935.  
  936.         layerPopup = document.all["PopupMenu"];
  937.         layerPopup.innerHTML = strMenu;
  938.         stylePopup = layerPopup.style;
  939.  
  940.         _BSPSGetClientSize();
  941.  
  942.         // Get the position of the item causing the event (relative to its parent)
  943.         //if (gbMac) {
  944.         if (true) {
  945.             nEventX = window.event.clientX;
  946.             nEventY = window.event.clientY;
  947.         } else {
  948.             //??? YJ: Can not remember why we calculate envent position by following code...
  949.             //but it is wrong in a case like: CENTER->P->TABLE:
  950.             //the offset positions of TABLE, P and CENTER are same (same offsetTop,offsetLeft)
  951.             //so we get triple times of offset of x and y as we expect... 
  952.  
  953.             nEventX = window.event.srcElement.offsetLeft - document.body.scrollLeft;
  954.             nEventY = window.event.srcElement.offsetTop - document.body.scrollTop;
  955.  
  956.             // Get the location of the parent
  957.             var nParentLocX = 0;
  958.             var nParentLocY = 0;
  959.  
  960.             var ParentItem = window.event.srcElement.offsetParent;
  961.             while (ParentItem != null) {
  962.                 if (ParentItem.offsetLeft)    {
  963.                     nParentLocX += ParentItem.offsetLeft;
  964.                     nParentLocY += ParentItem.offsetTop;
  965.                 }
  966.                 ParentItem = ParentItem.parentElement;
  967.             }
  968.  
  969.             // Adjust the location of the item using the location of the parent(s)
  970.             nEventX += nParentLocX;
  971.             nEventY += nParentLocY;
  972.         }
  973.  
  974.         if (nEventY + layerPopup.scrollHeight + 10 < gBsClientHeight) {
  975.             nEventY += document.body.scrollTop + 10;
  976.         } else {
  977.             nEventY = (document.body.scrollTop + gBsClientHeight) - layerPopup.scrollHeight - 20;
  978.         }
  979.         stylePopup.top = nEventY;
  980.  
  981.         if (nEventX + layerPopup.scrollWidth + 20 > gBsClientWidth) {
  982.             if (gBsClientWidth - layerPopup.scrollWidth < 5) {
  983.                 stylePopup.left = 5;
  984.             } else {
  985.                 stylePopup.left = gBsClientWidth - layerPopup.scrollWidth - 5;
  986.             }
  987.         } else {
  988.             stylePopup.left = nEventX + document.body.scrollLeft + 20;
  989.         }
  990.  
  991.         stylePopup.visibility = "visible";
  992.         document.onclick = PopupMenu_HandleClick;
  993.     } else if (gbNav4) {
  994.         layerPopup = document.layers.PopupMenu;
  995.         layerPopup.visibility = "hide";
  996.         stylePopup = layerPopup.document;
  997.         stylePopup.write(strMenu);
  998.         stylePopup.close();
  999.         var e = fn_arguments[0];
  1000.         nEventX = e.pageX;
  1001.         nEventY = e.pageY;
  1002.         _BSPSGetClientSize();
  1003.         if (nEventY + layerPopup.clip.height + 20 < window.pageYOffset + gBsClientHeight) {
  1004.             nEventY += 20;
  1005.         } else {
  1006.             nEventY = gBsClientHeight + window.pageYOffset- layerPopup.clip.height - 20;
  1007.         }
  1008.         layerPopup.top = nEventY;
  1009.  
  1010.         if (nEventX + layerPopup.clip.width + 20 > gBsClientWidth + window.pageXOffset) {
  1011.             if (gBsClientWidth + window.pageXOffset - layerPopup.clip.width < 20) {
  1012.                 nEventX = 5;
  1013.             } else {
  1014.                 nEventX = gBsClientWidth + window.pageXOffset - layerPopup.clip.width - 20;
  1015.             }
  1016.         } else {
  1017.             nEventX += 20;
  1018.         }
  1019.  
  1020.         layerPopup.left = nEventX;
  1021.  
  1022.         layerPopup.visibility = "show";
  1023.  
  1024. //        window.captureEvents(Event.CLICK | Event.MOUSEDOWN);
  1025.         window.captureEvents(Event.MOUSEDOWN);
  1026. //        window.onclick = PopupMenu_HandleClick;
  1027.         window.onmousedown = PopupMenu_HandleClick;
  1028.     }
  1029.  
  1030.     window.gbInPopupMenu = true;
  1031.     window.gbPopupMenuTimeoutExpired = false;
  1032.     setTimeout("PopupMenu_Timeout();", 100);
  1033.     return false;
  1034. }
  1035.  
  1036.  
  1037. function PopupMenu_Timeout()
  1038. {
  1039.     window.gbPopupMenuTimeoutExpired = true;
  1040. }
  1041.  
  1042. function PopupMenu_Over(e)
  1043. {
  1044.     if (gbIE4) {
  1045.         e.srcElement.className = "PopupOver";
  1046.     } else if (gbNav4) {
  1047. //        this.bgColor = "red";
  1048. //        e.target.document.className = "PopupOver";
  1049.     }
  1050.     return;
  1051. }
  1052.  
  1053. function PopupMenu_Out(e)
  1054. {
  1055.     if (gbIE4) {
  1056.         e.srcElement.className = "PopupNotOver";
  1057.     } else if (gbNav4) {
  1058.         this.bgColor = "#f0f0f0";
  1059.     }
  1060.     return;
  1061. }
  1062.  
  1063.  
  1064. function PopupMenu_HandleClick(e)
  1065. {
  1066.     if (!window.gbPopupMenuTimeoutExpired) {
  1067.         return;
  1068.     }
  1069.  
  1070.     window.gbInPopupMenu = false;
  1071.  
  1072.     if (gbNav4) {
  1073. //        window.releaseEvents(Event.CLICK);
  1074.         window.releaseEvents(Event.MOUSEDOWN);
  1075.     }
  1076.  
  1077.     var layerPopup = null;
  1078.     var stylePopup = null;
  1079.     if (gbIE4) {
  1080.         layerPopup = document.all["PopupMenu"];
  1081.         stylePopup = layerPopup.style;
  1082.         stylePopup.visibility = "hidden";
  1083.     } else if (gbNav4) {
  1084.         layerPopup = document.layers.PopupMenu;
  1085.         layerPopup.visibility = "hide";
  1086.     }
  1087.  
  1088.     return;
  1089. }
  1090.  
  1091. // This function should be deleted when all old projects are cleaned up
  1092. function BSPSWritePopupFrameForIE4()
  1093. {
  1094.     return false;
  1095. }
  1096.  
  1097. /////////////////////////////////////////////////////////////////////
  1098. function BSSCPopup_ClickMac()
  1099. {
  1100.     if ((!DHTMLPopupSupport()) && (gbIE4))
  1101.     {    
  1102.         var bClickOnAnchor = false;
  1103.         var el;
  1104.         if ((window.event != null) &&
  1105.             (window.event.srcElement != null))
  1106.         {
  1107.             el = window.event.srcElement;
  1108.             while (el != null)
  1109.             {
  1110.                 if ((el.tagName == "A") || (el.tagName == "AREA"))     {
  1111.                     bClickOnAnchor = true;
  1112.                     break;
  1113.                 }
  1114.                 if (el.tagName == "BODY") {
  1115.                     break;
  1116.                 }
  1117.                 el = el.parentElement;
  1118.             }
  1119.         }
  1120.         if (BSSCPopup_IsPopup())
  1121.         {
  1122.             if (!bClickOnAnchor) {
  1123.                 parent.window.gPopupWindow = null;
  1124.                 self.close();
  1125.             }
  1126.         }
  1127.         else
  1128.         {
  1129.             bClosePopupWindow = true;
  1130.             if ((bClickOnAnchor) &&
  1131.                 (el.href) &&
  1132.                 (el.href.indexOf("javascript:BSSCPopup") != -1))
  1133.             {
  1134.                 bClosePopupWindow = false;
  1135.             }
  1136.             if (bClosePopupWindow)
  1137.             {
  1138.                 if (window.gPopupWindow != null)
  1139.                 {
  1140.                     var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400";
  1141.                     window.gPopupWindow = window.open("", gstrPopupSecondWindowName,strParam);
  1142.                     window.gPopupWindow.close();
  1143.                     window.gPopupWindow = null;
  1144.                 }
  1145.             }
  1146.         }
  1147.     }
  1148.  }
  1149.  
  1150. //////////////////////////////////////////////////////////////////////
  1151.  
  1152. _BSPSGetBrowserInfo();
  1153.  
  1154. function _BSSCOnLoad()
  1155. {
  1156.     if (!gbIE4 && !gbNav4)
  1157.         return;
  1158.  
  1159.     // Make everything visible in navigator
  1160.     if (gbNav4) {
  1161.         // Make some special effects items visible
  1162.         for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  1163.             document.layers[iLayer].visibility = gBsStyVisShow;
  1164.             document.layers[iLayer].left = 0;
  1165.         }
  1166.     }
  1167.  
  1168.     // Remove the NavBar if necessary
  1169.     RemoveNavBar();
  1170.         
  1171.     // Don't continue without IE4
  1172.     if (gbIE4) {
  1173.         HHActivateComponents();
  1174.         doStaticEffects();
  1175.         startAnimationSet(0);
  1176.     }
  1177. }
  1178.  
  1179. function _BSSCOnUnload()
  1180. {
  1181. }
  1182.  
  1183. function _BSSCOnClick()
  1184. {
  1185.     if (!gbIE4)
  1186.         return;
  1187.  
  1188.     BSSCPopup_ClickMac();
  1189.     startNextAnimationSet();
  1190. }
  1191.  
  1192. function _BSSCOnError(message)
  1193. {
  1194.     if(-1 != message.indexOf("denied") 
  1195.         || -1 != message.indexOf("Object required"))
  1196.      return true;
  1197. }
  1198.  
  1199.  
  1200. function ResizeBasedonRate(thisWindow, size, rate, maxx, maxy)
  1201. {
  1202.     x = maxx;
  1203.     y = maxy;
  1204.     deltax = -maxx/2;
  1205.     while (true) {
  1206.         x = x + deltax;
  1207.         thisWindow.resizeTo(x, y);
  1208.         thisWindow.resizeTo(x, y);
  1209.         diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * rate;
  1210.         if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  1211.             deltax = Math.abs(deltax) /2;
  1212.         else if (diffy <  -permitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  1213.             deltax = -Math.abs(deltax) /2;
  1214.         else 
  1215.             // the y is close enough to wanted.
  1216.             break;
  1217.         if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  1218.             break;
  1219.         //j ++;
  1220.                 
  1221.     }
  1222.     size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth;
  1223.     size.y = thisWindow.document.body.scrollHeight;// + gBscrollHeight;    
  1224.     thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  1225. }
  1226.  
  1227.