$(document).ready(function(){

            Cufon.replace('#menu li',{hover: true});
            Cufon.replace('#s-menu li.li a[href="#"]',{hover: true});
            Cufon.replace('#text-head h1',{hover: true});
            Cufon.replace('#kontakt-head h1',{hover: true});
            Cufon.replace('#download-head h1',{hover: true});
            Cufon.replace('.db-head h1',{hover: true});
            Cufon.replace('.oferta-head h1',{hover: true});
            Cufon.replace('#oferta-head h1',{hover: true});
            Cufon.replace('#news-head h1',{hover: true});
            Cufon.replace('h2',{hover: true});
            Cufon.replace('.ob-prod h3',{hover: true});
            Cufon.replace('ul.lof-navigator',{hover: true, color: '#333333'});
            Cufon.replace('.active p',{hover: true,color: '#fff'});

            $('ul.lof-navigator li').hover(function(){
                var obj1 = $(this);
                Cufon.replace(obj1,{hover:true,color:'#fff'});
            },function(){
                var obj1 = $(this);
//                alert(obj);
                Cufon.replace(obj1,{hover:true,color:'#333333'});
            });

            $('#menu li').hover(function(){
                var obj = $(this).find('a');
                Cufon.replace(obj,{hover:true,color:'#cd0000'});
            },function(){
                var obj = $(this).find('a');
//                alert(obj);
                Cufon.replace(obj,{hover:true,color:'#333333'});
            });

            $('.foto a').lightBox();
            $('#galeria a').lightBox();
            $('.nb-img a').lightBox();
            $('.nb-main a.a').lightBox();

            $('#forma').validate({
                rules:
                {
                    name: "required",
                    sub: "required",
                    mail:
                    {
                        required: true,
                        email: true
                    },
                    msg: "required"
                },
                messages:
                {
                    name: "{$lang.vname}",
                    sub: "{$lang.vphone}",
                    mail: {
                        required: "{$lang.vmail}",
                        email: "{$lang.vmail1}"
                    },
                    msg: "{$lang.vmsg}"
                }
            });

            //When page loads...
            $(".tab_content").hide(); //Hide all content
            $("ul.tabs li:first").addClass("active").show(); //Activate first tab
            $(".tab_content:first").show(); //Show first tab content

            //On Click Event
            $("ul.tabs li").click(function() {

                    $("ul.tabs li").removeClass("active"); //Remove any "active" class
                    $(this).addClass("active"); //Add "active" class to selected tab
                    $(".tab_content").hide(); //Hide all tab content

                    var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
                    $(activeTab).fadeIn(); //Fade in the active ID content
                    return false;
            });

            $('.nb-main a').click(function(){
                var v = $(this).text();
//                alert("."+v+".");
                if( (v == 'więcej...') || (v == 'more...') || (v == 'mehr...') )
                    {
                        var aq = $(this).attr('class');
//                        alert(aq);
                        $('.s-'+aq).slideUp();
                        $(this).css('display','none');
                        $('.c-'+aq).slideDown();
                        $('.nb-main a[name="a'+aq+'"]').css('display','block');
                    }
                else if( (v == 'zwiń...') || (v == 'collapse...') || (v == 'zusammenbruch...') )
                    {
                        var aq = $(this).attr('class');
                        $('.c-'+aq).slideUp();
                        $('.nb-main a[name="a'+aq+'"]').css('display','none');
                        $(this).css('display','none');
                        $('.s-'+aq).slideDown();
                        $('.nb-main a[name="b'+aq+'"]').css('display','block');
                    }
            });

            $('.db-head span').click(function(){
                var s = $(this).text();
//                alert(s);

                if( s == '{$lang.more2}'  )
                    {
                        var sq = $(this).attr('name');
//                        alert(sq);

                        $('.db-main[name="d'+sq+'"]').slideDown();
                        $(this).text('{$lang.more3}');
                    }
                else if( s == '{$lang.more3}' )
                {
                    var sq = $(this).attr('name');
//                        alert(sq);

                        $('.db-main[name="d'+sq+'"]').slideUp();
                        $(this).text('{$lang.more2}');
                }
            });

            $('.ob-pr li a').hover(function(){
                var pr = $(this).attr('class');
//                alert(pr);
                $('div.'+pr).show();
            },function(){
                var pr = $(this).attr('class');
                $('div.'+pr).hide();
            });

            $('.oferta-head span').click(function(){
                var sqq = $(this).text();
//                alert(sqq);
                if( sqq == '{$lang.more2}'  )
                    {
                        var sq1 = $(this).attr('name');
//                        alert(sq1);

                        $('.ob-main[id="'+sq1+'"]').slideDown();
                        $(this).text('{$lang.more3}');
                    }
                else if( sqq == '{$lang.more3}' )
                {
                    var sq1 = $(this).attr('name');
//                        alert(sq);
                        $('.ob-main[id="'+sq1+'"]').slideUp();
                        $(this).text('{$lang.more2}');
                }
            });

            var cu = 0;
            $('#s-menu li a[href="#"]').click(function(){
                if( cu == 0)
                {
                    var cl = $(this).attr('class');
//                    alert(cl);
                    $('div#'+cl).show();
                    cu = 1;
                }
                else
                {
                    var cl = $(this).attr('class');
//                    alert(cl);
                    $('div#'+cl).hide();
                    cu = 0;
                }
            });

            var lo = 0;
            $('#om-left h3').click(function(){
                var po = $(this).attr('class');
//                alert(po);
                if( lo == 0)
                {
                    $('div#'+po).slideDown();
                    lo = 1;
                }
                else
                {
                    $('div#'+po).slideUp();
                    lo = 0;
                }
            });


        });
