﻿var IMAGES_URL = "";

var images = [
            { image: "02.jpg", text: "Marketing Team discussing the day ahead" },
            { image: "01.jpg", text: "An early start on location" },
            { image: "03.jpg", text: "Fitting Nina into her bikini" },
            { image: "04.jpg", text: "Jana waiting for her filming cue" },
            { image: "05.jpg", text: "Some last minute adjustments" },
            { image: "08.jpg", text: "Making sure Catherine's bra fits her perfectly" },
            { image: "07.jpg", text: "The room is set and the cameras in place" },
            { image: "09.jpg", text: "Final colour and make up checks for Jess" },
            { image: "06.jpg", text: "Katie looking a natural on camera" }
        ];


var ix = 1;

function step(dir) {
    if (dir == "-") {
        ix -= 1;
    } else if (dir == "+") {
        ix += 1;
    }

    var css = "cf";
    if (ix > 1) {
        setImage($.$("prevImg"), (ix - 1));
    } else {
        css = "start cf";
    }

    setImage($.$("currentImg"), ix);

    if (ix < images.length) {
        setImage($.$("nextImg"), (ix + 1));
    } else {
        css = "end cf";
    }

    $.$("slideshow").className = css;
}



function setImage(el, num) {
    el.src = IMAGES_URL + images[(num - 1)].image;
    el.title = images[(num - 1)].text;
    if (num == ix) {
        $.$("slideshow-text").innerHTML = el.title;
    }
}


page.onload(function() {
    for (i = 0; i < images.length; i++) {
        var img = new Image();
        img.src = IMAGES_URL + images[i].image;
    }
    step();
}
);