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 actualiza_microposts(idts,idact,cual) {
    var tsf = document.getElementById(idts);
    var ts = tsf.value;
    peticionAjax = '/la_redaccion_transparente/actualiza_microposts.html?ts=' + ts;
    if (cual!=undefined) {
        peticionAjax = peticionAjax + '&w=' + cual;
    }
    // alert(peticionAjax);
    ajax=objetoAjax();
    ajax.open("POST", peticionAjax,true);
    ajax.onreadystatechange=function() {
        if (ajax.readyState==4) {
            var respuesta = ajax.responseText;
            if (respuesta.length > 32 || respuesta !='error') {
              var nts = respuesta.substr(0,32);
              if (nts != ts) {
                var nol = respuesta.substr(32,respuesta.length);
                var actElem = document.getElementById(idact);
                var nlis = nol.replace(actElem.innerHTML,'');
                nlis = nlis.replace('</ol>','');
                nlis = nlis.replace('<ol id="'+idact+'">','');
                actElem.innerHTML = nlis + actElem.innerHTML;
                tsf.value = nts;
              }
            }
        }
    }
    ajax.send(null);
    if (cual!=undefined) {
       setTimeout("actualiza_microposts('"+idts+"','"+idact+"','"+cual+"')", 5000);
    } else {
       setTimeout("actualiza_microposts('"+idts+"','"+idact+"')", 5000);
    }
}

