// Contact Form Submittal Verification

function contactFormVerification(contactform)
{
	var errorcount = 0;
	var errorText = "";
	
	if (contactform.email.value != contactform.emailconfirm.value || contactform.email.value == "")
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - emails do not match.\n";
	}
	
	if (contactform.firstname.value == "")
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - must enter a first name.\n";
	}
	
	if (contactform.lastname.value == "")
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - must enter a last name.\n";
	}
	
	if (contactform.usersum.value != contactform.sum.value)
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - spam verification math sum is incorrect.\n";
	}
	
	if (contactform.agree.value != "on")
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - must agree to Privacy Policy.\n";
	}
	

	if (errorcount === 0)
	{
		return true;
	}
	else
	{
		var alertText = "There were errors submitting your form. Please check the following problems:\n\n" + errorText;
		alert(alertText);
		return false;
	}
	
}

function emailRemovalVerification(form)
{
	var errorcount = 0;
	var errorText = "";
	
	if (form.email.value != form.emailconfirm.value || form.email.value == "")
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - emails do not match.\n";
	}
	
	if (form.usersum.value != form.sum.value)
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - spam verification math sum is incorrect.\n";
	}
	
	if (form.confirmed.value != "on")
	{
		errorcount = errorcount + 1;
		errorText = errorText + " - must check the confirm box.\n";
	}
	

	if (errorcount === 0)
	{
		return true;
	}
	else
	{
		var alertText = "There were errors submitting your form. Please check the following problems:\n\n" + errorText;
		alert(alertText);
		return false;
	}
	
}