//Crea un objeto XML-http
function getXmlHttpObject() {
	var xmlhttp;
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				try {
					xmlhttp = new XMLHttpRequest();
				}
				catch (e) {
					xmlhttp = false;
					ale>>rt ('Error');
				}
			}
		}
	return xmlhttp;
}

//Porcesar la peticion XMLHttpReuest
function procesarajax(archivo,id,metodo,datos) {
	//Obtener el objeto XMLHttpRequest a utilizar
	xmlhttp = getXmlHttpObject();
	if (metodo=="get") {
		xmlhttp.open("GET",archivo,true);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState==1) {
				document.getElementById(id).innerHTML = "<img src='imagen/cargar.gif' width='17' style='margin-right:5px' /> Cargando ...";
			} else if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				document.getElementById(id).innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null); //Como es GET no mandamos nada en al cuerpo
	} else {
		xmlhttp.open("POST",archivo,true);
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState==1) {
				document.getElementById(id).innerHTML = "<div style='padding:5px 0px 5px 0px;text-align:center'><img src='imagen/cargar.gif' style='margin-right:10px' /> Cargando ...</div>";
			} else if (xmlhttp.readyState==4 && xmlhttp.status==200) {
				document.getElementById(id).innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(datos);
	}
}

function abrir(archivo,w,h,nombre) { 
		var windowprops= "top=0,left=0,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes, resizable=no,width=" + w + ",height=" + h;
	window.open(archivo,nombre,windowprops);
} 