﻿function validarNumero(e) {    
    
    var tecla = (document.all) ? e.keyCode : e.which; // 2    
    if (tecla == undefined) 
        return false;
    
    if ((tecla>=48 && tecla<=57) || tecla==8 || tecla==0)
        return true;
    else
        return false;
}

var _response;
function validarNUP(url,nup) {
    return 1;
        new Ajax.Request(url, {
            method: 'post',
            asynchronous: true,
            postBody: 'nup=' + nup + '',
            onSuccess: procesaRespuesta,
            onFailure: muestraError

        });

        if (_response == undefined || _response == null) {
            new Ajax.Request(url, {
                method: 'post',
                asynchronous: true,
                postBody: 'nup=' + nup + '',
                onSuccess: procesaRespuesta,
                onFailure: muestraError

            });
        }
    
    if (_response.toLowerCase().indexOf('false')==-1)
        _response = 1;
    else
        _response = 0;

    return _response;
}

function procesaRespuesta(respuesta) {
    var xml = respuesta.responseText;
    _response = xml;
}

function muestraError(respuesta) {
    alert('Ocurrio un error al ejecutar la petición al servidor.');
}
