window.onload = init;
var interval;
function init()
{
	interval = setInterval(trackLogin,100000);
}
function trackLogin()
{
	var xmlReq = false;
	try {
	xmlReq = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e2) {
	xmlReq = false;
	}
	}
	if (!xmlReq && typeof XMLHttpRequest != 'undefined') {
	xmlReq = new XMLHttpRequest();
	}

	xmlReq.open('get', '/includes/php/check.php', true);
	xmlReq.setRequestHeader("connection", "close");
	xmlReq.send(null);
	xmlReq.onreadystatechange = function(){
		if(xmlReq.readyState == 4 && xmlReq.status==200) {
			if(xmlReq.responseText == 1)
			{
				clearInterval(interval);
				alert('Session Timeout! Automatisches Logout erfolgt!');
				document.location.href = "index.html";
			}
		}
	}
}

