<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var screen=2;

function filterPopUp(){
    $('.sOptionsList li').click(function(){
        $('.sOptionsList li').removeClass('activeOption');
        sp = $(this).data('search-param');
        $(this).addClass('activeOption');
        $('input[name="p"]').attr('value',sp);
        localStorage.setItem("setSearch", sp);
        $('.currentSOption').html($(this).html());
        $('.sOptionsList').css('display','none');
    })

    $('.currentSOption').click(function(){
        if($('.sOptionsList').css('display')=='block'){
            $('.sOptionsList').css('display','none');
        } else {
            $('.sOptionsList').css('display','block');
        }
    })
}

/*  new search  */

function markshover()
{
    $(".makr").each(function()
        {
            $(this).bind("mouseenter", function() {
                //alert($(this).attr("rel"));
                $(this).attr("src",pictavtmarcs[$(this).attr("rel")+1]);

            });

            $(this).bind("mouseleave", function() {
                $(this).attr("src",pictavtmarcs[$(this).attr("rel")+1]);

            });

    });


    if (window.innerWidth&lt;1270){
        screen=1;
        $(".b1").each(function()
            {
                $(this).css("margin","0 0.2%");
        });

        $(".rightpart_mini").each(function()
            {
                $(this).css("margin-right","9px");
        });

        $(".noend").each(function()
            {
                $(this).css("margin","0 12px 12px 0");
                $(this).css("width","130px");
        });

        $(".end").each(function()
            {
                $(this).css("margin","0 0px 12px 0");
                $(this).css("width","130px");
        });

    }

    $(window).resize(function(){
        if (window.innerWidth&gt;1270)
        {
            if (screen==1) {
                screen=2;
                $(".b1").each(function()
                    {
                        $(this).css("margin","0 2.7%");
                });

                $(".rightpart_mini").each(function()
                    {
                        $(this).css("margin-right","48px");
                });

                $(".noend").each(function()
                    {
                        $(this).css("margin","0 56px 12px 0");
                        $(this).css("width","130px");
                });

                $(".end").each(function()
                    {
                        $(this).css("margin","0 0px 12px 0");
                        $(this).css("width","130px");
                });

            }

        }
        else
        {

            if (screen==2) {
                $(".b1").each(function()
                    {
                        $(this).css("margin","0 0.2%");
                });

                $(".rightpart_mini").each(function()
                    {
                        $(this).css("margin-right","9px");
                });

                $(".noend").each(function()
                    {
                        $(this).css("margin","0 12px 12px 0");
                        $(this).css("width","130px");
                });

                $(".end").each(function()
                    {
                        $(this).css("margin","0 0px 12px 0");
                        $(this).css("width","130px");
                });
                screen=1;


            }
        }
        // alert('Р&nbsp;Р°Р·РјРµСЂС‹ РѕРєРЅР° Р±СЂР°СѓР·РµСЂР° РёР·РјРµРЅРµРЅС‹.');
    });
}

function hidemainbanners(){
    $("#header").animate({height: "154px"});
    $("#show_banners").show();
    $("#hide_banners").hide();
    //   setCookie("mbanners","hide");
    setCookie("mbanners","hide",'','/', 'autobody.ru','');
    //  $.cookie("mbanners","hide" , { expires: 1 });
}

function showmainbanners(){
    $("#header").animate({height: "326px"});
    $("#show_banners").hide();
    $("#hide_banners").show();
    //  $.cookie("mbanners","show" , { expires: 1 });
    setCookie("mbanners","show", '','/', 'autobody.ru','');

}


function setCookie(name, value, expires, path, domain, secure){
    document.cookie =
    name +"=" + escape(value) +
    ((expires) ? "; expires="  + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "")
}




function submitForm(id){
    $("#"+id).submit();
    return false;
}

