home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 August / INTERNET94.ISO / pc / software / windows / mail / ft_gate_office / officewebhelp / ehlpdht1.js < prev    next >
Encoding:
JavaScript  |  2002-02-27  |  47.1 KB  |  1,710 lines

  1. //// Segment Begin -- (JavaScript 1.0)
  2. // eHelp« Corporation Dynamic HTML JavaScript 
  3. // Copyright⌐ 1998-2000 eHelp« Corporation.All rights reserved.
  4. // Version=4.45
  5.  
  6. // Warning:Do not modify this file.It is generated by RoboHELP« and changes will be overwritten.
  7.  
  8.  
  9. /// Section Begin - General (JavaScript 1.0)
  10.  
  11. //{{HH_SYMBOL_SECTION
  12. var HH_ChmFilename = "";
  13. var HH_WindowName = "";
  14. var HH_GlossaryFont = "";
  15. var HH_Glossary = "";
  16. var HH_Avenue = "";
  17. var HH_ActiveX = false;
  18. //}}HH_SYMBOL_SECTION
  19.  
  20. //Begin to support previous generic parameters
  21. //Get the information about the browser.
  22. var gstrBsAgent     = navigator.userAgent.toLowerCase();
  23. var gnBsVer               = parseInt(navigator.appVersion);
  24.  
  25. var gbBsIE          = (gstrBsAgent.indexOf('msie') != -1);
  26. var gbBsNS          = (gstrBsAgent.indexOf('mozilla') != -1) && ((gstrBsAgent.indexOf('spoofer') == -1) && (gstrBsAgent.indexOf('compatible') == -1));
  27. var gbBsOpera        = (gstrBsAgent.indexOf('opera') != -1);
  28.  
  29. var gbBsIE3Before     = ((gbBsIE) && (gnBsVer <= 2));
  30. var gbBsNS3Before     = ((gbBsNS) && (gnBsVer <= 3));
  31.  
  32. var gbBsNS2            = ((gbBsNS) && (gnBsVer <= 2));
  33. var gbBsNS3            = ((gbBsNS) && (gnBsVer == 3));
  34. var gbBsIE300301    = ((gbBsIE) && (gnBsVer == 2) && ((gstrBsAgent.indexOf("3.00") != -1)||(gstrBsAgent.indexOf("3.0a") != -1)||(gstrBsAgent.indexOf("3.0b")!=-1)||(gstrBsAgent.indexOf("3.01")!=-1)));
  35. var gbBsIE302        = ((gbBsIE) && (gnBsVer == 2) && (gstrBsAgent.indexOf("3.02") != -1));
  36.  
  37. var gbBsNS4            = ((gbBsNS) && (gnBsVer >= 4));
  38. var gbBsIE4            = ((gbBsIE) && (gnBsVer >= 4));
  39. var gbBsIE5            = ((gbBsIE) && (gnBsVer >= 5));
  40. var gbBsIE55        = false;
  41.  
  42. gbBsIE = (navigator.appName.indexOf("Microsoft") != -1);
  43. if (parseInt(navigator.appVersion) >= 4) {
  44.  
  45.     gbBsIE4 = (navigator.appName.indexOf("Microsoft") != -1);
  46.  
  47.     if (gbBsIE4) {
  48.         if (gstrBsAgent.indexOf("msie 5.0") != -1) {
  49.             gbBsIE5 = true;
  50.         }
  51.         if (gstrBsAgent.indexOf("msie 5.5") != -1) { // curently IE 5.5 has some buggy stuff. we need do some remedy to our code.
  52.             gbBsIE55 = true;
  53.         }
  54.     }
  55. }
  56.  
  57. var gbBsMac            = (gstrBsAgent.indexOf('mac') != -1);
  58. var gbBsWindows        = ((gstrBsAgent.indexOf('win') != -1) || (gstrBsAgent.indexOf('16bit') != -1));
  59. var gbBsOp3            = (gstrBsAgent.indexOf('opera') != -1);
  60.  
  61. // Utilities functions.
  62. function BsscHasExtJs()
  63. {
  64.     if( gbBsIE3Before || gbBsNS3Before)
  65.         return false;
  66.     return true;
  67. }
  68.  
  69. // Register event handler
  70. var gBsOnLoads             = new Array();    // An array holds all the onload event handler.
  71. var gBsOnClicks         = new Array();    // An array holds all the onClick event handler.
  72. var gBsOnUnLoads         = new Array();    // An array holds all the OnUnLoad event handler.
  73. var gBsOnMouseOvers     = new Array();    // An array holds all the OnMouseOver event handler.
  74. var gBsOnMouseOuts         = new Array();    // An array holds all the OnMouseOut event handler.
  75.  
  76. var gbOrignalOnMouseDown = null;
  77.  
  78. function BsscRegisterOnLoad(funcHandler)
  79. {
  80.     var nLength = gBsOnLoads.length;
  81.     gBsOnLoads[nLength] = funcHandler;
  82. }
  83.  
  84. function BsscRegisterOnClick(funcHandler)
  85. {
  86.     var nLength = gBsOnClicks.length;
  87.     gBsOnClicks[nLength] = funcHandler;
  88. }
  89.  
  90. function BsscRegisterOnUnLoad(funcHandler)
  91. {
  92.     var nLength = gBsOnUnLoads.length;
  93.     gBsOnUnLoads[nLength] = funcHandler;
  94. }
  95.  
  96. function BsscRegisterOnMouseOver(funcHandler)
  97. {
  98.     var nLength = gBsOnMouseOvers.length;
  99.     gBsOnMouseOvers[nLength] = funcHandler;
  100. }
  101.  
  102. function BsscRegisterOnMouseOut(funcHandler)
  103. {
  104.     var nLength = gBsOnMouseOuts.length;
  105.     gBsOnMouseOuts[nLength] = funcHandler;
  106. }
  107.  
  108.  
  109. function BsGeneralOnLoad()
  110. {
  111.     if (!gbBsIE4 && !gbBsNS4)
  112.         return;
  113.  
  114.     // Make everything visible in navigator
  115.     if (gbBsNS4) {
  116.         // Make some special effects items visible
  117.         for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  118.             document.layers[iLayer].visibility = "show";
  119.             document.layers[iLayer].left = 0;
  120.         }
  121.     }
  122. }
  123.  
  124. // If resize the netscape browser, need to reload it.
  125. function BsReDo()
  126. {
  127.   if (innerWidth != origWidth || innerHeight != origHeight)
  128.      location.reload();
  129. }
  130. // End of the local functions.
  131.  
  132. // The following functions are used by the html files.
  133. function BSSCOnLoad()
  134. {
  135.     if( !BsscHasExtJs() )
  136.         return;
  137.     for (var nElement = gBsOnLoads.length - 1; nElement >= 0; nElement--)
  138.         gBsOnLoads[nElement]();
  139. }
  140.  
  141. function BSSCOnClick()
  142. {
  143.     if (!BsscHasExtJs()) return;
  144.         
  145.     for (var nElement = gBsOnClicks.length - 1; nElement >= 0; nElement--)
  146.         gBsOnClicks[nElement]();
  147. }
  148.  
  149. function BSSCOnUnload()
  150. {
  151.     if (!BsscHasExtJs()) return;
  152.     for (var nElement = gBsOnUnLoads.length - 1; nElement >= 0; nElement--)
  153.     {
  154.         gBsOnUnLoads[nElement]();
  155.     }
  156. }
  157.  
  158. function BSSCOnMouseOver()
  159. {
  160.     if (!BsscHasExtJs()) return;
  161.     for (var nElement = gBsOnMouseOvers.length - 1; nElement >= 0; nElement--)
  162.     {
  163.         gBsOnMouseOvers[nElement]();
  164.     }
  165. }
  166.  
  167. function BSSCOnMouseOut()
  168. {
  169.     if (!BsscHasExtJs()) return;
  170.     for (var nElement = gBsOnMouseOuts.length - 1; nElement >= 0; nElement--)
  171.     {
  172.         gBsOnMouseOuts[nElement]();
  173.     }
  174. }
  175. // End of invocation of the event handle functions.
  176.  
  177.  
  178. // Add the GereralOnLoad to the onload array.
  179. if (typeof(BsscRegisterOnLoad) != "undefined")
  180. {
  181.     BsscRegisterOnLoad(BsGeneralOnLoad);
  182. }
  183.  
  184. if (gbBsNS4) {
  185.     origWidth = innerWidth;
  186.     origHeight = innerHeight;
  187.     onresize = BsReDo;
  188. }
  189. //End to support previous generic parameters
  190.  
  191. //Begin to support previous HHActiveX invoking
  192. function BsHHActivateComponents()
  193. {
  194.     if( HH_ActiveX && (HH_ChmFilename != "") && ((self == top) || (self == top.frames[0])))
  195.     {
  196.         var objBody = document.all.tags("BODY")[0];
  197.         if( typeof(objBody) == "object" )
  198.         {
  199.             objBody.insertAdjacentHTML("beforeEnd", '<OBJECT ID="HHComponentActivator" CLASSID="CLSID:399CB6C4-7312-11D2-B4D9-00105A0422DF" width=0 height=0></OBJECT>');
  200.             if (HHComponentActivator.object)
  201.                 HHComponentActivator.Activate(HH_ChmFilename, HH_WindowName, HH_GlossaryFont, HH_Glossary, HH_Avenue);
  202.         }
  203.     }
  204. }
  205.  
  206. function BsHHActivXOnLoad()
  207. {    
  208.     if( gbBsIE4 )
  209.         BsHHActivateComponents(); 
  210. }
  211.  
  212. if( typeof(BsscRegisterOnLoad) != "undefined" )
  213. {
  214.     BsscRegisterOnLoad(BsHHActivXOnLoad);
  215. }
  216. //End to support previous HHActiveX invoking
  217.  
  218.  
  219. /// Section End - General (JavaScript 1.0)
  220.  
  221. /// Section Begin  - Popup and Related Topic (JavaScript 1.0)
  222.  
  223. //Begin to support previous popup functions
  224. //////////////////////////////////////////////////////////////////////////////////////////////
  225. //
  226. //    Begin DHTML Popup Functions
  227. //
  228. //////////////////////////////////////////////////////////////////////////////////////////////
  229. //variables used to isolate the browser type
  230. var gBsDoc            = null;            
  231. var gBsSty            = null;
  232. var gBsHtm            = null;
  233. var gBsStyVisShow    = null;
  234. var gBsStyVisHide    = null;
  235. var gBsClientWidth    = 640;
  236. var gBsClientHeight = 480;
  237. var gBsBrowser        = null;
  238.  
  239. // here is the varible for judge popup windows size. these parameter is for IE5.0, it may need adjust for others.
  240. var gBRateH_W        = 0.618; // 1.618 Golden cut.
  241. var gBMaxXOfParent    = 0.8; 
  242. var gBMaxYOfParent    = 0.8;
  243. var gBscrollHeight   = 16;
  244. var gBscrollWidth   =  16;
  245. var gBpermitXDelta    = 3;
  246. var gBpermitYDelta    = 3;
  247.  
  248.  
  249. var arrayPopupURL = new Array();
  250. var arrayAbsPopupURL = new Array();
  251.  
  252. var arrayDirty = new Array();
  253.  
  254. function setAbsPopupURL(nIndex, strURL)
  255. {
  256.     arrayAbsPopupURL[nIndex] = strURL;
  257. }
  258.  
  259. function getAbsPopupURL(nIndex)
  260. {
  261.     if (nIndex == -1 || arrayAbsPopupURL.length <= nIndex) return null;
  262.     else 
  263.         return arrayAbsPopupURL[nIndex];
  264. }
  265.  
  266. function getPopupURL(nIndex)
  267. {
  268.     if (nIndex == -1 || arrayPopupURL.length <= nIndex) return null;
  269.     else 
  270.         return arrayPopupURL[nIndex];
  271. }
  272.  
  273. function getPopupID(nIndex)
  274. {
  275.     return gstrPopupID + nIndex;
  276. }
  277.  
  278. function getPopupShadowID(nIndex)
  279. {
  280.     return gstrPopupShadowID + nIndex;
  281. }
  282.  
  283. function getPopupTopicID(nIndex)
  284. {
  285.     return gstrPopupTopicID + nIndex;
  286. }
  287.  
  288. function getPopupIFrameID(nIndex)
  289. {
  290.     return gstrPopupIFrameID + nIndex;
  291. }
  292.  
  293. function getPopupIFrameName(nIndex)
  294. {
  295.     return gstrPopupIFrameName + nIndex;
  296. }
  297.  
  298.  
  299. function getPopupTopicStyle(nIndex)
  300. {
  301.     return eval("document.all['" + getPopupTopicID(nIndex) + "']").style;
  302. }
  303.  
  304. function getPopupShadowStyle(nIndex)
  305. {
  306.     return eval("document.all['" + getPopupShadowID(nIndex) + "']").style;
  307. }
  308.  
  309. function getPopupIFrame(nIndex)
  310. {
  311.  
  312.     return eval("document.frames['" + getPopupIFrameName(nIndex) + "']");
  313. }
  314.  
  315. function getPopupDivStyle(nIndex)
  316. {
  317.     return eval("document.all['" + getPopupID(nIndex) + "']").style;
  318. }
  319.  
  320. function getPopupIFrameStyle(nIndex)
  321. {
  322.     return eval("document.all['" + getPopupIFrameName(nIndex) + "'].style");
  323. }
  324.  
  325.  
  326. function findDiv(strURL)
  327. {
  328.     var i = 0;
  329.     for (i = 0; i < arrayPopupURL.length; i ++ ) {
  330.         if (arrayPopupURL[i] == strURL) {
  331.             return i;
  332.         }
  333.     }
  334.     return -1;
  335. }
  336.  
  337. var gnToken = -1;
  338. function takeToken()
  339. {
  340.     gnToken ++;
  341.     if (gnToken > 10000) gnToken = 0;
  342.     return gnToken;
  343. }
  344.  
  345. function IsValidToken(nToken)
  346. {
  347.     return (gnToken == nToken);
  348. }
  349.  
  350. function addDiv(strURL)
  351. {
  352.     var i = 0; 
  353.     for (i = 0; i < arrayPopupURL.length; i ++) {
  354.         if (arrayPopupURL[i] == null) {
  355.             arrayPopupURL[i] = strURL;
  356.             return i;
  357.         }
  358.     }    
  359.     arrayPopupURL[i] = strURL;
  360.     arrayDirty[i] = true;
  361.     return i;
  362. }
  363.  
  364. function setDirty()
  365. {
  366.     var i = 0;
  367.     for (i = 0; i < arrayPopupURL.length; i ++ )
  368.         arrayDirty[i] = true;
  369. }
  370.  
  371. function IsDirty(nIndex)
  372. {
  373.     if (nIndex == -1)
  374.         return true;
  375.     else 
  376.         if (arrayDirty.length > nIndex) 
  377.             return arrayDirty[nIndex];
  378.         else
  379.             return true;
  380. }
  381.  
  382. function hideAll()
  383. {
  384.     var i = 0; 
  385.     for (i = 0; i < arrayPopupURL.length; i ++ )
  386.         getPopupDivStyle(i).visibility = gBsStyVisHide;
  387. }
  388.  
  389. function getCurrentPopupIFrame()
  390. {
  391.     var i = 0;
  392.     for (i = 0; i < arrayPopupURL.length; i ++)
  393.         if (getPopupDivStyle(i).visibility == gBsStyVisShow)
  394.             return getPopupIFrame(i);
  395.     return null;
  396. }
  397.  
  398. function setClear(nIndex)
  399. {
  400.     if (nIndex != -1)
  401.         arrayDirty[nIndex] = false;
  402. }
  403.  
  404. function _BSSCCreatePopupDiv(strURL)
  405. {
  406.     var nIndex = findDiv(strURL);
  407.     if (nIndex == -1 ) {
  408.         nIndex = addDiv(strURL);
  409.         BsPopup_CreateDiv(nIndex);
  410.     }
  411.     else {
  412.         if (IsDirty(nIndex)) {
  413.             if("object" == typeof(getPopupIFrame(nIndex).document))
  414.                 getPopupIFrame(nIndex).document.location.href = strURL;
  415.         }
  416.     }
  417.     return nIndex;
  418.  
  419. }
  420.  
  421. //the browser information itself
  422. function _BSPSBrowserItself()
  423. {
  424.     var agent  = navigator.userAgent.toLowerCase();
  425.     this.major = parseInt(navigator.appVersion);
  426.     this.minor = parseFloat(navigator.appVersion);
  427.     this.ns    = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
  428.     this.ns2   = ((this.ns) && (this.major == 2));
  429.     this.ns3   = ((this.ns) && (this.major == 3));
  430.     this.ns4   = ((this.ns) && (this.major >= 4));
  431.     this.ie       = (agent.indexOf("msie") != -1);
  432.     this.ie3   = ((this.ie) && (this.major == 2));
  433.     this.ie4   = ((this.ie) && (this.major >= 4));
  434.     this.op3   = (agent.indexOf("opera") != -1);
  435.  
  436.     if (this.ns4)
  437.     {
  438.         gBsDoc        = "document";
  439.         gBsSty        = "";
  440.         gBsHtm        = ".document";
  441.         gBsStyVisShow    = "show";
  442.         gBsStyVisHide    = "hide";
  443.  
  444.     }
  445.     else if (this.ie4)
  446.     {
  447.         gBsDoc         = "document.all";
  448.         gBsSty         = ".style";
  449.         gBsHtm         = "";
  450.         gBsStyVisShow    = "visible";
  451.         gBsStyVisHide    = "hidden";
  452.     }
  453. }
  454.  
  455. //Here is the browser type 
  456. function _BSPSGetBrowserInfo()
  457. {
  458.     gBsBrowser    = new _BSPSBrowserItself();
  459. }
  460.  
  461. //Get client size info
  462. function _BSPSGetClientSize()
  463. {
  464.     if (gBsBrowser.ns4)
  465.     {
  466.         gBsClientWidth    = innerWidth;
  467.         gBsClientHeight = innerHeight;
  468.  
  469.     }
  470.     else if (gBsBrowser.ie4)
  471.     {
  472.         gBsClientWidth    = document.body.clientWidth;
  473.         gBsClientHeight = document.body.clientHeight;
  474.     }
  475. }
  476.  
  477.  
  478. var gstrPopupID = 'BSSCPopup';
  479. var gstrPopupShadowID = 'BSSCPopupShadow';
  480. var gstrPopupTopicID = 'BSSCPopupTopic';
  481. var gstrPopupIFrameID = 'BSSCPopupIFrame';
  482. var gstrPopupIFrameName = 'BSSCPopupIFrameName';
  483.  
  484. var gstrPopupSecondWindowName = 'BSSCPopup';
  485.  
  486. var gPopupWindow = null;
  487. var gnPopupClickX = 0;
  488. var gnPopupClickY = 0;
  489.  
  490. var gnPopupScreenClickX = 0;
  491. var gnPopupScreenClickY = 0;
  492.  
  493. var gbPopupTimeoutExpired = false;
  494.  
  495.  
  496. function DHTMLPopupSupport()
  497. {
  498.     if ((gbBsIE4) && (!gbBsMac)) {
  499.         return true;
  500.     }
  501.     return false;
  502. }
  503.  
  504.  
  505.  
  506. function BSSCPopup_IsPopup()
  507. {
  508.     if (DHTMLPopupSupport() && (this.name.indexOf(gstrPopupIFrameName) != -1)) {
  509.         return true;
  510.     } else if ((gbBsNS4 || gbBsIE4) && (this.name.indexOf(gstrPopupID) != -1)) {
  511.         return true;
  512.     } else {
  513.         return false;
  514.     }
  515. }
  516.  
  517.  
  518. // If there is a hyperlink in a popup window, display the hyperlink in
  519. // the original window.
  520. if (BSSCPopup_IsPopup() && !gbBsIE4) {
  521.     document.write("<base target=\"_parent\">");
  522. }
  523.  
  524. // Local functions.
  525. function BsPopup_CreateDiv(nIndex)
  526. {
  527.     if(!DHTMLPopupSupport())
  528.         return;
  529.     // DO NOT SET Width and height for the div, otherwize it will make IE4 popup do not work when view the topic alone.
  530.     var strPopupDiv = "<DIV ID='" + getPopupID(nIndex) + "' STYLE='position:absolute; top:-100; left:0; z-index:600; visibility:hidden;'>";
  531.     strPopupDiv += "<DIV ID='" + getPopupShadowID(nIndex) + "' STYLE=\"position:absolute;top:0; left:0;  background-color:#C0C0C0;\"></DIV>";
  532.     strPopupDiv += "<DIV ID='" + getPopupTopicID(nIndex) + "' STYLE=\"position:absolute;top:0; left:0;  background-color:#FFFFFF;border:1px #000000 outset;\">";
  533.     strPopupDiv += "<IFRAME ID='" + getPopupIFrameID(nIndex) + "' name='" + getPopupIFrameName(nIndex) + "' src = '" + getPopupURL(nIndex) + "' frameborder=0 scrolling=auto></IFRAME>";
  534.     strPopupDiv += "</DIV></DIV>";
  535.  
  536.     var objBody = document.all.tags("BODY")[0];
  537.     if( typeof(objBody) != "object" )
  538.         return;
  539.  
  540.     objBody.insertAdjacentHTML("beforeEnd", strPopupDiv);
  541. }
  542.  
  543. function BSSCPopup_Timeout(nIndex, nToken)
  544. {
  545.     if (!IsValidToken(nToken)) return;
  546.  
  547.     if ((getPopupIFrame(nIndex).document.readyState == "complete") &&
  548.         (getPopupIFrame(nIndex).document.body != null)) {
  549.         window.getPopupDivStyle(nIndex).visibility = gBsStyVisShow;
  550.         setClear(nIndex);
  551.         window.gbPopupTimeoutExpired = true;
  552.  
  553.         BSSCPopup_ChangeTargettoParent(getPopupIFrame(nIndex).document);
  554.         getPopupIFrame(nIndex).document.body.onclick = BSSCPopupClicked;
  555.  
  556.         if (gbOrignalOnMouseDown == null)
  557.             gbOrignalOnMouseDown = document.onmousedown;
  558.  
  559.         document.onmousedown = BSSCPopupParentClicked;
  560.  
  561.     } else {
  562.         setTimeout("BSSCPopup_Timeout(" + nIndex + "," + nToken + ")", 100);
  563.     }
  564. }
  565.  
  566.  
  567. // VH 08/10/00 
  568. // do not change target to parent if the href is using javascript
  569. function BSSCPopup_ChangeTargettoParent(tagsObject)
  570. {
  571.     var collA = tagsObject.all.tags("A");
  572.     BSSCPopup_ChangeTargettoParent2(collA);
  573.  
  574.     var collIMG = tagsObject.all.tags("IMG");
  575.     BSSCPopup_ChangeTargettoParent2(collIMG);
  576. }
  577.  
  578. function BSSCPopup_ChangeTargettoParent2(colls)
  579. {
  580.     var j = 0;
  581.     if (colls != null)  {
  582.         for (j = 0; j < colls.length; j ++ )
  583.         {
  584.             var strtemp = colls[j].href;
  585.             strtemp = strtemp.toLowerCase();
  586.             if (strtemp.indexOf("javascript:") == -1)
  587.                 colls[j].target = "_parent";
  588.         }
  589.  
  590.     }
  591. }
  592.  
  593. function BSPSPopupTopicWinHelp(strURL)
  594. {
  595.     _BSSCPopup(strURL);
  596.     return;
  597. }
  598.  
  599. function _BSSCPopup(strURL, width, height)
  600. {
  601.     var cuswidth = 0;
  602.     var cusheight = 0;
  603.     if ("undefined" != typeof(width) && "undefined" != typeof(height)) {
  604.         cuswidth = width;
  605.         cusheight= height;
  606.     }
  607.     
  608.     if (DHTMLPopupSupport()) {
  609.         // If we are already in a popup, replace the contents
  610.     //    if (BSSCPopup_IsPopup()) {
  611.     //        parent._BSSCPopup(strURL, cuswidth, cusheight);
  612.     //    } else {
  613.             var nToken = takeToken(); // take  token first.
  614.             var nIndex = _BSSCCreatePopupDiv(strURL);
  615.             window.gbPopupTimeoutExpired = false;
  616.             var ntWidth = gBsClientWidth;
  617.             var ntHeight = gBsClientHeight;
  618.             _BSPSGetClientSize();
  619.             if (ntWidth != gBsClientWidth || ntHeight != gBsClientHeight) {
  620.                 setDirty();
  621.             }
  622.  
  623.  
  624.             if (IsDirty(nIndex)) {
  625.                 if (gbBsMac) {
  626.                     setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight  +")", 400);
  627.                 } else {
  628.                     setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 100);
  629.                 }
  630.             }
  631.             else {
  632.                 MoveDivAndShow(nIndex ,nToken, cuswidth, cusheight);
  633.             }
  634.     //    }
  635.  
  636.     } else {
  637.         _BSSCPopup2(strURL, cuswidth, cusheight);
  638.     }
  639.     return;
  640. }
  641.  
  642.  
  643. function _BSSCPopup2(strURL, width, height)
  644. {
  645.     if (window.name == gstrPopupSecondWindowName) {
  646.         window.location = strURL;
  647.     } else {
  648.         if (!gbBsMac || !gBsBrowser.ns4) {
  649.             BSSCHidePopupWindow();
  650.         }
  651.         var nX = 0;
  652.         var nY = 0;
  653.         var nHeight = 300;
  654.         var nWidth = 400;
  655.         if (width > 0 && height > 0) {
  656.             nHeight = height;
  657.             nWidth = width;
  658.         }
  659.         _BSPSGetClientSize();
  660.  
  661.         nX = window.gnPopupScreenClickX;
  662.         nY = window.gnPopupScreenClickY;
  663.  
  664.         if (nY + nHeight + 40 > screen.availHeight) {
  665.             nY = screen.availHeight - nHeight - 40;
  666.         }
  667.         if (nX + nWidth + 40 > screen.availWidth) {
  668.             nX = screen.availWidth - nWidth - 40;
  669.         }
  670.         // Launch a separate window
  671.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes";
  672.         if (gBsBrowser.ns) {
  673.             strParam += ",OuterHeight=" + nHeight + ",OuterWidth=" + nWidth;
  674.             strParam += ",screenX=" + nX + ",screenY=" + nY;
  675.             strParam += ",dependent=yes";
  676.         }
  677.         else {
  678.             strParam += ",height=" + nHeight + ",width=" + nWidth;
  679.             strParam += ",left=" + nX + ",top=" + nY;
  680.         }
  681.         window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam);
  682.         if (gBsBrowser.ns4) {
  683.             window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE);
  684.             window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  685.             window.gPopupWindow.onblur = NonIEPopup_HandleBlur;
  686.         }
  687.         else if (gBsBrowser.ie4)
  688.         {
  689.             setTimeout("setPopupFocus();", 100);
  690.         }
  691.     }
  692.     return;
  693. }
  694.  
  695. function setPopupFocus()
  696. {
  697.     window.gPopupWindow.focus();
  698. }
  699.  
  700. function NonIEPopup_HandleBlur(e)
  701. {
  702.     window.gPopupWindow.focus();
  703. }
  704.  
  705. function NonIEPopup_HandleClick(e)
  706. {
  707.     // Because navigator will give the event to the handler before the hyperlink, let's
  708.     // first route the event to see if we are clicking on a Popup menu in a popup.
  709.     document.routeEvent(e);
  710.  
  711.     // If a popup menu is active then don't do anything with the click
  712.     if (window.gPopupWindow.gbInPopupMenu) {
  713.         window.gPopupWindow.captureEvents(Event.CLICK);
  714.         window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  715.         return false;
  716.     }
  717.  
  718.     // Close the popup window
  719.     if (e.target.href != null) {
  720.         window.location.href = e.target.href;
  721.         if (e.target.href.indexOf("javascript:void(0)") == -1 && e.target.href.indexOf("javascript:null") == -1 && e.target.href.indexOf("BsscPopup") == -1) {
  722.             this.close();
  723.         }
  724.     } else {
  725.         this.close();
  726.     }
  727.     return false;
  728.  
  729. }
  730.  
  731. function BSSCPopup_AfterLoad(nIndex, nToken, cuswidth, cusheight)
  732. {    
  733.     if (typeof(window.getPopupIFrame(nIndex).document) == "unknown") {
  734.         _BSSCPopup2(getPopupURL(nIndex), cuswidth, cusheight);
  735.         return;
  736.     }
  737.     if (!IsValidToken(nToken)) return;
  738.  
  739.     if ((window.getPopupIFrame(nIndex).document.readyState == "complete") &&
  740.         (window.getPopupIFrame(nIndex).document.body != null)) {
  741.             if (window.getPopupIFrame(nIndex).document.location.href.indexOf("about:blank") != -1) { // add this check. IE will use about:blank" as the default vaule for Iframe.
  742.                 window.getPopupIFrame(nIndex).document.location = getPopupURL(nIndex);
  743.                 setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200);
  744.             }
  745.             else
  746.                 {
  747.                     setAbsPopupURL(nIndex, window.getPopupIFrame(nIndex).document.location.href); // change URL to abs url.
  748.                     BSSCPopup_ResizeAfterLoad(nIndex, nToken, cuswidth, cusheight);
  749.                 }
  750.     } else {
  751.         setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200);
  752.     }
  753. }
  754.  
  755.  
  756. function BSSCPopup_ResizeAfterLoad(nIndex, nToken, cuswidth, cusheight)
  757. {
  758.     if (window.gbPopupTimeoutExpired) return;
  759.  
  760.     if (!IsValidToken(nToken)) return;
  761.  
  762.     getPopupDivStyle(nIndex).visibility = gBsStyVisHide;
  763.  
  764.     // Determine the width and height for the window
  765.     //var size = new BSSCSize(0, 0);
  766.     //BSSCGetContentSize(window.getPopupIFrame(nIndex), size);
  767.     //var nWidth = size.x;
  768.     //var nHeight = size.y;
  769.  
  770.     _BSPSGetClientSize();
  771.     
  772.     var size = new BSSCSize(0, 0);
  773.  
  774.     if (cuswidth <= 0 || cusheight <= 0)
  775.         BSSCGetContentSize(window.getPopupIFrame(nIndex), size);
  776.     else {
  777.         size.x = cuswidth;
  778.         size.y = cusheight;
  779.     }
  780.  
  781.     // Determine the width and height for the window
  782.     var nWidth = size.x;
  783.     var nHeight = size.y;
  784.         
  785.     if (nWidth < 40 || nHeight < 40) return;  // there must be something terribly wrong.
  786.  
  787.     window.getPopupDivStyle(nIndex).pixelWidth = nWidth;
  788.     window.getPopupDivStyle(nIndex).pixelHeight = nHeight;
  789.  
  790.     window.getPopupShadowStyle(nIndex).pixelWidth = nWidth;
  791.     window.getPopupShadowStyle(nIndex).pixelHeight = nHeight;
  792.     window.getPopupTopicStyle(nIndex).pixelWidth = nWidth;
  793.     window.getPopupTopicStyle(nIndex).pixelHeight = nHeight;
  794.     if (gbBsIE55)
  795.     {
  796.         window.getPopupShadowStyle(nIndex).pixelWidth = nWidth + 2;
  797.         window.getPopupShadowStyle(nIndex).pixelHeight = nHeight + 2;
  798.         window.getPopupTopicStyle(nIndex).pixelWidth = nWidth + 2;
  799.         window.getPopupTopicStyle(nIndex).pixelHeight = nHeight + 2;
  800.     }
  801.  
  802.     window.getPopupIFrameStyle(nIndex).pixelWidth = nWidth;
  803.     window.getPopupIFrameStyle(nIndex).pixelHeight = nHeight;
  804.     if (gbBsIE55)
  805.     {
  806.         window.getPopupIFrameStyle(nIndex).top = 0;
  807.         window.getPopupIFrameStyle(nIndex).left = 0;
  808.     }
  809.     
  810.     var strURL = getPopupURL(nIndex);
  811.     if (strURL.indexOf("#") != -1)
  812.         getPopupIFrame(nIndex).location.href = strURL;  // reload again, this will fix the bookmark misunderstand in IE5.
  813.         
  814.     MoveDivAndShow(nIndex, nToken, cuswidth, cusheight);
  815. }
  816.  
  817. function MoveDivAndShow(nIndex, nToken, cuswidth, cusheight)
  818. {
  819.     if (window.getPopupIFrame(nIndex).document.location.href != getAbsPopupURL(nIndex)) { // if redirect, reload again.
  820.             window.getPopupIFrame(nIndex).document.location = getPopupURL(nIndex);
  821.             setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200);
  822.             return;
  823.     }
  824.  
  825.     // Determine the position of the window
  826.     var nClickX = window.gnPopupClickX;
  827.     var nClickY = window.gnPopupClickY;
  828.     var nTop = 0;
  829.     var nLeft = 0;
  830.  
  831.     var nWidth = window.getPopupDivStyle(nIndex).pixelWidth;
  832.     var nHeight = window.getPopupDivStyle(nIndex).pixelHeight;
  833.  
  834.     if (nClickY + nHeight + 20 < gBsClientHeight + document.body.scrollTop) {
  835.         nTop = nClickY + 10;
  836.     } else {
  837.         nTop = (document.body.scrollTop + gBsClientHeight) - nHeight - 20;
  838.     }
  839.     if (nClickX + nWidth < gBsClientWidth + document.body.scrollLeft) {
  840.         nLeft = nClickX;
  841.     } else {
  842.         nLeft = (document.body.scrollLeft + gBsClientWidth) - nWidth - 8;
  843.     }
  844.     
  845.     if (nTop < document.body.scrollTop ) nTop  = document.body.scrollTop + 1;
  846.     if (nLeft< document.body.scrollLeft) nLeft = document.body.scrollLeft + 1;
  847.  
  848.  
  849.     window.getPopupDivStyle(nIndex).left = nLeft;
  850.     window.getPopupDivStyle(nIndex).top = nTop;
  851.  
  852.     // Set the location of the background blocks
  853.     window.getPopupShadowStyle(nIndex).left = 6;
  854.     window.getPopupShadowStyle(nIndex).top = 6;
  855.     if (gbBsIE55)
  856.     {
  857.         window.getPopupShadowStyle(nIndex).left = 4;
  858.         window.getPopupShadowStyle(nIndex).top = 4;
  859.     }
  860.  
  861.     if (gbBsMac) {
  862.         // Total hack on the iMac to get the IFrame to position properly
  863.         window.getPopupIFrameStyle(nIndex).pixelLeft = 100;
  864.         window.getPopupIFrameStyle(nIndex).pixelLeft = 0;
  865.         // Explicitly call BSSCOnLoad because the Mac doesn't seem to do it
  866.         window.getPopupIFrame(nIndex).window.BSSCOnLoad();
  867.     }
  868.  
  869.     BSSCPopup_Timeout(nIndex , nToken );
  870.     
  871.     return;
  872. }
  873.  
  874. function    BSSCSize(x, y)
  875. {
  876.     this.x = x;
  877.     this.y = y;
  878. }
  879.  
  880. function BSSCGetContentSize(thisWindow, size)
  881. {
  882.     if (!((gBsBrowser.ie4) || (gBsBrowser.ns4)))
  883.         return;
  884.  
  885.     if (gbBsMac) {
  886.         size.x = 300;
  887.         size.y = 300;
  888.         return;
  889.     }
  890.  
  891.     // Resize the width until it is wide enough to handle the content
  892.     // The trick is to start wide and determine when the scrollHeight changes
  893.     // because then we know a scrollbar is necessary. We can then go back
  894.     // to the next widest size (for no scrollbar)
  895.  
  896.     var ClientRate = gBsClientHeight / gBsClientWidth;
  897.  
  898.     var GoldenSize = new BSSCSize(0,0);
  899.     GoldenSize.x = gBsClientWidth * gBMaxXOfParent;
  900.     GoldenSize.y = gBsClientHeight *gBMaxYOfParent ;
  901.  
  902.     if (ClientRate > gBRateH_W) {
  903.         GoldenSize.y = GoldenSize.x * gBRateH_W;
  904.     }
  905.     else {
  906.         GoldenSize.x = GoldenSize.y / gBRateH_W;
  907.     }
  908.  
  909.     // Try to using parent specified max x.
  910.     var x = 0;
  911.     var maxgoldx = GoldenSize.x;
  912.     var maxx = gBsClientWidth * gBMaxXOfParent;
  913.     
  914.     // This double resize causes the document to re-render (and we need it to)
  915.     thisWindow.moveTo(10000,10000); // this is used to fix the flash on IE4.
  916.     thisWindow.resizeTo(1, 1);
  917.     thisWindow.resizeTo(1, 1);
  918.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  919.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  920.         
  921.     var miny = thisWindow.document.body.scrollHeight + gBscrollHeight;
  922.     
  923.     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
  924.     {
  925.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  926.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  927.         
  928.         miny =     thisWindow.document.body.scrollHeight + gBscrollHeight;
  929.         maxy = gBsClientHeight * gBMaxYOfParent;
  930.         
  931.         if (miny > maxy) { // the popup must have a scroll, OK let it be.
  932.             miny = maxy;
  933.             size.x = maxx;
  934.             size.y = maxy;
  935.             thisWindow.document.body.scroll = 'yes'; // At this time we do want to show scroll any more. so it will looks better a little.
  936.         }
  937.         else { // popup still can fit in the parent area by someway. now we choose the same h/w rate as parent.
  938.             size.y = miny;
  939.             
  940.             //  downsize from maxx , now I try to using binary divide.
  941.             x = maxx;
  942.             deltax = -maxx/2;
  943.             //j = 0;
  944.             while (true) {
  945.                 x = x + deltax;
  946.                 thisWindow.resizeTo(x, miny);
  947.                 thisWindow.resizeTo(x, miny);
  948.                 diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * ClientRate;
  949.                 if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  950.                     deltax = Math.abs(deltax) /2;
  951.                 else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  952.                     deltax = -Math.abs(deltax) /2;
  953.                 else 
  954.                     // the y is close enough to wanted.
  955.                     break;
  956.                 if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  957.                     break;
  958.             }
  959.             size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth;
  960.             size.y = thisWindow.document.body.scrollHeight;// + gBscrollHeight;    
  961.             thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  962.             
  963.         // Handle absurd cases just in case IE flakes
  964.     //        if (size.y < 100) {
  965.     //            size.y = 100;
  966.     //        }
  967.         }
  968.     }
  969.     else {
  970.         // VH 08/06/00 . OK there is another case we did not check before.
  971.         if (thisWindow.document.body.scrollWidth > maxgoldx) {
  972.             size.x = maxx; 
  973.             size.y = miny;    
  974.             thisWindow.document.body.scroll = 'yes'; // At this time we do want to show scroll any more. so it will looks better a little.
  975.         }
  976.         else {
  977.             //  downsize from maxgoldx , now I try to using binary divide.
  978.             x = maxgoldx;
  979.             deltax = -maxgoldx/2;
  980.             //i = 0;
  981.             while (true) {
  982.                 x = x + deltax;
  983.                 thisWindow.resizeTo(x, miny);
  984.                 thisWindow.resizeTo(x, miny);
  985.                 diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * gBRateH_W;
  986.                 if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  987.                     deltax = Math.abs(deltax) /2;
  988.                 else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  989.                     deltax = -Math.abs(deltax) /2;
  990.                 else 
  991.                     // the y is close enough to wanted.
  992.                     break;
  993.                 if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  994.                     break;
  995.                 //i ++;
  996.                 
  997.             }
  998.             size.x = thisWindow.document.body.scrollWidth ;//+ gBscrollWidth;
  999.             size.y = thisWindow.document.body.scrollHeight ;//+ gBscrollHeight;    
  1000.             thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  1001.         }
  1002.     }
  1003.     
  1004.     // no reload no scrollbar.
  1005.     //size.x = size.x + 16;     //reserve a width for scrollbar (IE 4.0 only)
  1006.  
  1007.     thisWindow.resizeTo(size.x, size.y);
  1008.     thisWindow.resizeTo(size.x, size.y);
  1009.     return;
  1010. }
  1011.  
  1012.  
  1013.  
  1014. function BSSCPopupParentClicked()
  1015. {
  1016.     if (!window.gbPopupTimeoutExpired) {
  1017.         return false;
  1018.     }
  1019.     
  1020.     document.onmousedown = gbOrignalOnMouseDown;
  1021.  
  1022.     // Simply hide the popup
  1023.     hideAll();
  1024.  
  1025.     window.gbPopupTimeoutExpired = false;
  1026.  
  1027.     return true;
  1028. }
  1029.  
  1030.  
  1031. function BSSCPopupClicked()
  1032. {
  1033.     if (!window.gbPopupTimeoutExpired) {
  1034.         return false;
  1035.     }
  1036.  
  1037.  
  1038.     var popupIFrame = getCurrentPopupIFrame();
  1039.     if (popupIFrame == null) {
  1040.         return true;
  1041.     }
  1042.  
  1043. /*
  1044.     if ("undefined" != typeof(popupIFrame.gbInPopupMenu) &&
  1045.         popupIFrame.gbInPopupMenu) {
  1046.         return true;
  1047.     }*/
  1048.  
  1049.     if (!((popupIFrame.window.event != null) &&
  1050.         (popupIFrame.window.event.srcElement != null) &&
  1051.         ((popupIFrame.window.event.srcElement.tagName == "A") ||
  1052.         (popupIFrame.window.event.srcElement.tagName == "IMG")))) {
  1053.         document.onmousedown = gbOrignalOnMouseDown;
  1054.  
  1055.     // Simply hide the popup
  1056.         hideAll();
  1057.  
  1058.         window.gbPopupTimeoutExpired = false;
  1059.  
  1060.         return true;
  1061.     }
  1062. }
  1063.  
  1064.  
  1065. //trace the mouse over's position for hotspot
  1066. function  BSPSPopupOnMouseOver(event)
  1067. {
  1068.     if (gBsBrowser.ie4) {
  1069.         window.gnPopupClickX = event.clientX + document.body.scrollLeft;
  1070.         window.gnPopupClickY = event.clientY + document.body.scrollTop;
  1071.         window.gnPopupScreenClickX = event.screenX;
  1072.         window.gnPopupScreenClickY = event.screenY;
  1073.     } else if (gBsBrowser.ns4) {
  1074.         window.gnPopupClickX = event.pageX - window.pageXOffset;
  1075.         window.gnPopupClickY = event.pageY - window.pageYOffset;
  1076.         window.gnPopupScreenClickX = event.screenX - window.pageXOffset;
  1077.         window.gnPopupScreenClickY = event.screenY - window.pageYOffset;
  1078.     }
  1079. }
  1080.  
  1081.  
  1082. function BSSCHidePopupWindow()
  1083. {
  1084.     if (window.gPopupWindow != null) {
  1085.         if (gBsBrowser.ns4) {
  1086.             if ((typeof window.gPopupWindow != "undefined") && (!window.gPopupWindow.closed)) {
  1087.                 window.gPopupWindow.close();
  1088.                 window.gPopupWindow = null;
  1089.             }
  1090.         }
  1091.     }
  1092.  
  1093.     return;
  1094. }
  1095.  
  1096. // Add the PopupOnClick to the onclick array.
  1097. if (typeof(BsscRegisterOnClick) != "undefined")
  1098. {
  1099.     BsscRegisterOnClick(BsPopupOnClick);
  1100. }
  1101. //End to support previous popup functions
  1102.  
  1103. //Begin to support previous relative topics
  1104. //If webHelp needs Related Topics DHTMLcode, it's supposed to add it here
  1105. var gbPopupMenuTimeoutExpired = false;
  1106. var gbInPopupMenu = false;
  1107. var gbPopupMenuTopicList = null;
  1108.  
  1109. //////////////////////////////////////////////////////////////////////////////////////////
  1110. //
  1111. // Popup Menu code
  1112. //
  1113. //////////////////////////////////////////////////////////////////////////////////////////
  1114.  
  1115. var g_bIsPopupMenuInit = false;
  1116. function _WritePopupMenuLayer()
  1117. {
  1118.     if (!g_bIsPopupMenuInit)
  1119.         {
  1120.       if (gbBsNS4) {
  1121. //Do not try to write ininle styles for NS!  NS can not handle it and will not stop downloading the html page...
  1122.        document.write("<DIV CLASS='WebHelpPopupMenu' ID='PopupMenu'></DIV>");
  1123.       } else{
  1124.       document.write("<DIV ID='PopupMenu' STYLE='position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;'></DIV>");
  1125.       if (gbBsIE4) {
  1126.         document.write("<STYLE TYPE='text/css'>");
  1127.         if (gbBsMac) {
  1128.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:10pt; text-decoration:none;}");
  1129.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:10pt; text-decoration:none;}");
  1130.         } else {
  1131.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:8pt; text-decoration:none;}");
  1132.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:8pt; text-decoration:none;}");
  1133.         }
  1134.         document.write("</STYLE>");
  1135.        }
  1136.           }
  1137.       g_bIsPopupMenuInit = true;
  1138.     }
  1139. }
  1140.  
  1141. //Define variable arguments as: strTitle, strUrl
  1142. function MTE() 
  1143. {
  1144.     this.strTitle = MTE.arguments[0];
  1145.     if (MTE.arguments.length > 1)
  1146.         this.strURL = MTE.arguments[1];
  1147.     else
  1148.         this.strURL = this.strTitle;
  1149. }
  1150.  
  1151. // If the topic list is set, it is an array of TopicEntry objects (defined in WebHelp3.js)
  1152. function PopupMenu_SetTopicList(aPopupTopicArray)
  1153. {
  1154.     gbPopupMenuTopicList = aPopupTopicArray;
  1155. }
  1156.  
  1157. //Seek for the bsscright frame 
  1158. function _SeekFrameByName( cRoot, strName )
  1159. {
  1160.     if( cRoot == null )    return null;
  1161.     if( cRoot.frames == null )    return null;
  1162.     if( cRoot.frames[strName] != null )    return cRoot.frames[strName];
  1163.     for (var i=0; i<cRoot.frames.length; i++)
  1164.     {
  1165.         var cObj = _SeekFrameByName( cRoot.frames(i).document, strName );
  1166.         if( cObj != null )        return cObj;
  1167.     };
  1168.     return null;
  1169. }
  1170. function _GetFrameByName( cRoot, strName )
  1171. {
  1172.     if( cRoot == null )    return null;
  1173.     var cRet = _SeekFrameByName(cRoot, strName);
  1174.     if( cRet != null )    return cRet;
  1175.     if (cRoot.parent != cRoot)
  1176.         return _GetFrameByName( cRoot.parent, strName );
  1177.     else
  1178.         return null;
  1179. }
  1180.  
  1181. //var gbOriPopupMenuClick = null;
  1182.  
  1183. function _PopupMenu_Invoke(fn_arguments)
  1184. {
  1185.     // Make sure we have reasonable arguments
  1186.     var argLen = fn_arguments.length;
  1187.     if (argLen < 3) {
  1188.         return false;
  1189.     }
  1190.  
  1191.     // Check to see if we only have one target
  1192.     var strTarget = "";
  1193.     var targetDoc = null;
  1194.     if (fn_arguments[1] == '') {
  1195.         if (BSSCPopup_IsPopup()) {
  1196.             targetDoc = parent;
  1197.             strTarget = "TARGET= _parent";
  1198.         }
  1199.         else
  1200.             targetDoc = window.document;
  1201.     } else {
  1202.         targetDoc = _GetFrameByName( parent, fn_arguments[1] );
  1203.  
  1204.         strTarget = "TARGET='" + fn_arguments[1] + "'";
  1205.     }
  1206.  
  1207.     if ((!gbBsIE4 && !gbBsNS4) || ((gbBsMac) && (gbBsIE4) && (window.event.srcElement.tagName == "AREA"))) {
  1208.     
  1209.         var argLen     = fn_arguments.length;
  1210.  
  1211.         // Create the window that the hyperlinks will go into
  1212.         var nHeight = argLen * 15;
  1213.         var nWidth = 400;
  1214.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  1215.         strParam += ",height=" + nHeight + ",width=200";
  1216.         strParam += ",resizable";
  1217.  
  1218.         // Create a temporary window first to ensure the real popup comes up on top
  1219.         var wndTemp = window.open("", "temp", strParam);
  1220.  
  1221.         // Create the real popup window
  1222.         var wndPopupLinks = window.open("", "popuplinks", strParam);
  1223.  
  1224.         // Close the temporary
  1225.         wndTemp.close();
  1226.  
  1227.         wndPopupLinks.document.open("text/html");
  1228.         wndPopupLinks.document.write("<html><head></head>");
  1229.         wndPopupLinks.document.write("<body onBlur=\'self.focus();\'>");
  1230.         var strParaLine = "";
  1231.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  1232.             strParaLine = "";
  1233.             strParaLine += "<a href=\"javascript:";
  1234.             if (gbBsIE) {
  1235.                 strParaLine += "onBlur=null; ";
  1236.             }
  1237.             strParaLine += "opener.location=\'";
  1238.             strParaLine += fn_arguments[2 * i + 3];
  1239.             strParaLine += "\';close();\"";
  1240.             strParaLine += strTarget;
  1241.  
  1242.             strParaLine += ">";
  1243.             strParaLine += fn_arguments[2 * i + 2];
  1244.             strParaLine += "</a>";
  1245.             strParaLine += "<br>";
  1246.             wndPopupLinks.document.write(strParaLine);
  1247.         }
  1248.         wndPopupLinks.document.write("</body></html>");
  1249.         wndPopupLinks.document.close();
  1250.         window.gbInPopupMenu = true;
  1251.         if (!gbBsIE) {
  1252.             wndPopupLinks.focus();
  1253.         }
  1254.  
  1255.         return false;
  1256.     }
  1257.  
  1258.  
  1259.     if (((argLen < 5) && ((isNaN(fn_arguments[2])) || (gbPopupMenuTopicList == null))) ||
  1260.         ((argLen < 4) && ((!isNaN(fn_arguments[2])) && (gbPopupMenuTopicList != null)))) {
  1261.         // Get the place that we will be putting the topic into
  1262.         var strURL = "";
  1263.         if (isNaN(fn_arguments[2]) ||  (gbPopupMenuTopicList == null)) {
  1264.             strURL = fn_arguments[3];
  1265.         }
  1266.         else     {
  1267.             strURL = gbPopupMenuTopicList[fn_arguments[2]].strURL;
  1268.         }
  1269.  
  1270.         if (targetDoc != null) {
  1271.             targetDoc.location.href = strURL;
  1272.         }
  1273.         else {
  1274.             window.open(strURL);
  1275.         }        
  1276.         window.gbInPopupMenu = true;
  1277.         return false;
  1278.     }
  1279.     
  1280.     var strMenu = "";
  1281.     if (gbBsNS4) {
  1282.         strMenu = '<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=3 BGCOLOR="#c0c0c0">';
  1283.     } else {
  1284.         strMenu = '<TABLE STYLE="border:2px outset white;" CELLSPACING=0';
  1285.         if (gbBsMac) {
  1286.             strMenu += ' CELLPADDING=4';
  1287.         } else {
  1288.             strMenu += ' CELLPADDING=2';
  1289.         }    
  1290.         strMenu += ' BGCOLOR=#c0c0c0>';
  1291.     }
  1292.     // Add each of the items
  1293.     var i = 2;
  1294.     while (i <= argLen - 1) {
  1295.         strMenu += '<TR><TD><NOBR>'
  1296.         // If the destination is a number then look it up in the topic list
  1297.         if (isNaN(fn_arguments[i]) ||  (gbPopupMenuTopicList == null)) {
  1298.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + fn_arguments[i + 1] + '"' + strTarget;
  1299.         } else {
  1300.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + gbPopupMenuTopicList[fn_arguments[i]].strURL + '"' + strTarget;
  1301.         }
  1302.         strMenu += ' onclick="PopupMenu_HandleClick(event);"';
  1303.         strMenu += ' onmouseover="PopupMenu_Over(event);"';
  1304.         strMenu += ' onmouseout="PopupMenu_Out(event);"';
  1305.         strMenu += '>';
  1306.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  1307.             strMenu += '<SPAN CLASS="PopupNotOver">' + fn_arguments[i] + '</SPAN>';
  1308.         } else {
  1309.             strMenu += '<SPAN CLASS="PopupNotOver">' + gbPopupMenuTopicList[fn_arguments[i]].strTitle + '</SPAN>';
  1310.         }
  1311.         strMenu += '</A></DIV></NOBR></TD></TR>';
  1312.  
  1313.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  1314.             i += 2;
  1315.         } else {
  1316.             i += 1;
  1317.         }
  1318.     }
  1319.     strMenu += "</TABLE>";
  1320.  
  1321.     if (gbBsMac) {
  1322.     // totally hack. because ie5 in mac need something. </TABLE> is one of them. mac is mad.
  1323.         strMenu +="<TABLE></TABLE>";
  1324.     }
  1325.  
  1326.     var layerPopup = null;
  1327.     var stylePopup = null;
  1328.     var nEventX = 0;
  1329.     var nEventY = 0;
  1330.     var nWindowWidth = 0;
  1331.     if (gbBsIE4) {
  1332.  
  1333.         layerPopup = document.all["PopupMenu"];
  1334.         layerPopup.innerHTML = strMenu;
  1335.         stylePopup = layerPopup.style;
  1336.  
  1337.         _BSPSGetClientSize();
  1338.  
  1339.         // Get the position of the item causing the event (relative to its parent)
  1340.         nEventX = window.event.clientX;
  1341.         nEventY = window.event.clientY;
  1342.  
  1343.         if (nEventY + layerPopup.scrollHeight + 10 < gBsClientHeight) {
  1344.             nEventY += document.body.scrollTop + 10;
  1345.         } else {
  1346.             nEventY = (document.body.scrollTop + gBsClientHeight) - layerPopup.scrollHeight - 20;
  1347.         }
  1348.         stylePopup.top = nEventY;
  1349.         
  1350.         var nPopupWidth = layerPopup.scrollWidth;
  1351.         if (gbBsMac) {
  1352.             nPopupWidth = 80; // we have no idea how to get the dynamic width of the popup.
  1353.         }
  1354.         if (nEventX + nPopupWidth + 20 > gBsClientWidth) {
  1355.             if (gBsClientWidth - nPopupWidth < 5) {
  1356.                 stylePopup.left = 5;
  1357.             } else {
  1358.                 stylePopup.left = gBsClientWidth - nPopupWidth - 5;
  1359.             }
  1360.         } else {
  1361.             stylePopup.left = nEventX + document.body.scrollLeft + 20;
  1362.         }
  1363.  
  1364.         stylePopup.visibility = "visible";
  1365.         document.onclick = PopupMenu_HandleClick;
  1366.         
  1367.     } else if (gbBsNS4) {
  1368.         layerPopup = document.layers.PopupMenu;
  1369.         layerPopup.visibility = "hide";
  1370.         stylePopup = layerPopup.document;
  1371.         stylePopup.write(strMenu);
  1372.         stylePopup.close();
  1373.         var e = fn_arguments[0];
  1374.         nEventX = e.pageX;
  1375.         nEventY = e.pageY;
  1376.         _BSPSGetClientSize();
  1377.         if (nEventY + layerPopup.clip.height + 20 < window.pageYOffset + gBsClientHeight) {
  1378.             nEventY += 20;
  1379.         } else {
  1380.             nEventY = gBsClientHeight + window.pageYOffset- layerPopup.clip.height - 20;
  1381.         }
  1382.         layerPopup.top = nEventY;
  1383.  
  1384.         if (nEventX + layerPopup.clip.width + 20 > gBsClientWidth + window.pageXOffset) {
  1385.             if (gBsClientWidth + window.pageXOffset - layerPopup.clip.width < 20) {
  1386.                 nEventX = 5;
  1387.             } else {
  1388.                 nEventX = gBsClientWidth + window.pageXOffset - layerPopup.clip.width - 20;
  1389.             }
  1390.         } else {
  1391.             nEventX += 20;
  1392.         }
  1393.  
  1394.         layerPopup.left = nEventX;
  1395.  
  1396.         layerPopup.visibility = "show";
  1397.  
  1398. //        window.captureEvents(Event.CLICK | Event.MOUSEDOWN);
  1399.         window.captureEvents(Event.MOUSEDOWN);
  1400. //        window.onclick = PopupMenu_HandleClick;
  1401.         window.onmousedown = PopupMenu_HandleClick;
  1402.     }
  1403.  
  1404.     window.gbInPopupMenu = true;
  1405.     window.gbPopupMenuTimeoutExpired = false;
  1406.     setTimeout("PopupMenu_Timeout();", 100);
  1407.     return false;
  1408. }
  1409.  
  1410.  
  1411. function PopupMenu_Timeout()
  1412. {
  1413.     window.gbPopupMenuTimeoutExpired = true;
  1414. }
  1415.  
  1416. function PopupMenu_Over(e)
  1417. {
  1418.     if (gbBsIE4) {
  1419.         e.srcElement.className = "PopupOver";
  1420.     } else if (gbBsNS4) {
  1421. //        this.bgColor = "red";
  1422. //        e.target.document.className = "PopupOver";
  1423.     }
  1424.     return;
  1425. }
  1426.  
  1427. function PopupMenu_Out(e)
  1428. {
  1429.     if (gbBsIE4) {
  1430.         e.srcElement.className = "PopupNotOver";
  1431.     } else if (gbBsNS4) {
  1432.         this.bgColor = "#f0f0f0";
  1433.     }
  1434.     return;
  1435. }
  1436.  
  1437.  
  1438. function PopupMenu_HandleClick(e)
  1439. {
  1440.     if (!window.gbPopupMenuTimeoutExpired) {
  1441.         return;
  1442.     }
  1443.  
  1444.     window.gbInPopupMenu = false;
  1445.  
  1446.     if (gbBsNS4) {
  1447. //        window.releaseEvents(Event.CLICK);
  1448.         window.releaseEvents(Event.MOUSEDOWN);
  1449.     }
  1450.  
  1451.     var layerPopup = null;
  1452.     var stylePopup = null;
  1453.     if (gbBsIE4) {
  1454.         layerPopup = document.all["PopupMenu"];
  1455.         stylePopup = layerPopup.style;
  1456.         stylePopup.visibility = "hidden";
  1457.     } else if (gbBsNS4) {
  1458.         layerPopup = document.layers.PopupMenu;
  1459.         layerPopup.visibility = "hide";
  1460.     }
  1461.  
  1462. //    if (gbOriPopupMenuClick!= null)
  1463. //        document.onclick = gbOriPopupMenuClick;
  1464.  
  1465.     return;
  1466. }
  1467.  
  1468. // This function should be deleted when all old projects are cleaned up
  1469. function BSPSWritePopupFrameForIE4()
  1470. {
  1471.     return false;
  1472. }
  1473.  
  1474. /////////////////////////////////////////////////////////////////////
  1475. function BSSCPopup_ClickMac()
  1476. {
  1477.     if ((!DHTMLPopupSupport()) && (gbBsIE4))
  1478.     {    
  1479.         var bClickOnAnchor = false;
  1480.         var el;
  1481.         if ((window.event != null) &&
  1482.             (window.event.srcElement != null))
  1483.         {
  1484.             el = window.event.srcElement;
  1485.             while (el != null)
  1486.             {
  1487.                 if ((el.tagName == "A") || (el.tagName == "AREA"))     {
  1488.                     bClickOnAnchor = true;
  1489.                     break;
  1490.                 }
  1491.                 if (el.tagName == "BODY") {
  1492.                     break;
  1493.                 }
  1494.                 el = el.parentElement;
  1495.             }
  1496.         }
  1497.         if (BSSCPopup_IsPopup())
  1498.         {
  1499.             if (!bClickOnAnchor) {
  1500.                 parent.window.gPopupWindow = null;
  1501.                 self.close();
  1502.             }
  1503.         }
  1504.         else
  1505.         {
  1506.             bClosePopupWindow = true;
  1507.             if ((bClickOnAnchor) &&
  1508.                 (el.href) &&
  1509.                 ((el.href.indexOf("javascript:BSSCPopup") != -1) || (el.href.indexOf("javascript:null") != -1) || (el.href.indexOf("javascript:void(0)") != -1)))
  1510.             {
  1511.                 bClosePopupWindow = false;
  1512.             }
  1513.             if (bClosePopupWindow)
  1514.             {
  1515.                 if (window.gPopupWindow != null && !window.gPopupWindow.closed )
  1516.                 {
  1517.                     window.gPopupWindow.close();
  1518.                 }
  1519.             }
  1520.         }
  1521.     }
  1522.  }
  1523.  
  1524. //////////////////////////////////////////////////////////////////////
  1525.  
  1526. _BSPSGetBrowserInfo();
  1527.  
  1528.  
  1529. function BsPopupOnClick()
  1530. {
  1531.     if (!gbBsIE4)
  1532.         return;
  1533.  
  1534.     BSSCPopup_ClickMac();
  1535. }
  1536.  
  1537. function _BSSCOnError(message)
  1538. {
  1539.     if(-1 != message.indexOf("denied") 
  1540.         || -1 != message.indexOf("Object required"))
  1541.      return true;
  1542. }
  1543.  
  1544. //End to support previous relative topics
  1545.  
  1546. /// Section End  - Popup and Related Topic (JavaScript 1.0)
  1547.  
  1548. /// Section Begin - Embedded Stub (JavaScript 1.0)
  1549.  
  1550. var s_strAgent = navigator.userAgent.toLowerCase();
  1551. var s_nVer       = parseInt(navigator.appVersion);
  1552.  
  1553. var s_bIE  = (s_strAgent.indexOf('msie') != -1);
  1554. var s_bNS  = (s_strAgent.indexOf('mozilla') != -1) && ((s_strAgent.indexOf('spoofer') == -1) && (s_strAgent.indexOf('compatible') == -1));
  1555. var s_bOpera    = (s_strAgent.indexOf('opera') != -1);
  1556.  
  1557. var s_bIE3Before = ((s_bIE) && (s_nVer <= 2));
  1558. var s_bNS3Before = ((s_bNS) && (s_nVer <= 3));
  1559.  
  1560. var s_bNS2        = ((s_bNS) && (s_nVer <= 2));
  1561. var s_bNS3        = ((s_bNS) && (s_nVer == 3));
  1562. var s_bIE300301    = ((s_bIE) && (s_nVer == 2) && ((s_strAgent.indexOf("3.00") != -1)||(s_strAgent.indexOf("3.0a") != -1)||(s_strAgent.indexOf("3.0b")!=-1)||(s_strAgent.indexOf("3.01")!=-1)));
  1563. var s_bIE302    = ((s_bIE) && (s_nVer == 2) && (s_strAgent.indexOf("3.02") != -1));
  1564.  
  1565.  
  1566. function HasExtJs()
  1567. {
  1568.     if (s_bIE3Before) { return false;}
  1569.     if (s_bNS3Before) {    return false;}
  1570.     if (typeof (BsGeneralOnLoad) == "undefined"){ return false; }
  1571.     return true;
  1572. }
  1573.  
  1574.  
  1575. function BSSCCreatePopupDiv()
  1576. {
  1577.     return;
  1578. }
  1579.  
  1580.  
  1581. function WritePopupMenuLayer()
  1582. {
  1583.     if (HasExtJs()) {_WritePopupMenuLayer();}
  1584. }
  1585.  
  1586. function BSSCPopup(strURL, width, height)
  1587. {
  1588.     if (HasExtJs())    { 
  1589.         _BSSCPopup(strURL, width, height);
  1590.     }else{
  1591.         //Create a temporary window first to ensure the real popup comes up on top
  1592.         var wndTemp = null;
  1593.         if (!s_bNS3) {
  1594.             wndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4");
  1595.         }
  1596.         // Create the real popup window
  1597.         var wndPopup = window.open(strURL, "BSSCPopup", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400");
  1598.         // Close the temporary
  1599.         if (!s_bNS3) {
  1600.             wndTemp.close();
  1601.         } else {
  1602.             wndPopup.focus();
  1603.         }
  1604.     }
  1605. }
  1606.  
  1607. var gbWndTemp = null, gbWndPopupLinks = null;
  1608. var gbstrParaTotal = "";
  1609.  
  1610. function PopupMenu_Invoke()
  1611. {
  1612.     if (HasExtJs()) {
  1613.         return _PopupMenu_Invoke(PopupMenu_Invoke.arguments);
  1614.     }
  1615.     if (s_bNS3Before || s_bIE3Before )    {
  1616.         var argLen     = PopupMenu_Invoke.arguments.length;
  1617.         if (argLen < 5) {
  1618.             window.document.location.href = PopupMenu_Invoke.arguments[3];
  1619.             return false;
  1620.         }
  1621.         gbWndTemp = null;
  1622.         gbWndPopupLinks = null;
  1623.         gbstrParaTotal = "";
  1624.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  1625.             var strParaLine = "";
  1626.             if (s_bNS2 || s_bOpera){
  1627.                 strParaLine += "<a href=\"";
  1628.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 3];
  1629.                 strParaLine += "\">"
  1630.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 2];
  1631.                 strParaLine += "</a>";
  1632.             } else {
  1633.                 strParaLine += "<a href=\"javascript:";
  1634.                 strParaLine += "gotoUrl(\'";
  1635.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 3];
  1636.                 strParaLine += "\');\"";
  1637.                 if (PopupMenu_Invoke.arguments[1] != '') {
  1638.                     strParaLine += " TARGET='" + PopupMenu_Invoke.arguments[1] + "'";
  1639.                 }
  1640.                 strParaLine += ">";
  1641.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 2];
  1642.                 strParaLine += "</a>";
  1643.             }
  1644.             strParaLine += "<br>";
  1645.             gbstrParaTotal += strParaLine;
  1646.         }
  1647.         var nHeight = argLen * 15;
  1648.         var nWidth = 400;
  1649.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  1650.         strParam += ",height=" + nHeight + ",width=200,resizable";
  1651.         
  1652.         //Create a temporary window first to ensure the real popup comes up on top
  1653.         //var wndTemp = null;
  1654.         if (!s_bNS3) {
  1655.             gbWndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4");
  1656.         } 
  1657.         gbWndPopupLinks = window.open("", "popuplinks", strParam);
  1658.  
  1659.         setTimeout("Wait_PopupMenuReady()", 100);
  1660.     }
  1661.     return true;
  1662. }
  1663.  
  1664. function Wait_PopupMenuReady() 
  1665. {
  1666.     if (gbWndPopupLinks != null && "object" == typeof(gbWndPopupLinks.document)) {
  1667.         PopupMenu_InvokeReady();
  1668.     }
  1669.     else 
  1670.         setTimeout("Wait_PopupMenuReady()", 100);
  1671. }
  1672.  
  1673.  
  1674. function PopupMenu_InvokeReady()
  1675. {
  1676.     if (gbWndPopupLinks != null) {
  1677.         gbWndPopupLinks.document.open("text/html");
  1678.         gbWndPopupLinks.document.write("<html><head>");
  1679.         if (s_bNS2 || s_bOpera) {
  1680.             gbWndPopupLinks.document.write("<base href=\"" + location +"\">");
  1681.         } else {
  1682.             //YJ: IE301,302 and NS3.x works fine
  1683.             gbWndPopupLinks.document.write("<");
  1684.             gbWndPopupLinks.document.write("script>");
  1685.             gbWndPopupLinks.document.write("function gotoUrl(aUrl) {opener.window.location=aUrl; close();}");
  1686.             gbWndPopupLinks.document.write("<");
  1687.             gbWndPopupLinks.document.write("/script>");
  1688.         }
  1689.         gbWndPopupLinks.document.write("</head><body onBlur=\'self.focus();\'>");
  1690.         gbWndPopupLinks.document.write(gbstrParaTotal);
  1691.         gbWndPopupLinks.document.write("</body></html>");
  1692.         gbWndPopupLinks.document.close();
  1693.  
  1694.         // Close the temporary
  1695.         if (!s_bNS3 && gbWndTemp != null) {
  1696.             gbWndTemp.close();
  1697.         }else {
  1698.             gbWndPopupLinks.focus();
  1699.         }
  1700.  
  1701.         return true;
  1702.     }
  1703.     return false;
  1704. }
  1705.  
  1706. /// Section End - Embedded Stub (JavaScript 1.0)
  1707.  
  1708. //// Segment End -- (JavaScript 1.0)
  1709.  
  1710.