// Downloadbox
function init_DownloadList(){

    $(".download_list li a.download_opener").removeAttr('href');

    $(".download_list li").click( function(){
        $('span.download_info',this).slideToggle(300);
        $(this).toggleClass('clicked');
    });

    $(".download_list a.download").mouseover( function(){
        $(this).parents('li').eq(0).unbind("click");
    });

    $(".download_list a.download").mouseout( function(){
        $(this).parents('li').eq(0).bind("click", function(){
            $('span.download_info',this).slideToggle(300);
            $(this).toggleClass('clicked');
        });
    });
}

$(function () {

    $('#nav1 ul:first').children('li:gt(2)').addClass('bottom');
    $("#nav1 a:contains('Unternehmenssteuerung')").html('Unternehmens-steuerung');

    $('#template_4 h1').nextUntil('.hr, h1').each(function(){
    	var $this = $(this);
    	if ($this.is('.projekt_content')) {
    		$this.hide();
    	}
    });
    
    //$('#template_4 h1:first').addClass('open').nextUntil('.hr, h1').show();

    $('#template_4 h1').click(function() {

        var open = $(this).is('.open');

        $('#template_4 h1').removeClass('open');
        $('#template_4 h1').nextUntil('.hr, h1').each(function(){
        	var $this = $(this);
        	if ($this.is('.projekt_content:not(:hidden)')) {
        		$this.hide();
        	}
        });
        
        if (!open) {
            $(this).addClass('open');
            $(this).nextUntil('.hr, h1').show();
        }
    });

	var h = window.location.host.toLowerCase();
	$("a[href^='http']:not(a[href^='http://" + h + "']):not(a[href^='http://www." + h + "']), a[href$='.pdf']").attr("target", "_blank");

});
