
window.onload=function()
{
	var this_js_script = $('script[src*=logout]');
	var logout_aktive = this_js_script.attr('logout'); 
	var logout_time = this_js_script.attr('logout_time'); 

	if(logout_aktive == "ja")
	{
		var idleTime = 0;
		var idleInterval = setInterval(function(){logout()}, 1000);
		element=document.getElementsByTagName("body")[0];
		element.addEventListener("mousemove", function(e) {idleTime = 0;})
		element.addEventListener("keypress", function(e) {idleTime = 0;})
			
		function logout() {
			idleTime++;
			
			if (idleTime > logout_time ){   
				window.location.href = "user_logoff.php";
			}
		}
	}
}
