function loadNoticiaCompleta() {
	getXMLHttpRequest("post", "/Ofm_Imprensa/ServletNoticia?acao=consultaCompleta&paginacao="+paginacao, true, "populaNoticiaCompleta");
}

function populaNoticiaCompleta() {
	if (req.readyState==4) {
		if (req.status==200) {
		    var resposta = req.responseText;
		    var arrResposta = resposta.split(';');
		    limpaTabela(document.getElementById("tbNoticia"));
			var vTbody = document.createElement("TBODY");
			vTbody.id = "tbodyX1308";
			for (var i=0;i<arrResposta.length-1 ;i++) {
				var JsonNoticia = eval('(' + arrResposta[i] + ')');		    
				var tabela = document.getElementById("tbNoticia"	);
				var vTr = document.createElement("TR");
				var vTd1 = document.createElement("TD");
				var strong = document.createElement("STRONG");
				var linkNoticia = document.createElement("A");
				linkNoticia.href = "javascript:loadVisualizarNoticia('"+JsonNoticia.cdNoticia+"')";
				strong.appendChild(document.createTextNode(JsonNoticia.titulo));
				
				linkNoticia.appendChild(strong);
				vTd1.appendChild(linkNoticia);
				vTd1.appendChild(document.createElement("BR"));
				vItalic = document.createElement("I");
				vItalic.appendChild(document.createTextNode("("+JsonNoticia.data+")"));
				vTd1.appendChild(vItalic);
				
				var vTr2 = document.createElement("TR");
				var vTd2 = document.createElement("TD");
				var imgBarra = document.createElement("IMG");
				imgBarra.src = "imgs/passa.gif";
				vTd2.width = "100%";
				imgBarra.width = "415";
				imgBarra.height = "1";

				vTd2.appendChild(imgBarra);
				vTr2.appendChild(vTd2);
			
				vTr.appendChild(vTd1);
				vTbody.appendChild(vTr);
				vTbody.appendChild(vTr2);
				tabela.appendChild(vTbody);
				
				if (paginacao == 0) {
						estadoBotoes("inicio");
					} else {
						estadoBotoes("on");
					}
			}	
			
			if (resposta == "false")	 {
				estadoBotoes("fim","loadNoticia()");
			}
			
			carregando(req.readyState);
		}
		
	} else if (req.readyState==1){
		carregando(req.readyState);
	}
}

function loadVisualizarNoticia(cod) {
	getXMLHttpRequest("post", "/Ofm_Imprensa/ServletNoticia?acao=selecionar&cdNoticia="+cod, true, "VisualizarNoticia");
}

function VisualizarNoticia() {
	if (req.readyState==4) {
		if (req.status==200) {
		    var resposta = req.responseText;
	        if (resposta == "true") {
	        	window.location = "/Ofm_Imprensa/visualizarnoticias.jsp";
	        } else {
	        	erro_ok("A notícia não pode ser visualizada, se o erro persistir informe ao administrador do Sistema.");
	        }   
		}	
		carregando(req.readyState);
	} else if (req.readyState==1){
		carregando(req.readyState);
	}
}