Automatic logout using AJAX

I don't know AJAX too well, but I'm sure you'll update this timer every time the user changes something. Won't this be too hard? You'll have to put a function like updateTimer() in all JS functions that may be called to update this.