//РІС‹РІРѕРґРёРј СЃРѕРѕР±С‰РµРЅРёРµ РѕР± РѕС‡РёСЃС‚РєРµ РєРѕСЂР·РёРЅС‹ РїРµСЂРµРґ СЃРјРµРЅРѕР№ СЃРєР»Р°РґР°
function before_wh_change(param, cur_wh){

    if(confirm("Р’РЅРёРјР°РЅРёРµ! РџСЂРё СЃРјРµРЅРµ СЃРєР»Р°РґР° РІСЃРµ С‚РѕРІР°СЂС‹ РёР· РєРѕСЂР·РёРЅС‹ Р±СѓРґСѓС‚ СѓРґР°Р»РµРЅС‹! РџСЂРѕРґРѕР»Р¶РёС‚СЊ?")){
        set_url(param);
    }
    else {
        //РІРѕР·РІСЂР°С‰Р°РµРј РІС‹Р±СЂР°РЅРЅС‹Рµ СЂР°РЅРµРµ СЃРєР»Р°Рґ
        $("#warehouse option").each(function(){
            // alert(this.value);
            if (this.value == cur_wh) {
                // alert(this.value);
                $(this).attr("selected", "selected");
                //  $(this).click();
            }
            else { }
        })

        return false;
    }
}

//РїСЂРѕРІРµСЂРєР° РєРѕР»РёС‡РµСЃС‚РІР° С‚РѕРІР°СЂРѕРІ РїСЂРё РґРѕР±Р°РІР»РµРЅРёРё РІ РєРѕСЂР·РёРЅСѓ РІРѕ РІСЃРїР»С‹РІР°СЋС‰РµРј РѕРєРЅРµ
$(function(){
    // $("#qw").css("disabled","disabled")

    $("#qw").keyup(function(){
        $("#qw").attr("value", $("#qw").attr("value").replace(/\D+/,'') );
        if ( Number($('#qw').val()) &lt; 1) {
            $('#qw').val(1) ;
        }
        if (Number($('#qw').val()) &lt; Number($('#catqwm').html())) {}
        else {$('#qw').val(Number($('#catqwm').html()))}

        $("#qw").attr("value", parseInt($("#qw").attr("value")));
    })
})

function deleteFavoriteFromPublic(obj){
    $(obj).data('delete-el', '');
    $(obj).css('background-position', '0 0');

}

function deleteFavoriteFromPopUp(obj){
    var parentTR = $(obj).parent().parent();
    parentTR.css('opacity',0);
    setTimeout(function(){
        parentTR.remove();
    },400);
}



