$().ready(function() {

    //Startseite
        //Welcome
            $('#welcome').click(function(){ $(this).hide('slow'); });
            $('#logo').mouseover(function(){
                $('#welcome').show('slow');
            });
        
        //Startbox
            //ani imgs and text-switch function
            $('#images').cycle({
                fx:         'fade',
                speed:      1100, 
                timeout:    10000,
                before:     function(){
                                pic = $('#images img').index($(this));
                                clicked = $('#text ul li:eq('+pic+')');
                                $('#text ul li').stop().animate({
                                    opacity: 0.5,
                                    height: 50
                                    }, 500
                                );
                                clicked.stop().animate({
                                        height: 300,
                                        opacity: 1
                                    }, 500, function(){
                                        clicked.siblings().stop().animate({
                                            opacity: .9
                                        },100
                                    )
                                });
                                clicked.find("h2").addClass('active');
                                tabactions();
                            }, 
                pager:      '#nav',
                pause:      1
            });
            //tell slide-element to pause when mouse hovers text-block
            $('#text').hover(
                function(){
                    $('#images').cycle('pause');
                },
                function(){
                    $('#images').cycle('resume');
                }
            );
            
            //Ani List
            function tabactions(){
                $('#text ul li h2').unbind('click').click(function(){
                    $('#welcome').hide('slow');
                    pos = $('#text li').index($(this).parent());
                    $('#nav a:eq('+pos+')').trigger('click');   
                });
                
                $('#text ul li h2.active').click(function(){
                    document.location.href = $(this).parent().find('a').attr('href');
                }).removeClass('active');  
            }


//ready function    
});

