function addDefaultPackToCart(id_pack,elementToTransfert) {
	  $.ajax({
			type: 'GET',
			url: advancedPackPath+'ajax_front.php',
			async: true,
			cache: false,
			data: {action : 'add_pack_to_cart', ajax : true, id_pack : id_pack, 'token': static_token},
			success: function(data)
			{
				if(data != '') alert(data);
				else {
					$.ajax({
						type: 'GET',
						url: advancedPackPath+'ajax_front.php',
						async: true,
						cache: false,
						dataType : "json",
						data: {action : 'get_total'},
						success: function(jsonData)
						{
							if(pack_ajax_allowed && typeof(ajaxCart) != 'undefined') {
								if(psVersion  < "1.4") {
									$(elementToTransfert).TransferTo({
										to: $('#cart_block').get(0),
										className:'transferProduct',
										duration: 800,
										complete: function () {
											initDiscountsHeader(jsonData);
											ajaxCart.updateCart(jsonData);
										}
									});
								}else {
									var $element = $(elementToTransfert).parent().parent().find('a.product_image img,a.product_img_link img');
									if (!$element.length)
										$element = $('#bigpic');
									var $picture = $element.clone();
									var pictureOffsetOriginal = $element.offset();
									$picture.css({'position': 'absolute', 'top': pictureOffsetOriginal.top, 'left': pictureOffsetOriginal.left});
									var pictureOffset = $picture.offset();
									var cartBlockOffset = $('#cart_block').offset();

									$picture.appendTo('body');
									$picture.css({ 'position': 'absolute', 'top': $picture.css('top'), 'left': $picture.css('left') })
									.animate({ 'width': $element.attr('width')*0.66, 'height': $element.attr('height')*0.66, 'opacity': 0.2, 'top': cartBlockOffset.top + 30, 'left': cartBlockOffset.left + 15 }, 1000)
									.fadeOut(100, function() {
										initDiscountsHeader(jsonData);
										ajaxCart.updateCart(jsonData);
									});
								}
							}
							else if(typeof(modalAjaxCart) != 'undefined') {
								initDiscountsHeader(jsonData);
								modalAjaxCart.updateCart(jsonData);
								modalAjaxCart.showModalPack(id_pack,0,0, 0);
							}
							else {
								location.href = baseDir+"modules/pm_advancedpack/redirect_cart.php?referer="+location.href;
							}
						}
					});
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				alert("TECHNICAL ERROR: unable to add the product.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
			}
		});
}
function initDiscountsHeader(jsonData) {
	if($('div#cart_block_list #vouchers').length == 0 && jsonData.discounts.length > 0) {
		$('<table id="vouchers"><tbody></tbody></table>').insertAfter('#cart_block_no_products');
		$(jsonData.discounts).each(function(){
			$('#vouchers tbody').append('<tr id="bloc_cart_voucher_'+this.id+'"><td class="name" title="'+this.description+'">'+this.name+': '+this.description+'</td><td class="price"></td><td class="delete"></td></tr>');
		});
	}
	else if(jsonData.discounts.length > 0) {
		$(jsonData.discounts).each(function(){
			//fix ie6 bug (one more item 'undefined' in IE6)
			if ($('#bloc_cart_voucher_' + this.id).length == 0)
				$('#vouchers tbody').append('<tr id="bloc_cart_voucher_'+this.id+'"><td class="name" title="'+this.description+'">'+this.name+': '+this.description+'</td><td class="price"></td><td class="delete"></td></tr>');
		});
	}
}
