jQuery.noConflict();

// Show caption for visible slide
var current_slide = '';
function showSlideCaption() {
	if (current_slide != jQuery('.slides_container li:visible').attr('id')) {
		current_slide = jQuery('.slides_container li:visible').attr('id');
		jQuery('.slideshow .captions li').hide();
		jQuery('.slideshow .captions li[rel='+current_slide+']').fadeIn();
	}
}

// Run on DOM ready
jQuery(function() {

	// Hide certain elements until page has finished loading
	//jQuery('#wrapper').hide(); // Commented out because it interferes with slideshow animation
	jQuery('#slideshow_overlay').hide();
	jQuery('.captions').hide();
	jQuery('.caption').hide();

	// Slideshow
	jQuery(function(){
		jQuery('.slideshow').slides({
			preload: true,
			preloadImage: 'img/loading.gif',
			play: 7500,
			pause: 1000,
			hoverPause: true,
			slideSpeed: 1000
		});
	});
	
	setInterval("showSlideCaption();",100);
	
	// Lightbox
	jQuery('a[rel=lightbox]').lightBox();

});

// Run on full content load
jQuery(window).load(function() {

	// Show elements that were hidden earlier
	//jQuery('#wrapper').fadeIn(); // Commented out because it interferes with slideshow animation
	jQuery('#slideshow_overlay').fadeIn();
	jQuery('.captions').fadeIn();
	jQuery('.caption').fadeIn();

});

