var simpleGallery = new Class({
	initialize: function (selectorElement, galleryElement) {
		this.images = Array();
		this.selectorElement = selectorElement;
		this.galleryElement = galleryElement;
		this.populateImages();
		this.gallery = new gallery(galleryElement, {
			showArrows: false,
			showCarousel: false,
			showInfopane: false,
			embedLinks: false,
			preloader: false,
			populateData: false,
            timed: true,
            delay: 6000,
			fadeDuration: 500,
			manualData: this.images
		});
	},
	populateImages: function() {
		currentArrayPlace = this.images.length;
		data = this.images;
		this.selectorElement.getElements('img').each(function(el) {
			// Create the element info for Smooth Gallery
			elementDict = {
				image: el.getProperty('src').replace(/SM/,'LG'),
				number: currentArrayPlace
			};
			data[currentArrayPlace] = elementDict;
			// Now add the callback
			el.addEvents({
				'click': function (myself) {
					this.gallery.goTo(myself);
				}.pass(currentArrayPlace, this)
			});
			// Increment the counter
			currentArrayPlace++;
		}.bind(this));
		this.images = data;
	}
});