/*
 * jQuery Tooltip Plugin
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Nekketu-Kenichi
 *
 */
(function($) {
	$.extend({
		tooltip : new function() {
			this.defaults = {
				xOffset : 10,
				yOffset : 30
			};

			this.construct = function(options) {
				return this.each(function() {
					var settings = $.extend({}, $.tooltip.defaults, options);

					$(this).hover(function(e){
						this.t = this.title;
						this.title = "";
						$("body").append("<p id='tooltip'>"+ this.t +"</p>");
						$("#tooltip")
							.css("top",(e.pageY - settings.xOffset) + "px")
							.css("left",(e.pageX + settings.yOffset) + "px")
							.fadeIn();
					    },
						function(){
							this.title = this.t;
							$("#tooltip").remove();
					    }
					);

					$(this).mousemove(function(e){
						$("#tooltip")
							.css("top",(e.pageY - settings.xOffset) + "px")
							.css("left",(e.pageX + settings.yOffset) + "px");
					});
				});
			};
		}
	});

	$.fn.extend({
		tooltip : $.tooltip.construct
	});

})(jQuery);


