var lightboxGallery = {
	slideInterval : '',
	slideDelay : 3000,
	slideSpeed : 500,
	init : function(){
		lightboxGallery.prepareImages();	
		lightboxGallery.prepareAutoSlide();	
	},
	prepareImages : function(){
		$('#photos')
			.css({
				position : 'relative'
			})
		
		$('#photos a')
			.hide()
			.css({
				position : 'absolute',
				top : 0,
				left : 0
			})
			.eq(0)
			.show();
	},
	prepareAutoSlide : function(){
		if($('#photos a').length > 1){
			slideInterval = setInterval(lightboxGallery.nextImage, lightboxGallery.slideDelay);
		}
	},
	nextImage : function(){
		var thisIndex = $('#photos a:visible').index();
		var nextIndex = thisIndex + 1;
		
		if(nextIndex >= $('#photos a').length){
			nextIndex = 0;
		}
		
		$('#photos a').eq(thisIndex).fadeOut(lightboxGallery.slideSpeed);
		$('#photos a').eq(nextIndex).fadeIn(lightboxGallery.slideSpeed);
	}
};

$(lightboxGallery.init)

