
(function ($) {
    Drupal.behaviors.stk = {
        attach: function(context,settings) {
            // Sidebar einfliegen
            first_value = ""+$("#sidebar_first").css('margin-left');


            $("#sidebar_first").mouseenter(function(){


                $(this).stop().animate(
                {
                    "margin-left":"0"
                }
                );
            });

            $("#sidebar_first").mouseleave(function(){

                $(this)//.find('.block')
                .stop().animate(
                {
                    "margin-left":first_value
                }
                );
            });

            second_value = ""+$("#sidebar_second").outerWidth();


            $("#sidebar_second_wrapper").mouseenter(function(){


                $(this).stop().animate(
                {
                    "width":second_value
                }
                );
            });

            $("#sidebar_second_wrapper").mouseleave(function(){

                $(this)//.find('.block')
                .stop().animate(
                {
                    "width":30
                }
                );
            });


            small=26;
            big=54;
                                       
            if(!($.browser.safari && $.browser.version.slice(0,3) <= 530)){
                //Menu animation
                $("#menu").mouseleave(function(){
                    //$("#menu li.active").children('a,span').animate({height:'200%'});
                    $("#menu li.active-trail").animate({height:big});
                });
                $('#menu').mouseleave();     
                $("#menu li").mouseenter(function(){
                    //$(this).siblings('li').children('a,span').stop().animate({height:'100%'});
                    $(this).siblings('li').stop().animate({height:small});

                    //  $(this).children('a,span').stop().animate({height:'200%'}); 
                    $(this).stop().animate({height:big}); 

                    /**/ 
                });

                $("#menu li").mouseleave(function(){
                    if(!$(this).hasClass('active-trail')){
                        //$(this).children('a,span').stop().animate({height:'100%'});
                        $(this).stop().animate({'height':small});
                    }
                });  
            } else {
                  $("#menu li.active-trail").animate({height:big}); 
            }
        }
    }
})(jQuery);
;

