
function AJAXConn(sDestino, sCargando)
{
	var xmlhttp, bCompleto = false;
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	try { 
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch (excepcion) { 
		try { 
	     	// Creacion del objeto AJAX para navegadores no IE
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
		catch (excepcion) { 
			try { 
				// Creacion del objet AJAX para IE 
				xmlhttp = new XMLHttpRequest(); 
			}
			catch (excepcion) { 
				xmlhttp = false; 
			}
		}
	}
	if (!xmlhttp) return null;

	this.connect = function(sURL, sMetodo, sVars)	{
		if (!xmlhttp) return false;
		bCompleto = false;
		sMetodo = sMetodo.toUpperCase();

    	try {
      		if (sMetodo == "GET") {
      			sURL = sURL + (sURL.indexOf("?")>0?"&":"?")+ sVars;
		        xmlhttp.open(sMetodo, sURL, true);
        		sVars = "";
      		}
      		else {
      			xmlhttp.open(sMetodo, sURL, true);
        		xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        		//xmlhttp.setRequestHeader("Method", "POST "+sURL);
        		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        		xmlhttp.setRequestHeader('If-Modified-Since', 'Wed, 1 Jan 2003 00:00:00 GMT');
      		}
      		
	  		xmlhttp.onreadystatechange = function(){
				//	Estado del Objeto:    //
				ST_UNINITIALIZED 	= 0;
				ST_LOADING			= 1;
				ST_LOADED			= 2;
				ST_INTERACTIVE		= 3;
				ST_COMPLETE			= 4;


				if (xmlhttp.readyState == ST_COMPLETE && !bCompleto) {
					bCompleto = true;
					if (sDestino!="")
					document.getElementById(sDestino).innerHTML = xmlhttp.responseText; 
				}
			};
			xmlhttp.send(sVars);
		}   
		catch(excepcion) { 
			return false; 
		}
    	return true;
	};
  return this;
}