Basic Javascript countdown with repetition support