// check to see if a form field is empty
function isNotEmpty (elem) {
	var valid;
	(elem.value == null || elem.value.length == 0) ? valid=false : valid=true;
	return valid;
}
// make sure an email address is in proper format
function isEmailAddress (elem) {
	var valid;
	var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
	!elem.value.match(re) ? valid=false : valid=true;
	return valid;
}
// check to see if form field contains ONLY numbers
function isOnlyNumbers (elem) {
	var str = elem.value.toString();
	var len = str.length;
	for (var i=0; i<len; i++) {
		var char = str.charAt(i).charCodeAt(0);
		if (char < 48 || char > 57) return false;
	}
	return true;
}
// check to see if form field contains ONLY numbers OR a dash
function isOnlyNumbersOrDash (elem) {
	var str = elem.value.toString();
	var len = str.length;
	for (var i=0; i<len; i++) {
		var char = str.charAt(i).charCodeAt(0);
		if (char < 48 || char > 57) {
			if (char != 45) return false;
		}
	}
	return true;
}
// check to see if 2 form field values are equivalent (such as password/password confirm)
function isEqualValue (elem1, elem2) {
	var valid;
	(elem1.value == elem2.value) ? valid=true : valid=false;
	return valid;
}
// check to see if user has selected an <option> in a select field - verifies that the selected index is NOT 0
function isValidSelect (elem) {
	var valid;
	(elem.selectedIndex > 0) ? valid=true : valid=false;
	return valid;
}
// verify form field has at least XXX number of characters typed in
function isMinLength (elem, num) {
	var valid;
	(elem.value.length >= num) ? valid = true : valid = false;
	return valid;
}
// verify form field has exactly XXX number of characters
function isExactLength (elem, num) {
	var valid;
	(elem.value.length == num) ? valid = true : valid = false;
	return valid;
}
// javascript alert error and focus on violating form field
function throwFormError (elem, msg) {
	alert(msg);
	elem.focus();
}