
function doValidation(theForm)
{
	var filledOut = true;

	filledOut = checkEmptyField (theForm.make, "Please select a make.");
	if (!filledOut) {
		return false;
	}

	filledOut = checkEmptyField (theForm.model, "Please select a model.");
	if (!filledOut) {
		return false;
	}

	filledOut = checkEmptyField (theForm.autoid, "Please select a trim.");
	if (!filledOut) {
		return false;
	}

	/*Allows only valid Zip*/
	filledOut = checkZip (theForm);
	if (!filledOut) {
		return false;
	}
	return (true);
}

function checkEmptyField (fieldObj, message)
{
	var checkStr=fieldObj.value;

	if(checkStr == null || checkStr == "") {
		alert(message);
		fieldObj.focus();
		return false;
	}

	return true;
}

function checkZip (theForm)
{
	var objRegExp = /(^\d{5}$)/;

	//check for valid US Zipcode
	if (!objRegExp.test(theForm.zip.value) || theForm.zip.value=="00000" || theForm.zip.value=="99999") {
		alert("Please enter a valid zip.");
		theForm.zip.focus();
		return false;
	}

	return true;
}