(function($) {

	$.extend({
		add2cart: function(source_id, target_id, callback) {
    
      //var source = $('#' + source_id );
      //var target = $('#' + target_id );
	  
	  var source = source_id;
      var target = target_id;
      
      var shadow = $('#add2cart_shadow');
      if( !shadow.attr('id') ) {
          $('body').prepend('<div id="add2cart_shadow" style="display: none; background:#bbb; border: solid 1px darkgray; position: static; top: 0px; z-index: 100000;">&nbsp;</div>');
          var shadow = $('#add2cart_shadow');
      }
      
      if( !shadow ) {
          alert('Cannot create the shadow div');
      }
      
      //shadow.width(source.css('width')).height(source.css('height'));
      //shadow.css('position', 'absolute').css('top', source.offset().top).css('left', source.offset().left).css('opacity', 0.7).show();
      shadow.css({ width:source.width(), height:source.height(), position:'absolute', top:source.offset().top, left:source.offset().left, opacity:'0.7' }).show();
      
      //shadow.animate( { top: target.offset().top, left: target.offset().left }, { duration: 600 } )
	  shadow.animate( { width:target.width(), height:target.height(), top: target.offset().top, left: target.offset().left }, { duration: 600 } ).fadeOut("fast");
		}
	});
})(jQuery);
