// Gift Card Form
function fillFields()
{
	if(document.gift_card.same_above.checked == true){
	  document.gift_card.recipient_prefix.value=document.gift_card.prefix.value;
	  document.gift_card.recipient_first_name.value=document.gift_card.first_name.value;
	  document.gift_card.recipient_last_name.value=document.gift_card.last_name.value;
	  document.gift_card.recipient_email.value=document.gift_card.email.value;
	  document.gift_card.recipient_phone.value=document.gift_card.phone.value;
	  document.gift_card.recipient_address1.value=document.gift_card.address1.value;
	  document.gift_card.recipient_address2.value=document.gift_card.address2.value;
	  document.gift_card.recipient_city.value=document.gift_card.city.value;
	  document.gift_card.recipient_state.value=document.gift_card.state.value;
	  document.gift_card.recipient_zip.value=document.gift_card.zip.value;
	}else{
		  document.gift_card.recipient_prefix.value='';
		  document.gift_card.recipient_first_name.value='';
		  document.gift_card.recipient_last_name.value='';
		  document.gift_card.recipient_email_address.value='';
		  document.gift_card.recipient_phone_number.value='';
		  document.gift_card.recipient_address1.value='';
		  document.gift_card.recipient_address2.value='';
		  document.gift_card.recipient_city.value='';
		  document.gift_card.recipient_state.value='';
		  document.gift_card.recipient_zip.value='';
	}
}



function updateGiftAmountValue(dropdownValue) {
	cost = dropdownValue.value;
	if(cost == '--'){
		cost = document.gift_card.gift_amount_other.value;
	}
	if(cost == ''){
		cost = 0;
	}
	
	if(isNaN(cost) == false){
		var radioLength = document.gift_card.shipping.length;
		for(var i = 0; i < radioLength; i++) {
			if(document.gift_card.shipping[i].checked) {
				var shippingAmount = document.gift_card.shipping[i].value;
			}
		}
		document.gift_card.total.value = ( parseInt(cost, 10) + parseInt(shippingAmount, 10) );
	}else{
		alert ("Please enter a valid gift card amount.");
		document.gift_card.gift_amount_other.value = '';
	}
}


function updateShippingValue(radioValue) {
	cost = document.gift_card.gift_amount.value;
	if(cost == '--'){
		cost = document.gift_card.gift_amount_other.value;
	}
	if(cost == ''){
		cost = 0;
	}
	
	if(isNaN(cost) == false){
		document.gift_card.total.value = ( parseInt(radioValue.value, 10) + parseInt(cost, 10) );
	}else{
		alert ("Please enter a valid gift card amount.");
		document.gift_card.gift_amount_other.value = '';
	}
}
