﻿function getHTTPObject() {
    var obj;
    if (window.XMLHttpRequest) { // no es IE 
        obj = new XMLHttpRequest();
    } else { // Es IE o no tiene el objeto 
        try {
            obj = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e) {
            alert('El navegador utilizado no está soportado');
        }
    }
    return obj;
}

var http = getHTTPObject();

function getcomentarios(id, index, programa ){

var sitio = document.getElementById("hidenminisitio").value ;
document.getElementById("dvhidenlistacomentario").innerHTML = "";
document.getElementById("dvhidenlistacomentario").style.backgroundImage = "url(../../images/loading.gif)";
document.getElementById("dvhidenlistacomentario").style.backgroundRepeat = "no-repeat";
document.getElementById("dvhidenlistacomentario").style.backgroundPosition = "center";

var r = "/home/"+programa+"/blog/leer_comentarios";
cert_registerHit(25559, r);



var url = "../../ajax/comentarios_blog.ashx?id="+id+"&index="+index+"&sitio="+sitio;

http.open("POST", url, true);



http.onreadystatechange = setcomentarios;
http.send(null);
}


function  setcomentarios(){
if (http.readyState == 4) {
        if (http.status == 200) {
           var xmlDocument = http.responseXML;
           var i ;
           var j;
           var total = xmlDocument.getElementsByTagName("comentario").length;
           
           var nodo = "";
           var texto = "";
           var top = "";
           var bottom = "";
           
           
           
           /*galeria*/
           for (i=0;i<total;i++)
            {
                nodo = xmlDocument.getElementsByTagName("comentario")[i];  
                top = xmlDocument.getElementsByTagName("top")[0].childNodes[0].nodeValue;              
                bottom = xmlDocument.getElementsByTagName("bottom")[0].childNodes[0].nodeValue;
                if (nodo.childNodes[0] != undefined ){  
                             
                texto += nodo.childNodes[0].nodeValue;                
                }
            }

            document.getElementById('dvhidenlistacomentario').innerHTML = top + texto + bottom;
            document.getElementById("dvhidenlistacomentario").style.backgroundImage = "none";
          
            /*galeria*/
           
          
           
           
           
           }
           }
}