function validateForm() {
  var error = 0;
  $('input[type=checkbox][required=true]').each(function(){if (! $('input[name=' + $(this).attr('name') + ']:checked').size()){error++}});
  $('input[type=radio][required=true]').each(function(){if (! $('input[name=' + $(this).attr('name') + ']:checked').size()){error++}});  
  $('select[required=true]').each(function(){if(! $(this).val()){error++;}});
  $('input[type=text][required=true]').each(function(){if(! $(this).val()){error++;}});
  $('textarea[required=true]').each(function(){if(! $(this).html()){error++;}});

  if (error) {
    alert('Not all of the required fields were completed.\nPlease check the form before resubmitting.');
    return false;
  }

  return true;
}

