            //fbox
            $(document).ready(function() {
                $("a.fbox").fancybox();
            });
            
            
            //wyrownywanie kontenerow na menu i tresc
            function hidden_height_check()
            {
                $("li#hidden-top").css({'display' : 'none'});
                $("div#content").css("height", "auto");
                $("div#side-menu").css("height", "auto");
                var menu =  $("div#side-menu").height();
                var content = $("div#content-box").height();
                if (menu > content)
                {
                    $('div#side-menu ul li').last().prev().css('margin-bottom', '0px');
                    $("div#content").css({'height' : menu-90});
                    $("li#hidden-top").css({'display' : 'none'});
                } 
                else 
                {
                    if(content - menu < 39)
                        return;
                    $('div#side-menu ul li').last().prev().css('margin-bottom', '5px');
                    $("div#side-menu").css({'height' : content});
                    var ul_height = $("div#side-menu ul").height();
                    var hidden_height = content-menu;
                    $("div#hidden").css({'height' : hidden_height});
                    $("li#hidden-top").css({'display' : 'block'});
                };
            }
            
            //rozwijanie szczegolow wedle schematu div.nazwa div a
            $(document).ready(
            function()
            {
                $("div.czesci a, div.zakres a, div.castrol_nazwa a").click(
                    function()
                    {
                        if($(this).parent().next("div").css("display")!="none")
                        {
                            $(this).parent().next("div").hide();
                            hidden_height_check();
                            return;
                        }
                        $("div.czesci_tresc, div.castrol_tresc, div.zakres_tresc").hide();
                        $(this).parent().next("div").show();
                        hidden_height_check();
                    }
                );
            });

            //fancybox + youtube
            $(document).ready(
            function()
            {
            $(".yt").click(function() {
            $.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
            return false;});
            });
            
            //rozwijanie szczegulow produktow webasto
            $(document).ready(
            function()
            {
                $(".t100").click(
                    function()
                    {
                        $("#webastodetails div").hide();
                        if($('#t100').css("display")=="none")
                            $('#t100').show();
                        else
                            $('#t100').hide();
                        hidden_height_check();
                    }
                );
                $(".t91").click(
                    function()
                    {
                        $("#webastodetails div").hide();
                        if($('#t91').css("display")=="none")
                            $('#t91').show();
                        else
                            $('#t91').hide();
                        hidden_height_check();
                    }
                );
                $(".tc").click(
                    function()
                    {
                        $("#webastodetails div").hide();
                        if($('#tc').css("display")=="none")
                            $('#tc').show();
                        else
                            $('#tc').hide();
                        hidden_height_check();
                    }
                );
                $(".kt").click(
                    function()
                    {
                        $("#webastodetails div").hide();
                        if($('#kt').css("display")=="none")
                            $('#kt').show();
                        else
                            $('#kt').hide();
                        hidden_height_check();
                    }
                );
            });
            
            //otwieranie strony castrola w fancyboxie
            $(document).ready(function() {
                $(".popup_window_635").fancybox({
                        'width'				: 635,
                        'height'			: '90%',
                        'autoScale'     	: true,
                        'transitionIn'		: 'none',
                        'transitionOut'		: 'none',
                        'type'				: 'iframe'
                });
                $(".popup_window_1000").fancybox({
                        'width'				: 1000,
                        'height'			: '90%',
                        'autoScale'     	: true,
                        'transitionIn'		: 'none',
                        'transitionOut'		: 'none',
                        'type'				: 'iframe'
                });
            });

            
            //zamykanie bloku informacyjnego
            $(document).ready(function() {
                $("a.close_info").click(
                function()
                {
                    $(this).parent("p").hide();
                    hidden_height_check();
                });
            });
            
            // pokazywanie/chowanie ukrytego bloku
            $(document).ready(function() {
                $(".show_next_div").click(
                function()
                {
                    if($(this).next(".hide").css("display")=="none")
                        $(this).next(".hide").show();
                    else
                        $(this).next(".hide").hide();
                    hidden_height_check();
                });
            });
            
            //hover obrazkow w menu glownym
            $(document).ready(
            function()
            {
                $('ul#menu li img').imghover({suffix: '_k', fade: true, fadeSpeed: 250});
            });
            
            $(window).load(function()
            {
                hidden_height_check();
            });
	    
	    //pokazanie pierwszego schowanego kontenera
	    
	    $(document).ready(
		function()
		{
		    $("#zakresbox #mechanika").next(".zakres_tresc").show();
		}
	    )
