$(document).ready(function(){
	
	Tooltip.init(8,30);
});

var Tooltip =
{
	init:function(xOffset, yOffset)
	{
		this.xOffset = xOffset;
		this.yOffset = yOffset;
		
		$("a.tooltip").hover(this.over, this.out);
		$("a.tooltip").mousemove(this.move);
	},
	
	over:function(e)
	{
		if ($(this).attr("title") != "") 
		{
			this.t = $(this).attr("title");
			$(this).attr("title", "");
			$(this).children(0).attr("alt", "");
			
			$("body").append("<p id='tooltip'>" + this.t + "</p>");
			
			$("#tooltip")
				.css("position", "absolute")
				.css("top", (e.pageY - Tooltip.yOffset) + "px")
				.css("left", (e.pageX + Tooltip.xOffset) + "px")
				.fadeIn("def");
		}
	},
	
	out:function(e)
	{
		$(this).attr("title", this.t);
		$("#tooltip").remove();
	},
	
	move:function(e)
	{
		
		$("#tooltip")

			.css("top",(e.pageY - Tooltip.yOffset) + "px")

			.css("left",(e.pageX + Tooltip.xOffset) + "px");
	}			
}