///РЅРѕРІС‹Р№ РєР°С‚Р°Р»РѕРі
$(function(){
    ////////////////РїРµСЂРµРєР»СЋС‡РµРЅРёРµ С‡РµРєР±РѕРєСЃРѕРІ РІ РєР°С‚Р°Р»РѕРіРµ
    $(".cbox").click(function(){
        if ($(this).hasClass("cbox_c")) {$(this).removeClass("cbox_c")}
        else {{$(this).addClass("cbox_c")}}
    })

    /*---Subscribe on items not in stock---*/
    $(".item_sub_button").click(function(){
        if($(this).siblings(".item_sub_form_container").hasClass("active_sub_form")){
            $(".item_sub_form_container").removeClass("active_sub_form");
        } else {
            $(".item_sub_form_container").removeClass("active_sub_form");
            $(this).siblings(".item_sub_form_container").toggleClass("active_sub_form");
        }
    })

    /*if($(".submit_subscribe_form")){
        $(".submit_subscribe_form").click(function(e){
            e.preventDefault();
            var clickedButton = $(this);
            $.post("/ajax/subscribe/manage_subscribe.php",
            {
                item_id : $(this).siblings("input[name='item_id']").val(),
                user_id : $(this).siblings("input[name='user_id']").val(),
                quantity : $(this).parent().find("input[name='quantity']").val(),
                warehouse : $(this).siblings("input[name='warehouse']").val(),
            }
            , function(data){
                if(data){
                    if(clickedButton.parent().hasClass("item_sub_form_container")){ // --- from detail page
                        clickedButton.parent().addClass("already_cubscribed");
                        clickedButton.parent().attr("style","left: -315px !important");
                        clickedButton.parent().html("РЎРїР°СЃРёР±Рѕ. РњС‹ СѓРІРµРґРѕРјРёРј РІР°СЃ Рѕ РїРѕСЃС‚СѓРїР»РµРЅРёРё.");
                    } else { // --- from list

                    }
                }
               });
        })
    }*/

    $(document).on("click",".submit_subscribe_form",function(e){
        e.preventDefault();
            var clickedButton = $(this);
            $.post("/ajax/subscribe/manage_subscribe.php",
            {
                item_id : $(this).siblings("input[name='item_id']").val(),
                user_id : $(this).siblings("input[name='user_id']").val(),
                quantity : $(this).parent().find("input[name='quantity']").val(),
                warehouse : $(this).siblings("input[name='warehouse']").val(),
            }
            , function(data){
                if(data){
                    if(clickedButton.parent().hasClass("item_sub_form_container")){ // --- from detail page
                        clickedButton.parent().addClass("already_cubscribed");
                        clickedButton.parent().attr("style","left: -315px !important");
                        clickedButton.parent().html("РЎРїР°СЃРёР±Рѕ. РњС‹ СѓРІРµРґРѕРјРёРј РІР°СЃ Рѕ РїРѕСЃС‚СѓРїР»РµРЅРёРё.");
                    } else { // --- from list
                        var whID = clickedButton.siblings("input[name='warehouse']").val();
                        clickedButton.closest(".popup_subscribe").siblings(".wh_popup_table").find("div[data-wh-id='"+whID+"']").data("already-subscribed",1);
                        clickedButton.closest(".subscribe_data").css("display","none");
                        clickedButton.closest(".subscribe_data").siblings(".already_subscribed").css("display","block");
                        clickedButton.closest(".subscribe_data").siblings(".already_subscribed").text("РЎРїР°СЃРёР±Рѕ. РњС‹ СѓРІРµРґРѕРјРёРј РІР°СЃ Рѕ РїРѕСЃС‚СѓРїР»РµРЅРёРё.");
                    }
                }
               });
    })

    $(document).on("click",".warehouses_popup .sub_mail_list",function(e){
        var closestPopup = $(this).closest(".wh_popup_table").siblings(".popup_subscribe");
        if (!$(this).data("already-subscribed")) {

            closestPopup.find(".subscribe_data").css("display", "block");
            closestPopup.find(".already_subscribed").css("display", "none");

            closestPopup.find("b").text($(this).data("wh-name"));
            closestPopup.find("input[name='warehouse']").val($(this).data("wh-id"));
        } else {
            closestPopup.find(".subscribe_data").css("display", "none");
            closestPopup.find(".already_subscribed").css("display", "block");
        }
        $(".popup_subscribe").css("left", "0px");
    })

    $(document).on("click",".close_subscription_popup",function(){
        $(".popup_subscribe").css("left", "333px");
    })


    /*----Favorite functions block----*/
    $("#favorite_slide_headers li").click(function(){
        $(".favorite_headers_bg").toggleClass("slided_header");
        $(".favoritePopupSlide").toggleClass("slideFavorite");
    })

    $(document).on("click",".group_block_inner",function(){
        if($(this).hasClass('active_favorite_group')){
            $(".group_block_inner").removeClass("active_favorite_group");
            $(".favorite_scroll_block").addClass("closed_scroll_block");
        } else {
            $(".group_block_inner").removeClass("active_favorite_group");
            $(".favorite_scroll_block").addClass("closed_scroll_block");
            $(this).addClass("active_favorite_group");
            $(this).parent().next().removeClass("closed_scroll_block");
        }
    })

    $(document).on("click",".close_favorite",function(){
        document.querySelector("#favorite_overlay").classList.toggle("favorite_overlay_active");
    })

    $('.open_favorite_popup').click(function(e) {
        e.preventDefault();
        document.querySelector("#favorite_overlay").classList.toggle("favorite_overlay_active");
    })

    $('.favorite_scroll_block').perfectScrollbar();

    $(document).on("click",'.clear_all_favorite',function(){
        $.post("/ajax/manage_fav.php", {
            delete_all: 'Y'
        }, function(data) {
            //console.log(data);
            $('.favorite_items_table').empty();
            $('.favorite_items_table').append("&lt;tr&gt;&lt;td&gt;&lt;h2&gt;РЈ РІР°СЃ РµС‰Рµ РЅРµС‚ СЌР»РµРјРµРЅС‚РѕРІ РІ РёР·Р±СЂР°РЅРЅРѕРј. РџРµСЂРµР№РґРёС‚Рµ РІ РєР°С‚Р°Р»РѕРі, С‡С‚РѕР±С‹ РґРѕР±Р°РІРёС‚СЊ С‚РѕРІР°СЂС‹ РёР»Рё РіСЂСѓРїРїС‹.&lt;/h2&gt;&lt;/td&gt;&lt;/tr&gt;");
        });
    })

    $(document).on("click",'.manage_favotite',function(){

        var isDelete = $(this).data('delete-el');
        var postId;
        if(isDelete){
            switch($(this).data('action-from')){
                case 'public':
                    deleteFavoriteFromPublic(this);
                    break;
                case 'popup':
                    deleteFavoriteFromPopUp(this);
                    break;
            }

            if($(this).prev().hasClass('sub_adding')){
                $(this).prev().text("Р”РѕР±Р°РІРёС‚СЊ РІ РёР·Р±СЂР°РЅРЅРѕРµ");
            } else {
                $(this).attr("title","Р”РѕР±Р°РІРёС‚СЊ РІ РёР·Р±СЂР°РЅРЅРѕРµ");
            }

            postId = $(this).data('related-element');
        } else {
            $(this).data('delete-el','Y');
            $(this).css('background-position','100% 0');
            if($(this).prev().hasClass('sub_adding')){
                $(this).prev().text("РЈРґР°Р»РёС‚СЊ РёР· РёР·Р±СЂР°РЅРЅРѕРіРѕ");
            } else {
                $(this).attr("title","РЈРґР°Р»РёС‚СЊ РёР· РёР·Р±СЂР°РЅРЅРѕРіРѕ");
            }
            postId = $(this).attr('id');
        }

        $.post("/ajax/manage_fav.php", {
            id: postId,
            type: $(this).data('elem-type'),
            delete_item: isDelete
        }, function(data) {

            if(parseInt(data)){
                $(this).data('related-element',parseInt(data));
            }
            $('#favorite_block_wrapper').load('/ #favorite_block_wrapper &gt; *',function(){
                $('.favorite_scroll_block').perfectScrollbar();
            });

        }.bind(this));

    })

    /*$(document).on({
        mouseenter: function () {
           if($(this).find(".section_list_star").length == 1){
               $(this).find(".section_list_star").show();
           }
        },
        mouseleave: function () {
           if($(this).find(".section_list_star").length == 1){
               $(this).find(".section_list_star").hide();
           }
        }
    }, ".submenu_items li");*/

    /*---Favorite functions block----*/
})



