function isEmpty(inputStr) {
	return (inputStr == null || inputStr == "");
}
function isPosInteger(inputStr) {
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.charAt(i);
		if (oneChar < "0" || oneChar > "9") return false;
	}
	return true;
}

function v_phone(phone) {
	return phone.length == 10 && isPosInteger(phone);
}
function v_email(email) {
	var pos = email.indexOf('@');
	if (pos < 1) return false;
	var right = email.substr(pos+1);
	pos = right.indexOf('.');
	if (pos < 1) return false;
	if (right.substr(pos+1).length < 2) return false;
	return true;
}
function v_zip(zip /*element*/) {
	var p_dash = zip.value.indexOf('-');
	if (p_dash != -1) zip.value = zip.value.substr(0, p_dash) + zip.value.substr(p_dash+1);
	return zip.value.length == 5 || zip.value.length == 9 && isPosInteger(zip.value);
}

function require(elem, name) {
	if (isEmpty(elem.value)) {
		errors++;
		errlist += "\n" + name + " cannot be empty.";
	}
}
