function envia(url, metodo, modo)
{
    var login = document.getElementById('cadastro').login.value;
    remoto  = new ajax();
    xmlhttp = remoto.enviar(url + "?login=" + login, metodo, modo );
    if(xmlhttp) {
        document.getElementById('login').className = 'erro';
        document.getElementById('alerta').className = 'alerta2';
        document.getElementById("alerta").innerHTML = 'ESSE LOGIN JÁ ESTÁ EM USO!';
    } else {
        document.getElementById('login').className = 'texto';
        document.getElementById('alerta').className = '';
        document.getElementById("alerta").innerHTML = '';
    }    
}

function enviacpf(url, metodo, modo)
{
    var cpf = document.getElementById('cadastro').cpf.value;
    remoto  = new ajax();
    xmlhttp = remoto.enviar(url + "?cpf=" + cpf, metodo, modo );
    if(xmlhttp) {
        document.getElementById('cpf').className = 'erro';
        document.getElementById('alertacpf').className = 'alerta2';
        document.getElementById("alertacpf").innerHTML = 'CPF INVÁLIDO!';
    } else {
        document.getElementById('cpf').className = 'texto';
        document.getElementById('alertacpf').className = '';
        document.getElementById("alertacpf").innerHTML = '';
    }    
}

function enviacnpj(url, metodo, modo)
{
    var cnpj = document.getElementById('cadastro').cnpj.value;
    remoto  = new ajax();
    xmlhttp = remoto.enviar(url + "?cnpj=" + cnpj, metodo, modo );
    if(xmlhttp) {
        document.getElementById('cnpj').className = 'erro';
        document.getElementById('alertacnpj').className = 'alerta2';
        document.getElementById("alertacnpj").innerHTML = 'CNPJ INVÁLIDO!';
    } else {
        document.getElementById('cnpj').className = 'texto';
        document.getElementById('alertacnpj').className = '';
        document.getElementById("alertacnpj").innerHTML = '';
    }    
}
