// JavaScript Document
function validate(thisform)
{
	var name=document.getElementById("name").value
	var lastname=document.getElementById("lastname").value
	var country=document.getElementById("country").value
	var project=document.getElementById("project").value	
	var phone_no=document.getElementById("phone_no").value	
	var commentary=document.getElementById("commentary").value
	var email=document.getElementById("email").value
	
	
	if (name=="" && lastname=="" && country=="" && project=="" && phone_no=="" && commentary=="" && email=="")
	{
      alert("All fields marked with (*) are required")
	  return false
	}
	else
	{
		  if (name=="")
		  {
			alert("Field first name is required")
			return false
		  }
		  if (lastname=="")
		  {
			alert("Field last name is required")
			return false
		  }
		  with (thisform)
		  {
			if (validate_email(email,"It's not a valid e-mail")==false)
			{
			 email.focus();
			 return false
			}
		  }	
		  
		  if (project=="0")
		  {
			alert("Field how did you hear about us is required")
			return false
		  }
		  if (country=="0")
		  {
			alert("Field country is required")
			return false
		  }
		  if (commentary=="0")
		  {
			alert("Field commentary is required")
			return false
		  }		  
		  
    }
	
}
function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos < 1 || dotpos-apos < 2) 
		{
		  alert(alerttxt);
		  return false
		}
		else
		 {
			return true
		 }
	}
}
