// (C) 2003 by CodeLifter.com
// Free for all users, but leave in this header.

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 2;

// =====================================
// Do not edit anything below this line!
// =====================================
var tss;
var iss;
var jss = 0;
var pss = Picture.length-1;

var preLoad = new Array();
var preLoadZoom = new Array();
for (iss = 1; iss < pss+1; iss++) {
    preLoad[iss] = new Image();
    preLoad[iss].src = Picture[iss];
}

var gallery = null;

function galleryLoad() {
    showHot = true;
    document.getElementById('loading').style.display = 'none';
    document.getElementById('images').style.display = 'block';
    galleryStart();
    galleryThumbnails();
}

function galleryThumbnails() {
    var buffer = "";
    for (iss = 1; iss < pss+1; iss++) {
        buffer += '<a href="javascript:" onclick="galleryJumpTo(' + iss + ')"><img src="' + Picture[iss] + '" border="0" title="' + Caption[iss] + '"';
        if (iss != 5 && iss != 10) {
            buffer += ' class="spacer"';
        }
        buffer += '></a>';
        if (iss == 5 || iss == 10 || iss == 15) {
            buffer += '<br>';
        }
    }
    document.getElementById('Thumbnails').innerHTML = buffer;
}

function galleryStart() {
    galleryControl('F');
    gallery = window.setTimeout("galleryStart('F')", 6000);
    document.getElementById('gallery-stopstart').src = 'public/images/gallery_stop.png';
}

function galleryStop() {
    window.clearTimeout(gallery);
    gallery = null;
    document.getElementById('gallery-stopstart').src = 'public/images/gallery_start.png';
}

function galleryStopStart() {
    if (gallery == null) {
        // start
        galleryStart();
    } else {
        // stop
        galleryStop();
    }
}

function galleryRestart() {
    jss = 1;
    galleryStart();
}

function galleryControl(how) {
    if (showHot) {
        if (how=="H") jss = 1;
        if (how=="F") jss = jss + 1;
        if (how=="B") jss = jss - 1;
        if (jss > (pss)) jss=1;
        if (jss < 1) jss = pss;

        if (document.all) {
            document.getElementById('PictureBox').style.filter="blendTrans(duration=2)";
            document.getElementById('PictureBox').style.filter="blendTrans(duration=CrossFadeDuration)";
            document.getElementById('PictureBox').filters.blendTrans.Apply();
        }
        document.getElementById('PictureBox').src = preLoad[jss].src;
        document.getElementById('PictureBox').title = Caption[jss];

        if (document.getElementById) document.getElementById("CaptionBox").innerHTML = Caption[jss];
        if (document.all) document.getElementById('PictureBox').filters.blendTrans.Play();
    }
}

function galleryJumpTo(i) {
    jss = i-1;
    galleryControl('F');
    galleryStop();
}

function showControls() {
    document.getElementById('controls').style.display = 'block';
}

function hideControls() {
    document.getElementById('controls').style.display = 'none';
}

