﻿(function($){  
	$.fn.tinyTips = function (supCont) {
		var tipFrame = '<div class="tltip"></div>';
		var animSpeed = 300;
		var tinyTip;
		var tText;
		
		$(this).hover(function() {
		
			$('body').append(tipFrame);
			tinyTip = $('div.tltip');
			tinyTip.hide();
			
			if (supCont === 'title') {
				var tipCont = $(this).attr('title');
			} else if (supCont !== 'title') {
				var tipCont = supCont;
			}
			$('.tltip').html(tipCont);
			tText = $(this).attr('title');
			$(this).attr('title', '');
			
			var yOffset = tinyTip.height() + 30;
			var xOffset = tinyTip.width() - 5;
			
			var pos = $(this).offset();
			var nPos = pos;
			
			nPos.top = pos.top - yOffset;
			nPos.left = pos.left - xOffset;
			
			tinyTip.css('position', 'absolute').css('z-index', '1000');
			tinyTip.css(nPos).fadeIn(animSpeed);
			
		}, function() {
			$(this).attr('title', tText);
			$('div.tltip').fadeOut(animSpeed, function() {
				$(this).remove();
			});
		});
	}
})(jQuery);
