//***********  Client-side form validation.  ****************

//enews form.
function submitForm_enews(InForm) {

  if (InForm.name) {
    if (InForm.name.value == "") {
      alert("Please enter your name.")
      InForm.name.focus()
      InForm.name.select()
      return false
    } 
  }

  if (InForm.email) {
    if (InForm.email.value == "") {
      alert("Please enter your e-mail address.")
      InForm.email.focus()
      InForm.email.select()
      return false
    } 
  }

  //Regular Expression for e-mail syntax validation.
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test (InForm.email.value)) {
    alert("Not a valid e-mail address format.")
    InForm.email.focus()
    InForm.email.select()
    return false; 
  }

  return true
}

//Contact Us form.
function submitForm_contact(InForm) {

  if (InForm.name) {
    if (InForm.name.value == "") {
      alert("Please enter your name.")
      InForm.name.focus()
      InForm.name.select()
      return false
    } 
  }

  if (InForm.email) {
    if (InForm.email.value == "") {
      alert("Please enter your e-mail address.")
      InForm.email.focus()
      InForm.email.select()
      return false
    } 
  }

  //Regular Expression for e-mail syntax validation.
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test (InForm.email.value)) {
    alert("Not a valid e-mail address format.")
    InForm.email.focus()
    InForm.email.select()
    return false; 
  }

  if (InForm.subject.value == "") {
    alert("Please enter the subject of your message.")
    InForm.subject.focus()
    InForm.subject.select()
    return false
  } 

  if (InForm.message.value == "") {
    alert("Please enter your message.")
    InForm.message.focus()
    InForm.message.select()
    return false
  } 

  return true
}
