function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}else{
		return new ActiveXObject("Msxml2.XMLHTTP");
		alert('No existe la posibilidad de AJAX');
	}
}
var xmlHttp;


/*Eventos*/

function show(pag){
	var url = "includes/get-eventos.php?pg=" + pag;
	var url2 = "includes/get-libros.php?pg=" + pag;
	xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", url);
	xmlHttp.onreadystatechange = result;
	xmlHttp.send(null);
	xmlHttp2 = createXMLHttpRequest();
		xmlHttp2.open("GET", url2);
	xmlHttp2.onreadystatechange = resultLibros;
	xmlHttp2.send(null);
	}
/*function showEventos(pag){
	var url = "includes/get-eventos.php?pg=" + pag;
	xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", url);
	xmlHttp.onreadystatechange = resultados;
	xmlHttp.send(null);
}*/

function paginateEventos(pag){
	var url = "includes/get-eventos.php?pg=" + pag;
	xmlHttp = createXMLHttpRequest();
	xmlHttp.open("GET", url);
	xmlHttp.onreadystatechange = result;
	xmlHttp.send(null);
}
function result() {
	if (xmlHttp.readyState == 4) {
		document.getElementById("eventos-result").innerHTML = xmlHttp.responseText;
	}
}

/*function showLibros(pag){
	var url = "includes/get-libros.php?pg=" + pag;
	xmlHttp2 = createXMLHttpRequest();
	xmlHttp2.open("GET", url);
	xmlHttp2.onreadystatechange = resultadosLibros;
	xmlHttp2.send(null);
}*/


function paginateLibros(pag){
	var url = "includes/get-libros.php?pg=" + pag;
	xmlHttp2 = createXMLHttpRequest();
	xmlHttp2.open("GET", url);
	xmlHttp2.onreadystatechange = resultLibros;
	xmlHttp2.send(null);
}
function resultLibros() {
	if (xmlHttp2.readyState == 4) {
		document.getElementById("libros-result").innerHTML = xmlHttp2.responseText;
	}
}

