function validatelist() {
var missinginfo = "";

if (document.joinlist.email.value == "") {
missinginfo += "An Email is required to send this form\n";
}
if (document.joinlist.captcha_code.value == "") {
missinginfo += "Please include the verification image text\n";
}
if (missinginfo != ""){
alert(missinginfo);
return false;
}
}

//start sign up form validation

//display additional fields if second family
function showMe(id) {
var obj = document.getElementById(id);
if (document.info.sharing.checked) {
obj.style.display = "block";
} else {
obj.style.display = "none";
}
}

//display donation amount if selected
function showDonation(id) {
var obj = document.getElementById(id);
if (document.info.financial_assist.checked) {
obj.style.display = "block";
} else {
obj.style.display = "none";
}
}



// adddtional required fields
function validateform() {
missinginfo = "";
	if (document.info.name.value == "") {
	missinginfo += "\n - Please include your name";
	}
	
	if (document.info.email.value == "") {
	missinginfo += "\n - Please include your email address";
	}
	
	if (!document.info.summer_veg.checked && !document.info.summer_fruit.checked  && !document.info.summer_flower.checked && !document.info.financial_assist.checked) {
	missinginfo += "\n - Please select a share type";
	} 
	
	if (document.info.pickup.value == "selectlocation") {
	missinginfo += "\n - Please select a pickup location";
	}
	
	if (document.info.captcha_code.value == "") {
	missinginfo += "\n - Please include the verification image text";
	}
	
	if (missinginfo != ""){
	alert(missinginfo);
	return false;
	}
	else { 
	return true;
	}
}

    //calculate amount due
function totaldollars() { 
amount = 0;

	if (document.info.summer_veg.checked && (document.info.pickup.value == "NevadaCityMonday" || document.info.pickup.value == "NevadaCityThursday" || document.info.pickup.value == "GrassValley" || document.info.pickup.value == "SanJuan")) {
	amount += 552;
	}
	
	if (document.info.summer_veg.checked && (document.info.pickup.value == "TruckeeTown" || document.info.pickup.value == "TruckeeGlenshire" || document.info.pickup.value == "TahoeCity")) {
	amount += 624;
	}
	
	if (document.info.summer_fruit.checked && (document.info.pickup.value == "NevadaCityMonday" || document.info.pickup.value == "NevadaCityThursday" || document.info.pickup.value == "GrassValley" || document.info.pickup.value == "SanJuan")) {
	amount += 195;
	}
	
	if (document.info.summer_fruit.checked && (document.info.pickup.value == "TruckeeTown" || document.info.pickup.value == "TruckeeGlenshire" || document.info.pickup.value == "TahoeCity")) {
	amount += 234;
	}
	
	if (document.info.summer_flower.checked && (document.info.pickup.value == "NevadaCityMonday" || document.info.pickup.value == "NevadaCityThursday" || document.info.pickup.value == "GrassValley" || document.info.pickup.value == "SanJuan")) {
	amount += 180;
	}
	
	if (document.info.summer_flower.checked && (document.info.pickup.value == "TruckeeTown" || document.info.pickup.value == "TruckeeGlenshire" || document.info.pickup.value == "TahoeCity")) {
	amount += 207;
	}
	
	if (document.info.financial_assist.checked && Number(document.info.Donation.value) > 0) {
	amount += Number(document.info.donation.value);
	}
	
	if (amount == 0) {
	document.getElementById('writeamount').innerHTML="<p><strong>Total amount due depends on your pickup location</strong></p>";
	}
	else {
	document.getElementById('writeamount').innerHTML="<p><strong>Your Total Amount Due is $" + Math.round(amount*100)/100 +"</strong></p><p>If you are using the Extended Payment Plan, each check should be for $" + Math.round(amount/3*100)/100 +"</p><p><strong>Payment Options:</strong><br><input type=\"radio\" name=\"pay_option\" value=\"1\"> Send a check for $" + Math.round(amount*100)/100 +" to Mountain Bounty Farm, 14579 Blind Shady Rd., Nevada City, CA 95959<br><input type=\"radio\" name=\"pay_option\" value=\"3\"> Extended Payment Plan: Send us 3 checks, each for $" + Math.round(amount/3*100)/100 +", dated one month apart (for example: May 1, June 1, July 1).</p>";
	}
	document.info.total_amount.value = amount;
}

