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();
http2 = getXMLHTTPRequest();
http3 = getXMLHTTPRequest();

function procesarAjax(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 = respuestaAjax;
	http.send(null);
}


function respuestaAjax() {
	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=imagenes/wait.gif>';
	}
	
}

function procesarAjax2(archivo2,vars2,divid2){
	myRand2 = parseInt(Math.random()*999999999999999);
	var modurl2 = archivo2 +"?rand2=" + myRand2 + vars2; 
	http2.open("GET", modurl2, true);
	mydiv2 = divid2;
	http2.onreadystatechange = respuestaAjax2;
	http2.send(null);
}

function respuestaAjax2() {
	if (http2.readyState == 4) {
		if(http2.status == 200) {
			var miTexto2 = http2.responseText;
			document.getElementById(mydiv2).innerHTML = (miTexto2);
		}
	} else {
		document.getElementById(mydiv2).innerHTML = '<img src=imagenes/wait.gif>';
	}
}

