function validateSearch() {
  if (document.getElementById('validation'))  {
	if (document.getElementById('validation').value == 'none') {return true;}
  }

  if (isblank('Surname')
  &&  isblank('Service_Type_Id')
  &&  isblank('Service_Category_Id')
  &&  isblank('Special_Interest_Id')
  &&  isblank('Town_Id')
  &&  isblank('Suburb_Id')
  &&  isblank('Event_Type_Id')
  &&  isblank('Subject_Id')
  &&  isblank('Target_Id')
  &&  isblank('Location_Id')
  &&  isblank('Start_Date')
  &&  isblank('Sub_Sector_Id')
  &&  isblank('Period_Type_Id'))  {
    if (!isblank('Province_Id') && document.title == 'Health Facility Search') {return true};
    alert('Please enter or select your Search criteria.');
    document.Form.Province_Id.focus();
    return false;
  }
  if (document.getElementById('Service_Category_Id') && document.getElementById('Service_Type_Id'))  {
    if (document.getElementById('Service_Category_Id').value == 3 && isblank('Service_Type_Id'))  {
      alert('Please select a Speciality.');
      document.Form.Service_Type_Id.focus();
      return false;
    }
  }
  return true;
}
function clearScreen() {
  if (document.getElementById('Surname'))  {
    document.Form.Surname.value = '';
  }
  document.Form.Province_Id.value = 'null';
  refreshTownsAndSuburbs(true);
  document.Form.Town_Id.value = '';
  document.Form.Suburb_Id.value = '';
  document.Form.IFrameSrc.value = '';
  SetIframeSrc();
  if (document.getElementById('Event_Type_Id'))  {
    document.Form.Event_Type_Id.value = 'null';
  }
  if (document.getElementById('Subject_Id'))  {
    document.Form.Subject_Id.value = 'null';
  }
  if (document.getElementById('Target_Id'))  {
    document.Form.Target_Id.value = 'null';
  }
  if (document.getElementById('Location_Id'))  {
    document.Form.Location_Id.value = 'null';
  }
  if (document.getElementById('Start_Date'))  {
    document.Form.Start_Date.value = '';
  }
  if (document.getElementById('Period_Type_Id'))  {
    document.Form.Period_Type_Id.value = 'null';
  }
  if (document.getElementById('Service_Type_Id'))  {
    document.Form.Service_Type_Id.value = 'null';
  }
  if (document.getElementById('Service_Category_Id'))  {
    document.Form.Service_Category_Id.value = 'null';
    setSpecializationVisibility();
  }
  if (document.getElementById('Special_Interest_Id'))  {
    document.Form.Special_Interest_Id.value = 'null';
  }
  if (document.getElementById('Sub_Sector_Id'))  {
    document.Form.Sub_Sector_Id.value = 'null';
  }
  displayDescription();
}
function isblank(s)  {
  
  if (!document.getElementById(s))  {return true};
  var v = document.getElementById(s).value;
  if (v != 'null')  {
    for(var i = 0; i < v.length; i++) {
      var c = v.charAt(i);
      if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
  }
  return true;
}

