function LogoutTimer() {
	lTime=lTime-1;
	var lMins=(lTime-(lTime%60))/60;
	var lSecs=lTime%60;
	var lDiv=document.getElementById('LogoutTimer');
	
	if(lDiv){
		if (lMins>=6) lDiv.style.backgroundColor='green';
		else if (lMins>=2) lDiv.style.backgroundColor='orange';
		else if (lMins>=0) lDiv.style.backgroundColor='red';
		else lDiv.style.backgroundColor='black';
	}
	
	if (lang=='en') window.status="Auto Logout: " + lMins + " Min " + lSecs + " Sec" ;
	else window.status="Automaatne väljalogimine: " + lMins + " Min " + lSecs + " Sek" ;
	
	if (lMins==2 & lSecs==0){
		if (lang=='en') alert('You will be automatilly logged out in '+ lMins +' minutes. Please save you work now to ensure no work is lost.');
		else alert('Automaatne väljalogimine toimub '+ lMins +' minuti pärast. Palun salvestage oma töö kohe vältimaks selle kadumist.');
	}
	if (lMins==0 & lSecs==0){
		if (lang=='en') alert('You session has timed out. You will need to login again. Please make a copy of your work before you do anything else as it may be lost.');
		else alert('Seanss aegus. On vaja uuesti sisse logida. Palun tehke enne jätkamist oma tööst koopia.');
	}
}
window.setInterval("LogoutTimer()",1000);
LogoutTimer();
