function ValidateRegForm() {

	EmptyFields = "";

	checkString = document.reg.first_name.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "A first name is required.\n";
	}	
	regex = /[^A-Za-z\.\-_ ]/
	if (regex.test(checkString) == true)	{
		EmptyFields = EmptyFields + "First Name may consist of letters, - and spaces only.\n";
	}
	
	checkString = document.reg.last_name.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "A last name is required.\n";
	}	
	regex = /[^A-Za-z\.\-\'_ ]/
	if (regex.test(checkString) == true)	{
		EmptyFields = EmptyFields + "Last Name may consist of letters, \',- and spaces only.\n";
	}	
	checkString = document.reg.email.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "An email address is required.\n";
	} else if ((checkString.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) == false) {
		EmptyFields = EmptyFields + "The email address doesn't appear to be valid.\n";
	}	
	checkString = document.reg.phone.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "Please enter your telephone number.\n";
	}
	regex = /[^0-9]/
	if (regex.test(checkString) == true)	{
		EmptyFields = EmptyFields + "Your telephone number must only consist of numbers.\n";
	}	
	checkString = document.reg.company.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "Please enter your company.\n";
	}
	checkString = document.reg.city.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "Please enter your city.\n";
	}	
	checkString = document.reg.street_name.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "Please enter your street name.\n";
	}		
	checkString = document.reg.state.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "Please select a province.\n";
	}
	checkString = document.reg.form_postal.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "Please enter your postal code.\n";
	}	
// SMS Checking
	if ( document.reg.opt_in_3.checked ) {
		cellNumber1 = document.reg.cell1.value;
		cellNumber2 = document.reg.cell2.value;
		cellNumber3 = document.reg.cell3.value;
		cellCarrier = document.reg.carrier.value;
		
		if ( cellCarrier == "SELECT" ){
			EmptyFields = EmptyFields + "Please select cell phone carrier.\n";
		}
		
		if ( !cellNumber1.length || !cellNumber2.length || !cellNumber3.length )
			EmptyFields = EmptyFields + "Please enter your cell phone number.\n";		
				
	}	
	
    if (EmptyFields != "") {
		alert(EmptyFields);
		return false;
	} else {
		return true;
	}
}

function ValidateLoginForm()	{
	EmptyFields = "";
	
	userString = document.login.username.value;
	if (userString == "" ) {		
		EmptyFields = EmptyFields + "A username is required.\n";
	}	
	regex = /[^A-Za-z0-9_\- ]/ // Matches any non-word character, spaces ok
	if (regex.test(userString) == true)	{
		EmptyFields = EmptyFields + "The username may consist of letters, numbers and spaces only.\n";
	}
	userString = document.login.password.value;
	if (userString == "" ) {		
		EmptyFields = EmptyFields + "The password is required.\n";
	}	
	regex = /[^A-Za-z0-9_~!@#$%^&*+=|?]/

	if (regex.test(userString) == true)	{
		EmptyFields = EmptyFields + "The password may consist of letters, numbers and spaces only.\n";
	}
		
	if (EmptyFields != "") {
		alert(EmptyFields);
		return false;
	} else {
		return true;
	}
}

function ValidateForgotForm(){
	EmptyFields = "";
	
		checkString = document.forgot.email.value;
	if (checkString == "" ) {		
		EmptyFields = EmptyFields + "An email address is required.\n";
	} else if ((checkString.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) == false) {
		EmptyFields = EmptyFields + "The email address doesn't appear to be valid.\n";
	}

	if (EmptyFields != "") {
		alert(EmptyFields);
		return false;
	} else {
		return true;
	}
}
