function ajax(pagina, valor, alvo){

	if (window.XMLHttpRequest)
  		{xmlhttp=new XMLHttpRequest();}  // code for IE7+, Firefox, Chrome, Opera, Safari
	else
  		{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}  // code for IE6, IE5
	
	xmlhttp.onreadystatechange=function(){ 
  		if (xmlhttp.readyState==4 && xmlhttp.status==200){
  			document.getElementById(alvo).innerHTML=xmlhttp.responseText;
  		}
  	}
  	
	xmlhttp.open("POST", pagina, true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");	
	xmlhttp.send("q=" + valor);
	
}
