DHTML={
	eventTarget:function(e){
		e=this.getEvent(e);
		var targ=(e.target)?e.target:e.srcElement;
		if(!targ){targ=e;}
		if(targ.nodeType===3){targ=targ.parentNode;} // defeat Safari bug
		return targ;
	},

	getEvent:function(e){
		if(!e){var e=window.event}
		return e;
	},
	
	mouse_position:function(e){
		e=this.getEvent(e);
		this.clientWindow=new clientwindow();
		this.clientScroll=new scrollposition();
		if(Browser.ie){
			this.xPos=e.clientX+this.clientScroll.x;
			this.yPos=e.clientY+this.clientScroll.y;
		}else{
			this.xPos=e.pageX;
			this.yPos=e.pageY;
		}
	}
}


//	DYNAMIC TOOLTIP FUNCTION
Tooltip={
	eventlistenerAdd:function(evType,fn){
		if(this.addEventListener) {		//	W3C
			this.addEventListener(evType,fn,false);
		}else if(this.attachEvent){		//	IE
			this.attachEvent("on"+evType,fn);
		}else{
			var originalHandler=this["on"+evType];
			if (originalHandler){
				this["on"+evType]=function(e){originalHandler(e);fn(e);};
			}else{
				this["on"+evType]=fn;
			}
		}
	},

	showit:function(obj){
		if(!this.tooltip){this.init()}
		this.tooltip.style.display="block"
		eTermin=DHTML.eventTarget(obj);
		this.fillMe(obj.title);
		return true;
	},

	hideit:function(obj){
		//	hide popup layer
		if(this.tooltip){this.tooltip.style.display="none"}
		return true;
	},

	fillMe:function(content){
		alert(content)
		this.tooltip.childNodes[1].innerHTML=content
	},

	followMe:function(e){
		coords=new DHTML.mouse_position(e)
		popupLeft=coords.xPos+aPopOffset[0]
		popupBottom=coords.yPos+aPopOffset[1]+this.tooltip.offsetHeight
		this.tooltipX=(popupLeft>integer(oRoot.offsetLeft)?integer(popupLeft)>coords.clientScroll.x?popupLeft:coords.clientScroll.x:oRoot.offsetLeft)
		this.tooltip.style.left=(this.tooltipX+this.tooltip.offsetWidth+aPopOffset[0])>(coords.clientWindow.w+coords.clientScroll.x)?((coords.clientWindow.w+coords.clientScroll.x)-(this.tooltip.offsetWidth+aPopOffset[0]))+"px":this.tooltipX+"px";	//	stay inside window (horizontal)
		this.tooltip.style.top=(popupBottom>(coords.clientWindow.h+coords.clientScroll.y-25)?coords.yPos-(this.tooltip.offsetHeight+aPopOffset[1])+"px":(popupBottom-this.tooltip.offsetHeight)+"px")	//	stay inside window (vertical)
	},
	
	init:function(){
		this.tooltip=$("tooltip");
	}
}
