var count = 1; // this is the slideshow counter
var total = screenshot.length - 1; // total number of screenshots

function gallery() { // load the page with initial message
    document.gallery.desc.value = "1: " + message[1];
    window.status = "Screenshot 1: " + message[1];
}

function previmg() { // load previous screenshot and message
    if (count != 1) {
        count--; // decrease counter by one
        if (document.all) document.gallery.img.filters.blendTrans.apply();
        if (document.images) document.img.src = screenshot[count];
        if (document.all) document.gallery.img.filters.blendTrans.play();
        document.gallery.desc.value = count + ": "+ message[count];
        window.status = "Screenshot " + count + ": " + message[count];
    }
}

function nextimg() { // load next screenshot and message
    if (count != total) {
        count++; // increase counter by one
        if (document.all) document.gallery.img.filters.blendTrans.apply();
        if (document.images) document.img.src = screenshot[count];
        if (document.all) document.gallery.img.filters.blendTrans.play();
        document.gallery.desc.value = count + ": "+ message[count];
        window.status = "Screenshot " + count + ": " + message[count];
    }
}

function randimg() { // load random screenshot and message
    var randomizer = Math.random();
    count = Math.round((total - 1) * randomizer) + 1;
    if (document.all) document.gallery.img.filters.blendTrans.apply();
    if (document.images) document.img.src = screenshot[count];
    if (document.all) document.gallery.img.filters.blendTrans.play();
    document.gallery.desc.value = count + ": "+ message[count];
    window.status = "Screenshot " + count + ": " + message[count];
}

function firstimg() { // load first screenshot and message
    count = 1; // set counter to one
    if (document.all) document.gallery.img.filters.blendTrans.apply();
    if (document.images) document.img.src = screenshot[1];
    if (document.all) document.gallery.img.filters.blendTrans.play();
    document.gallery.desc.value = count + ": "+ message[1];
    window.status = "Screenshot 1: " + message[1];
}


function lastimg() { // load last screenshot and message
    count = total; // set counter to last screenshot
    if (document.all) document.gallery.img.filters.blendTrans.apply();
    if (document.images) document.img.src = screenshot[count];
    if (document.all) document.gallery.img.filters.blendTrans.play();
    document.gallery.desc.value = count + ": "+ message[count];
    window.status = "Screenshot " + count + ": " + message[count];
}