Utiltity function for turning on/off various elements
function toggles(documents_form, show_json, show_file, show_doc, doc_text, show_wizard) {
  var json_only = $('#json-only');
  var the_document = $('#document', documents_form);
  if (show_doc) {
    //console.log("doc: " + doc_text);
    the_document.val(doc_text);
    the_document.show();
  } else {
    the_document.hide();
  }
  if (show_json) {
    json_only.show();
  } else {
    json_only.hide();
  }
  var file_upload = $('#file-upload', documents_form);
  var upload_only = $('#upload-only', documents_form);
  if (show_file) {
    file_upload.show();
    upload_only.show();
  } else {
    file_upload.hide();
    upload_only.hide();
  }
  var wizard = $('#wizard', documents_form);
  if (show_wizard) {
    wizard.show();
  } else {
    wizard.hide();
  }
}