jQuery(document).ready(function($) {
	
	// accordion for event list
	if ( $('.event-list-view').length ) {
		$('.event-list-view').accordion({
			active: false,
			autoHeight: false,
			header: '.toggler',
			collapsible: true
		});
	}
	
	// check if slideshow is on page
	if ( $('#slideshow div').length > 1) {
		$('#slideshow').cycle({
			easing: 'easeInOutBack',
			pause: true,
			speed: 4000,
			sync: true,
			random: false,
			cleartypeNoBg: false
		});
	}
	
	// hide all images for lightbox except first
	if ( $('.rzcolorbox-show-thumb').length ) {
		$('.rzcolorbox-show-thumb .rzcolorbox:not(:first)').hide();
	}
	
	// show or hide the textarea for questions
	if ( $('#question').length ) {
		if ( ! $('#question:checked').length ) {
			$('#question_content').hide();
		}
		
		$('#question').change( function() {
			if($('#question:checked').length) {
				$('#question_content').show();
			} else {
				$('#question_content').hide().val('');
			}
		})
	}
	
	if ( $('.tx-irfaq-dynlist').length ) {
		$('.tx-irfaq-dynlist').accordion({
			active: false,
			autoHeight: false,
			header: '.toggler',
			collapsible: true
		});
	}
});
