function init(){
getOnline();
getMsg();
}
$(document).ready(function() {
setInterval('init()',1000);
document.getElementById('msg').focus();
});
function getOnline()
{
xhttp=new XMLHttpRequest();
xhttp.onreadystatechange=function(){
if (xhttp.readyState==4 && xhttp.status==200){
document.getElementById('users').innerHTML = xhttp.responseText;
}
}
xhttp.open('POST','control/php/main.php', true);
xhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xhttp.send('go=getOnline');
}
function getMsg()
{
xhttp=new XMLHttpRequest();
xhttp.onreadystatechange=function(){
if (xhttp.readyState==4 && xhttp.status==200){
document.getElementById('chat').innerHTML = xhttp.responseText;
document.getElementById('chat').scrollTop = document.getElementById('chat').scrollHeight;
}
}
xhttp.open('POST','control/php/main.php', true);
xhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xhttp.send('go=getMsg');
}