function numeros(event){
  if (window.event) {
    // IE
    key = event.keyCode;
  } 
  else if (event.which) {
    // netscape
    key = event.which;
  }
  if (key != 8 || key != 13 || key < 48 || key > 57)
    return (((key > 47) && (key < 58)) || (key == 8 ) || (key == 13));
    return true;
}

function FormataCpf(campo, teclapres)
{
    var tecla = teclapres.keyCode;
    var vr = new String(campo.value);
    vr = vr.replace(".", "");
    vr = vr.replace("/", "");
    vr = vr.replace("-", "");
    tam = vr.length + 1;
    if (tecla != 14)
    {
        if (tam == 4)
            campo.value = vr.substr(0, 3) + '.';
        if (tam == 7)
            campo.value = vr.substr(0, 3) + '.' + vr.substr(3, 6) + '.';
        if (tam == 11)
            campo.value = vr.substr(0, 3) + '.' + vr.substr(3, 3) + '.' + vr.substr(7, 3) + '-' + vr.substr(11, 2);
    }
}
function formatar(src, mask){
  var i = src.value.length;
  var saida = mask.substring(0,1);
  var texto = mask.substring(i)
if (texto.substring(0,1) != saida)
  {
    src.value += texto.substring(0,1);
  }
}
function AlteraData()
{
    var unidade= document.getElementById('unidade_id').value;
    var vestibular_unidade= document.getElementById('vestibular_unidade_id').value;
    $("#data_id").html('<option value="">Carregando datas...</option>');
    $.ajax({ 
        url: '/admin/inscricoes/carregadata/', 
        data: { unidade_id: ""+unidade+"", vestibular_unidade_id: ""+vestibular_unidade+"" }, 
        type: "post", 
        success: function (data) { 
            $('#data_id').html(data);
        } 
     }); 
}
