/**
 * Remove the selected product from the cart.
 * 
 * @param productCode The unique product code of the product to remove from the cart.
 */
function removeWishList( entry,productCode ) {
	if ( entry && productCode ) {
		$.ajax({
			type: 'POST',
			url: "/removeWishList.action",
			data: { entryCode: entry,productCode: productCode },
			success: function(data) {
				if( data.successful ) {
					// remove all the elements that need removal when this product goes out of wishlist
					$( '.removeWishlistOnDelete_' + entry ).remove();
					
					// update the number of products currently in the wishlict
					$( '.updateOnWishlistEntries' ).text(data.numberOfEntries);
					
					if (data.numberOfEntries == 0){
						$('#wishlist').hide();
						$('#wishlistEmpty').show();
					}
				} else {
					alert( data.errorMessage );
				}
	
			},
			error: function(xmlHttpRequest, textStatus, errorThrown) {
				alert( Translations['unableToRemoveFromCart'] );
			},
			dataType: 'json'
		});
	}
}


