var t;

this.tooltip = function(){	
	
	xOffset = 10;
	yOffset = 20;
	
	var trigger = $(".itemName a");
	
	trigger.click(function(e){
	  e.preventDefault();
	
		resetTip();
	
		// Add tooltip to the page
		$("body").append("<p id='tooltip'></p>");
		
		tcont = $(this).parent().nextAll().each(function (i){
			$("#tooltip").append($(this).html());
		});
		
		this.title = "";
		
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("slow");
		
		
		t = setTimeout("closeTip()", 3000);
		e.stopPropagation(); 
		
		// Close tip on page click
		$(document).one("click", function() {
			closeTip();	
		});
		
		// Open links in new page/tab
		$("#tooltip a").click(function(e){
			e.preventDefault();
			window.open($(this).attr('href'));
		});
		
    });
}

function closeTip() {
	$("#tooltip").fadeOut('normal', function() {
			$(this).remove();
	});
}

function resetTip() {
	$("#tooltip").remove();
	clearTimeout(t);
}

