function isEmpty(strng) {
	var error = "";
	if (strng.length == 0) {
		return true;
	}
	return false;
}

function checkEmail (strng) {
	var error="";
	if (strng == "") {
		error = "EMPTY";
	}
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) {
		error = "INVALID";
	} else {
		var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
		if (strng.match(illegalChars)) {
			error = "ILLEGALCHARS";
		}
	}
	return error;
}

function checkPhone (strng) {
	var error = "";
	if (strng == "") {
		error = "EMPTY";
	}
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
	if (isNaN(parseInt(stripped))) {
		error = "ILLEGALCHARS";
	}
	if (!(stripped.length == 10)) {
		error = "INVALIDLENGTH";
	}
	return error;
}

function checkPassword (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a password.\n";
	}
	var illegalChars = /[\W_]/;
	if ((strng.length < 6) || (strng.length > 8)) {
		error = "The password is the wrong length.\n";
	} else if (illegalChars.test(strng)) {
		error = "The password contains illegal characters.\n";
	} else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/)))) {
		error = "The password must contain at least one uppercase letter, one lowercase letter, and one numeral.\n";
	}
	return error;
}

function checkUsername (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a username.\n";
	}
	var illegalChars = /\W/; 
	if ((strng.length < 4) || (strng.length > 10)) {
		error = "The username is the wrong length.\n";
	} else if (illegalChars.test(strng)) {
		error = "The username contains illegal characters.\n";
	}
	return error;
}

function checkRadio(checkvalue) {
	var error = "";
	if (!(checkvalue)) {
		error = "Please check a radio button.\n";
	}
	return error;
}

function checkDropdown(choice) {
	var error = "";
	if (choice == 0) {
		error = "You didn't choose an option from the drop-down list.\n";
	}
	return error;
}