function validate_required(field)
{
	with (field)
	{
	if (value==null||value=="")
  		{return false;}
	else {return true;}
	}
}

function validate_requestinfo(thisform)
{
	with (thisform)
	{
		if (validate_required(Name)==false) 
		{
			 alert("Name Required"); 
			 Name.focus();
			 return false; 
		}
		alert(" phone " & Phone);
		if (validate_email(Email)==false && validate_phone(Phone)==false)
		{
			alert("A Valid Email or Phone Number is Required.");
			Email.focus();
			return false;
		}
	}
}
function validate_contact(thisform)
{
	with (thisform)
	{
		if (validate_required(FirstName)==false && validate_required(LastName)==false) 
		{
			 alert("Name Required"); 
			 FirstName.focus();
			 return false; 
		}
		if (validate_email(From)==false && validate_phone(Phone.value)==false)
		{
			alert("A Valid Email or Phone Number is Required.");
			From.focus();
			return false;
		}
		if (validate_required(Body)==false)
		{
			alert("A message body is required");
			return false;	
		}
	}
}


function validate_phone(phonenumber){

	if (phonenumber.length > 6)
	{
		return IsNumeric(phonenumber);
	}
	 
	return false;
}
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 validate_email(field)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
  			{return false;}
		else {return true;}
	}
}

