home *** CD-ROM | disk | FTP | other *** search
/ Freelog 100 / FreelogNo100-NovembreDecembre2010.iso / GestionFichiers / GenieTimeline / GenieTimelineSetupFree.exe / TEMP / EN / help.chm / ehlpdhtm.js < prev    next >
Text File  |  2010-06-15  |  127KB  |  4,326 lines

  1. ∩╗┐// eHelp┬« Corporation Dynamic HTML JavaScript 
  2. // Copyright┬⌐ 1998-2003 eHelp┬« Corporation.All rights reserved.
  3. // Version=5.0
  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:\\Genie Timeline v 2\\Genie Timeline EN\\Genie Timeline Backup.chm";
  13. var HH_WindowName = "Timeline||NewWindow";
  14. var HH_GlossaryFont = "";
  15. var HH_Glossary = "1,1";
  16. var HH_Avenue = "1,1";
  17. var HH_ActiveX = true;
  18. //}}HH_SYMBOL_SECTION
  19. HH_ChmFilename = "E:\\sa3ed help 2.1\\Genie_Timeline.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  - DHTM (JavaScript 1.2)
  1906.  
  1907. //Begin to support extended and dropdown text effects.
  1908. function IsParagraph(el)
  1909. {
  1910.     return( el.tagName == "P" || el.tagName.indexOf("H") == 0 ) ? true : false;
  1911. }
  1912.  
  1913. //Begin to support extended and dropdown text effects.
  1914. function kadovIsParagraph(el)
  1915. {
  1916.     return IsParagraph(el);
  1917. }
  1918.  
  1919.  
  1920. function InitEachChild(el)
  1921. {    
  1922.     for(var i=0; i<getChildNodes(el).length; i++)
  1923.     {
  1924.         var child = getChildNodes(el)[i];
  1925.         if( child.tagName == "SCRIPT" || child.tagName == "!" )
  1926.             continue;
  1927.  
  1928.         if( child.id != "" )
  1929.         {
  1930.             // to wipe out the onload effects
  1931.             if (gbBsIE4&&!gbBsMac)
  1932.             {
  1933.                 var onLoadEffect = child.style.getAttribute( "x-on-pageload" );
  1934.                 if( (onLoadEffect != null) && (onLoadEffect > "") )
  1935.                     child.style.setAttribute( "x-on-pageload", "" );
  1936.             }
  1937.             
  1938.             var href = child.getAttribute("href")
  1939.             if( href != null && href > "" && href.indexOf( "BSSCPopup" ) >= 0 )
  1940.                 FilePopupInit(child.id); // Init for Popup
  1941.             else if( child.className == "dropspot" || child.className == "expandspot" || 
  1942.                      child.className == "glossterm" )
  1943.                 TextPopupInit(child.id);// Init for Expanding/Glossary or DropDown text
  1944.             else if( child.className == "trigger")
  1945.                 InitTrigger(child.id);// Init for Trigger
  1946.             else
  1947.             {
  1948.                 InitEffects(child.id);// Init for DHTML effects
  1949.                 CEngine.SetOneTargetInitialState( child.id );
  1950.             }
  1951.         }
  1952.         
  1953.         if( (child.tagName == "IMG") && (child.getAttribute("dynsrc") > "") )
  1954.             child.start = "mouseover";// to start a AVI file. fileopen doesn't work
  1955.  
  1956.         InitEachChild(child);
  1957.     }
  1958. }
  1959.  
  1960. function kadovInitEachChild(el)
  1961. {    
  1962.     InitEachChild(el);
  1963. }
  1964.  
  1965. function RetrieveTextInner(el)
  1966. {    
  1967.     var x = "";
  1968.     if( (!el) || (el.tagName == "!") || (el.tagName == "SCRIPT" ))
  1969.         return x;
  1970.  
  1971.     if( IsParagraph(el) )
  1972.     {
  1973.         var strNewID = " ";
  1974.         if( el.id != "" )
  1975.             strNewID += "id=" + el.id + "_NewSpan ";
  1976.         x = "<span" + strNewID + "style='" + el.style.cssText + "'>" + el.innerHTML + "</span>";
  1977.     }
  1978.     else
  1979.     {
  1980.         for(var i=0; i<getChildNodes(el).length; i++)
  1981.             x += RetrieveTextInner( getChildNodes(el)[i] );
  1982.     }
  1983.     return x;
  1984. }
  1985.  
  1986. function kadovRetrieveTextInner(el)
  1987. {
  1988.     return     RetrieveTextInner(el);
  1989. }
  1990.  
  1991. function RetrieveCleanHTML( strRawHTML, strTagOpen, strTagClose, nDistance )
  1992. {    
  1993.     var nTagOpen = strRawHTML.indexOf( strTagOpen, 0 );
  1994.     if( nTagOpen < 0 )
  1995.         return strRawHTML;
  1996.  
  1997.     var nTagClose = strRawHTML.indexOf( strTagClose, nTagOpen);
  1998.     if( nTagClose < nTagOpen )
  1999.         return strRawHTML;
  2000.         
  2001.     if( typeof(nDistance) == "number" && nDistance > 0 )
  2002.         if( (nTagClose - nTagOpen) != nDistance )
  2003.             return strRawHTML;
  2004.         
  2005.     var strCleanOnce = strRawHTML.substring(0, nTagOpen) + strRawHTML.substr(nTagClose + strTagClose.length) ;
  2006.     return     RetrieveCleanHTML( strCleanOnce, strTagOpen, strTagClose );
  2007. }
  2008.  
  2009. function kadovRetrieveCleanHTML( strRawHTML, strTagOpen, strTagClose, nDistance )
  2010. {    
  2011.     return RetrieveCleanHTML( strRawHTML, strTagOpen, strTagClose, nDistance );
  2012. }    
  2013.  
  2014. function AdjustObjectTag(strRawHTML, nStartPos)
  2015. {// adjust object tag for related topics HTML control, because innerHTML misses out the item settings
  2016.     
  2017.     //Is there any DTC?
  2018.     var strDTCTagOpen = '<!--Metadata type="DesignerControl" startspan';
  2019.     var strDTCTagClose = '<!--Metadata type="DesignerControl" endspan-->';
  2020.     var nDTCTagOpen = strRawHTML.indexOf( strDTCTagOpen, nStartPos );
  2021.     if( nDTCTagOpen < 0 )
  2022.         return strRawHTML;
  2023.     var nDTCTagClose = strRawHTML.indexOf( strDTCTagClose, nDTCTagOpen );
  2024.     if( nDTCTagClose < nDTCTagOpen)
  2025.         return strRawHTML; // no Design Time Controls;
  2026.         
  2027.     //Is the DTC HTML Help Control?
  2028.     var strRTObjTagOpen = 'classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11';
  2029.     var strRTObjTagClose = '</OBJECT>';
  2030.     var nRTObjTagOpen = strRawHTML.indexOf( strRTObjTagOpen, nDTCTagOpen );
  2031.     if( nRTObjTagOpen < nDTCTagOpen )
  2032.         return strRawHTML;
  2033.     var nRTObjTagClose = strRawHTML.indexOf( strRTObjTagClose, nRTObjTagOpen );
  2034.     if( nRTObjTagClose < nRTObjTagOpen )
  2035.         return strRawHTML; // is not a HTML help control
  2036.         
  2037.     // Is it a related Topics html help control?
  2038.     var strRTObjLabel = '<PARAM NAME=\"Command\" VALUE=\"Related Topics';
  2039.     if( strRawHTML.indexOf(strRTObjLabel, nRTObjTagOpen) < 0 )
  2040.         return strRawHTML;
  2041.     
  2042.     // does the commented object tag contain a items parameters        
  2043.     var strRTItemsOpen = '<param name="Items" value="';
  2044.     var strRTItemsClose = '$$**$$" >';
  2045.     var strRTItemsClose2 = '$$**$$">';
  2046.  
  2047.     var nRTItemsOpen = strRawHTML.indexOf(strRTItemsOpen, nDTCTagOpen);
  2048.     if( nRTItemsOpen < nDTCTagOpen )
  2049.         return strRawHTML;
  2050.     var nRTItemsClose = strRawHTML.indexOf(strRTItemsClose, nRTItemsOpen);
  2051.     if (nRTItemsClose == -1)
  2052.         nRTItemsClose = strRawHTML.indexOf(strRTItemsClose2, nRTItemsOpen);
  2053.     if( nRTItemsClose < nRTItemsOpen )
  2054.         return strRawHTML;
  2055.         
  2056.     // found a items string
  2057.     var strItems = strRawHTML.substring( nRTItemsOpen + strRTItemsOpen.length, nRTItemsClose);
  2058.     if( strItems.length < 1 )
  2059.         return strRawHTML;
  2060.     
  2061.     // to reconstruct the item(s) param tag(s)
  2062.     var strItemsArray = strItems.split('$$**$$');
  2063.     if( strItemsArray.length < 1 )
  2064.         return strRawHTML;
  2065.     var strRunTimeItemParam = "";
  2066.     for( var i = 0; i < strItemsArray.length; i++ )
  2067.     {
  2068.         strRunTimeItemParam += '<PARAM  NAME="Item' + (i+1);
  2069.         strRunTimeItemParam += '"' + '  VALUE="';
  2070.         strRunTimeItemParam += strItemsArray[i];
  2071.         strRunTimeItemParam += '">';
  2072.     }
  2073.     
  2074.     // to insert the reconstructed item params into runtime object tag
  2075.     var strAdjustedHTML = strRawHTML.substring(0,nRTObjTagClose) + strRunTimeItemParam + strRawHTML.substring(nRTObjTagClose, strRawHTML.length);
  2076.     return AdjustObjectTag(strAdjustedHTML, nDTCTagClose + strDTCTagClose.length);
  2077. }
  2078.  
  2079. function kadovAdjustObjectTag(strRawHTML, nStartPos)
  2080. {// adjust object tag for related topics HTML control, because innerHTML misses out the item settings
  2081.  return AdjustObjectTag(strRawHTML, nStartPos);
  2082. }
  2083.  
  2084. function TextPopupOnLoad( el )
  2085. {
  2086.     if( typeof(el) == "string" )
  2087.         el = getElement(el);
  2088.  
  2089.     var src = el.getAttribute( "x-use-popup" );
  2090.     var bNeedMove=true;
  2091.     if(!src&&el.id)
  2092.     {
  2093.         for (var i=0;i<gPopupData.length;i++)
  2094.             if (gPopupData[i].el==el.id)
  2095.             {
  2096.                 src=gPopupData[i].popupId;
  2097.                 bNeedMove=false;
  2098.                 break;
  2099.             }
  2100.     }
  2101.     if(!src)
  2102.         src = el.style.getAttribute( "x-use-popup" );    
  2103.     if (!src)    
  2104.         return 0;
  2105.  
  2106.     var name = src;
  2107.     if( src.substr(0,1) == "#" ) 
  2108.         name = src.substr(1, src.length-1);
  2109.     var srcDiv = getElement(name);
  2110.     if( !srcDiv )
  2111.         return 1;
  2112.  
  2113.     if (bNeedMove)
  2114.     {
  2115.         var type = el.getAttribute( "x-popup-type" );
  2116.         if (!type)
  2117.             type = el.style.getAttribute("x-popup-type");
  2118.         if (!type)        
  2119.             return 1;        
  2120.         var setup = el.getAttribute( "x-tmp-setup" );
  2121.         var newId = name;
  2122.         if( newId.indexOf( "_tmp") <= 0 )
  2123.             newId += "_tmp";
  2124.  
  2125.         if( !setup)
  2126.         {
  2127.             el.setAttribute( "x-tmp-setup", 1 );
  2128.  
  2129.             if( type == "pulldown"  )
  2130.             {
  2131.                 var strAdjust = AdjustObjectTag(srcDiv.innerHTML,0);
  2132.                 var strCleanHTML = RetrieveCleanHTML(strAdjust, "<!--", "-->");
  2133.                 strCleanHTML = RetrieveCleanHTML(strCleanHTML, "<SCRIPT", "/SCRIPT>");
  2134.                 
  2135.                 //work around the bug in HH.exe that highlight the phrases when use Search tab
  2136.                 //this approach is just removing the <FONT...> tag inserted by Microsoft in the runtime
  2137.                 strCleanHTML = RetrieveCleanHTML(strCleanHTML, "<FONT color=#", "\">", 52);
  2138.                 
  2139.                 var strStyle = " style='display:none; position:relative;";
  2140.                 var newDiv = "<div class=droptext id=" + newId + strStyle + "'>" + strCleanHTML + "</div>";
  2141.  
  2142.                 removeThis(srcDiv); // empty the original DIV tag
  2143.                 var elParentPra = FindParentParagraph(el);
  2144.                 if( elParentPra )
  2145.                     insertAdjacentHTML(elParentPra, "afterEnd", newDiv );
  2146.             }
  2147.             else if( type == "expanding"  )
  2148.             {
  2149.                 var inner = RetrieveTextInner(srcDiv);
  2150.                 if( inner == "" )
  2151.                     inner = srcDiv.innerHTML;
  2152.                 var strAdjust = AdjustObjectTag(inner,0);
  2153.                 var strCleanHTML = RetrieveCleanHTML(strAdjust, "<!--", "-->");
  2154.                 strCleanHTML = RetrieveCleanHTML(strCleanHTML, "<SCRIPT", "/SCRIPT>");
  2155.                 var strClassName = (el.className == "glossterm") ? "glosstext" : "expandtext";
  2156.                 var newSpan = "<span class=" + strClassName + " style='display: none;' id=" + newId + "> " + strCleanHTML + "</span>";
  2157.                 removeThis(srcDiv); // empty the original DIV tag
  2158.                 insertAdjacentHTML(el, "afterEnd", newSpan );
  2159.             }
  2160.         }
  2161.     }
  2162.     else
  2163.     {
  2164.         srcDiv.style.display = "none";
  2165.     }
  2166.     return 0;
  2167. }
  2168. function kadovTextPopupOnLoad( el )
  2169. {
  2170.     return TextPopupOnLoad( el );
  2171. }
  2172. function getElementsByTag(obj,sTagName)
  2173. {
  2174.     if(obj.getElementsByTagName)
  2175.         return obj.getElementsByTagName(sTagName);
  2176.     else if(obj.all)
  2177.         return obj.all.tags(sTagName);
  2178.     return null;
  2179. }
  2180.  
  2181. function getElement(sID)
  2182. {
  2183.     if(document.getElementById)
  2184.         return document.getElementById(sID);
  2185.     else if(document.all)
  2186.         return document.all(sID);
  2187.     return null;
  2188. }
  2189.  
  2190. function getParentNode(obj)
  2191. {
  2192.     if(obj.parentNode)
  2193.         return obj.parentNode;
  2194.     else if(obj.parentElement)
  2195.         return obj.parentElement;
  2196.     return null;
  2197. }
  2198.  
  2199. function getChildNodes(obj)
  2200. {
  2201.     if(obj.childNodes)
  2202.     {
  2203.         var children = new Array();
  2204.         for (var i = 0; i < obj.childNodes.length; i++)
  2205.         {
  2206.             if (obj.childNodes[i].nodeType == 1)
  2207.                 children[children.length] = obj.childNodes[i];
  2208.         }
  2209.         return children;
  2210.     }
  2211.     else if(obj.children)
  2212.         return obj.children;
  2213.     return null;    
  2214. }
  2215.  
  2216. function removeThis(obj)
  2217. {
  2218.     if(obj.parentNode)
  2219.         obj.parentNode.removeChild(obj);
  2220.     else
  2221.         obj.outerHTML="";
  2222. }
  2223.  
  2224. function TextPopup( el )
  2225. {
  2226.     if (!gbBsIE4 && !gbBsOpera7 && !gbBsSafari && !gbBsNS6 && !gbBsKonqueror3 )
  2227.         return;
  2228.  
  2229.     var bNeedMove=true;
  2230.     
  2231.     if (window.event)
  2232.         window.event.cancelBubble = true;
  2233.  
  2234.     if( typeof(el) == "string" )
  2235.         el = getElement(el);
  2236.  
  2237.     if (!el||el==window)
  2238.         return;
  2239.     
  2240.     var src = el.getAttribute( "x-use-popup" );
  2241.     if(!src&&el.id)
  2242.     {
  2243.         for (var i=0;i<gPopupData.length;i++)
  2244.             if (gPopupData[i].el==el.id)
  2245.             {
  2246.                 src=gPopupData[i].popupId;
  2247.                 bNeedMove=false;
  2248.                 break;
  2249.             }
  2250.     }
  2251.     if(!src)
  2252.         src = el.style.getAttribute( "x-use-popup" );    
  2253.     if(!src)
  2254.         return;
  2255.         
  2256.     var name = src;
  2257.     if( src.substr(0,1) == "#" ) 
  2258.     if (bNeedMove)
  2259.         name = src.substr(1, src.length-1) + "_tmp";
  2260.     else
  2261.         name = src.substr(1, src.length-1);
  2262.  
  2263.     var srcDiv = getElement(name);
  2264.     if( !srcDiv )
  2265.         return;
  2266.  
  2267.     if( srcDiv )
  2268.     {
  2269.         if( srcDiv.style.display == "" )
  2270.             srcDiv.style.display = "none";
  2271.         else
  2272.         {
  2273.             srcDiv.style.display = "";
  2274.             if( typeof(srcDiv.bInitialized) == "undefined" )
  2275.             {
  2276.                 srcDiv.bInitialized = true;
  2277.                 InitEffects(name);
  2278.                 InitEachChild(srcDiv);
  2279.             }
  2280.         }
  2281.     }
  2282.     if(gbBsIE4)
  2283.         event.returnValue=false;
  2284.     return;
  2285. }
  2286.  
  2287. function kadovTextPopup( el )
  2288. {
  2289.     TextPopup( el );
  2290. }
  2291.  
  2292. function FindParentParagraph( el )
  2293. {
  2294.     if( typeof(el) == "string" )
  2295.         el = getElement(el);
  2296.     if( (!el) || el.tagName == "BODY" )
  2297.         return null;
  2298.     if( IsParagraph(getParentNode(el)) )
  2299.         return getParentNode(el);
  2300.     else
  2301.         return FindParentParagraph( getParentNode(el) );
  2302. }
  2303.  
  2304. function kadovFindParentParagraph( el )
  2305. {
  2306.     return FindParentParagraph( el );
  2307. }
  2308.  
  2309. //Begin HTML code invoked function
  2310. function RegisterEventHandler( obj, strEvent, strEventHandler )
  2311. {
  2312.     if( !gbBsIE4 )
  2313.         return;
  2314.     CCSSP.RegisterEventHandler( obj, strEvent, strEventHandler );
  2315. }
  2316.  
  2317. function kadovRegisterEventHandler( obj, strEvent, strEventHandler )
  2318. {
  2319.  RegisterEventHandler( obj, strEvent, strEventHandler );
  2320. }
  2321.  
  2322.  
  2323. function textPopupData(el, popupId)
  2324. {
  2325.     this.el = el;
  2326.     this.popupId = "#"+popupId;
  2327. }
  2328.  
  2329. var gPopupData = new Array();
  2330.  
  2331. function TextPopupInit( el, popupId)
  2332. {
  2333.     if (!gbBsIE4 && !gbBsOpera7 && !gbBsSafari && !gbBsNS6 && !gbBsKonqueror3)
  2334.         return;
  2335.         
  2336.     if( typeof(el) == "string" )
  2337.     {
  2338.         if (popupId)
  2339.         {
  2340.             gPopupData[gPopupData.length]=new textPopupData(el, popupId);
  2341.         }
  2342.         el = getElement(el);
  2343.     }
  2344.         
  2345.     if( el != null )
  2346.     {
  2347.         CCSSP.RegisterEventHandler( el, "onclick", "TextPopup(\"" + el.id +"\");" );
  2348.         CCSSP.RegisterEventHandler( window, "onload", "TextPopupOnLoad(\"" + el.id +"\");" );
  2349.     }
  2350. }
  2351.  
  2352. function kadovTextPopupInit( el, popupId)
  2353. {
  2354.     return TextPopupInit( el, popupId);
  2355. }
  2356. //End HTML code invoked function
  2357.  
  2358. //End to support extended and dropdown text effects.
  2359.  
  2360. //Begin to convert iWrite format to RoboEditor Format for DHTML effects
  2361. function InitTriggersInHead( )
  2362. {
  2363.   if( Object.xDelayedInitElements )
  2364.   {
  2365.      var x = Object.xDelayedInitElements;
  2366.      for(i=0; i<x.length; i++)
  2367.          InitTrigger( x[i] );
  2368.   }
  2369. }
  2370.  
  2371. function kadovInitTriggersInHead( )
  2372. {
  2373.     InitTriggersInHead( );
  2374. }
  2375.  
  2376. //Begin HTML code invoked function
  2377. function FilePopupInit( el )
  2378. {
  2379.     if( typeof(el) == "string" )
  2380.         el = getElement(el);
  2381.  
  2382.     if( el != null )
  2383.         CCSSP.RegisterEventHandler( el, "onmouseover", "BSPSPopupOnMouseOver(event);" );
  2384. }
  2385. function kadovFilePopupInit( el )
  2386. {
  2387.     FilePopupInit( el );
  2388. }
  2389.  
  2390. function InitTrigger( element )
  2391. {
  2392.     if( !gbBsIE4 )
  2393.         return;
  2394.     var srcElement = element;
  2395.     if( typeof(srcElement) == "string" )
  2396.     {
  2397.         srcElement = getElement(element,0);
  2398.         if(srcElement == null)
  2399.             return;
  2400.     }
  2401.     
  2402.     if( !IsParentVisible(srcElement) )
  2403.         return;
  2404.  
  2405.     var targets = srcElement.getAttribute( "x-targets" );
  2406.     if (!targets)
  2407.         targets = srcElement.style.getAttribute("x-targets");
  2408.     if (!targets)
  2409.         return;    
  2410.     var arrOneTarget = targets.split( "," );
  2411.     for( var i = 0; i < arrOneTarget.length; i ++ )
  2412.         bsscFXInit( element, arrOneTarget[i], null, null, null, null );
  2413. }
  2414.  
  2415. function kadovInitTrigger( element )
  2416. {
  2417.     InitTrigger( element )
  2418. }
  2419.  
  2420. function IsParentVisible( el )
  2421. {
  2422.     if( typeof(el) == "string" )
  2423.         el = getElement(el);
  2424.     if( (!el) || el.tagName == "BODY" )
  2425.         return true;
  2426.     if( el.style.display == 'none' ) //el.visibility == 'hidden' || 
  2427.         return false;
  2428.     else
  2429.         return IsParentVisible( getParentNode(el) );
  2430. }
  2431.  
  2432. function kadovIsParentVisible( el )
  2433. {
  2434.     return IsParentVisible( el );
  2435. }
  2436. function InitEffects( element )
  2437. {
  2438.     if( !gbBsIE4 )
  2439.         return;
  2440.     var srcElement = element;
  2441.     if( typeof(srcElement) == "string" )
  2442.     {
  2443.         srcElement = getElement(element,0);
  2444.         if(srcElement == null)
  2445.             return;
  2446.     }
  2447.     
  2448.     if( !IsParentVisible(srcElement) )
  2449.         return;
  2450.     
  2451.     InitEffect( srcElement, "x-on-hover" );
  2452.     InitEffect( srcElement, "x-on-pageclick" );
  2453.     InitEffect( srcElement, "x-on-pageload" );
  2454.     InitEffect( srcElement, "x-on-trigger-1" );
  2455.     InitEffect( srcElement, "x-on-trigger-2" );
  2456. }
  2457.  
  2458. function kadovInitEffects( element )
  2459. {
  2460.     InitEffects( element );
  2461. }
  2462. //End HTML code invoked function
  2463.  
  2464. function InitEffect( element, prop )
  2465. {
  2466.     var values = null;
  2467.     if( element.getAttribute( "currentStyle" )  && element.currentStyle.getAttribute)
  2468.         values = element.currentStyle.getAttribute( prop );
  2469.     else  if (element.style.getAttribute)
  2470.         values = element.style.getAttribute( prop );
  2471.     if( !values )
  2472.         return;
  2473.  
  2474.     var functions = new Array();
  2475.     var nIdx = 0, nStart = 0;
  2476.     var nNext = values.indexOf( "\)", 0);
  2477.     while( nNext >= 0 && nNext < values.length )
  2478.     {
  2479.         functions[nIdx] = values.substr( nStart, nNext-nStart+1);
  2480.         nStart = nNext + 1;
  2481.         nIdx++;
  2482.         nNext = values.indexOf( "\)", nStart);
  2483.     }
  2484.         
  2485.     for( var i=0; i<functions.length; i++)
  2486.     {
  2487.         var id = element.getAttribute( "id" );
  2488.         var translatedProp = TranslateProp(prop);
  2489.  
  2490.         var lp = functions[i].indexOf( "(" );
  2491.         var fnname = functions[i].substring(0, lp);
  2492.         var srcargs = functions[i].substring(lp+1, functions[i].length-1);
  2493.         
  2494.         var nClickTimes = 1;
  2495.         var arrForClickCount = srcargs.split( "," );
  2496.         for( var j = 0; j < arrForClickCount.length; j++ )
  2497.         {// to locate and get the "clicks=99" settings
  2498.             var nPageClick = arrForClickCount[j].indexOf("clicks");
  2499.             if( nPageClick >= 0 )
  2500.             {
  2501.                 nPageClick = arrForClickCount[j].indexOf("=");
  2502.                 if( nPageClick > 0 )
  2503.                 {
  2504.                     nClickTimes = arrForClickCount[j].substring( nPageClick + 1, arrForClickCount[j].length) * 1;
  2505.                     break;
  2506.                 }
  2507.             }
  2508.         }
  2509.         var args = srcargs;
  2510.         if( j < arrForClickCount.length )
  2511.         {// to strip out the "clicks=99" from the arguments string
  2512.             args = "";
  2513.             for( var k = 0; k < arrForClickCount.length; k ++ )
  2514.             {
  2515.                 if( k != j )
  2516.                 {
  2517.                     args += arrForClickCount[k];
  2518.                     if( k < arrForClickCount.length - 1 )
  2519.                         args += ",";
  2520.                 }
  2521.             }
  2522.         }
  2523.         bsscFXInit( null, id, translatedProp, fnname, args, nClickTimes );
  2524.     }
  2525. }
  2526.  
  2527. function kadovInitEffect( element, prop )
  2528. {
  2529.     InitEffect( element, prop );
  2530. }
  2531.  
  2532. function TranslateProp( prop )
  2533. {
  2534.     switch( prop )
  2535.     {
  2536.     case "x-on-hover" :     return "bsschover";
  2537.     case "x-on-pageclick" : return "bsscpageclick";
  2538.     case "x-on-pageload" :  return "bsscpageload";
  2539.     case "x-on-trigger-1" : return "bssctrigger1";
  2540.     case "x-on-trigger-2" : return "bssctrigger2";
  2541.     }
  2542.     return null;
  2543. }
  2544.  
  2545. function kadovTranslateProp( prop )
  2546. {
  2547.     return TranslateProp( prop );
  2548. }
  2549.  
  2550. //End to convert iWrite format to RoboEditor Format for DHTML effects
  2551.  
  2552. //Begin the definition of one entry to DHTML effects
  2553. function bsscFXInit( trigger_ID, target_ID, event_type, 
  2554.     action_type, action_setting, event_addional )
  2555. {
  2556.     if( (!gbBsWindows && !gbBsSunOS  && !(gbBsMac&&gbBsIE5)) || typeof(target_ID) != "string" )//MUST have a target_ID
  2557.         return; // we don't support Navigator yet
  2558.     
  2559.     if( typeof(event_type) == "string" )
  2560.         event_type = event_type.toLowerCase();
  2561.     if( typeof(action_type) == "string" )
  2562.         action_type = action_type.toLowerCase();
  2563.     if( typeof(action_setting) == "string" )
  2564.          action_setting = action_setting.toLowerCase();
  2565.     
  2566.     // to get the target element then add it to the target list
  2567.     var eleTarget = CCSSP.GetObject( target_ID );
  2568.     if( (eleTarget != null) && (event_type != null) && (action_type != null) )
  2569.     {
  2570.         CEngine.AddOneTarget( target_ID, eleTarget );
  2571.         CEngine.BuildTargetObject(target_ID, event_type, action_type, action_setting, event_addional);
  2572.     }
  2573.     
  2574.     // to validate the trigger_ID parameter
  2575.     if( typeof(trigger_ID) == "string" && trigger_ID != "" )
  2576.         CEngine.BuildTriggerObject( trigger_ID, target_ID );
  2577. }    
  2578. //End the definition of one entry to DHTML effects
  2579.  
  2580. /// Section End  - DHTM (JavaScript 1.2)
  2581.  
  2582. /// Section Begin  - CCSSP DHTM (JavaScript 1.2)
  2583.  
  2584. //Begin JavaScript libary for cross-platform positioning object.
  2585. function CCSSP(){} // constructor of CCSSP class
  2586.  
  2587. CCSSP.GetObject = function( obj )
  2588. {//convert object name string or reference into a valid object reference
  2589.     if( typeof(obj) == "object" )
  2590.         return obj;
  2591.     else if( typeof(obj) == "string" && obj != "")
  2592.     {
  2593.         if( gbBsNS4 )
  2594.             return eval("document." + obj);
  2595.         else
  2596.             return eval("document.all(\"" + obj + "\")");
  2597.     }
  2598.     else
  2599.         return null;
  2600. }
  2601.  
  2602. CCSSP.MoveObjectTo = function(obj, x, y)
  2603. {//positioning an object at a specific pixel coordinate
  2604.     if( gbBsNS4 )
  2605.         obj.moveTo(x,y);
  2606.     else
  2607.     {
  2608.         obj.style.pixelLeft = x;
  2609.         obj.style.pixelTop = y;
  2610.     }
  2611. }
  2612.  
  2613. CCSSP.MoveObjectBy = function(obj, dx, dy)
  2614. {//moveing a object by x and/or y pixel
  2615.     if( gbBsNS4 )
  2616.         obj.moveBy(dx,dy);
  2617.     else
  2618.     {
  2619.         obj.style.pixelLeft += dx;
  2620.         obj.style.pixelTop += dy;
  2621.     }
  2622. }
  2623.  
  2624. CCSSP.SetObjectBGColor = function(obj, color)
  2625. {//set the background color of an object
  2626.     if( gbBsNS4 )
  2627.         obj.bgColor = color;
  2628.     else
  2629.         obj.style.backgroundColor = color;
  2630. }
  2631.  
  2632. CCSSP.ShowObject = function(obj, bShow)
  2633. {// set the object to be visible or invisible
  2634.     if( gbBsNS4 )
  2635.         obj.visibility = (bShow == true) ? 'show' : 'hide';
  2636.     else
  2637.         obj.style.visibility = (bShow == true) ? 'visible' : 'hidden';// when hidden, it still occupy some space.
  2638. }
  2639.  
  2640. CCSSP.GetObjectLeft = function(obj)
  2641. {// retrieve the x coordinate of a posionable object
  2642.     if( gbBsNS4 )
  2643.         return obj.left;
  2644.     else
  2645.         return obj.style.pixelLeft;
  2646. }
  2647.  
  2648. CCSSP.GetObjectTop = function(obj)
  2649. {// retrieve the y coordinate of a posionable object
  2650.     if( gbBsNS4 )
  2651.         return obj.top;
  2652.     else
  2653.         return obj.style.pixelTop;
  2654. }
  2655.  
  2656. CCSSP.GetObjectContainLeft = function(obj)
  2657. {// retrieve the x coordinate of a posionable object relative to it's parent element
  2658.     if( gbBsNS4 )
  2659.         return obj.pageX;
  2660.     else
  2661.     {
  2662.         if( obj == document.body )
  2663.             return obj.clientLeft;
  2664.         else
  2665.             return obj.offsetLeft;
  2666.     }
  2667. }
  2668.  
  2669. CCSSP.GetObjectWindowLeft = function(obj)
  2670. {// retrieve the x coordinate of a posionable object relative to browser window
  2671.     if( gbBsNS4 )
  2672.         return obj.pageX;
  2673.     else
  2674.     {
  2675.         var nOffsetWindowLeft = 0;
  2676.         for(var element = obj; element; element = element.offsetParent)
  2677.             nOffsetWindowLeft += CCSSP.GetObjectContainLeft(element);
  2678.         return nOffsetWindowLeft;
  2679.     }
  2680. }
  2681.  
  2682. CCSSP.GetObjectContainTop = function(obj)
  2683. {// retrieve the y coordinate of a posionable object relative to it's parent element
  2684.     if( gbBsNS4 )
  2685.         return obj.pageY;
  2686.     else
  2687.     {
  2688.         if( obj == document.body )
  2689.             return obj.clientTop;
  2690.         else
  2691.             return obj.offsetTop;
  2692.     }
  2693. }
  2694.  
  2695. CCSSP.GetObjectWindowTop = function(obj)
  2696. {// retrieve the y coordinate of a posionable object relative to browser window
  2697.     if( gbBsNS4 )
  2698.         return obj.pageY;
  2699.     else
  2700.     {
  2701.         var nOffsetWindowTop = 0;
  2702.         for(var element = obj; element; element = element.offsetParent)
  2703.             nOffsetWindowTop += CCSSP.GetObjectContainTop(element);
  2704.         return nOffsetWindowTop;
  2705.     }
  2706. }
  2707.  
  2708. CCSSP.GetObjectHeight = function(obj)
  2709. {// retrieve the height of a posionable object
  2710.     if( gbBsNS4 )
  2711.         return obj.clip.height;
  2712.     else
  2713.         return obj.offsetHeight;
  2714. }
  2715.  
  2716. CCSSP.GetObjectWidth = function(obj)
  2717. {// retrieve the width of a posionable object
  2718.     if( gbBsNS4 )
  2719.         return obj.clip.width;
  2720.     else
  2721.         return obj.offsetWidth;
  2722. }
  2723.  
  2724. CCSSP.RegisterEventHandler = function( srcObj, rawEventName, funcHandler )
  2725. { // to add the "funcHandler" as the "rawEventName" 's handler to the "srcObj" object,the original event handler will be combined
  2726.     if (gbBsNS4 && !gbBsNS6)
  2727.         return ;
  2728.         
  2729.     var oldHandler = "";
  2730.  
  2731.     if (gbBsMac &&gbBsIE4&&!gbBsIE5)
  2732.     {
  2733.         if (typeof(srcObj[rawEventName.toLowerCase()])=="unknown")
  2734.         { //search for <SCRIPT> tag which define the event handler
  2735.             for( var i = 0; i < document.scripts.length; i++ ) 
  2736.             {
  2737.                 var script = document.scripts[i];
  2738.                 if( (script.htmlFor == srcObj.id || script.htmlFor == srcObj ) && script.event == rawEventName )
  2739.                 {
  2740.                     oldHandler = script.innerHTML;
  2741.                     break;
  2742.                 }
  2743.             }
  2744.         }
  2745.     }
  2746.     else
  2747.     {
  2748.         var oldInlineHandler = srcObj[rawEventName.toLowerCase()];
  2749.         if( oldInlineHandler != null && typeof(oldInlineHandler) != "undefined")
  2750.         {
  2751.             var functionDefinition = oldInlineHandler.toString();
  2752.             var bodyStart = functionDefinition.indexOf( "{" );
  2753.             var bodyEnd = functionDefinition.lastIndexOf( "}" );
  2754.             if( bodyStart > 0 || bodyEnd > bodyStart )
  2755.                 oldHandler = functionDefinition.substr( bodyStart + 1, bodyEnd - bodyStart - 2 );
  2756.         }
  2757.         else if( gbBsIE4 )
  2758.         { //search for <SCRIPT> tag which define the event handler
  2759.             for( var i = 0; i < document.scripts.length; i++ ) 
  2760.             {
  2761.                 var script = document.scripts[i];
  2762.                 if( (script.htmlFor == srcObj.id || script.htmlFor == srcObj ) && script.event == rawEventName )
  2763.                 {
  2764.                     oldHandler = script.innerHTML;
  2765.                     break;
  2766.                 }
  2767.             }
  2768.         }
  2769.     }
  2770.     if( oldHandler.indexOf(funcHandler) >= 0 )
  2771.         return;// to prevent register the funtion twice.
  2772.  
  2773.     if( gbBsNS4 ) // only "onload, onresize, onfocus" apply to window
  2774.     {// other raw events will apply to layer
  2775.         var noOn = rawEventName.substring(2, rawEventName.length);
  2776.         if( typeof(noOn) == "string" && noOn.length > 3 ) {
  2777.             if (srcObj.captureEvents)
  2778.                 srcObj.captureEvents( Event[noOn.toUpperCase()] );
  2779.         }
  2780.     }
  2781.     
  2782.     var newHandler = oldHandler;
  2783.     if( newHandler.length == 0 )
  2784.         newHandler = funcHandler;
  2785.     else
  2786.         newHandler += "; " + funcHandler;
  2787.     
  2788.     srcObj[rawEventName.toLowerCase()] = new Function( newHandler );
  2789. }
  2790.  
  2791. CCSSP.GetWindowHeight = function()
  2792. {// retrieve the height of available content in browser window
  2793.     if( gbBsNS4 )
  2794.         return window.innerHeight;
  2795.     else
  2796.         return document.body.clientHeight;
  2797. }
  2798.  
  2799. CCSSP.GetWindowBottom = function()
  2800. {// retrieve the bottom postion of browser window
  2801.     if( gbBsNS4 )
  2802.         return window.outerHeight + window.pageYOffset;
  2803.     else
  2804.         return document.body.clientHeight + document.body.scrollTop;
  2805. }
  2806.  
  2807. CCSSP.GetWindowWidth = function()
  2808. {// retrieve the width of available content in browser window
  2809.     if( gbBsNS4 )
  2810.         return window.innerWidth;
  2811.     else
  2812.         return document.body.clientWidth;
  2813. }
  2814.  
  2815. CCSSP.GetWindowRight = function()
  2816. {// retrieve the right postion of browser window
  2817.     if( gbBsNS4 )
  2818.         return window.outerWidth + window.pageXOffset;
  2819.     else
  2820.         return document.body.clientWidth + document.body.scrollLeft;
  2821. }
  2822.  
  2823. CCSSP.TrimString = function( objString, subtrim )
  2824. {// to trim the "subtrim" in the beginning and ending of a string object
  2825.     if( typeof(subtrim) != "string" || subtrim == null )
  2826.         return objString;
  2827.     var strHead = objString.substring(0, 1);
  2828.     var strRear = objString.substring(objString.length-1, objString.length);
  2829.     if( strHead != subtrim && strRear != subtrim )
  2830.         return objString;
  2831.     
  2832.     var spacePos = objString.indexOf(subtrim);
  2833.     if( spacePos < 0 )
  2834.         return objString;
  2835.     else if( spacePos == objString.length - 1 )
  2836.         return objString.substring(0, spacePos);
  2837.     else
  2838.     {
  2839.         var newString = objString.substring( spacePos + 1, objString.length);
  2840.         return CCSSP.TrimString( newString, subtrim );
  2841.     }
  2842. }
  2843.  
  2844. CCSSP.TrimSpace = function( objString )
  2845. {
  2846.     var Trim1 = CCSSP.TrimString( objString, " ");
  2847.     return CCSSP.TrimString( Trim1, "\'");
  2848. }
  2849.  
  2850. CCSSP.GetEventElement = function( navEventObject )
  2851. {// to get the element who fired the current event
  2852.     if(gbBsNS4) 
  2853.         if (gbBsNS6)
  2854.             return null;
  2855.         else
  2856.              navEventObject.target;
  2857.     else
  2858.         return event.srcElement;
  2859. }
  2860.  
  2861. CCSSP.PrepareFilter = function( Obj )
  2862. {//to prepare for making the filter work
  2863.     Obj.style.filter = "";
  2864.     if( Obj.style.width != "" || Obj.style.height != "" || Obj.style.position == "absolute" )
  2865.         return;
  2866.     Obj.style.height = CCSSP.GetObjectHeight(Obj);
  2867. }
  2868.  
  2869. CCSSP.IsDescendant = function( progenitor, progeny )
  2870. {
  2871.     if( typeof(progeny) == "undefined" || progeny == null )
  2872.         return false;
  2873.     else if( progeny == progenitor )
  2874.         return true; 
  2875.     else if( progeny.id == progenitor.id ) 
  2876.         return true; 
  2877.     else if( getParentNode(progeny) == getParentNode(progenitor))
  2878.         return false;
  2879.     else
  2880.         return CCSSP.IsDescendant( progenitor, getParentNode(progeny));
  2881. }
  2882.  
  2883. CCSSP.IsTextTag = function( Obj )
  2884. {
  2885.     if( typeof( Obj.tagName ) == "undefined" )
  2886.         return false;
  2887.     return( Obj.tagName.indexOf("H") == 0 || Obj.tagName == "P" || 
  2888.             Obj.tagName == "FONT" || Obj.tagName == "SPAN" );
  2889. }
  2890.  
  2891. //End JavaScript libary for cross-platform positioning object.
  2892.  
  2893. /// Section End  - CCSSP DHTM (JavaScript 1.2)
  2894.  
  2895. /// Section Begin  - CCSSP DHTM 1 (JavaScript 1.2)
  2896.  
  2897. //Begin the definition of class CTrigger
  2898. function CTrigger( TriggerElement )
  2899. {
  2900.     // object : the trigger element. Never be null. 
  2901.     this.eleTrigger = TriggerElement;
  2902.     
  2903.     // number : the click counter number: only 3 values: 0,1,2;
  2904.     this.nCounter = 0; 
  2905.     
  2906.     //object as associative array of string:
  2907.     // the associate target ID strings; one element at least.            
  2908.     this.objStrTarget = new Object();
  2909.     this.eleTrigger.style.cursor = "hand";
  2910.     if( this.eleTrigger.tagName == "AREA" && this.eleTrigger.getAttribute("href") == "" )
  2911.         this.eleTrigger.setAttribute("href", "#") // to make a hand cursor for image map
  2912. }
  2913.  
  2914. CTrigger.prototype.AddTargetID = function( strTargetID )
  2915. {// add one target ID string to the objStrTarget
  2916.     if( typeof(strTargetID) != "string" )
  2917.         return ;
  2918.     if( typeof(this.objStrTarget[strTargetID]) != "string" )
  2919.         this.objStrTarget[strTargetID] = strTargetID;
  2920. }
  2921.  
  2922. CTrigger.prototype.OnTriggerClick = function()
  2923. {// to activate all asociated target
  2924.     var strEventType = ( (this.nCounter++)% 2 == 0 ) ? 
  2925.         "bssctrigger1" : "bssctrigger2";
  2926.         
  2927.     // to enumerate associative target element's ID string
  2928.     for( var strTargetID in this.objStrTarget ) 
  2929.         CEngine.SendEventToOneTarget( strTargetID, strEventType );
  2930. }
  2931. //End the definition of class CTrigger
  2932.  
  2933. //Begin the definition of class CTarget
  2934. function CTarget( TargetElement )
  2935. {
  2936.     // object : the target element. Never be null.
  2937.     this.eleTarget = TargetElement;
  2938.     this.objManager = new Object(); // object: the event manager
  2939.  
  2940. CTarget.nPageClickCounter = 0;// static class property.
  2941.  
  2942. CTarget.prototype.GetAgencyObject = function(str_action_type,action_setting )
  2943. {// return the action agency ( effect )object's refernece 
  2944.     switch( str_action_type )
  2945.     {
  2946.     case "show":return new CAgencyShow( this.eleTarget, true ) ;
  2947.     case "hide":return new CAgencyShow( this.eleTarget, false ) ;
  2948.  
  2949.     case "flyin" : 
  2950.         return new CAgencyFly(this.eleTarget, action_setting, true);
  2951.     case "flyout" : 
  2952.         return new CAgencyFly(this.eleTarget, action_setting, false);
  2953.     case "spiralin" : 
  2954.         return new CAgencySpiral(this.eleTarget, action_setting, true);
  2955.     case "spiralout" : 
  2956.         return new CAgencySpiral(this.eleTarget, action_setting, false);
  2957.     case "zoomin" :
  2958.         return new CAgencyZoom(this.eleTarget, action_setting, true);
  2959.     case "zoomout" : 
  2960.         return new CAgencyZoom(this.eleTarget, action_setting, false);
  2961.     case "elastic" : 
  2962.         return new CAgencyElastic(this.eleTarget, action_setting);
  2963.         
  2964.     case "fadein" : 
  2965.         return (gbBsIE4)? new CAgencyAlpha(this.eleTarget, action_setting, true) : null;
  2966.     case "fadeout" :
  2967.         return (gbBsIE4)? new CAgencyAlpha(this.eleTarget, action_setting, false) : null;
  2968.     case "rockrollstatic" :
  2969.     case "rockroll" :
  2970.         return (gbBsIE4)? new CAgencyWave(this.eleTarget, action_setting, false) : null;
  2971.  
  2972.     case "glow":
  2973.         return (gbBsIE4)? new CAgencyGlow(this.eleTarget,action_setting) : null;
  2974.     case "dropshadow":
  2975.         return (gbBsIE4)? new CAgencyDropShadow(this.eleTarget,action_setting) : null;
  2976.     case "transition" :
  2977.         return (gbBsIE4)? new CAgencyRevealTrans(this.eleTarget,action_setting) : null;
  2978.     case "blur" :
  2979.         return (gbBsIE4)? new CAgencyBlur(this.eleTarget,action_setting) : null;
  2980.  
  2981.     case "fliph" : // all these 4 do NOT need any parameters
  2982.     case "flipv" :
  2983.     case "invert":
  2984.     case "gray" :
  2985.         return (gbBsIE4)? new CAgencyChangeFilter(this.eleTarget, str_action_type) : null;
  2986.     
  2987.     case "fontchange": // the effects below change the style on the fly, so won't work in Navigator
  2988.         return (gbBsIE4)? new CAgencyFontChange(this.eleTarget,action_setting) : null;
  2989.     case "boderchange": 
  2990.     case "stylechange":
  2991.         return (gbBsIE4)? new CAgencyChangeStyle(this.eleTarget,action_setting) : null;
  2992.  
  2993.     default: return null;
  2994.     }
  2995. }
  2996.  
  2997. CTarget.prototype.SetEventManager = function( 
  2998.     one_event_type,str_action_type,action_setting,event_additional)
  2999. {// to set the event manager with specified action 
  3000.     if( typeof( one_event_type ) != "string" ||    
  3001.         typeof( str_action_type ) != "string"||
  3002.         typeof( action_setting ) != "string" )
  3003.         return false;
  3004.     if( typeof(this.objManager[one_event_type]) == "undefined" )
  3005.     {
  3006.         this.objManager[one_event_type] = new Object();
  3007.         this.objManager[one_event_type].length = 0;
  3008.     }
  3009.     
  3010.     var eventAgency = this.GetAgencyObject(str_action_type,action_setting);
  3011.     if( eventAgency != null )
  3012.     {
  3013.         var ct = this.objManager[one_event_type].length ++;
  3014.         this.objManager[one_event_type][ct] = eventAgency;
  3015.         
  3016.         if( one_event_type == "bsscpageclick" )
  3017.         {// to deal with the "number of pageclick" stuff
  3018.             if( typeof(event_additional) == "number" )
  3019.                 this.objManager[one_event_type][ct].nPageClick = event_additional;
  3020.             else // set the default number 
  3021.                 this.objManager[one_event_type][ct].nPageClick = 1;
  3022.             
  3023.             if( (typeof(this.objManager.nMinPageClickIndex) == "undefined") ||
  3024.                 (this.objManager[one_event_type][ct].nPageClick < 
  3025.                     this.objManager[one_event_type][this.objManager.nMinPageClickIndex].nPageClick) )
  3026.                 this.objManager.nMinPageClickIndex = ct;
  3027.         }
  3028.         
  3029.         //hide the object blindly,SetState function will take care of the final correct state
  3030.         if( ((one_event_type == "bsscpageclick") && 
  3031.              (this.objManager[one_event_type][ct].nPageClick == 1)) ||
  3032.             one_event_type == "bsscpageload" ||
  3033.             one_event_type == "bssctrigger1" )
  3034.             CCSSP.ShowObject( this.eleTarget, false );
  3035.         
  3036.         if( one_event_type == "bssctrigger1" || one_event_type == "bssctrigger2" )
  3037.             if( typeof( this.strTriggerEvent ) == "undefined" )
  3038.                 this.strTriggerEvent = ( one_event_type == "bssctrigger1" ) ? "bssctrigger2" : "bssctrigger1";
  3039.             
  3040.         return true;
  3041.     }
  3042.     return false;
  3043. }
  3044.  
  3045. CTarget.prototype.OnEvent = function( strBsscEvent )
  3046. {// response to the event ( bssc format )
  3047.     if( typeof(this.objManager[strBsscEvent]) == "object" )
  3048.     { // to get the event agency from the event manager
  3049.         var eventAgency = this.objManager[strBsscEvent];
  3050.         for( var i = 0; i < eventAgency.length; i++ )
  3051.         {
  3052.             if( strBsscEvent == "bsscpageclick" && 
  3053.                  eventAgency[i].nPageClick != CTarget.nPageClickCounter )
  3054.                  continue;
  3055.             else if( strBsscEvent == "bsschover" && event.type == "mouseout" )
  3056.                 eventAgency[i].EndEffect();
  3057.             else // to invoke the unified function in effect object    
  3058.                 eventAgency[i].UpdateEffect(); 
  3059.         }
  3060.     }
  3061. }
  3062.  
  3063. CTarget.prototype.SetState = function( strBsscEvent )
  3064. {
  3065.     if( typeof(this.objManager[strBsscEvent]) != "object" )
  3066.         return false;
  3067.  
  3068.     // to get the event agency from the event manager
  3069.     var eventAgency = this.objManager[strBsscEvent];
  3070.     
  3071.     if( strBsscEvent == "bsscpageclick" )
  3072.     {// we only set the initial state for the minium number of pageclick 
  3073.         eventAgency[this.objManager.nMinPageClickIndex].PrepareEffect();
  3074.         return true;
  3075.     }
  3076.     else
  3077.     {
  3078.         for( var i = 0; i < eventAgency.length; i++ )
  3079.             eventAgency[i].PrepareEffect(); // to invoke the unified function in effect object     
  3080.         if( i > 0 )
  3081.             return true;
  3082.         else
  3083.             return false;
  3084.     }
  3085. }
  3086. //End the definition of class CTarget
  3087.  
  3088. //Begin the definition of CEngine class
  3089. function CEngine(){}// all properities are going be "class" properities
  3090.  
  3091. // object : as associative array of trigger objects
  3092. CEngine.objTrigger = new Object();
  3093. // object : as associative array of target objects 
  3094. CEngine.objTarget = new Object(); 
  3095.  
  3096. // Array : each element is a CAgencyXXX animation object
  3097. CEngine.arrAnimation = new Array();
  3098. CEngine.PerformAnimation = function( nIndex )
  3099. {// animation : update effects function
  3100.     CEngine.arrAnimation[nIndex].UpdateEffect();
  3101. }
  3102.  
  3103. CEngine.AddOneTrigger = function(TriggerID,TriggerElement)
  3104. {// add one Trigger object into the trigger array
  3105.     if( typeof(TriggerID) != "string" || TriggerElement == null ||
  3106.         typeof(TriggerElement) != "object" )
  3107.         return;
  3108.     if( typeof(CEngine.objTrigger[TriggerID] ) != "object" )
  3109.         CEngine.objTrigger[TriggerID] = new CTrigger(TriggerElement);
  3110. }
  3111.     
  3112. CEngine.AddOneTarget = function(TargetID, TargetElement)
  3113. {// add one Target object into the target array
  3114.     if( typeof(TargetID) != "string" || TargetElement == null ||
  3115.         typeof(TargetElement) != "object" )
  3116.         return;
  3117.     if( typeof(CEngine.objTarget[TargetID]) != "object" )
  3118.         CEngine.objTarget[TargetID] = new CTarget( TargetElement );
  3119. }
  3120.  
  3121. CEngine.SendEventToOneTarget = function(strTargetID, strBsscEvent )
  3122. {// to activate one target object
  3123.     if( typeof(CEngine.objTarget[strTargetID]) == "object" ) 
  3124.     {
  3125.         if( strBsscEvent == "bssctrigger1" || strBsscEvent == "bssctrigger2" )
  3126.         {//now, the "bssctrigger1" and "bssctrigger2" work like a toggle
  3127.             if( strBsscEvent == CEngine.objTarget[strTargetID].strTriggerEvent )
  3128.                 strBsscEvent = (strBsscEvent == "bssctrigger1") ? "bssctrigger2" : "bssctrigger1";
  3129.             CEngine.objTarget[strTargetID].strTriggerEvent = strBsscEvent;
  3130.         }
  3131.         CEngine.objTarget[strTargetID].OnEvent( strBsscEvent );
  3132.     }
  3133. }
  3134.  
  3135. CEngine.SendEventToAllTarget = function( strBsscEvent )
  3136. { //to activate all target associative to the BSSC event
  3137.     for( var strTargetID in CEngine.objTarget ) //to enumerate all target
  3138.         CEngine.SendEventToOneTarget( strTargetID, strBsscEvent );
  3139. }
  3140.  
  3141. CEngine.SetOneTargetInitialState = function( strTargetID )
  3142. {// only invoked after ALL effects for the target have been set
  3143.     if( typeof(CEngine.objTarget[strTargetID]) == "object" ) 
  3144.     {// to get target object
  3145.         var objTarget = CEngine.objTarget[strTargetID];
  3146.         if( objTarget.SetState( "bsscpageload" ) == false )
  3147.         {
  3148.             objTarget.SetState( "bsscpageclick" );
  3149.             objTarget.SetState( "bssctrigger1" );
  3150.         }
  3151.     }
  3152. }
  3153.  
  3154. CEngine.AdjustPageClickCounter = function()
  3155. {
  3156.     var nAdjustedClickCounter = CTarget.nPageClickCounter;
  3157.     var bAdjusted = false;
  3158.     for( var strTargetID in CEngine.objTarget ) //to enumerate all target
  3159.     {// try to find the minum pageCliclConter greater than CTarget.nPageClickCounter
  3160.         var objEventPageClick = CEngine.objTarget[strTargetID].objManager.bsscpageclick;
  3161.         if( objEventPageClick != null )
  3162.         {
  3163.             for( var i = 0; i < objEventPageClick.length; i++ )
  3164.             {
  3165.                 var nOtherPageClick = objEventPageClick[i].nPageClick;
  3166.                 if( nOtherPageClick == CTarget.nPageClickCounter )
  3167.                     return;
  3168.                 if( nOtherPageClick > CTarget.nPageClickCounter )
  3169.                 {
  3170.                     if( !bAdjusted )
  3171.                     {
  3172.                         nAdjustedClickCounter = nOtherPageClick;
  3173.                         bAdjusted = true;
  3174.                     }
  3175.                     else if( nOtherPageClick < nAdjustedClickCounter )
  3176.                         nAdjustedClickCounter = nOtherPageClick;
  3177.                 }
  3178.             }
  3179.         }
  3180.     }
  3181.     CTarget.nPageClickCounter = nAdjustedClickCounter;
  3182. }
  3183.  
  3184. CEngine.OnPageLoad = function()
  3185. {     
  3186.     // first, to set all target's initial state
  3187.     for( var strTargetID in CEngine.objTarget )
  3188.         CEngine.SetOneTargetInitialState( strTargetID );
  3189.     
  3190.     // to invoke all target's onpageload handler
  3191.     CEngine.SendEventToAllTarget( "bsscpageload" );
  3192. }
  3193.  
  3194. CEngine.OnPageClick = function()
  3195. { // to invoke all target's onpageclick handler
  3196.     var src = CCSSP.GetEventElement( arguments[0] );
  3197.     if( src == null )
  3198.         return;
  3199.         
  3200.     var objClickedTrigger = null;
  3201.     for( var strTriggerID in CEngine.objTrigger )
  3202.     { // to detect which trigger is clicked
  3203.         if( CCSSP.IsDescendant( CEngine.objTrigger[strTriggerID].eleTrigger,src) )
  3204.         {
  3205.             objClickedTrigger = CEngine.objTrigger[strTriggerID];
  3206.             break;
  3207.         }
  3208.     }
  3209.     
  3210.     if( objClickedTrigger != null) // the clicked trigger found
  3211.         objClickedTrigger.OnTriggerClick();
  3212.     else // no trigger is clicked
  3213.     { // to send PageClick event to all target
  3214.         CTarget.nPageClickCounter++;
  3215.         CEngine.AdjustPageClickCounter();
  3216.         CEngine.SendEventToAllTarget( "bsscpageclick" );
  3217.     }
  3218. }    
  3219.  
  3220. CEngine.OnMouseOver = function()
  3221. { // to invoke all target's onpageload handler
  3222.     var src = CCSSP.GetEventElement( arguments[0] );
  3223.     if( src == null )
  3224.         return;
  3225.         
  3226.     var strHoveredTargetID = null;
  3227.     for( var strTargetID in CEngine.objTarget )
  3228.     { // to detect which Target is hovering on
  3229.         if( CCSSP.IsDescendant( CEngine.objTarget[strTargetID].eleTarget, src ) )
  3230.         {
  3231.             strHoveredTargetID = strTargetID;
  3232.             break;
  3233.         }
  3234.     }
  3235.     
  3236.     if( strHoveredTargetID != null ) // the hovered target found
  3237.         CEngine.SendEventToOneTarget( strHoveredTargetID, "bsschover" );
  3238. }
  3239.  
  3240. CEngine.BuildTargetObject = function(target_ID,event_type,action_type,
  3241.             action_setting, event_additional)
  3242. {// to build target object 
  3243.     // to get the target object
  3244.     if( typeof( CEngine.objTarget[target_ID] ) != "object" )
  3245.         return false;// the engine's AddOneTarget function might have failed.
  3246.     var TargetObject = CEngine.objTarget[target_ID];
  3247.     
  3248.     // to prepare the parameters for the event manager
  3249.     var arrEvent = event_type.split("|"); // to split the combined event_type string
  3250.     var arrAction = action_type.split("|");//to split the combined action_type string
  3251.     for( var trim = 0; trim < arrEvent.length; trim++ )
  3252.         arrEvent[trim] = CCSSP.TrimSpace(arrEvent[trim]);
  3253.     
  3254.     for( trim = 0; trim < arrAction.length; trim++ )
  3255.         arrAction[trim] = CCSSP.TrimSpace(arrAction[trim]);
  3256.     
  3257.     var arrSetting = new Array(); 
  3258.     if( typeof(action_setting) == "string" )
  3259.         arrSetting = action_setting.split("|");// to split the combined action_setting string
  3260.     // to calibrate the arrays
  3261.     for( var i = arrSetting.length; i < arrAction.length; i++ )
  3262.     {
  3263.         if( typeof(arrSetting[i]) != "string" )
  3264.              arrSetting[i] = "";
  3265.     }                 
  3266.  
  3267.     // to prepare for dealing with the absolute posioning element
  3268.     TargetObject.eleTarget.ABSX = CCSSP.GetObjectLeft( TargetObject.eleTarget );
  3269.     TargetObject.eleTarget.ABSY = CCSSP.GetObjectTop( TargetObject.eleTarget );
  3270.  
  3271.     if( arrEvent.length > 1 )
  3272.     {// if event is combined, it must be : "bssctrigger1 | bssctrigger2"
  3273.         if( arrAction.length != 2 )
  3274.             return false; // if event is combined, there must be 2 actions
  3275.         for( i = 0 ; i < 2; i++ )
  3276.         {
  3277.             if( TargetObject.SetEventManager(arrEvent[i], arrAction[i], 
  3278.                 arrSetting[i], event_additional) == false )
  3279.                 return false; // the event manager has not been set up
  3280.         }
  3281.     }
  3282.     else // the event_type string is not combined
  3283.     {
  3284.         for( i = 0 ; i < arrAction.length; i++ )
  3285.         {
  3286.             TargetObject.SetEventManager(event_type, arrAction[i], arrSetting[i], event_additional);
  3287.             // to validate the event manager
  3288.             if( typeof(TargetObject.objManager[event_type]) != "object" ||
  3289.                     typeof(TargetObject.objManager[event_type][i]) != "object" )
  3290.                 return false; // the event manager has not been set up
  3291.         }
  3292.     }
  3293.     return true;
  3294. }
  3295.  
  3296. CEngine.BuildTriggerObject = function(trigger_ID, target_ID)
  3297. {// to build the trigger object
  3298.     var arrTrigger = trigger_ID.split("|"); // to split the combined trigger_ID string
  3299.     for( var i = 0; i < arrTrigger.length; i ++ )
  3300.     {// to get the trigger element then add it to the trigger list
  3301.         arrTrigger[i] = CCSSP.TrimSpace( arrTrigger[i] );
  3302.         var eleTrigger = CCSSP.GetObject( arrTrigger[i] );
  3303.         if( eleTrigger == null )
  3304.             continue; // the trigger_ID string in the HTML code maybe wrong
  3305.         CEngine.AddOneTrigger( arrTrigger[i], eleTrigger );
  3306.  
  3307.         // to get the target object
  3308.         if( typeof( this.objTrigger[arrTrigger[i]] ) != "object" )
  3309.             continue;// the engine's AddOneTarget function might have failed.
  3310.         CEngine.objTrigger[arrTrigger[i]].AddTargetID( target_ID );
  3311.     }
  3312. }
  3313. //End the definition of CEngine class
  3314.  
  3315. /// Section End  - CCSSP DHTM 1 (JavaScript 1.2)
  3316.  
  3317. /// Section Begin  - CCSSP DHTM 2 (JavaScript 1.2)
  3318.  
  3319. //Begin the definition of CAgencyXXXX classes
  3320.  
  3321. //Begin of the CAgencyShow definition
  3322. function CAgencyShow( element, bIsShow )
  3323. {
  3324.     this.ele = element;
  3325.     this.bIsShow = bIsShow;
  3326. }
  3327.  
  3328. CAgencyShow.prototype.PrepareEffect = function()
  3329. {
  3330.     CCSSP.ShowObject( this.ele, !this.bIsShow );
  3331. }
  3332.  
  3333. CAgencyShow.prototype.UpdateEffect = function()
  3334. {
  3335.     CCSSP.ShowObject( this.ele, this.bIsShow );
  3336. }
  3337.  
  3338. CAgencyShow.prototype.EndEffect = function()
  3339. {
  3340.     CCSSP.ShowObject( this.ele, !this.bIsShow );
  3341. }
  3342. // End of the CAgencyShow definition
  3343.  
  3344. // Begin of CAgencyFly definition
  3345. function CAgencyFly( element, settings, bIsIn )
  3346. {
  3347.     this.ele = element;
  3348.     this.bIsIn = bIsIn;
  3349.     this.duration = 1000; // default
  3350.     this.direction = "right";
  3351.  
  3352.     var arrAllSet = settings.split(",");
  3353.     for( var i = 0; i < arrAllSet.length; i ++ )
  3354.     {// to retrieve the setting
  3355.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3356.         var arrOneSet = arrAllSet[i].split("=");
  3357.         for( var j = 0; j < arrOneSet.length; j++ )
  3358.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3359.         switch( arrOneSet[0] )
  3360.         {
  3361.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3362.         case "direction" : this.direction = arrOneSet[1]; break;
  3363.         }
  3364.     }
  3365.         
  3366.     if( gbBsIE5 && this.ele.style.position != "absolute" )
  3367.         this.ele.style.position = "relative";
  3368.     this.timer = null;
  3369.     this.aniIndex = CEngine.arrAnimation.length;
  3370.     CEngine.arrAnimation[this.aniIndex] = this;
  3371. }
  3372.  
  3373. CAgencyFly.prototype.PrepareEffect = function()
  3374. {
  3375.     CCSSP.ShowObject(this.ele, !this.bIsIn );
  3376. }
  3377.  
  3378. CAgencyFly.prototype.UpdateEffect = function()
  3379. {
  3380.     if( this.timer == null )
  3381.         this.ResetParameters();
  3382.  
  3383.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3384.     if( percent >= 1.0 )
  3385.         this.EndEffect();
  3386.     else
  3387.     {
  3388.         var newX = this.startX*(1.0-percent) +  this.finalX*percent;
  3389.         var newY = this.startY*(1.0-percent) +  this.finalY*percent;
  3390.         CCSSP.MoveObjectTo(this.ele, newX, newY);
  3391.         if( this.timer == null )
  3392.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3393.     }
  3394. }
  3395.  
  3396. CAgencyFly.prototype.EndEffect = function()
  3397. {
  3398.     clearInterval( this.timer );
  3399.     this.timer = null;
  3400.  
  3401.     if( this.bIsIn ) // FlyIn
  3402.         CCSSP.MoveObjectTo(this.ele, this.finalX, this.finalY);
  3403.     else // FlyOut
  3404.         CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  3405.     CCSSP.ShowObject(this.ele, this.bIsIn );
  3406. }
  3407.  
  3408. CAgencyFly.prototype.ResetParameters = function()
  3409. {
  3410.     this.PrepareEffect();
  3411.     CCSSP.ShowObject(this.ele, true );
  3412.  
  3413.     this.startX = 0;
  3414.     this.startY = 0;
  3415.     this.finalX = 0;
  3416.     this.finalY = 0; 
  3417.     
  3418.     var offsetLeft = CCSSP.GetObjectWindowLeft(this.ele) + this.ele.offsetWidth;
  3419.     var offsetTop = CCSSP.GetObjectWindowTop(this.ele) + this.ele.offsetHeight;
  3420.     var offsetRight = CCSSP.GetWindowRight();
  3421.     var offsetBottom = CCSSP.GetWindowBottom();
  3422.  
  3423.     if( this.bIsIn )
  3424.     { // FlyIn
  3425.         this.finalX = this.ele.ABSX;
  3426.         this.finalY = this.ele.ABSY;
  3427.  
  3428.         switch( this.direction )
  3429.         {
  3430.         case "right": this.startX = offsetRight; this.startY = this.finalY; break;
  3431.         case "left": this.startX = -offsetLeft;  this.startY = this.finalY; break;
  3432.         case "down": this.startY = offsetBottom; this.startX = this.finalX; break;
  3433.         case "up":  this.startY = -offsetTop;    this.startX = this.finalX; break;
  3434.         case "downright":
  3435.               this.startX = ( offsetBottom < offsetRight) ? offsetBottom : offsetRight;
  3436.             this.startY = this.startX;        break;
  3437.         case "upright":
  3438.               this.startX = (offsetTop < offsetRight)? offsetTop : offsetRight;
  3439.             this.startY = -this.startX;        break;
  3440.         case "upleft":
  3441.             this.startX = -((offsetTop < offsetRight)? offsetTop : offsetRight);
  3442.             this.startY = this.startX;        break;
  3443.         case "downleft":
  3444.             this.startX = -(( offsetBottom < offsetRight) ? offsetBottom : offsetRight);
  3445.             this.startY = -this.startX;     break;
  3446.         }
  3447.     }
  3448.     else
  3449.     { // FlyOut
  3450.         this.startX = this.ele.ABSX;
  3451.         this.startY = this.ele.ABSY;
  3452.  
  3453.         switch( this.direction )
  3454.         {
  3455.         case "right": this.finalX = offsetRight;  this.finalY = this.startY; break;
  3456.         case "left": this.finalX = -offsetLeft;   this.finalY = this.startY;  break;
  3457.         case "down": this.finalY = offsetBottom;  this.finalX = this.startX; break;
  3458.         case "up":  this.finalY = -offsetTop;     this.finalX = this.startX; break;
  3459.         case "downright":
  3460.               this.finalX = ( offsetBottom < offsetRight) ? offsetBottom : offsetRight;
  3461.             this.finalY = this.finalX;        break;
  3462.         case "upright":
  3463.               this.finalX = (offsetTop < offsetRight)? offsetTop : offsetRight;
  3464.             this.finalY = -this.finalX;        break;
  3465.         case "upleft":
  3466.             this.finalX = -((offsetTop < offsetRight)? offsetTop : offsetRight);
  3467.             this.finalY = this.finalX;        break;
  3468.         case "downleft":
  3469.             this.finalX = -(( offsetBottom < offsetRight) ? offsetBottom : offsetRight);
  3470.             this.finalY = -this.finalX;     break;
  3471.         }
  3472.     }
  3473.     CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  3474.     this.startTime = (new Date()).getTime();
  3475. }
  3476. // End of the CAgencyFly definition
  3477.  
  3478. // Begin of CAgencySpiral
  3479. function CAgencySpiral( element, settings, bIsIn )
  3480. {
  3481.     this.ele = element;
  3482.     this.bIsIn = bIsIn;
  3483.     this.duration = 1000; // default
  3484.  
  3485.     var arrAllSet = settings.split(",");
  3486.     for( var i = 0; i < arrAllSet.length; i ++ )
  3487.     {// to retrieve the setting
  3488.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3489.         var arrOneSet = arrAllSet[i].split("=");
  3490.         for( var j = 0; j < arrOneSet.length; j++ )
  3491.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3492.         switch( arrOneSet[0] )
  3493.         {
  3494.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3495.         }
  3496.     }
  3497.  
  3498.     if( gbBsIE5 && this.ele.style.position != "absolute" )
  3499.         this.ele.style.position = "relative";
  3500.     this.timer = null;
  3501.     this.aniIndex = CEngine.arrAnimation.length;
  3502.     CEngine.arrAnimation[this.aniIndex] = this;
  3503. }
  3504.  
  3505. CAgencySpiral.prototype.PrepareEffect = function()
  3506. {
  3507.     CCSSP.ShowObject(this.ele, !this.bIsIn );
  3508. }
  3509.  
  3510. CAgencySpiral.prototype.UpdateEffect = function()
  3511. {
  3512.     if( this.timer == null )
  3513.         this.ResetParameters();
  3514.  
  3515.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3516.     if( percent >= 1.0 )
  3517.         this.EndEffect();
  3518.     else
  3519.     {
  3520.         var rf = (this.bIsIn)? (1.0 - percent) : percent; 
  3521.         var t = (1.0-rf) * 4.0 * Math.PI
  3522.         var rxP = (this.bIsIn)? this.startX : this.finalX; 
  3523.         var ryP = (this.bIsIn)? this.startY : this.finalY; 
  3524.         var rx = (Math.abs(rxP) < 200) ? Math.abs(rxP) : 200;
  3525.         var ry = (Math.abs(ryP) < 200) ? Math.abs(ryP) : 200;
  3526.  
  3527.         var newX = Math.ceil(-rf*Math.cos(t)*rx) + this.ele.ABSX;
  3528.         var newY = Math.ceil(-rf*Math.sin(t)*ry) + this.ele.ABSY;
  3529.         CCSSP.MoveObjectTo(this.ele, newX, newY);
  3530.         if( this.timer == null )
  3531.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3532.     }
  3533. }
  3534.  
  3535. CAgencySpiral.prototype.EndEffect = function()
  3536. {
  3537.     clearInterval( this.timer );
  3538.     this.timer = null;
  3539.     
  3540.     if( this.bIsIn ) // In
  3541.         CCSSP.MoveObjectTo(this.ele, this.finalX, this.finalY);
  3542.     else // Out
  3543.         CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  3544.     CCSSP.ShowObject(this.ele, this.bIsIn );
  3545. }
  3546.  
  3547. CAgencySpiral.prototype.ResetParameters = function()
  3548. {
  3549.     this.PrepareEffect();
  3550.     CCSSP.ShowObject(this.ele, true );
  3551.     this.startX = (this.bIsIn)? CCSSP.GetWindowRight() : this.ele.ABSX;
  3552.     this.startY = (this.bIsIn)? CCSSP.GetWindowBottom() : this.ele.ABSY;
  3553.     this.finalX = (this.bIsIn)? this.ele.ABSX : CCSSP.GetWindowRight();
  3554.     this.finalY = (this.bIsIn)? this.ele.ABSY : CCSSP.GetWindowBottom(); 
  3555.     
  3556.     CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  3557.     this.startTime = (new Date()).getTime();
  3558. }
  3559. // End of CAgencySpiral
  3560.  
  3561. // Begin of CAgencyElastic
  3562. function CAgencyElastic( element, settings)
  3563. {
  3564.     this.ele = element;
  3565.     this.duration = 1000; // default
  3566.     this.direction = "right";
  3567.  
  3568.     var arrAllSet = settings.split(",");
  3569.     for( var i = 0; i < arrAllSet.length; i ++ )
  3570.     {// to retrieve the setting
  3571.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3572.         var arrOneSet = arrAllSet[i].split("=");
  3573.         for( var j = 0; j < arrOneSet.length; j++ )
  3574.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3575.         switch( arrOneSet[0] )
  3576.         {
  3577.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3578.         case "direction" : this.direction = arrOneSet[1]; break;
  3579.         }
  3580.     }
  3581.         
  3582.     if( gbBsIE5 && this.ele.style.position != "absolute" )
  3583.         this.ele.style.position = "relative";
  3584.     this.timer = null;
  3585.     this.aniIndex = CEngine.arrAnimation.length;
  3586.     CEngine.arrAnimation[this.aniIndex] = this;
  3587. }
  3588.  
  3589. CAgencyElastic.prototype.PrepareEffect = function()
  3590. {
  3591.     CCSSP.ShowObject(this.ele, false );
  3592. }
  3593.  
  3594. CAgencyElastic.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 newX = this.startX;
  3605.         var newY = this.startY;
  3606.         var rf = Math.exp(-percent*3);
  3607.         var t = percent * 1.5 * Math.PI
  3608.         var rx = (Math.abs(this.startX) > Math.abs(this.startY)) ? this.startX : this.startY;
  3609.         switch (this.direction )
  3610.         {
  3611.         case "left":   
  3612.         case "right" : newX = rf*Math.cos(t)*rx + this.ele.ABSX; break;
  3613.         case "up":       
  3614.         case "down" :  newY = rf*Math.cos(t)*rx + this.ele.ABSX; break;
  3615.         }
  3616.         CCSSP.MoveObjectTo(this.ele, newX, newY);
  3617.         if( this.timer == null )
  3618.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3619.     }
  3620. }
  3621.  
  3622. CAgencyElastic.prototype.EndEffect = function()
  3623. {
  3624.     CCSSP.MoveObjectTo(this.ele, this.finalX, this.finalY);
  3625.     clearInterval( this.timer );
  3626.     this.timer = null;
  3627. }
  3628.  
  3629. CAgencyElastic.prototype.ResetParameters = function()
  3630. {
  3631.     CCSSP.ShowObject(this.ele, true );
  3632.     this.startX = this.ele.ABSX;
  3633.     this.finalX = this.ele.ABSX;
  3634.     this.startY = this.ele.ABSY;
  3635.     this.finalY = this.ele.ABSY;
  3636.     
  3637.     switch (this.direction)
  3638.     { 
  3639.     case "left":  this.startX = -this.ele.offsetWidth; break;
  3640.     case "right": this.startX = this.ele.offsetWidth;  break;
  3641.     case "up":    this.startY = -this.ele.offsetHeight;break;
  3642.     case "down":  this.startY = this.ele.offsetHeight; break;
  3643.     }
  3644.     CCSSP.MoveObjectTo(this.ele, this.startX, this.startY);
  3645.     this.startTime = (new Date()).getTime();
  3646. }
  3647. // End of CAgencyElastic
  3648.  
  3649. // Begin of CAgencyZoom
  3650. function CAgencyZoom( element, settings, bIsIn)
  3651. {
  3652.     this.ele = element;
  3653.     this.duration = 1000; // default
  3654.     
  3655.     var arrAllSet = settings.split(",");
  3656.     for( var i = 0; i < arrAllSet.length; i ++ )
  3657.     {// to retrieve the setting
  3658.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3659.         var arrOneSet = arrAllSet[i].split("=");
  3660.         for( var j = 0; j < arrOneSet.length; j++ )
  3661.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3662.         switch( arrOneSet[0] )
  3663.         {
  3664.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3665.         }
  3666.     }
  3667.  
  3668.     this.bIsIn = bIsIn;
  3669.     this.timer = null;
  3670.     this.aniIndex = CEngine.arrAnimation.length;
  3671.     CEngine.arrAnimation[this.aniIndex] = this;
  3672. }
  3673.  
  3674. CAgencyZoom.prototype.PrepareEffect = function()
  3675. {
  3676.     CCSSP.ShowObject(this.ele, false);
  3677. }
  3678.  
  3679. CAgencyZoom.prototype.UpdateEffect = function()
  3680. {
  3681.     if( this.timer == null )
  3682.         this.ResetParameters();
  3683.  
  3684.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3685.     if( percent >= 1.0 )
  3686.         this.EndEffect();
  3687.     else
  3688.     {
  3689.         var nFactorIn = Math.ceil(50+50*percent);
  3690.         var nFactorOut = Math.ceil(100+200*(1-percent));
  3691.         var AlterFontsize = ((this.bIsIn)? nFactorIn : nFactorOut) + "%";
  3692.         var AlterFactor = ((this.bIsIn)? nFactorIn : nFactorOut) / 100;
  3693.         
  3694.         this.UpdateEffectAllChildren(this.ele, AlterFontsize, AlterFactor);
  3695.         for(var index = 0; index < this.ele.all.length; index++)
  3696.             this.UpdateEffectAllChildren(this.ele.all[index], AlterFontsize, AlterFactor);
  3697.             
  3698.         if( this.timer == null )
  3699.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3700.     }
  3701. }
  3702.  
  3703. CAgencyZoom.prototype.UpdateEffectAllChildren = function(child, FontSize, Factor)
  3704. {
  3705.     if( CCSSP.IsTextTag(child) )
  3706.         child.style.fontSize = FontSize;
  3707.     else
  3708.     {
  3709.         if( typeof(child.orgWidth) == "number" )
  3710.             child.style.width = Factor * child.orgWidth;
  3711.         if( typeof(child.orgHeight) == "number" )
  3712.             child.style.height = Factor * child.orgHeight;
  3713.     }
  3714. }
  3715.  
  3716. CAgencyZoom.prototype.EndEffect = function()
  3717. {
  3718.     this.EndEffectAllChildren(this.ele);
  3719.     for(var index = 0; index < this.ele.all.length; index++)
  3720.         this.EndEffectAllChildren(this.ele.all[index]);
  3721.     
  3722.     clearInterval( this.timer );
  3723.     this.timer = null;
  3724. }
  3725.  
  3726. CAgencyZoom.prototype.EndEffectAllChildren = function( child )
  3727. {    
  3728.     if( CCSSP.IsTextTag(child) )
  3729.         child.style.fontSize = child.orgFontSize;
  3730.     else
  3731.     {
  3732.         if( typeof(child.intactWidth) != "undefined" )
  3733.         {
  3734.             child.width = child.intactWidth;
  3735.             child.height = child.intactHeight;
  3736.         }
  3737.         else if( typeof(child.style.intactPixelWidth) != "undefined" )
  3738.         {
  3739.             child.style.pixelWidth = child.style.intactPixelWidth;
  3740.             child.style.pixelHeight = child.style.intactPixelHeight;
  3741.         }
  3742.     }
  3743. }
  3744.  
  3745. CAgencyZoom.prototype.ResetParameters = function()
  3746. {
  3747.     this.PrepareEffect();
  3748.     this.ResetParametersAllChildren( this.ele );
  3749.     for(var index = 0; index < this.ele.all.length; index++)
  3750.         this.ResetParametersAllChildren(this.ele.all[index]);
  3751.         
  3752.     this.startTime = (new Date()).getTime();
  3753. }
  3754.  
  3755. CAgencyZoom.prototype.ResetParametersAllChildren = function( child )
  3756. {
  3757.     CCSSP.ShowObject(child, true );
  3758.     if( (child.tagName == "DIV") && (getParentNode(child).tagName == "TD") )
  3759.         child.width = "100%";// if the div is inside a cell of table, we need the this hack
  3760.     
  3761.     if( CCSSP.IsTextTag(child) )
  3762.         child.orgFontSize = child.style.fontSize;
  3763.     else
  3764.     {
  3765.         if( child.width > "" || child.height > "" )
  3766.         {
  3767.             child.orgWidth = child.intactWidth = child.width;
  3768.             child.orgHeight = child.intactHeight = child.height;
  3769.         }
  3770.         else if( ( typeof(child.orgWidth) != "number" ) && (typeof(child.orgHeight) != "number") )
  3771.         {
  3772.             child.orgWidth = child.style.intactPixelWidth = child.style.pixelWidth;
  3773.             child.orgHeight = child.style.intactPixelHeight = child.style.pixelHeight;
  3774.         }
  3775.     }
  3776. }
  3777. // End of CAgencyZoom
  3778.  
  3779. //// the following effects will use IE's exclusive "filter" function ////
  3780. // Begin of CAgencyAlpha definition
  3781. function CAgencyAlpha( element, settings, bIsIn )
  3782. {// because of "visual filter" style, this won't work in Navigator
  3783.     this.ele = element;
  3784.     this.bIsIn = bIsIn;
  3785.  
  3786.     // to set the default value
  3787.     this.startOpacity = (this.bIsIn) ? 0 : 100;
  3788.     this.endOpacity = (this.bIsIn) ? 100 : 0;
  3789.     
  3790.     this.duration = 1000; // default
  3791.     
  3792.     var arrAllSet = settings.split(",");
  3793.     for( var i = 0; i < arrAllSet.length; i ++ )
  3794.     {// to retrieve the setting
  3795.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3796.         var arrOneSet = arrAllSet[i].split("=");
  3797.         for( var j = 0; j < arrOneSet.length; j++ )
  3798.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3799.         switch( arrOneSet[0] )
  3800.         {
  3801.         case "speed" : this.duration = 100000/arrOneSet[1]; break;
  3802.         }
  3803.     }
  3804.     
  3805.     this.timer = null;
  3806.     this.aniIndex = CEngine.arrAnimation.length;
  3807.     CEngine.arrAnimation[this.aniIndex] = this;
  3808. }
  3809.  
  3810. CAgencyAlpha.prototype.PrepareEffect = function()
  3811. {// to set the visual filter function
  3812.     // the visual filter ONLY work when set by "Width and Height" or
  3813.     // absolute position for DIV, SPAN and normal tag ( such as p )
  3814.     // but, "absolute" cause the following elements overlap, so:
  3815.     CCSSP.PrepareFilter( this.ele );
  3816.     CCSSP.ShowObject(this.ele, !this.bIsIn );
  3817. }
  3818.  
  3819. CAgencyAlpha.prototype.UpdateEffect = function()
  3820. {// to set the visual filter function
  3821.     if( this.timer == null )
  3822.         this.ResetParameters();
  3823.     if( typeof(this.ele.filters.alpha) != "object" )
  3824.     {
  3825.         this.EndEffect();
  3826.         return;
  3827.     }
  3828.  
  3829.     var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3830.     if( percent >= 1.0 )
  3831.         this.EndEffect();
  3832.     else if( typeof(this.ele.filters.alpha) == "object" )
  3833.     {
  3834.         this.ele.filters.alpha.opacity = this.startOpacity*(1.0-percent) + this.endOpacity*percent;
  3835.         if( this.timer == null )
  3836.             this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 20 );
  3837.     }
  3838. }
  3839.  
  3840. CAgencyAlpha.prototype.EndEffect = function()
  3841. {// to remove the visual filter function
  3842.     clearInterval( this.timer );
  3843.     this.timer = null;
  3844.     this.ele.style.filter = "";
  3845.     CCSSP.ShowObject(this.ele, this.bIsIn );
  3846. }
  3847.  
  3848. CAgencyAlpha.prototype.ResetParameters = function()
  3849. {
  3850.     this.PrepareEffect();
  3851.     CCSSP.ShowObject(this.ele, true );
  3852.     this.ele.style.filter = "alpha(opacity=" + this.startOpacity + ")";
  3853.     this.startTime = (new Date()).getTime();
  3854. }
  3855. // End of the CAgencyAlpha definition
  3856.  
  3857. // Begin of CAgencyWave definition
  3858. function CAgencyWave( element, settings )
  3859. {// because of "visual filter" style, this won't work in Navigator
  3860.     this.ele = element;
  3861.  
  3862.     this.duration = 0; // default
  3863.     this.strength = 10;
  3864.     this.freq = 1;
  3865.     this.lightstrength = 1;
  3866.     
  3867.     var arrAllSet = settings.split(",");
  3868.     for( var i = 0; i < arrAllSet.length; i ++ )
  3869.     {// to retrieve the setting
  3870.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3871.         var arrOneSet = arrAllSet[i].split("=");
  3872.         for( var j = 0; j < arrOneSet.length; j++ )
  3873.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3874.         switch( arrOneSet[0] )
  3875.         {
  3876.         case "duration" : this.duration = 100000/arrOneSet[1]; break;
  3877.         case "strength" : this.strength = arrOneSet[1]; break;
  3878.         case "freq" : this.freq = arrOneSet[1]; break;
  3879.         case "lightstrength" : this.lightstrength = arrOneSet[1]; break;
  3880.         }
  3881.     }
  3882.  
  3883.     this.timer = null;
  3884.     this.aniIndex = CEngine.arrAnimation.length;
  3885.     CEngine.arrAnimation[this.aniIndex] = this;
  3886. }
  3887.  
  3888. CAgencyWave.prototype.PrepareEffect = function()
  3889. {// to set the visual filter function
  3890.     CCSSP.PrepareFilter(this.ele);
  3891.  
  3892.     CCSSP.ShowObject(this.ele, true );
  3893. }
  3894.  
  3895. CAgencyWave.prototype.UpdateEffect = function()
  3896. {// to set the visual filter function
  3897.     if( this.timer == null )
  3898.         this.ResetParameters();
  3899.     if( typeof(this.ele.filters.wave) != "object" )
  3900.     {
  3901.         this.EndEffect();
  3902.         return;
  3903.     }
  3904.  
  3905.     if( this.duration > 0 )
  3906.     {
  3907.         var percent = ((new Date()).getTime() - this.startTime)/this.duration;
  3908.         if( percent >= 1.0 )
  3909.         {
  3910.             this.EndEffect();
  3911.             return;
  3912.         }
  3913.     }
  3914.     
  3915.     this.ele.filters.wave.phase += 5;
  3916.     this.ele.filters.wave.phase %= 100;
  3917.     if( this.timer == null )
  3918.         this.timer = setInterval("CEngine.PerformAnimation(" + this.aniIndex + ")", 50 );
  3919. }
  3920.  
  3921. CAgencyWave.prototype.EndEffect = function()
  3922. {// to remove the visual filter function
  3923.     this.ele.style.filter = "";
  3924.     clearInterval( this.timer );
  3925.     this.timer = null;
  3926. }
  3927.  
  3928. CAgencyWave.prototype.ResetParameters = function()
  3929. {
  3930.     this.PrepareEffect();
  3931.     this.ele.style.filter = "wave(strength=" + this.strength + ",freq=" + 
  3932.      this.freq +", lightstrength=" + this.lightstrength +",phase=0);";
  3933.     this.startTime = (new Date()).getTime();
  3934. }
  3935. // End of the CAgencyWave definition
  3936.  
  3937. // Begin of CAgencyGlow definition
  3938. function CAgencyGlow( element, settings )
  3939. {// because of "visual filter" style, this won't work in Navigator
  3940.     this.ele = element;
  3941.  
  3942.     // to set the default value
  3943.     this.glowColor = "green";
  3944.     this.glowStrength = "3";
  3945.     
  3946.     var arrAllSet = settings.split(",");
  3947.     for( var i = 0; i < arrAllSet.length; i ++ )
  3948.     {
  3949.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  3950.         var arrOneSet = arrAllSet[i].split("=");
  3951.         for( var j = 0; j < arrOneSet.length; j++ )
  3952.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  3953.         switch( arrOneSet[0] )
  3954.         {
  3955.         case "color" : this.glowColor = arrOneSet[1]; break;
  3956.         case "strength" : this.glowStrength = arrOneSet[1]; break;
  3957.         }
  3958.     }
  3959. }
  3960.  
  3961. CAgencyGlow.prototype.PrepareEffect = function()
  3962. {
  3963.     CCSSP.PrepareFilter(this.ele);
  3964.     CCSSP.ShowObject(this.ele, true );
  3965.     if( this.ele.style.backgroundColor != "" )
  3966.     {//style.backgroundColor somehow stop the visual filter
  3967.         this.ele.intactBackgroundColor = this.ele.style.backgroundColor;
  3968.         this.ele.style.backgroundColor = "";
  3969.     }
  3970. }
  3971.  
  3972. CAgencyGlow.prototype.UpdateEffect = function()
  3973. {// to set the visual filter function
  3974.     this.PrepareEffect();
  3975.     this.ele.style.filter = "glow(Color=" + this.glowColor + ", Strength=" + 
  3976.         this.glowStrength + ", enabled=true" +")";
  3977. }
  3978.  
  3979. CAgencyGlow.prototype.EndEffect = function()
  3980. {// to remove the visual filter function
  3981.     this.ele.style.filter = "";
  3982.     if( typeof(this.ele.intactBackgroundColor) != "undefined" )
  3983.         this.ele.style.backgroundColor = this.ele.intactBackgroundColor;
  3984. }
  3985. // End of the CAgencyGlow definition
  3986.  
  3987. // Begin of CAgencyDropShadow definition
  3988. function CAgencyDropShadow( element, settings )
  3989. {// because of "visual filter" style, this won't work in Navigator
  3990.     this.ele = element;
  3991.  
  3992.     // to set the default value
  3993.     this.shadowColor = "black"; 
  3994.     this.shadowOffx = "1";
  3995.     this.shadowOffy = "1";
  3996.     
  3997.     var arrAllSet = settings.split(",");
  3998.     for( var i = 0; i < arrAllSet.length; i ++ )
  3999.     {
  4000.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  4001.         var arrOneSet = arrAllSet[i].split("=");
  4002.         for( var j = 0; j < arrOneSet.length; j++ )
  4003.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  4004.         switch( arrOneSet[0] )
  4005.         {
  4006.         case "color" : this.shadowColor = arrOneSet[1]; break;
  4007.         case "offx" : this.shadowOffx = arrOneSet[1]; break;
  4008.         case "offy" : this.shadowOffy = arrOneSet[1]; break;
  4009.         }
  4010.     }
  4011. }
  4012.  
  4013. CAgencyDropShadow.prototype.PrepareEffect = function()
  4014. {
  4015.     CCSSP.PrepareFilter(this.ele);
  4016.     CCSSP.ShowObject(this.ele, true );
  4017.     
  4018.     if( this.ele.style.backgroundColor != "" )
  4019.     {//style.backgroundColor somehow stop the visual filter
  4020.         this.ele.intactBackgroundColor = this.ele.style.backgroundColor;
  4021.         this.ele.style.backgroundColor = "";
  4022.     }
  4023. }
  4024.  
  4025. CAgencyDropShadow.prototype.UpdateEffect = function()
  4026. {// to set the visual filter function
  4027.     this.PrepareEffect();
  4028.     this.ele.style.filter = "dropshadow(color=" + this.shadowColor + ", offx=" + 
  4029.         this.shadowOffx + ", offy=" + this.shadowOffy + ")";
  4030. }
  4031.  
  4032. CAgencyDropShadow.prototype.EndEffect = function()
  4033. {// to remove the visual filter function
  4034.     this.ele.style.filter = "";
  4035.     if( typeof(this.ele.intactBackgroundColor) != "undefined" )
  4036.         this.ele.style.backgroundColor = this.ele.intactBackgroundColor;
  4037. }
  4038. // End of the CAgencyDropShadow definition
  4039.  
  4040. // Begin of CAgencyRevealTrans definition
  4041. function CAgencyRevealTrans( element, settings )
  4042. {// because of "visual filter" style, this won't work in Navigator
  4043.     this.ele = element;
  4044.  
  4045.     // to set the default value
  4046.     this.duration = 1.0; //The value is specified in seconds.milliseconds format (0.0000).
  4047.     this.transition = 0;
  4048.     
  4049.     var arrAllSet = settings.split(",");
  4050.     for( var i = 0; i < arrAllSet.length; i ++ )
  4051.     {
  4052.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  4053.         var arrOneSet = arrAllSet[i].split("=");
  4054.         for( var j = 0; j < arrOneSet.length; j++ )
  4055.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  4056.         switch( arrOneSet[0] )
  4057.         {
  4058.         case "type" : this.transition = arrOneSet[1]; break;
  4059.         case "duration" : this.duration = 100/arrOneSet[1];    break;
  4060.         }
  4061.     }
  4062. }
  4063.  
  4064. CAgencyRevealTrans.prototype.PrepareEffect = function()
  4065. {
  4066.     CCSSP.PrepareFilter(this.ele);
  4067.     CCSSP.ShowObject( this.ele, false);
  4068. }
  4069.  
  4070. CAgencyRevealTrans.prototype.UpdateEffect = function()
  4071. {// to set the visual filter function
  4072.     if( typeof( this.ele.filters.RevealTrans ) == "object" )
  4073.     {
  4074.         if( this.ele.filters.RevealTrans.status == 2 )
  4075.             this.ele.filters.RevealTrans.stop();  
  4076.     }
  4077.  
  4078.     this.PrepareEffect();
  4079.     
  4080.     this.ele.style.filter = "RevealTrans(duration=" + this.duration + 
  4081.         ", transition=" + this.transition + ")";
  4082.     
  4083.     if( typeof( this.ele.filters.RevealTrans ) == "object" )
  4084.     {
  4085.         this.ele.filters.RevealTrans.apply();
  4086.         CCSSP.ShowObject( this.ele, true);
  4087.         this.ele.filters.RevealTrans.play();  
  4088.     }
  4089.     else
  4090.         CCSSP.ShowObject( this.ele, true);
  4091. }
  4092.  
  4093. CAgencyRevealTrans.prototype.EndEffect = function()
  4094. {
  4095.     if( typeof( this.ele.filters.RevealTrans ) == "object" )
  4096.         this.ele.filters.RevealTrans.stop();  
  4097.     this.ele.style.filter = "";
  4098. }
  4099. // End of the CAgencyRevealTrans definition
  4100.  
  4101. // Begin of CAgencyBlur definition
  4102. function CAgencyBlur( element, settings )
  4103. {// because of "visual filter" style, this won't work in Navigator
  4104.     this.ele = element;
  4105.  
  4106.     // to set the default value
  4107.     this.strength = "5";
  4108.     this.direction = "90";
  4109.     
  4110.     var arrAllSet = settings.split(",");
  4111.     for( var i = 0; i < arrAllSet.length; i ++ )
  4112.     {
  4113.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  4114.         var arrOneSet = arrAllSet[i].split("=");
  4115.         for( var j = 0; j < arrOneSet.length; j++ )
  4116.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  4117.         switch( arrOneSet[0] )
  4118.         {
  4119.         case "strength" : this.strength = arrOneSet[1]; break;
  4120.         case "direction" : this.direction = arrOneSet[1]; break;
  4121.         }
  4122.     }
  4123. }
  4124.  
  4125. CAgencyBlur.prototype.PrepareEffect = function()
  4126. {
  4127.     CCSSP.PrepareFilter(this.ele);
  4128.     CCSSP.ShowObject(this.ele, true );
  4129. }
  4130.  
  4131. CAgencyBlur.prototype.UpdateEffect = function()
  4132. {// to set the visual filter function
  4133.     CCSSP.PrepareFilter(this.ele);
  4134.     this.ele.style.filter = "blur(strength=" + this.strength + 
  4135.         ", direction=" + this.direction + ")";
  4136. }
  4137.  
  4138. CAgencyBlur.prototype.EndEffect = function()
  4139. {// to remove the visual filter function
  4140.     this.ele.style.filter = "";
  4141. }
  4142. // End of the CAgencyBlur definition
  4143.  
  4144. // Begin of CAgencyChangeFilter definition
  4145. function CAgencyChangeFilter( element, settings ) // flipH, flipV, invert, grey,
  4146. {// because of "visual filter" style, this won't work in Navigator
  4147.     this.ele = element;
  4148.  
  4149.     // to set the default value
  4150.     this.filterFunction = settings;
  4151. }
  4152.  
  4153. CAgencyChangeFilter.prototype.PrepareEffect = function()
  4154. {
  4155.     CCSSP.PrepareFilter(this.ele);
  4156.     CCSSP.ShowObject(this.ele, true );
  4157. }
  4158.  
  4159. CAgencyChangeFilter.prototype.UpdateEffect = function()
  4160. {// to set the visual filter function
  4161.     CCSSP.PrepareFilter(this.ele);
  4162.     this.ele.style.filter = this.filterFunction;
  4163. }
  4164.  
  4165. CAgencyChangeFilter.prototype.EndEffect = function()
  4166. {// to remove the visual filter function
  4167.     this.ele.style.filter = "";
  4168. }
  4169. // End of the CAgencyChangeFilter definition
  4170.  
  4171. // The effects below change the style on the fly, so they won't work in Navigator
  4172.  
  4173. // Begin of CAgencyFontChange definition, 
  4174. function CAgencyFontChange( element, settings )
  4175. {//this class can be replace by CAgencyChangeStyle,provided the "settings" is standard CSS string.
  4176.     this.ele = element;
  4177.     
  4178.     // to retrieve the original font style
  4179.     this.RetrieveOldFont( this.ele );
  4180.     
  4181.     // to set the default font to change
  4182.     this.newfontFamily = this.ele.oldFontFamily;
  4183.     this.newfColor = this.ele.oldColor;
  4184.     this.newtextDecoration = this.ele.oldTextDecoration;
  4185.     this.newfontWeight = this.ele.oldFontWeight;
  4186.     this.newfontStyle = this.ele.oldFontStyle;
  4187.     this.newfontSize = this.ele.oldFontSize;
  4188.     this.newBackgroundColor = this.ele.oldBackgroundColor;
  4189.     
  4190.     var arrAllSet = settings.split(",");
  4191.     for( var i = 0; i < arrAllSet.length; i ++ )
  4192.     {// to retrieve the setting
  4193.         arrAllSet[i] = CCSSP.TrimSpace(arrAllSet[i]);
  4194.         var arrOneSet = arrAllSet[i].split("=");
  4195.         for( var j = 0; j < arrOneSet.length; j++ )
  4196.             arrOneSet[j] = CCSSP.TrimSpace(arrOneSet[j]);
  4197.         switch( arrOneSet[0] )
  4198.         {
  4199.         case "font-family" : this.newfontFamily = arrOneSet[1]; break;
  4200.         case "color" : this.newfColor = arrOneSet[1]; break;
  4201.         case "underline" : this.newtextDecoration = (arrOneSet[1]=="on")? "underline" : "none"; break;
  4202.         case "bold" : this.newfontWeight = (arrOneSet[1]=="on")? "bold" : "normal"; break;
  4203.         case "italic" : this.newfontStyle = (arrOneSet[1]=="on")? "italic" : "normal"; break;
  4204.         case "size" : this.newfontSize = arrOneSet[1]; break;
  4205.         case "background-color" : this.newBackgroundColor = arrOneSet[1]; break;
  4206.         }
  4207.     }
  4208. }
  4209.  
  4210. CAgencyFontChange.prototype.RetrieveOldFont = function(objChild)
  4211. {
  4212.     if( typeof(objChild.oldFontFamily) == "undefined" )
  4213.         objChild.oldFontFamily = objChild.style.fontFamily;
  4214.     if( typeof(objChild.oldColor) == "undefined" )
  4215.         objChild.oldColor = objChild.style.color;
  4216.     if( typeof(objChild.oldTextDecoration) == "undefined" )
  4217.         objChild.oldTextDecoration = objChild.style.textDecoration;
  4218.     if( typeof(objChild.oldFontWeight) == "undefined" )
  4219.         objChild.oldFontWeight = objChild.style.fontWeight;
  4220.     if( typeof(objChild.oldFontStyle) == "undefined" )
  4221.         objChild.oldFontStyle = objChild.style.fontStyle;
  4222.     if( typeof(objChild.oldFontSize) == "undefined" )
  4223.         objChild.oldFontSize = objChild.style.fontSize;
  4224.     if( typeof(objChild.oldBackgroundColor) == "undefined" )
  4225.         objChild.oldBackgroundColor = objChild.style.backgroundColor;
  4226. }
  4227.  
  4228. CAgencyFontChange.prototype.PrepareEffect = function()
  4229. {
  4230.     // as for expanding text, the child is created after the constructor called
  4231.     for(var index = 0; index < this.ele.all.length; index++)
  4232.         this.RetrieveOldFont(this.ele.all[index]);
  4233.     CCSSP.ShowObject(this.ele, true );
  4234. }
  4235.  
  4236. CAgencyFontChange.prototype.UpdateEffect = function()
  4237. {// to change the font
  4238.     this.PrepareEffect();
  4239.     this.UpdateEffectAllChildren( this.ele );
  4240.     for( var index = 0; index < this.ele.all.length; index++)
  4241.         this.UpdateEffectAllChildren(this.ele.all[index]);
  4242. }
  4243.  
  4244. CAgencyFontChange.prototype.UpdateEffectAllChildren = function(objChild)
  4245. {
  4246.     objChild.style.fontFamily = this.newfontFamily;
  4247.     objChild.style.color = this.newfColor;
  4248.     objChild.style.textDecoration = this.newtextDecoration;
  4249.     objChild.style.fontWeight = this.newfontWeight;
  4250.     objChild.style.fontStyle = this.newfontStyle;
  4251.     objChild.style.fontSize = this.newfontSize;
  4252.     objChild.style.backgroundColor = this.newBackgroundColor;
  4253. }
  4254.  
  4255. CAgencyFontChange.prototype.EndEffect = function()
  4256. {// to reinstate the original font style
  4257.     this.EndEffectAllChildren( this.ele );
  4258.     for( var index = 0; index < this.ele.all.length; index++)
  4259.         this.EndEffectAllChildren(this.ele.all[index]);
  4260. }
  4261.  
  4262. CAgencyFontChange.prototype.EndEffectAllChildren = function( objChild )
  4263. {
  4264.     if( typeof(objChild.oldFontFamily) != "undefined" )
  4265.         objChild.style.fontFamily = objChild.oldFontFamily;
  4266.     if( typeof(objChild.oldColor) != "undefined" )
  4267.         objChild.style.color = objChild.oldColor;
  4268.     if( typeof(objChild.oldFontWeight) != "undefined" )
  4269.         objChild.style.fontWeight = objChild.oldFontWeight;
  4270.     if( typeof(objChild.oldFontStyle) != "undefined" )
  4271.         objChild.style.fontStyle = objChild.oldFontStyle;
  4272.     if( typeof(objChild.oldFontSize) != "undefined" )
  4273.         objChild.style.fontSize = objChild.oldFontSize;
  4274.     if( typeof(objChild.oldTextDecoration) != "undefined" )
  4275.         objChild.style.textDecoration = objChild.oldTextDecoration;
  4276.     if( typeof(objChild.oldBackgroundColor) != "undefined" )
  4277.         objChild.style.backgroundColor = objChild.oldBackgroundColor;
  4278. }
  4279. // End of the CAgencyFontChange definition
  4280.  
  4281. // Begin of the CAgencyChangeStyle definition
  4282. function CAgencyChangeStyle( element, settings )
  4283. {//this class can be replace by CAgencyChangeStyle,provided the "settings" is standard CSS string.
  4284.     this.ele = element;
  4285.     
  4286.     // to retrieve the original style
  4287.     this.oldstyle = this.ele.style.cssText;
  4288.     
  4289.     // to set the default style
  4290.     this.newStyle = this.oldstyle;
  4291.     
  4292.     if( typeof(settings) == "string" && settings.length > 1 )
  4293.         this.newStyle = this.oldstyle + " " + settings;
  4294. }
  4295.  
  4296. CAgencyChangeStyle.prototype.PrepareEffect = function()
  4297. {
  4298.     CCSSP.ShowObject(this.ele, true );
  4299. }
  4300.  
  4301. CAgencyChangeStyle.prototype.UpdateEffect = function()
  4302. {// to change the style
  4303.     this.ele.style.cssText = this.newStyle;
  4304. }
  4305.  
  4306. CAgencyChangeStyle.prototype.EndEffect = function()
  4307. {// to reinstate the original style
  4308.     this.ele.style.cssText = this.oldStyle;
  4309. }
  4310. // End of the CAgencyChangeStyle definition
  4311.  
  4312. //End the definition of CAgencyXXXX classes
  4313.  
  4314. //Begin to collaborate with other event handler settings 
  4315. CCSSP.RegisterEventHandler( window, "onload", "CEngine.OnPageLoad();BSSCOnLoad();InitTriggersInHead();");
  4316. CCSSP.RegisterEventHandler( document, "onclick", "CEngine.OnPageClick();BSSCOnClick();");
  4317. CCSSP.RegisterEventHandler( document, "onmouseover", "CEngine.OnMouseOver();BSSCOnMouseOver();" );
  4318. CCSSP.RegisterEventHandler( document, "onmouseout", "CEngine.OnMouseOver();BSSCOnMouseOut();" );
  4319. CCSSP.RegisterEventHandler( window, "onunload", "BSSCOnUnload();");
  4320. //End to collaborate with other event handler settings
  4321.  
  4322. /// Section End  - CCSSP DHTM 2 (JavaScript 1.2)
  4323.  
  4324. //// Segmen
  4325.