$(document).ready(function(){
    //Mouseover at head for Mainmenu
    $('.header-inner li').hover(function() {$(this).stop().animate({
                         backgroundPosition: '(50% 0)'
                 });
    }, function() {$(this).stop().animate({
                         backgroundPosition: '(50% -10)'
                 });
    });

    //Mouseover for agency
    $('#buagentur').hover(function() {$('#agentur').stop().attr("src","img/grundriss_mo.png")
    }, function() {$('#agentur').stop().attr("src","img/grundriss.png")});


    //blur the images at projectdetails
    $('.sonstiges img').css({opacity: 0.5});
    //hoverfunction for the images to return to normal at mouseover
    $('.sonstiges img').hover(function() {$(this).stop().animate({
                         opacity: 1.0
                 });
    }, function() {$(this).stop().animate({
                         opacity: 0.5
                 });
    });
    
    //close newsletter at start
    $('.newsletter').slideToggle(1);
    //toggle newsletter open
    $(".site-newl").click(function(){
        $(".newsletter").slideToggle(1000);
    });

    //close the sitemap at start
    $('.sitemap').slideToggle(1);
    //clickfunction for the footerbutton to open the sitemap
    $(".site-bu").click(function(){
        $(".sitemap").slideToggle(1000);
        if($('.site-bu img').attr("src") == "img/footer_pfeil_s.gif"){
            $('.site-bu img').attr("src","img/footer_pfeil.gif");
        } else {
            $('.site-bu img').attr("src","img/footer_pfeil_s.gif");
        }
    });

    //close customerlist at start
    $('.kundenliste').slideToggle(1);
    //clickfuntion to open customerlist
    $(".kunden-bu").click(function(){
        $(".kundenliste").slideToggle(1000);
    });

    //set different content to 0 opacity and fade it in if cal
    $('div.slideshow').css({opacity: 0.0});
    $('div.slideshow').animate({opacity: 1.0}, 3000);

    $('div.content').css({opacity: 0.0});
    $('div.content').animate({opacity: 1.0}, 1000);

    $('div.blogbeitrag').css({opacity: 0.0});
    $('div.blogbeitrag').animate({opacity: 1.0}, 1000);

    $('div.projektdetails').css({opacity: 0.0});
    $('div.projektdetails').animate({opacity: 1.0}, 1000);

    $('div.projekt').css({opacity: 0.0});
    $('div.projekt').animate({opacity: 1.0}, 1000);

    $('.projekt .tipp').css({opacity: 0.0});

    //show tips of projects on mouseover
    $('.tipp').hover(function() {$(this).stop().animate({
                         opacity: 1.0
                 }, 300);
    }, function() {$(this).stop().animate({
                         opacity: 0.0
                 }, 1000);
    });
    
    //newsletter label for input
    var $inputControl = $(".beschriftung>input");
    $inputControl.each(function (index, domElement) { /*@cc_on if (document.documentMode && document.documentMode >= 8) @*/ if ($(this).parent().css("display") == "inline") $(this).parent().css("display", "block"); if (!$(this).val()) $(this).parent().children("label").show(); });
    $inputControl.bind("focus", function(event) { $(this).parent().children("label").hide(); }); $inputControl.bind("blur", function(event) { if (!$(this).val()) $(this).parent().children("label").show(); });

});

