function ajax(url) 
{ 
	req = null; 
	// Procura por um objeto nativo (Mozilla/Safari) 
	if (window.XMLHttpRequest) { 
		req = new XMLHttpRequest(); 
		req.onreadystatechange = processReqChange; 
		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('fotos').innerHTML = req.responseText; 
		} else { 
			alert("Houve um problema ao obter os dados:n" + req.statusText); 
		} 
	} 
}

function ajax_url( url , local_conteudo ) {
	function createXMLHttpRequest()
	{
		try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}
		try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}
		try{ return new XMLHttpRequest(); }catch(e){}
		alert("XMLHttpRequest não é suportado!");
		return null;
	}
	var xhReq = createXMLHttpRequest();
	xhReq.open("get",url,true);
	xhReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhReq.onreadystatechange = function do_readyStateChange(to) {
		if (xhReq.readyState == 4)
		{
			document.getElementById(local_conteudo).innerHTML = xhReq.responseText;
		}
		else
		{
			document.getElementById(local_conteudo).innerHTML = '<div id="carregando">Carregando...</div>';
		}
	}
	xhReq.send("&ajaxr=true");
}
