function checkClearRequestsForm(form) {
  alert("hello");
  return confirm("Are you sure you want to clear this usher's requests?");
}

function checkRemoveAssignmentsForm(form) {

    var ids = form.elements['assignment_ids[]'];
    var checkedCount = 0;

    for (i=0; i < ids.length; i++) {
        if (ids[i].checked) {
            checkedCount++;
        }
    }

    if (checkedCount == 0) {
        return false;
    } else {
        return confirm("Are you sure you want to remove these assignments?");
    }
}

function checkUshersForm(form) {
  var ids = form.elements['actionIds[]'];
  var checkedCount = 0;

  var confirmMsg = "Are you sure you want to make these changes?";
  if (form.mybutton == "enable") {
    confirmMsg = "Are you sure you want to enable the selected ushers?";
  } else if (form.mybutton == "disable") {
    confirmMsg = "Are you sure you want to disable the selected ushers?";
  } else if (form.mybutton == "remove") {
    confirmMsg =
      "Are you sure you want to completely remove\n" +
      "the selected ushers?\n\n\n" +
      "Doing so will remove their assignments,\n"+
      "requests, login account, and will un-couple\n" +
      "them from any partner ushers.\n";
  }

  for (i=0; i < ids.length; i++) {
    if (ids[i].checked) {
      checkedCount++;
    }
  }

  if (checkedCount == 0) {
    alert("You must select one or more ushers");
    return false;
  } else {
    return confirm(confirmMsg);
  }
}

