home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 39 / Issue 39.iso / pc / PCSoftware / RoboHelp / DISK1 / DATA.1 / Robohtml.chm / ehlpdhtm.js < prev    next >
Encoding:
JavaScript  |  2000-07-21  |  111.8 KB  |  3,752 lines

  1. // eHelpÆ Corporation Dynamic HTML JavaScript 
  2. // Copyright© 1998-2000 eHelpÆ Corporation.All rights reserved.
  3. // Version=4.42
  4.  
  5. // Warning:Do not modify this file.It is generated by RoboHELPÆ and changes will be overwritten.
  6.  
  7. //// Segment Begin -- (JavaScript 1.0)
  8. /// Section Begin - General (JavaScript 1.0)
  9.  
  10. //{{HH_SYMBOL_SECTION
  11. var HH_ChmFilename = "C:\\chm rho\\Robohtml.chm";
  12. var HH_WindowName = "NewWindow||dialog||main||Secondary window";
  13. var HH_GlossaryFont = "Verdana,8";
  14. var HH_Glossary = "0,0,1,0";
  15. var HH_Avenue = "0,0,1,0";
  16. var HH_ActiveX = true;
  17. //}}HH_SYMBOL_SECTION
  18.  
  19. //Begin to support previous generic parameters
  20. //Get the information about the browser.
  21. var gstrBsAgent     = navigator.userAgent.toLowerCase();
  22. var gnBsVer               = parseInt(navigator.appVersion);
  23.  
  24. var gbBsIE          = (gstrBsAgent.indexOf('msie') != -1);
  25. var gbBsNS          = (gstrBsAgent.indexOf('mozilla') != -1) && ((gstrBsAgent.indexOf('spoofer') == -1) && (gstrBsAgent.indexOf('compatible') == -1));
  26. var gbBsOpera        = (gstrBsAgent.indexOf('opera') != -1);
  27.  
  28. var gbBsIE3Before     = ((gbBsIE) && (gnBsVer <= 2));
  29. var gbBsNS3Before     = ((gbBsNS) && (gnBsVer <= 3));
  30.  
  31. var gbBsNS2            = ((gbBsNS) && (gnBsVer <= 2));
  32. var gbBsNS3            = ((gbBsNS) && (gnBsVer == 3));
  33. 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)));
  34. var gbBsIE302        = ((gbBsIE) && (gnBsVer == 2) && (gstrBsAgent.indexOf("3.02") != -1));
  35.  
  36. var gbBsNS4            = ((gbBsNS) && (gnBsVer >= 4));
  37. var gbBsIE4            = ((gbBsIE) && (gnBsVer >= 4));
  38. var gbBsIE5            = ((gbBsIE) && (gnBsVer >= 5));
  39. var gbBsIE55        = false;
  40.  
  41. gbBsIE = (navigator.appName.indexOf("Microsoft") != -1);
  42. if (parseInt(navigator.appVersion) >= 4) {
  43.  
  44.     gbBsIE4 = (navigator.appName.indexOf("Microsoft") != -1);
  45.  
  46.     if (gbBsIE4) {
  47.         if (gstrBsAgent.indexOf("msie 5.0") != -1) {
  48.             gbBsIE5 = true;
  49.         }
  50.         if (gstrBsAgent.indexOf("msie 5.5") != -1) { // curently IE 5.5 has some buggy stuff. we need do some remedy to our code.
  51.             gbBsIE55 = true;
  52.         }
  53.     }
  54. }
  55.  
  56. var gbBsMac            = (gstrBsAgent.indexOf('mac') != -1);
  57. var gbBsWindows        = ((gstrBsAgent.indexOf('win') != -1) || (gstrBsAgent.indexOf('16bit') != -1));
  58. var gbBsOp3            = (gstrBsAgent.indexOf('opera') != -1);
  59.  
  60. // Utilities functions.
  61. function BsscHasExtJs()
  62. {
  63.     if( gbBsIE3Before || gbBsNS3Before)
  64.         return false;
  65.     return true;
  66. }
  67.  
  68. // Register event handler
  69. var gBsOnLoads             = new Array();    // An array holds all the onload event handler.
  70. var gBsOnClicks         = new Array();    // An array holds all the onClick event handler.
  71. var gBsOnUnLoads         = new Array();    // An array holds all the OnUnLoad event handler.
  72. var gBsOnMouseOvers     = new Array();    // An array holds all the OnMouseOver event handler.
  73. var gBsOnMouseOuts         = new Array();    // An array holds all the OnMouseOut event handler.
  74.  
  75. var gbOrignalOnMouseDown = null;
  76.  
  77. function BsscRegisterOnLoad(funcHandler)
  78. {
  79.     var nLength = gBsOnLoads.length;
  80.     gBsOnLoads[nLength] = funcHandler;
  81. }
  82.  
  83. function BsscRegisterOnClick(funcHandler)
  84. {
  85.     var nLength = gBsOnClicks.length;
  86.     gBsOnClicks[nLength] = funcHandler;
  87. }
  88.  
  89. function BsscRegisterOnUnLoad(funcHandler)
  90. {
  91.     var nLength = gBsOnUnLoads.length;
  92.     gBsOnUnLoads[nLength] = funcHandler;
  93. }
  94.  
  95. function BsscRegisterOnMouseOver(funcHandler)
  96. {
  97.     var nLength = gBsOnMouseOvers.length;
  98.     gBsOnMouseOvers[nLength] = funcHandler;
  99. }
  100.  
  101. function BsscRegisterOnMouseOut(funcHandler)
  102. {
  103.     var nLength = gBsOnMouseOuts.length;
  104.     gBsOnMouseOuts[nLength] = funcHandler;
  105. }
  106.  
  107.  
  108. function BsGeneralOnLoad()
  109. {
  110.     if (!gbBsIE4 && !gbBsNS4)
  111.         return;
  112.  
  113.     // Make everything visible in navigator
  114.     if (gbBsNS4) {
  115.         // Make some special effects items visible
  116.         for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  117.             document.layers[iLayer].visibility = "show";
  118.             document.layers[iLayer].left = 0;
  119.         }
  120.     }
  121. }
  122.  
  123. // If resize the netscape browser, need to reload it.
  124. function BsReDo()
  125. {
  126.   if (innerWidth != origWidth || innerHeight != origHeight)
  127.      location.reload();
  128. }
  129. // End of the local functions.
  130.  
  131. // The following functions are used by the html files.
  132. function BSSCOnLoad()
  133. {
  134.     if( !BsscHasExtJs() )
  135.         return;
  136.     for (var nElement = gBsOnLoads.length - 1; nElement >= 0; nElement--)
  137.         gBsOnLoads[nElement]();
  138.     _BSSCCreatePopupDivOnLoad();// init for DHTML popups
  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 g_bIsPopupInit = false;
  250. function _BSSCCreatePopupDivOnLoad()
  251. {
  252.     if(!g_bIsPopupInit)
  253.     {
  254.         BsPopup_CreateDiv(0);
  255.         g_bIsPopupInit = true;
  256.     }
  257. }
  258.  
  259. function _BSSCCreatePopupDivOnWrite()
  260. {
  261.     if(!g_bIsPopupInit)
  262.     {
  263.         BsPopup_CreateDiv(1);
  264.         g_bIsPopupInit = true;
  265.     }
  266. }
  267.  
  268. function _BSSCCreatePopupDivOnWriteForKodav()
  269. {
  270.     if(!g_bIsPopupInit)
  271.     {
  272.         if ((gbBsIE4) && (!gbBsIE5))
  273.         {
  274.             BsPopup_CreateDiv(2);
  275.             g_bIsPopupInit = true;
  276.         }
  277.     }
  278. }
  279.  
  280.  
  281. //the browser information itself
  282. function _BSPSBrowserItself()
  283. {
  284.     var agent  = navigator.userAgent.toLowerCase();
  285.     this.major = parseInt(navigator.appVersion);
  286.     this.minor = parseFloat(navigator.appVersion);
  287.     this.ns    = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
  288.     this.ns2   = ((this.ns) && (this.major == 2));
  289.     this.ns3   = ((this.ns) && (this.major == 3));
  290.     this.ns4   = ((this.ns) && (this.major >= 4));
  291.     this.ie       = (agent.indexOf("msie") != -1);
  292.     this.ie3   = ((this.ie) && (this.major == 2));
  293.     this.ie4   = ((this.ie) && (this.major >= 4));
  294.     this.op3   = (agent.indexOf("opera") != -1);
  295.  
  296.     if (this.ns4)
  297.     {
  298.         gBsDoc        = "document";
  299.         gBsSty        = "";
  300.         gBsHtm        = ".document";
  301.         gBsStyVisShow    = "show";
  302.         gBsStyVisHide    = "hide";
  303.  
  304.     }
  305.     else if (this.ie4)
  306.     {
  307.         gBsDoc         = "document.all";
  308.         gBsSty         = ".style";
  309.         gBsHtm         = "";
  310.         gBsStyVisShow    = "visible";
  311.         gBsStyVisHide    = "hidden";
  312.     }
  313. }
  314.  
  315. //Here is the browser type 
  316. function _BSPSGetBrowserInfo()
  317. {
  318.     gBsBrowser    = new _BSPSBrowserItself();
  319. }
  320.  
  321. //Get client size info
  322. function _BSPSGetClientSize()
  323. {
  324.     if (gBsBrowser.ns4)
  325.     {
  326.         gBsClientWidth    = innerWidth;
  327.         gBsClientHeight = innerHeight;
  328.  
  329.     }
  330.     else if (gBsBrowser.ie4)
  331.     {
  332.         gBsClientWidth    = document.body.clientWidth;
  333.         gBsClientHeight = document.body.clientHeight;
  334.     }
  335. }
  336.  
  337.  
  338. var gstrPopupID = 'BSSCPopup';
  339. var gstrPopupShadowID = 'BSSCPopupShadow';
  340. var gstrPopupTopicID = 'BSSCPopupTopic';
  341. var gstrPopupIFrameID = 'BSSCPopupIFrame';
  342. var gstrPopupIFrameName = 'BSSCPopupIFrameName';
  343.  
  344. var gstrPopupSecondWindowName = 'BSSCPopup';
  345.  
  346. var    gPopupDiv = null;
  347. var gPopupDivStyle = null;
  348. var    gPopupShadow = null;
  349. var    gPopupTopic = null;
  350. var gPopupIFrame = null;
  351. var gPopupIFrameStyle = null;
  352. var gPopupWindow = null;
  353. var gnPopupClickX = 0;
  354. var gnPopupClickY = 0;
  355.  
  356. var gnPopupScreenClickX = 0;
  357. var gnPopupScreenClickY = 0;
  358.  
  359. var gbPopupTimeoutExpired = false;
  360.  
  361. var gbScriptName = "EHELP_DHTM";
  362. var gbPathofJS = "";
  363.  
  364.  
  365. if (gbBsIE4) {
  366.     var aScripts = document.scripts;
  367.     var aScript = null;
  368.     var i = 0;
  369.     for (i = 0; i < aScripts.length ; i ++ )
  370.     {
  371.         if (aScripts[i].name == gbScriptName) {
  372.             aScript = aScripts[i];
  373.             break;
  374.         }
  375.         
  376.     }
  377.  
  378.     if (aScript != null) {
  379.         var nPathPos = 0;
  380.         var strCurrentSrc = "";
  381.         strCurrentSrc = aScript.src;
  382.         var nPathPos1 = strCurrentSrc.lastIndexOf("\\");
  383.         var nPathPos2 = strCurrentSrc.lastIndexOf("/");
  384.         if (nPathPos1 > nPathPos2)
  385.             nPathPos = nPathPos1 + 1;
  386.         else
  387.             nPathPos = nPathPos2 + 1;
  388.  
  389.         gbPathofJS = strCurrentSrc.substring(0, nPathPos);
  390.     }
  391. }
  392.  
  393. // Replace point - Used by SingleSource 
  394. // var gbBlankPageForIFrame = gbPathofJS + "_blank.htm";
  395. var gbBlankPageForIFrame = "about:blank";
  396.  
  397. function DHTMLPopupSupport()
  398. {
  399.     if ((gbBsIE4) && (!gbBsMac)) {
  400.         return true;
  401.     }
  402.     return false;
  403. }
  404.  
  405.  
  406.  
  407. function BSSCPopup_IsPopup()
  408. {
  409.     if (DHTMLPopupSupport() && (this.name == gstrPopupIFrameName)) {
  410.         return true;
  411.     } else if ((gbBsNS4 || gbBsIE4) && (this.name == gstrPopupID)) {
  412.         return true;
  413.     } else {
  414.         return false;
  415.     }
  416. }
  417.  
  418.  
  419. // If there is a hyperlink in a popup window, display the hyperlink in
  420. // the original window.
  421. if (BSSCPopup_IsPopup()) {
  422.     document.write("<base target=\"_parent\">");
  423. }
  424.  
  425. // Local functions.
  426. function BsPopup_CreateDiv(mode)
  427. {
  428.     if( gPopupDiv != null || (!DHTMLPopupSupport()) )
  429.         return;
  430.     
  431.     var strPopupDiv = "<DIV ID='" + gstrPopupID + "' STYLE='position:absolute; width:0; height:0; top:-100; left:0; z-index:600; visibility:hidden;'>";
  432.     strPopupDiv += "<DIV ID='" + gstrPopupShadowID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#C0C0C0;\"></DIV>";
  433.     strPopupDiv += "<DIV ID='" + gstrPopupTopicID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#FFFFFF;border:1px #000000 outset;\">";
  434.     strPopupDiv += "<IFRAME ID='" + gstrPopupIFrameID + "' name='" + gstrPopupIFrameName + "' src = '" + gbBlankPageForIFrame + "' frameborder=0 scrolling=auto></IFRAME>";
  435.     strPopupDiv += "</DIV></DIV>";
  436.  
  437.     if (mode == 0)
  438.     {    
  439.         var objBody = document.all.tags("BODY")[0];
  440.         if( typeof(objBody) != "object" )
  441.             return;
  442.  
  443.         objBody.insertAdjacentHTML("beforeEnd", strPopupDiv);
  444.     }
  445.     else if (mode == 1)
  446.     {
  447.         document.write(strPopupDiv);
  448.     }
  449.     else if (mode == 2)
  450.     {
  451.         document.write(strPopupDiv);
  452.     }
  453. }
  454.  
  455.  
  456. function BSSCPopup_Timeout()
  457. {
  458.     if ((gPopupIFrame.document.readyState == "complete") &&
  459.         (gPopupIFrame.document.body != null) && 
  460.         (gPopupIFrame.location.href.indexOf(gbBlankPageForIFrame) == -1)) {
  461.         window.gPopupDivStyle.visibility = gBsStyVisShow;
  462.         BSSCPopup_TimeoutReal();
  463.     } else {
  464.         setTimeout("BSSCPopup_Timeout()", 100);
  465.     }
  466. }
  467.  
  468. function BSSCPopup_TimeoutReal()
  469. {
  470.     window.gbPopupTimeoutExpired = true;
  471.  
  472.     if (gPopupIFrame.document) {
  473.         BSSCPopup_ChangeTargettoParent(gPopupIFrame.document);
  474.         gPopupIFrame.document.body.onclick = BSSCPopupClicked;
  475.     }
  476.     gbOrignalOnMouseDown = document.onmousedown;
  477.     document.onmousedown = BSSCPopupParentClicked;
  478. }
  479.  
  480. function BSSCPopup_ChangeTargettoParent(tagsObject)
  481. {
  482.     var collA = tagsObject.all.tags("A");
  483.     var j = 0;
  484.     if (collA != null) {
  485.         for (j = 0; j < collA.length; j ++ )
  486.         {
  487.             collA[j].target = "_parent";
  488.         }
  489.  
  490.     }
  491. }
  492.  
  493. function BSPSPopupTopicWinHelp(strURL)
  494. {
  495.     _BSSCPopup(strURL);
  496.     return;
  497. }
  498.  
  499. function _BSSCPopup(strURL)
  500. {
  501.     if (DHTMLPopupSupport()) {
  502.         // If we are already in a popup, replace the contents
  503.         if (BSSCPopup_IsPopup()) {
  504.  
  505.             location.href = strURL;
  506.             parent.window.gbPopupTimeoutExpired = false;
  507.             if (gbBsMac) {
  508.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 400);
  509.             } else {
  510.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 100);
  511.             }
  512.             
  513.         } else {
  514.  
  515.             var tempColl = document.all.tags("DIV");
  516.             for (var iDiv = 0; iDiv < tempColl.length; iDiv++)
  517.             {
  518.                 if (tempColl(iDiv).id == gstrPopupID)
  519.                     gPopupDiv = tempColl(iDiv);
  520.                 if (tempColl(iDiv).id == gstrPopupShadowID)
  521.                     gPopupShadow = tempColl(iDiv);
  522.                 if (tempColl(iDiv).id == gstrPopupTopicID)
  523.                     gPopupTopic = tempColl(iDiv);
  524.             }
  525.         
  526.             gPopupIFrame = eval("gPopupDiv.document.frames['" + gstrPopupIFrameName + "']");
  527.             gPopupDivStyle = eval("gPopupDiv" + gBsSty);
  528.             gPopupIFrameStyle = eval(gBsDoc + "['" + gstrPopupIFrameName + "']" + gBsSty);
  529.  
  530.             // Load the requested URL into the IFRAME
  531.             gPopupIFrame.location.href = strURL;
  532.             window.gbPopupTimeoutExpired = false;
  533.             if (gbBsMac) {
  534.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 400);
  535.             } else {
  536.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 100);
  537.             }
  538.         }
  539.  
  540.     } else {
  541.         _BSSCPopup2(strURL);
  542.     }
  543.     return;
  544. }
  545.  
  546.  
  547. function _BSSCPopup2(strURL)
  548. {
  549.     if (window.name == gstrPopupSecondWindowName) {
  550.         window.location = strURL;
  551.     } else {
  552.  
  553.         BSSCHidePopupWindow();
  554.         var nX = 0;
  555.         var nY = 0;
  556.         var nHeight = 300;
  557.         var nWidth = 400;
  558.         _BSPSGetClientSize();
  559.         if (gBsBrowser.ns4) {
  560.             nX = window.screenX + (window.outerWidth - window.innerWidth) + window.gnPopupClickX;
  561.             nY = window.screenY + (window.outerHeight - window.innerHeight) + window.gnPopupClickY;
  562.             if (nY + nHeight + 40 > screen.availHeight) {
  563.                 nY = screen.availHeight - nHeight - 40;
  564.             }
  565.             if (nX + nWidth + 40 > screen.availWidth) {
  566.                 nX = screen.availWidth - nWidth - 40;
  567.             }
  568.         } else {
  569.             nX = window.gnPopupScreenClickX;
  570.             nY = window.gnPopupScreenClickY;
  571.         }
  572.  
  573.         // Launch a separate window
  574.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes";
  575.         if (gBsBrowser.ns) {
  576.             strParam += ",OuterHeight=" + nHeight + ",OuterWidth=" + nWidth;
  577.             strParam += ",screenX=" + nX + ",screenY=" + nY;
  578.             strParam += ",dependent=yes";
  579.         }
  580.         else {
  581.             strParam += ",height=" + nHeight + ",width=" + nWidth;
  582.             strParam += ",left=" + nX + ",top=" + nY;
  583.         }
  584.         window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam);
  585.         if (gBsBrowser.ns4) {
  586.             window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE);
  587.             window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  588.             window.gPopupWindow.onblur = NonIEPopup_HandleBlur;
  589.         }
  590.         else if (gBsBrowser.ie4)
  591.         {
  592.             window.gPopupWindow.focus();
  593.         }
  594.     }
  595.     return;
  596. }
  597.  
  598. function NonIEPopup_HandleBlur(e)
  599. {
  600.     window.gPopupWindow.focus();
  601. }
  602.  
  603. function NonIEPopup_HandleClick(e)
  604. {
  605.     // Because navigator will give the event to the handler before the hyperlink, let's
  606.     // first route the event to see if we are clicking on a Popup menu in a popup.
  607.     document.routeEvent(e);
  608.  
  609.     // If a popup menu is active then don't do anything with the click
  610.     if (window.gPopupWindow.gbInPopupMenu) {
  611.         window.gPopupWindow.captureEvents(Event.CLICK);
  612.         window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  613.         return false;
  614.     }
  615.  
  616.     // Close the popup window
  617.     if (e.target.href != null) {
  618.         window.location.href = e.target.href;
  619.         if (e.target.href.indexOf("BSSCPopup") == -1) {
  620.             this.close();
  621.         }
  622.     } else {
  623.         this.close();
  624.     }
  625.     return false;
  626. }
  627.  
  628. function BSSCPopup_AfterLoad(strURL)
  629. {    
  630.     if (typeof(window.gPopupIFrame.document) == "unknown") {
  631.         _BSSCPopup2(strURL);
  632.         return;
  633.     }
  634.     if ((window.gPopupIFrame.document.readyState == "complete") &&
  635.         (window.gPopupIFrame.document.body != null) && 
  636.         (window.gPopupIFrame.location.href.indexOf(gbBlankPageForIFrame) == -1)) {
  637.         BSSCPopup_ResizeAfterLoad(strURL);
  638.     } else {
  639.         setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 200);
  640.     }
  641. }
  642.  
  643.  
  644. function BSSCPopup_ResizeAfterLoad(strURL)
  645. {
  646.     window.gPopupDivStyle.visibility = gBsStyVisHide;
  647.  
  648.     // Determine the width and height for the window
  649.     //var size = new BSSCSize(0, 0);
  650.     //BSSCGetContentSize(window.gPopupIFrame, size);
  651.     //var nWidth = size.x;
  652.     //var nHeight = size.y;
  653.  
  654.     _BSPSGetClientSize();
  655.     
  656.     var size = new BSSCSize(0, 0);
  657.  
  658.     BSSCGetContentSize(window.gPopupIFrame, size);
  659.  
  660.     // Determine the width and height for the window
  661.     var nWidth = size.x;
  662.     var nHeight = size.y;
  663.         
  664.     window.gPopupDivStyle.width = nWidth;
  665.     window.gPopupDivStyle.height = nHeight;
  666.  
  667.     // Determine the position of the window
  668.     var nClickX = window.gnPopupClickX;
  669.     var nClickY = window.gnPopupClickY;
  670.     var nTop = 0;
  671.     var nLeft = 0;
  672.  
  673.     if (nClickY + nHeight + 20 < gBsClientHeight + document.body.scrollTop) {
  674.         nTop = nClickY + 10;
  675.     } else {
  676.         nTop = (document.body.scrollTop + gBsClientHeight) - nHeight - 20;
  677.     }
  678.     if (nClickX + nWidth < gBsClientWidth + document.body.scrollLeft) {
  679.         nLeft = nClickX;
  680.     } else {
  681.         nLeft = (document.body.scrollLeft + gBsClientWidth) - nWidth - 8;
  682.     }
  683.     
  684.     if (nTop < document.body.scrollTop ) nTop  = document.body.scrollTop + 1;
  685.     if (nLeft< document.body.scrollLeft) nLeft = document.body.scrollLeft + 1;
  686.  
  687.  
  688.     window.gPopupDivStyle.left = nLeft;
  689.     window.gPopupDivStyle.top = nTop;
  690.  
  691.     // Set the location of the background blocks
  692.     window.gPopupShadow.style.left = 6;
  693.     window.gPopupShadow.style.top = 6;
  694.     if (gbBsIE55)
  695.     {
  696.         window.gPopupShadow.style.left = 4;
  697.         window.gPopupShadow.style.top = 4;
  698.     }
  699.     window.gPopupShadow.style.width = nWidth;
  700.     window.gPopupShadow.style.height = nHeight;
  701.     window.gPopupTopic.style.width = nWidth;
  702.     window.gPopupTopic.style.height = nHeight;
  703.     if (gbBsIE55)
  704.     {
  705.         window.gPopupShadow.style.width = nWidth + 2;
  706.         window.gPopupShadow.style.height = nHeight + 2;
  707.         window.gPopupTopic.style.width = nWidth + 2;
  708.         window.gPopupTopic.style.height = nHeight + 2;
  709.     }
  710.  
  711.  
  712.     if (gbBsMac) {
  713.         // Total hack on the iMac to get the IFrame to position properly
  714.         window.gPopupIFrameStyle.pixelLeft = 100;
  715.         window.gPopupIFrameStyle.pixelLeft = 0;
  716.         // Explicitly call BSSCOnLoad because the Mac doesn't seem to do it
  717.         window.gPopupIFrame.window.BSSCOnLoad();
  718.     }
  719.     //var nOriWidth = window.gPopupIFrameStyle.width
  720.  
  721.     window.gPopupIFrameStyle.width = nWidth;
  722.     window.gPopupIFrameStyle.height = nHeight;
  723.     if (gbBsIE55)
  724.     {
  725.         window.gPopupIFrameStyle.top = 0;
  726.         window.gPopupIFrameStyle.left = 0;
  727.     }
  728.  
  729.     gPopupIFrame.location.href = strURL;  // reload again, this will fix the bookmark misunderstand in IE5.
  730.     
  731.     setTimeout("BSSCPopup_Timeout();", 100);
  732.     
  733.     return false;
  734. }
  735.  
  736. function    BSSCSize(x, y)
  737. {
  738.     this.x = x;
  739.     this.y = y;
  740. }
  741.  
  742. function BSSCGetContentSize(thisWindow, size)
  743. {
  744.     if (!((gBsBrowser.ie4) || (gBsBrowser.ns4)))
  745.         return;
  746.  
  747.     if (gbBsMac) {
  748.         size.x = 300;
  749.         size.y = 300;
  750.         return;
  751.     }
  752.  
  753.     // Resize the width until it is wide enough to handle the content
  754.     // The trick is to start wide and determine when the scrollHeight changes
  755.     // because then we know a scrollbar is necessary. We can then go back
  756.     // to the next widest size (for no scrollbar)
  757.  
  758.     var ClientRate = gBsClientHeight / gBsClientWidth;
  759.  
  760.     var GoldenSize = new BSSCSize(0,0);
  761.     GoldenSize.x = gBsClientWidth * gBMaxXOfParent;
  762.     GoldenSize.y = gBsClientHeight *gBMaxYOfParent ;
  763.  
  764.     if (ClientRate > gBRateH_W) {
  765.         GoldenSize.y = GoldenSize.x * gBRateH_W;
  766.     }
  767.     else {
  768.         GoldenSize.x = GoldenSize.y / gBRateH_W;
  769.     }
  770.  
  771.     // Try to using parent specified max x.
  772.     var x = 0;
  773.     var maxgoldx = GoldenSize.x;
  774.     var maxx = gBsClientWidth * gBMaxXOfParent;
  775.     
  776.     // This double resize causes the document to re-render (and we need it to)
  777.     thisWindow.moveTo(10000,10000); // this is used to fix the flash on IE4.
  778.     thisWindow.resizeTo(1, 1);
  779.     thisWindow.resizeTo(1, 1);
  780.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  781.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  782.         
  783.     var miny = thisWindow.document.body.scrollHeight + gBscrollHeight;
  784.     
  785.     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
  786.     {
  787.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  788.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  789.         
  790.         miny =     thisWindow.document.body.scrollHeight + gBscrollHeight;
  791.         maxy = gBsClientHeight * gBMaxYOfParent;
  792.         
  793.         if (miny > maxy) { // the popup must have a scroll, OK let it be.
  794.             miny = maxy;
  795.             size.x = maxx;
  796.             size.y = maxy;
  797.         }
  798.         else { // popup still can fit in the parent area by someway. now we choose the same h/w rate as parent.
  799.             size.y = miny;
  800.             
  801.             //  downsize from maxx , now I try to using binary divide.
  802.             x = maxx;
  803.             deltax = -maxx/2;
  804.             //j = 0;
  805.             while (true) {
  806.                 x = x + deltax;
  807.                 thisWindow.resizeTo(x, miny);
  808.                 thisWindow.resizeTo(x, miny);
  809.                 diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * ClientRate;
  810.                 if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  811.                     deltax = Math.abs(deltax) /2;
  812.                 else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  813.                     deltax = -Math.abs(deltax) /2;
  814.                 else 
  815.                     // the y is close enough to wanted.
  816.                     break;
  817.                 if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  818.                     break;
  819.             }
  820.             size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth;
  821.             size.y = thisWindow.document.body.scrollHeight;// + gBscrollHeight;    
  822.             thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  823.             
  824.         // Handle absurd cases just in case IE flakes
  825.     //        if (size.y < 100) {
  826.     //            size.y = 100;
  827.     //        }
  828.         }
  829.     }
  830.     else {
  831.         //  downsize from maxgoldx , now I try to using binary divide.
  832.         x = maxgoldx;
  833.         deltax = -maxgoldx/2;
  834.         //i = 0;
  835.         while (true) {
  836.             x = x + deltax;
  837.             thisWindow.resizeTo(x, miny);
  838.             thisWindow.resizeTo(x, miny);
  839.             diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * gBRateH_W;
  840.             if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  841.                 deltax = Math.abs(deltax) /2;
  842.             else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  843.                 deltax = -Math.abs(deltax) /2;
  844.             else 
  845.                 // the y is close enough to wanted.
  846.                 break;
  847.             if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  848.                 break;
  849.             //i ++;
  850.                 
  851.         }
  852.         size.x = thisWindow.document.body.scrollWidth ;//+ gBscrollWidth;
  853.         size.y = thisWindow.document.body.scrollHeight ;//+ gBscrollHeight;    
  854.         thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  855.     }
  856.  
  857.     if ((gbBsIE4) && (!gbBsIE5))
  858.     {
  859.         size.x = size.x + 16;    //reserve a width for scrollbar (IE 4.0 only)
  860.     }
  861.  
  862.     thisWindow.resizeTo(size.x, size.y);
  863.     thisWindow.resizeTo(size.x, size.y);
  864.     return;
  865. }
  866.  
  867.  
  868.  
  869. function BSSCPopupParentClicked()
  870. {
  871.     BSSCPopupClicked();
  872.     return;
  873. }
  874.  
  875.  
  876. function BSSCPopupClicked()
  877. {
  878.     if (!window.gbPopupTimeoutExpired) {
  879.         return false;
  880.     }
  881.  
  882.     if (gPopupIFrame.window.gbInPopupMenu) {
  883.         return false;
  884.     }
  885.  
  886.     // Give the user a message about javascript calls through objects.
  887.     if ((gPopupIFrame.window.event != null) &&
  888.         (gPopupIFrame.window.event.srcElement != null) &&
  889.         (gPopupIFrame.window.event.srcElement.tagName == "A") &&
  890.         (gPopupIFrame.window.event.srcElement.href.indexOf("javascript:") == 0) &&
  891.         (gPopupIFrame.window.event.srcElement.href.indexOf(".") != -1)) {
  892.         gPopupIFrame.window.event.cancelBubble = true;
  893.         alert('Hyperlinks to objects do not work in popups.');
  894.         return false;
  895.     }
  896.  
  897.     if (gPopupIFrame.document) {
  898.         gPopupIFrame.document.body.onclick = null;
  899.     }
  900.  
  901.     document.onmousedown = gbOrignalOnMouseDown;
  902.  
  903.     // Simply hide the popup
  904.     gPopupDivStyle.visibility = gBsStyVisHide;
  905.     gPopupIFrame.location.href = gbBlankPageForIFrame;
  906.  
  907.     return true;
  908. }
  909.  
  910.  
  911. //trace the mouse over's position for hotspot
  912. function  BSPSPopupOnMouseOver(event)
  913. {
  914.     if (gBsBrowser.ie4) {
  915.         window.gnPopupClickX = event.clientX + document.body.scrollLeft;
  916.         window.gnPopupClickY = event.clientY + document.body.scrollTop;
  917.         window.gnPopupScreenClickX = event.screenX;
  918.         window.gnPopupScreenClickY = event.screenY;
  919.     } else if (gBsBrowser.ns4) {
  920.         window.gnPopupClickX = event.pageX;
  921.         window.gnPopupClickY = event.pageY;
  922.     }
  923. }
  924.  
  925. function BSSCHidePopupWindow()
  926. {
  927.     if (window.gPopupWindow != null) {
  928.         if (gBsBrowser.ns4) {
  929.             if ((typeof window.gPopupWindow != "undefined") && (!window.gPopupWindow.closed)) {
  930.                 window.gPopupWindow.close();
  931.                 window.gPopupWindow = null;
  932.             }
  933.         }
  934.     }
  935.  
  936.     return;
  937. }
  938.  
  939. // Add the PopupOnClick to the onclick array.
  940. if (typeof(BsscRegisterOnClick) != "undefined")
  941. {
  942.     BsscRegisterOnClick(BsPopupOnClick);
  943. }
  944. //End to support previous popup functions
  945.  
  946. //Begin to support previous relative topics
  947. //If webHelp needs Related Topics DHTMLcode, it's supposed to add it here
  948. var gbPopupMenuTimeoutExpired = false;
  949. var gbInPopupMenu = false;
  950. var gbPopupMenuTopicList = null;
  951.  
  952. //////////////////////////////////////////////////////////////////////////////////////////
  953. //
  954. // Popup Menu code
  955. //
  956. //////////////////////////////////////////////////////////////////////////////////////////
  957.  
  958. var g_bIsPopupMenuInit = false;
  959. function _WritePopupMenuLayer()
  960. {
  961.     if (!g_bIsPopupMenuInit)
  962.         {
  963.       if (gbBsNS4) {
  964. //Do not try to write ininle styles for NS!  NS can not handle it and will not stop downloading the html page...
  965.        document.write("<DIV CLASS='WebHelpPopupMenu' ID='PopupMenu'></DIV>");
  966.       } else{
  967.       document.write("<DIV ID='PopupMenu' STYLE='position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;'></DIV>");
  968.       if (gbBsIE4) {
  969.         document.write("<STYLE TYPE='text/css'>");
  970.         if (gbBsMac) {
  971.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:10pt; text-decoration:none;}");
  972.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:10pt; text-decoration:none;}");
  973.         } else {
  974.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:8pt; text-decoration:none;}");
  975.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:8pt; text-decoration:none;}");
  976.         }
  977.         document.write("</STYLE>");
  978.        }
  979.           }
  980.       g_bIsPopupMenuInit = true;
  981.     }
  982. }
  983.  
  984. //Define variable arguments as: strTitle, strUrl
  985. function PopupMenuTopicEntry() 
  986. {
  987.     this.strTitle = PopupMenuTopicEntry.arguments[0];
  988.     this.strURL = PopupMenuTopicEntry.arguments[1];
  989. }
  990.  
  991. // If the topic list is set, it is an array of TopicEntry objects (defined in WebHelp3.js)
  992. function PopupMenu_SetTopicList(aPopupTopicArray)
  993. {
  994.     gbPopupMenuTopicList = aPopupTopicArray;
  995. }
  996.  
  997. //Seek for the bsscright frame 
  998. function _SeekFrameByName( cRoot, strName )
  999. {
  1000.     if( cRoot == null )    return null;
  1001.     if( cRoot.frames == null )    return null;
  1002.     if( cRoot.frames[strName] != null )    return cRoot.frames[strName];
  1003.     for (var i=0; i<cRoot.frames.length; i++)
  1004.     {
  1005.         var cObj = _SeekFrameByName( cRoot.frames(i).document, strName );
  1006.         if( cObj != null )        return cObj;
  1007.     };
  1008.     return null;
  1009. }
  1010. function _GetFrameByName( cRoot, strName )
  1011. {
  1012.     if( cRoot == null )    return null;
  1013.     var cRet = _SeekFrameByName(cRoot, strName);
  1014.     if( cRet != null )    return cRet;
  1015.     return _GetFrameByName( cRoot.parent, strName );
  1016. }
  1017.  
  1018. function _PopupMenu_Invoke(fn_arguments)
  1019. {
  1020.     if ((!gbBsIE4 && !gbBsNS4) || ((gbBsMac) && (gbBsIE4) && (window.event.srcElement.tagName == "AREA"))) {
  1021.     
  1022.         var argLen     = fn_arguments.length;
  1023.  
  1024.         // Create the window that the hyperlinks will go into
  1025.         var nHeight = argLen * 15;
  1026.         var nWidth = 400;
  1027.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  1028.         strParam += ",height=" + nHeight + ",width=200";
  1029.         strParam += ",resizable";
  1030.  
  1031.         // Create a temporary window first to ensure the real popup comes up on top
  1032.         var wndTemp = window.open("", "temp", strParam);
  1033.  
  1034.         // Create the real popup window
  1035.         var wndPopupLinks = window.open("", "popuplinks", strParam);
  1036.  
  1037.         // Close the temporary
  1038.         wndTemp.close();
  1039.  
  1040.         wndPopupLinks.document.open("text/html");
  1041.         wndPopupLinks.document.write("<html><head></head>");
  1042.         wndPopupLinks.document.write("<body onBlur=\'self.focus();\'>");
  1043.         var strParaLine = "";
  1044.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  1045.             strParaLine = "";
  1046.             strParaLine += "<a href=\"javascript:";
  1047.             if (gbBsIE) {
  1048.                 strParaLine += "onBlur=null; ";
  1049.             }
  1050.             strParaLine += "opener.location=\'";
  1051.             strParaLine += fn_arguments[2 * i + 3];
  1052.             strParaLine += "\';close();\"";
  1053.             if (fn_arguments[1] != '') {
  1054.                 strParaLine += " TARGET='" + fn_arguments[1] + "'";
  1055.             }
  1056.             strParaLine += ">";
  1057.             strParaLine += fn_arguments[2 * i + 2];
  1058.             strParaLine += "</a>";
  1059.             strParaLine += "<br>";
  1060.             wndPopupLinks.document.write(strParaLine);
  1061.         }
  1062.         wndPopupLinks.document.write("</body></html>");
  1063.         wndPopupLinks.document.close();
  1064.         window.gbInPopupMenu = true;
  1065.         if (!gbBsIE) {
  1066.             wndPopupLinks.focus();
  1067.         }
  1068.  
  1069.         return false;
  1070.     }
  1071.  
  1072.     // Make sure we have reasonable arguments
  1073.     var argLen = fn_arguments.length;
  1074.     if (argLen < 3) {
  1075.         return false;
  1076.     }
  1077.  
  1078.     // Check to see if we only have one target
  1079.     var strTarget = "";
  1080.     if (((argLen < 5) && ((isNaN(fn_arguments[2])) || (gbPopupMenuTopicList == null))) ||
  1081.         ((argLen < 4) && ((!isNaN(fn_arguments[2])) && (gbPopupMenuTopicList != null)))) {
  1082.  
  1083.         // Get the place that we will be putting the topic into
  1084.         var targetDoc = null;
  1085.         if (fn_arguments[1] == '') {
  1086.             targetDoc = window.document;
  1087.         } else {
  1088.             targetDoc = _GetFrameByName( parent, fn_arguments[1] );
  1089.             if (targetDoc == null) {
  1090.                 targetDoc  = window.document;
  1091.             }
  1092.             //if (gbBsIE4) {
  1093.             //        targetDoc = eval("top.document.frames['" + fn_arguments[1] + "']");
  1094.             //    } else if (gbBsNS4) {
  1095.             //    targetDoc = eval("window.top." + fn_arguments[1] + ".document");
  1096.             //}
  1097.             strTarget = "TARGET='" + fn_arguments[1] + "'";
  1098.         }
  1099.         if (isNaN(fn_arguments[2]) ||  (gbPopupMenuTopicList == null)) {
  1100.             targetDoc.location.href = fn_arguments[3];
  1101.         } else {
  1102.             targetDoc.location.href = gbPopupMenuTopicList[fn_arguments[2]].strURL;
  1103.         }
  1104.         return false;
  1105.     }
  1106.     
  1107.     var strMenu = "";
  1108.     if (gbBsNS4) {
  1109.         strMenu = '<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=3 BGCOLOR="#c0c0c0">';
  1110.     } else {
  1111.         strMenu = '<TABLE STYLE="border:2px outset white;" CELLSPACING=0';
  1112.         if (gbBsMac) {
  1113.             strMenu += ' CELLPADDING=4';
  1114.         } else {
  1115.             strMenu += ' CELLPADDING=2';
  1116.         }    
  1117.         strMenu += ' BGCOLOR=#c0c0c0>';
  1118.     }
  1119.  
  1120.     // Add each of the items
  1121.     var i = 2;
  1122.     while (i <= argLen - 1) {
  1123.         strMenu += '<TR><TD><NOBR>'
  1124.         // If the destination is a number then look it up in the topic list
  1125.         if (isNaN(fn_arguments[i]) ||  (gbPopupMenuTopicList == null)) {
  1126.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + fn_arguments[i + 1] + '"' + strTarget;
  1127.         } else {
  1128.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + gbPopupMenuTopicList[fn_arguments[i]].strURL + '"' + strTarget;
  1129.         }
  1130.         strMenu += ' onclick="PopupMenu_HandleClick(event);"';
  1131.         strMenu += ' onmouseover="PopupMenu_Over(event);"';
  1132.         strMenu += ' onmouseout="PopupMenu_Out(event);"';
  1133.         strMenu += '>';
  1134.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  1135.             strMenu += '<SPAN CLASS="PopupNotOver">' + fn_arguments[i] + '</SPAN>';
  1136.         } else {
  1137.             strMenu += '<SPAN CLASS="PopupNotOver">' + gbPopupMenuTopicList[fn_arguments[i]].strTitle + '</SPAN>';
  1138.         }
  1139.         strMenu += '</A></DIV></NOBR></TD></TR>';
  1140.  
  1141.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  1142.             i += 2;
  1143.         } else {
  1144.             i += 1;
  1145.         }
  1146.     }
  1147.     strMenu += "</TABLE>";
  1148.  
  1149.     if (gbBsMac) {
  1150.     // totally hack. because ie5 in mac need something. </TABLE> is one of them. mac is mad.
  1151.         strMenu +="<TABLE></TABLE>";
  1152.     }
  1153.  
  1154.     var layerPopup = null;
  1155.     var stylePopup = null;
  1156.     var nEventX = 0;
  1157.     var nEventY = 0;
  1158.     var nWindowWidth = 0;
  1159.     if (gbBsIE4) {
  1160.  
  1161.         layerPopup = document.all["PopupMenu"];
  1162.         layerPopup.innerHTML = strMenu;
  1163.         stylePopup = layerPopup.style;
  1164.  
  1165.         _BSPSGetClientSize();
  1166.  
  1167.         // Get the position of the item causing the event (relative to its parent)
  1168.         //if (gbBsMac) {
  1169.         if (true) {
  1170.             nEventX = window.event.clientX;
  1171.             nEventY = window.event.clientY;
  1172.         } else {
  1173.             //??? YJ: Can not remember why we calculate envent position by following code...
  1174.             //but it is wrong in a case like: CENTER->P->TABLE:
  1175.             //the offset positions of TABLE, P and CENTER are same (same offsetTop,offsetLeft)
  1176.             //so we get triple times of offset of x and y as we expect... 
  1177.  
  1178.             nEventX = window.event.srcElement.offsetLeft - document.body.scrollLeft;
  1179.             nEventY = window.event.srcElement.offsetTop - document.body.scrollTop;
  1180.  
  1181.             // Get the location of the parent
  1182.             var nParentLocX = 0;
  1183.             var nParentLocY = 0;
  1184.  
  1185.             var ParentItem = window.event.srcElement.offsetParent;
  1186.             while (ParentItem != null) {
  1187.                 if (ParentItem.offsetLeft)    {
  1188.                     nParentLocX += ParentItem.offsetLeft;
  1189.                     nParentLocY += ParentItem.offsetTop;
  1190.                 }
  1191.                 ParentItem = ParentItem.parentElement;
  1192.             }
  1193.  
  1194.             // Adjust the location of the item using the location of the parent(s)
  1195.             nEventX += nParentLocX;
  1196.             nEventY += nParentLocY;
  1197.         }
  1198.  
  1199.         if (nEventY + layerPopup.scrollHeight + 10 < gBsClientHeight) {
  1200.             nEventY += document.body.scrollTop + 10;
  1201.         } else {
  1202.             nEventY = (document.body.scrollTop + gBsClientHeight) - layerPopup.scrollHeight - 20;
  1203.         }
  1204.         stylePopup.top = nEventY;
  1205.  
  1206.         if (nEventX + layerPopup.scrollWidth + 20 > gBsClientWidth) {
  1207.             if (gBsClientWidth - layerPopup.scrollWidth < 5) {
  1208.                 stylePopup.left = 5;
  1209.             } else {
  1210.                 stylePopup.left = gBsClientWidth - layerPopup.scrollWidth - 5;
  1211.             }
  1212.         } else {
  1213.             stylePopup.left = nEventX + document.body.scrollLeft + 20;
  1214.         }
  1215.  
  1216.         stylePopup.visibility = "visible";
  1217.         document.onclick = PopupMenu_HandleClick;
  1218.     } else if (gbBsNS4) {
  1219.         layerPopup = document.layers.PopupMenu;
  1220.         layerPopup.visibility = "hide";
  1221.         stylePopup = layerPopup.document;
  1222.         stylePopup.write(strMenu);
  1223.         stylePopup.close();
  1224.         var e = fn_arguments[0];
  1225.         nEventX = e.pageX;
  1226.         nEventY = e.pageY;
  1227.         _BSPSGetClientSize();
  1228.         if (nEventY + layerPopup.clip.height + 20 < window.pageYOffset + gBsClientHeight) {
  1229.             nEventY += 20;
  1230.         } else {
  1231.             nEventY = gBsClientHeight + window.pageYOffset- layerPopup.clip.height - 20;
  1232.         }
  1233.         layerPopup.top = nEventY;
  1234.  
  1235.         if (nEventX + layerPopup.clip.width + 20 > gBsClientWidth + window.pageXOffset) {
  1236.             if (gBsClientWidth + window.pageXOffset - layerPopup.clip.width < 20) {
  1237.                 nEventX = 5;
  1238.             } else {
  1239.                 nEventX = gBsClientWidth + window.pageXOffset - layerPopup.clip.width - 20;
  1240.             }
  1241.         } else {
  1242.             nEventX += 20;
  1243.         }
  1244.  
  1245.         layerPopup.left = nEventX;
  1246.  
  1247.         layerPopup.visibility = "show";
  1248.  
  1249. //        window.captureEvents(Event.CLICK | Event.MOUSEDOWN);
  1250.         window.captureEvents(Event.MOUSEDOWN);
  1251. //        window.onclick = PopupMenu_HandleClick;
  1252.         window.onmousedown = PopupMenu_HandleClick;
  1253.     }
  1254.  
  1255.     window.gbInPopupMenu = true;
  1256.     window.gbPopupMenuTimeoutExpired = false;
  1257.     setTimeout("PopupMenu_Timeout();", 100);
  1258.     return false;
  1259. }
  1260.  
  1261.  
  1262. function PopupMenu_Timeout()
  1263. {
  1264.     window.gbPopupMenuTimeoutExpired = true;
  1265. }
  1266.  
  1267. function PopupMenu_Over(e)
  1268. {
  1269.     if (gbBsIE4) {
  1270.         e.srcElement.className = "PopupOver";
  1271.     } else if (gbBsNS4) {
  1272. //        this.bgColor = "red";
  1273. //        e.target.document.className = "PopupOver";
  1274.     }
  1275.     return;
  1276. }
  1277.  
  1278. function PopupMenu_Out(e)
  1279. {
  1280.     if (gbBsIE4) {
  1281.         e.srcElement.className = "PopupNotOver";
  1282.     } else if (gbBsNS4) {
  1283.         this.bgColor = "#f0f0f0";
  1284.     }
  1285.     return;
  1286. }
  1287.  
  1288.  
  1289. function PopupMenu_HandleClick(e)
  1290. {
  1291.     if (!window.gbPopupMenuTimeoutExpired) {
  1292.         return;
  1293.     }
  1294.  
  1295.     window.gbInPopupMenu = false;
  1296.  
  1297.     if (gbBsNS4) {
  1298. //        window.releaseEvents(Event.CLICK);
  1299.         window.releaseEvents(Event.MOUSEDOWN);
  1300.     }
  1301.  
  1302.     var layerPopup = null;
  1303.     var stylePopup = null;
  1304.     if (gbBsIE4) {
  1305.         layerPopup = document.all["PopupMenu"];
  1306.         stylePopup = layerPopup.style;
  1307.         stylePopup.visibility = "hidden";
  1308.     } else if (gbBsNS4) {
  1309.         layerPopup = document.layers.PopupMenu;
  1310.         layerPopup.visibility = "hide";
  1311.     }
  1312.  
  1313.     return;
  1314. }
  1315.  
  1316. // This function should be deleted when all old projects are cleaned up
  1317. function BSPSWritePopupFrameForIE4()
  1318. {
  1319.     return false;
  1320. }
  1321.  
  1322. /////////////////////////////////////////////////////////////////////
  1323. function BSSCPopup_ClickMac()
  1324. {
  1325.     if ((!DHTMLPopupSupport()) && (gbBsIE4))
  1326.     {    
  1327.         var bClickOnAnchor = false;
  1328.         var el;
  1329.         if ((window.event != null) &&
  1330.             (window.event.srcElement != null))
  1331.         {
  1332.             el = window.event.srcElement;
  1333.             while (el != null)
  1334.             {
  1335.                 if ((el.tagName == "A") || (el.tagName == "AREA"))     {
  1336.                     bClickOnAnchor = true;
  1337.                     break;
  1338.                 }
  1339.                 if (el.tagName == "BODY") {
  1340.                     break;
  1341.                 }
  1342.                 el = el.parentElement;
  1343.             }
  1344.         }
  1345.         if (BSSCPopup_IsPopup())
  1346.         {
  1347.             if (!bClickOnAnchor) {
  1348.                 parent.window.gPopupWindow = null;
  1349.                 self.close();
  1350.             }
  1351.         }
  1352.         else
  1353.         {
  1354.             bClosePopupWindow = true;
  1355.             if ((bClickOnAnchor) &&
  1356.                 (el.href) &&
  1357.                 (el.href.indexOf("javascript:BSSCPopup") != -1))
  1358.             {
  1359.                 bClosePopupWindow = false;
  1360.             }
  1361.             if (bClosePopupWindow)
  1362.             {
  1363.                 if (window.gPopupWindow != null)
  1364.                 {
  1365.                     var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400";
  1366.                     window.gPopupWindow = window.open("", gstrPopupSecondWindowName,strParam);
  1367.                     window.gPopupWindow.close();
  1368.                     window.gPopupWindow = null;
  1369.                 }
  1370.             }
  1371.         }
  1372.     }
  1373.  }
  1374.  
  1375. //////////////////////////////////////////////////////////////////////
  1376.  
  1377. _BSPSGetBrowserInfo();
  1378.  
  1379.  
  1380. function BsPopupOnClick()
  1381. {
  1382.     if (!gbBsIE4)
  1383.         return;
  1384.  
  1385.     BSSCPopup_ClickMac();
  1386. }
  1387.  
  1388. function _BSSCOnError(message)
  1389. {
  1390.     if(-1 != message.indexOf("denied") 
  1391.         || -1 != message.indexOf("Object required"))
  1392.      return true;
  1393. }
  1394.  
  1395. //End to support previous relative topics
  1396.  
  1397. /// Section End  - Popup and Related Topic (JavaScript 1.0)
  1398.  
  1399. /// Section Begin - Embedded Stub (JavaScript 1.0)
  1400.  
  1401. var s_strAgent = navigator.userAgent.toLowerCase();
  1402. var s_nVer       = parseInt(navigator.appVersion);
  1403.  
  1404. var s_bIE  = (s_strAgent.indexOf('msie') != -1);
  1405. var s_bNS  = (s_strAgent.indexOf('mozilla') != -1) && ((s_strAgent.indexOf('spoofer') == -1) && (s_strAgent.indexOf('compatible') == -1));
  1406. var s_bOpera    = (s_strAgent.indexOf('opera') != -1);
  1407.  
  1408. var s_bIE3Before = ((s_bIE) && (s_nVer <= 2));
  1409. var s_bNS3Before = ((s_bNS) && (s_nVer <= 3));
  1410.  
  1411. var s_bNS2        = ((s_bNS) && (s_nVer <= 2));
  1412. var s_bNS3        = ((s_bNS) && (s_nVer == 3));
  1413. 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)));
  1414. var s_bIE302    = ((s_bIE) && (s_nVer == 2) && (s_strAgent.indexOf("3.02") != -1));
  1415.  
  1416.  
  1417. function HasExtJs()
  1418. {
  1419.     if (s_bIE3Before) { return false;}
  1420.     if (s_bNS3Before) {    return false;}
  1421.     if (typeof (BsGeneralOnLoad) == "undefined"){ return false; }
  1422.     return true;
  1423. }
  1424.  
  1425.  
  1426. function BSSCCreatePopupDiv()
  1427. {
  1428.     if(HasExtJs())    {_BSSCCreatePopupDivOnWrite();}
  1429. }
  1430.  
  1431.  
  1432. function WritePopupMenuLayer()
  1433. {
  1434.     if (HasExtJs()) {_WritePopupMenuLayer();}
  1435. }
  1436.  
  1437. function BSSCPopup(strURL)
  1438. {
  1439.     if (HasExtJs())    { 
  1440.         _BSSCPopup(strURL);
  1441.     }else{
  1442.         //Create a temporary window first to ensure the real popup comes up on top
  1443.         var wndTemp = null;
  1444.         if (!s_bNS3) {
  1445.             wndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4");
  1446.         }
  1447.         // Create the real popup window
  1448.         var wndPopup = window.open(strURL, "BSSCPopup", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400");
  1449.         // Close the temporary
  1450.         if (!s_bNS3) {
  1451.             wndTemp.close();
  1452.         } else {
  1453.             wndPopup.focus();
  1454.         }
  1455.     }
  1456. }
  1457.  
  1458. var gbWndTemp = null, gbWndPopupLinks = null;
  1459. var gbstrParaTotal = "";
  1460.  
  1461. function PopupMenu_Invoke()
  1462. {
  1463.     if (HasExtJs()) {
  1464.         return _PopupMenu_Invoke(PopupMenu_Invoke.arguments);
  1465.     }
  1466.     if (s_bNS3Before || s_bIE3Before )    {
  1467.         var argLen     = PopupMenu_Invoke.arguments.length;
  1468.         if (argLen < 5) {
  1469.             window.document.location.href = PopupMenu_Invoke.arguments[3];
  1470.             return false;
  1471.         }
  1472.         gbWndTemp = null;
  1473.         gbWndPopupLinks = null;
  1474.         gbstrParatotal = "";
  1475.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  1476.             var strParaLine = "";
  1477.             if (s_bNS2 || s_bOpera){
  1478.                 strParaLine += "<a href=\"";
  1479.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 3];
  1480.                 strParaLine += "\">"
  1481.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 2];
  1482.                 strParaLine += "</a>";
  1483.             } else {
  1484.                 strParaLine += "<a href=\"javascript:";
  1485.                 strParaLine += "gotoUrl(\'";
  1486.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 3];
  1487.                 strParaLine += "\');\"";
  1488.                 if (PopupMenu_Invoke.arguments[1] != '') {
  1489.                     strParaLine += " TARGET='" + PopupMenu_Invoke.arguments[1] + "'";
  1490.                 }
  1491.                 strParaLine += ">";
  1492.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 2];
  1493.                 strParaLine += "</a>";
  1494.             }
  1495.             strParaLine += "<br>";
  1496.             gbstrParaTotal += strParaLine;
  1497.         }
  1498.         var nHeight = argLen * 15;
  1499.         var nWidth = 400;
  1500.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  1501.         strParam += ",height=" + nHeight + ",width=200,resizable";
  1502.         
  1503.         //Create a temporary window first to ensure the real popup comes up on top
  1504.         //var wndTemp = null;
  1505.         if (!s_bNS3) {
  1506.             gbWndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4");
  1507.         } 
  1508.         gbWndPopupLinks = window.open("", "popuplinks", strParam);
  1509.  
  1510.         setTimeout("Wait_PopupMenuReady()", 100);
  1511.     }
  1512.     return true;
  1513. }
  1514.  
  1515. function Wait_PopupMenuReady() 
  1516. {
  1517.     if (gbWndPopupLinks != null && "object" == typeof(gbWndPopupLinks.document)) {
  1518.         PopupMenu_InvokeReady();
  1519.     }
  1520.     else 
  1521.         setTimeout("Wait_PopupMenuReady()", 100);
  1522. }
  1523.  
  1524.  
  1525. function PopupMenu_InvokeReady()
  1526. {
  1527.     if (gbWndPopupLinks != null) {
  1528.         gbWndPopupLinks.document.open("text/html");
  1529.         gbWndPopupLinks.document.write("<html><head>");
  1530.         if (s_bNS2 || s_bOpera) {
  1531.             gbWndPopupLinks.document.write("<base href=\"" + location +"\">");
  1532.         } else {
  1533.             //YJ: IE301,302 and NS3.x works fine
  1534.             gbWndPopupLinks.document.write("<");
  1535.             gbWndPopupLinks.document.write("script>");
  1536.             gbWndPopupLinks.document.write("function gotoUrl(aUrl) {opener.window.location=aUrl; close();}");
  1537.             gbWndPopupLinks.document.write("<");
  1538.             gbWndPopupLinks.document.write("/script>");
  1539.         }
  1540.         gbWndPopupLinks.document.write("</head><body onBlur=\'self.focus();\'>");
  1541.         gbWndPopupLinks.document.write(gbstrParaTotal);
  1542.         gbWndPopupLinks.document.write("</body></html>");
  1543.         gbWndPopupLinks.document.close();
  1544.  
  1545.         // Close the temporary
  1546.         if (!s_bNS3 && gbWndTemp != null) {
  1547.             gbWndTemp.close();
  1548.         }else {
  1549.             gbWndPopupLinks.focus();
  1550.         }
  1551.  
  1552.         return true;
  1553.     }
  1554.     return false;
  1555. }
  1556.  
  1557. /// Section End - Embedded Stub (JavaScript 1.0)
  1558.  
  1559. //// Segment End -- (JavaScript 1.0)
  1560.  
  1561.  
  1562. //// Segment Begin -- (JavaScript 1.2)
  1563. /// Section Begin  - kadov DHTM (JavaScript 1.2)
  1564.  
  1565. //Begin to support extended and dropdown text effects.
  1566. function kadovIsParagraph(el)
  1567. {
  1568.     return( el.tagName == "P" || el.tagName.indexOf("H") == 0 ) ? true : false;
  1569. }
  1570.  
  1571. function kadovInitEachChild(el)
  1572. {    
  1573.     for(var i=0; i<el.children.length; i++)
  1574.     {
  1575.         var child = el.children[i];
  1576.         if( child.tagName == "SCRIPT" || child.tagName == "!" )
  1577.             continue;
  1578.  
  1579.         if( child.id != "" )
  1580.         {
  1581.             var tmpID = child.id;
  1582.             if( tmpID > "" )
  1583.             {
  1584.                 // to wipe out the onload effects
  1585.                 var onLoadEffect = child.style.getAttribute( "x-on-pageload" );
  1586.                 if( (onLoadEffect != null) && (onLoadEffect > "") )
  1587.                     child.style.setAttribute( "x-on-pageload", "" );
  1588.                 
  1589.                 var href = child.getAttribute("href")
  1590.                 if( href != null && href > "" && href.indexOf( "BSSCPopup" ) >= 0 )
  1591.                     kadovFilePopupInit(tmpID); // Init for Popup
  1592.                 else if( child.className == "dropspot" || child.className == "expandspot" || 
  1593.                          child.className == "glossterm" )
  1594.                     kadovTextPopupInit(tmpID);// Init for Expanding/Glossary or DropDown text
  1595.                 else if( child.className == "trigger")
  1596.                     kadovInitTrigger(tmpID);// Init for Trigger
  1597.                 else
  1598.                     kadovInitEffects(tmpID);// Init for DHTML effects
  1599.             }
  1600.         }
  1601.         
  1602.         if( (child.tagName == "IMG") && (child.getAttribute("dynsrc") > "") )
  1603.             child.start = "mouseover";// to start a AVI file. fileopen doesn't work
  1604.  
  1605.         kadovInitEachChild(child);
  1606.     }
  1607. }
  1608.  
  1609. function kadovRetrieveTextInner(el)
  1610. {    
  1611.     var x = "";
  1612.     if( (!el) || (el.tagName == "!") || (el.tagName == "SCRIPT" ))
  1613.         return x;
  1614.  
  1615.     if( kadovIsParagraph(el) )
  1616.     {
  1617.         var strNewID = " ";
  1618.         if( el.id != "" )
  1619.             strNewID += "id=" + el.id + "_NewSpan ";
  1620.         x = "<span" + strNewID + "style='" + el.style.cssText + "'>" + el.innerHTML + "</span>";
  1621.     }
  1622.     else
  1623.     {
  1624.         for(var i=0; i<el.children.length; i++)
  1625.             x += kadovRetrieveTextInner( el.children[i] );
  1626.     }
  1627.     return x;
  1628. }
  1629.  
  1630. function kadovRetrieveCleanHTML( strRawHTML, strTagOpen, strTagClose, nDistance )
  1631. {    
  1632.     var nTagOpen = strRawHTML.indexOf( strTagOpen, 0 );
  1633.     if( nTagOpen < 0 )
  1634.         return strRawHTML;
  1635.  
  1636.     var nTagClose = strRawHTML.indexOf( strTagClose, nTagOpen);
  1637.     if( nTagClose < nTagOpen )
  1638.         return strRawHTML;
  1639.         
  1640.     if( typeof(nDistance) == "number" && nDistance > 0 )
  1641.         if( (nTagClose - nTagOpen) != nDistance )
  1642.             return strRawHTML;
  1643.         
  1644.     var strCleanOnce = strRawHTML.substring(0, nTagOpen) + strRawHTML.substr(nTagClose + strTagClose.length) ;
  1645.     return     kadovRetrieveCleanHTML( strCleanOnce, strTagOpen, strTagClose );
  1646. }
  1647.  
  1648. function kadovAdjustObjectTag(strRawHTML, nStartPos)
  1649. {// adjust object tag for related topics HTML control, because innerHTML misses out the item settings
  1650.     
  1651.     //Is there any DTC?
  1652.     var strDTCTagOpen = '<!--Metadata type="DesignerControl" startspan';
  1653.     var strDTCTagClose = '<!--Metadata type="DesignerControl" endspan-->';
  1654.     var nDTCTagOpen = strRawHTML.indexOf( strDTCTagOpen, nStartPos );
  1655.     if( nDTCTagOpen < 0 )
  1656.         return strRawHTML;
  1657.     var nDTCTagClose = strRawHTML.indexOf( strDTCTagClose, nDTCTagOpen );
  1658.     if( nDTCTagClose < nDTCTagOpen)
  1659.         return strRawHTML; // no Design Time Controls;
  1660.         
  1661.     //Is the DTC HTML Help Control?
  1662.     var strRTObjTagOpen = 'classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11';
  1663.     var strRTObjTagClose = '</OBJECT>';
  1664.     var nRTObjTagOpen = strRawHTML.indexOf( strRTObjTagOpen, nDTCTagOpen );
  1665.     if( nRTObjTagOpen < nDTCTagOpen )
  1666.         return strRawHTML;
  1667.     var nRTObjTagClose = strRawHTML.indexOf( strRTObjTagClose, nRTObjTagOpen );
  1668.     if( nRTObjTagClose < nRTObjTagOpen )
  1669.         return strRawHTML; // is not a HTML help control
  1670.         
  1671.     // Is it a related Topics html help control?
  1672.     var strRTObjLabel = '<PARAM NAME=\"Command\" VALUE=\"Related Topics';
  1673.     if( strRawHTML.indexOf(strRTObjLabel, nRTObjTagOpen) < 0 )
  1674.         return strRawHTML;
  1675.     
  1676.     // does the commented object tag contain a items parameters        
  1677.     var strRTItemsOpen = '<param name=Items value="';
  1678.     var strRTItemsClose = '$$**$$" >';
  1679.     var nRTItemsOpen = strRawHTML.indexOf(strRTItemsOpen, nDTCTagOpen);
  1680.     if( nRTItemsOpen < nDTCTagOpen )
  1681.         return strRawHTML;
  1682.     var nRTItemsClose = strRawHTML.indexOf(strRTItemsClose, nRTItemsOpen);
  1683.     if( nRTItemsClose < nRTItemsOpen )
  1684.         return strRawHTML;
  1685.         
  1686.     // found a items string
  1687.     var strItems = strRawHTML.substring( nRTItemsOpen + strRTItemsOpen.length, nRTItemsClose);
  1688.     if( strItems.length < 1 )
  1689.         return strRawHTML;
  1690.     
  1691.     // to reconstruct the item(s) param tag(s)
  1692.     var strItemsArray = strItems.split('$$**$$');
  1693.     if( strItemsArray.length < 1 )
  1694.         return strRawHTML;
  1695.     var strRunTimeItemParam = "";
  1696.     for( var i = 0; i < strItemsArray.length; i++ )
  1697.     {
  1698.         strRunTimeItemParam += '<PARAM  NAME="Item' + (i+1);
  1699.         strRunTimeItemParam += '"' + '  VALUE="';
  1700.         strRunTimeItemParam += strItemsArray[i];
  1701.         strRunTimeItemParam += '">';
  1702.     }
  1703.     
  1704.     // to insert the reconstructed item params into runtime object tag
  1705.     var strAdjustedHTML = strRawHTML.substring(0,nRTObjTagClose) + strRunTimeItemParam + strRawHTML.substring(nRTObjTagClose, strRawHTML.length);
  1706.     return kadovAdjustObjectTag(strAdjustedHTML, nDTCTagClose + strDTCTagClose.length);
  1707. }
  1708.  
  1709. function kadovTextPopupOnLoad( el )
  1710. {
  1711.     if( !CCSSP.bIsWinOS )
  1712.         return;
  1713.  
  1714.     if( typeof(el) == "string" )
  1715.         el = document.all.item(el);
  1716.  
  1717.     var src = el.getAttribute( "x-use-popup" );
  1718.     if(!src)
  1719.         return;
  1720.  
  1721.     var name = src;
  1722.     if( src.substr(0,1) == "#" ) 
  1723.         name = src.substr(1, src.length-1);
  1724.     var srcDiv = document.all.item(name);
  1725.     if( !srcDiv )
  1726.         return 1;
  1727.  
  1728.     var type = el.getAttribute( "x-popup-type" );
  1729.     var setup = el.getAttribute( "x-tmp-setup" );
  1730.     var newId = name;
  1731.     if( newId.indexOf( "_tmp") <= 0 )
  1732.         newId += "_tmp";
  1733.  
  1734.     if( !setup )
  1735.     {
  1736.         el.setAttribute( "x-tmp-setup", 1 );
  1737.     
  1738.         if( type == "pulldown"  )
  1739.         {
  1740.             var strAdjust = kadovAdjustObjectTag(srcDiv.innerHTML,0);
  1741.             var strCleanHTML = kadovRetrieveCleanHTML(strAdjust, "<!--", "-->");
  1742.             strCleanHTML = kadovRetrieveCleanHTML(strCleanHTML, "<SCRIPT", "/SCRIPT>");
  1743.  
  1744.             //work around the bug in HH.exe that highlight the phrases when use Search tab
  1745.             //this approach is just removing the <FONT...> tag inserted by Microsoft in the runtime
  1746.             strCleanHTML = kadovRetrieveCleanHTML(strCleanHTML, "<FONT color=#", "\">", 52);
  1747.             
  1748.             var strStyle = " style='display:none; position:relative;";
  1749.             var newDiv = "<div class=droptext id=" + newId + strStyle + "'>" + strCleanHTML + "</div>";
  1750.  
  1751.             srcDiv.outerHTML = ""; // empty the original DIV tag
  1752.             var elParentPra = kadovFindParentParagraph(el);
  1753.             if( elParentPra )
  1754.                 elParentPra.insertAdjacentHTML( "AfterEnd", newDiv );
  1755.         }
  1756.         else if( type == "expanding"  )
  1757.         {
  1758.             var inner = kadovRetrieveTextInner(srcDiv);
  1759.             if( inner == "" )
  1760.                 inner = srcDiv.innerHTML;
  1761.             var strAdjust = kadovAdjustObjectTag(inner,0);
  1762.             var strCleanHTML = kadovRetrieveCleanHTML(strAdjust, "<!--", "-->");
  1763.             strCleanHTML = kadovRetrieveCleanHTML(strCleanHTML, "<SCRIPT", "/SCRIPT>");
  1764.             var strClassName = (el.className == "glossterm") ? "glosstext" : "expandtext";
  1765.             var newSpan = "<span class=" + strClassName + " style='display: none;' id=" + newId + "> " + strCleanHTML + "</span>";
  1766.             srcDiv.outerHTML = ""; // empty the original DIV tag
  1767.             el.insertAdjacentHTML( "AfterEnd", newSpan );
  1768.         }
  1769.     }
  1770. }
  1771.  
  1772. function kadovTextPopup( el )
  1773. {
  1774.     if( (!CCSSP.bIsWinOS) || (window.event == null) )
  1775.         return;
  1776.     window.event.cancelBubble = true;
  1777.  
  1778.     if( typeof(el) == "string" )
  1779.         el = document.all.item(el);
  1780.  
  1781.     var src = el.getAttribute( "x-use-popup" );
  1782.     if(!src)
  1783.         return 1;
  1784.  
  1785.     var name = src;
  1786.     if( src.substr(0,1) == "#" ) 
  1787.         name = src.substr(1, src.length-1) + "_tmp";
  1788.     var srcDiv = document.all.item(name);
  1789.     if( !srcDiv )
  1790.         return 1;
  1791.  
  1792.     var type = el.getAttribute( "x-popup-type" );
  1793.     var setup = el.getAttribute( "x-tmp-setup" );
  1794.     if( srcDiv )
  1795.     {
  1796.         if( srcDiv.style.display == "" )
  1797.             srcDiv.style.display = "none";
  1798.         else
  1799.         {
  1800.             srcDiv.style.display = "";
  1801.             kadovInitEffects(name);
  1802.             kadovInitEachChild(srcDiv);
  1803.         }
  1804.     }
  1805. }
  1806.  
  1807. function kadovFindParentParagraph( el )
  1808. {
  1809.     if( typeof(el) == "string" )
  1810.         el = document.all.item(el);
  1811.     if( (!el) || el.tagName == "BODY" )
  1812.         return null;
  1813.     if( kadovIsParagraph(el.parentElement) )
  1814.         return el.parentElement;
  1815.     else
  1816.         return kadovFindParentParagraph( el.parentElement );
  1817. }
  1818.  
  1819. //Begin HTML code invoked function
  1820. function kadovRegisterEventHandler( obj, strEvent, strEventHandler )
  1821. {
  1822.     if( !gbBsIE4 )
  1823.         return;
  1824.     CCSSP.RegisterEventHandler( obj, strEvent, strEventHandler );
  1825. }
  1826.  
  1827. function kadovTextPopupInit( el )
  1828. {
  1829.     if( (!gbBsIE4) || (!CCSSP.bIsWinOS) )
  1830.         return;
  1831.         
  1832.     if( typeof(el) == "string" )
  1833.         el = document.all.item(el);
  1834.     if( el != null )
  1835.     {
  1836.         CCSSP.RegisterEventHandler( el, "onclick", "kadovTextPopup(" + el.id +");" );
  1837.         CCSSP.RegisterEventHandler( window, "onload", "kadovTextPopupOnLoad(" + el.id +");" );
  1838.     }
  1839. }
  1840. //End HTML code invoked function
  1841.  
  1842. //End to support extended and dropdown text effects.
  1843.  
  1844. //Begin to convert iWrite format to RoboEditor Format for DHTML effects
  1845. function kadovInitTriggersInHead( )
  1846. {
  1847.   if( Object.xDelayedInitElements )
  1848.   {
  1849.      var x = Object.xDelayedInitElements;
  1850.      for(i=0; i<x.length; i++)
  1851.          kadovInitTrigger( x[i] );
  1852.   }
  1853. }
  1854.  
  1855. //Begin HTML code invoked function
  1856. function kadovFilePopupInit( el )
  1857. {
  1858.     if( !gbBsIE4 )
  1859.         return;
  1860.     if( typeof(el) == "string" )
  1861.         el = document.all.item(el);
  1862.  
  1863.     _BSSCCreatePopupDivOnWriteForKodav();
  1864.  
  1865.     if( el != null )
  1866.         CCSSP.RegisterEventHandler( el, "onmouseover", "BSPSPopupOnMouseOver(event);" );
  1867. }
  1868.  
  1869. function kadovInitTrigger( element )
  1870. {
  1871.     if( !gbBsIE4 )
  1872.         return;
  1873.     var srcElement = element;
  1874.     if( typeof(srcElement) == "string" )
  1875.     {
  1876.         srcElement = document.all.item(element,0);
  1877.         if(srcElement == null)
  1878.             return;
  1879.     }
  1880.     
  1881.     if( !kadovIsParentVisible(srcElement) )
  1882.         return;
  1883.  
  1884.     var targets = srcElement.getAttribute( "x-targets" );
  1885.     var arrOneTarget = targets.split( "," );
  1886.     for( var i = 0; i < arrOneTarget.length; i ++ )
  1887.         bsscFXInit( element, arrOneTarget[i], null, null, null, null );
  1888. }
  1889.  
  1890. function kadovIsParentVisible( el )
  1891. {
  1892.     if( typeof(el) == "string" )
  1893.         el = document.all.item(el);
  1894.     if( (!el) || el.tagName == "BODY" )
  1895.         return true;
  1896.     if( el.style.display == 'none' ) //el.visibility == 'hidden' || 
  1897.         return false;
  1898.     else
  1899.         return kadovIsParentVisible( el.parentElement );
  1900. }
  1901.  
  1902. function kadovInitEffects( element )
  1903. {
  1904.     if( !gbBsIE4 )
  1905.         return;
  1906.     var srcElement = element;
  1907.     if( typeof(srcElement) == "string" )
  1908.     {
  1909.         srcElement = document.all.item(element,0);
  1910.         if(srcElement == null)
  1911.             return;
  1912.     }
  1913.     
  1914.     if( !kadovIsParentVisible(srcElement) )
  1915.         return;
  1916.     
  1917.     kadovInitEffect( srcElement, "x-on-hover" );
  1918.     kadovInitEffect( srcElement, "x-on-pageclick" );
  1919.     kadovInitEffect( srcElement, "x-on-pageload" );
  1920.     kadovInitEffect( srcElement, "x-on-trigger-1" );
  1921.     kadovInitEffect( srcElement, "x-on-trigger-2" );
  1922. }
  1923. //End HTML code invoked function
  1924.  
  1925. function kadovInitEffect( element, prop )
  1926. {
  1927.     var values = null;
  1928.     if( element.getAttribute( "currentStyle" ) )
  1929.         values = element.currentStyle.getAttribute( prop );
  1930.     else 
  1931.         values = element.style.getAttribute( prop );
  1932.     if( !values )
  1933.         return;
  1934.  
  1935.     var functions = new Array();
  1936.     var nIdx = 0, nStart = 0;
  1937.     var nNext = values.indexOf( "\)", 0);
  1938.     while( nNext >= 0 && nNext < values.length )
  1939.     {
  1940.         functions[nIdx] = values.substr( nStart, nNext-nStart+1);
  1941.         nStart = nNext + 1;
  1942.         nIdx++;
  1943.         nNext = values.indexOf( "\)", nStart);
  1944.     }
  1945.         
  1946.     for( var i=0; i<functions.length; i++)
  1947.     {
  1948.         var id = element.getAttribute( "id" );
  1949.         var translatedProp = kadovTranslateProp(prop);
  1950.  
  1951.         var lp = functions[i].indexOf( "(" );
  1952.         var fnname = functions[i].substring(0, lp);
  1953.         var srcargs = functions[i].substring(lp+1, functions[i].length-1);
  1954.         
  1955.         var nClickTimes = 1;
  1956.         var arrForClickCount = srcargs.split( "," );
  1957.         for( var j = 0; j < arrForClickCount.length; j++ )
  1958.         {// to locate and get the "clicks=99" settings
  1959.             var nPageClick = arrForClickCount[j].indexOf("clicks");
  1960.             if( nPageClick >= 0 )
  1961.             {
  1962.                 nPageClick = arrForClickCount[j].indexOf("=");
  1963.                 if( nPageClick > 0 )
  1964.                 {
  1965.                     nClickTimes = arrForClickCount[j].substring( nPageClick + 1, arrForClickCount[j].length) * 1;
  1966.                     break;
  1967.                 }
  1968.             }
  1969.         }
  1970.         var args = srcargs;
  1971.         if( j < arrForClickCount.length )
  1972.         {// to strip out the "clicks=99" from the arguments string
  1973.             args = "";
  1974.             for( var k = 0; k < arrForClickCount.length; k ++ )
  1975.             {
  1976.                 if( k != j )
  1977.                 {
  1978.                     args += arrForClickCount[k];
  1979.                     if( k < arrForClickCount.length - 1 )
  1980.                         args += ",";
  1981.                 }
  1982.             }
  1983.         }
  1984.         bsscFXInit( null, id, translatedProp, fnname, args, nClickTimes );
  1985.     }
  1986. }
  1987.  
  1988. function kadovTranslateProp( prop )
  1989. {
  1990.     switch( prop )
  1991.     {
  1992.     case "x-on-hover" :     return "bsschover";
  1993.     case "x-on-pageclick" : return "bsscpageclick";
  1994.     case "x-on-pageload" :  return "bsscpageload";
  1995.     case "x-on-trigger-1" : return "bssctrigger1";
  1996.     case "x-on-trigger-2" : return "bssctrigger2";
  1997.     }
  1998.     return null;
  1999. }
  2000. //End to convert iWrite format to RoboEditor Format for DHTML effects
  2001.  
  2002. //Begin the definition of one entry to DHTML effects
  2003. function bsscFXInit( trigger_ID, target_ID, event_type, 
  2004.     action_type, action_setting, event_addional )
  2005. {
  2006.     if( !CCSSP.bIsWinOS || typeof(target_ID) != "string" )//MUST have a target_ID
  2007.         return; // we don't support Navigator yet
  2008.     
  2009.     if( typeof(event_type) == "string" )
  2010.         event_type = event_type.toLowerCase();
  2011.     if( typeof(action_type) == "string" )
  2012.         action_type = action_type.toLowerCase();
  2013.     if( typeof(action_setting) == "string" )
  2014.          action_setting = action_setting.toLowerCase();
  2015.     
  2016.     // to get the target element then add it to the target list
  2017.     var eleTarget = CCSSP.GetObject( target_ID );
  2018.     if( (eleTarget != null) && (event_type != null) && (action_type != null) )
  2019.     {
  2020.         CEngine.AddOneTarget( target_ID, eleTarget );
  2021.         CEngine.BuildTargetObject(target_ID, event_type, action_type, action_setting, event_addional);
  2022.     }
  2023.     
  2024.     // to validate the trigger_ID parameter
  2025.     if( typeof(trigger_ID) == "string" && trigger_ID != "" )
  2026.         CEngine.BuildTriggerObject( trigger_ID, target_ID );
  2027. }    
  2028. //End the definition of one entry to DHTML effects
  2029.  
  2030.  
  2031. /// Section End  - kadov DHTM (JavaScript 1.2)
  2032.  
  2033.  
  2034. /// Section Begin  - CCSSP DHTM (JavaScript 1.2)
  2035.  
  2036. //Begin JavaScript libary for cross-platform positioning object.
  2037. function CCSSP(){} // constructor of CCSSP class
  2038.  
  2039. CCSSP.strAgent = navigator.userAgent.toLowerCase(); 
  2040. CCSSP.nAppVersion = parseInt(navigator.appVersion);
  2041.  
  2042. CCSSP.bIsWinOS = ((CCSSP.strAgent.indexOf("win") >= 0) || (CCSSP.strAgent.indexOf("16bit") >= 0));
  2043. CCSSP.bIsMacOS = (CCSSP.strAgent.indexOf("mac") >= 0);
  2044.  
  2045. CCSSP.bIsIE = (navigator.appName.indexOf("Microsoft") >= 0);
  2046. CCSSP.bIsIE4 = (CCSSP.bIsIE && (CCSSP.nAppVersion >= 4));
  2047. CCSSP.bIsIE5 = (CCSSP.bIsIE4 && (CCSSP.strAgent.indexOf("msie 5") != -1) )
  2048.  
  2049. CCSSP.bIsNav = (navigator.appName.indexOf("Netscape") >= 0);
  2050. CCSSP.bIsNav4 = (CCSSP.bIsNav && (CCSSP.nAppVersion >= 4));
  2051.  
  2052. CCSSP.GetObject = function( obj )
  2053. {//convert object name string or reference into a valid object reference
  2054.     if( typeof(obj) == "object" )
  2055.         return obj;
  2056.     else if( typeof(obj) == "string" && obj != "")
  2057.     {
  2058.         if( CCSSP.bIsNav4 )
  2059.             return eval("document." + obj);
  2060.         else
  2061.             return eval("document.all." + obj);
  2062.     }
  2063.     else
  2064.         return null;
  2065. }
  2066.  
  2067. CCSSP.MoveObjectTo = function(obj, x, y)
  2068. {//positioning an object at a specific pixel coordinate
  2069.     if( CCSSP.bIsNav4 )
  2070.         obj.moveTo(x,y);
  2071.     else
  2072.     {
  2073.         obj.style.pixelLeft = x;
  2074.         obj.style.pixelTop = y;
  2075.     }
  2076. }
  2077.  
  2078. CCSSP.MoveObjectBy = function(obj, dx, dy)
  2079. {//moveing a object by x and/or y pixel
  2080.     if( CCSSP.bIsNav4 )
  2081.         obj.moveBy(dx,dy);
  2082.     else
  2083.     {
  2084.         obj.style.pixelLeft += dx;
  2085.         obj.style.pixelTop += dy;
  2086.     }
  2087. }
  2088.  
  2089. CCSSP.SetObjectBGColor = function(obj, color)
  2090. {//set the background color of an object
  2091.     if( CCSSP.bIsNav4 )
  2092.         obj.bgColor = color;
  2093.     else
  2094.         obj.style.backgroundColor = color;
  2095. }
  2096.  
  2097. CCSSP.ShowObject = function(obj, bShow)
  2098. {// set the object to be visible or invisible
  2099.     if( CCSSP.bIsNav4 )
  2100.         obj.visibility = (bShow == true) ? 'show' : 'hide';
  2101.     else
  2102.         obj.style.visibility = (bShow == true) ? 'visible' : 'hidden';// when hidden, it still occupy some space.
  2103. }
  2104.  
  2105. CCSSP.GetObjectLeft = function(obj)
  2106. {// retrieve the x coordinate of a posionable object
  2107.     if( CCSSP.bIsNav4 )
  2108.         return obj.left;
  2109.     else
  2110.         return obj.style.pixelLeft;
  2111. }
  2112.  
  2113. CCSSP.GetObjectTop = function(obj)
  2114. {// retrieve the y coordinate of a posionable object
  2115.     if( CCSSP.bIsNav4 )
  2116.         return obj.top;
  2117.     else
  2118.         return obj.style.pixelTop;
  2119. }
  2120.  
  2121. CCSSP.GetObjectContainLeft = function(obj)
  2122. {// retrieve the x coordinate of a posionable object relative to it's parent element
  2123.     if( CCSSP.bIsNav4 )
  2124.         return obj.pageX;
  2125.     else
  2126.     {
  2127.         if( obj == document.body )
  2128.             return obj.clientLeft;
  2129.         else
  2130.             return obj.offsetLeft;
  2131.     }
  2132. }
  2133.  
  2134. CCSSP.GetObjectWindowLeft = function(obj)
  2135. {// retrieve the x coordinate of a posionable object relative to browser window
  2136.     if( CCSSP.bIsNav4 )
  2137.         return obj.pageX;
  2138.     else
  2139.     {
  2140.         var nOffsetWindowLeft = 0;
  2141.         for(var element = obj; element; element = element.offsetParent)
  2142.             nOffsetWindowLeft += CCSSP.GetObjectContainLeft(element);
  2143.         return nOffsetWindowLeft;
  2144.     }
  2145. }
  2146.  
  2147. CCSSP.GetObjectContainTop = function(obj)
  2148. {// retrieve the y coordinate of a posionable object relative to it's parent element
  2149.     if( CCSSP.bIsNav4 )
  2150.         return obj.pageY;
  2151.     else
  2152.     {
  2153.         if( obj == document.body )
  2154.             return obj.clientTop;
  2155.         else
  2156.             return obj.offsetTop;
  2157.     }
  2158. }
  2159.  
  2160. CCSSP.GetObjectWindowTop = function(obj)
  2161. {// retrieve the y coordinate of a posionable object relative to browser window
  2162.     if( CCSSP.bIsNav4 )
  2163.         return obj.pageY;
  2164.     else
  2165.     {
  2166.         var nOffsetWindowTop = 0;
  2167.         for(var element = obj; element; element = element.offsetParent)
  2168.             nOffsetWindowTop += CCSSP.GetObjectContainTop(element);
  2169.         return nOffsetWindowTop;
  2170.     }
  2171. }
  2172.  
  2173. CCSSP.GetObjectHeight = function(obj)
  2174. {// retrieve the height of a posionable object
  2175.     if( CCSSP.bIsNav4 )
  2176.         return obj.clip.height;
  2177.     else
  2178.         return obj.offsetHeight;
  2179. }
  2180.  
  2181. CCSSP.GetObjectWidth = function(obj)
  2182. {// retrieve the width of a posionable object
  2183.     if( CCSSP.bIsNav4 )
  2184.         return obj.clip.width;
  2185.     else
  2186.         return obj.offsetWidth;
  2187. }
  2188.  
  2189. CCSSP.RegisterEventHandler = function( srcObj, rawEventName, funcHandler )
  2190. { // to add the "funcHandler" as the "rawEventName" 's handler to the "srcObj" object,the original event handler will be combined
  2191.     var oldHandler = "";
  2192.     var oldInlineHandler = srcObj[rawEventName.toLowerCase()];
  2193.     if( oldInlineHandler != null )
  2194.     {
  2195.         var functionDefinition = oldInlineHandler.toString();
  2196.         var bodyStart = functionDefinition.indexOf( "{" );
  2197.         var bodyEnd = functionDefinition.lastIndexOf( "}" );
  2198.         if( bodyStart > 0 || bodyEnd > bodyStart )
  2199.             oldHandler = functionDefinition.substr( bodyStart + 1, bodyEnd - bodyStart - 2 );
  2200.     }
  2201.     else if( CCSSP.bIsIE4 )
  2202.     { //search for <SCRIPT> tag which define the event handler
  2203.         for( var i = 0; i < document.scripts.length; i++ ) 
  2204.         {
  2205.             var script = document.scripts[i];
  2206.             if( (script.htmlFor == srcObj.id || script.htmlFor == srcObj ) && script.event == rawEventName )
  2207.             {
  2208.                 oldHandler = script.innerHTML;
  2209.                 break;
  2210.             }
  2211.         }
  2212.     }
  2213.     
  2214.     if( oldHandler.indexOf(funcHandler) >= 0 )
  2215.         return;// to prevent register the funtion twice.
  2216.  
  2217.     if( CCSSP.bIsNav4 ) // only "onload, onresize, onfocus" apply to window
  2218.     {// other raw events will apply to layer
  2219.         var noOn = rawEventName.substring(2, rawEventName.length);
  2220.         if( typeof(noOn) == "string" && noOn.length > 3 )
  2221.             srcObj.captureEvents( Event[noOn.toUpperCase()] );
  2222.     }
  2223.  
  2224.     var newHandler = oldHandler;
  2225.     if( newHandler.length == 0 )
  2226.         newHandler = funcHandler;
  2227.     else
  2228.         newHandler += "; " + funcHandler;
  2229.     srcObj[rawEventName.toLowerCase()] = new Function( newHandler );
  2230. }
  2231.  
  2232. CCSSP.GetWindowHeight = function()
  2233. {// retrieve the height of available content in browser window
  2234.     if( CCSSP.bIsNav4 )
  2235.         return window.innerHeight;
  2236.     else
  2237.         return document.body.clientHeight;
  2238. }
  2239.  
  2240. CCSSP.GetWindowBottom = function()
  2241. {// retrieve the bottom postion of browser window
  2242.     if( CCSSP.bIsNav4 )
  2243.         return window.outerHeight + window.pageYOffset;
  2244.     else
  2245.         return document.body.clientHeight + document.body.scrollTop;
  2246. }
  2247.  
  2248. CCSSP.GetWindowWidth = function()
  2249. {// retrieve the width of available content in browser window
  2250.     if( CCSSP.bIsNav4 )
  2251.         return window.innerWidth;
  2252.     else
  2253.         return document.body.clientWidth;
  2254. }
  2255.  
  2256. CCSSP.GetWindowRight = function()
  2257. {// retrieve the right postion of browser window
  2258.     if( CCSSP.bIsNav4 )
  2259.         return window.outerWidth + window.pageXOffset;
  2260.     else
  2261.         return document.body.clientWidth + document.body.scrollLeft;
  2262. }
  2263.  
  2264. CCSSP.TrimString = function( objString, subtrim )
  2265. {// to trim the "subtrim" in the beginning and ending of a string object
  2266.     if( typeof(subtrim) != "string" || subtrim == null )
  2267.         return objString;
  2268.     var strHead = objString.substring(0, 1);
  2269.     var strRear = objString.substring(objString.length-1, objString.length);
  2270.     if( strHead != subtrim && strRear != subtrim )
  2271.         return objString;
  2272.     
  2273.     var spacePos = objString.indexOf(subtrim);
  2274.     if( spacePos < 0 )
  2275.         return objString;
  2276.     else if( spacePos == objString.length - 1 )
  2277.         return objString.substring(0, spacePos);
  2278.     else
  2279.     {
  2280.         var newString = objString.substring( spacePos + 1, objString.length);
  2281.         return CCSSP.TrimString( newString, subtrim );
  2282.     }
  2283. }
  2284.  
  2285. CCSSP.TrimSpace = function( objString )
  2286. {
  2287.     var Trim1 = CCSSP.TrimString( objString, " ");
  2288.     return CCSSP.TrimString( Trim1, "\'");
  2289. }
  2290.  
  2291. CCSSP.GetEventElement = function( navEventObject )
  2292. {// to get the element who fired the current event
  2293.     if( CCSSP.bIsNav4 )
  2294.         return navEventObject.target;
  2295.     else
  2296.         return event.srcElement;
  2297. }
  2298.  
  2299. CCSSP.PrepareFilter = function( Obj )
  2300. {//to prepare for making the filter work
  2301.     Obj.style.filter = "";
  2302.     if( Obj.style.width != "" || Obj.style.height != "" || Obj.style.position == "absolute" )
  2303.         return;
  2304.     Obj.style.height = CCSSP.GetObjectHeight(Obj);
  2305. }
  2306.  
  2307. CCSSP.IsDescendant = function( progenitor, progeny )
  2308. {
  2309.     if( typeof(progeny) == "undefined" || progeny == null )
  2310.         return false;
  2311.     else if( progeny == progenitor )
  2312.         return true; 
  2313.     else if( progeny.id == progenitor.id ) 
  2314.         return true; 
  2315.     else if( progeny.parentElement == progenitor.parentElement )
  2316.         return false;
  2317.     else
  2318.         return CCSSP.IsDescendant( progenitor, progeny.parentElement );
  2319. }
  2320.  
  2321. CCSSP.IsTextTag = function( Obj )
  2322. {
  2323.     if( typeof( Obj.tagName ) == "undefined" )
  2324.         return false;
  2325.     return( Obj.tagName.indexOf("H") == 0 || Obj.tagName == "P" || 
  2326.             Obj.tagName == "FONT" || Obj.tagName == "SPAN" );
  2327. }
  2328.  
  2329. //End JavaScript libary for cross-platform positioning object.
  2330.  
  2331. /// Section End  - CCSSP DHTM (JavaScript 1.2)
  2332.  
  2333. /// Section Begin  - CCSSP DHTM 1 (JavaScript 1.2)
  2334.  
  2335. //Begin the definition of class CTrigger
  2336. function CTrigger( TriggerElement )
  2337. {
  2338.     // object : the trigger element. Never be null. 
  2339.     this.eleTrigger = TriggerElement;
  2340.     
  2341.     // number : the click counter number: only 3 values: 0,1,2;
  2342.     this.nCounter = 0; 
  2343.     
  2344.     //object as associative array of string:
  2345.     // the associate target ID strings; one element at least.            
  2346.     this.objStrTarget = new Object();
  2347.     this.eleTrigger.style.cursor = "hand";
  2348.     if( this.eleTrigger.tagName == "AREA" && this.eleTrigger.getAttribute("href") == "" )
  2349.         this.eleTrigger.setAttribute("href", "#") // to make a hand cursor for image map
  2350. }
  2351.  
  2352. CTrigger.prototype.AddTargetID = function( strTargetID )
  2353. {// add one target ID string to the objStrTarget
  2354.     if( typeof(strTargetID) != "string" )
  2355.         return ;
  2356.     if( typeof(this.objStrTarget[strTargetID]) != "string" )
  2357.         this.objStrTarget[strTargetID] = strTargetID;
  2358. }
  2359.  
  2360. CTrigger.prototype.OnTriggerClick = function()
  2361. {// to activate all asociated target
  2362.     var strEventType = ( (this.nCounter++)% 2 == 0 ) ? 
  2363.         "bssctrigger1" : "bssctrigger2";
  2364.         
  2365.     // to enumerate associative target element's ID string
  2366.     for( var strTargetID in this.objStrTarget ) 
  2367.         CEngine.SendEventToOneTarget( strTargetID, strEventType );
  2368. }
  2369. //End the definition of class CTrigger
  2370.  
  2371. //Begin the definition of class CTarget
  2372. function CTarget( TargetElement )
  2373. {
  2374.     // object : the target element. Never be null.
  2375.     this.eleTarget = TargetElement;
  2376.     this.objManager = new Object(); // object: the event manager
  2377.  
  2378. CTarget.nPageClickCounter = 0;// static class property.
  2379.  
  2380. CTarget.prototype.GetAgencyObject = function(str_action_type,action_setting )
  2381. {// return the action agency ( effect )object's refernece 
  2382.     switch( str_action_type )
  2383.     {
  2384.     case "show":return new CAgencyShow( this.eleTarget, true ) ;
  2385.     case "hide":return new CAgencyShow( this.eleTarget, false ) ;
  2386.  
  2387.     case "flyin" : 
  2388.         return new CAgencyFly(this.eleTarget, action_setting, true);
  2389.     case "flyout" : 
  2390.         return new CAgencyFly(this.eleTarget, action_setting, false);
  2391.     case "spiralin" : 
  2392.         return new CAgencySpiral(this.eleTarget, action_setting, true);
  2393.     case "spiralout" : 
  2394.         return new CAgencySpiral(this.eleTarget, action_setting, false);
  2395.     case "zoomin" :
  2396.         return new CAgencyZoom(this.eleTarget, action_setting, true);
  2397.     case "zoomout" : 
  2398.         return new CAgencyZoom(this.eleTarget, action_setting, false);
  2399.     case "elastic" : 
  2400.         return new CAgencyElastic(this.eleTarget, action_setting);
  2401.         
  2402.     case "fadein" : 
  2403.         return (CCSSP.bIsIE4)? new CAgencyAlpha(this.eleTarget, action_setting, true) : null;
  2404.     case "fadeout" :
  2405.         return (CCSSP.bIsIE4)? new CAgencyAlpha(this.eleTarget, action_setting, false) : null;
  2406.     case "rockrollstatic" :
  2407.     case "rockroll" :
  2408.         return (CCSSP.bIsIE4)? new CAgencyWave(this.eleTarget, action_setting, false) : null;
  2409.  
  2410.     case "glow":
  2411.         return (CCSSP.bIsIE4)? new CAgencyGlow(this.eleTarget,action_setting) : null;
  2412.     case "dropshadow":
  2413.         return (CCSSP.bIsIE4)? new CAgencyDropShadow(this.eleTarget,action_setting) : null;
  2414.     case "transition" :
  2415.         return (CCSSP.bIsIE4)? new CAgencyRevealTrans(this.eleTarget,action_setting) : null;
  2416.     case "blur" :
  2417.         return (CCSSP.bIsIE4)? new CAgencyBlur(this.eleTarget,action_setting) : null;
  2418.  
  2419.     case "fliph" : // all these 4 do NOT need any parameters
  2420.     case "flipv" :
  2421.     case "invert":
  2422.     case "gray" :
  2423.         return (CCSSP.bIsIE4)? new CAgencyChangeFilter(this.eleTarget, str_action_type) : null;
  2424.     
  2425.     case "fontchange": // the effects below change the style on the fly, so won't work in Navigator
  2426.         return (CCSSP.bIsIE4)? new CAgencyFontChange(this.eleTarget,action_setting) : null;
  2427.     case "boderchange": 
  2428.     case "stylechange":
  2429.         return (CCSSP.bIsIE4)? new CAgencyChangeStyle(this.eleTarget,action_setting) : null;
  2430.  
  2431.     default: return null;
  2432.     }
  2433. }
  2434.  
  2435. CTarget.prototype.SetEventManager = function( 
  2436.     one_event_type,str_action_type,action_setting,event_additional)
  2437. {// to set the event manager with specified action 
  2438.     if( typeof( one_event_type ) != "string" ||    
  2439.         typeof( str_action_type ) != "string"||
  2440.         typeof( action_setting ) != "string" )
  2441.         return false;
  2442.     if( typeof(this.objManager[one_event_type]) == "undefined" )
  2443.     {
  2444.         this.objManager[one_event_type] = new Object();
  2445.         this.objManager[one_event_type].length = 0;
  2446.     }
  2447.     
  2448.     var eventAgency = this.GetAgencyObject(str_action_type,action_setting);
  2449.     if( eventAgency != null )
  2450.     {
  2451.         var ct = this.objManager[one_event_type].length ++;
  2452.         this.objManager[one_event_type][ct] = eventAgency;
  2453.         
  2454.         if( one_event_type == "bsscpageclick" )
  2455.         {// to deal with the "number of pageclick" stuff
  2456.             if( typeof(event_additional) == "number" )
  2457.                 this.objManager[one_event_type][ct].nPageClick = event_additional;
  2458.             else // set the default number 
  2459.                 this.objManager[one_event_type][ct].nPageClick = 1;
  2460.             
  2461.             if( (typeof(this.objManager.nMinPageClickIndex) == "undefined") ||
  2462.                 (this.objManager[one_event_type][ct].nPageClick < 
  2463.                     this.objManager[one_event_type][this.objManager.nMinPageClickIndex].nPageClick) )
  2464.                 this.objManager.nMinPageClickIndex = ct;
  2465.         }
  2466.         
  2467.         //hide the object blindly,SetState function will take care of the final correct state
  2468.         if( ((one_event_type == "bsscpageclick") && 
  2469.              (this.objManager[one_event_type][ct].nPageClick == 1)) ||
  2470.             one_event_type == "bsscpageload" ||
  2471.             one_event_type == "bssctrigger1" )
  2472.             CCSSP.ShowObject( this.eleTarget, false );
  2473.         return true;
  2474.     }
  2475.     return false;
  2476. }
  2477.  
  2478. CTarget.prototype.OnEvent = function( strBsscEvent )
  2479. {// response to the event ( bssc format )
  2480.     if( typeof(this.objManager[strBsscEvent]) == "object" )
  2481.     { // to get the event agency from the event manager
  2482.         var eventAgency = this.objManager[strBsscEvent];
  2483.         for( var i = 0; i < eventAgency.length; i++ )
  2484.         {
  2485.             if( strBsscEvent == "bsscpageclick" && 
  2486.                  eventAgency[i].nPageClick != CTarget.nPageClickCounter )
  2487.                  continue;
  2488.             else if( strBsscEvent == "bsschover" && event.type == "mouseout" )
  2489.                 eventAgency[i].EndEffect();
  2490.             else // to invoke the unified function in effect object    
  2491.                 eventAgency[i].UpdateEffect(); 
  2492.         }
  2493.     }
  2494. }
  2495.  
  2496. CTarget.prototype.SetState = function( strBsscEvent )
  2497. {
  2498.     if( typeof(this.objManager[strBsscEvent]) != "object" )
  2499.         return false;
  2500.  
  2501.     // to get the event agency from the event manager
  2502.     var eventAgency = this.objManager[strBsscEvent];
  2503.     
  2504.     if( strBsscEvent == "bsscpageclick" )
  2505.     {// we only set the initial state for the minium number of pageclick 
  2506.         eventAgency[this.objManager.nMinPageClickIndex].PrepareEffect();
  2507.         return true;
  2508.     }
  2509.     else
  2510.     {
  2511.         for( var i = 0; i < eventAgency.length; i++ )
  2512.             eventAgency[i].PrepareEffect(); // to invoke the unified function in effect object     
  2513.         if( i > 0 )
  2514.             return true;
  2515.         else
  2516.             return false;
  2517.     }
  2518. }
  2519. //End the definition of class CTarget
  2520.  
  2521. //Begin the definition of CEngine class
  2522. function CEngine(){}// all properities are going be "class" properities
  2523.  
  2524. // object : as associative array of trigger objects
  2525. CEngine.objTrigger = new Object();
  2526. // object : as associative array of target objects 
  2527. CEngine.objTarget = new Object(); 
  2528.  
  2529. // Array : each element is a CAgencyXXX animation object
  2530. CEngine.arrAnimation = new Array();
  2531. CEngine.PerformAnimation = function( nIndex )
  2532. {// animation : update effects function
  2533.     CEngine.arrAnimation[nIndex].UpdateEffect();
  2534. }
  2535.  
  2536. CEngine.AddOneTrigger = function(TriggerID,TriggerElement)
  2537. {// add one Trigger object into the trigger array
  2538.     if( typeof(TriggerID) != "string" || TriggerElement == null ||
  2539.         typeof(TriggerElement) != "object" )
  2540.         return;
  2541.     if( typeof(CEngine.objTrigger[TriggerID] ) != "object" )
  2542.         CEngine.objTrigger[TriggerID] = new CTrigger(TriggerElement);
  2543. }
  2544.     
  2545. CEngine.AddOneTarget = function(TargetID, TargetElement)
  2546. {// add one Target object into the target array
  2547.     if( typeof(TargetID) != "string" || TargetElement == null ||
  2548.         typeof(TargetElement) != "object" )
  2549.         return;
  2550.     if( typeof(CEngine.objTarget[TargetID]) != "object" )
  2551.         CEngine.objTarget[TargetID] = new CTarget( TargetElement );
  2552. }
  2553.  
  2554. CEngine.SendEventToOneTarget = function(strTargetID, strBsscEvent )
  2555. {// to activate one target object
  2556.     if( typeof(CEngine.objTarget[strTargetID]) == "object" ) 
  2557.         CEngine.objTarget[strTargetID].OnEvent( strBsscEvent );
  2558. }
  2559.  
  2560. CEngine.SendEventToAllTarget = function( strBsscEvent )
  2561. { //to activate all target associative to the BSSC event
  2562.     for( var strTargetID in CEngine.objTarget ) //to enumerate all target
  2563.         CEngine.SendEventToOneTarget( strTargetID, strBsscEvent );
  2564. }
  2565.  
  2566. CEngine.SetOneTargetInitialState = function( strTargetID )
  2567. {// only invoked after ALL effects for the target have been set
  2568.     if( typeof(CEngine.objTarget[strTargetID]) == "object" ) 
  2569.     {// to get target object
  2570.         var objTarget = CEngine.objTarget[strTargetID];
  2571.         if( objTarget.SetState( "bsscpageload" ) == false )
  2572.         {
  2573.             objTarget.SetState( "bsscpageclick" );
  2574.             objTarget.SetState( "bssctrigger1" );
  2575.         }
  2576.     }
  2577. }
  2578.  
  2579. CEngine.AdjustPageClickCounter = function()
  2580. {
  2581.     var nAdjustedClickCounter = CTarget.nPageClickCounter;
  2582.     var bAdjusted = false;
  2583.     for( var strTargetID in CEngine.objTarget ) //to enumerate all target
  2584.     {// try to find the minum pageCliclConter greater than CTarget.nPageClickCounter
  2585.         var objEventPageClick = CEngine.objTarget[strTargetID].objManager.bsscpageclick;
  2586.         if( objEventPageClick != null )
  2587.         {
  2588.             for( var i = 0; i < objEventPageClick.length; i++ )
  2589.             {
  2590.                 var nOtherPageClick = objEventPageClick[i].nPageClick;
  2591.                 if( nOtherPageClick == CTarget.nPageClickCounter )
  2592.                     return;
  2593.                 if( nOtherPageClick > CTarget.nPageClickCounter )
  2594.                 {
  2595.                     if( !bAdjusted )
  2596.                     {
  2597.                         nAdjustedClickCounter = nOtherPageClick;
  2598.                         bAdjusted = true;
  2599.                     }
  2600.                     else if( nOtherPageClick < nAdjustedClickCounter )
  2601.                         nAdjustedClickCounter = nOtherPageClick;
  2602.                 }
  2603.             }
  2604.         }
  2605.     }
  2606.     CTarget.nPageClickCounter = nAdjustedClickCounter;
  2607. }
  2608.  
  2609. CEngine.OnPageLoad = function()
  2610. {     
  2611.     // first, to set all target's initial state
  2612.     for( var strTargetID in CEngine.objTarget )
  2613.         CEngine.SetOneTargetInitialState( strTargetID );
  2614.     
  2615.     // to invoke all target's onpageload handler
  2616.     CEngine.SendEventToAllTarget( "bsscpageload" );
  2617. }
  2618.  
  2619. CEngine.OnPageClick = function()
  2620. { // to invoke all target's onpageclick handler
  2621.     var src = CCSSP.GetEventElement( arguments[0] );
  2622.     if( src == null )
  2623.         return;
  2624.         
  2625.     var objClickedTrigger = null;
  2626.     for( var strTriggerID in CEngine.objTrigger )
  2627.     { // to detect which trigger is clicked
  2628.         if( CCSSP.IsDescendant( CEngine.objTrigger[strTriggerID].eleTrigger,src) )
  2629.         {
  2630.             objClickedTrigger = CEngine.objTrigger[strTriggerID];
  2631.             break;
  2632.         }
  2633.     }
  2634.     
  2635.     if( objClickedTrigger != null) // the clicked trigger found
  2636.         objClickedTrigger.OnTriggerClick();
  2637.     else // no trigger is clicked
  2638.     { // to send PageClick event to all target
  2639.         CTarget.nPageClickCounter++;
  2640.         CEngine.AdjustPageClickCounter();
  2641.         CEngine.SendEventToAllTarget( "bsscpageclick" );
  2642.     }
  2643. }    
  2644.  
  2645. CEngine.OnMouseOver = function()
  2646. { // to invoke all target's onpageload handler
  2647.     var src = CCSSP.GetEventElement( arguments[0] );
  2648.     if( src == null )
  2649.         return;
  2650.         
  2651.     var strHoveredTargetID = null;
  2652.     for( var strTargetID in CEngine.objTarget )
  2653.     { // to detect which Target is hovering on
  2654.         if( CCSSP.IsDescendant( CEngine.objTarget[strTargetID].eleTarget, src ) )
  2655.         {
  2656.             strHoveredTargetID = strTargetID;
  2657.             break;
  2658.         }
  2659.     }
  2660.     
  2661.     if( strHoveredTargetID != null ) // the hovered target found
  2662.         CEngine.SendEventToOneTarget( strHoveredTargetID, "bsschover" );
  2663. }
  2664.  
  2665. CEngine.BuildTargetObject = function(target_ID,event_type,action_type,
  2666.             action_setting, event_additional)
  2667. {// to build target object 
  2668.     // to get the target object
  2669.     if( typeof( CEngine.objTarget[target_ID] ) != "object" )
  2670.         return false;// the engine's AddOneTarget function might have failed.
  2671.     var TargetObject = CEngine.objTarget[target_ID];
  2672.     
  2673.     // to prepare the parameters for the event manager
  2674.     var arrEvent = event_type.split("|"); // to split the combined event_type string
  2675.     var arrAction = action_type.split("|");//to split the combined action_type string
  2676.     for( var trim = 0; trim < arrEvent.length; trim++ )
  2677.         arrEvent[trim] = CCSSP.TrimSpace(arrEvent[trim]);
  2678.     
  2679.     for( trim = 0; trim < arrAction.length; trim++ )
  2680.         arrAction[trim] = CCSSP.TrimSpace(arrAction[trim]);
  2681.     
  2682.     var arrSetting = new Array(); 
  2683.     if( typeof(action_setting) == "string" )
  2684.         arrSetting = action_setting.split("|");// to split the combined action_setting string
  2685.     // to calibrate the arrays
  2686.     for( var i = arrSetting.length; i < arrAction.length; i++ )
  2687.     {
  2688.         if( typeof(arrSetting[i]) != "string" )
  2689.              arrSetting[i] = "";
  2690.     }                 
  2691.  
  2692.     // to prepare for dealing with the absolute posioning element
  2693.     TargetObject.eleTarget.ABSX = CCSSP.GetObjectLeft( TargetObject.eleTarget );
  2694.     TargetObject.eleTarget.ABSY = CCSSP.GetObjectTop( TargetObject.eleTarget );
  2695.  
  2696.     if( arrEvent.length > 1 )
  2697.     {// if event is combined, it must be : "bssctrigger1 | bssctrigger2"
  2698.         if( arrAction.length != 2 )
  2699.             return false; // if event is combined, there must be 2 actions
  2700.         for( i = 0 ; i < 2; i++ )
  2701.         {
  2702.             if( TargetObject.SetEventManager(arrEvent[i], arrAction[i], 
  2703.                 arrSetting[i], event_additional) == false )
  2704.                 return false; // the event manager has not been set up
  2705.         }
  2706.     }
  2707.     else // the event_type string is not combined
  2708.     {
  2709.         for( i = 0 ; i < arrAction.length; i++ )
  2710.         {
  2711.             TargetObject.SetEventManager(event_type, arrAction[i], arrSetting[i], event_additional);
  2712.             // to validate the event manager
  2713.             if( typeof(TargetObject.objManager[event_type]) != "object" ||
  2714.                     typeof(TargetObject.objManager[event_type][i]) != "object" )
  2715.                 return false; // the event manager has not been set up
  2716.         }
  2717.     }
  2718.     return true;
  2719. }
  2720.  
  2721. CEngine.BuildTriggerObject = function(trigger_ID, target_ID)
  2722. {// to build the trigger object
  2723.     var arrTrigger = trigger_ID.split("|"); // to split the combined trigger_ID string
  2724.     for( var i = 0; i < arrTrigger.length; i ++ )
  2725.     {// to get the trigger element then add it to the trigger list
  2726.         arrTrigger[i] = CCSSP.TrimSpace( arrTrigger[i] );
  2727.         var eleTrigger = CCSSP.GetObject( arrTrigger[i] );
  2728.         if( eleTrigger == null )
  2729.             continue; // the trigger_ID string in the HTML code maybe wrong
  2730.         CEngine.AddOneTrigger( arrTrigger[i], eleTrigger );
  2731.  
  2732.         // to get the target object
  2733.         if( typeof( this.objTrigger[arrTrigger[i]] ) != "object" )
  2734.             continue;// the engine's AddOneTarget function might have failed.
  2735.         CEngine.objTrigger[arrTrigger[i]].AddTargetID( target_ID );
  2736.     }
  2737. }
  2738. //End the definition of CEngine class
  2739.  
  2740. /// Section End  - CCSSP DHTM 1 (JavaScript 1.2)
  2741.  
  2742. /// Section Begin  - CCSSP DHTM 2 (JavaScript 1.2)
  2743.  
  2744. //Begin the definition of CAgencyXXXX classes
  2745.  
  2746. //Begin of the CAgencyShow definition
  2747. function CAgencyShow( element, bIsShow )
  2748. {
  2749.     this.ele = element;
  2750.     this.bIsShow = bIsShow;
  2751. }
  2752.  
  2753. CAgencyShow.prototype.PrepareEffect = function()
  2754. {
  2755.     CCSSP.ShowObject( this.ele, !this.bIsShow );
  2756. }
  2757.  
  2758. CAgencyShow.prototype.UpdateEffect = function()
  2759. {
  2760.     CCSSP.ShowObject( this.ele, this.bIsShow );
  2761. }
  2762.  
  2763. CAgencyShow.prototype.EndEffect = function()
  2764. {
  2765.     CCSSP.ShowObject( this.ele, !this.bIsShow );
  2766. }
  2767. // End of the CAgencyShow definition
  2768.  
  2769. // Begin of CAgencyFly definition
  2770. function CAgencyFly( element, settings, bIsIn )
  2771. {
  2772.     this.ele = element;
  2773.     this.bIsIn = bIsIn;
  2774.     this.duration = 1000; // default
  2775.     this.direction = "right";
  2776.  
  2777.     var arrAllSet = settings.split(",");
  2778.     for( var i = 0; i < arrAllSet.length; i ++ )
  2779.     {// to retrieve the setting
  2780.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  2781.         var arrOneSet = arrAllSet[i].split("=");
  2782.         for( var j = 0; j < arrOneSet.length; j++ )
  2783.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  2784.         switch( arrOneSet[0] )
  2785.         {
  2786.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  2787.         case "direction" : this.direction = arrOneSet[1]; break;
  2788.         }
  2789.     }
  2790.         
  2791.     if( CCSSP.bIsIE5 && this.ele.style.position != "absolute" )
  2792.         this.ele.style.position = "relative";
  2793.     this.timer = null;
  2794.     this.aniIndex = CEngine.arrAnimation.length;
  2795.     CEngine.arrAnimation[this.aniIndex] = this;
  2796. }
  2797.  
  2798. CAgencyFly.prototype.PrepareEffect = function()
  2799. {
  2800.     CCSSP.ShowObject(this.ele, !this.bIsIn );
  2801. }
  2802.  
  2803. CAgencyFly.prototype.UpdateEffect = function()
  2804. {
  2805.     if( this.timer == null )
  2806.         this.ResetParameters();
  2807.  
  2808.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  2809.     if( percent >= 1.0 )
  2810.         this.EndEffect();
  2811.     else
  2812.     {
  2813.         var newX = this.startX*(1.0-percent) +  this.finalX*percent;
  2814.         var newY = this.startY*(1.0-percent) +  this.finalY*percent;
  2815.         CCSSP.MoveObjectTo(this.ele, newX, newY);
  2816.         if( this.timer == null )
  2817.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  2818.     }
  2819. }
  2820.  
  2821. CAgencyFly.prototype.EndEffect = function()
  2822. {
  2823.     clearInterval( this.timer );
  2824.     this.timer = null;
  2825.  
  2826.     if( this.bIsIn ) // FlyIn
  2827.         CCSSP.MoveObjectTo(this.ele, this.finalX, this.finalY);
  2828.     else // FlyOut
  2829.         CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  2830.     CCSSP.ShowObject(this.ele, this.bIsIn );
  2831. }
  2832.  
  2833. CAgencyFly.prototype.ResetParameters = function()
  2834. {
  2835.     this.PrepareEffect();
  2836.     CCSSP.ShowObject(this.ele, true );
  2837.  
  2838.     this.startX = 0;
  2839.     this.startY = 0;
  2840.     this.finalX = 0;
  2841.     this.finalY = 0; 
  2842.     
  2843.     var offsetLeft = CCSSP.GetObjectWindowLeft(this.ele) + this.ele.offsetWidth;
  2844.     var offsetTop = CCSSP.GetObjectWindowTop(this.ele) + this.ele.offsetHeight;
  2845.     var offsetRight = CCSSP.GetWindowRight();
  2846.     var offsetBottom = CCSSP.GetWindowBottom();
  2847.  
  2848.     if( this.bIsIn )
  2849.     { // FlyIn
  2850.         this.finalX = this.ele.ABSX;
  2851.         this.finalY = this.ele.ABSY;
  2852.  
  2853.         switch( this.direction )
  2854.         {
  2855.         case "right": this.startX = offsetRight; this.startY = this.finalY; break;
  2856.         case "left": this.startX = -offsetLeft;  this.startY = this.finalY; break;
  2857.         case "down": this.startY = offsetBottom; this.startX = this.finalX; break;
  2858.         case "up":  this.startY = -offsetTop;    this.startX = this.finalX; break;
  2859.         case "downright":
  2860.               this.startX = ( offsetBottom < offsetRight) ? offsetBottom : offsetRight;
  2861.             this.startY = this.startX;        break;
  2862.         case "upright":
  2863.               this.startX = (offsetTop < offsetRight)? offsetTop : offsetRight;
  2864.             this.startY = -this.startX;        break;
  2865.         case "upleft":
  2866.             this.startX = -((offsetTop < offsetRight)? offsetTop : offsetRight);
  2867.             this.startY = this.startX;        break;
  2868.         case "downleft":
  2869.             this.startX = -(( offsetBottom < offsetRight) ? offsetBottom : offsetRight);
  2870.             this.startY = -this.startX;     break;
  2871.         }
  2872.     }
  2873.     else
  2874.     { // FlyOut
  2875.         this.startX = this.ele.ABSX;
  2876.         this.startY = this.ele.ABSY;
  2877.  
  2878.         switch( this.direction )
  2879.         {
  2880.         case "right": this.finalX = offsetRight;  this.finalY = this.startY; break;
  2881.         case "left": this.finalX = -offsetLeft;   this.finalY = this.startY;  break;
  2882.         case "down": this.finalY = offsetBottom;  this.finalX = this.startX; break;
  2883.         case "up":  this.finalY = -offsetTop;     this.finalX = this.startX; break;
  2884.         case "downright":
  2885.               this.finalX = ( offsetBottom < offsetRight) ? offsetBottom : offsetRight;
  2886.             this.finalY = this.finalX;        break;
  2887.         case "upright":
  2888.               this.finalX = (offsetTop < offsetRight)? offsetTop : offsetRight;
  2889.             this.finalY = -this.finalX;        break;
  2890.         case "upleft":
  2891.             this.finalX = -((offsetTop < offsetRight)? offsetTop : offsetRight);
  2892.             this.finalY = this.finalX;        break;
  2893.         case "downleft":
  2894.             this.finalX = -(( offsetBottom < offsetRight) ? offsetBottom : offsetRight);
  2895.             this.finalY = -this.finalX;     break;
  2896.         }
  2897.     }
  2898.     CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  2899.     this.startTime = (new Date()).getTime();
  2900. }
  2901. // End of the CAgencyFly definition
  2902.  
  2903. // Begin of CAgencySpiral
  2904. function CAgencySpiral( element, settings, bIsIn )
  2905. {
  2906.     this.ele = element;
  2907.     this.bIsIn = bIsIn;
  2908.     this.duration = 1000; // default
  2909.  
  2910.     var arrAllSet = settings.split(",");
  2911.     for( var i = 0; i < arrAllSet.length; i ++ )
  2912.     {// to retrieve the setting
  2913.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  2914.         var arrOneSet = arrAllSet[i].split("=");
  2915.         for( var j = 0; j < arrOneSet.length; j++ )
  2916.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  2917.         switch( arrOneSet[0] )
  2918.         {
  2919.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  2920.         }
  2921.     }
  2922.  
  2923.     if( CCSSP.bIsIE5 && this.ele.style.position != "absolute" )
  2924.         this.ele.style.position = "relative";
  2925.     this.timer = null;
  2926.     this.aniIndex = CEngine.arrAnimation.length;
  2927.     CEngine.arrAnimation[this.aniIndex] = this;
  2928. }
  2929.  
  2930. CAgencySpiral.prototype.PrepareEffect = function()
  2931. {
  2932.     CCSSP.ShowObject(this.ele, !this.bIsIn );
  2933. }
  2934.  
  2935. CAgencySpiral.prototype.UpdateEffect = function()
  2936. {
  2937.     if( this.timer == null )
  2938.         this.ResetParameters();
  2939.  
  2940.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  2941.     if( percent >= 1.0 )
  2942.         this.EndEffect();
  2943.     else
  2944.     {
  2945.         var rf = (this.bIsIn)? (1.0 - percent) : percent; 
  2946.         var t = (1.0-rf) * 4.0 * Math.PI
  2947.         var rxP = (this.bIsIn)? this.startX : this.finalX; 
  2948.         var ryP = (this.bIsIn)? this.startY : this.finalY; 
  2949.         var rx = (Math.abs(rxP) < 200) ? Math.abs(rxP) : 200;
  2950.         var ry = (Math.abs(ryP) < 200) ? Math.abs(ryP) : 200;
  2951.  
  2952.         var newX = Math.ceil(-rf*Math.cos(t)*rx) + this.ele.ABSX;
  2953.         var newY = Math.ceil(-rf*Math.sin(t)*ry) + this.ele.ABSY;
  2954.         CCSSP.MoveObjectTo(this.ele, newX, newY);
  2955.         if( this.timer == null )
  2956.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  2957.     }
  2958. }
  2959.  
  2960. CAgencySpiral.prototype.EndEffect = function()
  2961. {
  2962.     clearInterval( this.timer );
  2963.     this.timer = null;
  2964.     
  2965.     if( this.bIsIn ) // In
  2966.         CCSSP.MoveObjectTo(this.ele, this.finalX, this.finalY);
  2967.     else // Out
  2968.         CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  2969.     CCSSP.ShowObject(this.ele, this.bIsIn );
  2970. }
  2971.  
  2972. CAgencySpiral.prototype.ResetParameters = function()
  2973. {
  2974.     this.PrepareEffect();
  2975.     CCSSP.ShowObject(this.ele, true );
  2976.     this.startX = (this.bIsIn)? CCSSP.GetWindowRight() : this.ele.ABSX;
  2977.     this.startY = (this.bIsIn)? CCSSP.GetWindowBottom() : this.ele.ABSY;
  2978.     this.finalX = (this.bIsIn)? this.ele.ABSX : CCSSP.GetWindowRight();
  2979.     this.finalY = (this.bIsIn)? this.ele.ABSY : CCSSP.GetWindowBottom(); 
  2980.     
  2981.     CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  2982.     this.startTime = (new Date()).getTime();
  2983. }
  2984. // End of CAgencySpiral
  2985.  
  2986. // Begin of CAgencyElastic
  2987. function CAgencyElastic( element, settings)
  2988. {
  2989.     this.ele = element;
  2990.     this.duration = 1000; // default
  2991.     this.direction = "right";
  2992.  
  2993.     var arrAllSet = settings.split(",");
  2994.     for( var i = 0; i < arrAllSet.length; i ++ )
  2995.     {// to retrieve the setting
  2996.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  2997.         var arrOneSet = arrAllSet[i].split("=");
  2998.         for( var j = 0; j < arrOneSet.length; j++ )
  2999.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3000.         switch( arrOneSet[0] )
  3001.         {
  3002.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3003.         case "direction" : this.direction = arrOneSet[1]; break;
  3004.         }
  3005.     }
  3006.         
  3007.     if( CCSSP.bIsIE5 && this.ele.style.position != "absolute" )
  3008.         this.ele.style.position = "relative";
  3009.     this.timer = null;
  3010.     this.aniIndex = CEngine.arrAnimation.length;
  3011.     CEngine.arrAnimation[this.aniIndex] = this;
  3012. }
  3013.  
  3014. CAgencyElastic.prototype.PrepareEffect = function()
  3015. {
  3016.     CCSSP.ShowObject(this.ele, false );
  3017. }
  3018.  
  3019. CAgencyElastic.prototype.UpdateEffect = function()
  3020. {
  3021.     if( this.timer == null )
  3022.         this.ResetParameters();
  3023.  
  3024.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3025.     if( percent >= 1.0 )
  3026.         this.EndEffect();
  3027.     else
  3028.     {
  3029.         var newX = this.startX;
  3030.         var newY = this.startY;
  3031.         var rf = Math.exp(-percent*3);
  3032.         var t = percent * 1.5 * Math.PI
  3033.         var rx = (Math.abs(this.startX) > Math.abs(this.startY)) ? this.startX : this.startY;
  3034.         switch (this.direction )
  3035.         {
  3036.         case "left":   
  3037.         case "right" : newX = rf*Math.cos(t)*rx + this.ele.ABSX; break;
  3038.         case "up":       
  3039.         case "down" :  newY = rf*Math.cos(t)*rx + this.ele.ABSX; break;
  3040.         }
  3041.         CCSSP.MoveObjectTo(this.ele, newX, newY);
  3042.         if( this.timer == null )
  3043.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3044.     }
  3045. }
  3046.  
  3047. CAgencyElastic.prototype.EndEffect = function()
  3048. {
  3049.     CCSSP.MoveObjectTo(this.ele, this.finalX, this.finalY);
  3050.     clearInterval( this.timer );
  3051.     this.timer = null;
  3052. }
  3053.  
  3054. CAgencyElastic.prototype.ResetParameters = function()
  3055. {
  3056.     CCSSP.ShowObject(this.ele, true );
  3057.     this.startX = this.ele.ABSX;
  3058.     this.finalX = this.ele.ABSX;
  3059.     this.startY = this.ele.ABSY;
  3060.     this.finalY = this.ele.ABSY;
  3061.     
  3062.     switch (this.direction)
  3063.     { 
  3064.     case "left":  this.startX = -this.ele.offsetWidth; break;
  3065.     case "right": this.startX = this.ele.offsetWidth;  break;
  3066.     case "up":    this.startY = -this.ele.offsetHeight;break;
  3067.     case "down":  this.startY = this.ele.offsetHeight; break;
  3068.     }
  3069.     CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  3070.     this.startTime = (new Date()).getTime();
  3071. }
  3072. // End of CAgencyElastic
  3073.  
  3074. // Begin of CAgencyZoom
  3075. function CAgencyZoom( element, settings, bIsIn)
  3076. {
  3077.     this.ele = element;
  3078.     this.duration = 1000; // default
  3079.     
  3080.     var arrAllSet = settings.split(",");
  3081.     for( var i = 0; i < arrAllSet.length; i ++ )
  3082.     {// to retrieve the setting
  3083.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3084.         var arrOneSet = arrAllSet[i].split("=");
  3085.         for( var j = 0; j < arrOneSet.length; j++ )
  3086.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3087.         switch( arrOneSet[0] )
  3088.         {
  3089.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3090.         }
  3091.     }
  3092.  
  3093.     this.bIsIn = bIsIn;
  3094.     this.timer = null;
  3095.     this.aniIndex = CEngine.arrAnimation.length;
  3096.     CEngine.arrAnimation[this.aniIndex] = this;
  3097. }
  3098.  
  3099. CAgencyZoom.prototype.PrepareEffect = function()
  3100. {
  3101.     CCSSP.ShowObject(this.ele, false);
  3102. }
  3103.  
  3104. CAgencyZoom.prototype.UpdateEffect = function()
  3105. {
  3106.     if( this.timer == null )
  3107.         this.ResetParameters();
  3108.  
  3109.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3110.     if( percent >= 1.0 )
  3111.         this.EndEffect();
  3112.     else
  3113.     {
  3114.         var nFactorIn = Math.ceil(50+50*percent);
  3115.         var nFactorOut = Math.ceil(100+200*(1-percent));
  3116.         var AlterFontsize = ((this.bIsIn)? nFactorIn : nFactorOut) + "%";
  3117.         var AlterFactor = ((this.bIsIn)? nFactorIn : nFactorOut) / 100;
  3118.         
  3119.         this.UpdateEffectAllChildren(this.ele, AlterFontsize, AlterFactor);
  3120.         for(var index = 0; index < this.ele.all.length; index++)
  3121.             this.UpdateEffectAllChildren(this.ele.all[index], AlterFontsize, AlterFactor);
  3122.             
  3123.         if( this.timer == null )
  3124.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3125.     }
  3126. }
  3127.  
  3128. CAgencyZoom.prototype.UpdateEffectAllChildren = function(child, FontSize, Factor)
  3129. {
  3130.     if( CCSSP.IsTextTag(child) )
  3131.         child.style.fontSize = FontSize;
  3132.     else
  3133.     {
  3134.         if( typeof(child.orgWidth) == "number" )
  3135.             child.style.width = Factor * child.orgWidth;
  3136.         if( typeof(child.orgHeight) == "number" )
  3137.             child.style.height = Factor * child.orgHeight;
  3138.     }
  3139. }
  3140.  
  3141. CAgencyZoom.prototype.EndEffect = function()
  3142. {
  3143.     this.EndEffectAllChildren(this.ele);
  3144.     for(var index = 0; index < this.ele.all.length; index++)
  3145.         this.EndEffectAllChildren(this.ele.all[index]);
  3146.     
  3147.     clearInterval( this.timer );
  3148.     this.timer = null;
  3149. }
  3150.  
  3151. CAgencyZoom.prototype.EndEffectAllChildren = function( child )
  3152. {    
  3153.     if( CCSSP.IsTextTag(child) )
  3154.         child.style.fontSize = child.orgFontSize;
  3155.     else
  3156.     {
  3157.         if( typeof(child.intactWidth) != "undefined" )
  3158.         {
  3159.             child.width = child.intactWidth;
  3160.             child.height = child.intactHeight;
  3161.         }
  3162.         else if( typeof(child.style.intactPixelWidth) != "undefined" )
  3163.         {
  3164.             child.style.pixelWidth = child.style.intactPixelWidth;
  3165.             child.style.pixelHeight = child.style.intactPixelHeight;
  3166.         }
  3167.     }
  3168. }
  3169.  
  3170. CAgencyZoom.prototype.ResetParameters = function()
  3171. {
  3172.     this.PrepareEffect();
  3173.     this.ResetParametersAllChildren( this.ele );
  3174.     for(var index = 0; index < this.ele.all.length; index++)
  3175.         this.ResetParametersAllChildren(this.ele.all[index]);
  3176.         
  3177.     this.startTime = (new Date()).getTime();
  3178. }
  3179.  
  3180. CAgencyZoom.prototype.ResetParametersAllChildren = function( child )
  3181. {
  3182.     CCSSP.ShowObject(child, true );
  3183.     if( (child.tagName == "DIV") && (child.parentElement.tagName == "TD") )
  3184.         child.width = "100%";// if the div is inside a cell of table, we need the this hack
  3185.     
  3186.     if( CCSSP.IsTextTag(child) )
  3187.         child.orgFontSize = child.style.fontSize;
  3188.     else
  3189.     {
  3190.         if( child.width > "" || child.height > "" )
  3191.         {
  3192.             child.orgWidth = child.intactWidth = child.width;
  3193.             child.orgHeight = child.intactHeight = child.height;
  3194.         }
  3195.         else if( ( typeof(child.orgWidth) != "number" ) && (typeof(child.orgHeight) != "number") )
  3196.         {
  3197.             child.orgWidth = child.style.intactPixelWidth = child.style.pixelWidth;
  3198.             child.orgHeight = child.style.intactPixelHeight = child.style.pixelHeight;
  3199.         }
  3200.     }
  3201. }
  3202. // End of CAgencyZoom
  3203.  
  3204. //// the following effects will use IE's exclusive "filter" function ////
  3205. // Begin of CAgencyAlpha definition
  3206. function CAgencyAlpha( element, settings, bIsIn )
  3207. {// because of "visual filter" style, this won't work in Navigator
  3208.     this.ele = element;
  3209.     this.bIsIn = bIsIn;
  3210.  
  3211.     // to set the default value
  3212.     this.startOpacity = (this.bIsIn) ? 0 : 100;
  3213.     this.endOpacity = (this.bIsIn) ? 100 : 0;
  3214.     
  3215.     this.duration = 1000; // default
  3216.     
  3217.     var arrAllSet = settings.split(",");
  3218.     for( var i = 0; i < arrAllSet.length; i ++ )
  3219.     {// to retrieve the setting
  3220.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3221.         var arrOneSet = arrAllSet[i].split("=");
  3222.         for( var j = 0; j < arrOneSet.length; j++ )
  3223.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3224.         switch( arrOneSet[0] )
  3225.         {
  3226.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3227.         }
  3228.     }
  3229.     
  3230.     this.timer = null;
  3231.     this.aniIndex = CEngine.arrAnimation.length;
  3232.     CEngine.arrAnimation[this.aniIndex] = this;
  3233. }
  3234.  
  3235. CAgencyAlpha.prototype.PrepareEffect = function()
  3236. {// to set the visual filter function
  3237.     // the visual filter ONLY work when set by "Width and Height" or
  3238.     // absolute position for DIV, SPAN and normal tag ( such as p )
  3239.     // but, "absolute" cause the following elements overlap, so:
  3240.     CCSSP.PrepareFilter( this.ele );
  3241.     CCSSP.ShowObject(this.ele, !this.bIsIn );
  3242. }
  3243.  
  3244. CAgencyAlpha.prototype.UpdateEffect = function()
  3245. {// to set the visual filter function
  3246.     if( this.timer == null )
  3247.         this.ResetParameters();
  3248.     if( typeof(this.ele.filters.alpha) != "object" )
  3249.     {
  3250.         this.EndEffect();
  3251.         return;
  3252.     }
  3253.  
  3254.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3255.     if( percent >= 1.0 )
  3256.         this.EndEffect();
  3257.     else if( typeof(this.ele.filters.alpha) == "object" )
  3258.     {
  3259.         this.ele.filters.alpha.opacity = this.startOpacity*(1.0-percent) + this.endOpacity*percent;
  3260.         if( this.timer == null )
  3261.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3262.     }
  3263. }
  3264.  
  3265. CAgencyAlpha.prototype.EndEffect = function()
  3266. {// to remove the visual filter function
  3267.     clearInterval( this.timer );
  3268.     this.timer = null;
  3269.     this.ele.style.filter = "";
  3270.     CCSSP.ShowObject(this.ele, this.bIsIn );
  3271. }
  3272.  
  3273. CAgencyAlpha.prototype.ResetParameters = function()
  3274. {
  3275.     this.PrepareEffect();
  3276.     CCSSP.ShowObject(this.ele, true );
  3277.     this.ele.style.filter = "alpha(opacity=" + this.startOpacity + ")";
  3278.     this.startTime = (new Date()).getTime();
  3279. }
  3280. // End of the CAgencyAlpha definition
  3281.  
  3282. // Begin of CAgencyWave definition
  3283. function CAgencyWave( element, settings )
  3284. {// because of "visual filter" style, this won't work in Navigator
  3285.     this.ele = element;
  3286.  
  3287.     this.duration = 0; // default
  3288.     this.strength = 10;
  3289.     this.freq = 1;
  3290.     this.lightstrength = 1;
  3291.     
  3292.     var arrAllSet = settings.split(",");
  3293.     for( var i = 0; i < arrAllSet.length; i ++ )
  3294.     {// to retrieve the setting
  3295.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3296.         var arrOneSet = arrAllSet[i].split("=");
  3297.         for( var j = 0; j < arrOneSet.length; j++ )
  3298.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3299.         switch( arrOneSet[0] )
  3300.         {
  3301.         case "duration" : this.duration = 100000/arrOneSet[1]; break;
  3302.         case "strength" : this.strength = arrOneSet[1]; break;
  3303.         case "freq" : this.freq = arrOneSet[1]; break;
  3304.         case "lightstrength" : this.lightstrength = arrOneSet[1]; break;
  3305.         }
  3306.     }
  3307.  
  3308.     this.timer = null;
  3309.     this.aniIndex = CEngine.arrAnimation.length;
  3310.     CEngine.arrAnimation[this.aniIndex] = this;
  3311. }
  3312.  
  3313. CAgencyWave.prototype.PrepareEffect = function()
  3314. {// to set the visual filter function
  3315.     CCSSP.PrepareFilter(this.ele);
  3316.  
  3317.     CCSSP.ShowObject(this.ele, true );
  3318. }
  3319.  
  3320. CAgencyWave.prototype.UpdateEffect = function()
  3321. {// to set the visual filter function
  3322.     if( this.timer == null )
  3323.         this.ResetParameters();
  3324.     if( typeof(this.ele.filters.wave) != "object" )
  3325.     {
  3326.         this.EndEffect();
  3327.         return;
  3328.     }
  3329.  
  3330.     if( this.duration > 0 )
  3331.     {
  3332.         var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3333.         if( percent >= 1.0 )
  3334.         {
  3335.             this.EndEffect();
  3336.             return;
  3337.         }
  3338.     }
  3339.     
  3340.     this.ele.filters.wave.phase += 5;
  3341.     this.ele.filters.wave.phase %= 100;
  3342.     if( this.timer == null )
  3343.         this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 50 );
  3344. }
  3345.  
  3346. CAgencyWave.prototype.EndEffect = function()
  3347. {// to remove the visual filter function
  3348.     this.ele.style.filter = "";
  3349.     clearInterval( this.timer );
  3350.     this.timer = null;
  3351. }
  3352.  
  3353. CAgencyWave.prototype.ResetParameters = function()
  3354. {
  3355.     this.PrepareEffect();
  3356.     this.ele.style.filter = "wave(strength=" + this.strength + ",freq=" + 
  3357.      this.freq +", lightstrength=" + this.lightstrength +",phase=0);";
  3358.     this.startTime = (new Date()).getTime();
  3359. }
  3360. // End of the CAgencyWave definition
  3361.  
  3362. // Begin of CAgencyGlow definition
  3363. function CAgencyGlow( element, settings )
  3364. {// because of "visual filter" style, this won't work in Navigator
  3365.     this.ele = element;
  3366.  
  3367.     // to set the default value
  3368.     this.glowColor = "green";
  3369.     this.glowStrength = "3";
  3370.     
  3371.     var arrAllSet = settings.split(",");
  3372.     for( var i = 0; i < arrAllSet.length; i ++ )
  3373.     {
  3374.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3375.         var arrOneSet = arrAllSet[i].split("=");
  3376.         for( var j = 0; j < arrOneSet.length; j++ )
  3377.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3378.         switch( arrOneSet[0] )
  3379.         {
  3380.         case "color" : this.glowColor = arrOneSet[1]; break;
  3381.         case "strength" : this.glowStrength = arrOneSet[1]; break;
  3382.         }
  3383.     }
  3384. }
  3385.  
  3386. CAgencyGlow.prototype.PrepareEffect = function()
  3387. {
  3388.     CCSSP.PrepareFilter(this.ele);
  3389.     CCSSP.ShowObject(this.ele, true );
  3390.     if( this.ele.style.backgroundColor != "" )
  3391.     {//style.backgroundColor somehow stop the visual filter
  3392.         this.ele.intactBackgroundColor = this.ele.style.backgroundColor;
  3393.         this.ele.style.backgroundColor = "";
  3394.     }
  3395. }
  3396.  
  3397. CAgencyGlow.prototype.UpdateEffect = function()
  3398. {// to set the visual filter function
  3399.     this.PrepareEffect();
  3400.     this.ele.style.filter = "glow(Color=" + this.glowColor + ", Strength=" + 
  3401.         this.glowStrength + ", enabled=true" +")";
  3402. }
  3403.  
  3404. CAgencyGlow.prototype.EndEffect = function()
  3405. {// to remove the visual filter function
  3406.     this.ele.style.filter = "";
  3407.     if( typeof(this.ele.intactBackgroundColor) != "undefined" )
  3408.         this.ele.style.backgroundColor = this.ele.intactBackgroundColor;
  3409. }
  3410. // End of the CAgencyGlow definition
  3411.  
  3412. // Begin of CAgencyDropShadow definition
  3413. function CAgencyDropShadow( element, settings )
  3414. {// because of "visual filter" style, this won't work in Navigator
  3415.     this.ele = element;
  3416.  
  3417.     // to set the default value
  3418.     this.shadowColor = "black"; 
  3419.     this.shadowOffx = "1";
  3420.     this.shadowOffy = "1";
  3421.     
  3422.     var arrAllSet = settings.split(",");
  3423.     for( var i = 0; i < arrAllSet.length; i ++ )
  3424.     {
  3425.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3426.         var arrOneSet = arrAllSet[i].split("=");
  3427.         for( var j = 0; j < arrOneSet.length; j++ )
  3428.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3429.         switch( arrOneSet[0] )
  3430.         {
  3431.         case "color" : this.shadowColor = arrOneSet[1]; break;
  3432.         case "offx" : this.shadowOffx = arrOneSet[1]; break;
  3433.         case "offy" : this.shadowOffy = arrOneSet[1]; break;
  3434.         }
  3435.     }
  3436. }
  3437.  
  3438. CAgencyDropShadow.prototype.PrepareEffect = function()
  3439. {
  3440.     CCSSP.PrepareFilter(this.ele);
  3441.     CCSSP.ShowObject(this.ele, true );
  3442.     
  3443.     if( this.ele.style.backgroundColor != "" )
  3444.     {//style.backgroundColor somehow stop the visual filter
  3445.         this.ele.intactBackgroundColor = this.ele.style.backgroundColor;
  3446.         this.ele.style.backgroundColor = "";
  3447.     }
  3448. }
  3449.  
  3450. CAgencyDropShadow.prototype.UpdateEffect = function()
  3451. {// to set the visual filter function
  3452.     this.PrepareEffect();
  3453.     this.ele.style.filter = "dropshadow(color=" + this.shadowColor + ", offx=" + 
  3454.         this.shadowOffx + ", offy=" + this.shadowOffy + ")";
  3455. }
  3456.  
  3457. CAgencyDropShadow.prototype.EndEffect = function()
  3458. {// to remove the visual filter function
  3459.     this.ele.style.filter = "";
  3460.     if( typeof(this.ele.intactBackgroundColor) != "undefined" )
  3461.         this.ele.style.backgroundColor = this.ele.intactBackgroundColor;
  3462. }
  3463. // End of the CAgencyDropShadow definition
  3464.  
  3465. // Begin of CAgencyRevealTrans definition
  3466. function CAgencyRevealTrans( element, settings )
  3467. {// because of "visual filter" style, this won't work in Navigator
  3468.     this.ele = element;
  3469.  
  3470.     // to set the default value
  3471.     this.duration = 1.0; //The value is specified in seconds.milliseconds format (0.0000).
  3472.     this.transition = 0;
  3473.     
  3474.     var arrAllSet = settings.split(",");
  3475.     for( var i = 0; i < arrAllSet.length; i ++ )
  3476.     {
  3477.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3478.         var arrOneSet = arrAllSet[i].split("=");
  3479.         for( var j = 0; j < arrOneSet.length; j++ )
  3480.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3481.         switch( arrOneSet[0] )
  3482.         {
  3483.         case "type" : this.transition = arrOneSet[1]; break;
  3484.         case "duration" : this.duration = 100/arrOneSet[1];    break;
  3485.         }
  3486.     }
  3487. }
  3488.  
  3489. CAgencyRevealTrans.prototype.PrepareEffect = function()
  3490. {
  3491.     CCSSP.PrepareFilter(this.ele);
  3492.     CCSSP.ShowObject( this.ele, false);
  3493. }
  3494.  
  3495. CAgencyRevealTrans.prototype.UpdateEffect = function()
  3496. {// to set the visual filter function
  3497.     if( typeof( this.ele.filters.RevealTrans ) == "object" )
  3498.     {
  3499.         if( this.ele.filters.RevealTrans.status == 2 )
  3500.             this.ele.filters.RevealTrans.stop();  
  3501.     }
  3502.  
  3503.     this.PrepareEffect();
  3504.     
  3505.     this.ele.style.filter = "RevealTrans(duration=" + this.duration + 
  3506.         ", transition=" + this.transition + ")";
  3507.     
  3508.     if( typeof( this.ele.filters.RevealTrans ) == "object" )
  3509.     {
  3510.         this.ele.filters.RevealTrans.apply();
  3511.         CCSSP.ShowObject( this.ele, true);
  3512.         this.ele.filters.RevealTrans.play();  
  3513.     }
  3514.     else
  3515.         CCSSP.ShowObject( this.ele, true);
  3516. }
  3517.  
  3518. CAgencyRevealTrans.prototype.EndEffect = function()
  3519. {
  3520.     if( typeof( this.ele.filters.RevealTrans ) == "object" )
  3521.         this.ele.filters.RevealTrans.stop();  
  3522.     this.ele.style.filter = "";
  3523. }
  3524. // End of the CAgencyRevealTrans definition
  3525.  
  3526. // Begin of CAgencyBlur definition
  3527. function CAgencyBlur( element, settings )
  3528. {// because of "visual filter" style, this won't work in Navigator
  3529.     this.ele = element;
  3530.  
  3531.     // to set the default value
  3532.     this.strength = "5";
  3533.     this.direction = "90";
  3534.     
  3535.     var arrAllSet = settings.split(",");
  3536.     for( var i = 0; i < arrAllSet.length; i ++ )
  3537.     {
  3538.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3539.         var arrOneSet = arrAllSet[i].split("=");
  3540.         for( var j = 0; j < arrOneSet.length; j++ )
  3541.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3542.         switch( arrOneSet[0] )
  3543.         {
  3544.         case "strength" : this.strength = arrOneSet[1]; break;
  3545.         case "direction" : this.direction = arrOneSet[1]; break;
  3546.         }
  3547.     }
  3548. }
  3549.  
  3550. CAgencyBlur.prototype.PrepareEffect = function()
  3551. {
  3552.     CCSSP.PrepareFilter(this.ele);
  3553.     CCSSP.ShowObject(this.ele, true );
  3554. }
  3555.  
  3556. CAgencyBlur.prototype.UpdateEffect = function()
  3557. {// to set the visual filter function
  3558.     CCSSP.PrepareFilter(this.ele);
  3559.     this.ele.style.filter = "blur(strength=" + this.strength + 
  3560.         ", direction=" + this.direction + ")";
  3561. }
  3562.  
  3563. CAgencyBlur.prototype.EndEffect = function()
  3564. {// to remove the visual filter function
  3565.     this.ele.style.filter = "";
  3566. }
  3567. // End of the CAgencyBlur definition
  3568.  
  3569. // Begin of CAgencyChangeFilter definition
  3570. function CAgencyChangeFilter( element, settings ) // flipH, flipV, invert, grey,
  3571. {// because of "visual filter" style, this won't work in Navigator
  3572.     this.ele = element;
  3573.  
  3574.     // to set the default value
  3575.     this.filterFunction = settings;
  3576. }
  3577.  
  3578. CAgencyChangeFilter.prototype.PrepareEffect = function()
  3579. {
  3580.     CCSSP.PrepareFilter(this.ele);
  3581.     CCSSP.ShowObject(this.ele, true );
  3582. }
  3583.  
  3584. CAgencyChangeFilter.prototype.UpdateEffect = function()
  3585. {// to set the visual filter function
  3586.     CCSSP.PrepareFilter(this.ele);
  3587.     this.ele.style.filter = this.filterFunction;
  3588. }
  3589.  
  3590. CAgencyChangeFilter.prototype.EndEffect = function()
  3591. {// to remove the visual filter function
  3592.     this.ele.style.filter = "";
  3593. }
  3594. // End of the CAgencyChangeFilter definition
  3595.  
  3596. // The effects below change the style on the fly, so they won't work in Navigator
  3597.  
  3598. // Begin of CAgencyFontChange definition, 
  3599. function CAgencyFontChange( element, settings )
  3600. {//this class can be replace by CAgencyChangeStyle,provided the "settings" is standard CSS string.
  3601.     this.ele = element;
  3602.     
  3603.     // to retrieve the original font style
  3604.     this.RetrieveOldFont( this.ele );
  3605.     
  3606.     // to set the default font to change
  3607.     this.newfontFamily = this.ele.oldFontFamily;
  3608.     this.newfColor = this.ele.oldColor;
  3609.     this.newtextDecoration = this.ele.oldTextDecoration;
  3610.     this.newfontWeight = this.ele.oldFontWeight;
  3611.     this.newfontStyle = this.ele.oldFontStyle;
  3612.     this.newfontSize = this.ele.oldFontSize;
  3613.     this.newBackgroundColor = this.ele.oldBackgroundColor;
  3614.     
  3615.     var arrAllSet = settings.split(",");
  3616.     for( var i = 0; i < arrAllSet.length; i ++ )
  3617.     {// to retrieve the setting
  3618.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3619.         var arrOneSet = arrAllSet[i].split("=");
  3620.         for( var j = 0; j < arrOneSet.length; j++ )
  3621.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3622.         switch( arrOneSet[0] )
  3623.         {
  3624.         case "font-family" : this.newfontFamily = arrOneSet[1]; break;
  3625.         case "color" : this.newfColor = arrOneSet[1]; break;
  3626.         case "underline" : this.newtextDecoration = (arrOneSet[1]=="on")? "underline" : "none"; break;
  3627.         case "bold" : this.newfontWeight = (arrOneSet[1]=="on")? "bold" : "normal"; break;
  3628.         case "italic" : this.newfontStyle = (arrOneSet[1]=="on")? "italic" : "normal"; break;
  3629.         case "size" : this.newfontSize = arrOneSet[1]; break;
  3630.         case "background-color" : this.newBackgroundColor = arrOneSet[1]; break;
  3631.         }
  3632.     }
  3633. }
  3634.  
  3635. CAgencyFontChange.prototype.RetrieveOldFont = function(objChild)
  3636. {
  3637.     if( typeof(objChild.oldFontFamily) == "undefined" )
  3638.         objChild.oldFontFamily = objChild.style.fontFamily;
  3639.     if( typeof(objChild.oldColor) == "undefined" )
  3640.         objChild.oldColor = objChild.style.color;
  3641.     if( typeof(objChild.oldTextDecoration) == "undefined" )
  3642.         objChild.oldTextDecoration = objChild.style.textDecoration;
  3643.     if( typeof(objChild.oldFontWeight) == "undefined" )
  3644.         objChild.oldFontWeight = objChild.style.fontWeight;
  3645.     if( typeof(objChild.oldFontStyle) == "undefined" )
  3646.         objChild.oldFontStyle = objChild.style.fontStyle;
  3647.     if( typeof(objChild.oldFontSize) == "undefined" )
  3648.         objChild.oldFontSize = objChild.style.fontSize;
  3649.     if( typeof(objChild.oldBackgroundColor) == "undefined" )
  3650.         objChild.oldBackgroundColor = objChild.style.backgroundColor;
  3651. }
  3652.  
  3653. CAgencyFontChange.prototype.PrepareEffect = function()
  3654. {
  3655.     // as for expanding text, the child is created after the constructor called
  3656.     for(var index = 0; index < this.ele.all.length; index++)
  3657.         this.RetrieveOldFont(this.ele.all[index]);
  3658.     CCSSP.ShowObject(this.ele, true );
  3659. }
  3660.  
  3661. CAgencyFontChange.prototype.UpdateEffect = function()
  3662. {// to change the font
  3663.     this.PrepareEffect();
  3664.     this.UpdateEffectAllChildren( this.ele );
  3665.     for( var index = 0; index < this.ele.all.length; index++)
  3666.         this.UpdateEffectAllChildren(this.ele.all[index]);
  3667. }
  3668.  
  3669. CAgencyFontChange.prototype.UpdateEffectAllChildren = function(objChild)
  3670. {
  3671.     objChild.style.fontFamily = this.newfontFamily;
  3672.     objChild.style.color = this.newfColor;
  3673.     objChild.style.textDecoration = this.newtextDecoration;
  3674.     objChild.style.fontWeight = this.newfontWeight;
  3675.     objChild.style.fontStyle = this.newfontStyle;
  3676.     objChild.style.fontSize = this.newfontSize;
  3677.     objChild.style.backgroundColor = this.newBackgroundColor;
  3678. }
  3679.  
  3680. CAgencyFontChange.prototype.EndEffect = function()
  3681. {// to reinstate the original font style
  3682.     this.EndEffectAllChildren( this.ele );
  3683.     for( var index = 0; index < this.ele.all.length; index++)
  3684.         this.EndEffectAllChildren(this.ele.all[index]);
  3685. }
  3686.  
  3687. CAgencyFontChange.prototype.EndEffectAllChildren = function( objChild )
  3688. {
  3689.     if( typeof(objChild.oldFontFamily) != "undefined" )
  3690.         objChild.style.fontFamily = objChild.oldFontFamily;
  3691.     if( typeof(objChild.oldColor) != "undefined" )
  3692.         objChild.style.color = objChild.oldColor;
  3693.     if( typeof(objChild.oldFontWeight) != "undefined" )
  3694.         objChild.style.fontWeight = objChild.oldFontWeight;
  3695.     if( typeof(objChild.oldFontStyle) != "undefined" )
  3696.         objChild.style.fontStyle = objChild.oldFontStyle;
  3697.     if( typeof(objChild.oldFontSize) != "undefined" )
  3698.         objChild.style.fontSize = objChild.oldFontSize;
  3699.     if( typeof(objChild.oldTextDecoration) != "undefined" )
  3700.         objChild.style.textDecoration = objChild.oldTextDecoration;
  3701.     if( typeof(objChild.oldBackgroundColor) != "undefined" )
  3702.         objChild.style.backgroundColor = objChild.oldBackgroundColor;
  3703. }
  3704. // End of the CAgencyFontChange definition
  3705.  
  3706. // Begin of the CAgencyChangeStyle definition
  3707. function CAgencyChangeStyle( element, settings )
  3708. {//this class can be replace by CAgencyChangeStyle,provided the "settings" is standard CSS string.
  3709.     this.ele = element;
  3710.     
  3711.     // to retrieve the original style
  3712.     this.oldstyle = this.ele.style.cssText;
  3713.     
  3714.     // to set the default style
  3715.     this.newStyle = this.oldstyle;
  3716.     
  3717.     if( typeof(settings) == "string" && settings.length > 1 )
  3718.         this.newStyle = this.oldstyle + " " + settings;
  3719. }
  3720.  
  3721. CAgencyChangeStyle.prototype.PrepareEffect = function()
  3722. {
  3723.     CCSSP.ShowObject(this.ele, true );
  3724. }
  3725.  
  3726. CAgencyChangeStyle.prototype.UpdateEffect = function()
  3727. {// to change the style
  3728.     this.ele.style.cssText = this.newStyle;
  3729. }
  3730.  
  3731. CAgencyChangeStyle.prototype.EndEffect = function()
  3732. {// to reinstate the original style
  3733.     this.ele.style.cssText = this.oldStyle;
  3734. }
  3735. // End of the CAgencyChangeStyle definition
  3736.  
  3737. //End the definition of CAgencyXXXX classes
  3738.  
  3739. //Begin to collaborate with other event handler settings 
  3740. CCSSP.RegisterEventHandler( window, "onload", "CEngine.OnPageLoad();BSSCOnLoad();kadovInitTriggersInHead();");
  3741. CCSSP.RegisterEventHandler( document, "onclick", "CEngine.OnPageClick();BSSCOnClick();");
  3742. CCSSP.RegisterEventHandler( document, "onmouseover", "CEngine.OnMouseOver();BSSCOnMouseOver();" );
  3743. CCSSP.RegisterEventHandler( document, "onmouseout", "CEngine.OnMouseOver();BSSCOnMouseOut();" );
  3744. CCSSP.RegisterEventHandler( window, "onunload", "BSSCOnUnload();");
  3745. //End to collaborate with other event handler settings
  3746.  
  3747.  
  3748. /// Section End  - CCSSP DHTM 2 (JavaScript 1.2)
  3749.  
  3750. //// Segment End -- (JavaScript 1.2)
  3751.