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();
	}
}

jQuery(function() {

	// Slideshow
	jQuery(function(){
		jQuery('.slideshow').slides({
			preload: true,
			preloadImage: 'img/loading.gif',
			play: 0,
			pause: 0,
			hoverPause: true,
			slideSpeed: 750
		});
	});
	
	// Slide thumbnail navigation
	jQuery('.slide_navigation li').click(
		function() {
			var id = jQuery(this).attr('rel');
			if (jQuery('#'+id).is(':hidden')) {
				jQuery('#'+id).parent().children('li').fadeOut();
				jQuery('#'+id).fadeIn();
			}
		}
	);
	
	// Remove captions on pages with slide_navigation
	jQuery('.slide_navigation').parent().children('.captions').html('');
	
	setInterval("showSlideCaption();",100);
	
	// Lightbox
	jQuery('a[rel=lightbox]').lightBox();

});
