var $versatz;
var $sichtbar=0;

$(document).ready(function () {
	$('.slideFade').hide()
	$('#navigation').hide();
	$('.headline').hide();
	$('#contentWrapper').height(450);	
	$.each($('#slideshowModule .slideFade'), function(){
	   if($(this).children('img').size() > 1){
		$(this).cycle({
			fx: 'fade',
			random: 1,
			timeout: 1500,
			speed: 6000,
			speedOut:4000,
			height:450
		});
	}
	});
})

$(window).load(function(){
	// Startanimation
	$versatz = $('#slideshowModule').offset();	
	$('#pagewidth').hide();	
	$('.slideFade').fadeIn(1000);
	$('div.slide img').css('display', 'none').ready(function(){ $('div.slide img').fadeIn(600); }); 	
	$('.headline').delay(500).fadeIn(1000, function(){ $('.headline').show() });
	$('.headline').delay(5800).fadeOut(1000, function(){ $('.headline').hide() });
	$('#navigation').delay(8000).slideDown(500,function(){ $('#navigation').show(); });	
	$('#slideshowModule').prependTo('body').offset({ 'left': $versatz.left, 'top': $versatz.top }).css({ 'display': 'none', 'position': 'absolute', 'visibility': '' }).fadeIn(1000);	
	setTimeout(function(){
		$('#pagewidth').fadeIn(5000, function(){
			$('#slideshowModule').prependTo('#contentWrapper').css({ 'left': '', 'top': '', 'position': '' });	
			$('#contentWrapper').css('height', '');
			$('#footer').css('display', '');
			$('#footer .rowTwo').slideDown('slow');                    
			setTimeout(function(){ $('#footer .rowTwo').slideUp('fast'); }, 5000);					
		});
	}, 3000);
	
	// Anklickbarer Footer, nicht Teil der Startanimation	
    $('#footer .rowTwo').hide();
    $('#footer .rowOne').click(function(){
	  if ($sichtbar == 0) {
			$('#footer .rowOne img').attr('src', 'images/pfeil_11_oben_active_10x20.png');
			$sichtbar=1;
			$('#footer .rowTwo').show();
		}
		else {
			$('#footer .rowOne img').attr('src', 'images/pfeil_11_unten_10x20.png')
			$sichtbar=0;
			$('#footer .rowTwo').hide();
		}
    });	
});
