 function checkForm() {

  if (document.FORM1.FIRSTNAME.value.length < 1) {
   alert("Please enter your First Name.");
   document.FORM1.FIRSTNAME.focus()
   return false;
  }
  if (document.FORM1.LASTNAME.value.length < 1) {
   alert("Please enter your Last Name or Family Name.");
   document.FORM1.LASTNAME.focus()
   return false;
  }
  if (document.FORM1.STREET.value.length < 1) {
   alert("Please enter your Street Name.");
   document.FORM1.STREET.focus()
   return false;
  }
  if (document.FORM1.SUBURB.value.length < 1) {
   alert("Please provide the Suburb or Town that you live in.");
   document.FORM1.SUBURB.focus()
   return false;
  }
  if (document.FORM1.POSTCODE.value.length == 0) {
   alert("Please enter your PostCode/Zip Code.");
   document.FORM1.POSTCODE.focus()
   return false;
  }
  if (document.FORM1.COUNTRY.value.length < 1) {
   alert("Please enter the Country you are from.");
   document.FORM1.COUNTRY.focus()
   return false;
  }

  if (document.FORM1.PHONE.value.length < 1) {
   alert("Please fill in your Phone Number eg. +61 2 9080 8000")
   document.FORM1.PHONE.focus()
   return false;
  }

  if (document.FORM1.EMAIL.value.length < 1) {
   alert("Please enter your email address.")
   document.FORM1.EMAIL.focus()
   return false;
  }

  if (document.FORM1.EMAIL.value.length > 0) {
   var objRegEx = /^[\w](([_\.-]?[\w]+)*)@([\w]+)(([\.-]?[\w]+)*)\.([A-Za-z]{2,})$/
   if (objRegEx.test(document.FORM1.EMAIL.value) == false) {
    alert("Please check your email address. If the problem continues just leave the email field empty.")
    document.FORM1.EMAIL.focus()
    return false;
   }
  }

  checked = 0
  for (j=0; j < document.FORM1.HOW.length; j++) {
   if (document.FORM1.HOW[j].checked) {
    checked = 1
   }
  }
  if (checked == 0 && document.FORM1.OTHER.value.length == 0 && document.FORM1.NEWSPAPER.value.length == 0 ) {
   alert("Please answer the 'What prompted you to look at the Mirvac website' question.")
   return false;
  }
  if (checked == 1 && document.FORM1.OTHER.value.length > 0) {
   alert("Please on the 'What prompted you to look at the Mirvac website?' could we have just 1 answer.")
   return false;
  }
  if (checked == 1 && document.FORM1.NEWSPAPER.value.length > 0) {
     alert("Please on the 'What prompted you to look at the Mirvac website?' could we have just 1 answer.")
     return false;
  }

  checked = 0
  for (j=0; j < document.FORM1.AGE.length; j++) {
   if (document.FORM1.AGE[j].checked) {
    checked = 1
   }
  }
  if (checked == 0) {
   alert("Please answer the 'Your Age Group' question.")
   return false;
  }

  return true;
 }

 function hasValue(obj) {
  if (obj.value.length == 0)
   return false;
  else {
   if (obj.value.length < 15) { return false; }
   for (i=0; i<obj.value.length; i++) {
    if (i == "0") {
     if (obj.value.charAt(i) != "+") { return false }
    }
    else if (i == "3") {
     if (obj.value.charAt(i) != " ") { return false }
    }
    else if (i == "5") {
     if (obj.value.charAt(i) != " ") { return false }
    }
    else if (i == "10") {
     if (obj.value.charAt(i) != " ") { return false }
    }
    else {
     if (obj.value.charAt(i) < "0") { return false }
     if (obj.value.charAt(i) > "9") { return false }
    }
   }
   return true;
  }
 }

 function myPhoneCheck() {
  if (!hasValue(document.FORM1.PHONE)) {
   alert("- Please Fill in Tel. eg.+61 2 9080 8000 \n- Where '+61' is the country code, \n  '+61' is Australia. \n- Where '2' is the STD code (Area Code) \n\n If you feel the number entered is correct PLEASE CONTINUE ON.")
  }
 }

 function unCheck() {
  for (j=0; j < document.FORM1.HOW.length; j++) {
   document.FORM1.HOW[j].checked = false
  }
 }

