Esto es lo que hice yo en JS
...
<script type="text/javascript">
var pepe;
function ini() {
pepe = setTimeout('location="http://www.timeout.org/timeout.png"',915000); // 5 segundos
}
function parar() {
clearTimeout(pepe);
pepe = setTimeout('location="http://www.timeout.org/timeout.png"',915000); // 5 segundos
}
</script>
</head>
<body onload="ini()" onkeypress="parar()" onclick="parar()" ..........