// Some simple javascript validation for the search form
function validate(form) {
  // Either surname or member number has to have input
  var str = document.getElementById('search_form').surname.value;
  if(str=='' && document.getElementById('search_form').member_num.value==''){
    alert('You have to enter either a surname or a member number to search');
    return false;
  }
  // Surname search must have at least 3 characters
  if( str.length > 0
   && str.length < 3 ){
      alert('You have to enter at least 3 letters for surname');
      return false;
  }
  // Check that captcha code has been entered
  if( document.getElementById('search_form').vis_verify_code.value=='' ){
    alert('You have to enter the characters from the image in the input box below it');
    return false;
  }
  return true;
}
function validate_email(form) {
  // There must be an email entered
  if(document.getElementById('write_email').user_email.value==''){
    alert('You have to enter a valid email');
    return false;
  }
  // Check that captcha code has been entered
  if( document.getElementById('write_email').vis_verify_code.value=='' ){
    alert('You have to enter the characters from the image on the right.');
    return false;
  }
  return true;
}
function confirmDelete() {
  var conf = confirm("Are you certain you wish to remove this entry? it is irreversible!");
  if(true == conf){
    return true;
  } else {
    return false;
  }
}