$(document).ready(function () {

	$.fn.click_fun = function (product_id) {

		$.ajax({

			type: 'post',

			url: 'index.php?route=module/cart/callback',

			dataType: 'html',

			data: $('#product'+product_id+' :input'),

			success: function (html) {
				//$('#module_cart .middle').html(html);
				window.location.href = 'index.php?route=checkout/cart';

			},	

			complete: function () {

				var image = $('#image').offset();

				var cart  = $('#module_cart').offset();

	

				$('#image').before('<img src="' + $('#image').attr('src') + '" id="temp" style="position: absolute; top: ' + image.top + 'px; left: ' + image.left + 'px;" />');

	

				params = {

					top : cart.top + 'px', 

					left : cart.left + 'px',

					opacity : 0.0,

					width : $('#module_cart').width(),  

					heigth : $('#module_cart').height()

				};		

	

				$('#temp').animate(params, 'slow', false, function () {

					$('#temp').remove();

				});		

			}			

		});			

	}



	$.fn.delete_product_wishlist = function (product_id) {

		$.ajax({

			type: 'post',

			url: 'index.php?route=module/wishlist/deleteProduct',

			dataType: 'html',

			data: $('#wishlist'+product_id+' :input'),

			success: function (html) {

				$('#wishlist .middle').html(html);

			},	

			complete: function () {

			}			

		});			

	}



	$.fn.checkout_wishlist = function () {

		$.ajax({

			type: 'post',

			url: 'index.php?route=module/wishlist/checkoutWishlist',

			dataType: 'html',

			data: $('#wishlistcheckout :input'),

			success: function (html) {

				$(location).attr('href',html);

			},	

			complete: function () {

			}			

		});			

	}



	$.fn.add_product_wishlist = function (product_id) {

		$.ajax({

			type: 'post',

			url: 'index.php?route=module/wishlist/addProduct',

			dataType: 'html',

			data: $('#product'+product_id+' :input'),

			success: function (html) {

				$('#wishlist .middle').html(html);

			},	

			complete: function () {

			}			

		});			

	}



});




