//=========================================================================================
// UPDATE PROFILE YOU
function validator(theForm)
{

	if (theForm.firstName.value == "")
	{
		alert("Please enter a value for the \"First Name\" field.");
		theForm.firstName.focus();
		return (false);
	}
	
	if (theForm.lastName.value == "")
	{
		alert("Please enter a value for the \"Last Name\" field.");
		theForm.lastName.focus();
		return (false);
	}
	
	if (theForm.address1.value == "")
	{
		alert("Please enter a value for the \"Address\" field.");
		theForm.address1.focus();
		return (false);
	}
	
	if (theForm.city.value == "")
	{
		alert("Please enter a value for the \"City\" field.");
		theForm.city.focus();
		return (false);
	}
	
	if (theForm.state.value == "")
	{
		alert("Please select a value from the \"State\" menu.");
		theForm.state.focus();
		return (false);
	}
	
	if (theForm.zipSuffix1.value == "")
	{
		alert("Please enter a value for the \"Zip Code\" field.");
		theForm.zipSuffix1.focus();
		return (false);
	}

	var goodEmail = /^([a-zA-Z0-9\_\.\-])+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,})+$/;
	if (!goodEmail.test(theForm.email.value)) {
		alert('Please enter a valid e-mail address for the \"E-mail\" field.');
		theForm.email.focus();
		return (false); 
	}


	var goodEmail = /^([a-zA-Z0-9\_\.\-])+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,})+$/;
	if (!goodEmail.test(theForm.confirmEmail.value)) {
		alert('Please enter a valid e-mail address for the \"Confirm E-mail\" field.');
		theForm.confirmEmail.focus();
		return (false); 
	}

	if (theForm.email.value != theForm.confirmEmail.value)
	{
		alert("The E-mail Address field and the Confirm E-mail Address field must match.");
		theForm.confirmEmail.focus();
		return (false);
	}
	
	if (theForm.wicProgram.value == "")
	{
		alert("Please select an answer for the \"WIC Program\" question.");
		theForm.wicProgram.focus();
		return (false);
	}
	
	return (true);
}


