/* <![CDATA[ */

// eventuell muss dieses Installationsverzeichnis konfiguriert werden.
domain = document.domain;
install = "http://" + domain + "/chat";

// zuerst der AJAX Teil:
// http://aleembawany.com/2005/09/01/ajax-instant-tutorial/
function loadurl(dest) {
        try {
                xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e) { /* do nothing */ }

        xmlhttp.onreadystatechange = triggered;
        xmlhttp.open("GET", dest);
        xmlhttp.send(null);
}

function triggered() {
         if (xmlhttp.readyState == 4) document.getElementById("output").innerHTML =xmlhttp.responseText;
}


// und jetzt auto-refresh und sounds:
old_x = 1000;

function playsound(typ) { // die standardkonforme Lösung für alle Browser
	 document.getElementById("ton").innerHTML = '<object data="'+typ+'" type="application/x-shockwave-flash" width="0" height="0"><param name="movie" value="'+typ+'" /></object>';
}

function refresh() {
         // in folgender Zeile evtl. den kompletten Pfad eingeben:
         loadurl(install + '/anwesend.php');
         x=document.getElementById("output").innerHTML.length;


         // sound wenn user den Raum betritt:
        // if (x > old_x  && x != 1  && x != 18) playsound(install +'/sounds/eingang2.swf');
         // sound wenn user den Raum verlässt:
        // if (x < old_x && old_x != 1000 && x != 75 && x != 73 && x != 18) playsound(install+'/sounds/sound10.swf');
         old_x = x;

         setTimeout("refresh()", 25000);
}
window.onload=refresh;

/* ]]> */

