The problem with how you were handling the mouseover and mouseout was that you were redefining the global autoscroll variable instead of changing its value in the mouseout event.
Changing that and some relatively simple keydown event code fixed up the slideshow to do what you want (I think).
The changes I made to the mouseover/mouseout code:
var autoscroll = window.setInterval(function(){ navigate( 'next' )}, 5000);
component.onmouseover = function(e){
autoscroll = clearInterval(autoscroll);
console.log('onmouseover');
};
component.onmouseout = function(e) {
clearInterval(autoscroll);
autoscroll = setInterval(function() {navigate( 'next' )}, 5000);
console.log('onmouseout');
};
And here's the code for the arrow key events:
document.onkeydown = function(event) {
event = event || window.event;
switch (event.keyCode || event.which) {
case 37:
clearInterval(autoscroll);
navigate( 'prev' );
autoscroll = setInterval(function() {navigate( 'next' )}, 5000);
break;
case 39:
clearInterval(autoscroll);
navigate( 'next' );
autoscroll = setInterval(function() {navigate( 'next' )}, 5000);
break;
}
};
Here's what I came up with: http://jsfiddle.net/M2CwF/2/
Update
Here's a version that supports multiple slideshows per page. I eliminated the left and right arrow actions though because I'm not sure how you would want to handle navigating multiple slideshows on one page...
It shouldn't be hard to modify the code to make that happen though.