/* 
 * Copyright 2008 by Robert Baumgartner; the.godking.com
 * All rights reserved
 * 
 * You may use this script, as long as this copyright information won't be removed nor changed.
 * 
*/
	tooltipClass=".tooltip"; // replace with your class, for multiple classes, separate with comma.

	function str_replace(search, replace, subject) { 
		return subject.split(search).join(replace); 
	}
	
	this.tooltip=function(){
		xOffset=10;
		yOffset=20;
		fadeInTime=900;
		$(tooltipClass).livequery("mouseover",function(e){
			if (!this.rel)										   
				this.t=this.innerHTML;			
			else
				this.t=this.rel;

			this.t=str_replace("::", "<br />", this.t);
			this.t=str_replace("[!]", "<span class='tooltipTitle'>", this.t);
			this.t=str_replace("[/!]", "</span><br />", this.t);
			this.t=str_replace("[", "<", this.t);
			this.t=str_replace("]", ">", this.t);
			if(this.t != "") {
				$("#tooltip").remove();
				$("body").append("<p id='tooltip'>"+this.t+"</p>");
				$("#tooltip").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").css("opacity",0).css("marginTop",0);
				$("#tooltip").animate({marginTop:yOffset,opacity:0.9},400,"easeOutExpo");
			}

	    });
		
		$(tooltipClass).livequery("mouseout",function(e){
			//this.title=this.t;
			$("#tooltip").animate({marginTop:yOffset*2,opacity:0},400,"easeOutExpo",function(){
				jQuery("#tooltip").remove();
			});

	    });		
		$(tooltipClass).livequery("mousemove",function(e){
			$("#tooltip").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px");
		});
	};
	
	$(document).livequery(
		function(){
			tooltip();
		}
	);

