function objetoAjax(){
        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 mostrarDatos(url, datos ,capa, strError){
        divResultado = document.getElementById(capa);
        ajax=objetoAjax();
        ajax.open("GET", url+"?"+datos, true);
        ajax.onreadystatechange=function() {
               if (ajax.readyState==4) {
                   divResultado.innerHTML = ajax.responseText;
               }
			   else {
				   divResultado.innerHTML = strError;
			   }
        }
        ajax.send(null);
}

function obtenerDatos(url, datos, strError) {
	ajax = objetoAjax();
	ajax.open("GET",url+"?"+datos, false);
	ajax.send(null);
	if(ajax.status==200) {
		respuesta = ajax.responseText;
	}
	else {
		respuesta = strError;
	}
	return respuesta;
}


