
function validateclient() {
	with (document.Client) {
		var missing = false;
		var theMsg = "";
		var theMissingFields = "";

		// Make Sure All Required Fields Have Been Filled-In, Selected, or Checked.
		if (company.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Company Name.\n";
		}
		if (contact.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Contact Name.\n";
		}
		if (phone.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Phone Number.\n";
		}
		if (email.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Email Address.\n";
		}
		if (address.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Street Address.\n";
		}
		if (city.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your City.\n";
		}
		if (state.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your State.\n";
		}
		if (zip.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Zip Code.\n";
		}
		if (manager.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Manager Name.\n";
		}
		if (pws.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your PWS Code that was assigned to you.\n";
		}
		
		if (email.value != confirmemail.value) {
			missing = true;
			theMsg = theMsg + "	Your Email Address does not match the Confirm Email Address.\n";
		}
		
		theMissingFields = theMsg;

		if (missing) {
			var theMsgHeader = "Some required information was not provided. Please note the missing information.\n";
			theMsg = theMsgHeader + "\n\n";
			if (theMissingFields != "") {
				theSectionMsg = theMissingFields;
			}
			theMsg = theMsg + theSectionMsg + "\n\n";
			alert(theMsg);
			return(false);
		}
		return(true);
	}
}


function trapEntry(theForm,theField,theType,theFlag) {
	retVal = 1;
	with (document.Client) {
		theFieldValue = new String(eval(theField + ".value"));

		if (theType == 'Phone') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[0-9]{10}$/");
			} else {
				theRE = eval("/^$|^[0-9]{10}$/");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use just 10 numbers in Phone/Fax fields.");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}
		if (theType == 'Zip') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[0-9]{5}$/");
			} else {
				theRE = eval("/^$|^[0-9]{5}$/");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use a 5 digit zip code.");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}



		if (theType == 'Email') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z]{2,4}$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z0-9_-]+\.[a-z]{2,4}$/i");
			} else {
				theRE = eval("/^$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z]{2,4}$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z0-9_-]+\.[a-z]{2,4}$/i");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use the complete email address (eg. me@mymailbox.com).");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}
	}
	if (retVal) {
		return(true);
	} else {
		return(false);
	}
}

//__________________________________________REFER_FRIEND_1______________________________________


function validaterefer1() {
	with (document.referalform1) {
		var missing = false;
		var theMsg = "";
		var theMissingFields = "";

		// Make Sure All Required Fields Have Been Filled-In, Selected, or Checked.
		if (ReferalName.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your friend's Full Name.\n";
		}
		if (ReferalPhone.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your friend's Phone Number.\n";
		}
		if (ReferalEmail.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your friend's Email Address.\n";
		}
		if (ReferingName.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Full Name.\n";
		}
		if (ReferingPhone.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Phone Number.\n";
		}
		if (ReferingEmail.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Email Address.\n";
		}
		if (ReferingStreet_Address.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Street Address.\n";
		}
		if (ReferingCity.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your City.\n";
		}
		if (ReferingState.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your State.\n";
		}
		if (ReferingZip.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Zip Code.\n";
		}
		theMissingFields = theMsg;

		if (missing) {
			var theMsgHeader = "Some required information was not provided. Please note the missing information.\n";
			theMsg = theMsgHeader + "\n\n";
			if (theMissingFields != "") {
				theSectionMsg = theMissingFields;
			}
			theMsg = theMsg + theSectionMsg + "\n\n";
			alert(theMsg);
			return(false);
		}
		return(true);
	}
}


function trapEntryReferal(theForm,theField,theType,theFlag) {
	retVal = 1;
	with (document.referalform1) {
		theFieldValue = new String(eval(theField + ".value"));

		if (theType == 'Phone') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[0-9]{10}$/");
			} else {
				theRE = eval("/^$|^[0-9]{10}$/");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use just 10 numbers in Phone/Fax fields.");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}
		if (theType == 'Zip') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[0-9]{5}$/");
			} else {
				theRE = eval("/^$|^[0-9]{5}$/");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use a 5 digit zip code.");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}



		if (theType == 'Email') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z]{2,4}$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z0-9_-]+\.[a-z]{2,4}$/i");
			} else {
				theRE = eval("/^$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z]{2,4}$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z0-9_-]+\.[a-z]{2,4}$/i");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use the complete email address (eg. me@mymailbox.com).");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}
	}
	if (retVal) {
		return(true);
	} else {
		return(false);
	}
}







//__________________________________________REFER_FRIEND_2______________________________________


