1 // Copyright (C) 2007 Rod Roark <rod@sunsetsystems.com>
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 // See interface/patient_file/history/encounters.php for an example of
9 // implementing tooltips with this module.
16 elem
= elem
.offsetParent
;
24 elem
= elem
.offsetParent
;
29 // onmouseover handler.
30 function ttshow(elem
, tttext
) {
31 var ttobject
= document
.getElementById("tooltipdiv");
32 ttobject
.innerHTML
= tttext
;
34 var dw
= window
.innerWidth
? window
.innerWidth
- 20 : document
.body
.clientWidth
;
35 if (dw
&& dw
< (x
+ ttobject
.offsetWidth
)) {
36 x
= dw
- ttobject
.offsetWidth
;
39 var y
= getY(elem
) - ttobject
.offsetHeight
- 10;
40 if (y
< 0) y
= getY(elem
) + elem
.offsetHeight
+ 10;
41 ttobject
.style
.left
= x
;
42 ttobject
.style
.top
= y
;
43 ttobject
.style
.visibility
='visible';
47 // onmouseout handler.
49 var ttobject
= document
.getElementById("tooltipdiv");
50 ttobject
.style
.visibility
='hidden';
51 ttobject
.style
.left
= '-1000px';