var price = new Array();
function refreshForm() {
	var subtotal = 0;
	var bottles = 0;
	for (var id = 1; id < price.length ; id++){ 
	    var quantityElement = document.getElementById('quantity.' + id);
	    if (quantityElement){
		var quantity = quantityElement.value;
		bottles += 1 * quantity;
		var winetotalElement = document.getElementById('winetotal.' + id);
		var winetotal = (quantity * price[id]).toFixed(2);
		subtotal += 1* winetotal;
		winetotalElement.lastChild.nodeValue = winetotal;
            }
	}

	var subtotalElement = document.getElementById('subtotal');
	subtotalElement.lastChild.nodeValue = subtotal.toFixed(2);

	var discountElement = document.getElementById('discount');

	if (bottles > 11){
	    discountElement.lastChild.nodeValue = (subtotal * .9).toFixed(2);
	} else {
	    discountElement.lastChild.nodeValue = '0.00';
	}

	var orderForm = document.getElementById('orderForm');

//	var shippingState = orderForm.state.value;
//	var shippingLabel = document.getElementById('shippingLabel');
//	shippingLabel.lastChild.nodeValue = 'Shipping to ' + shippingState;
	return false;
}