//=========================================================================================
// UPDATE PROFILE YOUR FAMILY
function validator2(theForm) {

	// "I'm expecting"
	if (theForm.expecting.checked == true)
	{
	
		if (theForm.tellUsAboutPreg.value == "")
		{
			alert("Please select an option for \"Please tell us about this pregnancy\".");
			theForm.tellUsAboutPreg.focus();
			return (false);
		}
		
		if ((theForm.dueDateMonth.value == "") || (theForm.dueDateDay.value == "") || (theForm.dueDateYear.value == ""))
		{
			alert("Please select a value from the \"Due Date\" menu.");
			theForm.dueDateMonth.focus();
			return (false);
		}
		
		if (theForm.relationToBaby.value == "")
		{
			alert("Please select an option for \"Relationship to baby?\".");
			theForm.relationToBaby.focus();
			return (false);
		}
		
		//if (theForm.feedingPlans.value == "")
		//{
		//	alert("Please select an option for \"How do you plan to feed your baby?\".");
		//	theForm.feedingPlans.focus();
		//	return (false);
		//}
	}
	
	// REPEAT REGION
	// EDIT CHILD 1 VALIDATION
	if (document.getElementById('profileUpdateChild1').style.display == "block") {
		
		
		if ((theForm.birthMonthChild1.value == "") || (theForm.birthDayChild1.value == "") || (theForm.birthYearChild1.value == ""))
		{
			alert("Please select a value from the \"Birth Date\" menu.");
			theForm.birthMonthChild1.focus();
			return (false);
		}
		
		if (theForm.relationshipChild1.value == "")
		{
			alert("Please select a value from the \"Relationship to child?\" menu.");
			theForm.relationshipChild1.focus();
			return (false);
		}

	
	}

	// REPEAT REGION
	// EDIT CHILD 2 VALIDATION
	if (document.getElementById('profileUpdateChild2').style.display == "block") {
		
		
		if ((theForm.birthMonthChild2.value == "") || (theForm.birthDayChild2.value == "") || (theForm.birthYearChild2.value == ""))
		{
			alert("Please select a value from the \"Birth Date\" menu.");
			theForm.birthMonthChild2.focus();
			return (false);
		}
		
		if (theForm.relationshipChild2.value == "")
		{
			alert("Please select a value from the \"Relationship to child?\" menu.");
			theForm.relationshipChild2.focus();
			return (false);
		}
	
	}
	

	// ADD CHILD VALIDATION
	if (document.getElementById('profileUpdateAddChild').style.display == "block") {
	
		
		if ((theForm.birthMonthAddChild.value == "") || (theForm.birthDayAddChild.value == "") || (theForm.birthYearAddChild.value == ""))
		{
			alert("Please select a value from the \"Birth Date\" menu.");
			theForm.birthMonthAddChild.focus();
			return (false);
		}
		
		if (theForm.relationshipAddChild.value == "")
		{
			alert("Please select a value from the \"Relationship to child?\" menu.");
			theForm.relationshipAddChild.focus();
			return (false);
		}
	
	}
	
	
	return (true);

}
//=========================================================================================
// UPDATE SHOPPING
function validator3(theForm)
{

	if (theForm.addNewShipping.checked == true) {
	
		if (theForm.shipNickname.value == "")
		{
			alert("Please enter a value for the \"Nickname\" field.");
			theForm.shipNickname.focus();
			return (false);
		}
	
	} else {
	
		if (theForm.shipChooseNickname.value == "")
		{
			alert("Please select an value from the \"Shippping Nickname\" menu.");
			theForm.shipChooseNickname.focus();
			return (false);
		}
	
	}

	if (theForm.shipFirstName.value == "")
	{
		alert("Please enter a value for the \"First Name\" field.");
		theForm.shipFirstName.focus();
		return (false);
	}
	
	if (theForm.shipLastName.value == "")
	{
		alert("Please enter a value for the \"Last Name\" field.");
		theForm.shipLastName.focus();
		return (false);
	}
	
	if (theForm.shipAddress1.value == "")
	{
		alert("Please enter a value for the \"Address\" field.");
		theForm.shipAddress1.focus();
		return (false);
	}
	
	if (theForm.shipCity.value == "")
	{
		alert("Please enter a value for the \"City\" field.");
		theForm.shipCity.focus();
		return (false);
	}
	
	if (theForm.shipState.value == "")
	{
		alert("Please select a value from the \"State\" menu.");
		theForm.shipState.focus();
		return (false);
	}
	
	if (theForm.shipZip1.value == "")
	{
		alert("Please enter a value for the \"Zip Code\" field.");
		theForm.shipZip1.focus();
		return (false);
	}

	var goodEmail = /^([a-zA-Z0-9\_\.\-])+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,})+$/;
	if (!goodEmail.test(theForm.shipEmail.value)) {
		alert('Please enter a valid e-mail address for the \"E-mail\" field.');
		theForm.shipEmail.focus();
		return (false); 
	}

	var goodEmail = /^([a-zA-Z0-9\_\.\-])+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,})+$/;
	if (!goodEmail.test(theForm.shipConfirmEmail.value)) {
		alert('Please enter a valid e-mail address for the \"Confirm E-mail\" field.');
		theForm.shipConfirmEmail.focus();
		return (false); 
	}

	if (theForm.shipEmail.value != theForm.shipConfirmEmail.value)
	{
		alert("The E-mail Address field and the Confirm E-mail Address field must match.");
		theForm.shipConfirmEmail.focus();
		return (false);
	}
	

	if (theForm.addNewBilling.checked == true) {
	
		if (theForm.ccNickname.value == "")
		{
			alert("Please enter a value for the \"Nickname\" field.");
			theForm.ccNickname.focus();
			return (false);
		}
	
	} else {
	
		if (theForm.ccChooseCreditCardNickName.value == "")
		{
			alert("Please select an value from the \"Credit Card Nickname\" menu.");
			theForm.ccChooseCreditCardNickName.focus();
			return (false);
		}
	
	}

	if (theForm.ccCreditCardType.value == "")
	{
		alert("Please select an value from the \"Credit Card Type\" menu.");
		theForm.ccCreditCardType.focus();
		return (false);
	}

	if (theForm.ccCardNumber.value == "")
	{
		alert("Please enter a value for the \"Credit Card Number\" field.");
		theForm.ccCardNumber.focus();
		return (false);
	}

	if ((theForm.ccExpMonth.value == "") || (theForm.ccExpYear.value == ""))
	{
		alert("Please select a valid date from the \"Expiration Date\" menus.");
		theForm.ccExpMonth.focus();
		return (false);
	}

	if (theForm.ccFirstName.value == "")
	{
		alert("Please enter a value for the \"Cardholder\'s First Name\" field.");
		theForm.ccFirstName.focus();
		return (false);
	}

	if (theForm.ccLastName.value == "")
	{
		alert("Please enter a value for the \"Cardholder\'s Last Name\" field.");
		theForm.ccLastName.focus();
		return (false);
	}

	if (theForm.ccPaymentType.value == "")
	{
		alert("Please select an value from the \"Payment Type\" menu.");
		theForm.ccPaymentType.focus();
		return (false);
	}

	if (theForm.billFirstName.value == "")
	{
		alert("Please enter a value for the \"First Name\" field.");
		theForm.billFirstName.focus();
		return (false);
	}
	
	if (theForm.billLastName.value == "")
	{
		alert("Please enter a value for the \"Last Name\" field.");
		theForm.billLastName.focus();
		return (false);
	}
	
	if (theForm.billAddress1.value == "")
	{
		alert("Please enter a value for the \"Address\" field.");
		theForm.billAddress1.focus();
		return (false);
	}
	
	if (theForm.billCity.value == "")
	{
		alert("Please enter a value for the \"City\" field.");
		theForm.billCity.focus();
		return (false);
	}
	
	if (theForm.billState.value == "")
	{
		alert("Please select a value from the \"State\" menu.");
		theForm.billState.focus();
		return (false);
	}
	
	if (theForm.billZip1.value == "")
	{
		alert("Please enter a value for the \"Zip Code\" field.");
		theForm.billZip1.focus();
		return (false);
	}

	return (true);
}

