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