function isZipcode(value)
{
	var exp_zipcode = /^[0-9]{5}$/;
	return exp_zipcode.test(value); 
}

function validateForm(currentForm) {
	var elementsInputs;
	elementsInputs = currentForm.getElementsByTagName("input"); 
	for (var intCounter = 0; intCounter < elementsInputs.length; intCounter++) { 
		if (elementsInputs[intCounter].name == "zip") { 
			if (!(isZipcode(elementsInputs[intCounter].value))) {
				alert("To proceed please enter a valid ZIP Code.");
				elementsInputs[intCounter].focus();
				return false;
			}
		}
	}
	return true;
}

function formStValidate(f) {
	if (f.st.value == 0) {
		alert('Please select your state and then click on get quotes');	
		return false;
	}
	return true;
}

function getZipCode() {
	var f = document.getElementById('searchbox');
	if (f != null) {
		if (!isZipcode(f.zip.value)) {
			f.zip.value = "Enter ZIP Code";
			f.zip.focus();
		}
	}
}

function clearZipValue(zipInput) {
	if (isZipcode(zipInput.value)) {
		zipInput.select();
	} else {
		zipInput.value = '';
	}
}

function getZipValue(zipInput) {
	if (!isZipcode(zipInput.value)) {
		zipInput.value = "Enter ZIP Code";
	}
}

function quotesFormStValidateLanding(f) {
	if (f.st.value == 0) {
		alert('Please select your state and then click on get quotes');	
		return false;
	}

	f.submit();
}

function setFocus(obj) {
	obj.focus();
}

function getZipValueWithParams(zipInput, msg) {
	if (!isZipcode(zipInput.value)) {
		zipInput.value = msg;
	}
}