function formataCNPJ(campo) {
    var valor = "";
    var teste = campo.value;
    for (var i = 1;i<=teste.length;i++) {
        if (!isNaN(teste.charAt(i-1))) {
            valor += teste.charAt(i-1);
            if (valor.length ==2 |valor.length == 6 ) {
                valor += ".";
            }
            if (valor.length == 10) {
                valor += "/";
            }
            if (valor.length == 15) {
                valor += "-";
            }
        }
    }
    campo.value=valor;
}