/* Slideshow */
function slideSwitch() {
	var $active = $('.slideshow img.active');
	if ( $active.length == 0 ) $active = $('.slideshow img:last');
	var $next =  $active.next().length ? $active.next()
		: $('.slideshow img:first'); 
	// var $sibs  = $active.siblings();
	// var rndNum = Math.floor(Math.random() * $sibs.length );
	// var $next  = $( $sibs[ rndNum ] );
	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1800, function() {
			$active.removeClass('active last-active');
		});
}

$(function() {
	setInterval( "slideSwitch()", 4500 );
});

/* Band Teaser */
function bandSwitch() {
	var $ac = $('.bandteaser img.ac');
	if ( $ac.length == 0 ) $ac = $('.bandteaser img:last');
	var $next =  $ac.next().length ? $ac.next()
		: $('.bandteaser img:first'); 
	// var $sibs  = $ac.siblings();
	// var rndNum = Math.floor(Math.random() * $sibs.length );
	// var $next  = $( $sibs[ rndNum ] );
	$ac.addClass('last-ac');

	$next.css({opacity: 0.0})
		.addClass('ac')
		.animate({opacity: 1.0}, 1800, function() {
			$ac.removeClass('ac last-ac');
		});
}

$(function() {
	setInterval( "bandSwitch()", 5000 );
});

/* Infotabs */
$(document).ready(function() {
  $("#tabs").tabs();
});

/* FAQ */
$(document).ready(function() {
  $('#faqs h6').each(function() {
    var tis = $(this), state = false, answer = tis.next('div').hide().css('height','auto').slideUp();
    tis.click(function() {
      state = !state;
      answer.slideToggle(state);
      tis.toggleClass('active',state);
    });
  });
});

/* Lightbox */
$(document).ready(function() {
	$("a.fancybox").fancybox({ 'transitionIn':'elastic', 'transitionOut':'elastic','speedIn': 500, 'speedOut': 500, 'overlayShow':true,'overlayOpacity':0.3,'overlayColor':'#000000' });	
});

