 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.ADDRESS.value.length < 1) {
   alert("Please enter your Street Address.");
   document.FORM1.ADDRESS.focus()
   return false;
  }
  if (document.FORM1.SUBURB.value.length < 1) {
   alert("Please provide the City, Suburb or Town that you live in.");
   document.FORM1.SUBURB.focus()
   return false;
  }
  if (document.FORM1.STATE.value.length == 0) {
   alert("Please enter your State/Territory.");
   document.FORM1.STATE.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;
   } else {
     var objRegEx = /^[\w](([_\.-]?[\w]+)*)@([\w]+)(([\.-]?[\w]+)*)\.([A-Za-z]{2,})$/
     if (objRegEx.test(document.FORM1.EMAIL.value) == false) {
     alert("Please check your email address. It is not valid.")
     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) {
   alert("Please answer the 'How did you hear about...' question.")
   document.FORM1.HOW[0].focus()
   return false;
  }

if (document.FORM1.PROPTYPE1.value.length > 0) {
  
  a = document.FORM1.PROPTYPE1.checked
  b = document.FORM1.PROPTYPE2.checked
  c = document.FORM1.PROPTYPE3.checked
  d = document.FORM1.PROPTYPE4.checked
  e = document.FORM1.PROPTYPE5.checked
  f = document.FORM1.PROPTYPE6.checked
  
  if (a || b || c || d || e || f) {
   // continue
  } else {
   alert("Please Choose the types of Houses/Apartments you are interested in.");
   document.FORM1.PROPTYPE1.focus()
   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
  }
 }

