/**
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
*	alex_inside: 17.09.2009, changed content text() to html() at lines 12, 13.
**/
(function(){ jQuery.fn.simpletooltip = function(){
	return this.each(function() {
	//	var text = jQuery(this).attr("title");
	//	text = obj.content;
		var head = jQuery("h3", this).html();
		var text = jQuery("p", this).html();
		jQuery(this).attr("title", "");
		if(text != undefined && head != undefined) {
			jQuery(this).hover(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				jQuery(this).attr("title", ""); 
				content = "<div id='simpleTooltip' style='position:absolute;z-index:100;display: none;'><strong>" + head + "</strong><p>" + text + "</p></div>";
				jQuery("body").append(content);
				if(jQuery.browser.msie) var tipWidth = jQuery("#simpleTooltip").outerWidth(true)
				else var tipWidth = jQuery("#simpleTooltip").width()
				jQuery("#simpleTooltip").width(tipWidth);
				jQuery("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("medium");
			}, function(){
				jQuery("#simpleTooltip").remove();
				//jQuery(this).attr("title", text);
			});
			jQuery(this).mousemove(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				var tipWidth = jQuery("#simpleTooltip").outerWidth(true);
				var tipHeight = jQuery("#simpleTooltip").outerHeight(true);
				if(tipX + tipWidth > jQuery(window).scrollLeft() + jQuery(window).width()) tipX = e.pageX - tipWidth;
				if(jQuery(window).height()+jQuery(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
				jQuery("#simpleTooltip").css("left", tipX).css("top", tipY).fadeIn("fast");
			});
		}
	});
}})(jQuery);
