positionTip: function(e) { if ( this.tip && this.tip.style ) { // put e.pageX/Y first! (for Safari) var x = e.pageX? e.pageX: e.clientX + viewport.scrollX; var y = e.pageY? e.pageY: e.clientY + viewport.scrollY;
if ( x + this.tip.offsetWidth + this.offX > viewport.width + viewport.scrollX ) { x = x - this.tip.offsetWidth - this.offX; if ( x < 0 ) x = 0; } else x = x + this.offX;
if ( y + this.tip.offsetHeight + this.offY > viewport.height + viewport.scrollY ) { y = y - this.tip.offsetHeight - this.offY; if ( y < viewport.scrollY ) y = viewport.height + viewport.scrollY - this.tip.offsetHeight; } else y = y + this.offY;
this.tip.style.left = x + "px"; this.tip.style.top = y + "px"; }