function slideshowLoad(names,target) {
    len = names.length;
    gallery = new Array(len);
    for (i=0; i<len; i++) {
        gallery[i] = new Image();
        gallery[i].src = names[i];
    }
    if (slideshowLoad.arguments.length > 2) {
        captions = slideshowLoad.arguments[2];
    } else {
        captions = false;
    }
    gallery.captions = new Array(len);
    for (i=0; i<len; i++) {
        if (captions) {
            if (captions[i]) {
                gallery.captions[i] = captions[i];
            } else {
                gallery.captions[i] = '';
            }
        } else {
            gallery.captions[i] = '';
        }
    }
    gallery.current = 0;
    gallery.target = target;
    
    return gallery;
}
function slideshowNext(gallery) {
    gallery.current = (gallery.current+1) % gallery.length;
    document.images[gallery.target].src = gallery[gallery.current].src;
    if (document.getElementById){
        target = document.getElementById('slideShowCaption');
        if (target) {
            target.firstChild.nodeValue = gallery.captions[gallery.current];
        }
    }
    document.images[gallery.target].alt = gallery.captions[gallery.current];
}

function slideshowPrev(gallery) {
    gallery.current = gallery.current-1;
    if(gallery.current < 0) gallery.current = gallery.length-1;
    document.images[gallery.target].src = gallery[gallery.current].src;
    if (document.getElementById){
        target = document.getElementById('slideShowCaption');
        if (target) {
            target.firstChild.nodeValue = gallery.captions[gallery.current];
        }
    }
    document.images[gallery.target].alt = gallery.captions[gallery.current];
}