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();

function getHTTP(archivo,vars,divid){
	myRand = parseInt(Math.random()*999999999999999);
	var modurl = archivo +"?rand=" + myRand + vars; 
	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;
			document.getElementById(mydiv).innerHTML = (miTexto);
		}
	} else {
		document.getElementById(mydiv).innerHTML = '<br><br><center><img src="imagenes/cargando.gif"></center>';
	}
}

function getHTTP2(archivo2,vars2,divid2){
	myRand2 = parseInt(Math.random()*999999999999999);
	var modurl2 = archivo2 +"?rand2=" + myRand2 + vars2; 
	http2.open("GET", modurl2, true);
	mydiv2 = divid2;
	http2.onreadystatechange = useHTTP2;
	http2.send(null);
}

function useHTTP2() {
	if (http2.readyState == 4) {
		if(http2.status == 200) {
			var miTexto2 = http2.responseText;
			document.getElementById(mydiv2).innerHTML = (miTexto2);
		}
	} else {
		document.getElementById(mydiv2).innerHTML = '<br><br><center><img src="imagenes/cargando.gif"></center>';
	}
}


function getHTTP3(archivo3,vars3,divid3){
	myRand3 = parseInt(Math.random()*999999999999999);
	var modurl3 = archivo3 +"?rand3=" + myRand3 + vars3; 
	http3.open("GET", modurl3, true);
	mydiv3 = divid3;
	http3.onreadystatechange = useHTTP3;
	http3.send(null);
}

function useHTTP3() {
	if (http3.readyState == 4) {
		if(http3.status == 200) {
			var miTexto3 = http3.responseText;
			document.getElementById(mydiv3).innerHTML = (miTexto3);
		}
	} else {
		document.getElementById(mydiv3).innerHTML = '<br><br><center><img src="imagenes/cargando.gif"></center>';
	}
}

/*
var openWindow= function(id,url,aparameters)
{
	var sparameters='';	
	aDefaultParameters={"width":180,"height":210,"scrollbars":"yes","toolbar":"no","menubar":"no","location":"no","alwaysraised":"yes","modal":"yes","resizable":"no","screenX":200,"screenY":200,"left":400,"top":250,"titlebar":"no","status":"no"};

	for(val in aDefaultParameters)
		if(typeof aparameters[val] == 'undefined')
			sparameters = sparameters + val + "= " + aDefaultParameters[val] + ",";
		else
			sparameters = sparameters + val + "= " + aparameters[val] + ",";

	
	var parameters=sparameters.substring(0,sparameters.length-1);
	var new_window = window.open(url,id,parameters); 
	if (new_window.focus) 
	{new_window.focus();} return false;  
	
}

var openDialog= function(id,url,aparameters)
{
	var sparameters='';	
	aDefaultParameters={"width":180,"height":210,"scrollbars":"auto","toolbar":"no","menubar":"no","location":"no","alwaysraised":"yes","modal":"yes","resizable":"no","screenX":200,"screenY":200,"left":400,"top":250,"titlebar":"no","status":"no"};

	for(val in aDefaultParameters)
		if(typeof aparameters[val] == 'undefined')
			sparameters = sparameters + val + "= " + aDefaultParameters[val] + ",";
		else
			sparameters = sparameters + val + "= " + aparameters[val] + ",";

	
	var parameters=sparameters.substring(0,sparameters.length-1);
	var new_window = window.showModalDialog(url,id,parameters); 	
	
}
*/