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 */		
	$("ul.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltipId'>"+ this.t +"</p>");
		$("#tooltipId")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltipId").remove();
    });	
	$("ul.tooltip").mousemove(function(e){
		$("#tooltipId")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



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



	function addToBasket(productId) {
		if($('#'+productId+'_qty').val() > 0) {
			$.ajax({
				type: "POST",
				url: "/packaging",
				data: "ajax=true&productId="+productId+"&productQuantity="+$('#'+productId+'_qty').val(),
				success: function(answer){
					$('#costOfProductsInCart').html(answer);
					$('#numberOfProductsInCart').html(parseInt($('#numberOfProductsInCart').html())+parseInt($('#'+productId+'_qty').val()));
					$('#'+productId+'_qty').val('');
				}
			});
		}
		else {
			alert('You need to enter required quantity before adding to basket.');
		}
	}