//////////////РїРѕР»СѓС‡Р°РµРј РґР°С‚Сѓ РґРѕСЃС‚Р°РІРєРё
function check_delivery_date(id,art){

    $.post("/ajax/date_check.php", { art: art},
        function(data){
            $("#deliv_date_" + id).html(data);
    });
}

//РґРѕР±Р°РІР»РµРЅРёРµ РІ РєРѕСЂР·РёРЅСѓ
function add2basket(){
    //Р±РµСЂРµРј РґР°РЅРЅС‹Рµ РёР· РІСЃРїР»С‹РІР°СЋС‰РµРіРѕ РѕРєРЅР°
    var id = $("#idm").val();
    var quantity = $("#qw").val();
    var price = $("#catpricem").html();
    if (!price) {
        price = $("#item_price_" + id).val();
    }
    //////////////////////
    //console.log(id + " " + quantity + " " + price);

    $.post("/ajax/add2basket.php", { id: id, quantity: quantity, price:price},
        function(data){ 
            if (data == 'MoreThanAllowed') {
                window.MoreThanAllowed = 'Y';
                $(".jqmClose").click();
                $(".jqmOverlay_basket").show();
                $(".jqmbasket_error").show();
            } else {
                window.MoreThanAllowed = 'N';
                if (data) {
                    //РїРµСЂРµР·Р°РіСЂСѓР¶Р°РµРј РјР°Р»СѓСЋ РєРѕСЂР·РёРЅСѓ
                    $.post("/ajax/small_basket.php", {},
                        function(data){
                            $("#header_right").html(data);
                    });
                    //РІС‹РІРѕРґРёРј РЅР°РґРїРёСЃСЊ С‡С‚Рѕ С‚РѕРІР°СЂ РІ РєРѕСЂР·РёРЅРµ Рё Р·Р°РєСЂС‹РІР°РµРј РІСЃРїР»С‹РІР°СЋС‰РµРµ РѕРєРЅРѕ
                    var path = "/personal/basket.php";
                    $("#last_cell_"+id).html("&lt;span class='forward_catalog_new_in_b'&gt;&lt;a href='/personal/basket.php' title='РєРѕСЂР·РёРЅР°'&gt;Р’ РєРѕСЂР·РёРЅРµ&lt;/a&gt;&lt;/span&gt;");
                    $(".jqmClose").click();
                    status_change();
                }
                // $("#dialog").html(data);
            }
    });
}

