Using the following code for an image gallery:

Code:
image=new Object();
image[0]='http://www.autofusion.com/development/gallery2/images/1280_example.jpg';
image[1]='http://www.autofusion.com/development/gallery2/images/1280_example_2.jpg';
image[2]='http://www.autofusion.com/development/gallery2/images/1280_example_3.jpg';

function findImageIndex() {
    for (ind in image) {
        if (image[ind] == document.getElementById("mainImageSrc").src) {
            return ind;
        }
    }
    return -1;
}
function imageCount() {
    var count=0;
    for (ind in image) {
        count++;
    }
    return count;
}
function previous() {
    var index=findImageIndex();
    if (index != -1) {
        if (index == 0) {
            index=imageCount()-1;
        } else {
            index--;
        }
        document.getElementById("mainImageSrc").src=image[index];
    }
}
var playId;
function next() {
    var index=findImageIndex();
    if (index != -1) {
        if (index == (imageCount()-1)) {
            index=0;
        } else {
            index++;
        }
        document.getElementById("mainImageSrc").src=image[index];
    }
}
function play() {
    playId=setInterval("next()", 2000);
}
function stop() {
    clearInterval(playId);
}
The play and stop functions work fine in IE6, but for some reason the previous and next buttons only work in IE6 *sometimes* on some computers. Most of the time it just fails to load an image.

You can see the code in action here:

http://www.autofusion.com/development/gallery2/