1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * Displays the Tooltips (hints), if we have some
4 * 2005-01-20 added by Michael Keck (mkkeck)
12 var ttXpos
= 0, ttYpos
= 0;
13 var ttXadd
= 10, ttYadd
= -10;
14 var ttDisplay
= 0, ttHoldIt
= 0;
15 // Check if browser does support dynamic content and dhtml
16 var ttNS4
= (document
.layers
) ? 1 : 0; // the old Netscape 4
17 var ttIE4
= (document
.all
) ? 1 : 0; // browser wich uses document.all
18 var ttDOM
= (document
.getElementById
) ? 1 : 0; // DOM-compatible browsers
19 if (ttDOM
) { // if DOM-compatible, set the others to false
24 var myTooltipContainer
= null;
26 if ( (ttDOM
) || (ttIE4
) || (ttNS4
) ) {
29 document
.captureEvents(Event
.MOUSEMOVE
);
31 document
.onmousemove
= mouseMove
;
36 * init the tooltip and write the text into it
38 * @param string theText tooltip content
40 function textTooltip(theText
) {
41 if (ttDOM
|| ttIE4
) { // document.getEelementById || document.all
42 myTooltipContainer
.innerHTML
= ""; // we should empty it first
43 myTooltipContainer
.innerHTML
= theText
;
44 } else if (ttNS4
) { // document.layers
45 var layerNS4
= myTooltipContainer
.document
;
46 layerNS4
.write(theText
);
57 * swap the Tooltip // show and hide
59 * @param boolean stat view status
61 function swapTooltip(stat
) {
63 if (stat
!='default') {
66 else if (stat
=='false')
70 ttTimerID
= setTimeout("showTooltip(false);",500);
76 clearTimeout(ttTimerID
);
84 * show / hide the Tooltip
86 * @param boolean stat view status
88 function showTooltip(stat
) {
91 myTooltipContainer
.visibility
= "hide";
93 myTooltipContainer
.style
.visibility
= "hidden";
97 myTooltipContainer
.visibility
= "show";
99 myTooltipContainer
.style
.visibility
= "visible";
104 * hold it, if we create or move the mouse over the tooltip
106 function holdTooltip() {
113 * move the tooltip to mouse position
115 * @param integer posX horiz. position
116 * @param integer posY vert. position
118 function moveTooltip(posX
, posY
) {
119 if (ttDOM
|| ttIE4
) {
120 myTooltipContainer
.style
.left
= posX
+ "px";
121 myTooltipContainer
.style
.top
= posY
+ "px";
123 myTooltipContainer
.left
= posX
;
124 myTooltipContainer
.top
= posY
;
131 * @param string theText tooltip content
133 function pmaTooltip( theText
) {
134 // reference to TooltipContainer
135 if ( null == myTooltipContainer
) {
137 myTooltipContainer
= document
.TooltipContainer
;
139 myTooltipContainer
= document
.all('TooltipContainer');
141 myTooltipContainer
= document
.getElementById('TooltipContainer');
146 if ( typeof( myTooltipContainer
) == 'undefined' ) {
151 var plusX
=0, plusY
=0, docX
=0, docY
=0;
152 var divHeight
= myTooltipContainer
.clientHeight
;
153 var divWidth
= myTooltipContainer
.clientWidth
;
154 if (navigator
.appName
.indexOf("Explorer")!=-1) {
155 if (document
.documentElement
&& document
.documentElement
.scrollTop
) {
156 plusX
= document
.documentElement
.scrollLeft
;
157 plusY
= document
.documentElement
.scrollTop
;
158 docX
= document
.documentElement
.offsetWidth
+ plusX
;
159 docY
= document
.documentElement
.offsetHeight
+ plusY
;
161 plusX
= document
.body
.scrollLeft
;
162 plusY
= document
.body
.scrollTop
;
163 docX
= document
.body
.offsetWidth
+ plusX
;
164 docY
= document
.body
.offsetHeight
+ plusY
;
167 docX
= document
.body
.clientWidth
;
168 docY
= document
.body
.clientHeight
;
171 ttXpos
= ttXpos
+ plusX
;
172 ttYpos
= ttYpos
+ plusY
;
174 if ((ttXpos
+ divWidth
) > docX
)
175 ttXpos
= ttXpos
- (divWidth
+ (ttXadd
* 2));
176 if ((ttYpos
+ divHeight
) > docY
)
177 ttYpos
= ttYpos
- (divHeight
+ (ttYadd
* 2));
179 textTooltip(theText
);
180 moveTooltip((ttXpos
+ ttXadd
), (ttYpos
+ ttYadd
));
185 * register mouse moves
189 function mouseMove(e
) {
190 if ( typeof( event
) != 'undefined' ) {