home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 March / CMCD0305.ISO / Software / Freeware / Utilitare / xpantispy / xp-AntiSpy.chm / ehlpdhtm.js < prev    next >
Text File  |  2004-09-14  |  126KB  |  4,236 lines

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