function getXMLHTTPRequest() {
var req;
try {
	req = new XMLHttpRequest();
} catch(err1) {
	try {
		req = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (err2) {
		try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err3) {
				req = false;
			}
		}
	}
	return req;
}

http = getXMLHTTPRequest();

function getHTTP(archivo,vars,divid){
	myRand = parseInt(Math.random()*999999999999999);
	var modurl = archivo +"?rand=" + myRand + vars; 
	//alert(modurl);
	http.open("GET", modurl, true);
	mydiv = divid;
	http.onreadystatechange = useHTTP;
	http.send(null);
}

function useHTTP() {
	if (http.readyState == 4) {
		if(http.status == 200) {
			var miTexto = http.responseText;
			//alert(miTexto);
			document.getElementById(mydiv).innerHTML = (miTexto);
			//replaceHtml(mydiv, miTexto)
		}
	} else {
		document.getElementById(mydiv).innerHTML = '<img src=loading.gif>';
	}
}

