/*
 * jQuery Hirle Tooltip plugin 1.0
 * http://www.marinahirle.com.br
 * Copyright (c) 2008 Marina Hirle
 * 
 * sample: $(".container").hirleTooltip();
 * 
 */
 
jQuery.fn.hirleTooltip = function () {
	$(this).find("a").each(function(){
		$(this).addClass("preview");
		$(this).click(function(){
			return false;
		});
	});
	xOffset = 10;
	yOffset = 30;
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p class='hirleTooltip'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$(".hirleTooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$(".hirleTooltip").remove();
    });	
	$("a.preview").mousemove(function(e){
		$(".hirleTooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

