
function XMLHTTPRequest() { 
	var http = 0;
	if (window.XMLHttpRequest) {
		http = new XMLHttpRequest();
	} else {
		try { 
			http = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try { 
			http = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) { 
				http = false; 
			} 
		}
	} 
	return http; 
}

function ajax(url, div) {
	
	var http = XMLHTTPRequest();
	if (http) {
	
		http.onreadystatechange = function() {
			
			/*if(http.readyState == 1 )
					document.getElementById(div).innerHTML = "<div align='center' style='width:460px;><img align='absmiddle' src='images/progressbar.gif' border='0'></div>";
				//document.getElementById(div).innerHTML = "Carregando...";*/
			
			if (http.readyState == 4) {
				if (http.status == 200) {
					var retorno = unescape(http.responseText.replace(/\+/g, " "));
						document.getElementById(div).innerHTML = retorno;	
				} else {
					//alert('There was a problem with the request.');
				}
			}		
		}
		http.open('GET', url, true);
		http.send(null);
	}
	else {
		//alert('Erro seu navegador nao suporta ajax');
	}
}	

