function CheckRequiredFields_host(form) {
var errormessage = new String();
// Put field checks below this point.
	
if(WithoutContent(form.First_Name.value))
	{ errormessage += "\nYou did not enter your First Name."; }
if(WithoutContent(form.Last_Name.value))
	{ errormessage += "\nYou did not enter your Family/Last Name."; }
if(WithoutSelectionValue(form.Birth_Day)) 
	{ errormessage += "\nYou did not select your Birth Day."; }
if(WithoutSelectionValue(form.Birth_Month)) 
	{ errormessage += "\nYou did not select your Birth Month."; }			
if(WithoutSelectionValue(form.Birth_Year)) 
	{ errormessage += "\nYou did not select your Birth Year."; }	
if(WithoutContent(form.Street.value))
	{ errormessage += "\nYou did not enter your Street."; }	
if(WithoutContent(form.City.value))
	{ errormessage += "\nYou did not enter your City."; }	
if(WithoutContent(form.Postal_Code.value))
	{ errormessage += "\nYou did not enter your Postal Code."; }
if(WithoutContent(form.Country.value))
	{ errormessage += "\nYou did not enter your Country."; }
	
if(WithoutContent(form.Home_Telephone.value))
	{ errormessage += "\nYou did not enter your Home Telephone Number."; }	
if(WithoutContent(form.Work_Telephone.value))
	{ errormessage += "\nYou did not enter your Work Telephone Number."; }	
if(WithoutContent(form.Email_Address.value))
	{ errormessage += "\nYou did not enter your Email Address."; }	

if(WithoutSelectionValue(form.Number_in_House)) 
	{ errormessage += "\nYou did not specify the number of household members living at your address."; }

if(NoneWithCheck(form.Walking_Distance_to_ECSL))
	{ errormessage += "\nYou must specify if you are within walking distance of ECSL"; }
if(WithoutContent(form.KM_From_School.value))
	{ errormessage += "\nYou did not specify How many kilometres are you from the school?"; }
if(WithoutContent(form.Closest_Intersection.value))
	{ errormessage += "\nYou did not specify What is the closest intersection to your house?"; }
	
if(NoneWithCheck(form.On_Bus_Route))
	{ errormessage += "\nYou must specify if you are on a bus route"; }
	
if(WithoutContent(form.Minutes_to_Downtown_By_Bus.value))
	{ errormessage += "\nYou did not specify How many minutes to downtown Halifax by bus?"; }
	
if(WithoutContent(form.Description_of_Home.value))
	{ errormessage += "\nYou did not specify a description of your home:"; }
if(WithoutContent(form.Description_of_Area.value))
	{ errormessage += "\nYou did not specify a description of the area that you live in"; }
if(WithoutContent(form.Description_of_Bedroom.value))
	{ errormessage += "\nYou did not specify a description of the Student bedroom"; }

if(NoneWithCheck(form.Internet))
	{ errormessage += "\nYou must specify if you have internet access"; }
if(NoneWithCheck(form.High_Speed_Internet))
	{ errormessage += "\nYou must specify if you have High Speed Internet"; }
if(NoneWithCheck(form.Wireless_Network))
	{ errormessage += "\nYou must specify if there is a wireless network"; }

if(NoneWithCheck(form.Pets_in_Home))
	{ errormessage += "\nYou must specify if there are pets that live in your home"; }
if(NoneWithCheck(form.Smoking_Outside))
	{ errormessage += "\nYou must specify if Smoking outside is allowed"; }

if(WithoutContent(form.Other_Restrictions.value))
	{ errormessage += "\nYou must specify if there are any other restrictions"; }
if(WithoutContent(form.Main_Language.value))
	{ errormessage += "\nYou must specify the main language used in the household"; }
if(WithoutContent(form.Student_Gender_Preference.value))
	{ errormessage += "\nYou must specify you student gender preference"; }
if(WithoutContent(form.Other_Preferences.value))
	{ errormessage += "\nYou must List any other preferences"; }
if(WithoutContent(form.Will_Provide_Assistance_With.value))
	{ errormessage += "\nYou must list what you will provide assistance with"; }

if(WithoutContent(form.Weekend_Activities.value))
	{ errormessage += "\nYou must specify what your typical weekend activities include"; }
if(WithoutContent(form.Family_Hobbies.value))
	{ errormessage += "\nYou must specify what the Hobbies of Family Members are"; }
if(WithoutContent(form.Introduction_Letter.value))
	{ errormessage += "\nYou must submit an Introduction letter to your student"; }
	
if(WithoutCheck(form.Declaration))
	{ errormessage += "\nYou must specify that you declare that all information is true and accurate to the best of your knowledge"; }	


if(WithoutContent(form.checkcode.value))
	{ errormessage += "\nYou did not enter the ANTI-Spam Security Code"; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:\n' + errormessage + '\n\nPlease correct these errors and try again.');
	return false;
	}
return true;
} // end of function CheckRequiredFields_host()

