﻿function Ajax(){
	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') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function OrdenarPor(campo, orden , pagina, modulo, filtro){
	//especificamos en div donde se mostrará el resultado
	divListado = document.getElementById(modulo);
	
	ajax=Ajax();
	//especificamos el archivo que realizará el listado
	//y enviamos las dos variables: campo y orden
	var currentTime = new Date();
	var segundos = currentTime.getSeconds();
	
	urls = modulo + "_lis.php?campo="+campo+"&orden="+orden+"&pagina="+pagina+"&filtro="+filtro+"&time="+segundos;
	ajax.open("GET", urls);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divListado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function OrdenarPor2(campo, orden , pagina, modulo, filtro){
	//especificamos en div donde se mostrará el resultado
	divListado = document.getElementById(modulo);
	
	ajax=Ajax();
	//especificamos el archivo que realizará el listado
	//y enviamos las dos variables: campo y orden
	var currentTime = new Date();
	var segundos = currentTime.getSeconds();
	
	urls = modulo + "lis.php?campo="+campo+"&orden="+orden+"&pagina="+pagina+"&filtro="+filtro+"&time="+segundos;
	ajax.open("GET", urls);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divListado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}
