function antiCacheRand(aurl){
	//Adiciona um parametro randomico à querystring.
	var dt = new Date();
	if(aurl.indexOf("?")>=0){
		// já tem parametros
		return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime());
	}else{ 
		return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());
	}
}

function ajax(url) { 
	req = null; 
	// Procura por um objeto nativo (Mozilla/Safari) 
	if (window.XMLHttpRequest) { 
		req = new XMLHttpRequest(); 
		req.onreadystatechange = processReqChange; 
		url = antiCacheRand(url);
		req.open("GET",url,true); 
		req.send(null); 
	// Procura por uma versão ActiveX (IE) 
	} else if (window.ActiveXObject) { 
		req = new ActiveXObject("Microsoft.XMLHTTP"); 
		if (req) { 
			req.onreadystatechange = processReqChange; 
			req.open("GET",url,true); 
			req.send();
		} 
	} 
} 

function processReqChange() 
{ 
	// apenas quando o estado for "completado" 
	if (req.readyState == 4) { 
		// apenas se o servidor retornar "OK" 
		if (req.status == 200) { 
			// procura pela div id="pagina" e insere o conteudo 
			// retornado nela, como texto HTML 
			document.getElementById('pagina').innerHTML = req.responseText;
			
			var today=new Date();
			var todayd=today.getDate(); 
			var todaym=today.getMonth ()+1;
			var todayy=today.getFullYear()
			
			if (todayd <= 9) { dia = "0" + todayd }
			if (todayd > 9) { dia = todayd  }
			
			if (todaym <= 9) { mes = "0" + todaym }
			if (todaym > 9) { mes = todaym  }
			
			datahj = dia + "/" + mes + "/" + todayy;

			popdate('document.Form.data','pop1','150',document.getElementById('datap').value);			
			
		} else { 
			alert("Houve um problema ao obter os dados:n" + req.statusText); 
		}
		if(req.responseText == false){
			document.getElementById('pagina').innerHTML = "<p align=\"center\">Nenhum evento encontrado !</p>"; 
		}
	}
	else{ 
		document.getElementById('pagina').innerHTML = "<p align=\"center\">carregando...</p>";  
	}
}