(function($){
	$.fn.tooltip = function(options) {
		this.each(function() {
			var $this = $(this);
			var title = this.title;

			if ( $this.attr('title') != '' ) {
				this.title = '';
				
				$this.hover(function(e) {
					// mouse over
					$('<div id="tooltip" />')
						.appendTo('body')
						.text(title)
						.hide()
						.css({
							top:  e.pageY + 10,
							left: e.pageX + 20
						})
					.fadeIn('fast');
				}, function() {
					// mouse out
					$('#tooltip').remove();
				});	
			}

			$this.mousemove(function(e) {
				$('#tooltip').css({
					top: e.pageY + 10,
					left: e.pageX + 20
				});
			});
		});
		// returns the jQuery object to allow for chainability.
		return this;
	}
})(jQuery);