function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.
if(WithoutContent(document.ni_app.t1_surname.value))
	{ errormessage += "\nYou did not enter your Surname."; }
if(WithoutContent(document.ni_app.t1_first.value))
	{ errormessage += "\nYou did not enter your First Name."; }
if(WithoutContent(document.ni_app.t1_homephone.value))
	{ errormessage += "\nYou did not enter your Home Phone Number."; }
if(NoneWithCheck(document.ni_app.t1_warrants))
	{ errormessage += "\nYou must answer the question about whether or not there are any outstanding warrants for your arrest."; }	 
if(NoneWithCheck(document.ni_app.t1_crim))
	{ errormessage += "\nYou must answer the question about whether you have ever been convicted of a criminal offence."; }	 	
if(WithoutCheck(document.ni_app.t6_consent1))
	{ errormessage += "\nYou must check that you declare your information is true and complete in the Consent Section"; }
if(WithoutCheck(document.ni_app.t6_consent2))
	{ errormessage += "\nYou must state that you authorize Northeastern to conduct a background investigation in the Consent Section."; }	
//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()

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;
}
