﻿/*
    Global Stunts Home Page Functions
    Requires jQuery 1.6 library and GlobalStunts.js
    Created by Climbing Turn
    www.climbingturn.co.uk
*/

var faderImages = null; // the images to be faded
var ledImages = null;   // the squares which must be flipped to orange as each image is faded in
var imgPtr = -1;
var tImg = null;

function nextImage() {
    if (tImg) {
        clearTimeout(tImg);
        $(faderImages[imgPtr]).fadeOut(hpFadeTime);
        $(ledImages[imgPtr]).removeClass('AniLEDSelected');
    }
    imgPtr++;
    if (imgPtr >= faderImages.length)
        imgPtr = 0;
    $(faderImages[imgPtr]).fadeIn(hpFadeTime);
    $(ledImages[imgPtr]).addClass('AniLEDSelected');
    tImg = setTimeout('nextImage()', hpFadeInterval);
}



$(document).ready(function () {
    faderImages = $('.HomeFaderImage');
    ledImages = $('.AniLED');
    nextImage();    
});
