// JavaScript Document
function frmValidation()
{
    var Field= Array();
	var FieldName= Array();
	var selectedoption;
	
	FieldName[0]="First-Name";
	FieldName[1]="Last-Name";
	FieldName[2]="State";
	FieldName[3]="Zip";
	FieldName[4]="Email-Address";
	FieldName[5]="Phone-Number";
	//FieldName[5]="Size of Storage Needed";
	//FieldName[6]="Anticipated Storage Starting Date";
	//FieldName[7]="What type of storage are you interested in?";
	//FieldName[8]="Interested in packing supplies?";
	
	Field[0]=document.frmContact.FirstName.value;
	Field[1]=document.frmContact.LastName.value;
	Field[2]=document.frmContact.State.value;
	Field[3]=document.frmContact.Zip.value;
	if(document.frmContact.selectcontact[0].checked==true){
		Field[4]=document.frmContact.EmailAddress.value;
		FieldName[4]="Email-Address";
	}
	else{
		Field[5]=document.frmContact.PhoneNo.value;
		FieldName[5]="Phone-Number";
	}
	//Field[4]=document.frmContact.EmailAddress.value;
	//Field[5]=document.frmContact.PhoneNo.value;
	//Field[5]=document.frmContact.StorageNeeded.value;
	//Field[6]=document.frmContact.Anticipated.value;
	//Field[7]=document.frmContact.Climate.checked;
	//Field[8]=document.frmContact.Climate.checked;
	
	
		
	
	

	/*FieldName[0]="First-Name";
	FieldName[1]="Last-Name";
	FieldName[2]="State";
	FieldName[3]="Zip";
	//FieldName[4]="Email-Address";
	//FieldName[5]="Phone-Number";
	FieldName[4]="Size of Storage Needed";
	FieldName[5]="Anticipated Storage Starting Date";
	FieldName[6]="What type of storage are you interested in?"; */
                              
	
	
	//alert("hello");
	var msg="";
	var bval=true;
	
	for(i=0; i<8; i++)
	{
		if(Field[i]=="" || Field[i]==0)
		{
			//alert("Please fill " + FieldName[i] + " field.");
			msg = msg + "\n" + ">> " + FieldName[i];

		}
	}
	if(document.frmContact.Climate.checked==undefined){
		msg = msg + "\n" + ">> Interested in packing supplies?";
	}
	if(msg != "")
	{
		al = "Please Fill the following fields" 
		al = al + "\n" + msg;
		alert(al);
		bval=false;
	}
	
	if(bval)
	{
		bval=emailCheck();
	}
	
	//alert("Hi");
	return bval;
}

function emailCheck() 
  	{
  	  		var emailPat=/^(.+)@(.+)$/
  	        var matchArray;	
  	  		var emailStr1 =document.frmContact.EmailAddress.value;	
			
  	  	
  	  		
					matchArray = emailStr1.match(emailPat);
					if (matchArray == null) 
					
					{
						alert("Please Enter Correct Email Address"); 
						document.frmContact.EmailAddress.focus;
						return false;
					}	
					else 
					return true;
	  	
    }