if (photos == null)
    var photos = new Array();

if (current == null)
    var current = new Array();

function appendSlideShow(name, photo, caption)
{
    if (current[name] == null)
        current[name] = 0;

    if (photos[name] == null)
        {
            photos[name] = new Array();
        }

    ne = [photo, caption];
    photos[name].push(ne);

    preload = new Image();
    preload.src = photo;
}

function updateSlideShow(name)
{
    image = document.getElementById('currentPhoto_' + name);
    image.src = photos[name][current[name]][0];

    track = document.getElementById('currentPhotoTrack_' + name);
    track.innerHTML = 'Photo ' + (current[name] + 1) + '/' + photos[name].length;;

    caption = document.getElementById('caption_' + name);
    caption.innerHTML = photos[name][current[name]][1];
}

function prevPhoto(name)
{
    if (current[name] > 0)
        {
            --current[name];
            updateSlideShow(name);
        }

    return false;
}

function nextPhoto(name)
{
    if (current[name] < photos[name].length - 1)
        {
            ++current[name];
            updateSlideShow(name);
        }

    return false;
}
