(function($){
	$.fn.tooltip = function(options) {
		var defaults={
			color: 'black',
			opacity:"1"
		}
		settings = $.extend({}, defaults, options);
		this.each(function(){
			var $this=$(this);
			var chr_id=this.rel;
			var chr_comment=this.title;
			var s="";
			if($this.is("a") && $this.attr("title")!=""){
				s+="<div class='clearfix'>";
				s+="	<div class='fuki'><div class='fuki_inner'><p>"+chr_comment+"</p></div>";
				s+="</div>";
				s+="<img src='/x/images/chr_100/"+chr_id+".gif' alt='' />";
				this.title="";
				$this.hover(
					function(e){
						//mouseover
						$("<div id='tooltip'>")
							.appendTo("body")
							.html(s)
							.hide()
							.css(
								{
									color:settings.color,
									top:e.pageY - 50,
									left:e.pageX + 20
								}
							)
							.fadeIn("slow");
					},
					function(){
						//mouseout
						$("#tooltip").fadeOut().remove();
					}
				);
			}
			$this.mousemove(function(e) {
				$('#tooltip').css({
					top: e.pageY - 50,
					left: e.pageX + 20
			     });
			});
			
		  });
		  // returns the jQuery object to allow for chainability.
		  return this;
	}
})(jQuery);
