function check (f){	var checked = false;	for (var i=0; i<f.Type_Card.length; i++)	{		if (f.Type_Card[i].checked) checked = true}		{			return checked;		}}function echeck(str){		var at="@"		var dot="."		var lat=str.indexOf(at)		var lstr=str.length		var ldot=str.indexOf(dot)		if (str.indexOf(at)==-1)		{		   alert("Invalid E-mail Format")		   return false		}		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)		{		   alert("Invalid E-mail Format")		   return false		}		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)		{		    alert("Invalid E-mail Format")		    return false		}		 if (str.indexOf(at,(lat+1))!=-1)		 {		    alert("Invalid E-mail Format")		    return false		 }		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)		 {		    alert("Invalid E-mail Format")		    return false		 }		 if (str.indexOf(dot,(lat+2))==-1)		 {		    alert("Invalid E-mail Format")		    return false		 }				 if (str.indexOf(" ")!=-1)		 {		    alert("Invalid E-mail Format")		    return false		 }	}function Layer2(){	if (document.getElementById("firstName").value == "")	{		alert("Please Enter First Name");		document.getElementById("firstName").focus();		return(false);	}	if (document.getElementById("lastName").value == "")	{		alert("Please Enter Last Name");		document.getElementById("lastName").focus();		return(false);	}	if (document.getElementById("address").value == "")	{		alert("Please enter a value for the \"Address\" field.");		document.getElementById("address").focus();		return(false);	}		if (document.getElementById("address").value.length < 3)	{		alert("Please enter at least 3 characters in the \"Address\" field.");		document.getElementById("address").focus();		return (false);	}	if (document.getElementById("city").value == "")	{		alert("Please enter a value for the \"City\" field.");		document.getElementById("city").focus();		return(false);	}		if (document.getElementById("zip").value == "")	{		alert("Please enter a value for the \"Zip Code\" field.");		document.getElementById("zip").focus();		return(false);	}		if (document.getElementById("zip").value.length < 5)	{		alert("Please enter at least 5 digits in the \"Zip Code\" field.");		document.getElementById("zip").focus();		return (false);	}	if ((document.getElementById("email").value==null)||(document.getElementById("email").value==""))	{		alert("Please Enter your Email");		document.getElementById("email").focus();		return (false);	}		if (echeck(document.getElementById("email").value)==false)	{		document.getElementById("email").focus();		return (false);	}		if (document.getElementById("homeArea").value != "")	{		if (document.getElementById("homeArea").value.length < 3)		{			alert("Please enter at least 3 digits in the \"Home Area Code\" field.");			document.getElementById("homeArea").focus();			return (false);		}			if (document.getElementById("homePrefix").value.length < 3)		{			alert("Please enter at least 3 digits in the \"Home Telephone Prefix\" field.");			document.getElementById("homePrefix").focus();			return (false);		}		if (document.getElementById("homeSuffix").value.length < 4)		{			alert("Please enter at least 4 digits in the \"Home Telephone Suffix\" field.");			document.getElementById("homeSuffix").focus();			return (false);		}	}		if (document.getElementById("workArea").value != "")	{		if (document.getElementById("workArea").value.length < 3)		{			alert("Please enter at least 3 digits in the \"Work Phone Area Code\" field.");			document.getElementById("workArea").focus();			return (false);		}			if (document.getElementById("workPrefix").value.length < 3)		{			alert("Please enter at least 3 digits in the \"Work Phone Prefix\" field.");			document.getElementById("workPrefix").focus();			return (false);		}		if (document.getElementById("workSuffix").value.length < 4)		{			alert("Please enter at least 4 digits in the \"Work Phone Suffix\" field.");			document.getElementById("workSuffix").focus();			return (false);		}	}		if (document.getElementById("cellArea").value != "")	{		if (document.getElementById("cellArea").value.length < 3)		{			alert("Please enter at least 3 digits in the \"Cell Phone Area Code\" field.");			document.getElementById("cellArea").focus();			return (false);		}			if (document.getElementById("cellPrefix").value.length < 3)		{			alert("Please enter at least 3 digits in the \"Cell Phone Prefix\" field.");			document.getElementById("cellPrefix").focus();			return (false);		}		if (document.getElementById("cellSuffix").value.length < 4)		{			alert("Please enter at least 4 digits in the \"Cell Phone Suffix\" field.");			document.getElementById("cellSuffix").focus();			return (false);		}	}		if (document.getElementById("DOB_month").value == "0")	{		alert("The first \"Date of Birth Month\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("DOB_month").focus();		return(false);	}		if (document.getElementById("DOB_day").value == "0")	{		alert("The first \"Date of Birth Day\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("DOB_day").focus();		return(false);	}	if (document.getElementById("DOB_year").value == "0")	{		alert("The first \"Date of Birth Year\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("DOB_year").focus();		return(false);	}		if (document.getElementById("driverLicenseNumber").value.length < 4)	{		alert("Please enter at least 4 digits in the \"Driver License\" field.");		document.getElementById("driverLicenseNumber").focus();		return (false);	}		if (document.getElementById("DL_month").value == "0")	{		alert("The first \"License Expiration Month\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("DL_month").focus();		return(false);	}		if (document.getElementById("DL_day").value == "0")	{		alert("The first \"License Expiration Day\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("DL_day").focus();		return(false);	}	if (document.getElementById("DL_year").value == "0")	{		alert("The first \"License Expiration Year\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("DL_year").focus();		return(false);	}	btnNext('2', '3');	return (true);}function Layer3(){	if (document.getElementById("InsCompanyName").value =="")	{		alert("Please enter Insurance Company Name");		document.getElementById("InsCompanyName").focus();		return (false)	}	if (document.getElementById("InsAgencyName").value =="")	{		alert("Please enter Insurance Angency Name");		document.getElementById("InsAgencyName").focus();		return (false)	}	if (document.getElementById("InsAgentName").value =="")	{		alert("Please enter Insurance Agent Name");		document.getElementById("InsAgentName").focus();		return (false)	}		if (document.getElementById("InsPhoneArea").value.length < 3)	{		alert("Please enter at least 3 digits in the \"Insurance Telephone Area Code\" field.");		document.getElementById("InsPhoneArea").focus();		return (false);	}		if (document.getElementById("InsPhonePrefix").value.length < 3)	{		alert("Please enter at least 3 digits in the \"Insurance Telephone Prefix\" field.");		document.getElementById("InsPhonePrefix").focus();		return (false);	}	if (document.getElementById("InsPhoneSuffix").value.length < 4)	{		alert("Please enter at least 4 digits in the \"Insurance Telephone Suffix\" field.");		document.getElementById("InsPhoneSuffix").focus();		return (false);	}	if (document.getElementById("InsPolicyNumber").value =="")	{		alert("Please enter Insurance Policy Number");		document.getElementById("InsPolicyNumber").focus();		return (false)	}	if (document.getElementById("InsExpirationMonth").value == "0")	{		alert("The first \"Insurance Expiration Month\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("InsExpirationMonth").focus();		return(false);	}		if (document.getElementById("InsExpirationDay").value == "0")	{		alert("The first \"Insurance Expiration Day\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("InsExpirationDay").focus();		return(false);	}	if (document.getElementById("InsExpirationYear").value == "0")	{		alert("The first \"Insurance Expiration Year\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("InsExpirationYear").focus();		return(false);	}	btnNext('3', '4');	return (true);}function Layer5(e){		if (check(e)==false)	{		alert ('Please check one of the Credit Card Type.');		return(false);	}	if (document.getElementById("CCfirstname").value == "")	{		alert("Please Enter First Name as it appears on Credit Card");		document.getElementById("CCfirstname").focus();		return(false);	}	if (document.getElementById("CClastname").value == "")	{		alert("Please Enter Last Name as it appears on Credit Card");		document.getElementById("CClastname").focus();		return(false);	}	if (document.getElementById("ccNumber").value.length < 10)	{		alert("Please Enter Credit Card number");		document.getElementById("ccNumber").focus();		return(false);	}	if (document.getElementById("CC_month").value == "0")	{		alert("The first \"Credit Card Expiration Month\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("CC_month").focus();		return(false);	}	if (document.getElementById("CC_year").value == "0")	{		alert("The first \"Credit Card Expiration Year\" option is not a valid selection.  Please choose one of the other options.");		document.getElementById("CC_year").focus();		return(false);	}	if (document.getElementById("cvv").value.length < 3)	{		alert("Please Enter CVV digit");		document.getElementById("cvv").focus();		return(false);	}	if (!document.getElementById("iacceptconfirmation").checked)  	{   		alert("Please sign and accept by checking \"I accept\" box.");    	document.getElementById("iacceptconfirmation").focus();    	return (false); 	}	return (true);}
