function clearCart(url,action,id,session){
	$.ajax({
		type: "GET",
		url: url + '?action='+action+'&session='+ session,
		dataType: 'text',
		success: function(xml){
			$("#"+ id).html(xml);
		}
	 });
}
(function($) {

	$.extend({
		add2cart: function(source_id,target_id,img,url,id,callback) {
    
      var source = $('#' + source_id );
      var target = $('#' + target_id );
      
      var shadow = $('#' + source_id + '_shadow');
      if( !shadow.attr('id') ) {
          $('body').prepend('<span id="'+source.attr('id')+'_shadow" style="display: none;background-color:#999999;border: solid 1px darkgray; position: static; top: 0px; z-index: 11;"><img src="'+img+'" width="195" height="80"></span>');
          var shadow = $('#'+source.attr('id')+'_shadow');
      }
      
      if( !shadow ) {
          alert('Cannot create the shadow div');
      }
      
      	shadow.width(source.css('width')).height(source.css('height')).css('top', source.offset().top).css('left', source.offset().left).css('opacity', 0.5).show();
      	shadow.css('position', 'absolute');
      
      	shadow.animate( { width: target.innerWidth(), height: target.innerHeight()-25, top: target.offset().top, left: target.offset().left }, { duration: 500 } )
        .animate( { opacity: 0 }, { duration: 10, complete: callback } );
			//alert("Added to cart");
			//$('#' + target_id ).html(data).fadeIn('fast');
			$.ajax({
		   		type: "GET",
			   	url: url + '?',
			   	dataType: 'text',
			   	success: function(xml){
					$("#"+ id).html(xml);
				}
			 });
		}
	});
})(jQuery);
