home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 118 / cdrom118.iso / internet / webaroo / WebarooSetup.exe / Webaroo.msi / _23427055FC634066AD90D41116A148B0 < prev    next >
Encoding:
Text File  |  2006-01-09  |  4.3 KB  |  110 lines

  1. /***********************************************
  2. * Cool DHTML tooltip script II- πâ╗Dynamic Drive DHTML code library (www.dynamicdrive.com)
  3. * This notice MUST stay intact for legal use
  4. * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
  5. ***********************************************/
  6.  
  7. var offsetfromcursorX=12 //Customize x offset of tooltip
  8. var offsetfromcursorY=10 //Customize y offset of tooltip
  9.  
  10. var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
  11. var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
  12.  
  13. document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
  14. document.write('<img id="dhtmlpointer" src="images/webaroo_arrow2.gif">') //write out pointer image
  15.  
  16. var ie=document.all
  17. var ns6=document.getElementById && !document.all
  18. var enabletip=false
  19. if (ie||ns6)
  20. {
  21.     var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
  22.     var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
  23. }
  24.  
  25. function ietruebody(){
  26. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  27. }
  28.  
  29. function ddrivetip(thetext, thewidth, thecolor){
  30. if (ie||ns6)
  31. {
  32.     var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
  33.     var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
  34. }
  35. if (ns6||ie){
  36. if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
  37. if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
  38. tipobj.innerHTML=thetext
  39. enabletip=true
  40. return false
  41. }
  42. }
  43.  
  44. function positiontip(e){
  45. if (ie||ns6)
  46. {
  47.     var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
  48.     var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
  49. }
  50. if (enabletip){
  51. var nondefaultpos=false
  52. var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
  53. var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
  54. //Find out how close the mouse is to the corner of the window
  55. var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
  56. var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
  57.  
  58. var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
  59. var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
  60.  
  61. var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
  62.  
  63. //if the horizontal distance isn't enough to accomodate the width of the context menu
  64. if (rightedge<tipobj.offsetWidth){
  65. //move the horizontal position of the menu to the left by it's width
  66. tipobj.style.left=curX-tipobj.offsetWidth+"px"
  67. nondefaultpos=true
  68. }
  69. else if (curX<leftedge)
  70. tipobj.style.left="5px"
  71. else{
  72. //position the horizontal position of the menu where the mouse is positioned
  73. tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
  74. pointerobj.style.left=curX+offsetfromcursorX+"px"
  75. }
  76.  
  77. //same concept with the vertical position
  78. if (bottomedge<tipobj.offsetHeight){
  79. tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
  80. nondefaultpos=true
  81. }
  82. else{
  83. tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
  84. pointerobj.style.top=curY+offsetfromcursorY+"px"
  85. }
  86. tipobj.style.visibility="visible"
  87. if (!nondefaultpos)
  88. pointerobj.style.visibility="visible"
  89. else
  90. pointerobj.style.visibility="hidden"
  91. }
  92. }
  93.  
  94. function hideddrivetip(){
  95. if (ie||ns6)
  96. {
  97.     var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
  98.     var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
  99. }
  100. if (ns6||ie){
  101. enabletip=false
  102. tipobj.style.visibility="hidden"
  103. pointerobj.style.visibility="hidden"
  104. tipobj.style.left="-1000px"
  105. tipobj.style.backgroundColor=''
  106. tipobj.style.width=''
  107. }
  108. }
  109.  
  110. document.onmousemove=positiontip