// JavaScript Document
//ツールチッププラグイン

$.fn.easyToolTip = function(options){
	
	var toolTip = $('<div id="toolTip"></div>').hide();
	$('body').append(toolTip);
	
	$(this).filter(function(){
		return this.title;
	}).each(function(){
		
		var self = $(this);
		var target = this.title ? 'title' : 'alt';
		var tipText = self.attr(target);
		
		self.hover(function(e){
			self.attr(target,'');
			toolTip
			.stop(true,true)
			.fadeIn('fast')
			.text(tipText)
			.css({
				position: 'absolute',
				top: e.pageY - 20,
				left: e.pageX + 20
			});
		},function(){
			self.attr(target,tipText);
			toolTip.fadeOut('fast');
		}).mousemove(function(e){
			toolTip.css({
				top: e.pageY - 20,
				left: e.pageX + 20
			});
		});
		
	});
}

$(function(){
	//ツールチップの実行
	$('img,a,span').easyToolTip();
});

//ここまで
