function valid_email(eml)
{
	//declare the required variables
	var mint_len;
	var mstr_eml=eml;
	var mint_at=0;
	var mint_atnum=0;
	var mint_dot=0;
	var mint_dotnum=0;

	mint_len = eml.length; //takes the length of the email address entered
	//checking for the symbol single quote. If found replace it with its html code
	if (mstr_eml.indexOf("'")!=-1)
	{	
		mstr_eml=mstr_eml.replace("'","'");
	}
	//checking for the (@) & (.) symbol
	for(var iloop=0;iloop<mint_len;iloop++)
	{
		if(mstr_eml.charAt(iloop)=="@")
		{
			mint_at=iloop+1;
			mint_atnum=mint_atnum+1;
		}
		if(mstr_eml.charAt(iloop)==".")
		{
			mint_dot=iloop+1;
			mint_dotnum=mint_dotnum+1;
		}
	}
	//if nothing entered in the field
	if (mstr_eml=="")
	{
		return true;
	}
	//if @ entered more than once & dot (.) entered more than 4 times
	else if((mint_atnum!=1)||(mint_dotnum>4)||((mint_dot-mint_at)<2)||((mint_len-mint_dot)<2)||(mint_at<3))
	{
		return true;
	}
	//if any blank space is entered in the email address
	else if (mstr_eml.indexOf(" ")!=-1)
	{
		return true;
	}
	return false;
}
function validate()
{ 
  var Name=document.myform.name.value;
  var phone=document.myform.phone.value;
  var email=document.myform.email.value;
 var products=document.myform.message.value;
  
 
if((Name=='Name')||(alltrim(Name)==''))
{
alert("Please enter your Name");
document.getElementById('name').focus();
return false;
}


if((phone=='Phone')||(alltrim(phone)==''))
{
		alert("Please enter your Phone");
		document.getElementById('phone').focus();
		return false;
}
	
	
if((email=='E-mail')||(alltrim(email)==''))
 {
  alert('Please enter your E-mail');
  document.getElementById('email').focus();
  return false;
 }
 else
 {
	 if(valid_email(email)==true)
	 {
		 alert("Please enter a valid E-mail ");
	     document.getElementById('email').focus();
		 return false;
	 }
  }
  
  
 document.myform.submit();
  }
  
  
 
  
