// architectuurcentrumtwente dynamic site effects and actions
// (c) 2007 Loco (Loohuis Consulting), http://www.loohuis-consulting.nl/

// settings
var imgCount;
var currentImg = 1;
var imgInterval = 6;
var animator;

// initialize homepage image animation
function initAnim()
{
    var imgs = document.getElementsByClassName('animate', 'home-animation');
    imgCount = imgs.length;
    if (imgCount > 1)
        animator = new PeriodicalExecuter(swapImgs, imgInterval);
}

// animate images
function swapImgs()
{
    var swapIn = currentImg + 1;
    if (swapIn > imgCount)
        swapIn = 1;
    new Effect.Fade('anim' + currentImg);
    new Effect.Appear('anim' + swapIn);
    currentImg = swapIn;
}

// initialise page
function init()
{
    if ($('home-animation'))
        initAnim();
}

Event.observe(window, 'load', init);
