function createXmlHttpequestObject() {
    var xmlHttp;
    if(window.ActiveXObject) {
        try {
            xmlHttp =new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
            xmlHttp = false;
        }
    } else {
        try {
            xmlHttp = new XMLHttpRequest();
        } catch (e) {
            xmlHttp = false;
        }
    }
    return xmlHttp;
}

function cargaPastilla(viewurl, div_id, div_grupo){
    if (viewurl && div_id) {
        xmlhttp = createXmlHttpequestObject();
        xmlhttp.open("GET", viewurl, true);
        xmlhttp.onreadystatechange = function() { insertarDivPastilla(xmlhttp, viewurl, div_id, div_grupo); };
        xmlhttp.send(null);
    }
}

function insertarDivPastilla(xmlhttp, viewurl, div_id, div_grupo) {
    if (xmlhttp.readyState == 4) { // Complet
        if (xmlhttp.status == 200) { // OK response
            objGestor = document.getElementById(div_grupo);
            var bloque = document.createElement('div');
            bloque.id = div_id;
            bloque.innerHTML = xmlhttp.responseText;
            objGestor.appendChild(bloque);
            load_next();
        }
    }
}