//РїСЂРѕРІРµСЂСЏРµРј РЅРёР»РёС‡РёРµ С‚РѕРІР°СЂР° РІ РјР°СЃСЃРёРІРµ СЃСЂР°РІРЅРµРЅРёСЏ
function check_compare(id){
    $.post("/ajax/compare.php", { compare_id: id},
        function(data){
            if (parseInt(data) &gt; 0) {
                $(".catalog_compare_hidden_block").fadeIn(300);
            }
            else {
                $(".catalog_compare_hidden_block").fadeOut(300);
            }
            $(".catalog_compare_hidden_block_text span").html(data);

    });
}




//РїРѕР»СѓС‡Р°РµРј СЃРїРёСЃРѕРє СЂР°Р·РґРµР»РѕРІ РґР»СЏ РїРѕРёСЃРєР° (СЃС‚Р°СЂР°СЏ РІРµСЂСЃРёСЏ, РґР»СЏ СЃРµР»РµРєС‚РѕРІ)
/*
function get_subsections(id){
if (parseInt(id) &gt; 0) {
$("#select_2_block").html("Р·Р°РіСЂСѓР·РєР°...");
$.post("/ajax/get_sections.php", { section_id: id},
function(data){
//alert(data);
$("#select_2_block").html(data);
$("#section_id2").css("display","block");
$("#section_id2").uniform();
});
}
else {
$("#select_2_block").html("");
$("#select2").css("display","none");
}
}
*/

//РїРѕР»СѓС‡Р°РµРј СЃРїРёСЃРѕРє СЂР°Р·РґРµР»РѕРІ РґР»СЏ РїРѕРёСЃРєР° (РЅРѕРІР°СЏ РІРµСЂСЃРёСЏ, РґР»СЏ РґРёРІРѕРІ)
function get_subsection(item){
    var id = $(item).attr("id").slice(2);
    if (parseInt(id) &gt; 0) {
        $("#select_2_block &gt; div.search_select_type").html("&lt;div&gt;Р·Р°РіСЂСѓР·РєР°...&lt;/div&gt;&lt;div&gt;&lt;/div&gt;");
        $.post("/ajax/get_sections2.php", { section_id: id},
            function(data){
                //alert(data);
                $("#select2").html(data);
        });
    }
    else {
        $("#select2").html("&lt;div class='search_select_unactive'&gt;-&lt;/div&gt;&lt;div&gt;&lt;/div&gt;");
    }
}




//РІС‹РїР°РґР°СЋС‰РёРµ СЃРїРёСЃРєРµ РІ С„РѕСЂРјРµ РїРѕРёСЃРєР°
$(function(){
    $(".search_select_type &gt; div:first-child").click(function(){
        if ($(this).siblings("div").css("display") == "none") {
            $(this).siblings("div").css("display","block");
        } else {
            $(this).siblings("div").css("display","none");
        }
    })
})

$(document).ajaxSuccess(function() {
    $(".search_select_type &gt; div:first-child").click(function(){
        $(this).siblings("div").css("display","block");
    })
})


function set_search_type(id) {
    var new_val = ($(id).attr("id")).slice(2);
    var new_text =  $(id).html();
    $(id).siblings("input").val(new_val);
    $(id).parent().siblings("div").html(new_text);
    $(id).parent().toggle();
}


