/* 

   proTips v0.2 (05.09.2009)
   plugin for jQuery
   (c) http://developing.name/, http://otpro.ru/
   
   using: <div class="protips"> <a> <div>, <span> <div>, <strong> <div> etc... </div>
   
*/

(function($) {

	$.fn.protips = function(options) {
		
		options = $.extend({
			tips: "div.protips",
			attr: "",
			tags: "a, span, strong",
			width: 100,
			padding: 2,
			border: "1px solid #FF0000",
			color: "#000000",
			background: "#EEEEEE",
			link: "#FF0000",
			underline: "1px dotted #FF0000"
		}, options);		
		
		$(options.tips).children(options.tags).css({
			'display': 'inline',
			'text-decoration': 'none',
			'color': options.link,
			'height': 18,
			'border-bottom': options.underline 
		});
		
		if (options.attr != "")
		{
			$(options.tips+" "+options.tags+"["+options.attr+"]").each( function() {
				$(this).after("<div>" + $(this).attr(options.attr) + "</div>").attr(options.attr,'');
			});
		}
		
		$(options.tips).children("div").css({ 
				'position': 'absolute',
				'display': 'none', 
				'white-space': 'normal',
				'width': options.width,
				'padding': options.padding,
				'color': options.color,
				'background-color': options.background,
				'border': options.border
		});
				
		$(options.tips).children(options.tags).bind("mouseover, mousemove", function(e) {
					
			$(this).next("div").css({ 
				'display': 'block',
				'top': e.pageY+12,
				'left': e.pageX+12
			});
			
			return false;
		});
					
		$(options.tips).children(options.tags).bind("mouseout", function() {
			$(this).next("div").css({ 
				'display' : 'none' 
			});
			return false;
		});

		$(options.tips).children(options.tags).bind("click", function() {
			return false;
		});
	}
					
})(jQuery);
