// Version 1.0.0
// Last Updated 6/26/2007
// Copyright 2007 The Church Media Group, Inc
// 
// Description: These functions are used in conjunction with various forms in the web application.
//

function egiving_validation() {
	var elem
	var errs=0;
	// execute all element validations in reverse order, so focus gets
	// set to the first one in error.

	if (!validatePresent(document.forms.egiving.last_name,  'last_name_msg')){ errs += 1;}
	if (!validatePresent(document.forms.egiving.first_name,  'first_name_msg')){ errs += 1;}
	if (!validatePresent(document.forms.egiving.billing_address,  'billing_address_msg')){ errs += 1;}
	if (!validatePresent(document.forms.egiving.billing_city,  'billing_city_msg')){ errs += 1;}
	if (!validateSelectBox(document.forms.egiving.billing_state,  'billing_state_msg')){ errs += 1;}
	if (!validatePresent(document.forms.egiving.billing_zip,  'billing_zip_msg')){ errs += 1;}
	if (!validatePresent(document.forms.egiving.home_phone,  'home_phone_msg')){ errs += 1;}
	if (!validateEmail(document.forms.egiving.email_address,  'email_address_msg',true)){ errs += 1;} 	
	if (!validateDecimal(document.forms.egiving.gift_amount,  'gift_amount_msg',true)){ errs += 1;} 	
	if (!validateSelectBox(document.forms.egiving.type_of_card,  'type_of_card_msg')){ errs += 1;} 	
	if (!validateCreditCard(document.forms.egiving.cc_number,  'cc_number_msg')){ errs += 1;} 	
	if (!validateMonthYear(document.forms.egiving.exp_month,document.forms.egiving.exp_year,  'exp_msg')){ errs += 1;}		
	if (!validatePresent(document.forms.egiving.name_on_card,  'name_on_card_msg')){ errs += 1;}
	if (!validatePresent(document.forms.egiving.signature,  'signature_msg')){ errs += 1;}
	
	
	if (errs>1){  alert('Please correct all fields marked with ***');}
	if (errs==1){ alert('Please correct the field marked with ***');}
	
    // If everything checks out, we'll submit the form, if not, we return the false status
	if (errs > 0){
		return false;
	}
	else theForm.submit();   
	
}



//function enewsletter_validation() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//    if (!validateEmail(document.forms.registration.email_address,  'email_address_msg',true)){ errs += 1;} 
//	if (!validatePresent(document.forms.registration.zip_code,  'zip_code_msg')){ errs += 1;} 
//	if (!validatePresent(document.forms.registration.last_name,  'last_name_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.first_name,  'first_name_msg')){ errs += 1;}
//
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function contactus_validation1() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//	if (!validatePresent(document.forms.registration.last_name,  'last_name_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.first_name,  'first_name_msg')){ errs += 1;}
//
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function contactus_validation3() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//	if (!validateEmail(document.forms.registration.email_address,  'email_address_msg',true)){ errs += 1;} 
//	if (!validatePresent(document.forms.registration.comments,  'comments_msg')){ errs += 1;}
//	
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//
//function booking_validation1() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//    	if (!validateEmail(document.forms.registration.email_address,  'email_address_msg',true)){ errs += 1;} 
//	if (!validatePresent(document.forms.registration.last_name,  'last_name_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.first_name,  'first_name_msg')){ errs += 1;}
//
//    	if (errs>1){  alert('Please correct all fields marked with ***');}
//    	if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function booking_validation2() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//	if (!validatePresent(document.forms.registration.phone,  'phone_msg')){ errs += 1;}
//
//    	if (errs>1){  alert('Please correct all fields marked with ***');}
//    	if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//
//function testimony_validation1() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//	if (!validatePresent(document.forms.registration.name,  'name_msg')){ errs += 1;} 
//
//    	if (errs>1){  alert('Please correct all fields marked with ***');}
//    	if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function testimony_validation2() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//    	if (!validateEmail(document.forms.registration.email_address,  'email_address_msg',true)){ errs += 1;} 
//
//    	if (errs>1){  alert('Please correct all fields marked with ***');}
//    	if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function testimony_validation3() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//	if (!validatePresent(document.forms.registration.testimony,  'testimony_msg')){ errs += 1;} 
//
//    	if (errs>1){  alert('Please correct all fields marked with ***');}
//    	if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//
//function donations_validation1() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//	if (!validatePresent(document.forms.registration.last_name,  'last_name_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.first_name,  'first_name_msg')){ errs += 1;}
//
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function donations_validation2() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//	if (!validateEmail(document.forms.registration.email_address,  'email_address_msg',true)){ errs += 1;} 
//	if (!validatePresent(document.forms.registration.phone,  'phone_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.zip_code,  'zip_code_msg')){ errs += 1;}
//	if (!validateSelectBox(document.forms.registration.state,  'state_msg')){ errs += 1;}	
//	if (!validatePresent(document.forms.registration.city,  'city_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.address,  'address_msg')){ errs += 1;}
//	
//
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function donations_validation3() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//	if (!validatePresent(document.forms.registration.gift_amount,  'gift_amount_msg')){ errs += 1;}
//	
//
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//	return (errs==0);
//}
//
//function donations_validation4() 
//{
//	var elem;
//	var errs=0;
//	// execute all element validations in reverse order, so focus gets
//	// set to the first one in error.
//
//	if (!validatePresent(document.forms.registration.signature,  'signature_msg')){ errs += 1;}
//	if (!validateMonthYear(document.forms.registration.exp_month,document.forms.registration.exp_year,  'exp_msg')){ errs += 1;}	
//
//	if (!validateCreditCard(document.forms.registration.cc_number,  'cc_number_msg')){ errs += 1;}
//	if (!validatePresent(document.forms.registration.name_on_card,  'name_on_card_msg')){ errs += 1;}
//	
//
//    if (errs>1){  alert('Please correct all fields marked with ***');}
//    if (errs==1){ alert('Please correct the field marked with ***');}
// 
//    // If everything checks out, we'll submit the form, if not, we return the false status
//	if (errs > 0){
//		return false;
//	}
//	else theForm.submit();    
//    
//	//return (errs==0);
//}