//----------------------------------РњРѕРґР°Р»СЊРЅС‹Рµ РѕРєРЅР°
$(document).ready(function() {

    $(".fancybox").fancybox({
        //--------РћР±С‰РёРµ РЅР°СЃС‚СЂРѕР№РєРё Fancybox
        type : 'image',
        scrolling : 'no',
        maxWidth : '1000px',
        width : '1000px',
        height : 'auto',
        autoSize : false,
        closeClick : false,
        openEffect : 'none',
        closeEffect : 'none',

        //------------РќР°СЃС‚СЂРѕР№РєРё РѕС‚РґРµР»СЊРЅРѕ РґР»СЏ РѕР±СЉРµРєС‚Р° Frame
        iframe : {
            scrolling : 'no'
        },

    });

});

//----------------------------------РњРѕРґР°Р»СЊРЅС‹Рµ РѕРєРЅР°
$(document).ready(function() {

    $(".fancybox_map").fancybox({
        //--------РЅР°СЃС‚СЂРѕР№РєРё Fancybox РґР»СЏ РєРѕРЅС‚Р°РєС‚РѕРІ
        type : 'iframe',
        scrolling : 'no',
        maxWidth : '1000px',
        width : '1000px',
        height : '700px',
        autoSize : false,
        closeClick : false,
        openEffect : 'none',
        closeEffect : 'none',

        //------------РќР°СЃС‚СЂРѕР№РєРё РѕС‚РґРµР»СЊРЅРѕ РґР»СЏ РѕР±СЉРµРєС‚Р° Frame
        iframe : {
            scrolling : 'no'
        },

    });

});

//РїРѕРґРіСЂСѓР·РєР° РёРЅС„РѕСЂРјР°С†РёРё Рѕ РЅР°Р»РёС‡РёРё С‚РѕРІР°СЂР° РЅР° СЃРєР»Р°РґР°С…
function show_wh_popup(id) {
    /*if($(".whp_" + id + "  table")[0]) {console.log("fail")} else
    { */
        $(".whp_" + id).html("&lt;span style='color:red'&gt;Р·Р°РіСЂСѓР·РєР°...&lt;/span&gt;");
        $.post("/ajax/show_wh.php", { id: id},
            function(data){
                $(".whp_" + id).html(data);

                //РїСЂРѕРІРµСЂСЏРј РІРµР»РёС‡РёРЅСѓ РїСЂРѕРєСЂСѓС‚РєРё РѕРєРЅР°, С‡С‚РѕР±С‹ Р·Р°РґР°С‚СЊ РЅСѓР¶РЅСѓСЋ РїРѕР·РёС†РёСЋ РґР»СЏ РІСЃРїР»С‹РІР°СЋС‰РµРіРѕ РѕРєРЅР°
                var position = $("#item_info_" + id).offset().top;    //РїРѕР·РёС†РёСЏ С‚РµРєСѓС‰РµРіРѕ СЌР»РµРјРµРЅС‚Р°
                var scroll_top = $(window).scrollTop();
                //  alert(scroll_top)
                //СЃСѓРјРјР° РїСЂРѕРєСЂСѓС‚РєРё РѕРєРЅР°, РїРѕР»РѕР¶РµРЅРёСЏ СЌР»РµРјРµРЅС‚Р° Рё РІС‹СЃРѕС‚С‹ РІСЃРїР»С‹РІР°СЋС‰РµРіРѕ РѕРєРЅР°
                var summ = parseInt((position)*1 - parseInt(scroll_top)*1 + parseInt($("#item_info_" + id).find(".warehouses_popup").outerHeight())*1 + 100*1);
                var screen_height = window.outerHeight; //РІС‹СЃРѕС‚Р° РѕРєРЅР° Р±СЂР°СѓР·РµСЂР°
                // --- Fix for favorite popup window
                if($("#item_info_" + id).parent().parent().parent().hasClass("favorite_items_table") &amp;&amp; $("#item_info_" + id).parent().parent().children().length&gt;2){
                    if($("#item_info_" + id).parent().index()==parseInt($("#item_info_" + id).parent().parent().children().length-1)){
                        $("#item_info_" + id).find(".warehouses_popup").css("top","-170px");
                        $("#item_info_" + id).find(".forward_catalog_new_arr_tail3").css("top","160px");
                    } else if($("#item_info_" + id).parent().index()==parseInt($("#item_info_" + id).parent().parent().children().length-2)){
                        $("#item_info_" + id).find(".warehouses_popup").css("top","-90px");
                        $("#item_info_" + id).find(".forward_catalog_new_arr_tail3").css("top","85px");
                    }
                } else {
                    if (summ &gt; screen_height) {
                        $("#item_info_" + id).find(".warehouses_popup").css("top","-203px");
                        $("#item_info_" + id).find(".forward_catalog_new_arr_tail3").css("top","198px")
                    }
                    else {
                        $("#item_info_" + id).find(".warehouses_popup").css("top","-25px");
                        $("#item_info_" + id).find(".forward_catalog_new_arr_tail3").css("top","22px")
                    }
                }
        });
    //}
}

