
/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.tooltip = function(){ 
	/* CONFIG */		
		xOffset = -10;
		yOffset = -220;
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$(".tooltip").hover(function(e){
		if($(this).hasClass('txtToPhone')) {
			//xOffset = -10;
			//yOffset = -220;
			tip = 'CLICK&nbsp;&nbsp;&nbsp;&nbsp;ICON&nbsp;&nbsp;&nbsp;&nbsp;TO&nbsp;&nbsp;&nbsp;&nbsp;HAVE&nbsp;&nbsp;&nbsp;&nbsp;THIS<br />COMMUNITY\'S&nbsp;&nbsp;&nbsp;&nbsp;<span class="sendWhat">INFORMATION</span><br />TEXTED&nbsp;&nbsp;&nbsp;TO&nbsp;&nbsp;&nbsp;&nbsp;YOUR&nbsp;&nbsp;&nbsp;&nbsp;PHONE';
		} else {
			//xOffset = -10;
			//yOffset = -220;
			tip = 'CLICK&nbsp;&nbsp;&nbsp;&nbsp;ICON&nbsp;&nbsp;&nbsp;&nbsp;TO&nbsp;&nbsp;&nbsp;&nbsp;HAVE<br />THE&nbsp;&nbsp;&nbsp;<span class="sendWhat">DIRECTIONS</span>&nbsp;&nbsp;&nbsp;&nbsp;TO<br />THIS&nbsp;&nbsp;&nbsp;&nbsp;COMMUNITY&nbsp;&nbsp;&nbsp;TEXTED<br />TO&nbsp;&nbsp;&nbsp;&nbsp;YOUR&nbsp;&nbsp;&nbsp;&nbsp;PHONE';
		}		
		
		// Set the title to this array element
		$(this).attr('title',tip)
		
		this.t = $(this).attr('title');
		this.title = "";
		// attach this to the body
		var box = '<div id="tooltip">';
		box += "<p class='toolName'>"+$(this).parent().attr('id')+"</p>";
		box += "<p>"+ this.t +"</p>";
		box += '</div>';
		 
		//$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("body").append(box);
		// Place somewhere near the cursor
		
			$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
			
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$(".tooltip").mousemove(function(e){
		
			$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");		
		
	});			
};
$(document).ready(function(){
tooltip();		
});

