You can get the session timeout with the funcion getMaxInactiveInterval().You can also get the timestamp of session creation using a Listener that stores that value on a Session scoped variable. If you query both values from the browser, you can activate a timer that solves your problem.
For the timeout: http://docs.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpSession.html
For the listener (watch SessionLifeCycleEventExample): http://docs.oracle.com/cd/B14099_19/web.1012/b14017/filters.htm