XMl Slideshow with buttons

Hello I followed the xml slide show tutorial here on the site, and wanted to add buttons to it.(I did the autoplay tutorial) I have the buttons working, but the autoplay feature seems not to be agreeing with the buttons whenever I press left or right arrows on the keyboard it goes to it, but then the autoplayer becomes erratic and suddenly goes to various frames at random.

I think the problem is that the timer which is set to 3000 miliseconds is not resetting. I was wondering how to reset this variable each time the user presses the left or right arrow.

any help is much appreciated. Thank you.