var mod_online = 0; var timestamp = 0; var modbox = 0; var actsong = ""; function ajax_radio() { try { req = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { //Kein AJAX Support } req.onreadystatechange = function() { if ((req.readyState == 4) && (req.status == 200)) { var feedback = req.responseText; var update = new Array(); var Now = new Date(); update = feedback.split('||'); if(modbox == 1) { document.getElementById('upntradio').innerHTML = update[2]+'('+update[3]+') von '+update[5]+' Peak ('+update[6]+')'; } else { if(update[0] == 'new' && update[1] != ' ' ) { actsong = update[1]; var mytikker = document.getElementById('akttitle'); mytikker.stopAt = actsong.length * 13; mytikker.innerHTML = actsong; //document.getElementById('debugger').innerHTML += Now.toLocaleString() + ': Bild aktualisiert
'; if(mod_online == 1) { document.getElementById('onairbox').src = path + 'style/radio/RadioOn.gif'; } else { if(update[4] == '1') { document.getElementById('onairbox').src = path + 'img/Bilder/onair_on.gif'; } else { document.getElementById('onairbox').src = path + 'img/Bilder/onair_off.gif'; } } } else { //document.getElementById('debugger').innerHTML += Now.toLocaleString() + ': Kein Update verfügbar
'; } } //Rekursiv jede Sekunde aufrufen und auf Statusaenderung reagieren if(modbox == 1) { setTimeout("ajax_radio()", 5000); } else { setTimeout("ajax_radio()", 30000); } } else { //document.getElementById('radiostatusimg').src = path + 'img/Bilder/onair_off.gif'; } } req.open('get', 'http://www.radiotalks.de/ajax/radiostatus.php?actsong='+actsong); //alert('status.php?actsong='+actsong); req.setRequestHeader("Pragma","no-cache"); req.setRequestHeader("Cache-Control","must-revalidate"); //req.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT"); req.send(null); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(function() { ajax_radio(); })