http://jsfiddle.net/SCyWG/64/
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var timer,
num = 19,
output = $('#mydiv'),
LS_allowed=('localStorage' in window);
if(LS_allowed){
var save_time=parseInt(localStorage.getItem('timer-time'))||0;
if(save_time+1*60*60*1000>=(new Date()).getTime())
num=localStorage.getItem('timer-num')||num;
};
function changeNum(){
output.text(num--);
if(LS_allowed){
localStorage.setItem('timer-num',num);
localStorage.setItem('timer-time',(new Date()).getTime());
};
//каждый раз задержка будет на 100ms больше
if(num>0)
setTimeout(changeNum,500+(19-num)*100);
};
setTimeout(changeNum,500);
});
</script>
</head>
<body>
<div id="mydiv"></div>
</body>
</html>