function eNumero(e) {
var keyChar

  keyChar = event.keyCode
  if (keyChar >= 45 && keyChar <= 57) {
    return true
  } else {
    return false
  }
}

function escolheValorSelect(combo, valor) {
var lCnt;

  for (lCnt = 0; lCnt < combo.options.length; lCnt++) {
    if (combo.options(lCnt).value == valor) {
        combo.selectedIndex = lCnt
        return true;
    }
  }
}

function escolheValorSelectMulti(combo, valor) {
var lCnt;

  for (lCnt = 0; lCnt < combo.options.length; lCnt++) {
    if (combo.options(lCnt).value == valor) {
        combo.options(lCnt).selected = true;
        return true;
    }
  }
}

function escolheValorSelectTexto(combo, valor) {
var lCnt;

  for (lCnt = 0; lCnt < combo.options.length; lCnt++) {
    if (combo.options(lCnt).value.toUpperCase() == valor.toUpperCase()) {
        combo.selectedIndex = lCnt
        return true;
    }
  }
}

function validaValorCampo(campo, mensagem) {
  if (campo.value.length == 0) {
    alert(mensagem);
    campo.focus();
    return false;
  }
  return true;
}

function validaData(campo, obriga) {
  if (campo.value.length > 0) {
    if (isNaN(Date.parse(campo.value))) {
      alert("Data inválida!");
      campo.focus();
      return false;
    }
  } else {
    if (obriga) {
      alert("Indique a data!");
      campo.focus();
      return false;      
    }
  }
  return true;
}