$("#btn_erro_fechar").click(function() {
    $("#mensagem_erro").fadeOut(500);
    return false;
});

function cadastrarNewsletter(baseUrl){
    var new_nome = $("#new_nome").val();
    var new_email = $("#new_email").val();
    $.ajax({
        type: "GET",
        url: baseUrl+"/new/cadastrar",
        data: "new_email="+new_email+"&new_nome="+new_nome,
        success: function(msg){
            exibeErro(window.eval(msg));
        }
    });

}

function cadastrarComentario(Url){
    var id = $("#id_coment").val();
    var nome = $("#nome").val();
    var email = $("#email").val();
    var mensagem = $("#mensagem").val();
		
		

    $.ajax({
        type: "POST",
        url: Url,
        data: "email="+email+"&nome="+nome+"&mensagem="+mensagem+"&id="+id,
        success: function(msg){
            msg = window.eval(msg);
            exibeErro(msg);
						
            if(msg[1]){
                $("#nome").val('');
                $("#email").val('');
                $("#mensagem").val('');
            }
        }
    });
}

function exibeErro(obj){

    switch(obj[1]){
        case 0:
            $classe = "erro_vermelho";
            break;
        case 1:
            $classe = "erro_verde";
            break;
        default:
            $classe = "erro_amarelo";
            break;
    }
    $("#mensagem_erro").hide();
		
    $("body").prepend('<h2 id="mensagem_erro" class="'+$classe+'"><span> '+obj[0]+'</span><a href="#" id="btn_erro_fechar" title="Fechar">X</a></h2>');
		
    $("#btn_erro_fechar").click(function() {
        $("#mensagem_erro").fadeOut(500);
        return false;
    });

}
        
        
    function fontMais(id){
        var obj = document.getElementById(id);
        if (obj.style.fontSize==""){obj.style.fontSize="12px"};
        if (obj.style.fontSize=="10px"){obj.style.fontSize = "12px";}
        else if (obj.style.fontSize=="12px"){obj.style.fontSize = "15px";}
        else if (obj.style.fontSize=="15px"){obj.style.fontSize = "17px";}
        else if (obj.style.fontSize=="17px"){obj.style.fontSize = "19px";}
        else if (obj.style.fontSize=="19px"){obj.style.fontSize = "21px";}
    }
    function fontMenos(id){
        var obj = document.getElementById(id);
        if (obj.style.fontSize==""){obj.style.fontSize="12px"};
        if (obj.style.fontSize=="21px"){obj.style.fontSize = "19px";}
        else if (obj.style.fontSize=="19px"){obj.style.fontSize = "17px";}
        else if (obj.style.fontSize=="17px"){obj.style.fontSize = "15px";}
        else if (obj.style.fontSize=="15px"){obj.style.fontSize = "12px";}
        else if (obj.style.fontSize=="12px"){obj.style.fontSize = "10px";}
    }
