
function ValidateForm()
{
	var strErr = "";

	if (document.getQuoteForm.Type.value == "none") {
		strErr = strErr + "You must select an insurance type.\n";
		//SetErrorImage("InsuranceType", true);
	}
	else {
		//SetErrorImage("InsuranceType", false);
	}
	
	var tmpZip = trim(document.getQuoteForm.zip.value);
	document.getQuoteForm.zip.value = tmpZip;
	if (tmpZip.search(/^\d{5}/) == -1 ||  tmpZip.length > 5) {
		strErr = strErr + "Zip Code is required and must be in the format 00000.\n";
		//SetErrorImage("ZipCode", true);
	}
	else {
		//SetErrorImage("ZipCode", false);
	}

	if (strErr != "") {
		alert(strErr);
		return false;
	}
	preserveRefby();	
	return true;
}

function trim(str){

            return((" "+ str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,"$1"));

}

function SetErrorImage(strFieldName, blnIsError)
{
	if (blnIsError) {
		eval("document.getQuoteForm."+strFieldName+"_ErrImg.src = \"http://www.insureme.com/images/alert.gif\"");
	}
	else {
		eval("document.getQuoteForm."+strFieldName+"_ErrImg.src = \"http://www.insureme.com/images/trans.gif\"");
	}
}
