    var shown = 'all';
    var statarray = [];
    var ind;
    var is_called = false;
     
    if(window.location.hash) {
        hash = window.location.hash;
        if( hash == "#wettbewerbe-studien" )
            ind = 0;
        else if( hash == "#inplanung-inrealisierung" )
            ind = 1;
        else if( hash == "#realisiert-abgeschlossen" )
            ind = 2;
        else if( hash == "#alle" )
            ind = 3;
        
        $(document).ready(function() {
            $("div#scontent").smoothDivScroll({scrollingSpeed: 12, mouseDownSpeedBooster: 3, autoScroll: "", autoScrollDirection: "endlessloop", autoScrollSpeed: 2, visibleHotSpots: "", hotSpotsVisibleTime: 9, startAtElementId: ""});
            is_called = true;
            myobj = $('li.pstat').eq(ind);
            hideContent(myobj, ind);
        })
    }
    
    function goScroll() {
        $('#scontent').css('color', "white")
        var mywidth = $('#columnized').width() + 200;
        $('.scrollableArea').width(mywidth);
        $("div#scontent").smoothDivScroll({scrollingSpeed: 12, mouseDownSpeedBooster: 3, autoScroll: "", autoScrollDirection: "endlessloop", autoScrollSpeed: 2, visibleHotSpots: "", hotSpotsVisibleTime: 9, startAtElementId: ""});
    }
    
	function hideContent(obj, myIndex) {
        $('li.pstat').removeClass('activestat');
        window.location.hash = obj.attr('id');
        obj.addClass('activestat');
        $('div.section').hide();
        $("div#scontent").smoothDivScroll('restoreOriginalElements');
        if(myIndex == 3) {
            //$('div.section').fadeIn('fast');
            $("div#scontent").smoothDivScroll('restoreOriginalElements');
        } else {
            $('div.section').each(function(){
                myClass = $(this).attr('class');
                myLength = myClass.length;
                if(myClass.charAt(myLength-1) != myIndex) {
                    $(this).detach()
                } 
            })
        }
        $("div#scontent").smoothDivScroll('recalculateScrollableArea');
        $('div.section').show();
	}
	
    $(document).ready(function() {
        
        $('div.section').each(function(){
            //statarray = statarray.push($(this).attr('class'));
            myClass=$(this).attr('class');
            statarray.push(myClass);
         });

        $('li.pstat').click(function(){
            var showIndex = $(this).index();
            hideContent($(this), showIndex);
            
        });
        
        if($('#columnized').length){
            $('li').addClass('dontsplit');
            $('#columnized').columnize({ width: 380,
                height : 320,
                doneFunc : goScroll 
                });
        } else {
            $('#scontent').css('color', "white")
            if(is_called == false)
                $("div#scontent").smoothDivScroll({scrollingSpeed: 12, mouseDownSpeedBooster: 3, autoScroll: "", autoScrollDirection: "endlessloop", autoScrollSpeed: 2, visibleHotSpots: "", hotSpotsVisibleTime: 9, startAtElementId: ""});
        }
    });
