$(document).ready(function(){
	xOffset = 10;
	yOffset = 20;		
	// these 2 variable determine popup's distance from the cursor
	// you might want to adjust to get the right result		
	$("a.glossario").hover(function(e){
		palavra = this.href.substr(this.href.lastIndexOf("/")+2);
		$("body").append("<div id='glossario'>carregando...</div>");
		$('#glossario').load(location.protocol+'//'+location.host+'/app/views/pt/glossario/'+palavra+'.php');
		$("#glossario")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		$("#glossario").remove();
    });
	$("a.glossario").mousemove(function(e){
		$("#glossario")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
});