var timeoutHandle;
function toast(message, type = 0) {
    var x = document.getElementById("toast");
    if(timeoutHandle){
        clearTimeout(timeoutHandle);
        timeoutHandle = null;
    }
    x.innerHTML = message;
    if(type == 0)
    	x.className = "show";
    else if(type == 1)
    	x.className = "show green";
    else
    	x.className = "show red";
    timeoutHandle = setTimeout(function(){ x.className = x.className.replace("show", "").replace("green", "").replace("red", ""); }, 3000);
}

function toast_sucesso(message){
	toast(message, 1);
}

function toast_erro(message){
	toast(message, 2);
}