/* Image Slideshow */
function switchPanels() {
	
	// get active and next panel
	var activePanel = $('div.carousel div.panel.active').length ? $('div.carousel div.panel.active') : $('div.carousel div.panel:last');

	var nextPanel =  activePanel.next('div.carousel div.panel').length ? activePanel.next('div.carousel div.panel') : $('div.carousel div.panel:first');

	// adjust z-index
	activePanel.addClass('last-active');

	// fade in
	nextPanel.css({opacity: 0.0}).show()
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function(){
			
			activePanel.removeClass('active last-active').hide();
	});
}

$(document).ready(function(){		
	$('div.carousel div.panel div.teaser').css('opacity', 0.9);
	
	if ($('div.carousel div.panel').length > 1) {
		setInterval('switchPanels()', 5000);
	}
});
