/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * originally written by Alen Grakalic (http://cssglobe.com)
 * modified by Active Frequency to just use the .data jquery method to store the title
 * rather than repeatedly setting/unsetting the title element, because that
 * leads to weird situations if the unhover doesn't fire properly.
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 


this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */

  // move the tooltips out of the title element so we can handle the tooltips ourselves
  // do this here rather than in the hover handler because otherwise IE will show it anyway
  // before the hover() code executes
	$("a.tooltip").each(function(el){
		if (this.title){
		  $(this).data('tooltip', this.title).removeAttr('title');	
		}
  });
  
	$("a.tooltip").hover(function(e){
		$("body").append("<p id='tooltip'>"+ $(this).data('tooltip') +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		//this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

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