var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0); var isIE7 = isIE && (navigator.appVersion.toLowerCase().indexOf('msie 7.0')+1?1:0); var fieldtip = { leftPos : -200, /* used for the tip-field offset left */ topPos : -5, /* used for the tip-field offset top */ tipClass : 'hint', /* assumed classname for the tip, used to _find_ it */ activeTip : null, /* used to store the active tip */ isvisible: false, get : function(parent) { for(var i = 0; i < parent.childNodes.length; i++){ if(parent.childNodes[i].className && parent.childNodes[i].className.indexOf(this.tipClass) > -1 ){ return parent.childNodes[i]; //found the tip, YAY! }//nope, keep looking then } return null;// didn't find the tip, BORK! }, show : function(t){ var _fieldTop = t.offsetTop; var _fieldLeft = t.offsetLeft; var _y = _fieldTop; var _x = _fieldLeft; this.activeTip = this.get(t.parentNode); var _tipHeight = this.activeTip.offsetHeight; var _tipCanvas = document.getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0]; var _canvWidth = (_tipCanvas.clientWidth) ? _tipCanvas + _tipCanvas.scrollLeft : window.innerWidth + window.pageXOffset; var _canvHeight = (window.innerHeight) ? window.innerHeight + window.pageYOffset : _tipCanvas.clientHeight + _tipCanvas.scrollTop; //this.activeTip.style.width = ((this.activeTip.max_width) && (this.activeTip.offsetWidth > this.activeTip.max_width)) ? this.max_width + "px" : "auto"; this.activeTip.style.left = (_x + this.leftPos) + "px"; this.activeTip.style.top = (_y + this.topPos - _tipHeight) + "px"; if (isIE) { this.activeTip.style.left = "0px"; } if (isIE7) { this.activeTip.style.left = "-200px"; } /* check canvas bounds */ if( _x + this.activeTip.offsetWidth > _canvWidth ){ this.activeTip.style.left = (_canvWidth - this.activeTip.offsetWidth) + "px"; } if( _y + this.activeTip.offsetHeight > _canvHeight ){ this.activeTip.style.top = (_canvHeight - this.activeTip.offsetHeight) + "px"; } var x = 0; for(x = (isIE ? 0 : 1); x < this.activeTip.childNodes.length; x++) { if(this.activeTip.childNodes[x].getAttribute('class') == 'content' || this.activeTip.childNodes[x].className == 'content') { // Well, this is the internet explorer hack! break; } } if(this.activeTip.childNodes[x] && this.activeTip.childNodes[x].innerHTML != '' && this.activeTip.childNodes[x].innerHTML != 'undefined' && this.activeTip.childNodes[x].innerHTML != null) { this.activeTip.style.visibility = "visible"; this.isvisible = true; } }, hide : function(){ if(this.activeTip != null){ this.activeTip.style.visibility = "hidden"; this.activeTip = null; this.isvisible = false; } }, toggle : function(t){ if(this.isvisible) { this.hide(); } else { this.show(t); } } }