$(document).ready(function() {

    
    $('#laden').fadeOut("slow");
    
    // Impressum hin und her
    function impressum(){
    var groesse = $("#impressum").css("top"); 
        groesse = groesse.replace("px", "");
        $('#impressum').animate({
            marginLeft: "-100px",
            top: parseInt(groesse)+parseInt(15)
        }, 4000, "linear", function() {
            $('#impressum').animate({
                marginLeft: "-200px",
                top: parseInt(groesse)-parseInt(10)
            }, 1500, "linear", function() {
                $('#impressum').animate({
                    marginLeft: "-400px",
                    top: parseInt(groesse)+parseInt(155)
                }, 1500, "linear", function() {
                            $('#impressum').css("background-position", "top right");
                    $('#impressum').animate({
                        marginLeft: "-200px",
                        top: parseInt(groesse)-parseInt(5)
                    }, 2000, "linear", function() {
                        $('#impressum').animate({
                            marginLeft: "100px",
                            top: parseInt(groesse)-parseInt(5)
                        }, 3000, "linear", function() {
                            $('#impressum').animate({
                                marginLeft: "150px",
                                top: parseInt(groesse)+parseInt(155)
                            }, 1500, "linear", function() {
                                $('#impressum').css("background-position", "top left");
                            });
                                $('#impressum').animate({
                                    marginLeft: "200px",
                                    top: parseInt(groesse)
                                }, 1500, "linear", function() {
                                    impressum();    
                                });                            
                        });
                    });
                });
            });
        }); 
    }
    impressum();
    
    
    function welle(){     
        $('.welle1').each(function() {
            $(this).animate({
                backgroundPosition: "-20px 0px"
            }, 1500, "linear", function() {});
            $(this).animate({
                backgroundPosition: "0px 0px"
            }, 1500, "linear", function() { welle(); });
        });
        
        $('.welle2').each(function() {
            $(this).animate({
                backgroundPosition: "20px 0px"
            }, 1500, "linear", function() {});
            $(this).animate({
                backgroundPosition: "0px 0px"
            }, 1500, "linear", function() { welle(); });
        });        
    }
    welle();
});

