function addCart(product_id, stock)
{
	var quality = parseInt($("#quality_"+product_id).val());
	var available = parseInt($("span#av_"+product_id).html());
	if(isNaN(quality) || quality == '' || quality == 0)
	{
		quality = 1;
	}
	$.post(base_url+"/products/cart",
		   {'data[Product][id]': product_id, 'data[Product][quality]': quality, 'data[act]':'addCart'},
		  function(data)
		 {
			 jQuery.facebox(data);
			if(quality <= available)
			{
				$("span#av_"+product_id).html(available - quality);
			}
		 }
	);
}
function goCheckout()
{
	document.location = base_url+'/shopping_cart';
}
function updateItems(items)
{
	jQuery("span#number_items").html(items);
}
function updateCart()
{
	document.getElementById('CartForm').submit();
}
function addInsurance()
{
	jQuery("#add_insurance_hidden").val(1);
	updateCart();
}
function checkoutCart()
{
	document.getElementById('OrderShoppingCartForm').submit();
}
function chose_ship(val)
{
	document.location = base_url+"/orders/change_ship_to/"+val;
}
