var Gallery = {
	imagesByIndex: [ ], 
	init: function () {
		// Initialize the fullsize images
		$('#gallery img').each( function (index, array) {
			img = $(this);
			Gallery.imagesByIndex.push(img);
			img.hide();
		} );
		// Initialize thumbs
		$('#gallery-thumbs a').each( function (index, array) {
			$(this).click( function () { Gallery.showByIndex(index); } );
		} );
		// Show first image
		Gallery.showByIndex(0);
	}, 
	showByIndex: function (index) {
		$(Gallery.imagesByIndex).each( function (index, array) { this.hide(); } );
		Gallery.imagesByIndex[index].show();
	}
}
$(document).ready( Gallery.init );
