(function () {

  function submitSurvey (form) { 
      $.post($(form).attr('action'), $("#survey-form").serialize(), displaySurveyReply, "html");
  }
  
  function displaySurveyReply (data, textStatus) {
    $('#survey').empty().append($('<p>').append(data));
  }

/*  function enableDisableSubmission () {
    if (this.value) {
      $('#survey-submit').removeAttr('disabled');
    } else {
      $('#survey-submit').attr('disabled', 'disabled');
    }
  }
  */
  function hideShowSupportHow () {
    $('#how').css('display', this.checked ? 'block' : 'none');
    if (this.checked) $('#survey-how').focus();
  }

  $(document).ready(function () {
    //$('#survey-email').change(enableDisableSubmission);
    $('#survey-form').submit(function() { submitSurvey(this); return false; });
    $('#survey-supporting').click(hideShowSupportHow);
  });
  
}());

