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

	
	Field[0]=document.frmcontact.FirstName.value;
	Field[1]=document.frmcontact.LastName.value;
	Field[2]=document.frmcontact.EmailAddress.value;
	Field[3]=document.frmcontact.PhoneNumber.value;
	Field[4]=document.frmcontact.Iagree.checked;
	Field[5]=document.frmcontact.txtcaptcha.value;
	

	FieldName[0]="First Name ";
	FieldName[1]="Last Name ";
	FieldName[2]="Email Address ";
	FieldName[3]="Telephone Number ";
	FieldName[4]="I agree to the terms and conditions ";
	FieldName[5]="Shown Code ";
	
	
	var msg="";
	var bval = true;
	
	for(i=0; i<6; i++)
	{
		if(Field[i]=="" || Field[i]==0)
		{
			//alert("Please fill " + FieldName[i] + " field.");
			msg = msg + "Please Fill:"
			msg = msg + "\n" + ">> " + FieldName[i] + "Field";
			alert(msg);
			bval = false;
			break;

		}
	}
	
	/*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=/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/
  	        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;
	  	
    }