function CheckRequiredFields_agent(form) {
var errormessage = new String();
// Put field checks below this point.
	
if(WithoutContent(form.Agency_Name.value))
	{ errormessage += "\nYou did not enter your Agency Name."; }
if(WithoutContent(form.First_Name.value))
	{ errormessage += "\nYou did not enter your First Name."; }
if(WithoutContent(form.Last_Name.value))
	{ errormessage += "\nYou did not enter your Family/Last Name."; }
if(WithoutContent(form.How_Many_Abroad.value))
	{ errormessage += "\nYou did not specify How many students you sent abroad last year?"; }	
if(WithoutContent(form.How_Many_to_ECSL.value))
	{ errormessage += "\nYou did not specify How many students you plan to send to ECSL?"; }
	
if(WithoutContent(form.Street.value))
	{ errormessage += "\nYou did not enter your Street."; }	
if(WithoutContent(form.City.value))
	{ errormessage += "\nYou did not enter your City."; }	
if(WithoutContent(form.Postal_Code.value))
	{ errormessage += "\nYou did not enter your Postal Code."; }
if(WithoutContent(form.Country.value))
	{ errormessage += "\nYou did not enter your Country."; }
	
if(WithoutContent(form.Office_Telephone.value))
	{ errormessage += "\nYou did not enter your Office Telephone Number."; }	
if(WithoutContent(form.Office_Fax.value))
	{ errormessage += "\nYou did not enter your Office Fax Number."; }	
if(WithoutContent(form.Email_Address.value))
	{ errormessage += "\nYou did not enter your Email Address."; }	
if(WithoutContent(form.Website.value))
	{ errormessage += "\nYou did not enter your Website."; }

if(WithoutSelectionValue(form.Heard_About_ECSL)) 
	{ errormessage += "\nYou did not specify Where you Heard About ECSL."; }
	

if(WithoutContent(form.Programs_Students_Looking_For.value))
	{ errormessage += "\nYou did not specify Which programs your students are looking for?"; }
if(WithoutContent(form.Years_Agency_in_Operation.value))
	{ errormessage += "\nYou did not specify How many years your Agency has been in operation?"; }
if(WithoutContent(form.Countries_Promoted.value))
	{ errormessage += "\nYou did not specify Which countries you promote?"; }
if(WithoutContent(form.Students_Find_Agency.value))
	{ errormessage += "\nYou did not specify How students find out about your agency?"; }
if(WithoutContent(form.Promote_ECSL.value))
	{ errormessage += "\nYou did not specify How you plan to promote ECSL?"; }
if(WithoutContent(form.Why_Promote_Halifax.value))
	{ errormessage += "\nYou did not specify Why you want to promote Halifax Nova Scotia?"; }
	
if(WithoutSelectionValue(form.Single_Most_Important_Factor)) 
	{ errormessage += "\nYou did not specify the single most important factor in your decision to work with a school?"; }

if(WithoutContent(form.Reference_Name_1.value))
	{ errormessage += "\nYou did not enter the Name for Reference 1"; }
if(WithoutContent(form.Reference_School_1.value))
	{ errormessage += "\nYou did not enter the School Name for Reference 1"; }
if(WithoutContent(form.Reference_Location_1.value))
	{ errormessage += "\nYou did not enter the Location for Reference 1"; }
if(WithoutContent(form.Reference_Phone_1.value))
	{ errormessage += "\nYou did not enter the Phone Number for Reference 1"; }
if(WithoutContent(form.Reference_Email_1.value))
	{ errormessage += "\nYou did not enter the Email Address for Reference 1"; }

if(WithoutContent(form.Reference_Name_2.value))
	{ errormessage += "\nYou did not enter the Name for Reference 2"; }
if(WithoutContent(form.Reference_School_2.value))
	{ errormessage += "\nYou did not enter the School Name for Reference 2"; }
if(WithoutContent(form.Reference_Location_2.value))
	{ errormessage += "\nYou did not enter the Location for Reference 2"; }
if(WithoutContent(form.Reference_Phone_2.value))
	{ errormessage += "\nYou did not enter the Phone Number for Reference 2"; }
if(WithoutContent(form.Reference_Email_2.value))
	{ errormessage += "\nYou did not enter the Email Address for Reference 2"; }
	
if(WithoutContent(form.Reference_Name_3.value))
	{ errormessage += "\nYou did not enter the Name for Reference 3"; }
if(WithoutContent(form.Reference_School_3.value))
	{ errormessage += "\nYou did not enter the School Name for Reference 3"; }
if(WithoutContent(form.Reference_Location_3.value))
	{ errormessage += "\nYou did not enter the Location for Reference 3"; }
if(WithoutContent(form.Reference_Phone_3.value))
	{ errormessage += "\nYou did not enter the Phone Number for Reference 3"; }
if(WithoutContent(form.Reference_Email_3.value))
	{ errormessage += "\nYou did not enter the Email Address for Reference 3"; }


if(WithoutContent(form.checkcode.value))
	{ errormessage += "\nYou did not enter the ANTI-Spam Security Code"; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:\n' + errormessage + '\n\nPlease correct these errors and try again.');
	return false;
	}
return true;
} // end of function CheckRequiredFields_agent()

