
        var toggle;
        var activeToogle = 7;
        var activeElem = null;
        
    

        var maxToogle = 5;
            function preSetForm(id,preset)
            {
                var input = $("#"+ id);
                input.focus(function(){
                    $(this).addClass("active");
                    if ($(this).attr("value") == preset) 
                        $(this).attr("value", "");
                });
                input.blur(function(){
                    $(this).removeClass("active");
                    if ($(this).attr("value") == "") 
                        $(this).attr("value", preset);
                });
            }
            function modalStart() {
                Cufon.replace('.fancy_title > div');
                preSetForm('ModalUsername','Benutzername');
                preSetForm('ModalPassword','Passwort');
            }
    
            function initKwicks()
            {
                    
                    $('#KwickBox .kwicks').kwicks({
                            max: 600,
                            sticky: true,
                            defaultKwick: 0,
                            spacing:  5
                        });
                    $('#kwick1').click(function(){ window.location.href='aktuell.html'});
                    $('#kwick2').click(function(){ window.location.href='verein.html'});
                    $('#kwick3').click(function(){ window.location.href='arbeitskreise.html'});
                    $('#kwick4').click(function(){ window.location.href='veranstaltungen.html'});
                    $('#kwick5').click(function(){ window.location.href='Lobby.html'});
                    $('#kwick6').click(function(){ window.location.href='Wissenschaft_und_Bildung.html '});
                    $('#kwick7').click(function(){ window.location.href='Marketing.html'});
                    $('#kwick8').click(function(){ window.location.href='kommunikation-und-veranstaltung.html'});
                    
                    $('.kwickFader').css("display","block"); 
            }
            function initLoginBox()
            {
                // -------------------------------------------------------------------                  
                // loginbox
                
                $("a.login").attr("href", "/login-form.php")

                var overlayColor =  '#2c2c2c';
                $("a.login").fancybox({
                    'padding': 0, 
                    'overlayOpacity': 0.2,
                    'overlayColor': overlayColor, 
                    'showCloseButton': false,
                    'frameWidth': 434,
                    'frameHeight': 276,
                    'hideOnContentClick': false,
                    'callbackOnShow': modalStart        
                });
            }
            function initMenu()
            {
                
                  $("ul.sf-menu").supersubs({ 
                        minWidth:    12,   // minimum width of sub-menus in em units 
                        maxWidth:    27,   // maximum width of sub-menus in em units 
                        extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                                           // due to slight rounding differences and font-family 
                    }).superfish();  // call supersubs first, then superfish, so that subs are 
                                     // not display:none when measuring. Call before initialising 
                                     // containing tabs for same reason. 
            }
            function initBanner()
            {
            

            
            // roll up
            $("#bannerRollUp").hover(function() {
                    $("slidemarginleft").show();
                    
                    $("#bannerRollUpFull").fadeToggle();
                }, function() {
                    $("#bannerRollUpFull").fadeToggle();
                });

            }
            function initToggle()
            {
                var LastElem;
                $('.fadeToggle').hide();
                toggle = function()
                 {

                    if (activeElem) activeElem.fadeOut(4000);
                    activeToogle = activeToogle + 1;
                    if (activeToogle > maxToogle)activeToogle = 1;
                    
                    
                    //  alert('#kwickFader'+activeToogle);
                    activeElem = $('#kwickFader'+activeToogle);
                    if (activeElem.length != 0) 
                        activeElem.fadeIn(1000);
                    
                    window.setTimeout("toggle()", 3000);
                    
                 };
               window.setTimeout("toggle()", 3000);
            }
            function initFieldTips()
            {
                $('li.third-item').next()
                $('.formHelp').hide();
                $(".field input").hover(function() {
                    var item = $(this).next();
                    if (item.attr("class")=="formHelp")
                        item.fadeIn();
                    
                }, function() {
                /*  var item = $(this).next();
                    if (item.attr("class")=="formHelp")
                        item.fadeOut();*/
                });
                
            }
            function initSlideBanner () {
                var $active = $('#slideBanner div.active');
                var $next = $active.next();
                if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
            
                var $next =  $active.next().length ? $active.next()
                    : $('#slideBanner DIV:first');
            
                $active.addClass('last-active');
            
                $next.css({opacity: 0.0})
                    .addClass('active')
                    .animate({opacity: 1.0}, 1000, function() {
                        $active.removeClass('active').removeClass('last-active');
                    });
            }
            
            $().ready(function() {
                // -------------------------------------------------------------------                  
                // Prozess
                if ($("#KwickBox").length > 0){ initKwicks();}
                if ($("#bannerRollUp").length > 0){ initBanner();}
                if ($('.fadeToggle').length > 0) { initToggle();}
                if ($('div.toggler').length > 0) { $('div.toggler').toggleElements( ); }
                
                if ($('.formHelp').length > 0) { initFieldTips(); }
                if ($('#slideBanner').length > 0) {setInterval( "initSlideBanner()", 10000 );  }
                
                preSetForm('searchInput','Suchbegriff');
                
                initLoginBox();
                initMenu();
                    
            });
            runCufon();
    
            jQuery.fn.fadeToggle = function(speed, easing, callback) {
               return this.animate({opacity: 'toggle'}, speed, easing, callback);
            }; 