$(function(){
    //Р·Р°РїСѓСЃРєР°РµРј С„СѓРЅРєС†РёСЋ РїРѕРґРіСЂСѓР·РєРё РёРЅС„РѕСЂРјР°С†РёРё РїРѕ СЃРєР»Р°РґР°Рј
    $("body").on('click','.catalog_item_info_cell',function(e){
        if(e.target.nodeName=="TD"){
            if ($(this).find(".warehouses_popup").css("display")=="block") {
               $(this).find(".warehouses_popup").hide();
            }
            else {
                var item_id = $(this).attr("id").slice(10); //РїРѕР»СѓС‡Р°РµРј id РЅСѓР¶РЅРѕРіРѕ С‚РѕРІР°СЂР°
                var item_attr_id = $(this).attr("id");      //РїРѕР»СѓС‡Р°РµРј id СЏС‡РµР№РєРё С‚Р°Р±Р»РёС†С‹
                show_wh_popup(item_id);                     //Р·Р°РіСЂСѓР¶Р°РµРј РёРЅС„Рѕ РїРѕ СЃРєР»Р°РґР°Рј
                $("td:not(#" + item_attr_id + ")").find(".warehouses_popup").css("display","none"); //СЃРєСЂС‹РІР°РµРј РІСЃРїР»С‹РІР°СЋС‰РёРµ РѕРєРЅР° РІ РґСЂСѓРіРёС… СЏС‡РµР№РєР°С…
                $(this).find(".warehouses_popup").toggle();  //РїРѕРєР°Р·С‹РІР°РµРј/СЃРєСЂС‹РІР°РµРј РІСЃРїР»С‹РІР°СЋС‰РµРµ РѕРєРЅРѕ РІ С‚РµРєСѓС‰РµР№ СЏС‡РµР№РєРµ

                //РїСЂРѕРІРµСЂСЏРј РІРµР»РёС‡РёРЅСѓ РїСЂРѕРєСЂСѓС‚РєРё РѕРєРЅР°, С‡С‚РѕР±С‹ Р·Р°РґР°С‚СЊ РЅСѓР¶РЅСѓСЋ РїРѕР·РёС†РёСЋ РґР»СЏ РІСЃРїР»С‹РІР°СЋС‰РµРіРѕ РѕРєРЅР°
                var position = $(this).offset().top;    //РїРѕР·РёС†РёСЏ С‚РµРєСѓС‰РµРіРѕ СЌР»РµРјРµРЅС‚Р°
                var scroll_top = $(window).scrollTop();
                //СЃСѓРјРјР° РїСЂРѕРєСЂСѓС‚РєРё РѕРєРЅР°, РїРѕР»РѕР¶РµРЅРёСЏ СЌР»РµРјРµРЅС‚Р° Рё РІС‹СЃРѕС‚С‹ РІСЃРїР»С‹РІР°СЋС‰РµРіРѕ РѕРєРЅР°
                var summ = parseInt((position)*1 - parseInt(scroll_top)*1 + parseInt($(this).find(".warehouses_popup").outerHeight())*1 + 100*1);
                var screen_height = window.outerHeight; //РІС‹СЃРѕС‚Р° РѕРєРЅР° Р±СЂР°СѓР·РµСЂР°
                // --- Fix for favorite popup window
                if($(this).parent().parent().parent().hasClass("favorite_items_table") &amp;&amp; $(this).parent().parent().children().length&gt;2){
                    if($(this).parent().index()==parseInt($(this).parent().parent().children().length-1)){
                        $(this).find(".warehouses_popup").css("top","-170px");
                        $(this).find(".forward_catalog_new_arr_tail3").css("top","160px");
                    } else if($(this).parent().index()==parseInt($(this).parent().parent().children().length-2)){
                        $(this).find(".warehouses_popup").css("top","-90px");
                        $(this).find(".forward_catalog_new_arr_tail3").css("top","85px");
                    }
                } else {
                    if (summ &gt; screen_height) {
                        $(this).find(".warehouses_popup").css("top","-203px");
                        $(this).find(".forward_catalog_new_arr_tail3").css("top","198px")
                    }
                    else {
                        $(this).find(".warehouses_popup").css("top","-25px");
                        $(this).find(".forward_catalog_new_arr_tail3").css("top","22px")
                    }
                }
            }
        }
    })


    //РїСЂРѕРІРµСЂСЏРµРј РєР»РёРє РІРЅРµ РІСЃРїР»С‹РІР°СЋС‰РµРіРѕ РѕРєРЅР°, С‡С‚РѕР±С‹ СЃРєСЂС‹С‚СЊ РёС… РІСЃРµ

    $("body").click(function(e){
        //СЃРєСЂС‹РІР°РµРј РІСЃРїР»С‹РІР°СЋС‰РµРµ РѕРєРЅРѕ СЃ РєРѕР»РёС‡РµСЃС‚РІРѕРј С‚РѕРІР°СЂРѕРІ РЅР° СЃРєР»Р°РґРµ
        if ( !$(e.target).hasClass("catalog_item_info_cell") ) {
            //$(".warehouses_popup").css("display","none");
        }

        //СЃРєСЂС‹РІР°РµРј СЃРїРёСЃРѕРє СЃРєР»Р°РґРѕРІ
        if (!$(e.target).hasClass("wh_list") &amp;&amp; !$(e.target).parents().hasClass("wh_list") &amp;&amp; !$(e.target).hasClass("top-header") &amp;&amp; !$(e.target).parents().hasClass("top-header")) {
            $(".wh_list").css("display","none");
        }

        //СЃРєСЂС‹РІР°РµРј РѕРєРЅРѕ Р°РІС‚РѕСЂРёР·Р°С†РёРё
        //СЃРєСЂС‹РІР°РµРј СЃРїРёСЃРѕРє СЃРєР»Р°РґРѕРІ
        if (!$(e.target).hasClass("top_auth_form") &amp;&amp; !$(e.target).parents().hasClass("top_auth_form")  &amp;&amp; !$(e.target).parents().hasClass("lk-header") &amp;&amp; !$(e.target).hasClass('authFromBasket')) {
            $(".top_auth_form").css("display","none");
        }
    })

    /*
    $(".catalog_item_info_cell").mouseout(function(){
    $(this).find(".warehouses_popup").css("display","none");
    })
    */
})

