function formCadastroNoticia(){
    parametros = "funcao=formCadastro";
    enviaPOST("php/noticia.php",parametros,"content","content");
}

function salvarNoticia(){
    parametros = "funcao=salvarNoticia";
    erro="";
    
    if(document.getElementById("tipoNoticia").value=="")
        erro+="Tipo Noticia\n";
    if(document.getElementById("titulo").value=="")
        erro+="Titulo\n";
    if(document.getElementById("texto").value=="")
        erro+="Texto\n";
    if(document.getElementById("fonte").value=="")
        erro+="Fonte\n";
    
    if(erro==""){
        parametros += "&tipoNoticia="+document.getElementById("tipoNoticia").value;
        parametros += "&titulo="+document.getElementById("titulo").value;
        parametros += "&texto="+document.getElementById("texto").value;
        parametros += "&fonte="+document.getElementById("fonte").value;
        parametros += "&txtPk="+document.getElementById("txtPk").value;
        
        //enviaPOST("php/noticia.php",parametros,"content","content");
        enviaPOSTurl("php/noticia.php",parametros,"content","content","php/noticia.php", "funcao=listaNoticia", "content","content"); 
        
    }else{
        alert("todos os campos sao obrigatorios");
    }
    
}

function listaNoticia(){
    parametros = "funcao=listaNoticia";
    enviaPOST("php/noticia.php",parametros,"content","content");
}


function editarNoticia(cdRegistroJS){
    parametros = "funcao=editarNoticia";
    parametros += "&codigo="+cdRegistroJS;
    enviaPOST("php/noticia.php",parametros,"content","content");    
}


function excluirNoticia(codigoJS){
    parametros = "funcao=excluir";
    parametros += "&codigo="+codigoJS;
    
    enviaPOSTurl("php/noticia.php",parametros,"content","content","php/noticia.php", "funcao=listaNoticia", "content","content"); 
}

function carregaNoticiaIndex(pkJ){
    parametros = "funcao=exibePaginaInicial";
    parametros += "&pk="+pkJ;
    enviaPOST("admin/php/noticia.php",parametros,"principal","principal");    
}

