//globale Instanz von XMLHttpRequest
var xmlHttp = false;
 
//XMLHttpRequest-Instanz erstellen
//... für Internet Explorer
try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp  = false;
    }
}
//... für Mozilla, Opera, Safari usw.
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}


setInterval("loadOnline()",60000);

function loadOnline()
{
 if (xmlHttp) {
	 var bundesland=selectWert(document.online_form.regioSel);
	
     xmlHttp.open('POST', 'http://www.qpeople.de/online.php', true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send('uid='+document.loginBox.userid.value+'&bundesland='+bundesland);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             document.getElementById("onlineList").innerHTML = xmlHttp.responseText;
			 loadBirthday();
         }
     };
    
 }

}

function checkMail()
{

 if (xmlHttp) {
	  var onlinestat=selectWert(document.user_form.user_stat);
     xmlHttp.open('POST', 'http://www.qpeople.de/app/checkmail.php', true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send('uid='+document.loginBox.userid.value+'&stat='+onlinestat+'&time3='+document.user_form.acttime.value);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             document.getElementById("newMess").innerHTML = xmlHttp.responseText;		
			 checkChat();
         }
     };
    
 }
	

}

function checkChat()
{
 if (xmlHttp) {
     xmlHttp.open('POST', 'http://www.qpeople.de/app/checkchat.php', true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send('uid='+document.loginBox.userid.value);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             document.getElementById("howChat").innerHTML = xmlHttp.responseText;			 
         }
     };
    
 }
	

}

function loadBirthday()
{
 if (xmlHttp) {
     xmlHttp.open('POST', 'http://www.qpeople.de/online.php?modul_site=birthday', true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send('uid='+document.loginBox.userid.value);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             document.getElementById("birthdayList").innerHTML = xmlHttp.responseText;
			 if(document.loginBox.userid.value>0)
				{
			 checkMail();
			 };
         }
     };
    
 }

}

loadOnline();