//РєРЅРѕРїРєР° "РЅР°РІРµСЂС…"
function showButtonUp(){


    if ($(document).scrollTop() &gt; 200) {
        $("#button_up").css("opacity","0.5");
    }
    else {
        $("#button_up").css("opacity","0");
    }
}


$(function(){

    $("#button_up").click(function(){
        $("body,html").animate({scrollTop: 0}, 500)
    })

    showButtonUp();

    $(document).scroll(function(){
        showButtonUp();
    })
})

// РѕС‚СЃР»РµР¶РёРІР°РЅРёРµ СЃРєР°С‡РёРІР°РЅРёСЏ РїСЂР°Р№СЃРѕРІ
$(function(){
	$(".price_list_link").click(function(e){
		e.preventDefault();
		var a = $(this),
			src = $(this).attr("href"),
			filename = $.trim($(this).text()),
			pseudolink = $("&lt;a id='filenav' href='" + src + "' target='_blank' style='display:none'&gt;&lt;/a&gt;");
		$("#filenav").remove();
		ym(23257468,'reachGoal','download-price', {src: src, filename:filename}, function(){
			$(document.body).append(pseudolink);
			$("#filenav")[0].click();
		})
	})
})

grecaptcha.ready(function() {
    grecaptcha.execute(app.recaptchaKey, {action: 'submit'}).then(function(token) {
        if (token) {
            form.find('input[name="recaptcha_token"]').val(token)
        }
    });
});</pre></body></html>