function nuevoAjax()
{
   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 eliminar_foto(foto,id,numero,seccion)
{
	imagen_asociada = document.getElementById('imagen_asociada');
	ajax=nuevoAjax();
	ajax.open("POST", "../eliminar_foto.php",true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("foto="+foto+"&id="+id+"&seccion="+seccion+"&numero="+numero);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
	    	imagen_asociada.innerHTML = ajax.responseText;
		} else {
			imagen_asociada.innerHTML = '<img src="../images/loading.gif" align="middle" /> Borrando imagen...';
		}
	}
}

function eliminar_foto_socio(foto,id,seccion)
{
	imagen_asociada = document.getElementById('imagen_asociada');
	ajax=nuevoAjax();
	ajax.open("POST", "../eliminar_foto.php",true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("foto="+foto+"&id="+id+"&seccion="+seccion);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
	    	imagen_asociada.innerHTML = ajax.responseText;
		} else {
			imagen_asociada.innerHTML = '<img src="../images/loading.gif" align="middle" /> Borrando imagen...';
		}
	}
}

function refresca_lista_socios(tipo_socio)
{
	lista_socios = document.getElementById('lista_socios');
	ajax=nuevoAjax();
	ajax.open("POST", "socios_lista.php",true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo_socio="+tipo_socio.value);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
	    	lista_socios.innerHTML = ajax.responseText;
		} else {
			lista_socios.innerHTML = '<img src="../../images/loading.gif" align="middle" /> Cargando lista de socios...';
		}
	}
}


