$(function(){
	/**
	 * News Box Links Hover 
	 */
    $(".newsBoxLink").hover(function(){
        $(this).addClass("hover");
    }, function(){
        $(this).removeClass("hover");
    });
    
    /**
     * Footer Slider
     */
	var footerClosed = true;
	
	var footerClosedHeight = $("#footeractive").height();
	
    $('#footeractive .footerToggle').click(function() {
		if (footerClosed) {
			var slideDistance = $("#footerSlider").height() + $("#copyright").height() + "px"
			
			$("#footeractive").animate({
				height: slideDistance
			}, 500);
			$("#page").animate({
				marginBottom: "-" + slideDistance
			}, 500);
			$('#copyright').hide('slow');
			$('.address h4, .dialogue h4, .sitemap h4, .slideNavi').addClass('active');
		} else {
			$("#footeractive").animate({
				height: footerClosedHeight + "px"
			}, 500);
			$("#page").animate({
				marginBottom: -footerClosedHeight + "px"
			}, 500);
			$('#copyright').show('slow');
			$('.address h4, .dialogue h4, .sitemap h4, .slideNavi').removeClass('active');
		}
		
		footerClosed = !footerClosed;
    });

	/**
	 * Search Box
	 */
    $('#search').val('Suchen');
    $("#search").focus(function(){
        if ($('#search').attr("value") == "Suchen") {
            $('#search').attr("value", "");
            $('#search').addClass("active");
            return false;
        }
    });
    $("#search").blur(function(){
        if (($('#search').attr("value") == "") || ($('#search').attr("value") == "Suchen")) {
            $('#search').attr("value", "Suchen");
            $('#search').removeClass("active");
            return false;
        }
    });
    $('.go-btn').click(function(){
        if ($("#search").val() == "Suchen") {
            return false;
        }
        else {
            return true;
        }
    });
	
	/**
	 * Big Slider
	 */
    var startRandom = Math.floor(Math.random() * 4 + 1);
    $('#slider').anythingSlider({
        width: 1017,
        height: 439,
        resizeContents: false,
        startPanel: startRandom,
        hashTags: false,
        buildArrows: true,
        buildNavigation: true,
        navigationFormatter: null,
        forwardText: "&raquo;",
        backText: "&laquo;",
        autoPlay: true,
        startStopped: false,
        pauseOnHover: true,
        resumeOnVideoEnd: true,
        stopAtEnd: false,
        playRtl: false,
        startText: "Start",
        stopText: "Stop",
        delay: 9000,
        animationTime: 800,
        easing: "swing"
    });
	
	/**
	 * News Box Slider
	 */
    $('.newsSlider ul').anythingSlider({
        width: 307,
        height: 106,
        resizeContents: true,
        startPanel: 1,
        hashTags: false,
        buildArrows: true,
        buildNavigation: true,
        navigationFormatter: null,
        forwardText: "&raquo;",
        backText: "&laquo;",
        autoPlay: true,
        startStopped: false,
        pauseOnHover: true,
        resumeOnVideoEnd: true,
        stopAtEnd: false,
        playRtl: false,
        startText: "Start",
        stopText: "Stop",
        delay: 9000,
        animationTime: 675,
        easing: "linear"
    });
});

