﻿var imgWidth = '150px';
var imgHeight = '200px';
var stripContainer = 'strip_container';
var numImages = 20;

var images = new Array(numImages);
for (i = 0; i <= numImages - 1; i++) {
    var offset = 100
    images[i] = new stripImage(imgWidth, imgHeight, 'cake' + (i + 1).toString(), 'images/cake' + (i + 1).toString() + '.jpg');
}

function stripImage(width,height,id,src) {
    this.width = width;
    this.height = height;
    this.id = id;
    this.src = src;
    }

function initializeStrip() {
    var strip = document.createElement('div');
    strip.setAttribute('id', 'film_strip');
    var container = document.getElementById(stripContainer);
    for (i = 0; i <= numImages - 1; i++) {
        img = document.createElement('img');
        img.setAttribute('id', images[i].id);
        img.setAttribute('height', images[i].height);
        img.setAttribute('width', images[i].width);
        img.setAttribute('src', images[i].src);
        img.setAttribute('class', 'strip_images');
        strip.appendChild(img);
    }
    container.appendChild(strip);
}

function animateStrip() {
    var strip = document.getElementById('film_strip');
    var topElem = strip.firstChild;
    strip.removeChild(topElem);
    strip.appendChild(topElem);
    var t = setTimeout("animateStrip()", 5000);
}

function init() {
    initializeStrip();
    setTimeout("animateStrip()", 5000);
}
