function sec() { if(time<0) clearInterval(intervalID); else { document.getElementById('time').innerHTML=time + ' сек'; time=time-1; } }