What "setInterval slideshow"? I don't see any setInterval any place in there.
I will say that this is wrong:
imageCounter = (imageCounter - 1) % imageCache.length;
Think about it. What happens if imageCounter is zero when you hit that statement?
What can you easily do to fix that line?