﻿/***********************************************************/
/*                    tinyTips Plugin                      */
/*                      Version: 1.0                       */
/*                      Mike Merritt                       */
/*                 Updated: Feb 4th, 2010                  */
/***********************************************************/
(function($){
	$.fn.tinyTips = function (supCont) {
		/* User settings
		*****************/
		// Markup for tooltips
		var tipFrame = '<div class="tinyTip"><div class="content"></div><div class="bottom">&nbsp;</div></div>';
		// Speed of the animations in milliseconds
		var animSpeed = 300;

		/************************
    * End of user settings
		************************/
		var tinyTip;
		var tText;
		$(this).hover(function() {
			$('body').append(tipFrame);
			tinyTip = $('div.tinyTip');
			tinyTip.hide();
			$('.tinyTip .content').html((supCont === 'title') ? $(this).attr('title'):supCont);
			tText = $(this).attr('title');
			$(this).attr('title', '');

			var pos = $(this).offset();
			pos.top = pos.top - tinyTip.outerHeight();
			pos.left = pos.left - (tinyTip.width() - 10)/2 + $(this).width()/2;
			tinyTip.css('position', 'absolute').css('z-index', '1000').css(pos).fadeIn(animSpeed);
		}, function() {
			$(this).attr('title', tText);
			$('div.tinyTip').fadeOut(animSpeed, function() { $(this).remove(); });
		});
	}
})(jQuery);
