// If we are running this file then, by definition, JavaScript is enabled.
// Load the style sheet that reveals hideable elements containing JavaScript.
document.write('<link rel="stylesheet" href="Styles/js.css">')

//
// Image selection functions - for selecting from a list of images
//
var displayed = 0

function preload(imageDir, imageNames)
{
    var imageList = new Array(imageNames.length)
    for (i = 0; i < imageNames.length; i++)
    {
        imageList[i] = new Image
        imageList[i].src = imageDir + "/" + imageNames[i]
    }
    return imageList
}

function displayImg(imgList, num, elId)
{
    el = document.getElementById(elId)
    el.src = imgList[num % imgList.length].src
    displayed = num
}

function swap(imgList, elId)
{
    displayImg(imgList, displayed + 1, elId)
}
