//JQuery Quick Tip
//Author: Owain Lewis
//Author URL: www.Owainlewis.com
// modified by Marek Svarc, www.hogen.cz

jQuery.fn.quicktip = function(options){

	var defaults = {
		speed: 500,
		xOffset: 10,
		yOffset: 10
	};

	var options = $.extend(defaults, options);
	
	return this.each(function(){

		var $this = jQuery(this);
		
		var content = '';
		if ($this.attr('title')) {
			content = ($this.attr('title'));
			$this.removeAttr('title');
		}
		if ($this.attr('rel')) {
			content = $('.quicktip-content.'+$this.attr('rel')).html();
		}

		$(this).hover(
			function(e) {
	            $("body").append("<div id='quicktip'>" + content + "</div>");
				$("#quicktip")
					.css({
						top: (e.pageY + defaults.xOffset) + "px",
						left: (e.pageX + defaults.yOffset) + "px"
					})
		            .fadeIn(options.speed);
			},
			function() {
				$("#quicktip").remove();
			}
		);
			
		$(this).mousemove(function(e) {
			$("#quicktip").css({
				top: (e.pageY + defaults.xOffset) + "px",
				left: (e.pageX + defaults.yOffset) + "px"
			});
		});

	});
	
};



