title: repeat a function when it finished
body: <p>I have a function that hides and shows divs.</p>
  
  <p>How can i set it up, when the function finishes running, then it should start again? </p>
  
  <pre><code>function rotateimages() {
    setTimeout(function() {
      restoreOriginal()
      $('.main2').css('background-image', 'url(/img/2017/home_main_vacation.gif)');
    }, 3500);
    setTimeout(function() {
      restoreOriginal()
      $('.main5').css('background-image', 'url(/img/2017/home_main_tickets.gif)');
    }, 12500);
  }
  </code></pre>