// globale Instanz von XMLHttpRequest
var xmlHttp = false;

// XMLHttpRequest-Instanz erstellen
// ... für Internet Explorer
try {
    xmlHttpy  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttpy  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttpy  = false;
    }
}
// ... für Mozilla, Opera und Safari
if (!xmlHttpy  && typeof XMLHttpRequest != 'undefined') {
    xmlHttpy = new XMLHttpRequest();
}

// aktuelle Daten laden
loadradioData();

// alle 30 Sekunden neue Daten holen
setInterval("loadradioData()",30000);

function loadradioData()
{
 if (xmlHttpy) {
     xmlHttpy.open('GET', 'radiostats.php', true);
     xmlHttpy.onreadystatechange = function () {
         if (xmlHttpy.readyState == 4) {
             document.getElementById("radio_stats").innerHTML = xmlHttpy.responseText;
         }
     };
     xmlHttpy.send(null);
 }
}

