var conexion1;
var resultado;
function votar(id,cod,resul,accion) 
{
  resultado=resul;
  conexion1=crearXMLHttpRequest();
  conexion1.onreadystatechange = procesarEventos;
  var aleatorio=Math.random();
  conexion1.open('GET','includes/procesarvoto.php?cod='+cod+"&aleatorio="+aleatorio+"&acc="+accion+"&idficha="+id, true);
  conexion1.send(null);
}
function favorito(idusuario,idficha,resul,accion) 
{
  resultado=resul;
  conexion1=crearXMLHttpRequest();
  conexion1.onreadystatechange = procesarEventos;
  var aleatorio=Math.random();
  conexion1.open('GET','includes/procesarfavorito.php?idusuario='+idusuario+"&acc="+accion+"&idficha="+idficha+"&resul="+resul, true);
  conexion1.send(null);
}

function procesarEventos()
{
  var resultados = document.getElementById(resultado);
  if(conexion1.readyState == 4)
  {
    resultados.innerHTML = conexion1.responseText;
  } 
  else 
  {
    resultados.innerHTML = 'Proc...';
  }
}

function crearXMLHttpRequest() 
{
  var xmlHttp=null;
  if (window.ActiveXObject) 
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else 
    if (window.XMLHttpRequest) 
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}


