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

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(FirstName,"Please fill out the first name field.")==false)
  {FirstName.focus();return false;}
  if (validate_required(Surname,"Please fill out the surname field.")==false)
  {Surname.focus();return false;}
  {
  var dValidate=document.form1.ContactTel.value;
  if(dValidate=="")
  {
    alert("Contact Tel. field is empty.")
    return false;
  }
  else if(isDigits(dValidate)==false)
  {
   alert("Contact Tel. field is not numeric.")
   return false;
  }
}

function isDigits(argvalue) {
    argvalue = argvalue.toString();
    var validChars = "0123456789";
    var startFrom = 0;
    if (argvalue.substring(0, 2) == "0x") {
       validChars = "0123456789";
       startFrom = 2;
    } else if (argvalue.charAt(0) == "0") {
       validChars = "0123456789";
       startFrom = 1;
    }
    for (var n = 0; n < argvalue.length; n++) {
        if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
    }
  return true;
}


}
}