
/**
 *	Update the cart quantity based
 *
 *	@param	Int		id
 */
	function updateCart(id) 
	{
		window.location = '/cart?cart_action=addunbundled&unbundled_id='
						+ id + '&quantity='
						+ document.getElementById(id+'quantity').value;
		return;
	}
	
	function calcShipping(zip, userId) 
	{
		document.getElementById('shipping-amount').innerHTML = "<p>Contacting UPS...</p>";
		zip = String(parseInt(zip));
		
		if(zip.length != 5) {
			return alert('Please enter a 5 digit zip code.');
		}
		
		ajax.request('calcShipping', 'shipping-amount', 'zip='+zip+'&user_id='+userId);
		return;
	}
	
	function zipCodeListener(zip, userId)
	{
		zip = String(parseInt(zip));
		
		if(zip.length != 5) {
			document.getElementById('shipping-amount').innerHTML = 
				"<p>Please enter a valid shipping zip code above.</p>";					
			return;
		}
		document.getElementById('billing_postcode').value = zip;
		document.getElementById('shipping-options').innerHTML = "<p>Contacting UPS...</p>";		
		ajax.request('calcShipping', 'shipping-options', 'zip='+zip+'&user_id='+userId);
		return;		
	}
	
	function cartShippingSelected(amount, label, methodId, userId, promoAmount)
	{
		amount = amount.replace(",", "");
		s = document.getElementById('shipping-amount');
		s.innerHTML = amount;
		
		o = parseFloat(document.getElementById('update-subtotal').innerHTML);
		newEst = o + parseFloat(amount) - parseFloat(promoAmount);
		
		est = document.getElementById('update-ordertotal');
		est.innerHTML =  Number(newEst).toFixed(2);
		
		ajax.request('saveShipping', 'dummy', 'user_id='+userId+'&method_id='+methodId
			+'&shipping_amount='+amount);
		
		Fat.fade_element('updatedShippingTotal');
	}
	
	/*
	function cartShippingSelected(amount, label, methodId, userId)
	{
		amount = amount.replace(",", "");
		s = document.getElementById('shipping-selection');
		s.innerHTML = label + ': $' + amount;
		
		o = parseFloat(document.getElementById('subtotal').innerHTML);
		newEst = o + parseFloat(amount);
		
		est = document.getElementById('estimated-order-total');
		est.innerHTML =  Number(newEst).toFixed(2);
		
		ajax.request('saveShipping', 'dummy', 'user_id='+userId+'&method_id='+methodId
			+'&shipping_amount='+amount);
	}
	*/
	
	function toggleShippingInfo()
	{
		div = document.getElementById('shipping-information');
		
		if(div.style.display=='none') {
			document.getElementById('shipping-information').style.display ='block';			
		} else {
			document.getElementById('shipping-information').style.display ='none';
		}

	}