function tooltip(x, html, maxWidth, myEvent, location) { var tt = document.createElement("div"); tt.className = "tooltip"; tt.innerHTML = html; tt.style.maxWidth = maxWidth + "px"; var arrow = new Image(); if(location == "bottom") { arrow.src = "images/tooltip_arrowbtm.gif"; arrow.setAttribute("id", "tt_arrowbtm"); } else { arrow.src = "images/tooltip_arrow.gif"; arrow.setAttribute("id", "tt_arrow"); } tt.appendChild(arrow); tt.style.visibility = "hidden"; document.body.appendChild(tt); var ttHeight = tt.offsetHeight + 4; var ttWidth = Math.round(tt.offsetWidth/2); var daHeight = x.offsetHeight; var pos = getAbsolutePos(x); tt.style.left = myEvent.clientX - ttWidth + "px"; if(location == "bottom") { tt.style.top = Math.round((pos.y + x.offsetHeight + 4)) + "px"; } else { tt.style.top = Math.round((pos.y - ttHeight)) + "px"; } arrow.style.left = ttWidth - 4 + "px"; tt.style.visibility = "visible"; x.onmousemove = function(event) { if(isLTIE8 == true) { tt.style.left = window.event.clientX - ttWidth + "px"; } else { tt.style.left = event.clientX - ttWidth + "px"; } } x.onmouseout = function() { document.body.removeChild(tt); x.onmousemove = ""; } }