var timeout2; function rotateS() { *!* clearInterval(play); */!* clearTimeout(timeout2); timeout2 = setTimeout(function() {rotateSwitch ();rotateS() }, 6000); } rotateSwitch = function(){ rotate_r(); rotateS(); };