From http://selfmade.lemkewebdesign.de/js-schleifen.php