/*

Quote From Name: getQuoteForm
Insurance Type: Type
Zip code: zip
Are you currently insured Div (to show/hide): yes-no
Are you currently insured radio button Id Yes: QuoteBoxLeadHasInsurance1
Are you currently insured radio button Id No: QuoteBoxLeadHasInsurance0

*/
function ValidateForm_1	()
{
	var strErr = "";

	if (document.getQuoteForm_1.type.value == "none") {
		strErr = strErr + "You must select an insurance type.\n";
	}
	
	var tmpZip = trim_1(document.getQuoteForm_1.zip.value);
	document.getQuoteForm_1.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.getElementById("QuoteBoxLeadHasInsurance1").checked) 
//			&& (! document.getElementById("QuoteBoxLeadHasInsurance0").checked))
//	{
//	  strErr = strErr + "You must specify if you are currently insured";
//  }

	if ((document.getElementById("currently_insured_1").className == "visible") && (! document.getElementById("noinsurance1_1").checked) && (! document.getElementById("noinsurance0_1").checked))
	{
		strErr = strErr + "You must specify if your car is currently insured";
	}

	if (strErr != "") 
	{
		alert(strErr);
		return false;
	}
	
	return true;
}

function trim_1(str)
{
  return((" "+ str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,"$1"));
}

function insurance_type_change_1()
{
	if (document.getElementById("type_1").value == "Auto")
	{
		document.getElementById("currently_insured_1").className = "visible";
	}
	else
	{
		document.getElementById("currently_insured_1").className = "invisible";
	}
}
