root/trunk/dhtml/js/wz_tooltip.js

Revision 70, 34.3 kB (checked in by root, 2 years ago)

Remove dhtmltooltip and replace with wz_tooltip

Line 
1 /* This notice must be untouched at all times.
2 Copyright (c) 2002-2008 Walter Zorn. All rights reserved.
3
4 wz_tooltip.js    v. 5.01
5
6 The latest version is available at
7 http://www.walterzorn.com
8 or http://www.devira.com
9 or http://www.walterzorn.de
10
11 Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com )
12 Last modified: 26.3.2008
13
14 Easy-to-use cross-browser tooltips.
15 Just include the script at the beginning of the <body> section, and invoke
16 Tip('Tooltip text') from the desired HTML onmouseover eventhandlers,
17 and UnTip(), usually from the onmouseout eventhandlers, to hide the tip.
18 No container DIV required.
19 By default, width and height of tooltips are automatically adapted to content.
20 Is even capable of dynamically converting arbitrary HTML elements to tooltips
21 by calling TagToTip('ID_of_HTML_element_to_be_converted') instead of Tip(),
22 which means you can put important, search-engine-relevant stuff into tooltips.
23 Appearance of tooltips can be individually configured
24 via commands passed to Tip() or TagToTip().
25
26 Tab Width: 4
27 LICENSE: LGPL
28
29 This library is free software; you can redistribute it and/or
30 modify it under the terms of the GNU Lesser General Public
31 License (LGPL) as published by the Free Software Foundation; either
32 version 2.1 of the License, or (at your option) any later version.
33
34 This library is distributed in the hope that it will be useful,
35 but WITHOUT ANY WARRANTY; without even the implied warranty of
36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
37
38 For more details on the GNU Lesser General Public License,
39 see http://www.gnu.org/copyleft/lesser.html
40 */
41
42 var config = new Object();
43
44
45 //===================  GLOBAL TOOPTIP CONFIGURATION  =========================//
46 var  tt_Debug   = true          // false or true - recommended: false once you release your page to the public
47 var  tt_Enabled = true          // Allows to (temporarily) suppress tooltips, e.g. by providing the user with a button that sets this global variable to false
48 var  TagsToTip  = true          // false or true - if true, HTML elements to be converted to tooltips via TagToTip() are automatically hidden;
49                                                         // if false, you should hide those HTML elements yourself
50
51 // For each of the following config variables there exists a command, which is
52 // just the variablename in uppercase, to be passed to Tip() or TagToTip() to
53 // configure tooltips individually. Individual commands override global
54 // configuration. Order of commands is arbitrary.
55 // Example: onmouseover="Tip('Tooltip text', LEFT, true, BGCOLOR, '#FF9900', FADEIN, 400)"
56
57 config. Above                   = false         // false or true - tooltip above mousepointer
58 config. BgColor = '#E2E7FF' // Background colour (HTML colour value, in quotes)
59 config. BgImg = ''            // Path to background image, none if empty string ''
60 config. BorderColor             = '#003099'
61 config. BorderStyle             = 'solid'       // Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
62 config. BorderWidth             = 1
63 config. CenterMouse             = false         // false or true - center the tip horizontally below (or above) the mousepointer
64 config. ClickClose = false         // false or true - close tooltip if the user clicks somewhere
65 config. ClickSticky = false         // false or true - make tooltip sticky if user left-clicks on the hovered element while the tooltip is active
66 config. CloseBtn = false         // false or true - closebutton in titlebar
67 config. CloseBtnColors  = ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF']    // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colours
68 config. CloseBtnText = '&nbsp;X&nbsp;'       // Close button text (may also be an image tag)
69 config. CopyContent = true          // When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
70 config. Delay                   = 400           // Time span in ms until tooltip shows up
71 config. Duration                = 0             // Time span in ms after which the tooltip disappears; 0 for infinite duration, < 0 for delay in ms _after_ the onmouseout until the tooltip disappears
72 config. FadeIn                  = 0             // Fade-in duration in ms, e.g. 400; 0 for no animation
73 config. FadeOut                 = 0
74 config. FadeInterval    = 30            // Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
75 config. Fix = null          // Fixated position - x- an y-oordinates in brackets, e.g. [210, 480], or null for no fixation
76 config. FollowMouse = true          // false or true - tooltip follows the mouse
77 config. FontColor               = '#000044'
78 config. FontFace                = 'Verdana,Geneva,sans-serif'
79 config. FontSize                = '8pt'         // E.g. '9pt' or '12px' - unit is mandatory
80 config. FontWeight = 'normal'      // 'normal' or 'bold';
81 config. Height                  = 0             // Tooltip height; 0 for automatic adaption to tooltip content, < 0 (e.g. -100) for a maximum for automatic adaption
82 config. JumpHorz = false         // false or true - jump horizontally to other side of mouse if tooltip would extend past clientarea boundary
83 config. JumpVert = true          // false or true - jump vertically              "
84 config. Left = false         // false or true - tooltip on the left of the mouse
85 config. OffsetX                 = 14            // Horizontal offset of left-top corner from mousepointer
86 config. OffsetY                 = 8             // Vertical offset
87 config. Opacity                 = 100           // Integer between 0 and 100 - opacity of tooltip in percent
88 config. Padding                 = 3             // Spacing between border and content
89 config. Shadow = false         // false or true
90 config. ShadowColor             = '#C0C0C0'
91 config. ShadowWidth             = 5
92 config. Sticky                  = false         // false or true - fixate tip, ie. don't follow the mouse and don't hide on mouseout
93 config. TextAlign = 'left'        // 'left', 'right' or 'justify'
94 config. Title = ''            // Default title text applied to all tips (no default title: empty string '')
95 config. TitleAlign = 'left'        // 'left' or 'right' - text alignment inside the title bar
96 config. TitleBgColor = ''            // If empty string '', BorderColor will be used
97 config. TitleFontColor = '#FFFFFF'     // Color of title text - if '', BgColor (of tooltip body) will be used
98 config. TitleFontFace = ''            // If '' use FontFace (boldified)
99 config. TitleFontSize = ''            // If '' use FontSize
100 config. Width                   = 0             // Tooltip width; 0 for automatic adaption to tooltip content; < -1 (e.g. -240) for a maximum width for that automatic adaption;
101                                                                         // -1: tooltip width confined to the width required for the titlebar
102 //=======  END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW  ==============//
103
104
105
106
107 //=====================  PUBLIC  =============================================//
108 function Tip()
109 {
110         tt_Tip(arguments, null);
111 }
112 function TagToTip()
113 {
114         var t2t = tt_GetElt(arguments[0]);
115         if(t2t)
116                 tt_Tip(arguments, t2t);
117 }
118 function UnTip()
119 {
120         tt_OpReHref();
121         if(tt_aV[DURATION] < 0)
122                 tt_tDurt.Timer("tt_HideInit()", -tt_aV[DURATION], true);
123         else if(!(tt_aV[STICKY] && (tt_iState & 0x2)))
124                 tt_HideInit();
125 }
126
127 //==================  PUBLIC PLUGIN API  =====================================//
128 // Extension eventhandlers currently supported:
129 // OnLoadConfig, OnCreateContentString, OnSubDivsCreated, OnShow, OnMoveBefore,
130 // OnMoveAfter, OnHideInit, OnHide, OnKill
131
132 var tt_aElt = new Array(10), // Container DIV, outer title & body DIVs, inner title & body TDs, closebutton SPAN, shadow DIVs, and IFRAME to cover windowed elements in IE
133 tt_aV = new Array(),    // Caches and enumerates config data for currently active tooltip
134 tt_sContent,                    // Inner tooltip text or HTML
135 tt_scrlX = 0, tt_scrlY = 0,
136 tt_musX, tt_musY,
137 tt_over,
138 tt_x, tt_y, tt_w, tt_h; // Position, width and height of currently displayed tooltip
139
140 function tt_Extension()
141 {
142         tt_ExtCmdEnum();
143         tt_aExt[tt_aExt.length] = this;
144         return this;
145 }
146 function tt_SetTipPos(x, y)
147 {
148         var css = tt_aElt[0].style;
149
150         tt_x = x;
151         tt_y = y;
152         css.left = x + "px";
153         css.top = y + "px";
154         if(tt_ie56)
155         {
156                 var ifrm = tt_aElt[tt_aElt.length - 1];
157                 if(ifrm)
158                 {
159                         ifrm.style.left = css.left;
160                         ifrm.style.top = css.top;
161                 }
162         }
163 }
164 function tt_HideInit()
165 {
166         if(tt_iState)
167         {
168                 tt_ExtCallFncs(0, "HideInit");
169                 tt_iState &= ~0x4;
170                 if(tt_flagOpa && tt_aV[FADEOUT])
171                 {
172                         tt_tFade.EndTimer();
173                         if(tt_opa)
174                         {
175                                 var n = Math.round(tt_aV[FADEOUT] / (tt_aV[FADEINTERVAL] * (tt_aV[OPACITY] / tt_opa)));
176                                 tt_Fade(tt_opa, tt_opa, 0, n);
177                                 return;
178                         }
179                 }
180                 tt_tHide.Timer("tt_Hide();", 1, false);
181         }
182 }
183 function tt_Hide()
184 {
185         if(tt_db && tt_iState)
186         {
187                 tt_OpReHref();
188                 if(tt_iState & 0x2)
189                 {
190                         tt_aElt[0].style.visibility = "hidden";
191                         tt_ExtCallFncs(0, "Hide");
192                 }
193                 tt_tShow.EndTimer();
194                 tt_tHide.EndTimer();
195                 tt_tDurt.EndTimer();
196                 tt_tFade.EndTimer();
197                 if(!tt_op && !tt_ie)
198                 {
199                         tt_tWaitMov.EndTimer();
200                         tt_bWait = false;
201                 }
202                 if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY])
203                         tt_RemEvtFnc(document, "mouseup", tt_OnLClick);
204                 tt_ExtCallFncs(0, "Kill");
205                 // In case of a TagToTip tooltip, hide converted DOM node and
206                 // re-insert it into document
207                 if(tt_t2t && !tt_aV[COPYCONTENT])
208                 {
209                         tt_t2t.style.display = "none";
210                         tt_MovDomNode(tt_t2t, tt_aElt[6], tt_t2tDad);
211                 }
212                 tt_iState = 0;
213                 tt_over = null;
214                 tt_ResetMainDiv();
215                 if(tt_aElt[tt_aElt.length - 1])
216                         tt_aElt[tt_aElt.length - 1].style.display = "none";
217         }
218 }
219 function tt_GetElt(id)
220 {
221         return(document.getElementById ? document.getElementById(id)
222                         : document.all ? document.all[id]
223                         : null);
224 }
225 function tt_GetDivW(el)
226 {
227         return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);
228 }
229 function tt_GetDivH(el)
230 {
231         return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);
232 }
233 function tt_GetScrollX()
234 {
235         return(window.pageXOffset || (tt_db ? (tt_db.scrollLeft || 0) : 0));
236 }
237 function tt_GetScrollY()
238 {
239         return(window.pageYOffset || (tt_db ? (tt_db.scrollTop || 0) : 0));
240 }
241 function tt_GetClientW()
242 {
243         return(document.body && (typeof(document.body.clientWidth) != tt_u) ? document.body.clientWidth
244                         : (typeof(window.innerWidth) != tt_u) ? window.innerWidth
245                         : tt_db ? (tt_db.clientWidth || 0)
246                         : 0);
247 }
248 function tt_GetClientH()
249 {
250         // Exactly this order seems to yield correct values in all major browsers
251         return(document.body && (typeof(document.body.clientHeight) != tt_u) ? document.body.clientHeight
252                         : (typeof(window.innerHeight) != tt_u) ? window.innerHeight
253                         : tt_db ? (tt_db.clientHeight || 0)
254                         : 0);
255 }
256 function tt_GetEvtX(e)
257 {
258         return (e ? ((typeof(e.pageX) != tt_u) ? e.pageX : (e.clientX + tt_scrlX)) : 0);
259 }
260 function tt_GetEvtY(e)
261 {
262         return (e ? ((typeof(e.pageY) != tt_u) ? e.pageY : (e.clientY + tt_scrlY)) : 0);
263 }
264 function tt_AddEvtFnc(el, sEvt, PFnc)
265 {
266         if(el)
267         {
268                 if(el.addEventListener)
269                         el.addEventListener(sEvt, PFnc, false);
270                 else
271                         el.attachEvent("on" + sEvt, PFnc);
272         }
273 }
274 function tt_RemEvtFnc(el, sEvt, PFnc)
275 {
276         if(el)
277         {
278                 if(el.removeEventListener)
279                         el.removeEventListener(sEvt, PFnc, false);
280                 else
281                         el.detachEvent("on" + sEvt, PFnc);
282         }
283 }
284
285 //======================  PRIVATE  ===========================================//
286 var tt_aExt = new Array(),      // Array of extension objects
287
288 tt_db, tt_op, tt_ie, tt_ie56, tt_bBoxOld,       // Browser flags
289 tt_body,
290 tt_ovr_,                                // HTML element the mouse is currently over
291 tt_flagOpa,                     // Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
292 tt_maxPosX, tt_maxPosY,
293 tt_iState = 0,                  // Tooltip active |= 1, shown |= 2, move with mouse |= 4
294 tt_opa,                                 // Currently applied opacity
295 tt_bJmpVert, tt_bJmpHorz,// Tip temporarily on other side of mouse
296 tt_t2t, tt_t2tDad,              // Tag converted to tip, and its parent element in the document
297 tt_elDeHref,                    // The tag from which we've removed the href attribute
298 // Timer
299 tt_tShow = new Number(0), tt_tHide = new Number(0), tt_tDurt = new Number(0),
300 tt_tFade = new Number(0), tt_tWaitMov = new Number(0),
301 tt_bWait = false,
302 tt_u = "undefined";
303
304
305 function tt_Init()
306 {
307         tt_MkCmdEnum();
308         // Send old browsers instantly to hell
309         if(!tt_Browser() || !tt_MkMainDiv())
310                 return;
311         tt_IsW3cBox();
312         tt_OpaSupport();
313         tt_AddEvtFnc(window, "scroll", tt_OnScrl);
314         // IE doesn't fire onscroll event when switching to fullscreen;
315         // fix suggested by Yoav Karpeles 14.2.2008
316         tt_AddEvtFnc(window, "resize", tt_OnScrl);
317         tt_AddEvtFnc(document, "mousemove", tt_Move);
318         // In Debug mode we search for TagToTip() calls in order to notify
319         // the user if they've forgotten to set the TagsToTip config flag
320         if(TagsToTip || tt_Debug)
321                 tt_SetOnloadFnc();
322         // Ensure the tip be hidden when the page unloads
323         tt_AddEvtFnc(window, "unload", tt_Hide);
324 }
325 // Creates command names by translating config variable names to upper case
326 function tt_MkCmdEnum()
327 {
328         var n = 0;
329         for(var i in config)
330                 eval("window." + i.toString().toUpperCase() + " = " + n++);
331         tt_aV.length = n;
332 }
333 function tt_Browser()
334 {
335         var n, nv, n6, w3c;
336
337         n = navigator.userAgent.toLowerCase(),
338         nv = navigator.appVersion;
339         tt_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != tt_u);
340         tt_ie = n.indexOf("msie") != -1 && document.all && !tt_op;
341         if(tt_ie)
342         {
343                 var ieOld = (!document.compatMode || document.compatMode == "BackCompat");
344                 tt_db = !ieOld ? document.documentElement : (document.body || null);
345                 if(tt_db)
346                         tt_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
347                                         && typeof document.body.style.maxHeight == tt_u;
348         }
349         else
350         {
351                 tt_db = document.documentElement || document.body ||
352                                 (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
353                                 : null);
354                 if(!tt_op)
355                 {
356                         n6 = document.defaultView && typeof document.defaultView.getComputedStyle != tt_u;
357                         w3c = !n6 && document.getElementById;
358                 }
359         }
360         tt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
361                                 : (document.body || null));
362         if(tt_ie || n6 || tt_op || w3c)
363         {
364                 if(tt_body && tt_db)
365                 {
366                         if(document.attachEvent || document.addEventListener)
367                                 return true;
368                 }
369                 else
370                         tt_Err("wz_tooltip.js must be included INSIDE the body section,"
371                                         + " immediately after the opening <body> tag.", false);
372         }
373         tt_db = null;
374         return false;
375 }
376 function tt_MkMainDiv()
377 {
378         // Create the tooltip DIV
379         if(tt_body.insertAdjacentHTML)
380                 tt_body.insertAdjacentHTML("afterBegin", tt_MkMainDivHtm());
381         else if(typeof tt_body.innerHTML != tt_u && document.createElement && tt_body.appendChild)
382                 tt_body.appendChild(tt_MkMainDivDom());
383         if(window.tt_GetMainDivRefs /* FireFox Alzheimer */ && tt_GetMainDivRefs())
384                 return true;
385         tt_db = null;
386         return false;
387 }
388 function tt_MkMainDivHtm()
389 {
390         return('<div id="WzTtDiV"></div>' +
391                         (tt_ie56 ? ('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>')
392                         : ''));
393 }
394 function tt_MkMainDivDom()
395 {
396         var el = document.createElement("div");
397         if(el)
398                 el.id = "WzTtDiV";
399         return el;
400 }
401 function tt_GetMainDivRefs()
402 {
403         tt_aElt[0] = tt_GetElt("WzTtDiV");
404         if(tt_ie56 && tt_aElt[0])
405         {
406                 tt_aElt[tt_aElt.length - 1] = tt_GetElt("WzTtIfRm");
407                 if(!tt_aElt[tt_aElt.length - 1])
408                         tt_aElt[0] = null;
409         }
410         if(tt_aElt[0])
411         {
412                 var css = tt_aElt[0].style;
413
414                 css.visibility = "hidden";
415                 css.position = "absolute";
416                 css.overflow = "hidden";
417                 return true;
418         }
419         return false;
420 }
421 function tt_ResetMainDiv()
422 {
423         var w = (window.screen && screen.width) ? screen.width : 10000;
424
425         tt_SetTipPos(-w, 0);
426         tt_aElt[0].innerHTML = "";
427         tt_aElt[0].style.width = (w - 1) + "px";
428         tt_h = 0;
429 }
430 function tt_IsW3cBox()
431 {
432         var css = tt_aElt[0].style;
433
434         css.padding = "10px";
435         css.width = "40px";
436         tt_bBoxOld = (tt_GetDivW(tt_aElt[0]) == 40);
437         css.padding = "0px";
438         tt_ResetMainDiv();
439 }
440 function tt_OpaSupport()
441 {
442         var css = tt_body.style;
443
444         tt_flagOpa = (typeof(css.filter) != tt_u) ? 1
445                                 : (typeof(css.KhtmlOpacity) != tt_u) ? 2
446                                 : (typeof(css.KHTMLOpacity) != tt_u) ? 3
447                                 : (typeof(css.MozOpacity) != tt_u) ? 4
448                                 : (typeof(css.opacity) != tt_u) ? 5
449                                 : 0;
450 }
451 // Ported from http://dean.edwards.name/weblog/2006/06/again/
452 // (Dean Edwards et al.)
453 function tt_SetOnloadFnc()
454 {
455         tt_AddEvtFnc(document, "DOMContentLoaded", tt_HideSrcTags);
456         tt_AddEvtFnc(window, "load", tt_HideSrcTags);
457         if(tt_body.attachEvent)
458                 tt_body.attachEvent("onreadystatechange",
459                         function() {
460                                 if(tt_body.readyState == "complete")
461                                         tt_HideSrcTags();
462                         } );
463         if(/WebKit|KHTML/i.test(navigator.userAgent))
464         {
465                 var t = setInterval(function() {
466                                         if(/loaded|complete/.test(document.readyState))
467                                         {
468                                                 clearInterval(t);
469                                                 tt_HideSrcTags();
470                                         }
471                                 }, 10);
472         }
473 }
474 function tt_HideSrcTags()
475 {
476         if(!window.tt_HideSrcTags || window.tt_HideSrcTags.done)
477                 return;
478         window.tt_HideSrcTags.done = true;
479         if(!tt_HideSrcTagsRecurs(tt_body))
480                 tt_Err("There are HTML elements to be converted to tooltips.\nIf you"
481                                 + " want these HTML elements to be automatically hidden, you"
482                                 + " must edit wz_tooltip.js, and set TagsToTip in the global"
483                                 + " tooltip configuration to true.", true);
484 }
485 function tt_HideSrcTagsRecurs(dad)
486 {
487         var ovr, asT2t;
488         // Walk the DOM tree for tags that have an onmouseover or onclick attribute
489         // containing a TagToTip('...') call.
490         // (.childNodes first since .children is bugous in Safari)
491         var a = dad.childNodes || dad.children || null;
492
493         for(var i = a ? a.length : 0; i;)
494         {--i;
495                 if(!tt_HideSrcTagsRecurs(a[i]))
496                         return false;
497                 ovr = a[i].getAttribute ? (a[i].getAttribute("onmouseover") || a[i].getAttribute("onclick"))
498                                 : (typeof a[i].onmouseover == "function") ? (a[i].onmouseover || a[i].onclick)
499                                 : null;
500                 if(ovr)
501                 {
502                         asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);
503                         if(asT2t && asT2t.length)
504                         {
505                                 if(!tt_HideSrcTag(asT2t[0]))
506                                         return false;
507                         }
508                 }
509         }
510         return true;
511 }
512 function tt_HideSrcTag(sT2t)
513 {
514         var id, el;
515
516         // The ID passed to the found TagToTip() call identifies an HTML element
517         // to be converted to a tooltip, so hide that element
518         id = sT2t.replace(/.+'([^'.]+)'.+/, "$1");
519         el = tt_GetElt(id);
520         if(el)
521         {
522                 if(tt_Debug && !TagsToTip)
523                         return false;
524                 else
525                         el.style.display = "none";
526         }
527         else
528                 tt_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()."
529                                 + " There exists no HTML element with that ID.", true);
530         return true;
531 }
532 function tt_Tip(arg, t2t)
533 {
534         if(!tt_db)
535                 return;
536         if(tt_iState)
537                 tt_Hide();
538         if(!tt_Enabled)
539                 return;
540         tt_t2t = t2t;
541         if(!tt_ReadCmds(arg))
542                 return;
543         tt_iState = 0x1 | 0x4;
544         tt_AdaptConfig1();
545         tt_MkTipContent(arg);
546         tt_MkTipSubDivs();
547         tt_FormatTip();
548         tt_bJmpVert = false;
549         tt_bJmpHorz = false;
550         tt_maxPosX = tt_GetClientW() + tt_scrlX - tt_w - 1;
551         tt_maxPosY = tt_GetClientH() + tt_scrlY - tt_h - 1;
552         tt_AdaptConfig2();
553         // Ensure the tip be shown and positioned before the first onmousemove
554         tt_OverInit();
555         tt_ShowInit();
556         tt_Move();
557 }
558 function tt_ReadCmds(a)
559 {
560         var i;
561
562         // First load the global config values, to initialize also values
563         // for which no command is passed
564         i = 0;
565         for(var j in config)
566                 tt_aV[i++] = config[j];
567         // Then replace each cached config value for which a command is
568         // passed (ensure the # of command args plus value args be even)
569         if(a.length & 1)
570         {
571                 for(i = a.length - 1; i > 0; i -= 2)
572                         tt_aV[a[i - 1]] = a[i];
573                 return true;
574         }
575         tt_Err("Incorrect call of Tip() or TagToTip().\n"
576                         + "Each command must be followed by a value.", true);
577         return false;
578 }
579 function tt_AdaptConfig1()
580 {
581         tt_ExtCallFncs(0, "LoadConfig");
582         // Inherit unspecified title formattings from body
583         if(!tt_aV[TITLEBGCOLOR].length)
584                 tt_aV[TITLEBGCOLOR] = tt_aV[BORDERCOLOR];
585         if(!tt_aV[TITLEFONTCOLOR].length)
586                 tt_aV[TITLEFONTCOLOR] = tt_aV[BGCOLOR];
587         if(!tt_aV[TITLEFONTFACE].length)
588                 tt_aV[TITLEFONTFACE] = tt_aV[FONTFACE];
589         if(!tt_aV[TITLEFONTSIZE].length)
590                 tt_aV[TITLEFONTSIZE] = tt_aV[FONTSIZE];
591         if(tt_aV[CLOSEBTN])
592         {
593                 // Use title colours for non-specified closebutton colours
594                 if(!tt_aV[CLOSEBTNCOLORS])
595                         tt_aV[CLOSEBTNCOLORS] = new Array("", "", "", "");
596                 for(var i = 4; i;)
597                 {--i;
598                         if(!tt_aV[CLOSEBTNCOLORS][i].length)
599                                 tt_aV[CLOSEBTNCOLORS][i] = (i & 1) ? tt_aV[TITLEFONTCOLOR] : tt_aV[TITLEBGCOLOR];
600                 }
601                 // Enforce titlebar be shown
602                 if(!tt_aV[TITLE].length)
603                         tt_aV[TITLE] = " ";
604         }
605         // Circumvents broken display of images and fade-in flicker in Geckos < 1.8
606         if(tt_aV[OPACITY] == 100 && typeof tt_aElt[0].style.MozOpacity != tt_u && !Array.every)
607                 tt_aV[OPACITY] = 99;
608         // Smartly shorten the delay for fade-in tooltips
609         if(tt_aV[FADEIN] && tt_flagOpa && tt_aV[DELAY] > 100)
610                 tt_aV[DELAY] = Math.max(tt_aV[DELAY] - tt_aV[FADEIN], 100);
611 }
612 function tt_AdaptConfig2()
613 {
614         if(tt_aV[CENTERMOUSE])
615         {
616                 tt_aV[OFFSETX] -= ((tt_w - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0)) >> 1);
617                 tt_aV[JUMPHORZ] = false;
618         }
619 }
620 // Expose content globally so extensions can modify it
621 function tt_MkTipContent(a)
622 {
623         if(tt_t2t)
624         {
625                 if(tt_aV[COPYCONTENT])
626                         tt_sContent = tt_t2t.innerHTML;
627                 else
628                         tt_sContent = "";
629         }
630         else
631                 tt_sContent = a[0];
632         tt_ExtCallFncs(0, "CreateContentString");
633 }
634 function tt_MkTipSubDivs()
635 {
636         var sCss = 'position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',
637         sTbTrTd = ' cellspacing="0" cellpadding="0" border="0" style="' + sCss + '"><tbody style="' + sCss + '"><tr><td ';
638
639         tt_aElt[0].innerHTML =
640                 (''
641                 + (tt_aV[TITLE].length ?
642                         ('<div id="WzTiTl" style="position:relative;z-index:1;">'
643                         + '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
644                         + tt_aV[TITLE]
645                         + '</td>'
646                         + (tt_aV[CLOSEBTN] ?
647                                 ('<td align="right" style="' + sCss
648                                 + 'text-align:right;">'
649                                 + '<span id="WzClOsE" style="padding-left:2px;padding-right:2px;'
650                                 + 'cursor:' + (tt_ie ? 'hand' : 'pointer')
651                                 + ';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">'
652                                 + tt_aV[CLOSEBTNTEXT]
653                                 + '</span></td>')
654                                 : '')
655                         + '</tr></tbody></table></div>')
656                         : '')
657                 + '<div id="WzBoDy" style="position:relative;z-index:0;">'
658                 + '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
659                 + tt_sContent
660                 + '</td></tr></tbody></table></div>'
661                 + (tt_aV[SHADOW]
662                         ? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
663                                 + '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
664                         : '')
665                 );
666         tt_GetSubDivRefs();
667         // Convert DOM node to tip
668         if(tt_t2t && !tt_aV[COPYCONTENT])
669         {
670                 // Store the tag's parent element so we can restore that DOM branch
671                 // once the tooltip is hidden
672                 tt_t2tDad = tt_t2t.parentNode || tt_t2t.parentElement || tt_t2t.offsetParent || null;
673                 if(tt_t2tDad)
674                 {
675                         tt_MovDomNode(tt_t2t, tt_t2tDad, tt_aElt[6]);
676                         tt_t2t.style.display = "block";
677                 }
678         }
679         tt_ExtCallFncs(0, "SubDivsCreated");
680 }
681 function tt_GetSubDivRefs()
682 {
683         var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");
684
685         for(var i = aId.length; i; --i)
686                 tt_aElt[i] = tt_GetElt(aId[i - 1]);
687 }
688 function tt_FormatTip()
689 {
690         var css, w, h, iOffY, iOffSh,
691         iAdd = (tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1;
692        
693         //--------- Title DIV ----------
694         if(tt_aV[TITLE].length)
695         {
696                 css = tt_aElt[1].style;
697                 css.background = tt_aV[TITLEBGCOLOR];
698                 css.paddingTop = (tt_aV[CLOSEBTN] ? 2 : 0) + "px";
699                 css.paddingBottom = "1px";
700                 css.paddingLeft = css.paddingRight = tt_aV[PADDING] + "px";
701                 css = tt_aElt[3].style;
702                 css.color = tt_aV[TITLEFONTCOLOR];
703                 if (tt_aV[WIDTH] == -1)
704                         css.whiteSpace = "nowrap";
705                 css.fontFamily = tt_aV[TITLEFONTFACE];
706                 css.fontSize = tt_aV[TITLEFONTSIZE];
707                 css.fontWeight = "bold";
708                 css.textAlign = tt_aV[TITLEALIGN];
709                 // Close button DIV
710                 if(tt_aElt[4])
711                 {
712                         css.paddingRight = (tt_aV[PADDING] << 1) + "px";
713                         css = tt_aElt[4].style;
714                         css.background = tt_aV[CLOSEBTNCOLORS][0];
715                         css.color = tt_aV[CLOSEBTNCOLORS][1];
716                         css.fontFamily = tt_aV[TITLEFONTFACE];
717                         css.fontSize = tt_aV[TITLEFONTSIZE];
718                         css.fontWeight = "bold";
719                 }
720                 if(tt_aV[WIDTH] > 0)
721                         tt_w = tt_aV[WIDTH];
722                 else
723                 {
724                         tt_w = tt_GetDivW(tt_aElt[3]) + tt_GetDivW(tt_aElt[4]);
725                         // Some spacing between title DIV and closebutton
726                         if(tt_aElt[4])
727                                 tt_w += tt_aV[PADDING];
728                         // Restrict auto width to max width
729                         if(tt_aV[WIDTH] < -1 && tt_w > -tt_aV[WIDTH])
730                                 tt_w = -tt_aV[WIDTH];
731                 }
732                 // Ensure the top border of the body DIV be covered by the title DIV
733                 iOffY = -tt_aV[BORDERWIDTH];
734         }
735         else
736         {
737                 tt_w = 0;
738                 iOffY = 0;
739         }
740
741         //-------- Body DIV ------------
742         css = tt_aElt[5].style;
743         css.top = iOffY + "px";
744         if(tt_aV[BORDERWIDTH])
745         {
746                 css.borderColor = tt_aV[BORDERCOLOR];
747                 css.borderStyle = tt_aV[BORDERSTYLE];
748                 css.borderWidth = tt_aV[BORDERWIDTH] + "px";
749         }
750         if(tt_aV[BGCOLOR].length)
751                 css.background = tt_aV[BGCOLOR];
752         if(tt_aV[BGIMG].length)
753                 css.backgroundImage = "url(" + tt_aV[BGIMG] + ")";
754         css.padding = tt_aV[PADDING] + "px";
755         css.textAlign = tt_aV[TEXTALIGN];
756         if(tt_aV[HEIGHT])
757         {
758                 css.overflow = "auto";
759                 if(tt_aV[HEIGHT] > 0)
760                         css.height = (tt_aV[HEIGHT] + iAdd) + "px";
761                 else
762                         tt_h = iAdd - tt_aV[HEIGHT];
763         }
764         // TD inside body DIV
765         css = tt_aElt[6].style;
766         css.color = tt_aV[FONTCOLOR];
767         css.fontFamily = tt_aV[FONTFACE];
768         css.fontSize = tt_aV[FONTSIZE];
769         css.fontWeight = tt_aV[FONTWEIGHT];
770         css.background = "";
771         css.textAlign = tt_aV[TEXTALIGN];
772         if(tt_aV[WIDTH] > 0)
773                 w = tt_aV[WIDTH];
774         // Width like title (if existent)
775         else if(tt_aV[WIDTH] == -1 && tt_w)
776                 w = tt_w;
777         else
778         {
779                 // Measure width of the body's inner TD, as some browsers would expand
780                 // the container and outer body DIV to 100%
781                 w = tt_GetDivW(tt_aElt[6]);
782                 // Restrict auto width to max width
783                 if(tt_aV[WIDTH] < -1 && w > -tt_aV[WIDTH])
784                         w = -tt_aV[WIDTH];
785         }
786         if(w > tt_w)
787                 tt_w = w;
788         tt_w += iAdd;
789
790         //--------- Shadow DIVs ------------
791         if(tt_aV[SHADOW])
792         {
793                 tt_w += tt_aV[SHADOWWIDTH];
794                 iOffSh = Math.floor((tt_aV[SHADOWWIDTH] * 4) / 3);
795                 // Bottom shadow
796                 css = tt_aElt[7].style;
797                 css.top = iOffY + "px";
798                 css.left = iOffSh + "px";
799                 css.width = (tt_w - iOffSh - tt_aV[SHADOWWIDTH]) + "px";
800                 css.height = tt_aV[SHADOWWIDTH] + "px";
801                 css.background = tt_aV[SHADOWCOLOR];
802                 // Right shadow
803                 css = tt_aElt[8].style;
804                 css.top = iOffSh + "px";
805                 css.left = (tt_w - tt_aV[SHADOWWIDTH]) + "px";
806                 css.width = tt_aV[SHADOWWIDTH] + "px";
807                 css.background = tt_aV[SHADOWCOLOR];
808         }
809         else
810                 iOffSh = 0;
811
812         //-------- Container DIV -------
813         tt_SetTipOpa(tt_aV[FADEIN] ? 0 : tt_aV[OPACITY]);
814         tt_FixSize(iOffY, iOffSh);
815 }
816 // Fixate the size so it can't dynamically change while the tooltip is moving.
817 function tt_FixSize(iOffY, iOffSh)
818 {
819         var wIn, wOut, h, add, i;
820
821         tt_aElt[0].style.width = tt_w + "px";
822         tt_aElt[0].style.pixelWidth = tt_w;
823         wOut = tt_w - ((tt_aV[SHADOW]) ? tt_aV[SHADOWWIDTH] : 0);
824         // Body
825         wIn = wOut;
826         if(!tt_bBoxOld)
827                 wIn -= (tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1;
828         tt_aElt[5].style.width = wIn + "px";
829         // Title
830         if(tt_aElt[1])
831         {
832                 wIn = wOut - (tt_aV[PADDING] << 1);
833                 if(!tt_bBoxOld)
834                         wOut = wIn;
835                 tt_aElt[1].style.width = wOut + "px";
836                 tt_aElt[2].style.width = wIn + "px";
837         }
838         // Max height specified
839         if(tt_h)
840         {
841                 h = tt_GetDivH(tt_aElt[5]);
842                 if(h > tt_h)
843                 {
844                         if(!tt_bBoxOld)
845                                 tt_h -= (tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1;
846                         tt_aElt[5].style.height = tt_h + "px";
847                 }
848         }
849         tt_h = tt_GetDivH(tt_aElt[0]) + iOffY;
850         // Right shadow
851         if(tt_aElt[8])
852                 tt_aElt[8].style.height = (tt_h - iOffSh) + "px";
853         i = tt_aElt.length - 1;
854         if(tt_aElt[i])
855         {
856                 tt_aElt[i].style.width = tt_w + "px";
857                 tt_aElt[i].style.height = tt_h + "px";
858         }
859 }
860 function tt_DeAlt(el)
861 {
862         var aKid;
863
864         if(el)
865         {
866                 if(el.alt)
867                         el.alt = "";
868                 if(el.title)
869                         el.title = "";
870                 aKid = el.childNodes || el.children || null;
871                 if(aKid)
872                 {
873                         for(var i = aKid.length; i;)
874                                 tt_DeAlt(aKid[--i]);
875                 }
876         }
877 }
878 // This hack removes the native tooltips over links in Opera
879 function tt_OpDeHref(el)
880 {
881         if(!tt_op)
882                 return;
883         if(tt_elDeHref)
884                 tt_OpReHref();
885         while(el)
886         {
887                 if(el.hasAttribute("href"))
888                 {
889                         el.t_href = el.getAttribute("href");
890                         el.t_stats = window.status;
891                         el.removeAttribute("href");
892                         el.style.cursor = "hand";
893                         tt_AddEvtFnc(el, "mousedown", tt_OpReHref);
894                         window.status = el.t_href;
895                         tt_elDeHref = el;
896                         break;
897                 }
898                 el = el.parentElement;
899         }
900 }
901 function tt_OpReHref()
902 {
903         if(tt_elDeHref)
904         {
905                 tt_elDeHref.setAttribute("href", tt_elDeHref.t_href);
906                 tt_RemEvtFnc(tt_elDeHref, "mousedown", tt_OpReHref);
907                 window.status = tt_elDeHref.t_stats;
908                 tt_elDeHref = null;
909         }
910 }
911 function tt_OverInit()
912 {
913         if(window.event)
914                 tt_over = window.event.target || window.event.srcElement;
915         else
916                 tt_over = tt_ovr_;
917         tt_DeAlt(tt_over);
918         tt_OpDeHref(tt_over);
919 }
920 function tt_ShowInit()
921 {
922         tt_tShow.Timer("tt_Show()", tt_aV[DELAY], true);
923         if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY])
924                 tt_AddEvtFnc(document, "mouseup", tt_OnLClick);
925 }
926 function tt_Show()
927 {
928         var css = tt_aElt[0].style;
929
930         // Override the z-index of the topmost wz_dragdrop.js D&D item
931         css.zIndex = Math.max((window.dd && dd.z) ? (dd.z + 2) : 0, 1010);
932         if(tt_aV[STICKY] || !tt_aV[FOLLOWMOUSE])
933                 tt_iState &= ~0x4;
934         if(tt_aV[DURATION] > 0)
935                 tt_tDurt.Timer("tt_HideInit()", tt_aV[DURATION], true);
936         tt_ExtCallFncs(0, "Show")
937         css.visibility = "visible";
938         tt_iState |= 0x2;
939         if(tt_aV[FADEIN])
940                 tt_Fade(0, 0, tt_aV[OPACITY], Math.round(tt_aV[FADEIN] / tt_aV[FADEINTERVAL]));
941         tt_ShowIfrm();
942 }
943 function tt_ShowIfrm()
944 {
945         if(tt_ie56)
946         {
947                 var ifrm = tt_aElt[tt_aElt.length - 1];
948                 if(ifrm)
949                 {
950                         var css = ifrm.style;
951                         css.zIndex = tt_aElt[0].style.zIndex - 1;
952                         css.display = "block";
953                 }
954         }
955 }
956 function tt_Move(e)
957 {
958         if(e)
959                 tt_ovr_ = e.target || e.srcElement;
960         e = e || window.event;
961         if(e)
962         {
963                 tt_musX = tt_GetEvtX(e);
964                 tt_musY = tt_GetEvtY(e);
965         }
966         if(tt_iState & 0x04)
967         {
968                 // Prevent jam of mousemove events
969                 if(!tt_op && !tt_ie)
970                 {
971                         if(tt_bWait)
972                                 return;
973                         tt_bWait = true;
974                         tt_tWaitMov.Timer("tt_bWait = false;", 1, true);
975                 }
976                 if(tt_aV[FIX])
977                 {
978                         var iY = tt_aV[FIX][1];
979                         // For a fixed tip to be positioned above the mouse, use the
980                         // bottom edge as anchor
981                         // (recommended by Christophe Rebeschini, 31.1.2008)
982                         if(tt_aV[ABOVE])
983                                 iY -= tt_h;
984                         tt_iState &= ~0x4;
985                         tt_SetTipPos(tt_aV[FIX][0], tt_aV[FIX][1]);
986                 }
987                 else if(!tt_ExtCallFncs(e, "MoveBefore"))
988                         tt_SetTipPos(tt_Pos(0), tt_Pos(1));
989                 tt_ExtCallFncs([tt_musX, tt_musY], "MoveAfter")
990         }
991 }
992 function tt_Pos(iDim)
993 {
994         var iX, bJmpMode, cmdAlt, cmdOff, cx, iMax, iScrl, iMus, bJmp;
995
996         // Map values according to dimension to calculate
997         if(iDim)
998         {
999                 bJmpMode = tt_aV[JUMPVERT];
1000                 cmdAlt = ABOVE;
1001                 cmdOff = OFFSETY;
1002                 cx = tt_h;
1003                 iMax = tt_maxPosY;
1004                 iScrl = tt_scrlY;
1005                 iMus = tt_musY;
1006                 bJmp = tt_bJmpVert;
1007         }
1008         else
1009         {
1010                 bJmpMode = tt_aV[JUMPHORZ];
1011                 cmdAlt = LEFT;
1012                 cmdOff = OFFSETX;
1013                 cx = tt_w;
1014                 iMax = tt_maxPosX;
1015                 iScrl = tt_scrlX;
1016                 iMus = tt_musX;
1017                 bJmp = tt_bJmpHorz;
1018         }
1019         if(bJmpMode)
1020         {
1021                 if(tt_aV[cmdAlt] && (!bJmp || tt_CalcPosAlt(iDim) >= iScrl + 16))
1022                         iX = tt_PosAlt(iDim);
1023                 else if(!tt_aV[cmdAlt] && bJmp && tt_CalcPosDef(iDim) > iMax - 16)
1024                         iX = tt_PosAlt(iDim);
1025                 else
1026                         iX = tt_PosDef(iDim);
1027         }
1028         else
1029         {
1030                 iX = iMus;
1031                 if(tt_aV[cmdAlt])
1032                         iX -= cx + tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);
1033                 else
1034                         iX += tt_aV[cmdOff];
1035         }
1036         // Prevent tip from extending past clientarea boundary
1037         if(iX > iMax)
1038                 iX = bJmpMode ? tt_PosAlt(iDim) : iMax;
1039         // In case of insufficient space on both sides, ensure the left/upper part
1040         // of the tip be visible
1041         if(iX < iScrl)
1042                 iX = bJmpMode ? tt_PosDef(iDim) : iScrl;
1043         return iX;
1044 }
1045 function tt_PosDef(iDim)
1046 {
1047         if(iDim)
1048                 tt_bJmpVert = tt_aV[ABOVE];
1049         else
1050                 tt_bJmpHorz = tt_aV[LEFT];
1051         return tt_CalcPosDef(iDim);
1052 }
1053 function tt_PosAlt(iDim)
1054 {
1055         if(iDim)
1056                 tt_bJmpVert = !tt_aV[ABOVE];
1057         else
1058                 tt_bJmpHorz = !tt_aV[LEFT];
1059         return tt_CalcPosAlt(iDim);
1060 }
1061 function tt_CalcPosDef(iDim)
1062 {
1063         return iDim ? (tt_musY + tt_aV[OFFSETY]) : (tt_musX + tt_aV[OFFSETX]);
1064 }
1065 function tt_CalcPosAlt(iDim)
1066 {
1067         var cmdOff = iDim ? OFFSETY : OFFSETX;
1068         var dx = tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);
1069         if(tt_aV[cmdOff] > 0 && dx <= 0)
1070                 dx = 1;
1071         return((iDim ? (tt_musY - tt_h) : (tt_musX - tt_w)) - dx);
1072 }
1073 function tt_Fade(a, now, z, n)
1074 {
1075         if(n)
1076         {
1077                 now += Math.round((z - now) / n);
1078                 if((z > a) ? (now >= z) : (now <= z))
1079                         now = z;
1080                 else
1081                         tt_tFade.Timer("tt_Fade("
1082                                                         + a + "," + now + "," + z + "," + (n - 1)
1083                                                         + ")",
1084                                                         tt_aV[FADEINTERVAL],
1085                                                         true);
1086         }
1087         now ? tt_SetTipOpa(now) : tt_Hide();
1088 }
1089 function tt_SetTipOpa(opa)
1090 {
1091         // To circumvent the opacity nesting flaws of IE, we set the opacity
1092         // for each sub-DIV separately, rather than for the container DIV.
1093         tt_SetOpa(tt_aElt[5], opa);
1094         if(tt_aElt[1])
1095                 tt_SetOpa(tt_aElt[1], opa);
1096         if(tt_aV[SHADOW])
1097         {
1098                 opa = Math.round(opa * 0.8);
1099                 tt_SetOpa(tt_aElt[7], opa);
1100                 tt_SetOpa(tt_aElt[8], opa);
1101         }
1102 }
1103 function tt_OnScrl()
1104 {
1105         tt_scrlX = tt_GetScrollX();
1106         tt_scrlY = tt_GetScrollY();
1107 }
1108 function tt_OnCloseBtnOver(iOver)
1109 {
1110         var css = tt_aElt[4].style;
1111
1112         iOver <<= 1;
1113         css.background = tt_aV[CLOSEBTNCOLORS][iOver];
1114         css.color = tt_aV[CLOSEBTNCOLORS][iOver + 1];
1115 }
1116 function tt_OnLClick(e)
1117 {
1118         //  Ignore right-clicks
1119         e = e || window.event;
1120         if(!((e.button && e.button & 2) || (e.which && e.which == 3)))
1121         {
1122                 if(tt_aV[CLICKSTICKY] && (tt_iState & 0x4))
1123                 {
1124                         tt_aV[STICKY] = true;
1125                         tt_iState &= ~0x4;
1126                 }
1127                 else if(tt_aV[CLICKCLOSE])
1128                         tt_HideInit();
1129         }
1130 }
1131 function tt_Int(x)
1132 {
1133         var y;
1134
1135         return(isNaN(y = parseInt(x)) ? 0 : y);
1136 }
1137 Number.prototype.Timer = function(s, iT, bUrge)
1138 {
1139         if(!this.value || bUrge)
1140                 this.value = window.setTimeout(s, iT);
1141 }
1142 Number.prototype.EndTimer = function()
1143 {
1144         if(this.value)
1145         {
1146                 window.clearTimeout(this.value);
1147                 this.value = 0;
1148         }
1149 }
1150 function tt_SetOpa(el, opa)
1151 {
1152         var css = el.style;
1153
1154         tt_opa = opa;
1155         if(tt_flagOpa == 1)
1156         {
1157                 if(opa < 100)
1158                 {
1159                         // Hacks for bugs of IE:
1160                         // 1.) Once a CSS filter has been applied, fonts are no longer
1161                         // anti-aliased, so we store the previous 'non-filter' to be
1162                         // able to restore it
1163                         if(typeof(el.filtNo) == tt_u)
1164                                 el.filtNo = css.filter;
1165                         // 2.) A DIV cannot be made visible in a single step if an
1166                         // opacity < 100 has been applied while the DIV was hidden
1167                         var bVis = css.visibility != "hidden";
1168                         // 3.) In IE6, applying an opacity < 100 has no effect if the
1169                         //         element has no layout (position, size, zoom, ...)
1170                         css.zoom = "100%";
1171                         if(!bVis)
1172                                 css.visibility = "visible";
1173                         css.filter = "alpha(opacity=" + opa + ")";
1174                         if(!bVis)
1175                                 css.visibility = "hidden";
1176                 }
1177                 else if(typeof(el.filtNo) != tt_u)
1178                         // Restore 'non-filter'
1179                         css.filter = el.filtNo;
1180         }
1181         else
1182         {
1183                 opa /= 100.0;
1184                 switch(tt_flagOpa)
1185                 {
1186                 case 2:
1187                         css.KhtmlOpacity = opa; break;
1188                 case 3:
1189                         css.KHTMLOpacity = opa; break;
1190                 case 4:
1191                         css.MozOpacity = opa; break;
1192                 case 5:
1193                         css.opacity = opa; break;
1194                 }
1195         }
1196 }
1197 function tt_MovDomNode(el, dadFrom, dadTo)
1198 {
1199         if(dadFrom)
1200                 dadFrom.removeChild(el);
1201         if(dadTo)
1202                 dadTo.appendChild(el);
1203 }
1204 function tt_Err(sErr, bIfDebug)
1205 {
1206         if(tt_Debug || !bIfDebug)
1207                 alert("Tooltip Script Error Message:\n\n" + sErr);
1208 }
1209
1210 //============  EXTENSION (PLUGIN) MANAGER  ===============//
1211 function tt_ExtCmdEnum()
1212 {
1213         var s;
1214
1215         // Add new command(s) to the commands enum
1216         for(var i in config)
1217         {
1218                 s = "window." + i.toString().toUpperCase();
1219                 if(eval("typeof(" + s + ") == tt_u"))
1220                 {
1221                         eval(s + " = " + tt_aV.length);
1222                         tt_aV[tt_aV.length] = null;
1223                 }
1224         }
1225 }
1226 function tt_ExtCallFncs(arg, sFnc)
1227 {
1228         var b = false;
1229         for(var i = tt_aExt.length; i;)
1230         {--i;
1231                 var fnc = tt_aExt[i]["On" + sFnc];
1232                 // Call the method the extension has defined for this event
1233                 if(fnc && fnc(arg))
1234                         b = true;
1235         }
1236         return b;
1237 }
1238
1239 tt_Init();
Note: See TracBrowser for help on using the browser.