function checkName(strng) {
var error = "";
	if (strng == "") {
		error = "Please enter your fulll name.\n";
	}
return error;
}


function checkEmail(strng) {
var error = "";

var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) { 
		error = "Please enter a valid email address.\n";
	}

var illegalChars=/[\(\)\<\>\,\;\:\\\/\'"'\[\]]/;
	if (strng.match(illegalChars)) {
		error = "The email address contains illegal characters.\n";
	}
return error;
}

function checkAddress(strng) {
var error = "";
	 if (strng == "") {
	    error = "Please enter your address.\n";
	 }
return error;
}

function checkCity(strng) {
var error = "";
	 if (strng == "") {
	    error = "Please enter your city.\n";
	 }
return error;
}

function checkState(choice) {
var error = "";
    if (choice == 0) {
       error = "Please choose a state or province.\n";
	}
return error;
}

function checkZip(strng) {
var error = "";
var acceptableChars = /[\d]/; // allow only numbers
	if (strng == "") {
		error = "Please enter a zip/postal code.\n";
	} else if (strng.length < 5) {
		error = "The zip/postal code is the wrong length.\n";
	} else if (!(acceptableChars.test(strng))) {
		error = "Zip/Postal code: only numbers are allowed.\n";
    }
return error;
}

function checkTelephone(strng) {
var error = "";

var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
	//strip out acceptable non-numeric characters
	if (isNaN(parseInt(stripped))) {
		error = "The phone number contains illegal characters.";
	}
	
	if (stripped.value == "") {
		error = "Please enter your phone number.\n";
	} else if (!(stripped.length == 10)) {
		error = "The phone number is the wrong length.\nMake sure you included an area code.\n";
	}
return error;
}
