// JavaScript Document
function frmValidation()
{
    var Field= Array();
	var FieldName= Array();

	Field[0]=document.autoquote.txtname.value;
	Field[1]=document.autoquote.address.value;
	Field[2]=document.autoquote.phone.value;
	Field[3]=document.autoquote.altphone.value;
	Field[4]=document.autoquote.email.value;
	Field[5]=document.autoquote.driver.value;
	Field[6]=document.autoquote.ssno.value;
	Field[7]=document.autoquote.cuaddress.value;
	Field[8]=document.autoquote.praddress.value;
	Field[9]=document.autoquote.ownhome.value;
	Field[10]=document.autoquote.vehicle.value;
	Field[11]=document.autoquote.make.value;
	Field[12]=document.autoquote.model.value;
	Field[13]=document.autoquote.vin.value;
	Field[14]=document.autoquote.cuinsure.value;
	Field[15]=document.autoquote.cucoverage.value;
	Field[16]=document.autoquote.dassign.value;
	Field[17]=document.autoquote.driverl.value;
	Field[18]=document.autoquote.incident.value;
		
	FieldName[0]="Name";
	FieldName[1]="Address";
	FieldName[2]="Phone";
	FieldName[3]="Alt# ";
	FieldName[4]="Email Address ";
	FieldName[5]="Drivers ";
	FieldName[6]="Social Security#";
	FieldName[7]="Current Address";
	FieldName[8]="Prior Address";
	FieldName[9]="Do you own the home";
	FieldName[10]="Vehicle";
	FieldName[11]="Make";
	FieldName[12]="Model";
	FieldName[13]="Vin #";
	FieldName[14]="Current Insurer";
	FieldName[15]="Current Coverage";
	FieldName[16]="Driver Assignment";
	FieldName[17]="Driver";
	FieldName[18]="Incident";
		
	var msg="";
	var bval=true;
	
	for(i=0; i<19; i++)
	{
		if(Field[i]=="" || Field[i]==0)
		{
			
			msg = msg + "\n" + ">> " + FieldName[i] + " Field";
			bval = false;
						
		}
		
	}
	
	if(msg != "")
	{
		al = "Please Fill the following fields" 
		al = al + "\n" + msg;
		alert(al);
		bval=false;
	}
	
	if(bval)
	{
		bval=emailCheck(Field[4]);
	}
	
	//alert("Hi");
	return bval;
	
}
function emailCheck(emailStr1) 
  	{
  	  		var emailPat=/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/
  	        var matchArray;	
  	  		//var emailStr1 =document.frmorder.EmailAddress.value;	
			
  	  	
  	  		
					matchArray = emailStr1.match(emailPat);
					if (matchArray == null) 
					
					{
						alert("Please Enter Correct Email Address"); 
						document.frmorder.EmailAddress.focus;
						return false;
					}	
					else 
					return true;
	  	
    }
