onloadHandlers[onloadHandlers.length] = 'startRotator()';
var imageDivs;
var imageTimer = 5000;
var tid;
var cont = "gallery-rotator";
function startRotator() {
    imageDivs = document.getElementById(cont).getElementsByTagName("div");
    if(imageDivs) {
        rotate(-1);
    }
}
function rotate(imageIndex) {
    if(imageIndex == -1) {
        imageIndex+=1;
        imageDivs[imageIndex].style.display = "block";
        tid = setTimeout("rotate("+imageIndex+")", imageTimer);
    }else {
        if(imageIndex == imageDivs.length-1) {
            imageDivs[imageIndex].style.display = "none";
            startRotator();
        } else {
            imageDivs[imageIndex].style.display = "none";
            imageDivs[imageIndex+1].style.display = "block";
            imageIndex+=1;
            tid = setTimeout("rotate("+imageIndex+")", imageTimer);
        }
    }
}