function ValidateForm()
{
	var strErr = "";

	if (document.getQuoteForm.Type.value == "none") {
		strErr = strErr + "You must select an insurance type.\n";
	}
		
	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";
	}
	
	if (document.getQuoteForm.Type.value == 'Auto' && !document.getElementById('rblnoinsuranceyes').checked && !document.getElementById('rblnoinsuranceno').checked) 
    {
          strErr = strErr + "Please indicate if you currently have Auto Insurance.\n";
    }
     
	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 = \"/Images/alert.gif\"");
	}
	else {
		eval("document.getQuoteForm."+strFieldName+"_ErrImg.src = \"/Images/trans.gif\"");
	}
}
function CheckforInsuranceQuestion(type)
{
    if(type == "Auto")
    {  
      document.getElementById('mainInsuranceQuestion').style.display = 'block';
    }  
    else
    {  
      document.getElementById('mainInsuranceQuestion').style.display = 'none';      
    }  
}
