// ******************************************************************// File: 		libform.js// Language:	JavaScript// Description:	Client-side validation and formatting of form fields.// ******************************************************************// ======================================================// Validation routines.// ======================================================function validateAddress(form) {   if (form.contactAddress.value == "") {      alert("Please enter your street no. and name.");      form.contactAddress.focus();      return false;   }   if (form.contactSuburb.value == "") {      alert("Please enter your suburb/city.");      form.contactSuburb.focus();      return false;   }   if (form.contactPostcode.value == "") {      alert("Please enter your postcode.");      form.contactPostcode.focus();      return false;   }   return true;}function validateEmailAddress(form) {   if (form.email.value == "") {      alert("Please enter your email address.");      form.email.focus();      return false;   }   return true;}// ======================================================// Create address label variable (for admin staff).// ======================================================function createAddrLabel(form) {   // <First name> <Surname>   (Both optional)   // <Street no. and name>   // <SUBURB>  <STATE>  <POSTCODE>  (STATE is optional)   // <COUNTRY> (If not Australia - future use).      if (form.contactAddrLabel == null) return;      var firstName = "", surname = "", address = "", suburb = "", state = "", postcode = "", country = "";      var selectedIndex = 0;      var addressLabel = "\n";      if (form.contactFirstName != null) firstName = form.contactFirstName.value;   if (form.contactSurname != null) surname = form.contactSurname.value;   if (form.contactAddress != null) address = form.contactAddress.value;   if (form.contactSuburb != null) suburb = form.contactSuburb.value;   if (form.contactState != null) state = form.contactState.value;   if (form.contactPostcode != null) postcode = form.contactPostcode.value;   if (form.contactCountry != null) {      selectedIndex = form.contactCountry.options.selectedIndex;      country = form.contactCountry.options[selectedIndex].value;      country = country.toUpperCase();      if (country == "AUSTRALIA") {         if (suburb != "") suburb = suburb.toUpperCase();         if (state != "") state = state.toUpperCase();      }      }      if (firstName != "") addressLabel += firstName + " ";   if (surname != "") addressLabel += surname;   if ((firstName != "") || (surname != "")) addressLabel += "\n";      if (address != "") addressLabel += address + "\n";      if (suburb != "") addressLabel += suburb + "  ";   if (state != "") addressLabel += state + "  ";   if (postcode != "") addressLabel += postcode;   if ((suburb != "") || (state != "") || (postcode != "")) addressLabel += "\n";        if ((country != "") && (country != "AUSTRALIA")) addressLabel += country + "\n";   if (addressLabel == "\n") addressLabel = "none";   return form.contactAddrLabel.value = addressLabel;}// ======================================================// // ======================================================