function validcontact(frm)
{ 
with(frm)
	{
		if (validate_required(name,"Please enter your name")==false)
		{name.focus();return false;}
		
			
			if(validate_email(email)==false)
		{
			email.value="";
			email.focus();return false;
		}
		 
		if (validate_required(phone,"Please enter your phone")==false)
		{phone.focus();return false;}
			if(IsNumeric(phone.value)==false)
			{
				alert("Please enter numbers only");
				phone.value="";
				phone.focus();
				return false;
			}
	
	
		if (validate_required(comment,"Please enter your message")==false)
		{comment.focus();return false;}
	
		
	}
		
	return true;
}








function validate_required(field,alerttxt)
{
	if(field.value==null || field.value=="")
	  {
			alert(alerttxt);
			return false;
	  }
	else
	 {
		return true;
	 }
}




//Email validation

function validate_email(field)
{

	if (field.value==null||field.value=="")
	{
		alert("Please enter email address");
		return false;
	}
	else
	{
			apos=field.value.indexOf("@");
			dotpos=field.value.lastIndexOf(".");
			if (apos<1||dotpos-apos<2) 
			 {
			  alert("Invalid Email");
			  return false;
			  }
			else 
			{
				return true;
			}
	}
	return true;
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {

   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   
  function validcheck()
{
	if(validate_email(document.frm.email)==false)
		{
			document.frm.email.value="";
			document.frm.email.focus();return false;
		}
		return true;
}
