$(document).ready(function(){ 	
	
	$("#btnAddToCart").click(function() {	
									  
		//alert('alert');									  
									  
		var productIDVal 			= this.value;
		
		var productX 		= $("#coda-slider-1").offset().left;
		var productY 		= $("#coda-slider-1").offset().top;

		var basketX 		= $("#basketItemsWrap").offset().left;
		var basketY 		= $("#basketItemsWrap").offset().top;
		
		var gotoX 			= basketX - productX;
		var gotoY 			= basketY - productY;
		
		var newImageWidth 	= $("#coda-slider-1").width() / 3;
		var newImageHeight	= $("#coda-slider-1").height() / 3;
		
		//alert('width'+newImageWidth+',height'+newImageHeight);
		//{opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}
		
		
		$("#coda-slider-1")	
		.clone()
		.prependTo(".coda-slider-wrapper")
		.css({'position' : 'absolute'})
		.animate({opacity: 0.4}, 100 )
		.animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 1200, function() {
			$(this).remove();
			
			$.ajax({  
				type: "POST",  
				//url: "inc/functions.php",  
				url : "http://184.95.33.26/~russellh/cart/getCartRevise.html",
				data: { product_id: productIDVal, quantity: "1"},  
				success: function(theResponse) {					
					
					document.getElementById("basket_text").innerHTML = theResponse;					
					}  
			});																																   });
			
			return false;
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$("#basketItemsWrap li img").live("click", function(event) { 
		var productIDValSplitter 	= (this.id).split("_");
		var productIDVal 			= productIDValSplitter[1];	

		$("#notificationsLoader").html('<img src="images/loader.gif">');
	
		$.ajax({  
			type: "POST",  
			url: "inc/functions.php",  
			data: { productID: productIDVal, action: "deleteFromBasket"},  
			success: function(theResponse) {
				
				$("#productID_" + productIDVal).hide("slow",  function() {$(this).remove();});
				$("#notificationsLoader").empty();
			
			}  
		});  
		
	});

});

