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;
}

objhttp=getXMLHTTPRequest();

function  gestionaPeticion(file,param,capadiv){
	capa = capadiv;
	x =parseInt(Math.random()*9999999999);
	mensaje="";
	archivo = file+"?x="+x+param; 
	objhttp.open("GET", archivo, true);
	objhttp.send(null);
	objhttp.onreadystatechange=gestionaRespuesta;
}

function gestionaRespuesta(){
	if(objhttp.readyState==4){
		if(objhttp.status==200){
			document.getElementById(capa).innerHTML = objhttp.responseText;
		}
	}else{
		document.getElementById(capa).innerHTML = mensaje;
	}
}
	
	
	
	
function muestra_oculta(id){
	if (document.getElementById){ //se obtiene el id
	var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
	el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
	}
}
	window.onload = function(){/*hace que se cargue la función lo que predetermina que div estará oculto hasta llamar a la función nuevamente*/
	muestra_oculta('contenido_a_mostrar');/* "contenido_a_mostrar" es el nombre que le dimos al DIV */
}
	
	


