$(function(){
  
  var verif = true;
  //RollOver
  $(".ajax_block_product a.product_image, .ajax_block_product a.icone_new, .ajax_block_product a.product_img_link").mouseover(function(){

  	//insert the Bubble span in the code
  	$("#featured-products_block_center, #product_list").append('<span class="bubble"></span>');
  	//creation var the ultimate bubble selected
  	var bubble = $(".bubble:last");
  	
  	 $(this).parent().find("a").attr("title", "");
    //Get a title H5, txt, price in variable
  	var txt = $(this).parent().find(".product_desc").html();
  	var h5 = $(this).prev(".product_desc").html();
  	var price = $(this).next("div span.price").find(".price").html();
  	var content = '<i>' + txt + '</i>';
  	
  	//Insert content in the Bubble
  	bubble.html(content);
  	
  	// Animation
  	var posLeft = $(this).offset().left-$(this).width()/2 + $(this).width()/4;
  	var posTop = $(this).offset().top-$(this).height()/2-bubble.height();
  	bubble.css({
  		left:posLeft,
  		top:posTop,
  		opacity:1,
  	});
  	// Condition for the bug when the bubble is in over
  	if( verif == true){
	  	bubble.stop().animate({
	  		top:posTop+bubble.height(),
	  		left:posLeft,
	  		opacity:1,
	  	}, 500);
	  	
	    $(".bubble").mouseover(function(){
	      verif = false;
  		  $(this).stop();
        });
        
        $(".bubble").mouseout(function(){
	      verif = true;
	      $(this).stop().animate({
  	        opacity:1
  	      }, 500, function(){
  		    $(this).remove();
  	      });
  		  
        });
  	}
  
  	
  });
 
    //RollOut
  $(".ajax_block_product a.product_image, .ajax_block_product a.icone_new, .ajax_block_product a.product_img_link").mouseout(function(){
  	var bubble = $(".bubble:last");
  	var posLeft = $(this).offset().left;
  	var posTop = $(this).offset().top;
  	verif = true;
  	bubble.stop().animate({
  	  top:posTop-150,
  	  opacity:0
  	}, 500, function(){
  		bubble.remove();
  	});
  	
  });

});
