$(function(){
        if($('#dropdowncatmenu ul').length){
            $('div.menu ul > li a[href$=seats]').after($('#dropdowncatmenu').html().replace(/%7E/ig, '~'));
            $('#dropdowncatmenu').remove();
        }
    
    $('.ti-txt').jScrollPane({scrollbarWidth:7});
    $('.jScrollPaneDrag').css('height', '16px');
    
    
    $("div.menu ul > li").hover(function(){
        $(this).find('div.m-down').css({visibility: "visible"}).show(200);
    },function(){
        $(this).find('div.m-down').css({visibility: "hidden"}).hide();
    });
    
    $('ul.arch li:last').addClass('last');
    
    $('div.cat-v-menu ul > li > a[class~=selected]').next('ul').show(200);
    $('div.cat-v-menu a[href=' + window.location.href + ']').addClass('selected');
    
    $('#subm').click(function(){$('#searchform').submit();});
    
    
    
        if($('div.top-models ul > li').length){
            $('div.top-models ul > li:last').addClass('p2');
            
            $('div.top-models ul > li > div').hover(function(){
                $('> p', this).stop(true, true).animate({'height': 'toggle'}, 'slow');
            },function(){
                $('> p', this).animate({'height': 'toggle'}, 'hide');
            });

            $('div.top-models ul > li > div > p').click(function(){
                window.location.href = $(this).prev().find('a').attr('href');
            });
        }
        

    
    
        if($('ul.catalog2 > li').length){
            $('ul.catalog2 > li.techdescr > a').hover(function(){
                margleft = Math.ceil(Number($('> img', this).width()) / 2);
                $('> img', this).css('margin-left', -margleft).fadeIn();
            }, function(){
                $('> img', this).hide();
            });
            
            
            if($('ul.color > li').length){
                $('ul.color > li > a').click(function(){
                    $('ul.catalog2 > li.photo > a img').attr('src', $(this).attr('rel'));
                    $('ul.catalog2 > li.photo > a').attr('href', $(this).attr('href'));
                    return false;
                });
            }
            
            
            $('a.img-photo').lightBox({
                fixedNavigation:true,
                overlayBgColor: '#000',
                overlayOpacity: 0.7,
                imageLoading: './css/images/lightbox-ico-loading.gif',
                imageBtnClose: './css/images/lightbox-btn-close.gif',
                imageBtnPrev: './css/images/lightbox-btn-prev.gif',
                imageBtnNext: './css/images/lightbox-btn-next.gif',
                imageBlank: './css/images/lightbox-blank.gif',
                containerResizeSpeed: 350,
                txtImage: 'Картинка',
                txtOf: 'из'
            });
            
            
            $('a.image').lightBox({
                fixedNavigation:true,
                overlayBgColor: '#000',
                overlayOpacity: 0.7,
                imageLoading: './css/images/lightbox-ico-loading.gif',
                imageBtnClose: './css/images/lightbox-btn-close.gif',
                imageBtnPrev: './css/images/lightbox-btn-prev.gif',
                imageBtnNext: './css/images/lightbox-btn-next.gif',
                imageBlank: './css/images/lightbox-blank.gif',
                containerResizeSpeed: 350,
                txtImage: 'Картинка',
                txtOf: 'из'
            });
        }

});
