//Creando el objeto XMLHTTPREQUEST
//Hacer una función genérica es la mejor idea para este modelo. A base de try y catch podemos hacer una función cross-browser:

function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {//alert("XMLHttp creado");
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
//Implemento una función genérica para cargar el contenido de String2 en un elemento como <p Id='String1'>
function cargaContenido(String1,String2){
	var contenedor;
	contenedor = document.getElementById(String1);
	ajax=nuevoAjax();
	ajax.open("GET", String2,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {//alert(ajax.readyState);
			if(ajax.status == 200) {contenedor.innerHTML = ajax.responseText}
		}
	}
	 ajax.send(null)
}