function CheckRequiredFields_register(form) {
var errormessage = new String();
// Put field checks below this point.
	
if(WithoutContent(form.First_Name.value))
	{ errormessage += "\nYou did not enter your First Name."; }
if(WithoutContent(form.Last_Name.value))
	{ errormessage += "\nYou did not enter your Family/Last Name."; }
if(NoneWithCheck(form.Gender))
	{ errormessage += "\nYou must specify your Gender."; }
if(WithoutSelectionValue(form.Birth_Day)) 
	{ errormessage += "\nYou did not select your Birth Day."; }
if(WithoutSelectionValue(form.Birth_Month)) 
	{ errormessage += "\nYou did not select your Birth Month."; }			
if(WithoutSelectionValue(form.Birth_Year)) 
	{ errormessage += "\nYou did not select your Birth Year."; }	
if(WithoutContent(form.Nationality.value))
	{ errormessage += "\nYou did not enter your Nationality."; }	
if(WithoutContent(form.Primary_Language.value))
	{ errormessage += "\nYou did not enter your Primary Language."; }	
	
if(WithoutContent(form.Street.value))
	{ errormessage += "\nYou did not enter your Street."; }	
if(WithoutContent(form.City.value))
	{ errormessage += "\nYou did not enter your City."; }	
if(WithoutContent(form.Postal_Code.value))
	{ errormessage += "\nYou did not enter your Postal Code."; }
if(WithoutContent(form.Country.value))
	{ errormessage += "\nYou did not enter your Country."; }	
if(WithoutContent(form.Telephone.value))
	{ errormessage += "\nYou did not enter your Telephone Number."; }	
if(WithoutContent(form.Email_Address.value))
	{ errormessage += "\nYou did not enter your Email Address."; }	

if(WithoutSelectionValue(form.Heard_About_ECSL)) 
	{ errormessage += "\nYou did not specify Where you Heard About ECSL."; }
if(WithoutSelectionValue(form.Register_For)) 
	{ errormessage += "\nYou did not specify What Program you are Registering For."; }
if(WithoutSelectionValue(form.Number_of_Weeks)) 
	{ errormessage += "\nYou did not specify The Number of Weeks you are Registering For."; }	
if(WithoutSelectionValue(form.Start_On)) 
	{ errormessage += "\nYou did not specify what day you want to start your program."; }

if(NoneWithCheck(form.Attend_NS_College))
	{ errormessage += "\nYou must specify whether you will be attending a NS College or University."; }
if (form.Attend_NS_College[0].checked) {
	if(WithoutSelectionValue(form.College_Choice)) 
		{ errormessage += "\nYou did not specify what College/University you will be attending."; }
	if(NoneWithCheck(form.College_Applied))
		{ errormessage += "\nYou must specify whether you already applied to university or college?"; }
}
if(NoneWithCheck(form.Under_19))
	{ errormessage += "\nYou must specify whether you are Under 19 Years of Age"; }
if(NoneWithCheck(form.Homestay))
	{ errormessage += "\nYou must specify whether you wish to stay with a Homestay Family."; }		
if (form.Under_19[0].checked) {
	if(form.Homestay[1].checked)
		{ errormessage += "\nIf you are under 19 years of age you must stay with an ECSL Host Family."; }
}

if(WithoutContent(form.Payment_Method.value))
	{ errormessage += "\nYou did not specify how you want to make payment.."; }	
if(NoneWithCheck(form.Already_Purchase_Insurance))
	{ errormessage += "\nYou must specify whether you have Already Purchased Health Insurance or not"; }
	
if(WithoutCheck(form.TOC))
	{ errormessage += "\nYou must specify that you have read and understand the ECSL Terms and Conditions"; }	

if(WithoutContent(form.checkcode.value))
	{ errormessage += "\nYou did not enter the ANTI-Spam Security Code"; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:\n' + errormessage + '\n\nPlease correct these errors and try again.');
	return false;
	}
return true;
} // end of function CheckRequiredFields_register()

