$(function(){
	$('.datum').datepicker({
		inline: true,
		showOn: 'both',
		buttonImageOnly: true,
		buttonImage: 'files/calendar_view_month.png'
	});
	
	$('#weiter').hover(
		function() { 
			$('#weiter').toggleClass('button', false) 
			$('#weiter').toggleClass('button_hover', true) 
		}, 
		function() { 
			$('#weiter').toggleClass('button_hover', false) 
			$('#weiter').toggleClass('button', true) 
		}
	);
	
	setInterval ( "slideshow(2000)", 6000 );    
	
	$('a[rel*=lightbox]').lightBox();
	
	$.pir.options.php="text.php";
	$("h1").pir({wrap: true});
	$("h5").pir({wrap: true});
});

function slideshow(speed) {
    var $active = $('#header_rechts img.active');
    
    if ( $active.length == 0 ) $active = $('#header_rechts img:last');

    var $next =  $active.next('img').length ? $active.next('img')
       : $('#header_rechts img:first');

    $active.addClass('last-active');
    
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, speed, function() {
            $active.removeClass('active last-active');
        });
}
