////// Gabriel S. Reis - 15/06/2009 \\\\\\

var xmlhttp

function ajax(url,str)
	{xmlhttp=GetXmlHttpObject();
	 if (xmlhttp==null) {alert("Seu navegador nao suporta AJAX!"); return;}

	 url=url+"?q="+str;
	 url=url+"&amp;sid="+Math.random();

	 xmlhttp.onreadystatechange=stateChanged;
	 xmlhttp.open("GET",url,true);
	 xmlhttp.send(null);
	}

function GetXmlHttpObject()
	{if (window.XMLHttpRequest)	// IE7+, Firefox, Chrome, Opera, Safari
		{return new XMLHttpRequest();}
	 else if (window.ActiveXObject)	// IE6, IE5
		{return new ActiveXObject("Microsoft.XMLHTTP");}
	 else
		{return null;}
	}

function stateChanged()
	{if (xmlhttp.readyState==1 || xmlhttp.readyState=="loading")
		{document.getElementById("resultado").style.visibility="visible";
		 document.getElementById("resultado").innerHTML="Carregando...";
		}
	 else if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete")
		{document.getElementById("resultado").style.visibility="visible";
		 document.getElementById("resultado").innerHTML=xmlhttp.responseText;
		}
	}

function CloseResult(div1,div2)
	{document.getElementById(div1).style.visibility='hidden';
	 document.getElementById(div2).value='';
	}