function validate()
{
	at  = document.frmContact.txtEmail.value.indexOf('@');
	dot = document.frmContact.txtEmail.value.indexOf('.');
	//var Phone=document.frmContact.getElementById("txtPhNo");

	if(document.frmContact.txtName.value == "")  //validation for name should not blank
		{
				alert("Please Enter Name");	
		}
		else if(document.frmContact.txtCompany.value == "") //validation for company should not blank
		{
				alert("Please Enter the Company");
		}
		else if(document.frmContact.txtEmail.value == "")  //validation for email should not blank
		{
				alert("Please Enter the Email");
		}
		else if((at == -1 || dot == -1) || (document.frmContact.txtEmail.value == ""))//email must conatains @ and .
		{
			alert("Please enter valid email ID.");
		}
		else if(document.frmContact.txtCountry.value == "")//validation for country should not blank
		{
				alert("Please Enter the Country");
		}
		else if(document.frmContact.txtCountryCode.value == "")//validation for countrycode should not blank
		{
				alert("Please Enter the CountryCode");
		}
		else if(document.frmContact.txtArea.value == "")//validation for area should not blank
		{
				alert("Please Enter the AreaCode");
		}
		else if(document.frmContact.txtPhNo.value == "")//validation for phoneno should not blank
		{
				alert("Please Enter the PhoneNo");
		}
		else if(document.frmContact.txtInq.value == "")//validation for inquiry should not blank
		{
				alert("Please Enter the Inqury Message");
		}
		else if((at == -1 || dot == -1) || (document.frmContact.txtEmail.value == ""))/*validation for email should not blank*/
		{
			alert("Please enter valid email ID.");
		}
		else if(checkPhNo(document.frmContact.txtPhNo.value) || checkPhNo(document.frmContact.txtCountryCode.value) || checkPhNo(document.frmContact.txtArea.value))//validation for phoneno should not blank
		{
			
			alert("Please enter valid Phone Number with Proper Area Code & Country Code.");
		}
		else
		{
			document.frmContact.submit();  //submit the form
		}

		
}
function checkPhNo(s)
{ 
	//var Phone=document.getElementById("txtPhNo");
	
	if ((s==null)||(s==""))
	{
		alert("Please Enter your Phone Number");
	}
	var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9")))
			return true;
    }
    // All characters are numbers.
   return false;
}
function checkNo(s,elemnt)
{
	if ((s==null)||(s==""))
	{
		alert("Please Enter your Phone Number");
	}
	var i;

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))){
			alert("Please Enter Valid " + elemnt);
			return false;
	}
    }
    // All characters are numbers.
   return true;	
}

