﻿Pic[_SHOW].sort(randOrd);

if (Pic[_SHOW].length > 5) {
    Pic[_SHOW].length = 5
}

var t = new Array(); /* set up in init() */
var j = new Array(); /* set up in init() */
var preLoad = new Array();

function init_ex() {
    for (var i = 0; i < Pic.length; i++) {
        j[i] = 0;
        t[i] = null;
        preLoad[i] = new Array();
        for (var r = 0; r < Pic[i].length; r++) {
            preLoad[i][r] = new Image();
            preLoad[i][r].src = Pic[i][r];
        }
    }
}
init_ex();
function startShow(_n) {
    if (t[_n]) {
        clearInterval(t[_n]);
        t[_n] = null;
    }
    t[_n] = setInterval('runSlideShow(' + _n + ')', slideShowSpeed);
}
function runSlideShow(_n) {
    if (document.all) {
        document.images["SlideShow" + _n].style.filter = "blendTrans(duration=2)";
        document.images["SlideShow" + _n].style.filter = "blendTrans(duration=crossFadeDuration)";
        document.images["SlideShow" + _n].filters.blendTrans.Apply();
    }
    document.images["SlideShow" + _n].src = preLoad[_n][j[_n]].src;
    if (document.all) { document.images["SlideShow" + _n].filters.blendTrans.Play(); }
    j[_n] = j[_n] + 1;
    if (j[_n] > (Pic[_n].length - 1)) j[_n] = 0;
}
function ImageOnload() {
    for (var i = 0; i < Pic.length; i++) {
        /* this starts each one at a separated interval */
        setTimeout('startShow(' + i + ')', slideShowSpeed * i / Pic.length);
        /* use this if you want them to all change at the "same time" */
        /* "same time" on a single processing machine ? :_) */
        // startShow(i);
    }
}
