var leafTooltip = function() {

	var show = function() {
		
		var link = jQuery(this);
		
		var ttId = "#" + link.attr("href").split("#")[1];
		var tt = jQuery(ttId);
				
		var linkPosition = link.offset();
		var x = linkPosition.left + link.width() / 2 - tt.width() / 2;
		var y = linkPosition.top + link.height() + 10;
		
		tt.removeClass('hidden');
		tt.css({left: x, top: y});
		
	}
	
	var hide = function() {
		var ttId = "#" + jQuery(this).attr("href").split("#")[1];
		jQuery(ttId).addClass('hidden');
	}
	
	this.init = function() {
		jQuery(".jsTooltip").hover(show, hide);
		jQuery(".tooltip").addClass('hidden');
	}
	
	this.init();
	
}


/* Use only for CALL/CHAT tooltip */
var leafHelpTooltip = function() {

	var show = function(e) {
		
		var link = jQuery(this);
		
		var tt = jQuery("#ttCallChat").addClass('hidden');
		tt.removeClass('hidden');
				
		var linkPosition = link.offset();
		var x = linkPosition.left + link.width() / 2 - tt.width() / 2;
		var y = linkPosition.top + link.height() - tt.height();
		
		tt.css({left: x, top: y});
		
	}
	
	var hide = function(e) {
		jQuery("#ttCallChat").addClass('hidden');
	}
	
	this.init = function() {
		if (jQuery("#ttCallChat").size() > 0 && jQuery(".jsTooltipHelp").size() > 0) {
			jQuery(".jsTooltipHelp").bind('mouseenter', show);
			jQuery("#ttCallChat").bind('mouseleave', hide);
			jQuery("#ttCallChat").addClass('hidden');
		}
	}
	
	this.init();
	
}
