// add the picture to the cart
var $element = $(callerElement).parent().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();
pictureOffsetOriginal.right = $(window).innerWidth() - pictureOffsetOriginal.left - $element.width();
if ($picture.length)
{
$picture.css({
position: 'absolute',
top: pictureOffsetOriginal.top,
right: pictureOffsetOriginal.right
});
}
var pictureOffset = $picture.offset();
var cartBlock = $('#cart_block');
if (!$('#cart_block')[0] || !$('#cart_block').offset().top || !$('#cart_block').offset().left)
cartBlock = $(parent.document).find('.shopping_cart');
var cartBlockOffset = cartBlock.offset();
cartBlockOffset.right = $(window).innerWidth() - cartBlockOffset.left - cartBlock.width();
// Check if the block cart is activated for the animation
if (cartBlockOffset != undefined && $picture.length)
{
$picture.appendTo('body');
$picture
.css({
position: 'absolute',
top: pictureOffsetOriginal.top,
right: pictureOffsetOriginal.right,
zIndex: 9999
})
.animate({
width: $element.attr('width')*0.66,
height: $element.attr('height')*0.66,
opacity: 0.2,
top: cartBlockOffset.top + 30,
right: cartBlockOffset.right + 15
}, 1000)
.fadeOut(100, function() {
ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
$(this).remove();
});
}