//##################################################################################
//##################################################################################
//##################################################################################
//##### JASON BUBBLE
// 
// 
// **SAMPLE FUNCTION CALL**
//$('#container').mouse_mouse({
//		text: 'This is a big box',
//		offset_x: -20,
//		offset_y: -20
//	}); 
//
//
(function($){
 $.fn.mouse_mouse = function(options) {
	var defaults = {
		offset_x: -20,
		offset_y: -40
	};  
	
	var options = $.extend(defaults, options); 
	
	return this.each(function() {  
		
		var target_name = $(this).attr('id');
		
		var bubble_h = $('.'+target_name).height();
		var bubble_w = $('.'+target_name).width();
			
		$(this).bind('mousemove', function(e){	
			
			//find center of container box
			if(e.pageX >= (window.innerWidth - bubble_w) - 20)
				$('.bubble').css({'left': (e.pageX - (options.offset_x * -2) - bubble_w), 'top': (e.pageY - bubble_h - options.offset_y)});
			else
				$('.bubble').css({'left': (e.pageX - options.offset_x), 'top': (e.pageY - bubble_h - options.offset_y)});
			
			$('.'+target_name).fadeIn('fast');
				
		});
		
		//fade out bubble on mouseout
		$(this).mouseout(function(e){
			$('.'+target_name).fadeOut('fast');
		});
	});

	};
})(jQuery);










