5 * Displays the Tooltips (hints), if we have some
6 * 2005-01-20 added by Michael Keck (mkkeck)
9 var ttXpos
= 0, ttYpos
= 0;
10 var ttXadd
= 10, ttYadd
= -10;
11 var ttDisplay
= 0, ttHoldIt
= 0;
12 // Check if browser does support dynamic content and dhtml
13 var ttNS4
= (document
.layers
) ? 1 : 0; // the old Netscape 4
14 var ttIE4
= (document
.all
) ? 1 : 0; // browser wich uses document.all
15 var ttDOM
= (document
.getElementById
) ? 1 : 0; // DOM-compatible browsers
16 if (ttDOM
) { // if DOM-compatible, set the others to false
21 var myTooltipContainer
= null;
23 if ( (ttDOM
) || (ttIE4
) || (ttNS4
) ) {
26 document
.captureEvents(Event
.MOUSEMOVE
);
28 document
.onmousemove
= mouseMove
;
33 * init the tooltip and write the text into it
35 * @param string theText tooltip content
37 function textTooltip(theText
) {
38 if (ttDOM
|| ttIE4
) { // document.getEelementById || document.all
39 myTooltipContainer
.innerHTML
= ""; // we should empty it first
40 myTooltipContainer
.innerHTML
= theText
;
41 } else if (ttNS4
) { // document.layers
42 var layerNS4
= myTooltipContainer
.document
;
43 layerNS4
.write(theText
);
54 * swap the Tooltip // show and hide
56 * @param boolean stat view status
58 function swapTooltip(stat
) {
60 if (stat
!='default') {
63 else if (stat
=='false')
67 ttTimerID
= setTimeout("showTooltip(false);",500);
73 clearTimeout(ttTimerID
);
81 * show / hide the Tooltip
83 * @param boolean stat view status
85 function showTooltip(stat
) {
88 myTooltipContainer
.visibility
= "hide";
90 myTooltipContainer
.style
.visibility
= "hidden";
94 myTooltipContainer
.visibility
= "show";
96 myTooltipContainer
.style
.visibility
= "visible";
101 * hold it, if we create or move the mouse over the tooltip
103 function holdTooltip() {
110 * move the tooltip to mouse position
112 * @param integer posX horiz. position
113 * @param integer posY vert. position
115 function moveTooltip(posX
, posY
) {
116 if (ttDOM
|| ttIE4
) {
117 myTooltipContainer
.style
.left
= posX
+ "px";
118 myTooltipContainer
.style
.top
= posY
+ "px";
120 myTooltipContainer
.left
= posX
;
121 myTooltipContainer
.top
= posY
;
128 * @param string theText tooltip content
130 function pmaTooltip( theText
) {
131 // reference to TooltipContainer
132 if ( null == myTooltipContainer
) {
134 myTooltipContainer
= document
.TooltipContainer
;
136 myTooltipContainer
= document
.all('TooltipContainer');
138 myTooltipContainer
= document
.getElementById('TooltipContainer');
143 if ( typeof( myTooltipContainer
) == 'undefined' ) {
148 var plusX
=0, plusY
=0, docX
=0, docY
=0;
149 var divHeight
= myTooltipContainer
.clientHeight
;
150 var divWidth
= myTooltipContainer
.clientWidth
;
151 if (navigator
.appName
.indexOf("Explorer")!=-1) {
152 if (document
.documentElement
&& document
.documentElement
.scrollTop
) {
153 plusX
= document
.documentElement
.scrollLeft
;
154 plusY
= document
.documentElement
.scrollTop
;
155 docX
= document
.documentElement
.offsetWidth
+ plusX
;
156 docY
= document
.documentElement
.offsetHeight
+ plusY
;
158 plusX
= document
.body
.scrollLeft
;
159 plusY
= document
.body
.scrollTop
;
160 docX
= document
.body
.offsetWidth
+ plusX
;
161 docY
= document
.body
.offsetHeight
+ plusY
;
164 docX
= document
.body
.clientWidth
;
165 docY
= document
.body
.clientHeight
;
168 ttXpos
= ttXpos
+ plusX
;
169 ttYpos
= ttYpos
+ plusY
;
171 if ((ttXpos
+ divWidth
) > docX
)
172 ttXpos
= ttXpos
- (divWidth
+ (ttXadd
* 2));
173 if ((ttYpos
+ divHeight
) > docY
)
174 ttYpos
= ttYpos
- (divHeight
+ (ttYadd
* 2));
176 textTooltip(theText
);
177 moveTooltip((ttXpos
+ ttXadd
), (ttYpos
+ ttYadd
));
182 * register mouse moves
186 function mouseMove(e
) {
187 if ( typeof( event
) != 'undefined' ) {