function checkUncheckAll(theElement) {
  var theForm = theElement.form, z = 0;
  for(z=0; z<theForm.length;z++){
    if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
      theForm[z].checked = theElement.checked;
    }
  }
}

function disableAllSubmitButtons() {
  var l = document.getElementsByTagName("form");
  for(i = 0; i < l.length; i++) { // for each form obj
    for(j = 0; j < l[i].length; j++) {
      m = l[i][j];
      if(m.getAttribute('type') == 'submit') {
        m.disabled = true;
      }
    }
  }
}

function backendSubmitButton(button) {
  button.value = 'Aguarde...';
  // Nao funciona no Safari nem no Opera. Testar.
  // disableAllSubmitButtons();
  return true;
}

function undoBackendSubmitButton(button) {
  button.value = 'Gravar';
  this.disabled = false;
  return true;
}
