/*
Simple tooltip using jQuery (http://www.jquery.com)
written by Daniel Ruuth @ nute.se
*/
 


this.tooltip = function(){	
	
	xOffset = 10;
	yOffset = 20;		
				
	jQuery("a.nutelexiconword").hover(function(e){											  
		this.t = this.title;
		var word = $(this).html()
		var tool_body = jQuery('<p id="tooltip"><img src="/wp-content/themes/strukturinvest/assets/ajax-loader.gif" /></p>');
		
		
		
		this.title = "";
		
		
											  
		//jQuery("body").append("<p id='tooltip'>"+ this.t +"</p>");
		jQuery("body").append( tool_body );
		
		if(this.t=="" || this.t==undefined){
			jQuery.get('/xmlrpc/?lexicon='+word, function(data){
				tool_body.html( data );
				
			});
		}else{
			tool_body.html( this.t )
		}

		
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltip").remove();
    });	
	jQuery("a.tooltip").mousemove(function(e){
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



// starting the script on page load
jQuery(document).ready(function(){
	tooltip();
});
