// JavaScript Document

$(document).ready(function() {
    if(jQuery.browser.msie) {
        $('#subMenu li').hover(
            function() {
                $(this).addClass('hover');
            },
            function() {
                $(this).removeClass('hover');
            }
        );
    }
    if(jQuery.browser.msie) {
        $('#mainMenu li').hover(
            function() {
                $(this).addClass('hover');
            },
            function() {
                $(this).removeClass('hover');
            }
        );
        $('.catList').hover (
			function() {
                $(this).addClass('hover');
            },
            function() {
                $(this).removeClass('hover');
            }
		)
    }
    $('a[class*=external]').attr('target', '_blank');
	$('li[class*=external] a').attr('target', '_blank');
    
    lastActive = null;
    
    if ($('#slider').length > 0) {
        $('#slider > li').each(function() {
            var _l = 0;
            $(this).prevAll().each(function() {
                _l += $(this).outerWidth(true);
            });
            $(this).css('left', _l);
        });
        $('#slider > li').css('position', 'absolute');
        
        $('#slider li a').hover(
            function(e) {
                $('#bigbox').children('div').hide();
                $('#bigbox #' + $(this).attr('rel')).show();
            },
            function() {}
        );
        
        $('#slider > li').hover(
            function() {
                if (lastActive == this)
                    return;
                if(lastActive != null)
                    $(lastActive).bb_zoomOut();
                
                $(this).bb_zoomIn();
                lastActive = this;
            },
            function() {}
        );
        lastActive = $('#slider > li.active');
        $('#slider > li.active').mouseover();
        $('#bigbox').hover(
            function() {},
            function() {
                if ($(lastActive).hasClass('active'))
                    return;
                $(lastActive).bb_zoomOut();
                
                $('#bigbox').children('div').hide();
                $('#bigbox #' + $('#slider > li.active').find('a').eq(0).attr('rel')).show();
                
                $('#slider > li.active').mouseover();
                lastActive = $('#slider > li.active');
            }
        );
    }
    
    $('#show').click(function(){
			$('div#slider').slideToggle("slow");
			});
	$('#show2').click(function(){
			$('div#slider2').slideToggle("slow");
			});

	
	$(".studioMenuEbene1").mouseover(function(){ 
		$(".studioMenuEbene2").show(100);
	});
	
	$(".studioMenuEbene2 > li > a").mouseover(function(){ 
		$(".studioMenuEbene3").hide(0);
		$(this).siblings(".studioMenuEbene3").show(0);
	});
	
	$(".studioMenuEbene1").bind('mouseleave', function(){ 
        $(".studioMenuEbene3").hide(0);
		$(".studioMenuEbene2").hide(100);
	});
	
	
   
});





(function($) {
    
    $.fn.bb_zoomIn = function() {
        return $(this).each(function() {
            var box = $(this).find('.smallbox');
            var logo = $(this).find('.logo');
            var list = $(this).find('ul');
            
            logo.attr('src', logo.attr('src').replace('small', 'big'));
            logo.width(77);
            logo.height(26);
            
            if(list.length > 0)
                lTop = 10;
            else
                lTop = 25;
            
            box.attr('src', box.attr('src').replace('smallbox', 'bigbox'));
            box.width(120);
            box.height(84);
            box.css({
                'left': - 15,
                'position' : 'absolute'
            });
            box.parents('li').css('z-index', 5);
            box.parents('li').siblings('li').css('z-index', 1);
            box.stop().animate({
               'width' : 180,
               'height' :  131,
               'left' : -45,
               'top' : -15
            }, 100);
            logo.stop().animate({
                'width' : 115,
                'height' : 45,
                'top' : 10,
                'left' : -12
            }, 100, 'linear',
                function() {
                    if(list.length > 0)
                        list.show();
                }
            );
        });
    }
    
    $.fn.bb_zoomOut = function() {
        var boxo = $(this).find('.smallbox');
        var logoo = $(this).find('.logo');
        var listo = $(this).find('ul');
        if(listo.length > 0)
            listo.hide();
        
        logoo.stop().animate({
            'width' : 77,
            'height' : 26,
            'top' : 25,
            'left' : 5
        }, 100);
        
        boxo.stop().animate({
           'width' : 120,
           'height' :  84,
           'left' : -15,
           'top' : 0
        }, 100, 'linear',
            function() {
                boxo.css({
                    'left': 0,
                    'position' : 'absolute'
                });
                boxo.width(88);
                boxo.height(87);
                boxo.attr('src', boxo.attr('src').replace('bigbox', 'smallbox'));
                
                logoo.attr('src', logoo.attr('src').replace('big', 'small'));
            }
        );
    }
        
})(jQuery);








