If you are familier with jquery, there is the plugin known as jquery timer(the link is below), which is going to enable you run certain code in regular interval of time.
Whenever a page or a div is initiated, setup a session, and keep the time in the session variable like $_SESSION['checkedtime'] = time();
Now use the jquery timer to sent a psot request to a file which checks the value and return the activity status a basic example of that page is like this
check.php
$oldtime = $_SESSION['checkedtime'];
if($oldtime<time()-15) { return 0; }
else { return 1; }
to setup a time function see the demo page
http://www.evanbyrne.com/article/jquery-timer-plugin