// 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.CompanyName.value;
	Field[3]=document.frmContact.PhoneNo.value;
	Field[4]=document.frmContact.MobileNo.value;
	Field[5]=document.frmContact.Email.value;
	Field[6]=document.frmContact.City.value;
	Field[7]=document.frmContact.Country.value;
	

	FieldName[0]="First Name";
	FieldName[1]="Last Name";
	FieldName[2]="Company Name";
	FieldName[3]="Phone No";
	FieldName[4]="Mobile No";
	FieldName[5]="Email";
	FieldName[6]="City";
	FieldName[7]="Country";
	
	
	
	
	
	var msg="";
	var bval=true;
	
	for(i=0; i<8; i++)
	{
		if(Field[i]=="")
		{
			//alert("Please fill " + FieldName[i] + " field.");
			msg = msg + "\n" + ">> " + FieldName[i];

		}
	}
	
	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.Email.value;	
			
  	  	
  	  		
					matchArray = emailStr1.match(emailPat);
					if (matchArray == null) 
					
					{
						alert("Please Enter Correct Email Address"); 
						document.frmContact.Email.focus;
						return false;
					}	
					else 
					return true;
					  		
			
  	  	
    }