function addToCart(id,format,type){
	jQuery("#basket_widget .content_container").show();
	jQuery("#basket_widget .content").html("<img src=\"img/ajax-loader_blue.gif\" alt=\"loading\" style=\"margin:0px\" />");
	jQuery.post("add_to_cart.php", {id:id,format:format,type:type}, function(data){
		jQuery("#basket_widget .content").html(data);
		//jQuery("#basket_header").attr.("src","/widgets/img/basket_widget_down.gif");
	});
}

function removeFromCart(id,type){
	jQuery("#basket_widget .content").html("<img src=\"img/ajax-loader_blue.gif\" alt=\"loading\" style=\"margin:0px\" />");
	jQuery.post("remove_from_cart.php", {id:id,type:type}, function(data){
		jQuery("#basket_widget .content").html(data);
	});
}

function changeQuantity(id,direction){
	jQuery("#cartrow_"+id).html("<img src=\"img/ajax-loader_blue.gif\" alt=\"loading\" style=\"margin:0px\" />");
	jQuery.post("change_quantity.php", {id:id,direction:direction}, function(data){
		if (jQuery.trim(data) == "removed") {
			//alert (data);
			removeFromCart(id,"release");
		} else {
			jQuery("#cartrow_"+id).html(data);
			recalculateCart();
		}
	});
}

function recalculateCart(){
	jQuery("#totals").html("<img src=\"img/ajax-loader_blue.gif\" alt=\"loading\" style=\"margin:0px\" />");
	jQuery.ajax({
	  url: 'recalculate_cart.php',
	  success: function(data) {
	    jQuery('#totals').html(data);
	  }
	});
}

function changeShipping() {
	var region = jQuery('#shipping_region').val();
	jQuery.post("recalculate_cart.php", {region:region}, function(data){
		jQuery('#totals').html(data);
	});
}

/// load an artist into the player ///
function playCart() {

	var url = 'widgets/mediaplayer/mediaplayer_content.php'; 
	jQuery("#mediaplayer_li .content_container").load(url, "scope=cart");  
	jQuery('#mediaplayer_widget .header .header_buttons #min').attr('src','/widgets/img/mediaplayer_widget_down.gif');
	jQuery("#mediaplayer_li .content_container").show();
	
}

