
														 
                             				     function buscaNoticias(data, revista, flag){
														//document.getElementById("noticias").style.display= "none";
														ajax = getAJAX();
														ajax.onreadystatechange = function(){
														trataBuscaNoticias(ajax, flag, revista);
														};
														ajax.open("POST","/site-2008b/controller/noticias.php",true);
																ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
														        ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
														        ajax.setRequestHeader("Pragma", "no-cache");
															if(data != ""){
															//alert("action=getNextAndPrevious&data="+data+"&flag="+flag);
																if(data == "first"){
																	ajax.send("action=getNextAndPrevious&revista="+revista);
																}else{
																	ajax.send("action=getNextAndPrevious&data="+data+"&flag="+flag+"&revista="+revista);	
																}
															}else{
															ajax.send(null);
															}
														}
														
														function trataBuscaNoticias(ajax, flag, revista){
														
														if( ajax.readyState == 4 ) {
																if( ajax.status == 200 ){
																	//document.getElementById("noticias").innerHTML = ajax.responseText;
																	xmldoc = false;
														            xmldoc =  ajax.responseXML;
				alert(ajax.responseText);
														            if(xmldoc){
														            document.getElementById("noticias").innerHTML = "";
														            	root = xmldoc.documentElement.childNodes;
														            	data = root[0].childNodes[0].firstChild.nodeValue;
														            	string = "";
														            	for(i=0;i<root.length;i++){
														            		link = root[i].childNodes[1].firstChild.nodeValue;
														            		titulo = root[i].childNodes[2].firstChild.nodeValue;
														            		string += "<a href="+link+">"+titulo+"</a><br><br>";
														            		dataPrevious = root[0].childNodes[0].firstChild.nodeValue;
														            	}
														            	if(i>=12){
														            	string += "<input type='button' onclick='buscaNoticias(document.getElementById(&quot;dataHiddenP&quot;).value,"+revista+", 1)' value='&lt;'>&nbsp;";
														            	string += "<input type='button' onclick='buscaNoticias(document.getElementById(&quot;dataHidden&quot;).value,"+revista+", 2)' value='&gt;'>&nbsp;";
														            	}
																	document.getElementById("noticias").innerHTML = string;
																	if(data != ""){
																	document.getElementById("dataHidden").value = data;
																	}
																	if(dataPrevious != ""){
																	document.getElementById("dataHiddenP").value = dataPrevious;
																	}
																}else{
																 document.getElementById("noticias").innerHTML = "nenhuma not&iacute;cia encontrada";
																}
															}
														}
													}

function testeAjax(){
teste = "2008-10-20";
comp  = "2008-11-07";
tx    = teste.split("-");
tx2   = comp.split("-");

teste1 ="";
comp1 = "";
for(i=0;i<3;i++){
teste1 += tx[i];
comp1  += tx2[i];
}
alert(teste1);
alert(comp1);
teste2 = parseInt(teste1);
comp2  = parseInt(comp1);

	if(teste2 > comp2){ 
		alert("data "+teste+" é maior que "+comp);
	}else{
		if(teste2 < comp2){
		alert("data "+comp+" é maior que "+teste);
		}else{
			alert("datas iguais 2");
		}
	} 
}

function getAJAX() {
try{
	var ajax=new ActiveXObject("Msxml2.XMLHTTP");
	return ajax;
	}catch(e){
		try {
			var ajax=new ActiveXObject("Microsoft.XMLHTTP");
			return ajax;
		}catch(e){
			try {
				var ajax=new XMLHttpRequest();
				return ajax;
			}
			catch(e){
				alert(browserNaoSuportaXMLHttpRequest);	  
			return false;
			}
		}
	}
}  
function preencheCombo(sUrl, sParam, sTag, sCombo, bTodos){
		/*
		Objetivo: Carregar um combobox html(<select>) com informaï¿½ï¿½es
		Dados de entrada:
			- sUrl 		-> Endereï¿½o do arquivo que irï¿½ gerar o XML
			- sParam	-> Parametros a serem enviados para o arquivo de geraï¿½ï¿½o do XML
			- sTag		-> Tag referente ao registro no arquivo html
			- sCombo	-> Nome do combobox a ser preenchido
		Dados de Saï¿½da:
			- Combo Preenchido com o retono do arquivo XML ou uma string "Nenhum" quando nï¿½o achado registros
		
		Funï¿½ï¿½es auxiliares:
			- executaAjax();
		*/
		var ajax = getAJAX();
		var url = sUrl + "?" + sParam;	//alert(url);
		funcao =  function() { executeAjax(ajax,sCombo,sTag, bTodos) }
		ajax.onreadystatechange = eval(funcao);	
		ajax.open("GET",url,true);
		ajax.send(null);
}



function executeAjax(ajax, sCombo, sTag, bTodos){

	combox = document.getElementById(sCombo);
	if( ajax.readyState == 4 ) {
		if( ajax.status == 200 ){
							
				var xmldoc = ajax.responseXML;
				//var doc = ajax.responseText;alert(doc); return false;			
				
				combox.innerHTML	= "---";
				var novo			= document.createElement("option");
				novo.value 			= "";
				novo.text  			= "--- Selecione ---";
				combox.options.add(novo);
				
				if(bTodos){
					var novo			= document.createElement("option");
					novo.value 			= "*";
					novo.text  			= "Todos";
					combox.options.add(novo);
				}
				
				var dataArray = xmldoc.getElementsByTagName(sTag);
				//alert(dataArray.length);
				if(dataArray.length > 0) {
					for(var i = 0 ; i < dataArray.length ; i++) {
						var item 	= dataArray[i];
						var codigo	=  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
						var nome	=  item.getElementsByTagName("nome")[0].firstChild.nodeValue;					
						var novo 	= document.createElement("option");
						novo.setAttribute("id", "opcoes");
						novo.value 	= codigo;
						novo.text  	= nome;
						//document.forms[0].codseq.options.add(novo);
						combox.options.add(novo);
					}
				}else{
					if(idioma.indexOf("pt") >=0)
						combox.innerHTML = "Nenhum";	
					else
						combox.innerHTML = "None";	
						
					var novo = document.createElement("option");
					novo.setAttribute("id", "opcoes");
					novo.value = "-----";
					novo.disable = true;
					if(idioma.indexOf("pt") >=0)
						novo.text  = "Nenhum";
					else
						novo.text = "None";	
					
					//document.forms[0].codseq.options.add(novo);	
					combox.options.add(novo);				
				}
		}
	}else{
			combox.innerHTML = "---";	
			var novo = document.createElement("option");
			novo.setAttribute("id", "opcoes");
			novo.value = codigo;
			novo.disable = 'disabled';
			if(idioma.indexOf("pt") >=0)
				novo.text  = "CARREGANDO";
			else
				novo.text  = "LOADING";
				
			//document.forms[0].codseq.options.add(novo);	
			combox.options.add(novo);		
		}
}

function teste(){
	
}