
//  this is a validation function that will work for all forms
//  this funtion is called when the user clicks the submit button
function submitGlobalForm() {
		// make a variable to hold all the errors
		var error_string="";
		
		// making a variable to hold document.myForm, to make less code to write
		var formValidate = document.globalForm;
		
		// make sure user enters first name
		if (formValidate.Full_Name.value == "") {
			error_string += "You must enter your full name!\n";
		}

		//check the email text field
		if (formValidate.Email_Address.value == "") {
		      error_string += "You must enter your e-mail address!\n";
		} else if (formValidate.Email_Address.value.indexOf("@")==-1 || 
			 	formValidate.Email_Address.value.indexOf(".")==-1 || 
			 	formValidate.Email_Address.value.indexOf(" ")!=-1 || 
			 	formValidate.Email_Address.value.length<6) 
				{
					error_string += "You entered an invalid e-mail address!\n";
		}
		
		
	if (error_string == "") {
		alert("Your information has been submitted.  Thank You!");
		return true;
	} else {
		error_string = "We found the following omissions in your form: \n" + error_string;
		alert(error_string);
			return false;
	}
}

// this funtion is called when the user clicks the submit button on the cma form
function submitCMAForm() {
		// make a variable to hold all the errors
		var error_string="";
		
		// making a variable to hold document.myForm, to make less code to write
		var formValidate = document.myForm;
		
		// make sure user enters first name
		if (formValidate.Full_Name.value == "") {
			error_string += "You must enter your full name!\n";
		}

		//check the email text field
		if (formValidate.Email_Address.value == "") {
		      error_string += "You must enter your e-mail address!\n";
		} else if (formValidate.Email_Address.value.indexOf("@")==-1 || 
			 	formValidate.Email_Address.value.indexOf(".")==-1 || 
			 	formValidate.Email_Address.value.indexOf(" ")!=-1 || 
			 	formValidate.Email_Address.value.length<6) 
				{
					error_string += "You entered an invalid e-mail address!\n";
		}
		
		
	if (error_string == "") {
		alert("Your information has been submitted.  Thank You!");
		return true;
	} else {
		error_string = "We found the following omissions in your form: \n" + error_string;
		alert(error_string);
			return false;
	}
}

// this funtion is called when the user clicks the submit button on module CO-01
function submitForm1() {
		
		// make a variable to hold all the errors
		var error_string="";
		
		// making a variable to hold document.contactForm, to make less code to write
		var formValidate = document.contactForm;
		
		// make sure user enters first name
		if (formValidate.Full_Name.value == "") {
			error_string += "You must enter your full name!\n";
		}

		// check to see if the email address is entered and or valid
		if (formValidate.Email_Address.value == "") {
		      error_string += "You must enter your e-mail address!\n";
		} else if (formValidate.Email_Address.value.indexOf("@")==-1 || 
			 	formValidate.Email_Address.value.indexOf(".")==-1 || 
			 	formValidate.Email_Address.value.indexOf(" ")!=-1 || 
			 	formValidate.Email_Address.value.length<6) 
				{
					error_string += "You entered an invalid e-mail address!\n";
		}
	   
	
	// if variable is empty, process the form else pop up an alert returning the errors	
	if (error_string == "") {
		alert("Your information has been submitted.  Thank You!");
		return true;
	} else {
		error_string = "We found the following omissions in your form: \n" + error_string;
		alert(error_string);
			return false;
	}
}

// this funtion is called when the user clicks the submit button on module CO-02
function submitForm2() {
		
		// make a variable to hold all the errors
		var error_string="";
		
		// making a variable to hold document.contactForm, to make less code to write
		var formValidate = document.contactForm;
		
		// make sure user enters first name
		if (formValidate.Full_Name.value == "") {
			error_string += "You must enter your full name!\n";
		}

		// check to see if the email address is entered and or valid
		if (formValidate.Email_Address.value == "") {
		      error_string += "You must enter your e-mail address!\n";
		} else if (formValidate.Email_Address.value.indexOf("@")==-1 || 
			 	formValidate.Email_Address.value.indexOf(".")==-1 || 
			 	formValidate.Email_Address.value.indexOf(" ")!=-1 || 
			 	formValidate.Email_Address.value.length<6) 
				{
					error_string += "You entered an invalid e-mail address!\n";
		}
	   
	
	// if variable is empty, process the form else pop up an alert returning the errors	
	if (error_string == "") {
		alert("Your information has been submitted.  Thank You!");
		return true;
	} else {
		error_string = "We found the following omissions in your form: \n" + error_string;
		alert(error_string);
			return false;
	}
}

// this funtion is called when the user clicks the submit button on module CUS-EF-01-01
function submitForm3() {
		
		// make a variable to hold all the errors
		var error_string="";
		
		// making a variable to hold document.contactForm, to make less code to write
		var formValidate = document.contactForm;
		
		// make sure user enters first name
		if (formValidate.Full_Name.value == "") {
			error_string += "You must enter your full name!\n";
		}

		// check to see if the email address is entered and or valid
		if (formValidate.Email_Address.value == "") {
		      error_string += "You must enter your e-mail address!\n";
		} else if (formValidate.Email_Address.value.indexOf("@")==-1 || 
			 	formValidate.Email_Address.value.indexOf(".")==-1 || 
			 	formValidate.Email_Address.value.indexOf(" ")!=-1 || 
			 	formValidate.Email_Address.value.length<6) 
				{
					error_string += "You entered an invalid e-mail address!\n";
		}
		
		// make sure user enters a community
		if (formValidate.Community.value == "") {
			error_string += "You must enter community!\n";
		}
	
	// if variable is empty, process the form else pop up an alert returning the errors	
	if (error_string == "") {
		alert("Your information has been submitted.  Thank You!");
		return true;
	} else {
		error_string = "We found the following omissions in your form: \n" + error_string;
		alert(error_string);
			return false;
	}
}

// this funtion is called when the user clicks the submit button on module CUS-CO-01-01
function submitForm4() {
		
		// make a variable to hold all the errors
		var error_string="";
		
		// making a variable to hold document.contactForm, to make less code to write
		var formValidate = document.contactForm;
		
		// make sure user selects a subject
		if (formValidate.Subject.value == "") {
			error_string += "Please select a Subject.\n";
		}
		
		// make sure user selects an immigration status
		if (formValidate.Immigration_Status.value == "") {
			error_string += "Please select an Immigration Status.\n";
		}
		
		// make sure user enters first name
		if (formValidate.Full_Name.value == "") {
			error_string += "Please enter your full name.\n";
		}

		// make sure user enters phone number
		if (formValidate.Phone_Number.value == "") {
		  error_string += "Please enter your phone number.\n";
		}
		
		// check to see if the email address is entered and or valid
		if (formValidate.Email_Address.value == "") {
		      error_string += "Please enter your e-mail address.\n";
		} else if (formValidate.Email_Address.value.indexOf("@")==-1 || 
			 	formValidate.Email_Address.value.indexOf(".")==-1 || 
			 	formValidate.Email_Address.value.indexOf(" ")!=-1 || 
			 	formValidate.Email_Address.value.length<6) 
				{
					error_string += "Please enter a valid e-mail address.\n";
		}
	
	// if variable is empty, process the form else pop up an alert returning the errors	
	if (error_string == "") {
		alert("Your information has been submitted. Thank You!");
		return true;
	} else {
		error_string = "We found the following omissions in your form: \n" + error_string;
		alert(error_string);
			return false;
	}
}