function attachTooltips(xOffset, yOffset) {
	if (typeof xOffset == 'undefined') {
		xOffset = 0;
	}
	if (typeof yOffset == 'undefined') {
		yOffset = 20;		
	}
	$(".tooltip").live('mouseenter', function(e){
		this.t = this.title;
		this.title = "";
		if ($(this).attr('rel') && $('#'+$(this).attr('rel')).length) {
			this.t = $('#'+$(this).attr('rel')).html();
		}
		$("body").append("<div id='tooltip'>"+ this.t +"</div>");
		$("#tooltip")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn("fast");		
    });
	$(".tooltip").live('mouseleave', function(e){
		if ($(this).attr('rel') && $('#'+$(this).attr('rel')).length) {
			this.title = '';
		}
		else {
			this.title = this.t;
		}
		xOffset = 0;
		yOffset = 20;		

		$("#tooltip").remove();
    });	
	$(".tooltip").live('mousemove', function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
}
$(function() {
	attachTooltips();
});
