function CarregaPagina(nomePagina) {
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/carregaPagina.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 1) {
		//	document.getElementById("noticiasResultado").innerHTML = "<object id=\"loading\" name=\"loading\" type=\"text/html\" data=\"html\loading.html\"><\object>";
		}
		if (xmlHttpTmp.readyState == 4) {
			resultado = xmlHttpTmp.responseText.split("<!>");
			document.getElementById("noticiasResultado").innerHTML = resultado[0];
			//document.getElementById("noticiasResultado").innerHTML = "<iframe align=\"center\" border=\"0\" src=\"loading.html\"></iframe>"
			if (resultado[1] == "1") tabdropdown.init(resultado[2] + "Menu","auto");	
			//if (CarregaTool.in_array(nomePagina)) tabdropdown.init("colortab","auto");
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("nomePagina=" + nomePagina);
}
function Buscar(varTexto) {
	if (varTexto == "undefinied") varTexto = "";
	if ((varTexto != "")) varTexto = document.getElementById("texto").value;
	varTexto = unescape(varTexto);
	xmlHttpTmp = GetXmlHttpObject();
	if (varTexto != "") {
		if (!xmlHttpTmp) {
			 alert('Seu browser não é compatível com AJAX!');
			 return false;
		}
		var url="files/busca.php";
		xmlHttpTmp.onreadystatechange=function() {
			if (xmlHttpTmp.readyState == 4) {
				document.getElementById("noticiasResultado").innerHTML = xmlHttpTmp.responseText;
			}
		}
		xmlHttpTmp.open("POST",url,true);
		xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlHttpTmp.send("texto=" + varTexto);
	} else alert("Preencha o campo para a busca!");
}
function AlteraPaginaTmp(nomePagina) {
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/alteraPagina.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 1) {
		//	document.getElementById("noticiasResultado").innerHTML = "<object id=\"loading\" name=\"loading\" type=\"text/html\" data=\"html\loading.html\"><\object>";
		}
		if (xmlHttpTmp.readyState == 4) {
			document.getElementById("noticiasResultado").innerHTML = xmlHttpTmp.responseText;
			//document.getElementById("noticiasResultado").innerHTML = "<iframe align=\"center\" border=\"0\" src=\"loading.html\"></iframe>"
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("nomePagina=" + nomePagina);
}
function AlteraPagina(nomePagina) {
	tmpDiv = document.getElementById("nomeDiv").value;
	if (tmpDiv == "busca") {
		document.getElementById("conteudoBusca").innerHTML+= "<br><br><a class=\"linkPagina\" href=\"javascript: Buscar('" +  document.getElementById("textoBusca").value + "');\">Voltar</a>";
	}
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/alteraPagina.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 1) {
		//	document.getElementById("noticiasResultado").innerHTML = "<object id=\"loading\" name=\"loading\" type=\"text/html\" data=\"html\loading.html\"><\object>";
		}
		if (xmlHttpTmp.readyState == 4) {
			document.getElementById(tmpDiv).innerHTML = xmlHttpTmp.responseText;
			//document.getElementById("noticiasResultado").innerHTML = "<iframe align=\"center\" border=\"0\" src=\"loading.html\"></iframe>"
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("nomePagina=" + nomePagina);
}
function AlteraPaginaJanela(codigoPagina,pagina) {
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/retornoPagina.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 4) {
			//alert(xmlHttpTmp.responseText);
			janelaResultado = window.open(xmlHttpTmp.responseText + "/index.php?pagina=" + codigoPagina);
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("pagina=" + pagina);
}

function MostraConteudo(varPagina,tmpDiv) {
	tmpDiv = document.getElementById("nomeDiv").value;
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/mostraConteudo.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 1) {
		//	document.getElementById("noticiasResultado").innerHTML = "<object id=\"loading\" name=\"loading\" type=\"text/html\" data=\"html\loading.html\"><\object>";
		}
		if (xmlHttpTmp.readyState == 4) {
			document.getElementById(tmpDiv).innerHTML = xmlHttpTmp.responseText;
			//document.getElementById("noticiasResultado").innerHTML = "<iframe align=\"center\" border=\"0\" src=\"loading.html\"></iframe>"
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("codigoPagina=" + varPagina);
}
function MostraNoticiaJanela(codigoNoticia,pagina) {
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/retornoPagina.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 4) {
			//alert(xmlHttpTmp.responseText);
			janelaResultado = window.open(xmlHttpTmp.responseText + "/index.php?codigo=" + codigoNoticia);
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("pagina=" + pagina);
}
function MostraNoticia(codigoNoticia) {
	varPaginaAnt = document.getElementById("paginaAnt").value;
	
	xmlHttpTmp = GetXmlHttpObject();
	if (!xmlHttpTmp) {
		 alert('Seu browser não é compatível com AJAX!');
		 return false;
	}
	var url="files/mostraNoticia.php";
	xmlHttpTmp.onreadystatechange=function() {
		if (xmlHttpTmp.readyState == 1) {
			//document.getElementById("noticiasResultado").innerHTML = "<object id=\"loading\" name=\"loading\" type=\"text/html\" data=\"html\loading.html\"><\object>";
		}
		if (xmlHttpTmp.readyState == 4) {
			document.getElementById("noticiasResultado").innerHTML = xmlHttpTmp.responseText;
			//document.getElementById("noticiasResultado").innerHTML = "<iframe align=\"center\" border=\"0\" src=\"loading.html\"></iframe>"
		}
	}
	xmlHttpTmp.open("POST",url,true);
	xmlHttpTmp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlHttpTmp.send("codigoNoticia=" + codigoNoticia + "&paginaAnt=" + varPaginaAnt);
}
function GetXmlHttpObject(handler) { 
var xmlHttp=null
	if (window.XMLHttpRequest) {
           xmlHttp = new XMLHttpRequest();
           if (xmlHttp.overrideMimeType) {
               xmlHttp.overrideMimeType('text/xml');
           }
       } else if (window.ActiveXObject) {
           try {
               xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
           } catch (e) {
               try {
                   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
               } catch (e) {}
           }
       }
return xmlHttp
}
Array.prototype.in_array = function ( obj ) {
	var len = this.length;
	for ( var x = 0 ; x <= len ; x++ ) {
		if ( this[x] == obj ) return true;
	}
	return false;
}
