var slideshow = Class.create({
	initialize: function(container, container_two, file) {
		thisContainer = $(container);
		nextDiv = $(container_two).hide();
		textAlign = thisContainer.getStyle('text-align');
		thisFile = file;
		images = [];

		this.buildArray();
		this.showImage.delay(1, 0);

	},

	buildArray: function() {
	
		var url = thisFile;
		new Ajax.Request(url, 
		{
			method: 'get',
			onSuccess: function(transport) 
			{
				images = transport.responseText.split('[split]');
			}
		});

	},

	showImage: function(i) {
        var arrayLenght = images.length;
        var thisIndex = i + 1;

        if(thisIndex == arrayLenght)
        {
            next = 0;
        } else {
            next = i + 1;
        }

		if(nextDiv.getStyle('display') == 'none')
		{
			nextDiv.update(images[next]);

			Element.fade.delay(2, thisContainer);
			Element.appear.delay(2, nextDiv);
		} else {
			thisContainer.update(images[next]);

			Element.fade.delay(2, nextDiv);
			Element.appear.delay(2, thisContainer);
		}

		slideshow.prototype.showImage.delay(4, next);
	}
});
