// JavaScript Document ////////////////////// function makeRequest(id, lista, objeto, ajax) { var http_request = false; var id = id; var lista = lista; var objeto = objeto; var ajax = ajax; var url = "http://www.rssindicato.com/javascript/"+objeto+".php?id="+id+"&lista="+lista; if (window.XMLHttpRequest) { // Mozilla, Safari, ... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { //alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } http_request.onreadystatechange = function() { // do the thing if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); var xmldoc = http_request.responseXML; var xml_datos = xmldoc.getElementsByTagName('datos').item(0); document.getElementById("relacionadas_"+id).innerHTML=xml_datos.firstChild.data; if(ajax=="ajax") { document.getElementById("boton_"+id).innerHTML='noticias anteriores similares'; } else { document.getElementById("boton_"+id).innerHTML='noticias anteriores similares'; } } else { alert('Ha habido un problema con la solicitud. Inténtalo más tarde'); } } }; //alert(url); http_request.open('GET', url, true); http_request.send(null); } function relacionadas(id,lista) { //var dd = document.getElementById(d); if(id.length < 1) { return; } if(document.getElementById("relacionadas_"+id).innerHTML.length<1) { document.getElementById("relacionadas_"+id).style.marginTop= '15px'; document.getElementById("boton_"+id).innerHTML='noticias anteriores similares'; document.getElementById("relacionadas_"+id).innerHTML='cargando datos...'; makeRequest(id, lista, "relacionadas",""); } else { document.getElementById("relacionadas_"+id).style.marginTop= '0px'; document.getElementById("relacionadas_"+id).innerHTML=""; document.getElementById("boton_"+id).innerHTML='noticias anteriores similares'; } } function relacionadas_ajax(id,lista) { //var dd = document.getElementById(d); var id=id; var lista=lista; if(id.length < 1) { return; } if(document.getElementById("relacionadas_"+id).innerHTML.length<1) { document.getElementById("relacionadas_"+id).style.marginTop= '15px'; document.getElementById("boton_"+id).innerHTML='noticias anteriores similares'; document.getElementById("relacionadas_"+id).innerHTML='cargando datos...'; makeRequest(id, lista, "relacionadas","ajax"); } else { document.getElementById("relacionadas_"+id).style.marginTop= '0px'; document.getElementById("relacionadas_"+id).innerHTML=""; document.getElementById("boton_"+id).innerHTML='noticias anteriores similares'; } } ////////// //////////////////lista function makeRequestLista(id, lista, accion, u) { var http_request = false; var id = id; var lista = lista; var accion = accion; var u = u; var url = "http://www.rssindicato.com/javascript/lista.php?id="+id+"&lista="+lista+"&accion="+accion+"&u="+u; if (window.XMLHttpRequest) { // Mozilla, Safari, ... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { //alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } http_request.onreadystatechange = function() { // do the thing if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); var xmldoc = http_request.responseXML; var xml_datos = xmldoc.getElementsByTagName('datos').item(0); //document.getElementById("lista_"+id).innerHTML=xml_datos.firstChild.data; if (!document.getElementsByTagName) return; var span_listas = document.getElementsByTagName("span"); for (var i=0; i