function CheckRequiredFields_contact(form) {
var errormessage = new String();
// Put field checks below this point.
	
if(WithoutContent(form.First_Name.value))
	{ errormessage += "\nYou did not enter your First Name."; }
if(WithoutContent(form.Last_Name.value))
	{ errormessage += "\nYou did not enter your Last Name."; }
	
if(WithoutContent(form.Country.value))
	{ errormessage += "\nYou did not enter your Country of Residence."; }	
if(WithoutContent(form.Email_Address.value))
	{ errormessage += "\nYou did not enter your Email Address."; }	

if(WithoutSelectionValue(form.Heard_About_ECSL)) 
	{ errormessage += "\nYou did not specify Where you Heard About ECSL."; }

if(WithoutContent(form.checkcode.value))
	{ errormessage += "\nYou did not enter the ANTI-Spam Security Code"; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:\n' + errormessage + '\n\nPlease correct these errors and try again.');
	return false;
	}
return true;
} // end of function CheckRequiredFields_contact()



function CheckEmail(s_email)
{
	var i = s_email.indexOf(' ',0);
	while(i > -1)
	{
		s_email = s_email.substring(0,i) + 
			s_email.substring((i + 1),s_email.length);
		i = s_email.indexOf(' ',0);
	}
	if((s_email.length < 6) ||
	   (s_email.indexOf('@',0) < 1) ||
	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||
	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||
	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||
	   (s_email.lastIndexOf('.') < (s_email.length - 4)) ||
	   (s_email.indexOf('..',0) > -1) ||
	   (s_email.indexOf('@.',0) > -1) ||
	   (s_email.indexOf('.@',0) > -1) ||
	   (s_email.indexOf(',',0) > -1))
	{
		return false;
	}
	return true;
}

function WithContent(ss) {
if(ss.length = 0) { return false; }
return true;
}
function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}
