$(function(){

			var slidesNum = $('div#slideShow div.photo').length;

			// ADD INDEXES
			$('div#slideShow div.photo').each( function (index) {
				if( index == 0 ) { $(this).css('opacity', '1'); }
				if (index != 0) { $(this).css('opacity', '0'); }
				if (index > 0) { $('div#slideShow div.index.active').after('<div class="index"></div>'); }
			});
	
			$('div#slideShow div.photo img').load(function() {
				$('div#slideShow div.photo').each( function (index) {
					$(this).children('img').css('margin-top', ((($(this).height() - $(this).children('img').height())/2) - 12) + 'px');
				});
			});
	
			var factor = Math.round(slidesNum/12);
			if ( factor == 0 ) { factor++; }
				$('div#slideShow div.indexes').css('bottom', factor * 22 );
	
			var indexGlobal = 0;
			$('div#slideShow div.index').each( function (index) {
				$(this).click( function () {
					$('div#slideShow div.index').removeClass('active');
					$(this).addClass('active');
	
					indexGlobal = $(this).index();
	
					$('div#slideShow div.photo').each( function (i) {
						if ( i == indexGlobal ) { $(this).animate({
							'opacity': '1'
						}, 100); }
						if ( i != indexGlobal ) { $(this).css('opacity', '0'); }
					});
				});
			});
				
});
