/**
* Function name has been changed from simpletooltip for
* plugin naming simplicity.
*
*	simpleTooltip jQuery plugin, by Marius ILIE
*	visit http://dev.mariusilie.net for details
*
**/
(function(jQuery){ jQuery.fn.sfGlossaryToolTip = function(){
	return this.each(function() {
		var text = jQuery(this).attr("title");
		jQuery(this).attr("title", "");
		jQuery(this).attr("class", "glossaryTerm");
		if(text != undefined) {
			jQuery(this).hover(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				jQuery(this).attr("title", "");
				jQuery("body").append("<div id='glossaryToolTip' style='position: absolute; z-index: 100; display: none;'>" + text + "</div>");
				if(jQuery.browser.msie) var tipWidth = jQuery("#glossaryToolTip").outerWidth(true)
				else var tipWidth = jQuery("#glossaryToolTip").width()
				jQuery("#glossaryToolTip").width(tipWidth);
				jQuery("#glossaryToolTip").css("left", tipX).css("top", tipY).fadeIn("medium");
			}, function(){
				jQuery("#glossaryToolTip").remove();
				jQuery(this).attr("title", text);
			});
			jQuery(this).mousemove(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				var tipWidth = jQuery("#glossaryToolTip").outerWidth(true);
				var tipHeight = jQuery("#glossaryToolTip").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("#glossaryToolTip").css("left", tipX).css("top", tipY).fadeIn("medium");
			});
		}
	});
}})(jQuery);

(function(jQuery){ jQuery.fn.sfGlossaryToolTipRemove = function(){
	return this.each(function() {
    jQuery(this).before(jQuery(this)[0].innerHTML).remove();
	});
}})(jQuery);