// JavaScript Documentvar blank = ' Field Must Not Be Blank!';var fnumb = ' Field Must Be In Numeric Format!';function validate_form() {  if (!validate_name()) {    return false;  }if (!validate_surname()) {    return false;  }  if (!validate_company()) {    return false;  }  if (!validate_phone_area()) {    return false;  }  if (!validate_phone()) {    return false;  }  if (!validate_fax_area()) {      return false;  }  if (!validate_fax()) {    return false;  }  if (!validate_email()) {    return false  }  if (!validate_employees()) {    return false  }}function is_number(arg) {  return (arg.length > 0);}function check_empty(arg) {  return !(arg.length > 0);}function validate_name() {  if (check_empty(document.form.Name.value)) {    alert('The Name' + blank);    return false;  }  return true;}function validate_surname() {  if (check_empty(document.form.Surname.value)) {    alert('The Surname' + blank);    return false;  }  return true;}function validate_company() {  if (check_empty(document.form.Company.value)){    alert('The Company' + blank);    return false;  }  return true;}function validate_phone() {  if(!check_empty(document.form.Phone.value)) {    if (!is_number(document.form.Phone.value)) {      alert('The Phone' + fnumb);      return false;    }  }  return true;}function validate_phone_area() {  if(!check_empty(document.form.Phone_Area.value)) {    if (!is_number(document.form.Phone_Area.value)) {      alert('The Area Code' + fnumb);      return false;    }  }  return true;}function validate_fax() {  if(!check_empty(document.form.Fax.value)) {    if (!is_number(document.form.Fax.value)) {      alert('The Fax' + fnumb);      return false;    }  }  return true;}function validate_fax_area() {  if(!check_empty(document.form.Fax_Area.value)) {    if (!is_number(document.form.Fax_Area.value)) {      alert('The Area Code' + fnumb);      return false;    }  }  return true;}function validate_email() {  if (check_empty(document.form.Email.value)) {  	alert('The Email' + blank);    return false;  }  return true;}function validate_employees() {  if (!check_empty(document.form.Employees.value)) {    if (is_number(document.form.Employees.value)) {      return true;    }    else {      alert('The Number Of Employees' + fnumb);    }  }  document.form.Employees.value = '1';  return false;}function set_numbers() {  if (document.form.State.value == 'NSW') {    document.form.Phone_Area.value = '02';    document.form.Fax_Area.value = '02';    return;  }  if (document.form.State.value == 'QLD') {    document.form.Phone_Area.value = '07';    document.form.Fax_Area.value = '07';    return  }  if (document.form.State.value == 'VIC') {    document.form.Phone_Area.value = '03';    document.form.Fax_Area.value = '03';    return  }  if (document.form.State.value == 'TAS') {    document.form.Phone_Area.value = '03';    document.form.Fax_Area.value = '03';    return  }  if (document.form.State.value == 'ACT') {    document.form.Phone_Area.value = '02';    document.form.Fax_Area.value = '02';    return  }  if (document.form.State.value == 'NT') {    document.form.Phone_Area.value = '08';    document.form.Fax_Area.value = '08';    return  }  if (document.form.State.value == 'SA') {    document.form.Phone_Area.value = '08';    document.form.Fax_Area.value = '08';    return  }  if (document.form.State.value == 'WA') {    document.form.Phone_Area.value = '08';    document.form.Fax_Area.value = '08';    return  }  document.form.Phone_Area.value = '';  document.form.Fax_Area.value = '';}function FrontPage_Form1_Validator(theForm){  if (theForm.Name.value == "")  {    alert("Please enter a value for the \"Name\" field.");    theForm.Name.focus();    return (false);  }  if (theForm.Name.value.length < 1)  {    alert("Please enter at least 1 characters in the \"Name\" field.");    theForm.Name.focus();    return (false);  }  if (theForm.Name.value.length > 30)  {    alert("Please enter at most 30 characters in the \"Name\" field.");    theForm.Name.focus();    return (false);  }  if (theForm.Surname.value == "")  {    alert("Please enter a value for the \"Surname\" field.");    theForm.Surname.focus();    return (false);  }  if (theForm.Surname.value.length < 1)  {    alert("Please enter at least 1 characters in the \"Surname\" field.");    theForm.Surname.focus();    return (false);  }  if (theForm.Surname.value.length > 30)  {    alert("Please enter at most 30 characters in the \"Surname\" field.");    theForm.Surname.focus();    return (false);  }  if (theForm.Position.value == "")  {    alert("Please enter a value for the \"Position\" field.");    theForm.Position.focus();    return (false);  }  if (theForm.Position.value.length < 1)  {    alert("Please enter at least 1 characters in the \"Position\" field.");    theForm.Position.focus();    return (false);  }  if (theForm.Position.value.length > 30)  {    alert("Please enter at most 30 characters in the \"Position\" field.");    theForm.Position.focus();    return (false);  }  if (theForm.Company.value.length < 1)  {    alert("Please enter at least 1 characters in the \"Company\" field.");    theForm.Company.focus();    return (false);  }  if (theForm.Company.value.length > 30)  {    alert("Please enter at most 30 characters in the \"Company\" field.");    theForm.Company.focus();    return (false);  }  if (theForm.Address.value.length < 1)  {    alert("Please enter at least 1 characters in the \"Address\" field.");    theForm.Address.focus();    return (false);  }  if (theForm.Address.value.length > 30)  {    alert("Please enter at most 30 characters in the \"Address\" field.");    theForm.Address.focus();    return (false);  }  if (theForm.Suburb.value == "")  {    alert("Please enter a value for the \"Suburb\" field.");    theForm.Suburb.focus();    return (false);  }  if (theForm.Suburb.value.length < 1)  {    alert("Please enter at least 1 characters in the \"Suburb\" field.");    theForm.Suburb.focus();    return (false);  }  if (theForm.Suburb.value.length > 16)  {    alert("Please enter at most 16 characters in the \"Suburb\" field.");    theForm.Suburb.focus();    return (false);  }  if (theForm.Postcode.value == "")  {    alert("Please enter a value for the \"Postcode\" field.");    theForm.Postcode.focus();    return (false);  }  if (theForm.Postcode.value.length < 4)  {    alert("Please enter at least 4 characters in the \"Postcode\" field.");    theForm.Postcode.focus();    return (false);  }  if (theForm.Postcode.value.length > 6)  {    alert("Please enter at most 6 characters in the \"Postcode\" field.");    theForm.Postcode.focus();    return (false);  }  var checkOK = "0123456789-";  var checkStr = theForm.Postcode.value;  var allValid = true;  var decPoints = 0;  var allNum = "";  for (i = 0;  i < checkStr.length;  i++)  {    ch = checkStr.charAt(i);    for (j = 0;  j < checkOK.length;  j++)      if (ch == checkOK.charAt(j))        break;    if (j == checkOK.length)    {      allValid = false;      break;    }    allNum += ch;  }  if (!allValid)  {    alert("Please enter only digit characters in the \"Postcode\" field.");    theForm.Postcode.focus();    return (false);  }  if (theForm.Phone_Area.value == "")  {    alert("Please enter a value for the \"Phone_Area\" field.");    theForm.Phone_Area.focus();    return (false);  }  if (theForm.Phone_Area.value.length < 2)  {    alert("Please enter at least 2 characters in the \"Phone_Area\" field.");    theForm.Phone_Area.focus();    return (false);  }  if (theForm.Phone_Area.value.length > 2)  {    alert("Please enter at most 2 characters in the \"Phone_Area\" field.");    theForm.Phone_Area.focus();    return (false);  }  var checkOK = "0123456789-.";  var checkStr = theForm.Phone_Area.value;  var allValid = true;  var decPoints = 0;  var allNum = "";  for (i = 0;  i < checkStr.length;  i++)  {    ch = checkStr.charAt(i);    for (j = 0;  j < checkOK.length;  j++)      if (ch == checkOK.charAt(j))        break;    if (j == checkOK.length)    {      allValid = false;      break;    }    if (ch == ".")    {      allNum += ".";      decPoints++;    }    else      allNum += ch;  }  if (!allValid)  {    alert("Please enter only digit characters in the \"Phone_Area\" field.");    theForm.Phone_Area.focus();    return (false);  }  if (decPoints > 1)  {    alert("Please enter a valid number in the \"Phone_Area\" field.");    theForm.Phone_Area.focus();    return (false);  }  if (theForm.Phone.value == "")  {    alert("Please enter a value for the \"Phone\" field.");    theForm.Phone.focus();    return (false);  }  if (theForm.Phone.value.length < 8)  {    alert("Please enter at least 8 characters in the \"Phone\" field.");    theForm.Phone.focus();    return (false);  }  if (theForm.Phone.value.length > 8)  {    alert("Please enter at most 8 characters in the \"Phone\" field.");    theForm.Phone.focus();    return (false);  }  var checkOK = "0123456789-.,";  var checkStr = theForm.Phone.value;  var allValid = true;  var decPoints = 0;  var allNum = "";  for (i = 0;  i < checkStr.length;  i++)  {    ch = checkStr.charAt(i);    for (j = 0;  j < checkOK.length;  j++)      if (ch == checkOK.charAt(j))        break;    if (j == checkOK.length)    {      allValid = false;      break;    }    if (ch == ".")    {      allNum += ".";      decPoints++;    }    else if (ch != ",")      allNum += ch;  }  if (!allValid)  {    alert("Please enter only digit characters in the \"Phone\" field.");    theForm.Phone.focus();    return (false);  }  if (decPoints > 1)  {    alert("Please enter a valid number in the \"Phone\" field.");    theForm.Phone.focus();    return (false);  }  if (theForm.Fax_Area.value == "")  {    alert("Please enter a value for the \"Fax_Area\" field.");    theForm.Fax_Area.focus();    return (false);  }  if (theForm.Fax_Area.value.length < 2)  {    alert("Please enter at least 2 characters in the \"Fax_Area\" field.");    theForm.Fax_Area.focus();    return (false);  }  if (theForm.Fax_Area.value.length > 2)  {    alert("Please enter at most 2 characters in the \"Fax_Area\" field.");    theForm.Fax_Area.focus();    return (false);  }  var checkOK = "0123456789-.";  var checkStr = theForm.Fax_Area.value;  var allValid = true;  var decPoints = 0;  var allNum = "";  for (i = 0;  i < checkStr.length;  i++)  {    ch = checkStr.charAt(i);    for (j = 0;  j < checkOK.length;  j++)      if (ch == checkOK.charAt(j))        break;    if (j == checkOK.length)    {      allValid = false;      break;    }    if (ch == ".")    {      allNum += ".";      decPoints++;    }    else      allNum += ch;  }  if (!allValid)  {    alert("Please enter only digit characters in the \"Fax_Area\" field.");    theForm.Fax_Area.focus();    return (false);  }  if (decPoints > 1)  {    alert("Please enter a valid number in the \"Fax_Area\" field.");    theForm.Fax_Area.focus();    return (false);  }  if (theForm.Fax.value == "")  {    alert("Please enter a value for the \"Fax\" field.");    theForm.Fax.focus();    return (false);  }  if (theForm.Fax.value.length < 8)  {    alert("Please enter at least 8 characters in the \"Fax\" field.");    theForm.Fax.focus();    return (false);  }  if (theForm.Fax.value.length > 8)  {    alert("Please enter at most 8 characters in the \"Fax\" field.");    theForm.Fax.focus();    return (false);  }  var checkOK = "0123456789-.,";  var checkStr = theForm.Fax.value;  var allValid = true;  var decPoints = 0;  var allNum = "";  for (i = 0;  i < checkStr.length;  i++)  {    ch = checkStr.charAt(i);    for (j = 0;  j < checkOK.length;  j++)      if (ch == checkOK.charAt(j))        break;    if (j == checkOK.length)    {      allValid = false;      break;    }    if (ch == ".")    {      allNum += ".";      decPoints++;    }    else if (ch != ",")      allNum += ch;  }  if (!allValid)  {    alert("Please enter only digit characters in the \"Fax\" field.");    theForm.Fax.focus();    return (false);  }  if (decPoints > 1)  {    alert("Please enter a valid number in the \"Fax\" field.");    theForm.Fax.focus();    return (false);  }  return (true);}