/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

App.toolTip = function(node, txt, w, align, ev) {
	var offsetxpoint=0;
	var offsetypoint=20;
	var enabletip=false;
	var tipobj=$('tooltip');
	if (w==null) w = 150;
	if (align==null) align = "center";
	
	function ietruebody(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
	}
	
	this.display = function(node, txt, w, align){
		document.onmousemove=positiontip;
		Event.observe(node, 'mouseout', this.hide, false);
		
		tipobj.style.textAlign=align;
		tipobj.innerHTML='<div class="tooltipFrame"><div class="tooltipFrame2">'+txt+'</div></div>';
		tipobj.style.display="block";
		
		if (tipobj.offsetWidth>w) tipobj.style.width=w+"px";
		enabletip=true;		
	}
	
	function positiontip(e){
		if (enabletip){
			var curX=(Browser.isIE)?event.x+ietruebody().scrollLeft:e.pageX;
			var curY=(Browser.isIE)?event.y+ietruebody().scrollTop:e.pageY;
			var rightedge=Browser.isIE&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
			var bottomedge=Browser.isIE&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
			
			var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
			
			
			if (rightedge<tipobj.offsetWidth)
			
			tipobj.style.left=(Browser.isIE) ? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
			else if (curX<leftedge) {
				tipobj.style.left="5px";
			} else {
			
				tipobj.style.left=curX+offsetxpoint+"px";
			}
			
			
			if (bottomedge<tipobj.offsetHeight) {
				var d = (Browser.isSafari) ? 0 : window.pageYOffset;
				tipobj.style.top=(Browser.isIE)? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : d+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
			} else {
				tipobj.style.top=curY+offsetypoint+"px";
			}
			tipobj.style.visibility="visible";
		}
	}
	
	this.hide = function(){
		document.onmousemove=null;
		enabletip=false;
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.backgroundColor='';
		tipobj.style.width='';
	}
	
	this.display(node, txt, w, align);
	
}

