function chkForm(form, formMode) {
   if (formMode=="1") {
   if  ((form.City.value=="Any" && form.zip5.value != "Any") || (form.zip5.value=="Any" && form.City.value != "Any") || (form.zip5.value=="Any" && form.City.value == "Any")) {
	return true;

   } else {
	alert ("Please select either City/Area OR Zip Code but not both.");
	return false;

   }
   }

   if (formMode=="2") {
	return(isUSZipcode(form.zip5.value));
   }

   if (formMode=="3") {
	if (form.City.value=='') {
		alert("City Name Cannot be NULL.");
		return false;
	}
	ret=isAlphabetic(form.City.value);
	if (ret==false) {
		alert("Please enter a valid City Name.");
		return false;
	}
   }

}

function isNumeric(string, ignoreWhiteSpace) {
	if (string.search) {
		if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;
	}
	return true;
}

function isAlphabetic(string, ignoreWhiteSpace) {
	if (string.search) {
		if ((ignoreWhiteSpace && string.search(/[^a-zA-Z\s]/) != -1) || (!ignoreWhiteSpace && string.search(/[^a-zA-Z]/) != -1)) return false;
	}
	return true;
}

function isUSZipcode(zipcode) {
	zipcode = removeSpaces(zipcode);

	if (zipcode=='') {
		alert("Zip Code Cannot be NULL.");
		return false;
	}

	if (!isNumeric(zipcode)) {
		alert("Please enter a valid NUMERIC US Zip Code.");
		return false;
	}

	if (!(zipcode.length == 5)) {
		alert("Please enter a 5-DIGIT US Zip Code.");
	 	return false;
	}

   return true;
}

function removeSpaces(string) {
	var newString = '';
	for (var i = 0; i < string.length; i++) {
		if (string.charAt(i) != ' ') newString += string.charAt(i);
	}
	return newString;
}