function form1valid()
{
	if(document.form1.name.value == "")
	{	
		alert("Please Enter the Name");
		document.form1.name.focus();
		return false;
	}
	
		if(document.form1.company.value == "")
	{	
		alert("Please Enter the Company Name");
		document.form1.company.focus();
		return false;
	}
	
		if(echeck(document.form1.email.value)==false)
	{
		document.form1.email.focus();
		return false;
	}
	
	if(document.form1.purpose.value == "")
	{	
		alert("Please Select the Purpose");
		document.form1.purpose.focus();
		return false;
	}
	
	/*if(document.form1.address.value == "")
	{	
		alert("Please Enter the Address");
		document.form1.address.focus();
		return false;
	}*/
	
	if((document.form1.phone.value)=="")
	{
		alert("Please Enter the Contact No");
		document.form1.phone.focus();
		return false;
	}
	
	else 
	{
		if(isNaN(document.form1.phone.value))
		{
		alert("Please Enter Valid Contact No");
		document.form1.phone.focus();
		return false;
		}
		else
		{
		
		if(document.form1.phone.value.length < 10)
				{
				alert("Please Enter Valid Contact No");
				document.form1.phone.focus();
				return false;
				}
        }
	
	}

	
	if(document.form1.enquiry.value == "")
	{	
		alert("Please Enter your Query");
		document.form1.enquiry.focus();
		return false;
	}
	   
	
}

function echeck(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1)
		{
		   alert("Invalid E-mail ID")
		   return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false0
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
 		 return true
}