// JScript File
var ImageCollection = new Class({
	options: {
		baseURL: 'http://www.catapult3.com/'	
	}, 
	initialize: function(images, mainImage) {
		this.images = $A(images);
		this.mainImage = $(mainImage);
		this.loadImages();
	},
	loadImages: function() {
		this.images.each(function(value, key, obj) {
			if (key === 0) this.loadImage(value); //Set first image to main
 		}, this);
	},
	loadImage: function(img) {

							
		this.mainImage
			.setStyle('opacity', 0)
			.empty()
			.adopt(
				new Asset.image(this.options.baseURL + img, {
					id: img, 
					border: 0, 
					onload: this.showImage.bind(this)
				})
			);
	},
	showImage: function(cont) {
		this.fx = this.fx || this.mainImage.effect('opacity');
		this.fx.start(0, 1);
	}
});
ImageCollection.implement(new Options);

