 function checkForm() {
 
 
  if (document.FORM1.FIRSTNAME2.value.length < 1) {
   alert("Please enter your First Name.");
   document.FORM1.FIRSTNAME2.focus()
   return false;
  }
  if (document.FORM1.LASTNAME2.value.length < 1) {
   alert("Please enter your Last Name or Family Name.");
   document.FORM1.LASTNAME2.focus()
   return false;
  }
  if (document.FORM1.STREET2.value.length < 1) {
   alert("Please enter your Street Name.");
   document.FORM1.STREET2.focus()
   return false;
  }
  if (document.FORM1.SUBURB2.value.length < 1) {
   alert("Please provide the Suburb or Town that you live in.");
   document.FORM1.SUBURB2.focus()
   return false;
  }
  if (document.FORM1.POSTCODE2.value.length == 0) {
   alert("Please enter your PostCode/Zip Code.");
   document.FORM1.POSTCODE2.focus()
   return false;
  }
  if (document.FORM1.COUNTRY2.value.length < 1) {
   alert("Please enter the Country you are from.");
   document.FORM1.COUNTRY.focus()
   return false;
  }

  if (document.FORM1.PHONE2.value.length < 1) {
   alert("Please fill in your Phone Number eg. +61 2 9080 8000")
   document.FORM1.PHONE2.focus()
   return false;
  }

  if (document.FORM1.EMAIL2.value.length > 1) {
   if (document.FORM1.EMAIL2.value.indexOf("@") < 1 || document.FORM1.EMAIL2.value.indexOf(" ") != "-1" ){
    alert("Please Fill in the Email address correctly.")
    document.FORM1.EMAIL2.focus()
    return false;
   }
   if (document.FORM1.EMAIL2.value.indexOf(".") < 1 ){
    alert("Please Fill in the Email address correctly.")
    document.FORM1.EMAIL2.focus()
    return false;
   }
  }

  checked = 0
  for (j=0; j < document.FORM1.RET.length; j++) {
   if (document.FORM1.RET[j].checked) {
    checked = 1
   }
  }

  if (checked == 0) {
   alert("Please answer the 'Employment Status' question.")
   document.FORM1.RET[0].focus()
   return false;
  }

  checked = 0
  if (document.FORM1.VILLA2.checked) { checked = 1 }
  if (document.FORM1.VILLA3.checked) { checked = 1 }
  if (document.FORM1.GOLF3.checked) { checked = 1 }
  if (document.FORM1.GOLF4.checked) { checked = 1 }
  if (document.FORM1.BEACH4.checked) { checked = 1 }

  if (checked == 0) {
   alert("Please answer the 'Are you looking for' question.")
   return false;
  }

  checked = 0
  for (j=0; j < document.FORM1.HOW.length; j++) {
   if (document.FORM1.HOW[j].checked) {
    checked = 1
   }
  }

  if (checked == 0) {
   alert("Please answer the 'What prompted you to look at the Mirvac website' question.")
   document.FORM1.HOW[0].focus()
   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.PHONE2)) {
   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.")
  }
 }

