function nuevoAjax(xmlhttp){

   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 CargaAjaxGET(pagina,destino,tipo){

   var ajax; 
 
   var tipo; if(!tipo) { tipo = 1; } //si no es seteada
   var pagina;
   
   var contenedor = document.getElementById(destino);
   

	
	  ajax = nuevoAjax(ajax);
	  ajax.open("GET", pagina, true);
	  ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');

		ajax.onreadystatechange=function() { 
	  		
			if(ajax.readyState != 4)  { 


					if(tipo == 1) {						
					
						contenedor.innerHTML ='Cargando ...';
					} 
					
					if(tipo == 2) { //autocompletar 
					
					//	contenedor.innerHTML = '<img src="img/load_chico.gif"> <span style="font-size:11px; color:#cccccc; font-weight:bold;"> Buscando...</span>';
						contenedor.innerHTML = '<img src="img/icon/load_chico.gif"> Espere unos segundos ...';
					
					}
									
					if(tipo == 3) { //otros
					
					contenedor.innerHTML = '<img src="img/icon/load_chico.gif">';
					
					}
					
					if(tipo == 4) { 
					
					contenedor.innerHTML='<center> <br /><img src="img/icon/search_load.gif"></center>';
					
					}
													
			}
			
			if(ajax.readyState==4) {
				
							var scs=ajax.responseText.extractScript();    //capturamos los scripts
							contenedor.innerHTML=ajax.responseText;
							scs.evalScript();       //ahora si, comenzamos a interpretar todo  
									
			}
	  
	  } //fin onreadystatechange
	  
	  
	  ajax.send(null);
 }




