home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / PsTools / Pstools.chm / ehlpdhtm.js < prev    next >
Text File  |  2004-12-02  |  126KB  |  4,241 lines

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