
try {
$(document).ready(function(){
    

    
    $('*').click( function() {
        if(topmenuIsOpen) {
            $('div#contentcontainer div.menumain-subitems').remove();
            topmenuIsOpen = false;
            return false;
        }
    });

    $('.newsframe > div').hover(
        function() {
            $(this).css('background', '#96C0E3 url(gfx/newsframe.png) scroll repeat');
        },
        function() {
            $(this).css('background', 'transparent none');
        }
    );
    
    
    $('div.newsframe > div').click( function() {
        var news = $('div', this)
        $('div.newsshow').empty();
        $('div.newsshow').append(news.html());
    });
    
    
    
    var topmenuIsOpen = false;
    
    $('#menumaincontent > div').hover(
        function() {
            $(this).css('background', '#96C0E3 url(gfx/lightbluebg.png) scroll repeat');
        },
        function() {
            $(this).css('background', 'transparent none');
        }
    );
    

    
    $('div#menumaincontent div').click( function(){
        $('div#contentcontainer div.menumain-subitems').remove();
        var xpos = $(this).offset( ).left;
        var items = $('div', this).html();
        if( items != null ) {
            $('div#contentcontainer').append('<div class="menumain-subitems" style="display:none; left:'+(xpos-273)+'px">'+items+'</div>');

            $('div.menumain-subitems').slideDown('fast');
            $('div.menumain-subitems a').fadeOut(0);
            $('div.menumain-subitems a').fadeIn('fast');
            $('div.menumain-subitems a').click( function(){
                $('div#contentcontainer div.menumain-subitems').remove();
            });
            
            $('div.menumain-subitems a').hover(
                function() {
                    $(this).css('background-color', '#eeeeee');
                },
                function() {
                   $(this).css('background-color', 'transparent');
                }
            );
            
            topmenuIsOpen = true;
            return false;
        }
    });
    
    
    
    var quickLinkIsOpen;
    if($('#sidebarquiklinks').hasClass('open')) {
        $('div#sidebarheader a.quicklinklogo').addClass('minus');
        $('#sidebarcontent').hide();
        $('#sidebarquiklinks').css('height','auto');
        $('#sidebarquiklinks').show();
        $('div#sidebarsearchshadow').hide();
        $('body').css('background', 'transparent url(gfx/bg-dark.png) scroll repeat-y');
        quickLinkIsOpen = true;
    }
    else {
        $('div#sidebarheader a.quicklinklogo').addClass('plus');
        $('#sidebarcontent').show();
        $('#sidebarquiklinks').hide();
        quickLinkIsOpen = false;
    }
    
    /**
     * aufrollen und einrollen der Quicklinkleiste
     */
    $('a.quicklink, a.quicklinklogo').click(
        function() {
            var offset = 240;
            if(quickLinkIsOpen) {
                quickLinkIsOpen = false;
                $('body').css('background', 'transparent url(gfx/bg-light.png) scroll repeat-y');
	            $('#sidebarcontent').fadeIn('slow');
                $('#sidebarquiklinks > div').fadeOut('slow')
                $('div#sidebarsearchshadow').show();
                $('#sidebarquiklinks').css('height',($(window).height()-offset)+'px');
                $('#sidebarquiklinks').animate({ 
                    height: '0px'
                },'slow',function(){
                    $('div#sidebarheader a.quicklinklogo').removeClass('minus').addClass('plus');
                    
                });

                
            } else {
                quickLinkIsOpen = true;
                var h = ($(window).height()-offset);
                $('#sidebarcontent').fadeOut('slow');
                $('#sidebarquiklinks > div').fadeIn('slow');
                $('#sidebarquiklinks').animate({ 
                        height: h + "px"
                    },'slow' , function(){
                        $('div#sidebarsearchshadow').hide();
                        $('body').css('background', 'transparent url(gfx/bg-dark.png) scroll repeat-y');
                        $('#sidebarquiklinks').css('height','auto');
                    }
                );
                $('div#sidebarheader a.quicklinklogo').removeClass('plus').addClass('minus');
            }
        }
    );
    
    
    
    $('#seachform input.seachform-text').hover( 
        function() {
            if( $.trim($('#seachform input.seachform-text').val()) == 'Volltextsuche' )
                $('#seachform input.seachform-text').val('');
            $('#seachform input.seachform-text').removeClass('nofocus').addClass('focus');
        },
        function() {
            if($.trim($('#seachform input.seachform-text').val()).length < 1)
                $('#seachform input.seachform-text').val('Volltextsuche');
            $('#seachform input.seachform-text').removeClass('focus').addClass('nofocus');
        }
    );
    
});
} catch(e) {

}