function validaterefer2() {
	with (document.referalform2) {
		var missing = false;
		var theMsg = "";
		var theMissingFields = "";

		// Make Sure All Required Fields Have Been Filled-In, Selected, or Checked.
		if (Name.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Full Name.\n";
		}
		if (Street_Address.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Street Address.\n";
		}
		if (City.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your City.\n";
		}
		if (State.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your State.\n";
		}
		if (Zip.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Zip Code.\n";
		}
		if (Phone.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Phone Number.\n";
		}
		if (Email.value == "") {
			missing = true;
			theMsg = theMsg + "	You have not entered your Email Address.\n";
		}
		if ((Currently_In_School[0].checked == false) && (Currently_In_School[1].checked == false)) {
			missing = true;
			theMsg = theMsg + "	Are you currently in school?.\n";
		}
		if (School_Attended.value == "") {
			missing = true;
			theMsg = theMsg + "	College/University attended?\n";
		}
		if ((Graduated[0].checked == false) && (Graduated[1].checked == false)) {
			missing = true;
			theMsg = theMsg + "	Did you Graduate from College/University?\n";
		}
		if ((Graduate_school_Attended[0].checked == false) && (Graduate_school_Attended[1].checked == false)) {
			missing = true;
			theMsg = theMsg + "	Graduate school attended?\n";
		}
		if ((Graduate_Degree_Completed[0].checked == false) && (Graduate_Degree_Completed[1].checked == false)) {
			missing = true;
			theMsg = theMsg + "	Graduate degree completed?\n";
		}
		
		
		if ((Best_Time_to_Call[0].checked == false) && (Best_Time_to_Call[1].checked == false) && (Best_Time_to_Call[2].checked == false)) {
			missing = true;
			theMsg = theMsg + "	Best time to contact you?\n";
		}
		
		if (Approximate_Loan_Balance.value == "") {
			missing = true;
			theMsg = theMsg + "	Approximate federal student loan balance?\n";
		}
		if ((Ready_to_Consolidate[0].checked == false) && (Ready_to_Consolidate[1].checked == false)) {
			missing = true;
			theMsg = theMsg + "	Are you ready to consolidate?\n";
		}
		if (Refered_By.value == "") {
			missing = true;
			theMsg = theMsg + "	Who refered you to StudentFed?\n";
		}
		if (Referer_ACC_Number.value == "") {
			missing = true;
			theMsg = theMsg + "	Account number of person who refered you?\n";
		}
		theMissingFields = theMsg;

		if (missing) {
			var theMsgHeader = "Some required information was not provided. Please note the missing information.\n";
			theMsg = theMsgHeader + "\n\n";
			if (theMissingFields != "") {
				theSectionMsg = theMissingFields;
			}
			theMsg = theMsg + theSectionMsg + "\n\n";
			alert(theMsg);
			return(false);
		}
		return(true);
	}
}



function trapEntryReferal2(theForm,theField,theType,theFlag) {
	retVal = 1;
	with (document.referalform2) {
		theFieldValue = new String(eval(theField + ".value"));

		if (theType == 'Phone') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[0-9]{10}$/");
			} else {
				theRE = eval("/^$|^[0-9]{10}$/");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use just 10 numbers in Phone/Fax fields.");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}
		if (theType == 'Zip') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[0-9]{5}$/");
			} else {
				theRE = eval("/^$|^[0-9]{5}$/");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use a 5 digit zip code.");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}



		if (theType == 'Email') {
			if (theFlag) {
				// Required Entry
				theRE = eval("/^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z]{2,4}$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z0-9_-]+\.[a-z]{2,4}$/i");
			} else {
				theRE = eval("/^$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z]{2,4}$|^[a-z0-9_\.-]+[@]{1}[a-z0-9_-]+\.[a-z0-9_-]+\.[a-z]{2,4}$/i");
			}
			if (theRE.test(theFieldValue)) {
			} else {
				alert("Please use the complete email address (eg. me@mymailbox.com).");
				eval(theField + ".value = ''");
				retVal = 0;
			}
		}
	}
	if (retVal) {
		return(true);
	} else {
		return(false);
	}
}







function validateStep3() {
	with (document.Step3) {
		var missing = false;
		var theMsg = "";
		var theMissingFields = "";

		// Make Sure All Required Fields Have Been Filled-In, Selected, or Checked.
		if (form3adv.checked == false) {
			missing = true;
			theMsg = theMsg + "	Please check the box for Client Agreement.\n";
		}
		theMissingFields = theMsg;

		if (missing) {
			var theMsgHeader = "Some required information was not provided. Please note the missing information.\n";
			theMsg = theMsgHeader + "\n\n";
			if (theMissingFields != "") {
				theSectionMsg = theMissingFields;
			}
			theMsg = theMsg + theSectionMsg + "\n\n";
			alert(theMsg);
			return(false);
		}
		return(true);
	}
}





