
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 buscar_multimedia(indice)
	{
		divResultado = document.getElementById('resultado_busqueda'); 
		var buscar = document.getElementById('buscar_media').value;
		var tipo;
		if(document.getElementById('e_imagenes').checked)
		     tipo="imagenes";
		if(document.getElementById('e_videos').checked)
		     tipo="videos";     
		/*if(document.getElementById('e_documentos').checked)
		     tipo="documentos";*/
		if(document.getElementById('e_todos').checked)
		     tipo="all";
		     
		ajax   = objetoAjax();
		ajax.open("GET",'index.php?opcion=com_descarga&ver=descargar&tarea=buscar&buscar='+ buscar + '&tipo=' + tipo + '&indice=' + indice,true);
		
		ajax.onreadystatechange=function() 
		{
		   if (ajax.readyState==4) 
		   {
			divResultado.innerHTML = ajax.responseText
		   }
	         }
		ajax.send(null);
	}
	
	function buscar_portal(indice)
	{
		divResultado = document.getElementById('resultado_busqueda'); 
		var buscar = document.getElementById('buscar').value;
		//alert(buscar)     
		ajax   = objetoAjax();
		ajax.open("GET",'index.php?opcion=com_busqueda&tarea=buscar&buscar='+ buscar + '&indice=' + indice+'&metodo=ajax',true);
		
		ajax.onreadystatechange=function() 
		{
		   if (ajax.readyState==4) 
		   {
  
		        //alert(ajax.responseText);
			divResultado.innerHTML = ajax.responseText
		   }
	         }
		ajax.send(null);
	}
      
      function buscar_estadisticas(indice)
	{
		divResultado = document.getElementById('resultado_busqueda'); 
		var buscar = document.getElementById('buscar').value;
		var idc = document.getElementById('idc').value;
		     
		ajax   = objetoAjax();
		ajax.open("GET",'index.php?opcion=com_indicadores&ver=indicadores&tarea=buscar&buscar='+ buscar + '&indice=' + indice+ '&idc=' + idc,true);
		
		ajax.onreadystatechange=function() 
		{
		   if (ajax.readyState==4) 
		   {
  
		        //alert(ajax.responseText);
			divResultado.innerHTML = ajax.responseText
		   }
	         }
		ajax.send(null);
	}
      
      function getContadorVisitas(c_id_idioma)
      {
        divResultado = document.getElementById('resultado_contador'); 
        
        ajax  = objetoAjax();
        
        ajax.open("GET",'contador.php?c_id_idioma='+c_id_idioma);
        
        ajax.onreadystatechange = function()
        {
    	    if(ajax.readyState==4)
    	    {
    	       
    		divResultado.innerHTML = ajax.responseText
    	    }
        }
	ajax.send(null);
      }
