How can a web application detect the user's idle time?
I am working on a browser-based instant messaging client, and this application needs to know when the user is idle, if possible.  Is there a way, in any major browser, for the application to detect the user's idle time system-wide?  Failing that, are there any recommended techniques for detecting when the user was last active in the application itself, and possibly in other pages under the same domain?
How can a web application detect the user's idle time?
===

I am working on a browser-based instant messaging client, and this application needs to know when the user is idle, if possible.  Is there a way, in any major browser, for the application to detect the user's idle time system-wide?  Failing that, are there any recommended techniques for detecting when the user was last active in the application itself, and possibly in other pages under the same domain?