PageSourceSearch

https://anturazhvrn.ru/bitrix/templates/concept_kraken_s1/js/script.js

js anturazhvrn.ru collected 2026-10-05 00:06:25 UTC 133,960 bytes, 5,057 lines download raw bytes

1var lazyController = false,
2	parentContainerSlide = {},
3	parent = {},
4	flagSlider = 0,
5	customEvent = false,
6    arImagesLazyload = {},
7    isIos = device.ios();
8
9
10var paramsLazy = {
11	scrollDirection: 'vertical',
12    threshold: 500,
13    visibleOnly: true,
14    effect: 'fadeIn'
15};
16
17function buildFormValues(form, params) {
18
19    params = params || null;
20
21    var formSendAll = new FormData();
22
23
24    if (params) {
25        for (key in params) {
26            formSendAll.append(key, params[key]);
27        }
28    }
29
30    form_arr = form.find(':input,select,textarea').serializeArray();
31
32
33    for (var i = 0; i < form_arr.length; i++) {
34        if (form_arr[i].value.length > 0)
35            formSendAll.append(form_arr[i].name, form_arr[i].value);
36
37
38    };
39
40    if (form.hasClass('file-download')) {
41        form.find('input[type=file]').each(function (key) {
42
43            var inp = $(this);
44            var file_list_name = "";
45
46            $(inp[0].files).each(
47                function (k) {
48                    formSendAll.append(inp.attr('name'), inp[0].files[k], inp[0].files[k].name);
49                }
50            );
51
52        });
53    }
54
55    return formSendAll;
56}
57
58function checkToolSettings()
59{
60
61    if($('div.tool-settings').length>0)
62    {
63
64        if($('div.kraken-sets-list-wrap').hasClass('on'))
65        {
66            $('div.tool-settings').addClass('on');
67        }
68
69        else
70        {
71            $('div.tool-settings').removeClass('on');
72        }
73    
74    }
75
76}
77
78function menuOffset(li) {
79    var mainPosition = $(li).parents('.main-menu-inner').width() + $(li).parents(
80        '.main-menu-inner').offset().left;
81    var liPosition = $(li).children('ul').offset().left + $(li).children('ul').width();
82    if (liPosition >= mainPosition) $(li).addClass('reverse');
83}
84
85function addGoal(action){
86
87	if(typeof globalGoals !== "undefined")
88	{
89		if(globalGoals[action])
90			$('body').append(globalGoals[action]);
91	}
92}
93
94function showProcessLoad()
95{
96	$('.google-spin-wrapper').addClass('active');
97}
98function closeProcessLoad()
99{
100	$('.google-spin-wrapper').removeClass('active');
101}
102
103function startBlurWrapperContainer()
104{
105	$('body').addClass('modal-open');
106    $('.wrapper').addClass('blur');
107
108    if (isIos) {
109		$("body").addClass("modal-ios");
110	}
111}
112function stopBlurWrapperContainer()
113{
114	$('body').removeClass('modal-open');
115    $('.wrapper').removeClass('blur');
116
117    if (isIos) {
118		$("body").removeClass("modal-ios");
119		window.scrollTo(0, cur_pos);
120	}
121}
122
123
124
125function updateLazyLoad()
126{
127	$('.lazyload').Lazy(
128		{
129			scrollDirection: 'vertical',
130            threshold: 500,
131            visibleOnly: true,
132            effect: 'fadeIn',
133			afterLoad: function(element)
134			{
135				parent = $(element).parent();
136                parentContainerSlide = parent.find('.parent-slider-item-js');
137
138                if($(element).hasClass("slider-start"))
139                {
140
141                    if(typeof arImagesLazyload["id"+$(element).attr("data-id")] === "undefined") 
142                        arImagesLazyload["id"+$(element).attr("data-id")] = {"s": 0, "f": 0, "type": null};
143
144                    arImagesLazyload["id"+$(element).attr("data-id")].s = 1;
145
146          
147                    arImagesLazyload["id"+$(element).attr("data-id")].type = parentContainerSlide;
148
149                }
150
151
152                if($(element).hasClass('slider-finish'))
153                {
154
155                    if(typeof arImagesLazyload["id"+$(element).attr("data-id")] === "undefined") 
156                        arImagesLazyload["id"+$(element).attr("data-id")] = {"s": 0, "f": 0, "type": null};
157                    
158                    arImagesLazyload["id"+$(element).attr("data-id")].f = 1;
159                    arImagesLazyload["id"+$(element).attr("data-id")].type = parentContainerSlide;
160
161                }
162
163                if($(element).hasClass('slider-finish') || $(element).hasClass("slider-start"))
164                {
165                	for (key in arImagesLazyload){
166
167                        if(arImagesLazyload[key].s == 1 && arImagesLazyload[key].f == 1)
168                        {
169		                	/*if( arImagesLazyload[key].type.hasClass('first-slider') && !arImagesLazyload[key].type.hasClass('slider-init'))
170								initFSlider(arImagesLazyload[key].type);*/
171
172							controllerSliders(arImagesLazyload[key].type);
173
174							delete arImagesLazyload[key];
175                        }
176                    }
177                }
178				
179
180                if($(element).parents(".parent-video-bg").find(".videoBG").length>0)
181                	correctSizeVideoBg($(element).parents(".parent-video-bg").find(".videoBG"));
182
183
184                if($(element).hasClass('map-start'))
185                    generateMaps($(element).parents("div.block"));
186
187                if($(element).hasClass('video-start'))
188                    generateVideos($(element).parents("div.block"));
189
190                if($(element).hasClass('video-start-js'))
191                    generateVideos($(element).parents("div.video-start-parent"));
192
193                if($(element).hasClass('videoBG-start'))
194                    generateVideoBG($(element).parents("div.block"));
195
196                if($(element).hasClass('videoBG-start-fb'))
197                    generateVideoBG($(element).parents("div.first-block"));
198			}
199		}
200	);
201}
202
203
204function generateMaps(container){
205    var mapBlock = $(".iframe-map-area", container);
206
207    if(mapBlock.length>0)
208    {
209        mapBlock.each(
210            function(index, element)
211            {
212                $(element).after($(element).attr("data-src"));
213                $(element).remove();
214            }
215        ); 
216    }
217}
218function generateVideos(container){
219
220    var videoBlock = $(".iframe-video-area", container);
221
222    if(videoBlock.length>0)
223    {
224        videoBlock.each(
225            function(index, element)
226            {
227                $(element).after($(element).attr("data-src"));
228                $(element).remove();
229            }
230        ); 
231    }
232}
233
234function setSharesValues()
235{
236
237	if($(".public_shares").length>0)
238	{
239
240		var title = "",
241			description = "",
242			image = "",
243			url = "";
244
245		if($("meta[property=\"og:title\"]").length)
246			title = $("meta[property=\"og:title\"]").attr("content");
247
248		if($("meta[property=\"og:description\"]").length)
249			description = $("meta[property=\"og:description\"]").attr("content");
250
251		if($("meta[property=\"og:image\"]").length)
252			image = $("meta[property=\"og:image\"]").attr("content");
253
254		if($("meta[property=\"og:url\"]").length)
255			url = $("meta[property=\"og:url\"]").attr("content");
256
257
258		$(".public_shares a.vkontakte").attr("onclick", "Share.vkontakte('"+url+"','"+title+"','"+image+"', '"+description+"')");
259		$(".public_shares a.facebook").attr("onclick", "Share.facebook('"+url+"','"+title+"','"+image+"', '"+description+"')");
260		$(".public_shares a.twitter").attr("onclick", "Share.twitter('"+url+"','"+title+"')");
261
262	}
263}
264
265
266function initblueimp(){
267	setTimeout(function() {
268		$("body").append('<div class="blueimp-gallery blueimp-gallery-controls" id="blueimp-gallery">'
269		    +'<div class="slides"></div>'
270		    +'<h3 class="title bold"></h3>'
271		    +'<a class="prev"></a>'
272		    +'<a class="next"></a>'
273		    +'<a class="close"></a>'
274		+'</div>');
275	}, 2000);
276}
277
278
279function initGlobalBasketItems(){
280
281	 $.post(
282        "/bitrix/tools/kraken/ajax/cart/cart_js_items.php",
283        {
284            "site_id": $("input.site_id").val()
285        },
286        function(data){
287          	globalBasketItems = data;
288          	updateBasketPublicInfo();
289        },
290        "json"
291    ); 
292}
293
294function controllerSliders(obj)
295{
296    if(obj)
297    {
298        if(!obj.hasClass('slider-init'))
299        {
300
301            if( obj.hasClass('slider'))
302                initOpSlider(obj);
303
304            if( obj.hasClass('slider-mini'))
305                initOpMiniSlider(obj);
306
307            if( obj.hasClass('advantages-big-slide'))
308                initAdvantagesBigSlider(obj);
309
310            if( obj.hasClass('advantages-small-slide'))
311                initAdvantagesSmallSlider(obj);
312
313            if( obj.hasClass('slider-news-big'))
314                initNewsBigSlider(obj);
315
316            if( obj.hasClass('slider-news-small'))
317                initNewsSmallSlider(obj);
318
319            if( obj.hasClass('slider-gallery'))
320                initGallerySlider(obj);
321
322            if( obj.hasClass('menu-banner-slider'))
323                initBannerSlider(obj);
324
325            if( obj.hasClass('tariff-flat'))
326                initTariffsElements(obj);
327        }
328    }
329}
330
331function setChangerBlocks() {
332    $("div.changer-blocks").each(
333        function()
334        {
335            var block = $(this);
336            
337            $("div.changer-link-js", block).each(
338                function(index, value)
339                {
340                    var arIds = $(this).attr("data-id").split(",");
341
342                    if(arIds)
343                    {
344                        for (var i = 0; i < arIds.length; i++) {
345
346                            if($(this).hasClass("active"))
347                            {
348                                $("div#block"+arIds[i]).removeClass("hidden");
349                                $('.lazyload').Lazy(paramsLazy);
350
351                                var obj = $("div#block"+arIds[i]).find(".parent-slider-item-js");
352
353                                controllerSliders(obj);
354                            }
355                            
356                        }
357                    }
358                    
359                }
360            );
361        }
362    );
363    
364    
365    $("div.changer-link-js").click(
366        function()
367        {
368            var block = $(this).parents("div.changer-blocks");
369            
370            $("div.changer-link-js", block).removeClass("active");
371            $(this).addClass("active");
372            
373             $("div.changer-link-js", block).each(
374                function(index, value)
375                {
376                    var arIds = $(this).attr("data-id").split(",");
377
378                    if(arIds)
379                    {
380                        for (var i = 0; i < arIds.length; i++) {
381                            $("div#block"+arIds[i]).addClass("hidden");
382                        }
383                    }
384                    
385                }
386            );
387
388            var arIds = $(this).attr("data-id").split(",");
389
390            if(arIds)
391            {
392                for (var i = 0; i < arIds.length; i++) {
393                    $("div#block"+arIds[i]).removeClass("hidden");
394                    $('.lazyload').Lazy(paramsLazy);
395                    var obj = $("div#block"+arIds[i]).find(".parent-slider-item-js");
396                    controllerSliders(obj);
397                }
398            }
399            
400            
401
402            
403        }
404    );
405}
406
407$(document).ready(function()
408{
409	initGlobalBasketItems();
410	
411	initblueimp(); 
412	setSharesValues();
413
414
415	if ( $(window).width() >= 991 )
416		$(".slide-hidden-lg").remove();
417	
418	else
419	{
420		$(".slide-hidden-xs").remove();
421	}
422
423
424    if ( $(window).width() < 768)
425    {
426    	if($(".error-404").length>0)
427    		$("div.wrapper").addClass('overflow-visible');
428    }
429
430    
431
432	updateLazyLoad();
433
434	if (window.frameCacheVars !== undefined) 
435	{
436        BX.addCustomEvent("onFrameDataReceived" , function(json) {
437        	customEvent = true;
438    	});
439    }
440
441	if(isIos)
442        $('div.block.parallax-attachment').removeClass('parallax-attachment');
443    
444
445	
446	$("form.timer_form").each(function(index) {
447		timerCookie($(this));
448	});
449
450	if ($(window).width() > 1200) 
451	{
452		$('.elem-hover').hover(function() {
453			var total = parseInt($(this).find('.elem-hover-height-more').css(
454				'margin-bottom')) + $(this).find('.elem-hover-height').outerHeight(
455				true);
456			$(this).css({
457				'height': total + 'px'
458			});
459			$(this).find('div.elem-hover-show').slideDown(250);
460		}, function() {
461			$(this).find('div.elem-hover-show').slideUp(0);
462		});
463	}
464
465	if ($(window).width() > 1024) 
466	{
467		$('.service-block').find('.service-item').hover(function() {
468			var element_height = $(this).find('.service-element').height();
469			var element_bot_height = $(this).find('.bot-wrap').height();
470			var need_height = element_height - element_bot_height;
471			$(this).css({
472				'height': need_height + 'px'
473			});
474		}, function() {
475			$(this).css({
476				'height': 'auto'
477			});
478		});
479	}
480	else 
481	{
482		$('.service-block').find('.service-item').hover(function() {
483			$(this).css({
484				'height': 'auto'
485			});
486		});
487	}
488	$("div.expired-page").height($(document).height());
489	$("div.error-404").height($(document).height());
490
491	if ($(window).width() > 1199) 
492	{
493
494
495		$('header .main-phone div.phone').hover(function() {
496			var itThis = $(this);
497			$.data(this, 'timer', setTimeout($.proxy(function() {
498				$(itThis).parents(".main-phone").find('.list-contacts').stop(true,
499					true).addClass('open');
500			}, this), 300));
501		}, function() {
502			clearTimeout($.data(this, 'timer'));
503		});
504
505
506
507		$('header .main-phone div.ic-open-list-contact.open-list-contact').hover(
508			function() {
509				var itThis = $(this);
510				$.data(this, 'timer', setTimeout($.proxy(function() {
511					$(itThis).parents(".main-phone").find('.list-contacts').stop(true,
512						true).addClass('open');
513				}, this), 300));
514			},
515			function() {
516				clearTimeout($.data(this, 'timer'));
517			});
518		$('header .list-contacts').hover(function() {}, function() {
519			$(this).removeClass('open');
520		});
521
522
523		$('nav.main-menu > li.parent.view_2').hover(function() {
524
525            var th = $(this);
526
527            jQuery.data(this, 'timer', setTimeout(jQuery.proxy(function() {
528                    
529                th.find(".dropdown-menu-view-2").addClass('on');
530                setTimeout(function() {
531                    th.find(".dropdown-menu-view-2").addClass('active');
532                    $('.lazyload').Lazy(paramsLazy);
533                }, 100);
534
535
536            }, this), 200));
537            
538
539        }, function() {
540            var th = $(this);
541
542            clearTimeout(jQuery.data(this, 'timer'));
543
544            th.find(".dropdown-menu-view-2").removeClass('active');
545            setTimeout(function() {
546                th.find(".dropdown-menu-view-2").removeClass('on');
547            }, 100);
548
549            
550        });
551
552
553
554		$('nav.main-menu > li.parent.view_1').hover(function() {
555			jQuery.data(this, 'timer', setTimeout(jQuery.proxy(function() {
556				$('ul.child', this).stop(true, true).addClass("show-open");
557				menuOffset(this);
558				if ($('ul.child', this).width() < $(this).width()) 
559					$('ul.child', this).css('width', $(this).width());
560			}, this), 150));
561		}, function() {
562			clearTimeout(jQuery.data(this, 'timer'));
563			$('ul.child', this).stop(true, true).removeClass("show-open");
564		});
565
566
567
568
569		$('nav.main-menu ul.child > li.parent2').hover(function() {
570			jQuery.data(this, 'timer', setTimeout(jQuery.proxy(function() {
571				$('ul.child2', this).stop(true, true).addClass("show-open");
572				menuOffset(this);
573			}, this), 100));
574		}, function() {
575			clearTimeout(jQuery.data(this, 'timer'));
576			$('ul.child2', this).stop(true, true).removeClass("show-open");
577		});
578
579
580
581	}
582
583
584	$('body').append(
585		'<div class="modalArea modalAreaDetail"></div><div class="modalArea modalAreaVideo"></div><div class="modalArea modalAreaForm"></div><div class="modalArea modalAreaWindow"></div><div class="modalArea modalAreaAgreement"></div>'
586	);
587
588
589	$.datetimepicker.setLocale('ru');
590
591
592	$('form.form .date').datetimepicker({
593		timepicker: false,
594		format: 'd/m/Y',
595		scrollMonth: false,
596		scrollInput: false,
597		dayOfWeekStart: 1
598	});
599
600
601	if ($(window).width() < 767)
602	{
603		var anim_callmob_in = setTimeout(function()
604		{
605			$("#callphone-mob .callphone-desc").show().addClass('active');
606			clearTimeout(anim_callmob_in);
607		}, 5000);
608		var anim_callmob_out = setTimeout(function() {
609			$("#callphone-mob .callphone-desc").removeClass('active');
610			clearTimeout(anim_callmob_out);
611		}, 12000);
612		var anim_callmob_out2 = setTimeout(function() {
613			$("#callphone-mob .callphone-desc").hide();
614			clearTimeout(anim_callmob_out2);
615		}, 12500);
616	}
617	
618	if ($(window).width() > 767)
619	{
620		$(window).enllax();
621		new WOW().init();
622		var wow = new WOW({
623			boxClass: 'parent-animate',
624			animateClass: 'animated',
625			offset: 0,
626			mobile: true,
627			live: true,
628			callback: function(box) {
629				var sec = 0;
630				$("div.child-animate", box).each(function() {
631					var elem = $(this);
632					setTimeout(function() {
633						elem.removeClass("opacity-zero").addClass("animated fadeIn");
634					}, sec);
635					sec += 500;
636				});
637			},
638			scrollContainer: null
639		});
640		wow.init();
641	}
642	
643	$('[data-toggle="tooltip"]').tooltip({
644                    html:true,
645                    container: "body"
646                });
647
648
649	if ($(window).width() > 767)
650	{
651		setTimeout(function() {
652			$('div.wrap-scroll-down').addClass('active');
653		}, 3000);
654	}
655	
656	$(".quest-click").click(function() {
657		var block = $(this).parents("div.quest-parent");
658		if (!block.hasClass("active"))
659		{
660			$(".quest-text", block).slideDown(200, function() {
661				block.addClass("active");
662			});
663		} 
664		else
665		{
666			$(".quest-text", block).slideUp(200, function() {
667				block.removeClass("active");
668			});
669		}
670	});
671
672
673	$("div.switcher-wrap div.switcher-title").click(function() {
674		var block = $(this).parents("div.switcher-wrap");
675		if (!block.hasClass("active"))
676		{
677			$("div.switcher-content", block).slideDown(200, function() {
678				block.addClass("active");
679			});
680		} 
681		else
682		{
683			$("div.switcher-content", block).slideUp(200, function() {
684				block.removeClass("active");
685			});
686		}
687	});
688	
689	var url = location.href;
690	url = url.split("#");
691	if (typeof(url[1]) != "undefined")
692	{
693		if(url[1].length > 0 && url[1].length < 20)
694			scrollToBlock("#" + url[1], false);
695		
696	}
697
698	setChangerBlocks();
699
700	setComments();
701});
702
703function showProcessLoadBlock(obj) {
704    obj.find('.loading-block').addClass('active');
705}
706
707function closeProcessLoadBlock(obj) {
708    obj.find('.loading-block').removeClass('active');
709}
710
711function ajaxGetComments(params) {
712    var path = "/bitrix/tools/kraken/ajax/comments/comments_block.php";
713    params = params || 0;
714
715    showProcessLoadBlock($(".block-comments-js"));
716
717    $.post(path, {
718            site_id: $("input.site_id").val(),
719            id: $(".block-comments-js").attr("data-element-id"),
720            mode: params.mode,
721            page: params.pageNum
722
723        },
724        function (html) {
725            closeProcessLoadBlock($(".block-comments-js"));
726
727            if(params.this)
728            {
729                if (params.this.hasClass('get-comments-js')) {
730                    $(".block-comments-js .comments-set-js").append(html);
731                    params.this.remove();
732                } 
733            }
734            else
735            {
736                $('.comments-set-js').append(html);
737            }
738
739
740            if(params.newItem)
741            {
742
743
744                $.ajax({
745                    url: "/bitrix/tools/kraken/ajax/ajax_hit_page.php",
746                    method: 'POST',
747                    success: function(json) {}
748                });
749
750
751                var otherHeight = 0;
752                if ($('header').hasClass('fixed')) 
753                    otherHeight = 100;
754
755                var newItem = $('.comments-set-js').find('.review-item.first');
756                newItem.addClass('new');
757                formAttentionScroll(newItem.offset().top - otherHeight, $("html:not(:animated),body:not(:animated)"));
758                setTimeout(function() {
759                    newItem.removeClass('new');
760                }, 2000);
761            }
762        }
763    );
764}
765
766function setComments(newItem){
767    if($('.block-comments-js').length>0)
768    {
769        newItem = newItem || '';
770        var params = {
771            newItem: newItem,
772            mode: "full"
773        };
774
775        ajaxGetComments(params);
776    }
777}
778
779$(document).on("click", ".get-comments-js", function () {
780    var params = {
781        "this": $(this),
782        "pageNum": $(this).attr("data-page"),
783        "mode": "list"
784    };
785    ajaxGetComments(params);
786});
787
788function deleteComment(params) {
789    var path = "/bitrix/tools/kraken/ajax/comments/delete.php";
790    params = params || 0;
791
792    showProcessLoadBlock($(".block-comments-js"));
793
794    $.post(
795        path, {
796            site_id: $("input.site_id").val(),
797            ELEMENT_ID: params.ELEMENT_ID
798        },
799        function (data) {
800            closeProcessLoadBlock($(".block-comments-js"));
801
802            if (data.OK == "Y") {
803                $(".review-item[data-review-id='"+params.ELEMENT_ID+"']").remove();
804            }
805            else
806            {
807                $('.comments-set-js').html('');
808                setComments();
809            }
810        },
811        "json"
812    );
813}
814
815$(document).on("click", ".comment-delete-js", function () {
816    var params = {
817        "ELEMENT_ID": $(this).attr("data-review-id")
818    };
819    deleteComment(params);
820});
821$(document).on("focus", ".text-require, .input-simple input[type='email']", function () {
822    $(this).removeClass("has-error");
823});
824
825function sendComments(that, fields)
826{
827    fields = fields || null;
828
829    var form = that.parents("form"),
830        load = form.find(".loader-simple"),
831        question = form.find(".question-js"),
832        thank = form.find(".thank-js"),
833        text = form.find("textarea[name=TEXT]"),
834        btn = that;
835
836    if(text.val()<=5)
837    {
838    	var otherHeight = 0;
839        if ($('header').hasClass('fixed')) 
840            otherHeight = 100;
841
842        text.addClass('has-error');
843        formAttentionScroll(text.offset().top - otherHeight, $("html:not(:animated),body:not(:animated)"));
844        return false;
845    }
846    else
847    {
848        load.removeClass('hidden');
849        btn.addClass('hidden');
850
851   
852        var formSendAll = buildFormValues(form);
853
854        formSendAll.append("send", "Y");
855        formSendAll.append("site_id", $("input.site_id").val());
856
857
858  		if(fields)
859  		{
860        	if(fields.captchaToken)
861            	formSendAll.append("captchaToken", fields.captchaToken);
862  		}
863
864
865        var path = "/bitrix/tools/kraken/ajax/comments/add.php";
866
867
868        $.ajax({
869            url: path,
870            method: 'POST',
871            contentType: false,
872            processData: false,
873            data: formSendAll,
874            dataType: 'json',
875            success: function (json) {
876                if (json.OK == "Y") {
877
878                    thank.html(json.MESSAGE);
879                    question.addClass('hidden');
880                    thank.removeClass('hidden');
881
882                    setTimeout(function() {
883
884                        if(json.NEW === 'Y')
885                        {
886                            $('.comments-set-js').html('');
887                            setComments(json.NEW);
888                        }
889                        question.removeClass('hidden');
890                        thank.addClass('hidden');
891                        load.addClass('hidden');
892                        btn.removeClass('hidden');
893
894                        text.val('');
895                        text.parent().removeClass('in-focus');
896
897                    }, 2000);
898
899                    $.ajax({
900                        url: "/bitrix/tools/kraken/ajax/ajax_hit_page.php",
901                        method: 'POST',
902                        success: function (json) {}
903                    });
904
905                    /*setTimeout(function() {
906
907                        location.href = location.href;
908                    }, 3000);*/
909
910
911
912
913                } else if (json.OK == "N") {
914                    question.removeClass('hidden');
915                    thank.addClass('hidden');
916                    load.addClass('hidden');
917                    btn.removeClass('hidden');
918                }
919
920                console.log(json.CAPTCHA_SCORE);
921
922            }
923        });
924
925
926    }
927}
928
929$(document).on("click", ".btn-submit-comments-js", function () {
930
931    var that = $(this);
932    if($("body").hasClass('captcha'))
933    {
934        grecaptcha.execute($(".captcha-site-key").val(), {action: 'homepage'}).then(function(token) {
935
936            sendComments(that, {captchaToken:token});
937        });
938    }
939    else
940    {
941        sendComments(that);
942    }
943    
944
945});
946
947
948function initOpMiniSlider(obj){
949	obj.on('init', function(event, slick){
950        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
951        obj.addClass("slider-init");
952        correctLazyloadInSlider(obj);
953        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
954        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
955        }
956    });
957
958
959    obj.slick({
960		dots: true,
961		infinite: true,
962		adaptiveHeight: true,
963		arrows: true
964	});
965
966}
967
968function initOpSlider(obj){
969	obj.on('init', function(event, slick){
970        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
971        obj.addClass("slider-init");
972
973        correctLazyloadInSlider(obj);
974        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
975        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
976        }
977    });
978
979    var count = obj.attr('data-count');
980
981    if (count == 1)
982	{
983		$('.slider-for', obj).slick({
984			slidesToShow: 1,
985			arrows: false,
986			asNavFor: obj.find('.slider-nav'),
987			appendArrows: obj.find('.slider-nav-wrap')
988		});
989		$('.slider-nav', obj).slick({
990			slidesToShow: 1,
991			asNavFor: obj.find('.slider-for'),
992			centerPadding: 0,
993			dots: false,
994			centerMode: true,
995			focusOnSelect: true,
996		});
997		obj.addClass("one-slide");
998	}
999	else if (count == 2)
1000	{
1001		$('.slider-for', obj).slick({
1002			slidesToShow: 1,
1003			slidesToScroll: 1,
1004			speed: 300,
1005			fade: true,
1006			adaptiveHeight: true,
1007			arrows: false,
1008			asNavFor: obj.find('.slider-nav'),
1009			appendArrows: obj.find('.slider-nav-wrap')
1010		});
1011		$('.slider-nav', obj).slick({
1012			slidesToShow: 2,
1013			slidesToScroll: 1,
1014			speed: 300,
1015			asNavFor: obj.find('.slider-for'),
1016			centerPadding: 0,
1017			dots: false,
1018			centerMode: true,
1019			focusOnSelect: true,
1020			responsive: [{
1021				breakpoint: 1200,
1022				settings: {
1023					slidesToShow: 2,
1024					infinite: true,
1025				}
1026			}, {
1027				breakpoint: 991,
1028				settings: {
1029					slidesToShow: 1
1030				}
1031			}, {
1032				breakpoint: 0,
1033				settings: "unslick"
1034			}]
1035		});
1036	} 
1037	else
1038	{
1039		$('.slider-for', obj).slick({
1040			slidesToShow: 1,
1041			slidesToScroll: 1,
1042			speed: 300,
1043			fade: true,
1044			adaptiveHeight: true,
1045			arrows: false,
1046			asNavFor: obj.find('.slider-nav'),
1047			appendArrows: obj.find('.slider-nav-wrap')
1048		});
1049		$('.slider-nav', obj).slick({
1050			slidesToShow: 3,
1051			slidesToScroll: 1,
1052			speed: 300,
1053			asNavFor: obj.find('.slider-for'),
1054			centerPadding: 0,
1055			dots: false,
1056			centerMode: true,
1057			focusOnSelect: true,
1058			responsive: [{
1059				breakpoint: 1200,
1060				settings: {
1061					slidesToShow: 3,
1062					infinite: true,
1063				}
1064			}, {
1065				breakpoint: 991,
1066				settings: {
1067					slidesToShow: 1
1068				}
1069			}, {
1070				breakpoint: 0,
1071				settings: "unslick"
1072			}]
1073		});
1074	}
1075
1076}
1077
1078function initFSlider(obj, size){
1079	var adaptiveMob = ($(window).width() < 768 && $(".wrap-first-slider").attr("data-mobile-height") == "Y") ? false : true,
1080		sizeSlides = $('div.first-slider div.first-block').length,
1081		params = {};
1082
1083	if(size == "lg")
1084	{
1085		params = {
1086			dots: false,
1087	        infinite: true,
1088	        adaptiveHeight: false,
1089	        speed: 500,
1090	        pauseOnFocus: false,
1091	        pauseOnHover: false
1092	    };
1093	}
1094	else if(size == "xs")
1095	{
1096		params = {
1097			dots: false,
1098	        infinite: true,
1099	        adaptiveHeight: false,
1100	        speed: 500,
1101	        pauseOnFocus: false,
1102	        pauseOnHover: false,
1103	        responsive: [
1104	            {
1105
1106	                breakpoint: 767,
1107	                settings:{
1108	                    adaptiveHeight: adaptiveMob,
1109
1110	                }
1111
1112	            },
1113                {
1114
1115	                    breakpoint: 0,
1116	                    settings: "unslick" 
1117
1118	            }]
1119	    };
1120	}
1121
1122	obj.on('init', function(event, slick){
1123        obj.find(".first-block").removeClass('noactive-slide-lazyload');
1124    	obj.addClass("slider-init");
1125    });
1126
1127
1128
1129
1130
1131	if($(".wrap-first-slider").attr("data-autoslide") == "Y")
1132	{
1133		params["autoplaySpeed"] = $(".wrap-first-slider").attr("data-autoslide-time");
1134		params["autoplay"] = true;
1135	}
1136
1137
1138	obj.slick(params);
1139
1140
1141    
1142
1143    if ( $(window).width() >= 768 || ($(window).width() < 768 && $(".wrap-first-slider").attr("data-mobile-height") == "Y"))
1144	{
1145
1146		var height1 = 0;
1147		var height2 = 0;
1148
1149
1150		$('div.first-slider div.first-block').each(
1151            function(index){
1152            	
1153                if ($(this).outerHeight() > height2){
1154                    height1 = $(this).height();
1155                    height2 = $(this).outerHeight();
1156                }
1157                
1158
1159                if(sizeSlides == index+1)
1160                {
1161
1162	    			$('div.first-slider div.first-block-container').css("height", height1);
1163
1164	    			if ( $(".wrap-first-slider").attr("data-desktop-height") == "Y")
1165                    {
1166                        if ($(window).height() > $(".wrap-first-slider").height())
1167                            $(".wrap-first-slider").find(".slick-track").css("height", $(window).height() +
1168                            "px");
1169                    }
1170
1171                    if ( ($(window).width() < 768 && $(".wrap-first-slider").attr("data-mobile-height") == "Y") )
1172		            {
1173		                if ($(window).height() > $(".wrap-first-slider").height())
1174		                    $(".wrap-first-slider").find(".slick-track").css("height", $(window).height() +
1175		                    "px");
1176		            }
1177
1178		            if(obj.find(".videoBG").length>0)
1179			    	{
1180			    		$(obj.find(".videoBG")).each(
1181						    function(index)
1182						    {
1183						    	correctSizeVideoBg($(this));
1184						    }
1185					    );
1186			    	}
1187                }
1188            }
1189        );
1190
1191		
1192	}
1193
1194
1195	if( $(window).width() < 768 )
1196	{
1197		if ( $(".wrap-first-slider").attr("data-mobile-height") == "Y")
1198        {
1199            if ($(window).height() > $(".wrap-first-slider").height())
1200                $(".wrap-first-slider").find(".slick-track").css("height", $(window).height() +
1201                "px");
1202        }
1203	}
1204
1205}
1206
1207function initAdvantagesBigSlider(obj){
1208	obj.on('init', function(event, slick){
1209        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
1210        obj.addClass("slider-init");
1211        correctLazyloadInSlider(obj);
1212
1213        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
1214        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
1215        }
1216    });
1217
1218    obj.slick({
1219		dots: true,
1220		adaptiveHeight: false
1221	});
1222}
1223
1224function initAdvantagesSmallSlider(obj){
1225	obj.on('init', function(event, slick){
1226        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
1227        obj.addClass("slider-init");
1228        correctLazyloadInSlider(obj);
1229        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
1230        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
1231        }
1232    });
1233
1234    obj.slick({
1235		dots: true,
1236		slidesToShow: 2,
1237		adaptiveHeight: false,
1238		slidesToScroll: 2,
1239		responsive: [{
1240			breakpoint: 767,
1241			settings: {
1242				slidesToShow: 1,
1243				slidesToScroll: 1
1244			}
1245		}, {
1246			breakpoint: 0,
1247			settings: "unslick"
1248		}]
1249	});
1250}
1251
1252function initNewsBigSlider(obj){
1253	obj.on('init', function(event, slick){
1254        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
1255        obj.addClass("slider-init");
1256        correctLazyloadInSlider(obj);
1257        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
1258        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
1259        }
1260    });
1261
1262
1263    obj.slick({
1264		slidesToShow: 3,
1265		slidesToScroll: 1,
1266		dots: false,
1267		infinite: false,
1268		centerPadding: 0,
1269		centerMode: false,
1270		adaptiveHeight: false,
1271		focusOnSelect: false,
1272		responsive: [{
1273			breakpoint: 1200,
1274			settings: {
1275				slidesToShow: 3,
1276				infinite: true,
1277			}
1278		}, {
1279			breakpoint: 991,
1280			settings: {
1281				slidesToShow: 2
1282			}
1283		}, {
1284			breakpoint: 767,
1285			settings: {
1286				slidesToShow: 1
1287			}
1288		}, {
1289			breakpoint: 0,
1290			settings: "unslick"
1291		}]
1292	});
1293}
1294
1295function initNewsSmallSlider(obj){
1296	obj.on('init', function(event, slick){
1297        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
1298        obj.addClass("slider-init");
1299        correctLazyloadInSlider(obj);
1300        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
1301        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
1302        }
1303    });
1304
1305
1306    obj.slick({
1307		slidesToShow: 2,
1308		slidesToScroll: 1,
1309		dots: false,
1310		infinite: false,
1311		centerPadding: 0,
1312		centerMode: false,
1313		adaptiveHeight: false,
1314		focusOnSelect: false,
1315		responsive: [{
1316			breakpoint: 1200,
1317			settings: {
1318				slidesToShow: 3,
1319				infinite: true,
1320			}
1321		}, {
1322			breakpoint: 991,
1323			settings: {
1324				slidesToShow: 2
1325			}
1326		}, {
1327			breakpoint: 767,
1328			settings: {
1329				slidesToShow: 1
1330			}
1331		}, {
1332			breakpoint: 0,
1333			settings: "unslick"
1334		}]
1335	});
1336}
1337
1338function correctLazyloadInSlider(obj)
1339{
1340    if($('.lazyload', obj).length)
1341    {
1342        $('.lazyload', obj).each(
1343            function(index, element)
1344            {
1345                $(element).attr("src", $(element).attr("data-src"));
1346                $(element).removeAttr("data-src");
1347            }
1348           
1349        );
1350    }
1351}
1352
1353function initGallerySlider(obj){
1354	var count = parseInt(obj.attr("data-slide-visible"));
1355
1356	obj.on('init', function(event, slick){
1357        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
1358        obj.addClass("slider-init");
1359        correctLazyloadInSlider(obj);
1360        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
1361        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
1362        }
1363    });
1364
1365
1366
1367	obj.slick({
1368		dots: true,
1369		adaptiveHeight: true,
1370		slidesToScroll: count,
1371		slidesToShow: count,
1372		responsive: [{
1373			breakpoint: 767,
1374			settings: {
1375				slidesToShow: 1,
1376				slidesToScroll: 1,
1377			}
1378		}, {
1379			breakpoint: 0,
1380			settings: "unslick"
1381		}]
1382	});
1383}
1384
1385function initBannerSlider(obj){
1386	obj.on('init', function(event, slick){
1387        obj.find(".slick-slide").removeClass('noactive-slide-lazyload');
1388        obj.addClass("slider-init");
1389        correctLazyloadInSlider(obj);
1390        if(obj.parents(".parent-video-bg").find(".videoBG").length>0){
1391        	correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG"));
1392        }
1393    });
1394
1395
1396    obj.slick({
1397		slidesToShow: 1,
1398		slidesToScroll: 1,
1399		autoplay: true,
1400		autoplaySpeed: 5000,
1401		dots: false,
1402		infinite: true,
1403		adaptiveHeight: false,
1404		speed: 500,
1405		arrows: false
1406	});
1407}
1408
1409
1410function tariffsHeightRound (obj)
1411{
1412	var cols = 0,
1413		cur_row = 1,
1414		heights = new Array();
1415
1416	if ($(window).width() >= 1200) 
1417		cols = obj.attr("data-col-lg");
1418
1419	if ($(window).width() >= 992 && $(window).width() <= 1199) 
1420		cols = obj.attr("data-col-md");
1421
1422	if ($(window).width() >= 768 && $(window).width() <= 991)
1423		cols = obj.attr("data-col-sm");
1424
1425	var quantity = obj.find(".tarif-element-inner").length;
1426
1427	var max_height = 0;
1428
1429	obj.find(".tarif-element-inner").each(function(index) {
1430		var cur_element = index + 1;
1431
1432		if (max_height < $(this).height()) 
1433			max_height = $(this).height();
1434
1435		if (cur_element % cols == 0 || cur_element == quantity)
1436		{
1437			heights[cur_row] = max_height;
1438			cur_row++;
1439			max_height = 0;
1440		}
1441	});
1442	cur_row = 1;
1443	obj.find(".tarif-element-inner").each(function(index) {
1444		var cur_element = index + 1;
1445		var top_height = $(this).find(".trff-top-part").height();
1446		$(this).height(heights[cur_row]);
1447		$(this).find(".trff-top-part").height(top_height + (heights[cur_row] -
1448			$(this).find(".trff-top-part").height() - $(this).find(
1449				".trff-bot-part").height()));
1450
1451		if (cur_element % cols == 0) 
1452			cur_row++;
1453	});
1454}
1455
1456function initTariffsElements(obj){
1457    if ($(window).width() > 767)
1458    {
1459    	if(obj.attr("data-round-height") == "Y")
1460        {
1461        	if(typeof($('.lazyload', obj)) != "undefined")
1462            {
1463                if($('.lazyload', obj).length > 0)
1464                {
1465                    var countItems = $('.lazyload', obj).length;
1466                    $('.lazyload', obj).each(
1467                    function(index, element)
1468                    {
1469                    	$(element).attr("src", $(element).attr("data-src"));
1470                    	$(element).removeAttr('data-src');
1471
1472                    	$(element).load(function()
1473                        {
1474
1475	                        if(index == countItems-1)
1476	                        {
1477	                        	tariffsHeightRound (obj);
1478	                        }
1479	                    });
1480                    });
1481                }
1482
1483                else
1484                {
1485                	tariffsHeightRound (obj);
1486                }
1487            }
1488	    }
1489    }
1490
1491}
1492
1493function correctSizeVideoBg(obj)
1494{
1495
1496	var height = obj.parents('.parent-video-bg').outerHeight();
1497    var videoThis = obj.find(".video-bg-display");
1498    var width = $(window).width();
1499    var video_w = 0;
1500    var video_h = 0;
1501    var add = 4;
1502
1503    if (width / height < 16 / 9){
1504        video_w = height * 16 / 9 + add;
1505        video_h = height + add;
1506    }
1507
1508    else{
1509        video_w = width + add;
1510        video_h = width * 9 / 16 + add;
1511    }
1512
1513    videoThis.width(video_w).height(video_h);
1514    videoThis.addClass('active');
1515}
1516
1517function generateVideoBG(container)
1518{
1519    if($(window).width() >= 1200 || ($(window).width() >= 768 && $(window).width() < 1200 && !device.android() && !isIos) )
1520    {
1521        var videoBG = $(".videoBG", container),
1522            iframeType = videoBG.attr("data-type"),
1523            srcMP4 = videoBG.attr("data-srcMP4"),
1524            srcWEBM = videoBG.attr("data-srcWEBM"),
1525            srcOGG = videoBG.attr("data-srcOGG"),
1526            srcYB = videoBG.attr("data-srcYB"),
1527            html = "";
1528
1529
1530
1531        if(iframeType == "file")
1532        {
1533            if(videoBG.children('video').length <= 0)
1534            {
1535                if( srcMP4 )
1536                    html += '<source src="'+srcMP4+'" type="video/mp4">';
1537
1538                if( srcWEBM )
1539                    html += '<source src="'+srcWEBM+'" type="video/webm">';
1540
1541                if( srcOGG )
1542                    html += '<source src="'+srcOGG+'" type="video/ogg">';
1543
1544
1545                html = '<video class="video-bg-display" autoplay="autoplay" loop="loop" preload="auto" muted="muted">'+html+'</video>';
1546            }
1547        }
1548
1549        else if(iframeType == "iframe")
1550        {
1551
1552            if(videoBG.children('iframe').length <= 0)
1553            {
1554                if( srcYB )
1555                    html += '<iframe src="'+srcYB+'" class="video-bg-display" allowfullscreen="" frameborder="0" height="100%" width="100%"></iframe>';
1556            }
1557        }
1558
1559        if( html )
1560            videoBG.prepend(html);
1561
1562        correctSizeVideoBg(videoBG);
1563                
1564    }
1565}
1566
1567$(window).on("load", function() 
1568{
1569    if(customEvent)
1570    {
1571        updateLazyLoad();
1572    }
1573    else
1574    {
1575        var counter = 0;
1576
1577        var timerId = setInterval(
1578            function()
1579            {
1580                if(counter > 5)
1581                    clearInterval(timerId);
1582
1583                updateLazyLoad();
1584                counter++;
1585            },
1586            1000
1587        );
1588
1589        
1590    }
1591});
1592
1593$(window).load(function() {
1594
1595	if ($('#navigation').hasClass('on-scroll'))
1596	{
1597		var lastmarg = 0;
1598		if (parseInt($("div.block").last().css('margin-bottom')) > 0) 
1599			lastmarg = parseInt($("div.block").last().css('margin-bottom'));
1600
1601		var menu_scroll = $('#navigation.on-scroll').find('div.menu-navigation-inner').outerHeight() + lastmarg;
1602		var side_scroll = $('div.content-inner').outerHeight();
1603		var total = side_scroll - menu_scroll;
1604
1605		if (total > 100) {
1606			$('#navigation.on-scroll').find('div.menu-navigation-wrap').width($(
1607				'#navigation.on-scroll').width());
1608
1609			var base_padding = parseFloat($('#navigation.on-scroll').find('div.menu-navigation-wrap').css("padding-top").replace("px", ""));
1610			var moreHeight = base_padding - 10;
1611
1612			if ($('header').hasClass('fixed')) 
1613				moreHeight = 70 + base_padding - 10;
1614
1615			var sscr = $('div.content-inner').offset().top;
1616			var docscr = $(document).scrollTop() + moreHeight;
1617
1618			$('#navigation.on-scroll').height(side_scroll);
1619
1620			if (sscr + base_padding <= docscr && side_scroll >= (docscr - sscr +
1621					menu_scroll))
1622			{
1623				$('#navigation.on-scroll').addClass('fixed').find(
1624					'div.menu-navigation-wrap').css('padding-top', moreHeight + 'px');
1625				$('#navigation.on-scroll').removeClass('absolute').removeClass('static');
1626			}
1627			else if (side_scroll <= (docscr - sscr + menu_scroll))
1628			{
1629				$('#navigation.on-scroll').removeClass('static');
1630				$('#navigation.on-scroll').removeClass('fixed').addClass('absolute').find(
1631					'div.menu-navigation-wrap').css('padding-bottom', lastmarg + 'px');
1632			}
1633			else
1634			{
1635				$('#navigation.on-scroll').addClass('static');
1636				$('#navigation.on-scroll').removeClass('fixed');
1637			}
1638			$(window).scroll(function()
1639			{
1640
1641				menu_scroll = $('#navigation.on-scroll').find(
1642					'div.menu-navigation-inner').outerHeight() + lastmarg;
1643				side_scroll = $('div.content-inner').outerHeight();
1644				total = side_scroll - menu_scroll;
1645				sscr = $('div.content-inner').offset().top;
1646				docscr = $(document).scrollTop() + moreHeight;
1647
1648				if (side_scroll != $('div.content-inner').outerHeight()) 
1649					side_scroll = $('div.content-inner').outerHeight();
1650
1651				$('#navigation.on-scroll').height(side_scroll);
1652				if (total > 0)
1653				{
1654					if (sscr + base_padding <= docscr && side_scroll >= (docscr - sscr +
1655							menu_scroll))
1656					{
1657						$('#navigation.on-scroll').addClass('fixed').find(
1658							'div.menu-navigation-wrap').css('padding-top', moreHeight + 'px');
1659						$('#navigation.on-scroll').removeClass('absolute').removeClass(
1660							'static');
1661					}
1662					else if (side_scroll <= (docscr - sscr + menu_scroll))
1663					{
1664						$('#navigation.on-scroll').removeClass('static');
1665						$('#navigation.on-scroll').removeClass('fixed').addClass('absolute').find(
1666							'div.menu-navigation-wrap').css('padding-bottom', lastmarg + 'px');
1667					}
1668					else
1669					{
1670						$('#navigation.on-scroll').addClass('static');
1671						$('#navigation.on-scroll').removeClass('fixed');
1672					}
1673				}
1674			});
1675		}
1676	}
1677});
1678
1679
1680
1681
1682function updateMainMenu(menu)
1683{
1684	
1685	if (menu.length > 0)
1686	{
1687		menu.removeClass('full');
1688		menu.find('li.lvl1').removeClass('visible');
1689		menu.parents(".wrap-main-menu").removeClass('ready');
1690
1691		var totalWidth = menu.parents('div.main-menu-inner').width() - 60;
1692
1693	
1694
1695		if ($(".mini-cart-js").length>0) 
1696			totalWidth = totalWidth - $(".mini-cart-js").width();
1697
1698		if($(".mini-search-style").length>0)
1699			totalWidth = totalWidth - $(".mini-search-style").width();
1700
1701		if ($(document).width() > 767)
1702		{
1703			var visible = 0;
1704			var size = menu.find('li.lvl1').length;
1705			
1706			menu.find('li.lvl1').each(function(index)
1707			{
1708
1709				if (visible > 4) 
1710				{
1711					$("div.nav-main-menu-wrap").addClass('more-four');
1712				}
1713
1714				if (totalWidth > ($(this).width()))
1715				{
1716					totalWidth = totalWidth - $(this).width();
1717
1718					$(this).addClass('visible');
1719					visible++;
1720
1721					if (size == (index + 1)) 
1722						$(".wrap-main-menu").addClass('ready');
1723				}
1724				else
1725				{
1726					menu.parents('div.main-menu-inner').find(".ic-main-menu-burger").addClass(
1727						"active").removeClass("noactive");
1728
1729					$(".wrap-main-menu").addClass('ready');
1730					return false;
1731				}
1732			});
1733		}
1734	}
1735}
1736
1737$(document).ready(function() {
1738	updateMainMenu($('nav.main-menu'));
1739});
1740
1741$(window).on("load", function()
1742{
1743	if($(".hide-adv").length>0)
1744    {
1745        setTimeout(function()
1746        {
1747            $.post(
1748            "/bitrix/tools/kraken/ajax/hide_adv.php",
1749            {
1750                "check": "Y",
1751                "USER_ID": $(".hide-adv").attr("data-user")
1752            },
1753            function(data){
1754                if(data.OK == "Y")
1755                {
1756                    $("body").append('<script type="text/javascript">
vendor: 287 bytes, line 1756
1756 (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)}) (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); ym(
175654591493
vendor: 76 bytes, line 1756
1756, "init", { clickmap:false, trackLinks:false, accurateTrackBounce:false }); 
1756</script> <noscript><div><img src="https://mc.yandex.ru/watch/54591493" style="position:absolute; left:-9999px;" alt="" /></div></noscript>'
1757                        +'<script>ym(54591493, \'reachGoal\', \'hide_kraken\');</script>');
1758                }
1759            },
1760            "json"
1761        ); 
1762            
1763        }, 20000); 
1764    }
1765});
1766
1767$(window).scroll(function() {
1768
1769	
1770	if ($('header').hasClass('fixed'))
1771	{
1772		var headerBotPos = $('header').outerHeight(true) + 150;
1773
1774		if ($(window).scrollTop() >= headerBotPos)
1775		{
1776			$('header').addClass('top');
1777			setTimeout(function() {
1778				$('header').addClass('on');
1779			}, 100);
1780		}
1781		else
1782		{
1783			$('header').removeClass('top');
1784			setTimeout(function() {
1785				$('header').removeClass('on');
1786			}, 50);
1787		}
1788	}
1789
1790	var top = $(document).scrollTop();
1791	var height = $('header').height();
1792
1793	if (top >= height) 
1794		$('a.up').addClass('on');
1795	else
1796	{
1797		$('a.up').removeClass('on');
1798	}
1799});
1800
1801var windowWidth = $(window).width();
1802
1803
1804
1805$(window).resize(function() {
1806	
1807	mobileMenuPositionFooter();
1808
1809	if(windowWidth != $(window).width())
1810	{
1811		krakenResizeVideo();
1812		updateMainMenu($('nav.main-menu'));
1813	}
1814	
1815});
1816
1817if ($(window).width() < 1199)
1818{
1819	$(document).on("click", "header .open-list-contact", function() {
1820		$("header div.list-contacts").addClass('open');
1821	});
1822
1823
1824
1825	$(document).mouseup(function(e) {
1826		var div = $("header div.list-contacts");
1827		if (!div.is(e.target) && div.has(e.target).length === 0) div.removeClass(
1828			'open');
1829	});
1830
1831
1832	$(document).on("click", "nav.main-menu li.parent.view_1", function() {
1833		var menu = $(this).parents('nav.main-menu');
1834		if (!$(this).children('a').hasClass("open")) {
1835			$('li.parent', menu).find("ul.child").removeClass("show-open").find(
1836				"ul.child2").removeClass("show-open");
1837			$('li.parent > a', menu).removeClass("open");
1838			$(this).find("ul.child").addClass("show-open");
1839			$(this).children('a').addClass("open");
1840			menuOffset(this);
1841			return false;
1842		}
1843	});
1844
1845
1846	$(document).on("click", "nav.main-menu li.parent.view_2", function() {
1847
1848        if ( !$(this).children('a').hasClass("open") )
1849        {
1850        	$(this).children('a').addClass("open");
1851
1852            var th = $(this);
1853        
1854            $('.lazyload').Lazy(paramsLazy);
1855            $(this).find(".dropdown-menu-view-2").addClass('on');
1856            setTimeout(function() {
1857                th.find(".dropdown-menu-view-2").addClass('active');
1858            }, 100);
1859
1860            return false;
1861        }
1862    });
1863
1864
1865
1866
1867	$(document).on("click", "nav.main-menu li.parent2", function() {
1868		var menu = $(this).parents('nav.main-menu');
1869		var menu_list = $("ul.child > li.parent2", menu);
1870		if (!$(this).children('a').hasClass("open")) {
1871			menu.find("ul.child2").removeClass("show-open");
1872			$(this).find("ul.child2").addClass("show-open");
1873			$("a", menu_list).removeClass("open");
1874			$(this).children('a').addClass("open");
1875			menuOffset(this);
1876			return false;
1877		}
1878	});
1879
1880
1881	$(document).mouseup(function(e) {
1882		var div = $("nav.main-menu");
1883		if (!div.is(e.target) && div.has(e.target).length === 0) {
1884			$('li.parent > a', div).removeClass("open");
1885			$("ul.child", div).removeClass("show-open");
1886			$('li.parent2 > a', div).removeClass("open");
1887			$("ul.child2", div).removeClass("show-open");
1888			
1889			if($(".dropdown-menu-view-2", div).length>0)
1890			{
1891				$(".dropdown-menu-view-2", div).removeClass('active');
1892				setTimeout(function() {
1893                    $(".dropdown-menu-view-2", div).removeClass('on');
1894                }, 100);
1895			}
1896                
1897		}
1898	});
1899}
1900
1901$(document).on("click", ".cart-show", function(){
1902
1903	if ($(this).hasClass('cart-empty')) 
1904		return false;
1905
1906	openCart();
1907});
1908
1909$(document).on("click", ".cart-close", function(){
1910	closeCart();
1911});
1912
1913$(document).on("keypress", "input.count-val", function(e) {
1914	e = e || event;
1915
1916    if (e.ctrlKey || e.altKey || e.metaKey) return;
1917
1918    var chr = getChar(e);
1919
1920    if (chr == null) return false;
1921});
1922
1923$(document).on("blur", "input.count-val", 
1924	function(e)
1925	{
1926		e = e || event;
1927
1928        if (e.ctrlKey || e.altKey || e.metaKey) return;
1929
1930        var chr = getChar(e);
1931
1932        if (chr == null) return false;
1933
1934        var mainBlock = $(this).parents(".parent-calccart"),
1935        	newVal = $(this).val(),
1936        	step = mainBlock.attr(
1937			"data-cart-step"),
1938			minVal = mainBlock.attr(
1939			"data-cart-min"),
1940			productID = mainBlock.attr("data-product-id"),
1941			mainId = mainBlock.attr("data-main-product-id");
1942
1943		step = +step;
1944        minVal = +minVal;
1945
1946        if (isNaN(minVal))
1947            minVal = 1;
1948
1949        if (isNaN(step))
1950            step = 1;
1951
1952        newVal = +newVal;
1953        newVal = parseCount(newVal, step, minVal);
1954		$(this).val(newVal);
1955
1956		updateBasket(productID, newVal, mainId);
1957	}
1958);
1959function parseMinVal(value, step, minVal)
1960{
1961    var tmpMin = step;
1962
1963    if(step < minVal)
1964        tmpMin = minVal;
1965
1966    if (value <= tmpMin || isNaN(value))
1967        value = minVal;
1968
1969    return value;
1970}
1971$(document).on("click", ".count-plus", 
1972	function()
1973	{
1974		actionCalc($(this), true);
1975	}
1976);
1977
1978function actionCalc(_this, action)
1979{
1980	var mainBlock = _this.parents(".parent-calccart"),
1981		input = mainBlock.find("input.count-val"),
1982		value = parseFloat(input.val()),
1983		step = mainBlock.attr("data-cart-step"),
1984		minVal = mainBlock.attr("data-cart-min"),
1985		productID = mainBlock.attr("data-product-id"),
1986		mainId = mainBlock.attr("data-main-product-id");;
1987
1988	step = +step;
1989    minVal = +minVal;
1990
1991    if (isNaN(minVal))
1992        minVal = 1;
1993
1994    if (isNaN(step))
1995        step = 1;
1996
1997    if (isNaN(value))
1998        value = 0;
1999
2000    if(action)
2001    {
2002    	value += step;
2003        value = parseMinVal(value, step, minVal);
2004
2005        input.val(value);
2006    }
2007    else
2008    {
2009    	value -= step;
2010        value = parseMinVal(value, step, minVal);
2011
2012        input.val(value);
2013    }
2014
2015    updateBasket(productID, value, mainId);
2016}
2017
2018$(document).on("click", ".count-minus", 
2019	function() 
2020	{
2021		actionCalc($(this), false);
2022	}
2023);
2024
2025
2026
2027$(document).on('click', 'ul.switcher-tab li:not(.active)', function() {
2028	$(this).addClass('active').siblings().removeClass('active').closest(
2029		'div.switcher').find('div.switcher-wrap').removeClass('active').eq($(this)
2030		.index()).addClass('active');
2031});
2032
2033$(document).on('click', 'a.map-show', function() {
2034	$(this).parent().hide();
2035	$(this).parents('div.map-block').find(".map-height").show();
2036});
2037
2038
2039$(document).on("click", "ul.tabs li:not(.active)", function(){
2040	$(this).addClass('active').siblings().removeClass('active').closest(
2041		'div.descriptive-tabs-wrap').find('div.image-content').removeClass(
2042		'active').eq($(this).index()).addClass('active');
2043		$('.lazyload').Lazy(paramsLazy);
2044});
2045
2046$(document).on("click", "div.mob-tab", function() {
2047
2048	var block = $(this).parent("div.image-content");
2049
2050	if (!$(this).hasClass("active")) {
2051
2052		if ($("img", block).attr("data-src"))
2053		{
2054            var _this = $(this);
2055
2056            $("img", block).Lazy({
2057                afterLoad: function (element) {
2058                    $("img", block).removeAttr('style');
2059
2060                    _this.addClass("active");
2061
2062	                $("div.mob-content", block).slideDown(200, function() {
2063						$(this).removeClass("active");
2064					});
2065                }
2066            });
2067        } 
2068        else
2069        {
2070			$(this).addClass("active");
2071			$("div.mob-content", block).slideDown(200, function() {
2072				$(this).removeClass("active");
2073			});
2074		}
2075
2076
2077	} else {
2078		$(this).removeClass("active");
2079		$("div.mob-content", block).slideUp(200, function() {
2080			$(this).removeClass("active");
2081		});
2082	}
2083});
2084
2085$(document).on("click", "div.wrap-scroll-down", function(){
2086	var s_b = $(this).parents('div.parent-scroll-down').next(),
2087		heightOut = 70,
2088		destination = null;
2089
2090	while (s_b.hasClass('hidden-lg')) {
2091		s_b = s_b.next();
2092	}
2093
2094	destination = $(s_b).offset().top - heightOut;
2095
2096	$("html:not(:animated),body:not(:animated)").animate({
2097		scrollTop: destination
2098	}, 700);
2099});
2100
2101$(document).on('click', '.open-main-menu', function() {
2102	if ($(window).width() <= 767) {
2103
2104		$('div.open-menu-mobile').addClass('show-open');
2105		setTimeout(function() {
2106			$('div.open-menu-mobile.show-open').addClass('on');
2107		}, 50);
2108		setTimeout(function() {
2109			$('a.close-menu.mobile').addClass('on');
2110		}, 1000);
2111		setTimeout(function() {
2112			mobileMenuPositionFooter();
2113		}, 100);
2114		$('body').addClass('modal-open');
2115		$('a.up').addClass('hidden');
2116
2117
2118	} else {
2119		$('div.open-menu').addClass('show-open');
2120		setTimeout(function() {
2121			openMenuFooterPos();
2122		}, 100);
2123		setTimeout(function() {
2124			$('div.open-menu').addClass('on');
2125		}, 150);
2126		$('div.wrapper').addClass('blur');
2127		$('div.menu-shadow').addClass('show-open');
2128		$('body').addClass('modal-open');
2129		$(".open-cart").addClass('off');
2130	}
2131	$('.lazyload').Lazy(paramsLazy);
2132});
2133
2134$(document).on('click', '.close-menu', function() {
2135	if ($(window).width() <= 767) {
2136		$('div.open-menu-mobile').removeClass('on');
2137		$('body').removeClass('modal-open');
2138		$('a.close-menu.mobile').removeClass('on');
2139		setTimeout(function() {
2140			$('div.open-menu-mobile.show-open').removeClass('show-open');
2141		}, 500);
2142		$('a.up').removeClass('hidden');
2143	} else {
2144		$('div.wrapper').removeClass('blur');
2145		$('div.open-menu').removeClass('show-open');
2146		$('div.menu-shadow').removeClass('show-open');
2147		$('body').removeClass('modal-open');
2148		$(".open-cart").removeClass('off');
2149	}
2150});
2151
2152
2153$(document).on('click', '.close-menu-js.open', function() {
2154	
2155	$('div.wrapper').removeClass('blur');
2156	$('div.open-menu').removeClass('show-open');
2157	$('div.menu-shadow').removeClass('show-open');
2158	$('body').removeClass('modal-open');
2159	$(".open-cart").removeClass('off');
2160
2161});
2162
2163$(document).on('click', '.close-menu-mobile-js', function() {
2164
2165	$('div.open-menu-mobile').removeClass('on');
2166	$('body').removeClass('modal-open');
2167	$('a.close-menu.mobile').removeClass('on');
2168	setTimeout(function() {
2169		$('div.open-menu-mobile.show-open').removeClass('show-open');
2170	}, 500);
2171		$('a.up').removeClass('hidden');
2172});
2173
2174$(document).on("click", "div.list-menu li.parent", function() {
2175	var menu = $(this).parents('div.list-menu');
2176	var Li = $(this);
2177	menu.find('ul.child2').slideUp(200);
2178	if (!$(this).children('a').hasClass("open")) {
2179		$('li.parent > a', menu).removeClass("open");
2180		$("ul.child2", Li).slideDown(200);
2181		$(this).children('a').addClass("open");
2182		return false;
2183	} else if ($(this).children('a').hasClass("empty-link")) {
2184		menu.find('ul.child2').slideUp(200);
2185		$('li.parent > a', menu).removeClass("open");
2186	}
2187});
2188
2189$(document).on('click', 'a.open-mobile-list', function() {
2190	$('ul.mobile-menu-list').removeClass('show-open');
2191	$("ul.mobile-menu-list[data-menu-list='" + $(this).attr('data-menu-list') +
2192		"']").addClass('show-open');
2193	mobileMenuPositionFooter();
2194});
2195
2196$(document).on('click', 'div.open-menu-mobile div.open-list-contact', function() {
2197	var btn = $(this);
2198	if (!btn.hasClass("active")) {
2199		btn.parents('div.contacts').find('div.list-contacts').addClass('open');
2200		btn.addClass("active");
2201	} else {
2202		btn.parents('div.contacts').find('div.list-contacts').removeClass('open');
2203		btn.removeClass("active");
2204	}
2205	mobileMenuPositionFooter();
2206});
2207
2208$(document).on("click", "a.scroll", function() {
2209	var elementClick = $(this).attr("href");
2210	scrollToBlock(elementClick, $(this));
2211	if ($(this).hasClass('from-modal')) {
2212		$('div.no-click-block').removeClass('on');
2213		$('body').removeClass('modal-open');
2214		$('div.wrapper').removeClass('blur');
2215		if (isIos) {
2216			window.scrollTo(0, cur_pos);
2217			$("body").removeClass("modal-ios");
2218		}
2219	}
2220	return false;
2221});
2222
2223$(document).on('click', 'div.tab-child:not(.active)', function() {
2224	$(this).addClass('active').siblings().removeClass('active').closest(
2225		'div.tab-parent').find('div.tab-content').removeClass('active').eq($(this)
2226		.index()).addClass('active');
2227});
2228
2229$(document).on('click', '.select-list-choose', function() {
2230	$(this).parents('.form-select').addClass('open');
2231});
2232
2233$(document).on('click', '.ar-down', function() {
2234	if ($(this).parents('.form-select').hasClass('open')) $(this).parents(
2235		'.form-select').removeClass('open');
2236	else {
2237		$(this).parents('.form-select').addClass('open');
2238	}
2239});
2240
2241$(document).on('click', '.form-select .name', function() {
2242	$(this).parents('.form-select').find('.select-list-choose').removeClass(
2243		'first').find(".list-area").text($(this).text());
2244	$(this).parents('.form-select').removeClass('open');
2245});
2246
2247$(document).on('click', '.call-modal', function() {
2248	
2249	if (!$("body").hasClass("modal-ios")) cur_pos = $(document).scrollTop();
2250	var path = '';
2251	var area = '';
2252	var value = $(this).attr("data-call-modal");
2253	var platform = $(this).attr("data-video-platform");
2254	var comment = $(this).attr("data-name");
2255	var header = $(this).attr("data-header");
2256	var formTitle = $(this).attr("data-name-form");
2257	var from = $(this).attr("data-from-open-modal");
2258	var element_id = "";
2259	var element_type = "";
2260	if ($(this).hasClass("more-modal-info")) {
2261		element_id = $(this).attr("data-element-id");
2262		element_type = $(this).attr("data-element-type");
2263	}
2264	var cart_form = "";
2265	var th = $(this);
2266
2267	
2268	site_id = $("input.site_id").val();
2269
2270	$('div.wrapper').addClass('blur');
2271	if ($(this).hasClass('callform')) {
2272		area = 'modalAreaForm';
2273		path = 'formmodal.php';
2274		value = value.replace("form", "");
2275		if ($(this).hasClass('for_cart')) cart_form = "Y";
2276	}
2277	if ($(this).hasClass('cart-form')) {
2278		area = 'areacart-form';
2279		path = 'form_cart.php';
2280		value = value.replace("form", "");
2281	}
2282	if ($(this).hasClass('callvideo')) {
2283		area = 'modalAreaVideo';
2284		path = 'videomodal.php';
2285	}
2286	if ($(this).hasClass('callmodal')) {
2287		area = 'modalAreaWindow';
2288		path = 'windowmodal.php';
2289		value = value.replace("modal", "");
2290	}
2291	if ($(this).hasClass('callagreement')) {
2292		area = 'modalAreaAgreement';
2293		path = 'agreemodal.php';
2294		value = value.replace("agreement", "");
2295	}
2296	if (typeof(comment) != "undefined") {
2297		if (comment.length > 0) type = "Y";
2298	}
2299	$('.google-spin-wrapper').addClass('active');
2300	$.post("/bitrix/tools/kraken/ajax/" + path, {
2301		formId: value,
2302		site_id: site_id,
2303		element_id: element_id,
2304		element_type: element_type,
2305		cart_form: cart_form,
2306		platform: platform
2307	}, function(html) {
2308		$("body").addClass("modal-open");
2309		if (isIos && !th.hasClass('box-form')) {
2310			$("body").addClass("modal-ios");
2311		}
2312		$('div.' + area).html(html);
2313
2314		$('[data-toggle="tooltip"]').tooltip({
2315                    html:true,
2316                    container: "body"
2317                });
2318		checkToolSettings();
2319
2320		$('.google-spin-wrapper').removeClass('active');
2321		if (from == 'open-menu') {
2322			$('div.open-menu').addClass('blur');
2323			$('div.' + area).find('.close-modal').addClass('open-menu');
2324		}
2325		setTimeout(function() {
2326			$('div.' + area).find('.kraken-modal').addClass('active');
2327		}, 100);
2328		if (area == 'modalAreaForm') {
2329
2330			setTimeout(function() {
2331				$("input[name='url']").val(decodeURIComponent(location.href));
2332
2333				if (typeof(comment) != "undefined") {
2334					if (comment.length > 0) $("div.modalAreaForm").find("div.add_text").html(
2335						comment);
2336				}
2337				if (typeof(formTitle) != "undefined") {
2338					if (formTitle.length > 0) $('div.modalAreaForm').find(
2339						"form input[name='comment']").val(formTitle);
2340				}
2341				if (typeof(header) != "undefined") {
2342					if (header.length > 0) $('div.modalAreaForm').find(
2343						"form input[name='header']").val(header);
2344				}
2345				$.datetimepicker.setLocale('ru');
2346				$('div.modalAreaForm form.form .date').datetimepicker({
2347					timepicker: false,
2348					format: 'd/m/Y',
2349					scrollMonth: false,
2350					scrollInput: false,
2351					dayOfWeekStart: 1
2352				});
2353			}, 100);
2354		}
2355		if (area == 'modalAreaVideo') {
2356			setTimeout(function() {
2357				krakenResizeVideo();
2358			}, 100);
2359		}
2360		
2361		if (th.hasClass('from-modalform')) {
2362			$('div.modalAreaAgreement').find('.close-modal').addClass('from-modal');
2363			$('div.modalAreaAgreement').find('.close-modal').addClass(
2364				'from-modalform');
2365			$('div.form-modal').addClass('blur');
2366		}
2367		else if (th.hasClass('from-openmenu')) {
2368			$('div.modalAreaForm').find('.close-modal').addClass('from-modal');
2369			$('div.modalAreaAgreement').find('.close-modal').addClass('from-modal');
2370			$('div.modalAreaAgreement').find('.close-modal').addClass(
2371				'from-openmenu');
2372			$('div.modalAreaForm').find('.close-modal').addClass('from-openmenu');
2373			$('div.open-menu').addClass('blur');
2374			$('div.modalAreaWindow').find('.close-modal').addClass('from-modal');
2375			$('div.modalAreaWindow').find('.close-modal').addClass('from-openmenu');
2376		}
2377		else if (th.hasClass('from-set')) {
2378			$('div.modalAreaForm').find('.close-modal').addClass('from-modal');
2379			$('div.modalAreaWindow').find('.close-modal').addClass('from-modal');
2380		}
2381		else if (th.hasClass('from-modal')) {
2382			$('div.modalAreaForm').find('.close-modal').addClass('from-modal');
2383			$('div.modalAreaWindow').find('.close-modal').addClass('from-modal');
2384			$('div.modalAreaAgreement').find('.close-modal').addClass('from-modal');
2385		}
2386		
2387		else if (area == 'areacart-form') {
2388			th.parents(".wrapper-cart").find(".info-table").removeClass('active');
2389			th.parents(".wrapper-cart").find(".cart-back").addClass('active');
2390			th.parents(".wrapper-cart").find(".areacart-form").addClass('active');
2391			th.parents(".wrapper-cart").find("form input[name='url']").val(
2392				decodeURIComponent(location.href));
2393			$.datetimepicker.setLocale('ru');
2394			$('.wrapper-cart form.form .date').datetimepicker({
2395				timepicker: false,
2396				format: 'd/m/Y',
2397				scrollMonth: false,
2398				scrollInput: false,
2399				dayOfWeekStart: 1
2400			});
2401		}
2402
2403		$('.lazyload').Lazy(paramsLazy);
2404	});
2405});
2406
2407$(document).on("click", ".cart-back", function(e) {
2408	$(this).removeClass('active');
2409	$(this).parents(".wrapper-cart").find(".areacart-form").removeClass('active');
2410	$(this).parents(".wrapper-cart").find(".info-table").addClass('active');
2411});
2412
2413$(document).on('click', '.close-modal', function() {
2414	$('div.modalAreaForm form.form .date').datetimepicker('destroy');
2415	if (!($(this).hasClass('from-modal'))){
2416		stopBlurWrapperContainer();
2417	}
2418	if ($(this).hasClass('from-modalform')) $('div.form-modal').removeClass(
2419		'blur');
2420	if ($(this).hasClass('from-openmenu')) $('div.open-menu').removeClass('blur');
2421	if ($(this).hasClass('wind-close')) $(this).parents(
2422		"div.shadow-modal-wind-contact").removeClass('on');
2423	else {
2424		$(this).parents("div.modalArea").children().remove();
2425	}
2426});
2427
2428$(document).on('click', '.open_modal_contacts', function() {
2429	$('div.shadow-modal-wind-contact').addClass('on');
2430	$('div.wrapper').addClass('blur');
2431	$("body").addClass("modal-open");
2432	if (isIos) {
2433		cur_pos = $(document).scrollTop();
2434		$("body").addClass("modal-ios");
2435	}
2436});
2437
2438$(document).on('click', 'div.tab-menu', function() {
2439	$(this).parents('.tab-control').find('.tab-menu').removeClass('active');
2440	$(this).parents('.tab-control').find('.tabb-content').removeClass('active');
2441	$(this).addClass('active');
2442	$('.tabb-content[data-tab="' + $(this).attr("data-tab") + '"]').addClass(
2443		'active');
2444});
2445
2446$(document).on('click', '.show-hidden', function() {
2447	$(this).parents('.show-hidden-parent').find('.show-hidden-child').removeClass(
2448		'hidden').removeClass('hidden-sm');
2449	$(this).hide();
2450	$(this).parent().addClass('off');
2451});
2452
2453$(document).on("click", ".click-slide-show", function() {
2454	var block = $(this).parent(".parent-slide-show");
2455	if (!$(this).hasClass("active")) {
2456		$(this).addClass("active");
2457		$(".content-slide-show", block).slideDown(200, function() {
2458			$(this).addClass("active");
2459		});
2460	} else {
2461		$(this).removeClass("active");
2462		$(".content-slide-show", block).slideUp(200, function() {
2463			$(this).removeClass("active");
2464		});
2465	}
2466});
2467
2468Share = {
2469    vkontakte: function(purl, ptitle, pimg, text) {
2470        url = 'http://vkontakte.ru/share.php?';
2471        url += 'url=' + encodeURIComponent(purl);
2472        url += '&title=' + encodeURIComponent(ptitle);
2473        url += '&description=' + encodeURIComponent(text);
2474        url += '&image=' + encodeURIComponent(pimg);
2475        url += '&noparse=true';
2476        Share.popup(url);
2477    },
2478    facebook: function(purl, ptitle, pimg, text) {
2479        url = 'https://www.facebook.com/sharer/sharer.php?';
2480        url += '&title=' + encodeURIComponent(ptitle);
2481        url += '&description=' + encodeURIComponent(text);
2482        url += '&u=' + encodeURIComponent(purl);
2483        url += '&picture=' + encodeURIComponent(pimg);
2484        Share.popup(url);
2485    },
2486    twitter: function(purl, ptitle) {
2487        url = 'http://twitter.com/share?';
2488        url += 'text=' + encodeURIComponent(ptitle);
2489        url += '&url=' + encodeURIComponent(purl);
2490        url += '&counturl=' + encodeURIComponent(purl);
2491        Share.popup(url);
2492    },
2493
2494    ok: function(purl, ptitle) {
2495        url  = 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview';
2496        url += '&st.title=' + encodeURIComponent(ptitle);
2497        url += '&st.shareUrl='    + encodeURIComponent(purl);
2498        Share.popup(url);
2499    },
2500
2501    mailRu: function(purl, ptitle) {
2502        url  = 'https://connect.mail.ru/share?';
2503        url += '&url=' + encodeURIComponent(purl);
2504        url += '&title='    + encodeURIComponent(ptitle);
2505        Share.popup(url);
2506    },
2507
2508    wtsApp: function(purl, ptitle) {
2509        url  = 'https://api.whatsapp.com/send?';
2510        url += '&text=' + encodeURIComponent(ptitle) + ' ' + encodeURIComponent(purl);
2511        Share.popup(url);
2512    },
2513
2514    telegram: function(purl, ptitle) {
2515        url  = 'https://telegram.me/share/url?';
2516        url += 'url=' + encodeURIComponent(purl);
2517        url += '&text=' + encodeURIComponent(ptitle);
2518        Share.popup(url);
2519    },
2520    skype: function(purl) {
2521        url  = 'https://web.skype.com/share?';
2522        url += 'url=' + encodeURIComponent(purl);
2523        Share.popup(url);
2524    },
2525    gPlus: function(purl) {
2526        url  = 'https://plus.google.com/share?';
2527        url += 'url=' + encodeURIComponent(purl);
2528        Share.popup(url);
2529    },
2530
2531    reddit: function(purl) {
2532        url  = 'https://www.reddit.com/submit?';
2533        url += 'url=' + encodeURIComponent(purl);
2534        Share.popup(url);
2535    },
2536
2537    popup: function(url) {
2538        window.open(url, '', 'toolbar=0,status=0,width=626,height=436');
2539    }
2540};
2541
2542$(document).on('click', '.click-show-pic', function() {
2543	$(this).parents('.parent-show-pic').find('.item-show-pic').removeClass(
2544		'active');
2545	$(this).parents('.parent-show-pic').find('.click-show-pic').removeClass(
2546		'active');
2547	$(this).parents('.parent-show-pic').find('.item-show-pic[data-show-pic="' +
2548		$(this).attr("data-show-pic") + '"]').addClass('active');
2549	$(this).addClass('active');
2550});
2551
2552$(document).on('click', '.scroll-next', function() {
2553	var dist = $(this).parents('.scroll-next-parent').next().offset().top - 40;
2554	if ($("header").hasClass("fixed")) dist -= 70;
2555	$("html:not(:animated),body:not(:animated)").animate({
2556		scrollTop: dist
2557	}, 700);
2558});
2559
2560$(document).on("click", ".kraken-alert-btn", function() {
2561	$("div.alert-block div.kraken-alert-btn").addClass("on");
2562	$("div.alert-block div.alert-block-content").addClass("on");
2563});
2564
2565$(document).on("click", "a.alert-close", function() {
2566	$("div.alert-block div.kraken-alert-btn").removeClass("on");
2567	$("div.alert-block div.alert-block-content").removeClass("on");
2568});
2569
2570var mouseUp = (isIos)?"touchend":"mouseup";
2571
2572$(document).on( mouseUp, function(e){
2573
2574	var div = $(".form-select");
2575	if (!div.is(e.target) && div.has(e.target).length === 0) 
2576		div.removeClass('open');
2577	
2578
2579	var div2 = $(".search-list");
2580	if (!div2.is(e.target) && div2.hasClass("active")) 
2581	{
2582		div2.removeClass('active');
2583	}
2584
2585	var search_top_js = $(".search-top-js");
2586	if (!search_top_js.is(e.target) && search_top_js.has(e.target).length === 0) 
2587	{
2588		if(search_top_js.hasClass("active"))
2589		{
2590			search_top_js.removeClass('active');
2591			$(".no-click-block").removeClass('on');
2592			$('body').removeClass('modal-open');
2593			$('.wrapper').removeClass('blur');
2594			var st = setTimeout(function()
2595			{
2596				search_top_js.removeClass('fixed');
2597				clearTimeout(st);
2598			}, 100);
2599		}
2600	}
2601
2602	var checboxReq = $(".check-require.has-error");
2603    if (!checboxReq.is(e.target)) 
2604        checboxReq.removeClass('has-error');
2605    
2606
2607    var selectReq = $(".form-select.has-error");
2608    if (!selectReq.is(e.target)) 
2609        selectReq.removeClass('has-error');
2610
2611});
2612
2613$(document).on('change', ".cart-choose-select", function() {
2614	$(this).parents(".parent-choose-select").find(".inp-show-js").removeClass(
2615		'active');
2616	$(this).parents(".parent-choose-select").find(
2617		".inp-show-js[data-choose-select='" + $(this).attr("data-choose-select") +
2618		"']").addClass('active');
2619});
2620
2621$(document).on("click", ".search-icon-js", function(){
2622	$(this).parents(".search-input-box").find(".search-js").focus();
2623});
2624
2625$(document).on("click", ".show-search-list", function(){
2626	$(this).parents(".show-search-list-parent").find(".search-list").addClass('active');
2627});
2628
2629$(document).ready(function() 
2630{
2631	if($('div.first-slider.slider-lg').length>0)
2632        initFSlider($('div.first-slider.slider-lg'), "lg");
2633
2634    if($('div.first-slider.slider-xs').length>0)
2635        initFSlider($('div.first-slider.slider-xs'), "xs");
2636});
2637
2638/*$(document).ready(function() 
2639{
2640	$("form.search-form").each(
2641		function()
2642		{
2643			var attr_url = $(this).find("span.search-get.active").attr("data-url");
2644
2645			if(typeof(attr_url) == "undefined")
2646				attr_url = location.href;
2647
2648			$(this).attr("action", attr_url);
2649		}
2650	);
2651
2652});*/
2653
2654$(document).on("click", "span.search-get", function()
2655{
2656	$(this).parents(".show-search-list-parent").find(".search-cur").text($(this).text());
2657	$(this).parents(".search-list").find('span.search-get').removeClass("active");
2658	$(this).parents(".search-list").removeClass('active');
2659	$(this).addClass('active');
2660	$(this).parents("form.search-form").attr("action", $(this).attr("data-url"));
2661});
2662
2663
2664function checkInput(input)
2665{
2666
2667	if(input.parents('.search-panel-js').hasClass("hint"))
2668	{
2669		if (input.val().length > 0)
2670	    {
2671	        input.parents('.search-panel-js').find('.hint-area').hide();
2672	        input.parents('.search-panel-js').find('.search-btns-box').addClass('before-active');
2673
2674	        var timeOut = setTimeout(
2675	            function(){
2676			        input.parents('.search-panel-js').find('.search-btns-box').addClass('active');
2677			        clearTimeout(timeOut);
2678			    },100);
2679	    }
2680	    else
2681	    {
2682	        input.parents('.search-panel-js').find('.search-btns-box').removeClass('before-active active');
2683	    	input.parents('.search-panel-js').find('.hint-area').show();
2684	    }
2685	}
2686
2687	 
2688
2689}
2690$(document).on("keyup", "form.search-form input.search-js",
2691    function() {
2692    	checkInput( $(this) );
2693    }
2694);
2695
2696$('form.search-form input.search-js').focusout(function() {
2697    checkInput( $(this) );
2698});
2699
2700$(document).on("click", ".paste-in-input", function(){
2701	var input = $(this).parents('.search-panel-js').find('input.search-js');
2702	input.val($(this).text());
2703	checkInput( input );
2704});
2705
2706$(document).on("click", ".open-search-top", function(){
2707	$(".search-top-js").addClass('fixed');
2708	$('.wrapper').addClass('blur');
2709	$('body').addClass('modal-open');
2710	var st = setTimeout(function()
2711	{
2712		$(".no-click-block").addClass('on');
2713		$(".search-top-js").addClass('active');
2714		$(".search-top-js").find('input.search-js').focus();
2715		clearTimeout(st);
2716	}, 100);
2717});
2718$(document).on("click", ".close-search-top", function(){
2719	$(this).parents(".search-top-js").removeClass('active');
2720	var th = $(this);
2721	$(".no-click-block").removeClass('on');
2722	$('body').removeClass('modal-open');
2723	$('.wrapper').removeClass('blur');
2724	var st = setTimeout(function()
2725	{
2726		th.parents(".search-top-js").removeClass('fixed');
2727		clearTimeout(st);
2728	}, 100);
2729
2730});
2731
2732
2733(function(window){
2734
2735	window.JCCatalogElement = function(arParams)
2736    {
2737    	
2738    	this.productType = null;
2739    	this.firstLoad = true;
2740    	this.visual = {};
2741
2742        this.config = {
2743            useAdd2Basket: false,
2744            useFastOrder: false,
2745            useSku: false
2746        };
2747        this.product = {};
2748        this.offerNum = 0;
2749        this.offerNumPrev = 0;
2750        this.treeProps = [];
2751        this.selectedValues = {};
2752        this.emptySku = true;
2753        this.formFastOrder = null;
2754
2755
2756
2757        this.obTree = null;
2758        this.obGallery = null;
2759        this.obArticleAvailableText = null;
2760        this.obArticle = null;
2761        this.obWrArticle = null;
2762        this.obAvailable = null;
2763        this.obWrAvailable = null;
2764        this.obText = null;
2765        this.obWrText = null;
2766
2767
2768        this.obPriceBlock = null;
2769        this.obPriceRequest = null;
2770        this.obPrice = null;
2771        this.obOldPrice = null;
2772        this.obDots = null;
2773        this.obDiscount = null;
2774
2775        this.obSkuChars = null;
2776
2777
2778        this.obComment1 = null;
2779
2780
2781        this.obBtnFastOrder = null;
2782        this.obBtnAdd2Basket = null;
2783
2784
2785        this.errorCode = 0;
2786
2787        if (typeof arParams === 'object')
2788        {
2789        	this.params = arParams;
2790            this.initConfig();
2791            this.initBtns();
2792
2793            switch (this.productType)
2794            {
2795                case "PRODUCT":
2796                    this.initProductData();
2797                    break;
2798                case "OFFERS":
2799
2800                	if(!this.emptySku)
2801                    	this.initOffersData();
2802
2803                    break;
2804                default:
2805                    this.errorCode = -1;
2806            }
2807        }
2808
2809        if (this.errorCode === 0)
2810            BX.ready(BX.delegate(this.init, this));
2811
2812        this.params = {};
2813    },
2814
2815    window.JCCatalogElement.prototype = 
2816    {
2817    	initBtns: function()
2818    	{
2819    		if(this.config.useFastOrder)
2820        	{
2821        		this.obBtnFastOrder = BX(this.visual.BTN_FAST_ORDER);
2822        		BX.bind(this.obBtnFastOrder, 'click', BX.delegate(this.callFastOrderForm, this));
2823        	}
2824
2825        	if(this.config.useAdd2Basket)
2826        	{
2827        		this.obBtnAdd2Basket = BX(this.visual.BTN_ADD2BASKET);
2828        		BX.bind(this.obBtnAdd2Basket, 'click', BX.delegate(this.add2Basket, this));
2829        	}
2830    	},
2831
2832    	initConfig: function()
2833    	{
2834
2835    		this.productType = this.params.PRODUCT_TYPE;
2836
2837    		this.visual = this.params.VISUAL;
2838
2839    		if(this.params.CONFIG.USE_ADD2BASKET)
2840                this.config.useAdd2Basket = this.params.CONFIG.USE_ADD2BASKET;
2841
2842            if(this.params.CONFIG.USE_FAST_ORDER)
2843                this.config.useFastOrder = this.params.CONFIG.USE_FAST_ORDER;
2844
2845            if(this.params.CONFIG.USE_SKU)
2846                this.config.useSku = this.params.CONFIG.USE_SKU;
2847
2848
2849            
2850        	this.emptySku = this.params.CONFIG.EMPTY_SKU;
2851            
2852            this.product = this.params.PRODUCT;
2853
2854            this.formFastOrder = this.params.FAST_ORDER_FORM_ID;
2855    	},
2856
2857    	init: function()
2858        {
2859        	switch (this.productType)
2860            {
2861                case "PRODUCT":
2862                    break;
2863                case "OFFERS":
2864        			this.setCurrent();
2865
2866                    break;
2867                default:
2868                    this.errorCode = -1;
2869            }
2870        },
2871
2872        initProductData: function()
2873        {
2874        	this.refreshBtnAdd2Basket();
2875        },
2876
2877       	initOffersData: function()
2878        {
2879
2880        	this.treeProps = this.params.TREE_PROPS;
2881        	this.obTree = BX(this.visual.SKU_ID);
2882        	this.obGallery = BX(this.visual.GALLERY);
2883
2884        	this.obArticleAvailableText = BX(this.visual.ARTICLE_AVAILABLE_TEXT);
2885	        this.obArticle = BX(this.visual.ARTICLE);
2886	        this.obWrArticle = BX(this.visual.ARTICLE_BLOCK);
2887	        this.obAvailable = BX(this.visual.AVAILABLE);
2888	        this.obWrAvailable = BX(this.visual.AVAILABLE_BLOCK);
2889	        this.obText = BX(this.visual.PREVIEW_TEXT);
2890	        this.obWrText = BX(this.visual.PREVIEW_TEXT_BLOCK);
2891
2892	        this.obPriceBlock = BX(this.visual.PRICE_BLOCK_ID);
2893	        /*this.obPriceRequest = BX(this.visual.PRICE_REQUEST);*/
2894	        this.obPrice = BX(this.visual.PRICE_VALUE);
2895	        this.obOldPrice = BX(this.visual.OLDPRICE_VALUE);
2896	        this.obDots = BX(this.visual.DOTS);
2897	        this.obDiscount = BX(this.visual.DISCOUNT);
2898
2899	        this.obComment1 = BX(this.visual.PRICE_COMMENT1);
2900
2901	        this.obSkuChars = BX(this.visual.CHARS);
2902
2903        	var treeItems = this.obTree.querySelectorAll('li');
2904
2905	        for (i = 0; i < treeItems.length; i++)
2906	        {
2907	            BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this));
2908	        }
2909
2910	        if(this.params.OFFER_SELECTED != "0")
2911	        {
2912	        	this.offerNum = this.params.OFFER_SELECTED;
2913	        	/*this.firstLoad = false;*/
2914	        }
2915
2916        },
2917
2918        deleteParameterURL: function (url, param) {
2919            var a = url.split('?');
2920            var re = new RegExp('(\\?|&)'+param+'=[^&]+','g');
2921
2922            if(url == "undefined")
2923                url = "";
2924
2925            url=('?'+a[1]).replace(re,'');
2926            url=url.replace(/^&|\?/,'');
2927
2928            if(url == "undefined")
2929                url = "";
2930
2931            var dlm=(url=='')? '': '?';
2932            return a[0]+dlm+url;
2933        },
2934
2935        addParameterToURL: function (param, value){
2936
2937            var url = window.location.href;
2938            
2939
2940            if (history.replaceState) {
2941                var baseUrl = this.deleteParameterURL(url, param);
2942                baseUrl += (baseUrl.split('?')[1] ? '&':'?') + param+"="+value;
2943                history.replaceState(null, null, baseUrl);
2944            }
2945            else {
2946                console.warn('History API don`t support');
2947            }
2948        },
2949
2950        callFastOrderForm: function()
2951        {
2952
2953        	var productID, mainID=null, isOffer="N";
2954
2955        	switch (this.productType)
2956            {
2957                case "PRODUCT":
2958                    productID = this.product.PRODUCT_ID;
2959                    mainID = this.product.MAIN_ID;
2960                    break;
2961                case "OFFERS":
2962                	productID = this.product[this.offerNum].PRODUCT_ID;
2963                	mainID = this.product[this.offerNum].MAIN_ID;
2964                	isOffer = "Y";
2965                    break;
2966                default:
2967                    break;
2968            }
2969
2970        	var params = {
2971				"element_type": "CTL",
2972				"element_id": productID,
2973				"main_id": mainID,
2974				"isOffer": isOffer,
2975				"formId": this.formFastOrder,
2976				"action": "order"
2977			};
2978
2979			callFormDialog(params);
2980        },
2981
2982        add2Basket: function()
2983        {
2984        	var productID = "", count = "", _this=this, mainID = "";
2985
2986
2987                		
2988        	switch (this.productType)
2989            {
2990                case "PRODUCT":
2991                    productID = this.product.PRODUCT_ID;
2992                    count = this.product.MIN_QUANTITY;
2993                    mainID = this.product.MAIN_ID;
2994                    break;
2995                case "OFFERS":
2996                	productID = this.product[this.offerNum].PRODUCT_ID;
2997                	count = this.product[this.offerNum].MIN_QUANTITY;
2998                	mainID = this.product[this.offerNum].MAIN_ID;
2999
3000                    break;
3001                default:
3002                    break;
3003            }
3004
3005            add2Basket(productID, count, mainID, function(){
3006            	_this.refreshBtnAdd2Basket();
3007            });
3008
3009        },
3010
3011        selectOfferProp: function()
3012        {
3013        	var i = 0,
3014                strTreeValue = '',
3015                arTreeItem = [],
3016                rowItems = null,
3017                target = BX.proxy_context;
3018
3019
3020            if (target && target.hasAttribute('data-treevalue'))
3021            {
3022                if (BX.hasClass(target, 'active'))
3023                    return;
3024
3025
3026                strTreeValue = target.getAttribute('data-treevalue');
3027                arTreeItem = strTreeValue.split('_');
3028
3029                this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]);
3030
3031
3032                rowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
3033
3034
3035                if (rowItems && rowItems.length)
3036                {
3037                    for (i = 0; i < rowItems.length; i++)
3038                    {
3039                        BX.removeClass(rowItems[i], 'active');
3040                    }
3041                }
3042
3043                
3044                BX.addClass(target, 'active');
3045
3046            }
3047        },
3048
3049        searchOfferPropIndex: function(strPropID, strPropValue)
3050        {
3051        	var i = 0,
3052        		j = 0,
3053        		strName='',
3054        		arShowValues = false,
3055        		arFilter = {};
3056
3057
3058        	for (i = 0; i < this.treeProps.length; i++)
3059            {
3060                if (this.treeProps[i].ID === strPropID)
3061                {
3062                    index = i;
3063                    break;
3064                }
3065            }
3066
3067            if (index > -1)
3068            {
3069            	for (i = 0; i < index; i++)
3070                {
3071                    strName = 'PROP_' + this.treeProps[i].ID;
3072                    arFilter[strName] = this.selectedValues[strName];
3073                }
3074
3075                strName = 'PROP_' + this.treeProps[index].ID;
3076                arFilter[strName] = strPropValue;
3077
3078
3079                for (i = index + 1; i < this.treeProps.length; i++)
3080                {
3081                	strName = 'PROP_' + this.treeProps[i].ID;
3082                    arShowValues = this.getRowValues(arFilter, strName);
3083
3084                    if (!arShowValues)
3085                        break;
3086
3087                    if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arShowValues))
3088                    {
3089                    	arFilter[strName] = this.selectedValues[strName];
3090                    }
3091                    else
3092                    {
3093                    	arFilter[strName] = arShowValues[0];
3094                    }
3095
3096
3097                    this.updateRow(i, arFilter[strName], arShowValues);
3098
3099
3100                }
3101
3102                this.selectedValues = arFilter;
3103
3104
3105                this.changeInfo();
3106
3107            }
3108
3109        },
3110
3111        setCurrent: function()
3112        {
3113        	var i = 0,
3114        		j = 0,
3115        		strName='',
3116        		arShowValues = false,
3117        		arFilter = {},
3118        		current = this.product[this.offerNum].TREE;
3119
3120
3121        	for (i = 0; i < this.treeProps.length; i++)
3122            {
3123            	strName = 'PROP_' + this.treeProps[i].ID;
3124            	arShowValues = this.getRowValues(arFilter, strName);
3125
3126            	if (!arShowValues)
3127            		break;
3128
3129
3130            	if (BX.util.in_array(current[strName], arShowValues) && current[strName])
3131                    arFilter[strName] = current[strName];
3132
3133                this.updateRow(i, arFilter[strName], arShowValues);
3134
3135            }
3136
3137            this.selectedValues = arFilter;
3138
3139            this.changeInfo();
3140        },
3141
3142        getRowValues: function(arFilter, index)
3143        {
3144        	var arValues = [],
3145                i = 0,
3146                j = 0,
3147                boolSearch = false,
3148                boolOneSearch = true;
3149
3150            if ($.isEmptyObject(arFilter))
3151            {
3152                for (i = 0; i < this.product.length; i++)
3153                {
3154                    if (!BX.util.in_array(this.product[i].TREE[index], arValues) && this.product[i].TREE[index])
3155                    {
3156                        arValues[arValues.length] = this.product[i].TREE[index];
3157                    }
3158                }
3159                boolSearch = true;
3160            }
3161            else
3162            {
3163            	for (i = 0; i < this.product.length; i++)
3164                {
3165                    boolOneSearch = true;
3166
3167                    for (j in arFilter)
3168                    {
3169                        if (arFilter[j] !== this.product[i].TREE[j])
3170                        {
3171                            boolOneSearch = false;
3172                            break;
3173                        }
3174                    }
3175
3176            
3177
3178                    if (boolOneSearch)
3179                    {
3180                        if (!BX.util.in_array(this.product[i].TREE[index], arValues) && this.product[i].TREE[index])
3181                        {
3182                            arValues[arValues.length] = this.product[i].TREE[index];
3183                        }
3184
3185
3186                        boolSearch = true;
3187                    }
3188                }
3189
3190            }
3191
3192
3193            return (boolSearch ? arValues : false);
3194        },
3195
3196        updateRow: function(intNumber, activeId, showId)
3197        {
3198
3199            var i = 0,
3200                value = '',
3201                isCurrent = false,
3202                rowItems = null;
3203
3204
3205            var lineContainer = this.obTree.querySelectorAll(".sku-row");
3206
3207      
3208
3209            if (intNumber > -1 && intNumber < lineContainer.length)
3210            {
3211                rowItems = lineContainer[intNumber].querySelectorAll('li');
3212
3213                for (i = 0; i < rowItems.length; i++)
3214                {
3215                    value = rowItems[i].getAttribute('data-onevalue');
3216                    isCurrent = value === activeId;
3217
3218                    if (isCurrent)
3219                    {
3220                        BX.addClass(rowItems[i], 'active');
3221                    }
3222                    else
3223                    {
3224                        BX.removeClass(rowItems[i], 'active');
3225                    }
3226
3227                    rowItems[i].style.display = BX.util.in_array(value, showId) ? '' : 'none';
3228
3229                    if (isCurrent)
3230                    {
3231                        lineContainer[intNumber].style.display = (value == 0 ) ? 'none' : '';
3232                    }
3233                }
3234            }
3235
3236            if(showId.length === 0)
3237            {
3238            	lineContainer[intNumber].style.display = 'none';
3239            }
3240
3241        },
3242
3243        setCurrentOfferNum: function()
3244        {
3245
3246        	var index = -1;
3247
3248        	for (i = 0; i < this.product.length; i++)
3249            {
3250                boolOneSearch = true;
3251
3252                for (j in this.selectedValues)
3253                {
3254
3255                    if (this.selectedValues[j] !== this.product[i].TREE[j])
3256                    {
3257                        boolOneSearch = false;
3258                        break;
3259                    }
3260
3261                }
3262
3263                if (boolOneSearch)
3264                {
3265                    index = i;
3266                    break;
3267                }
3268            }
3269
3270            this.offerNumPrev = this.offerNum;
3271
3272            this.offerNum = index;
3273        },
3274
3275        faqBtn: function()
3276        {
3277        	$(".faq-btn-form").attr("data-product-id", this.product[this.offerNum].PRODUCT_ID);
3278        },
3279
3280        changeInfo: function()
3281        {
3282            var j = 0,
3283                i = 0;
3284
3285            this.setCurrentOfferNum();
3286            this.addParameterToURL("oID", this.product[this.offerNum].PRODUCT_ID);
3287            this.refreshBtnAdd2Basket();
3288
3289
3290            if(!this.firstLoad)
3291            {
3292            	this.drawGallery();
3293            	this.drawArticleAvailableText();
3294            	this.drawPriceBlock();
3295            	this.drawSkuCharsBlock();
3296            	this.faqBtn();
3297            	updateBasketPublicInfo();
3298            }
3299            else{
3300            	this.firstLoad = false;
3301            }
3302            
3303        },
3304
3305        refreshBtnAdd2Basket: function()
3306        {
3307        	if(this.config.useAdd2Basket)
3308    		{
3309    			switch (this.productType)
3310	            {
3311	                case "PRODUCT":
3312	                    break;
3313	                case "OFFERS":
3314		    			if(this.obBtnAdd2Basket.hasAttribute("data-product-id")){
3315		    				this.obBtnAdd2Basket.setAttribute("data-product-id", this.product[this.offerNum].PRODUCT_ID);
3316		    			}
3317	                    break;
3318	                default:
3319	                    break;
3320	            }
3321			}
3322        },
3323
3324        drawSkuCharsBlock: function()
3325        {
3326        	this.obSkuChars.innerHTML = "";
3327
3328        	if(this.product[this.offerNum].SKU_CHARS.length>0)
3329        	{
3330        		var html = "";
3331
3332        		for (var i = 0; i < this.product[this.offerNum].SKU_CHARS.length; i++)
3333        		{
3334
3335        			html += 
3336		        		 "<table class=\"cart-char-table mobile-break show-hidden-child\">"
3337		        		+"<tr>"
3338		        		+"<td class=\"left\">"+this.product[this.offerNum].SKU_CHARS[i].NAME+"</td>"
3339		        		+"<td class=\"dotted\"><div class=\"dotted\"></div></td>"
3340		        		+"<td class=\"right bold\">"+this.product[this.offerNum].SKU_CHARS[i].VALUE+"</td>"
3341		        		+"</tr>"
3342		        		+"</table>";
3343        		}
3344        		
3345        		this.obSkuChars.innerHTML = html;
3346        	}
3347        	
3348        	if(this.obSkuChars.innerHTML.length<=0 && $('.props_chars_js').length<=0 && $('.prop_chars_js').length<=0)
3349        	{
3350        		$('#chars').addClass('hidden');
3351        	}
3352        	else
3353        	{
3354        		$('#chars').removeClass('hidden');
3355        	}
3356
3357        },
3358
3359        drawGallery: function()
3360        {
3361
3362        	if(this.obGallery)
3363        	{
3364        		var galleryContainer = this.obGallery.querySelector('.gallery-list'),
3365        			controlContainer = this.obGallery.querySelector('.gallery-control'),
3366        			galleryHTML = "",
3367        			controlHTML = "",
3368        			countGallery= (+this.product[this.offerNum].GALLERY_COUNT);
3369
3370
3371
3372        		for (var i = 0; i < countGallery; i++)
3373    			{
3374    				galleryHTML += "<div class=\"item-show-pic "+((i==0)?"active":"")+"\" data-show-pic=\"img-"+i+"\">"
3375    							   +"<a href=\""+this.product[this.offerNum].GALLERY[i].BIG+"\" data-gallery=\"gal-item\" class=\"cursor-loop\">"
3376    							   +"<img class=\"img-responsive center-block animate_to_box\" data-cart-id-img=\""+this.product[this.offerNum].PRODUCT_ID+"\" title=\""+this.product[this.offerNum].GALLERY[i].TITLE+"\" alt=\""+this.product[this.offerNum].GALLERY[i].ALT+"\" src=\""+this.product[this.offerNum].GALLERY[i].SMALL+"\">"
3377    							   +"</a>"
3378    							   +"</div>";
3379    			}
3380
3381    			controlContainer.innerHTML = "";
3382
3383        		if(countGallery>1)
3384        		{
3385
3386        			for (var i = 0; i < countGallery; i++)
3387	    			{
3388	    				controlHTML +="<div class=\"col-xs-3 pic-item\">"
3389	    						  +"<div class=\"mini-pic click-show-pic "+((i==0)?"active":"")+"\" data-show-pic=\"img-"+i+"\" title=\""+this.product[this.offerNum].GALLERY[i].TITLE+"\">"
3390	    						  +"<table>"
3391	    						  +"<tr>"
3392	    						  +"<td>"
3393	    						  +"<div class=\"pic-border\">"
3394	    						  +"<img class=\"img-responsive center-block\" alt=\""+this.product[this.offerNum].GALLERY[i].ALT+"\" src=\""+this.product[this.offerNum].GALLERY[i].CONTROL+"\">"
3395	    						  +"<div class=\"pic-shadow\"></div>"
3396	    						  +"</div>"
3397	    						  +"</td>"
3398	    						  +"</tr>"
3399	    						  +"</table>"
3400	    						  +"</div>"
3401	    						  +"</div>";
3402    				}
3403
3404
3405	    			controlContainer.classList.remove('hidden');
3406
3407	    			controlContainer.innerHTML = controlHTML;
3408
3409        		}
3410        		else
3411        		{
3412        			controlContainer.classList.add('hidden');
3413        		}
3414
3415        		galleryContainer.innerHTML=galleryHTML;
3416        	}
3417
3418        },
3419
3420        drawArticleAvailableText: function()
3421        {
3422        	var article = false,
3423        		available = false,
3424        		text = false;
3425
3426        	this.product[this.offerNum].ARTICLE;
3427        	this.product[this.offerNum].AVAILABLE.VALUE;
3428        	this.product[this.offerNum].AVAILABLE.VALUE_XML_ID;
3429        	this.product[this.offerNum].PREVIEW_TEXT;
3430
3431
3432        	if(this.product[this.offerNum].ARTICLE.length)
3433        		article = true;
3434        	
3435        	if(typeof this.product[this.offerNum].AVAILABLE.VALUE !== "undefined")
3436        		available = true;
3437
3438        	if(this.product[this.offerNum].PREVIEW_TEXT.length)
3439        		text = true;
3440
3441
3442
3443        	if(article || available || text)
3444        		this.obArticleAvailableText.classList.remove('hidden');
3445        	else
3446        	{
3447        		this.obArticleAvailableText.classList.add('hidden');
3448        	}
3449
3450
3451        	if(article)
3452        	{
3453        		this.obWrArticle.classList.remove('hidden');
3454        		this.obArticle.innerHTML = BX.message('ARTICLE')+" "+this.product[this.offerNum].ARTICLE;
3455        		this.obArticleAvailableText.classList.remove('no-article');
3456        	}
3457        	else
3458        	{
3459        		this.obWrArticle.classList.add('hidden');
3460        		this.obArticle.innerHTML = "";
3461        		this.obArticleAvailableText.classList.add('no-article');
3462        	}
3463
3464        	if(available)
3465        	{
3466        		if(typeof this.product[this.offerNumPrev].AVAILABLE.VALUE !== "undefined")
3467        			this.obAvailable.classList.remove(this.product[this.offerNumPrev].AVAILABLE.VALUE_XML_ID);
3468
3469        		this.obAvailable.classList.add(this.product[this.offerNum].AVAILABLE.VALUE_XML_ID);
3470        		this.obAvailable.innerHTML = this.product[this.offerNum].AVAILABLE.VALUE;
3471        		this.obWrAvailable.classList.remove('hidden');
3472        	}
3473        	else
3474        	{
3475        		this.obWrAvailable.classList.add('hidden');
3476
3477        		if(typeof this.product[this.offerNumPrev].AVAILABLE.VALUE !== "undefined")
3478        			this.obAvailable.classList.remove(this.product[this.offerNumPrev].AVAILABLE.VALUE_XML_ID);
3479
3480        		this.obAvailable.innerHTML = "";
3481        	}
3482
3483
3484
3485        	if(text)
3486        	{
3487        		this.obWrText.classList.remove('hidden');
3488        		this.obText.innerHTML = this.product[this.offerNum].PREVIEW_TEXT;
3489        		
3490        	}
3491        	else
3492        	{
3493        		this.obWrText.classList.add('hidden');
3494        		this.obText.innerHTML = "";
3495        	}
3496        },
3497
3498        drawPriceBlock: function()
3499        {	
3500
3501        	
3502        	if(this.product[this.offerNum].CAN_BUY == "Y" )
3503        	{
3504        		this.obPriceBlock.classList.remove('hidden');
3505
3506	        	if(this.product[this.offerNum].REQUEST_PRICE == "Y")
3507	        	{
3508	        		this.obPrice.innerHTML = this.product[this.offerNum].PRICE.HTML;
3509	        		this.obPrice.classList.add('big');
3510	        		this.obPrice.classList.remove('hidden');
3511	        		this.obPrice.classList.remove('red-color');
3512	        		this.obOldPrice.classList.add('hidden');
3513	        		/*this.obPriceRequest.classList.remove('hidden');*/
3514	        	}
3515	        	else
3516	        	{
3517	        		/*this.obPriceRequest.classList.add('hidden');*/
3518
3519	        		if(typeof this.product[this.offerNum].PRICE.VALUE !== "undefined")
3520		        	{
3521		        		this.obPrice.classList.remove('hidden');
3522
3523		        		if(typeof this.product[this.offerNum].OLD_PRICE.VALUE !== "undefined")
3524		        		{
3525		        			this.obPrice.classList.remove('big');
3526		        			this.obPrice.classList.add('red-color');
3527		        		}
3528		        		else
3529		        		{
3530		        			this.obPrice.classList.add('big');
3531		        			this.obPrice.classList.remove('red-color');
3532		        		}
3533
3534
3535
3536		        		this.obPrice.innerHTML = this.product[this.offerNum].PRICE.HTML;
3537		        	}
3538		        	else
3539		        	{
3540		        		this.obPrice.classList.add('hidden');
3541		        		this.obPrice.innerHTML = "";
3542		        	}
3543
3544
3545		        	if(typeof this.product[this.offerNum].OLD_PRICE.VALUE !== "undefined")
3546		        	{
3547		        		this.obOldPrice.classList.remove('hidden');
3548		        		this.obOldPrice.innerHTML = this.product[this.offerNum].OLD_PRICE.HTML;
3549		        	}
3550		        	else
3551		        	{
3552		        		this.obOldPrice.classList.add('hidden');
3553		        		this.obOldPrice.innerHTML = "";
3554		        	}
3555		        	
3556	        	}
3557
3558	        	if(typeof this.product[this.offerNum].DISCOUNT.VALUE !== "undefined")
3559	        	{
3560	        		this.obDots.classList.remove('hidden');
3561	        		this.obDiscount.classList.remove('hidden');
3562	        		this.obDiscount.innerHTML = BX.message("ECONOMY_MESSAGE")+"&nbsp;<span class=\"total bold\">"+this.product[this.offerNum].DISCOUNT.HTML+"</span>";
3563	        		$(this.obPriceBlock).find(".wrap-btn").addClass("marg");
3564	        	}
3565	        	else
3566	        	{
3567	        		this.obDots.classList.add('hidden');
3568	        		this.obDiscount.classList.add('hidden');
3569	        		this.obDiscount.innerHTML = "";
3570	        		$(this.obPriceBlock).find(".wrap-btn").removeClass("marg");
3571	        	}
3572
3573	        	if(this.product[this.offerNum].PRICE_COMMENT1.length>0)
3574	        		this.obComment1.innerHTML = this.product[this.offerNum].PRICE_COMMENT1;
3575
3576	        	else{
3577	        		this.obComment1.innerHTML = "";
3578	        	}
3579        	}
3580        	else
3581        	{
3582        		this.obPriceBlock.classList.add('hidden');
3583        	}
3584
3585        	
3586        }
3587
3588
3589    },
3590
3591
3592    window.JCCatalogItem = function(arParams)
3593    {
3594    	
3595    	this.productType = null;
3596    	this.firstLoad = true;
3597    	this.visual = {};
3598
3599        this.config = {
3600            useAdd2Basket: false,
3601            useFastOrder: false,
3602            useSku: false
3603        };
3604        this.product = {};
3605        this.offerNum = 0;
3606        this.offerNumPrev = 0;
3607        this.treeProps = [];
3608        this.selectedValues = {};
3609        this.emptySku = true;
3610        this.formFastOrder = null;
3611
3612
3613
3614        this.obTree = null;
3615        this.obGallery = null;
3616        this.obArticleAvailableText = null;
3617        this.obArticle = null;
3618        this.obWrArticle = null;
3619        this.obAvailable = null;
3620        this.obWrAvailable = null;
3621        this.obText = null;
3622        this.obWrText = null;
3623
3624
3625        this.obPriceBlock = null;
3626        this.obPriceRequest = null;
3627        this.obPrice = null;
3628        this.obOldPrice = null;
3629        this.obDots = null;
3630        this.obDiscount = null;
3631
3632        this.obSkuChars = null;
3633
3634
3635        this.obComment1 = null;
3636
3637
3638        this.obBtnFastOrder = null;
3639        this.obWrBtnFastOrder = null;
3640        this.obBtnAdd2Basket = null;
3641        this.obWrBtnAdd2Basket = null;
3642        this.obBtn2Detail = null;
3643
3644
3645        this.errorCode = 0;
3646
3647        if (typeof arParams === 'object')
3648        {
3649        	this.params = arParams;
3650            this.initConfig();
3651            this.initBtns();
3652
3653            switch (this.productType)
3654            {
3655                case "PRODUCT":
3656                    this.initProductData();
3657                    break;
3658                case "OFFERS":
3659
3660                	if(!this.emptySku)
3661                    	this.initOffersData();
3662
3663                    break;
3664                default:
3665                    this.errorCode = -1;
3666            }
3667        }
3668
3669        if (this.errorCode === 0)
3670            BX.ready(BX.delegate(this.init, this));
3671
3672        this.params = {};
3673    },
3674
3675    window.JCCatalogItem.prototype = 
3676    {
3677    	initBtns: function()
3678    	{
3679    		if(this.config.useFastOrder)
3680        	{
3681        		this.obBtnFastOrder = BX(this.visual.BTN_FAST_ORDER);
3682        		BX.bind(this.obBtnFastOrder, 'click', BX.delegate(this.callFastOrderForm, this));
3683
3684        		this.obWrBtnFastOrder = BX(this.visual.WR_BTN_FAST_ORDER);
3685        	}
3686
3687        	if(this.config.useAdd2Basket)
3688        	{
3689        		this.obBtnAdd2Basket = BX(this.visual.BTN_ADD2BASKET);
3690        		BX.bind(this.obBtnAdd2Basket, 'click', BX.delegate(this.add2Basket, this));
3691
3692        		this.obWrBtnAdd2Basket = BX(this.visual.WR_BTN_ADD2BASKET);
3693        	}
3694
3695        	this.obBtn2Detail = BX(this.visual.BTN2DETAIL);
3696    	},
3697
3698    	initConfig: function()
3699    	{
3700
3701    		this.productType = this.params.PRODUCT_TYPE;
3702
3703    		this.visual = this.params.VISUAL;
3704
3705    		if(this.params.CONFIG.USE_ADD2BASKET)
3706                this.config.useAdd2Basket = this.params.CONFIG.USE_ADD2BASKET;
3707
3708            if(this.params.CONFIG.USE_FAST_ORDER)
3709                this.config.useFastOrder = this.params.CONFIG.USE_FAST_ORDER;
3710
3711            if(this.params.CONFIG.USE_SKU)
3712                this.config.useSku = this.params.CONFIG.USE_SKU;
3713
3714
3715            
3716        	this.emptySku = this.params.CONFIG.EMPTY_SKU;
3717            
3718            this.product = this.params.PRODUCT;
3719
3720            this.formFastOrder = this.params.FAST_ORDER_FORM_ID;
3721    	},
3722
3723    	init: function()
3724        {
3725        	switch (this.productType)
3726            {
3727                case "PRODUCT":
3728                    break;
3729                case "OFFERS":
3730        			this.setCurrent();
3731
3732                    break;
3733                default:
3734                    this.errorCode = -1;
3735            }
3736
3737        },
3738
3739        initProductData: function()
3740        {
3741        	this.refreshBtnAdd2Basket();
3742        },
3743
3744       	initOffersData: function()
3745        {
3746
3747        	this.treeProps = this.params.TREE_PROPS;
3748        	this.obName2Detail = BX(this.visual.NAME2DETAIL);
3749        	this.obTree = BX(this.visual.SKU_ID);
3750        	this.obGallery = BX(this.visual.GALLERY);
3751
3752        	this.obArticleAvailableText = BX(this.visual.ARTICLE_AVAILABLE_TEXT);
3753	        this.obArticle = BX(this.visual.ARTICLE);
3754	        this.obWrArticle = BX(this.visual.ARTICLE_BLOCK);
3755	        this.obAvailable = BX(this.visual.AVAILABLE);
3756	        this.obWrAvailable = BX(this.visual.AVAILABLE_BLOCK);
3757	        this.obText = BX(this.visual.PREVIEW_TEXT);
3758	        this.obWrText = BX(this.visual.PREVIEW_TEXT_BLOCK);
3759
3760	        this.obPriceBlock = BX(this.visual.PRICE_BLOCK_ID);
3761	        /*this.obPriceRequest = BX(this.visual.PRICE_REQUEST);*/
3762	        this.obPrice = BX(this.visual.PRICE_VALUE);
3763	        this.obOldPrice = BX(this.visual.OLDPRICE_VALUE);
3764	        this.obDots = BX(this.visual.DOTS);
3765	        this.obDiscount = BX(this.visual.DISCOUNT);
3766
3767	        this.obComment1 = BX(this.visual.PRICE_COMMENT1);
3768
3769	        this.obSkuChars = BX(this.visual.CHARS);
3770
3771        	var treeItems = this.obTree.querySelectorAll('li');
3772
3773	        for (i = 0; i < treeItems.length; i++)
3774	        {
3775	            BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this));
3776	        }
3777
3778
3779	        if(this.params.OFFER_SELECTED != "0")
3780	        {
3781	        	this.offerNum = this.params.OFFER_SELECTED;
3782	        	/*this.firstLoad = false;*/
3783	        }
3784
3785	        
3786
3787
3788        },
3789
3790        deleteParameterURL: function (url, param) {
3791            var a = url.split('?');
3792            var re = new RegExp('(\\?|&)'+param+'=[^&]+','g');
3793
3794            if(url == "undefined")
3795                url = "";
3796
3797            url=('?'+a[1]).replace(re,'');
3798            url=url.replace(/^&|\?/,'');
3799
3800            if(url == "undefined")
3801                url = "";
3802
3803            var dlm=(url=='')? '': '?';
3804            return a[0]+dlm+url;
3805        },
3806
3807        addParameterToURL: function (param, value){
3808
3809            var url = window.location.href;
3810            
3811
3812            if (history.replaceState) {
3813                var baseUrl = this.deleteParameterURL(url, param);
3814                baseUrl += (baseUrl.split('?')[1] ? '&':'?') + param+"="+value;
3815                history.replaceState(null, null, baseUrl);
3816            }
3817            else {
3818                console.warn('History API don`t support');
3819            }
3820        },
3821
3822        callFastOrderForm: function()
3823        {
3824
3825        	var productID, mainID=null, isOffer="N";
3826
3827        	switch (this.productType)
3828            {
3829                case "PRODUCT":
3830                    productID = this.product.PRODUCT_ID;
3831                    mainID = this.product.MAIN_ID;
3832                    break;
3833                case "OFFERS":
3834                	productID = this.product[this.offerNum].PRODUCT_ID;
3835                	mainID = this.product[this.offerNum].MAIN_ID;
3836                	isOffer = "Y";
3837                    break;
3838                default:
3839                    break;
3840            }
3841
3842        	var params = {
3843				"element_type": "CTL",
3844				"element_id": productID,
3845				"main_id": mainID,
3846				"isOffer": isOffer,
3847				"formId": this.formFastOrder,
3848				"action": "order"
3849			};
3850
3851			callFormDialog(params);
3852        },
3853
3854        add2Basket: function()
3855        {
3856        	var productID = "", count = "", _this=this, mainID = "";
3857                	
3858        	switch (this.productType)
3859            {
3860                case "PRODUCT":
3861                    productID = this.product.PRODUCT_ID;
3862                    count = this.product.MIN_QUANTITY;
3863                    mainID = this.product.MAIN_ID;
3864                    break;
3865                case "OFFERS":
3866                	productID = this.product[this.offerNum].PRODUCT_ID;
3867                	count = this.product[this.offerNum].MIN_QUANTITY;
3868                	mainID = this.product[this.offerNum].MAIN_ID;
3869
3870                    break;
3871                default:
3872                    break;
3873            }
3874
3875            add2Basket(productID, count, mainID, function(){
3876            	_this.refreshBtnAdd2Basket();
3877            	updateBasketPublicInfo();
3878            });
3879
3880        },
3881
3882        selectOfferProp: function()
3883        {
3884        	var i = 0,
3885                strTreeValue = '',
3886                arTreeItem = [],
3887                rowItems = null,
3888                target = BX.proxy_context;
3889
3890
3891            if (target && target.hasAttribute('data-treevalue'))
3892            {
3893                if (BX.hasClass(target, 'active'))
3894                    return;
3895
3896
3897                strTreeValue = target.getAttribute('data-treevalue');
3898                arTreeItem = strTreeValue.split('_');
3899
3900                this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]);
3901
3902
3903                rowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
3904
3905
3906                if (rowItems && rowItems.length)
3907                {
3908                    for (i = 0; i < rowItems.length; i++)
3909                    {
3910                        BX.removeClass(rowItems[i], 'active');
3911                    }
3912                }
3913
3914                
3915                BX.addClass(target, 'active');
3916
3917            }
3918        },
3919
3920        searchOfferPropIndex: function(strPropID, strPropValue)
3921        {
3922        	var i = 0,
3923        		j = 0,
3924        		strName='',
3925        		arShowValues = false,
3926        		arFilter = {};
3927
3928
3929        	for (i = 0; i < this.treeProps.length; i++)
3930            {
3931                if (this.treeProps[i].ID === strPropID)
3932                {
3933                    index = i;
3934                    break;
3935                }
3936            }
3937
3938            if (index > -1)
3939            {
3940            	for (i = 0; i < index; i++)
3941                {
3942                    strName = 'PROP_' + this.treeProps[i].ID;
3943                    arFilter[strName] = this.selectedValues[strName];
3944                }
3945
3946                strName = 'PROP_' + this.treeProps[index].ID;
3947                arFilter[strName] = strPropValue;
3948
3949
3950                for (i = index + 1; i < this.treeProps.length; i++)
3951                {
3952                	strName = 'PROP_' + this.treeProps[i].ID;
3953                    arShowValues = this.getRowValues(arFilter, strName);
3954
3955                    if (!arShowValues)
3956                        break;
3957
3958                    if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arShowValues))
3959                    {
3960                    	arFilter[strName] = this.selectedValues[strName];
3961                    }
3962                    else
3963                    {
3964                    	arFilter[strName] = arShowValues[0];
3965                    }
3966
3967
3968                    this.updateRow(i, arFilter[strName], arShowValues);
3969
3970
3971                }
3972
3973                this.selectedValues = arFilter;
3974
3975
3976                this.changeInfo();
3977
3978            }
3979
3980        },
3981
3982        setCurrent: function()
3983        {
3984        	var i = 0,
3985        		j = 0,
3986        		strName='',
3987        		arShowValues = false,
3988        		arFilter = {},
3989        		current = this.product[this.offerNum].TREE;
3990
3991
3992        	for (i = 0; i < this.treeProps.length; i++)
3993            {
3994            	strName = 'PROP_' + this.treeProps[i].ID;
3995            	arShowValues = this.getRowValues(arFilter, strName);
3996
3997            	if (!arShowValues)
3998            		break;
3999
4000
4001            	if (BX.util.in_array(current[strName], arShowValues) && current[strName])
4002                    arFilter[strName] = current[strName];
4003
4004                this.updateRow(i, arFilter[strName], arShowValues);
4005
4006            }
4007
4008            this.selectedValues = arFilter;
4009
4010            this.changeInfo();
4011        },
4012
4013        getRowValues: function(arFilter, index)
4014        {
4015        	var arValues = [],
4016                i = 0,
4017                j = 0,
4018                boolSearch = false,
4019                boolOneSearch = true;
4020
4021            if ($.isEmptyObject(arFilter))
4022            {
4023                for (i = 0; i < this.product.length; i++)
4024                {
4025                    if (!BX.util.in_array(this.product[i].TREE[index], arValues) && this.product[i].TREE[index])
4026                    {
4027                        arValues[arValues.length] = this.product[i].TREE[index];
4028                    }
4029                }
4030                boolSearch = true;
4031            }
4032            else
4033            {
4034            	for (i = 0; i < this.product.length; i++)
4035                {
4036                    boolOneSearch = true;
4037
4038                    for (j in arFilter)
4039                    {
4040                        if (arFilter[j] !== this.product[i].TREE[j])
4041                        {
4042                            boolOneSearch = false;
4043                            break;
4044                        }
4045                    }
4046
4047            
4048
4049                    if (boolOneSearch)
4050                    {
4051                        if (!BX.util.in_array(this.product[i].TREE[index], arValues) && this.product[i].TREE[index])
4052                        {
4053                            arValues[arValues.length] = this.product[i].TREE[index];
4054                        }
4055
4056
4057                        boolSearch = true;
4058                    }
4059                }
4060
4061            }
4062
4063
4064            return (boolSearch ? arValues : false);
4065        },
4066
4067        updateRow: function(intNumber, activeId, showId)
4068        {
4069
4070            var i = 0,
4071                value = '',
4072                isCurrent = false,
4073                rowItems = null;
4074
4075
4076            var lineContainer = this.obTree.querySelectorAll(".sku-row");
4077
4078      
4079
4080            if (intNumber > -1 && intNumber < lineContainer.length)
4081            {
4082                rowItems = lineContainer[intNumber].querySelectorAll('li');
4083
4084                for (i = 0; i < rowItems.length; i++)
4085                {
4086                    value = rowItems[i].getAttribute('data-onevalue');
4087                    isCurrent = value === activeId;
4088
4089                    if (isCurrent)
4090                    {
4091                        BX.addClass(rowItems[i], 'active');
4092                    }
4093                    else
4094                    {
4095                        BX.removeClass(rowItems[i], 'active');
4096                    }
4097
4098                    rowItems[i].style.display = BX.util.in_array(value, showId) ? '' : 'none';
4099
4100                    if (isCurrent)
4101                    {
4102                        lineContainer[intNumber].style.display = (value == 0 ) ? 'none' : '';
4103                    }
4104                }
4105            }
4106
4107            if(showId.length === 0)
4108            {
4109            	lineContainer[intNumber].style.display = 'none';
4110            }
4111
4112        },
4113
4114        setCurrentOfferNum: function()
4115        {
4116
4117        	var index = -1;
4118
4119        	for (i = 0; i < this.product.length; i++)
4120            {
4121                boolOneSearch = true;
4122
4123                for (j in this.selectedValues)
4124                {
4125
4126                    if (this.selectedValues[j] !== this.product[i].TREE[j])
4127                    {
4128                        boolOneSearch = false;
4129                        break;
4130                    }
4131
4132                }
4133
4134                if (boolOneSearch)
4135                {
4136                    index = i;
4137                    break;
4138                }
4139            }
4140
4141            this.offerNumPrev = this.offerNum;
4142
4143            this.offerNum = index;
4144        },
4145
4146        changeInfo: function()
4147        {
4148            var j = 0,
4149                i = 0;
4150
4151            this.setCurrentOfferNum();
4152            this.refreshBtnAdd2Basket();
4153
4154            if(!this.firstLoad)
4155            {
4156            	if(this.obName2Detail.hasAttribute("href")){
4157    				this.obName2Detail.setAttribute("href", this.product[this.offerNum].DETAIL_PAGE_URL);
4158    			}
4159            	this.drawGallery();
4160            	this.drawPriceBlock();
4161            	updateBasketPublicInfo();
4162            }
4163            else{
4164            	this.firstLoad = false;
4165            }
4166            
4167            
4168        },
4169
4170        refreshBtnAdd2Basket: function()
4171        {
4172        	
4173    			switch (this.productType)
4174	            {
4175	                case "PRODUCT":
4176	                    break;
4177	                case "OFFERS":
4178	                	if(this.config.useAdd2Basket)
4179    					{
4180			    			if(this.obBtnAdd2Basket.hasAttribute("data-product-id")){
4181			    				this.obBtnAdd2Basket.setAttribute("data-product-id", this.product[this.offerNum].PRODUCT_ID);
4182			    			}
4183
4184			    			if(this.obWrBtnAdd2Basket)
4185			    			{
4186			    				if(this.product[this.offerNum].CAN_BUY=="Y")
4187			    					this.obWrBtnAdd2Basket.classList.remove("hidden");
4188			    				else
4189			    				{
4190			    					this.obWrBtnAdd2Basket.classList.add("hidden");
4191			    				}
4192			    			}
4193
4194			            }
4195			            if(this.config.useFastOrder)
4196    					{
4197    						if(this.product[this.offerNum].CAN_BUY=="Y")
4198		    					this.obWrBtnFastOrder.classList.remove("hidden");
4199		    				else
4200		    				{
4201		    					this.obWrBtnFastOrder.classList.add("hidden");
4202		    				}
4203    					}
4204
4205		    			if(this.obBtn2Detail)
4206		    			{
4207		    				if(this.obBtn2Detail.hasAttribute("href"))
4208		    					this.obBtn2Detail.setAttribute("href", this.product[this.offerNum].DETAIL_PAGE_URL);
4209		    			}
4210
4211
4212	                    break;
4213	                default:
4214	                    break;
4215			}
4216        },
4217
4218        drawSkuCharsBlock: function()
4219        {
4220        	this.obSkuChars.innerHTML = "";
4221
4222        	if(this.product[this.offerNum].SKU_CHARS.length>0)
4223        	{
4224        		var html = "";
4225
4226        		for (var i = 0; i < this.product[this.offerNum].SKU_CHARS.length; i++)
4227        		{
4228
4229        			html += 
4230		        		 "<table class=\"cart-char-table mobile-break show-hidden-child\">"
4231		        		+"<tr>"
4232		        		+"<td class=\"left\">"+this.product[this.offerNum].SKU_CHARS[i].NAME+"</td>"
4233		        		+"<td class=\"dotted\"><div class=\"dotted\"></div></td>"
4234		        		+"<td class=\"right bold\">"+this.product[this.offerNum].SKU_CHARS[i].VALUE+"</td>"
4235		        		+"</tr>"
4236		        		+"</table>";
4237        		}
4238        		
4239        		this.obSkuChars.innerHTML = html;
4240        	}
4241
4242
4243        },
4244
4245        drawGallery: function()
4246        {
4247        	if(this.obGallery)
4248        	{
4249        		var galleryContainer = this.obGallery.querySelector('.gallery-list'),
4250        			galleryHTML = "";
4251
4252        		for (var i = 0; i < 1; i++)
4253    			{
4254    				galleryHTML += "<a href=\""+this.product[this.offerNum].DETAIL_PAGE_URL+"\">"
4255    							   +"<img class=\"img-responsive center-block animate_to_box\" data-cart-id-img=\""+this.product[this.offerNum].PRODUCT_ID+"\" title=\""+this.product[this.offerNum].GALLERY[i].TITLE+"\" alt=\""+this.product[this.offerNum].GALLERY[i].ALT+"\" src=\""+this.product[this.offerNum].GALLERY[i].SMALL+"\">"
4256    							   +"</a>";
4257    			}
4258
4259        		galleryContainer.innerHTML=galleryHTML;
4260        	}
4261
4262        },
4263
4264        drawArticleAvailableText: function()
4265        {
4266        	var article = false,
4267        		available = false,
4268        		text = false;
4269
4270        	this.product[this.offerNum].ARTICLE;
4271        	this.product[this.offerNum].AVAILABLE.VALUE;
4272        	this.product[this.offerNum].AVAILABLE.VALUE_XML_ID;
4273        	this.product[this.offerNum].PREVIEW_TEXT;
4274
4275
4276        	if(this.product[this.offerNum].ARTICLE.length)
4277        		article = true;
4278        	
4279        	if(typeof this.product[this.offerNum].AVAILABLE.VALUE !== "undefined")
4280        		available = true;
4281
4282        	if(this.product[this.offerNum].PREVIEW_TEXT.length)
4283        		text = true;
4284
4285
4286
4287        	if(article || available || text)
4288        		this.obArticleAvailableText.classList.remove('hidden');
4289        	else
4290        	{
4291        		this.obArticleAvailableText.classList.add('hidden');
4292        	}
4293
4294
4295        	if(article)
4296        	{
4297        		this.obWrArticle.classList.remove('hidden');
4298        		this.obArticle.innerHTML = BX.message('ARTICLE')+" "+this.product[this.offerNum].ARTICLE;
4299        		this.obArticleAvailableText.classList.remove('no-article');
4300        	}
4301        	else
4302        	{
4303        		this.obWrArticle.classList.add('hidden');
4304        		this.obArticle.innerHTML = "";
4305        		this.obArticleAvailableText.classList.add('no-article');
4306        	}
4307
4308        	if(available)
4309        	{
4310        		if(typeof this.product[this.offerNumPrev].AVAILABLE.VALUE !== "undefined")
4311        			this.obAvailable.classList.remove(this.product[this.offerNumPrev].AVAILABLE.VALUE_XML_ID);
4312
4313        		this.obAvailable.classList.add(this.product[this.offerNum].AVAILABLE.VALUE_XML_ID);
4314        		this.obAvailable.innerHTML = this.product[this.offerNum].AVAILABLE.VALUE;
4315        		this.obWrAvailable.classList.remove('hidden');
4316        	}
4317        	else
4318        	{
4319        		this.obWrAvailable.classList.add('hidden');
4320
4321        		if(typeof this.product[this.offerNumPrev].AVAILABLE.VALUE !== "undefined")
4322        			this.obAvailable.classList.remove(this.product[this.offerNumPrev].AVAILABLE.VALUE_XML_ID);
4323
4324        		this.obAvailable.innerHTML = "";
4325        	}
4326
4327
4328
4329        	if(text)
4330        	{
4331        		this.obWrText.classList.remove('hidden');
4332        		this.obText.innerHTML = this.product[this.offerNum].PREVIEW_TEXT;
4333        		
4334        	}
4335        	else
4336        	{
4337        		this.obWrText.classList.add('hidden');
4338        		this.obText.innerHTML = "";
4339        	}
4340        },
4341
4342        drawPriceBlock: function()
4343        {	
4344        	
4345        	if(this.product[this.offerNum].CAN_BUY == "Y" )
4346        	{
4347        		this.obPriceBlock.classList.remove('hidden');
4348
4349	        	if(this.product[this.offerNum].REQUEST_PRICE == "Y")
4350	        	{
4351	        		this.obPrice.innerHTML = this.product[this.offerNum].PRICE.HTML;
4352	        		this.obPrice.classList.add('big');
4353	        		this.obPrice.classList.remove('hidden');
4354	        		this.obPrice.classList.remove('red-color');
4355	        		this.obOldPrice.classList.add('hidden');
4356	        		/*this.obPriceRequest.classList.remove('hidden');*/
4357	        	}
4358	        	else
4359	        	{
4360	        		/*this.obPriceRequest.classList.add('hidden');*/
4361
4362	        		if(typeof this.product[this.offerNum].PRICE.VALUE !== "undefined")
4363		        	{
4364		        		
4365	        			this.obPrice.classList.remove('hidden');
4366
4367		        		if(typeof this.product[this.offerNum].OLD_PRICE.VALUE !== "undefined")
4368		        		{
4369		        			this.obPrice.classList.remove('big');
4370		        			this.obPrice.classList.add('red-color');
4371		        		}
4372		        		else
4373		        		{
4374		        			this.obPrice.classList.add('big');
4375		        			this.obPrice.classList.remove('red-color');
4376		        		}
4377
4378		        		this.obPrice.innerHTML = this.product[this.offerNum].PRICE.HTML;
4379		        	}
4380		        	else
4381		        	{
4382		        		this.obPrice.classList.add('hidden');
4383		        		this.obPrice.innerHTML = "";
4384		        	}
4385
4386
4387		        	if(typeof this.product[this.offerNum].OLD_PRICE.VALUE !== "undefined")
4388		        	{
4389		        		this.obOldPrice.classList.remove('hidden');
4390		        		this.obOldPrice.innerHTML = this.product[this.offerNum].OLD_PRICE.HTML;
4391		        	}
4392		        	else
4393		        	{
4394		        		this.obOldPrice.classList.add('hidden');
4395		        		this.obOldPrice.innerHTML = "";
4396		        	}
4397	        	}
4398        	}
4399        	else
4400        	{
4401        		this.obPriceBlock.classList.add('hidden');
4402        	}
4403
4404        	
4405        }
4406
4407
4408    }
4409})(window);
4410
4411
4412function updateWidgetInPublicMob(action){
4413
4414	var url2Basket = $(".basket-count-control-widget-in-public-mob").find(".url2Basket"),
4415		url2Other = $(".basket-count-control-widget-in-public-mob").find(".url2Other");
4416
4417	if(action)
4418	{
4419		$(".basket-count-control-widget-in-public-mob").addClass('no-empty');
4420		$(".basket-count-control-widget-in-public-mob").removeClass('cart-empty');
4421
4422		if(url2Basket.length>0)
4423			url2Basket.removeClass("hidden");
4424
4425		if(url2Other.length>0)
4426			url2Other.addClass("hidden");
4427	}
4428	else
4429	{
4430		$(".basket-count-control-widget-in-public-mob").removeClass('no-empty');
4431		$(".basket-count-control-widget-in-public-mob").addClass('cart-empty');
4432
4433		if(url2Basket.length>0)
4434			url2Basket.addClass("hidden");
4435
4436		if(url2Other.length>0)
4437			url2Other.removeClass("hidden");
4438	}
4439}
4440
4441function updateWidgetInPublic(action){
4442
4443
4444	var aBtn = $(".basket-count-control-widget-in-public").find(".cart_link");
4445
4446	if(action)
4447	{
4448		$(".basket-count-control-widget-in-public").addClass('no-empty cart-show');
4449		$(".basket-count-control-widget-in-public").removeClass('cart-empty');
4450
4451		if(aBtn.length>0)
4452			aBtn.addClass("hidden");
4453	}
4454	else
4455	{
4456		$(".basket-count-control-widget-in-public").removeClass('no-empty cart-show');
4457		$(".basket-count-control-widget-in-public").addClass('cart-empty');
4458
4459		if(aBtn.length>0)
4460			aBtn.removeClass("hidden");
4461	}
4462}
4463function updateMiniWidgetInMenu(action){
4464
4465	var aBtn = $(".basket-count-control-mini-widget").find(".cart_link");
4466
4467	if(action)
4468	{
4469		
4470		$(".basket-count-control-mini-widget").addClass('no-empty');
4471		$(".basket-count-control-mini-widget").removeClass('cart-empty');
4472
4473		aBtn.addClass("cart-show").removeAttr("href");
4474	}
4475	else
4476	{
4477		$(".basket-count-control-mini-widget").removeClass('no-empty');
4478		$(".basket-count-control-mini-widget").addClass('cart-empty');
4479
4480		if(typeof aBtn.attr("data-url")!=="undefined")
4481			aBtn.removeClass("cart-show").attr("href", aBtn.attr("data-url"));
4482	}
4483}
4484
4485function updateBtnsAdd2Basket(){
4486
4487	$(".btn-add2basket").removeClass("added");
4488
4489	for (var i in globalBasketItems["ITEMS"])
4490	{
4491		$(".btn-add2basket[data-product-id=\""+globalBasketItems["ITEMS"][i].id+"\"]").addClass("added");
4492	}
4493}
4494
4495function updateBasketPublicInfo(){
4496	if(globalBasketItems["COUNT"] > 0)
4497	{
4498		updateMiniWidgetInMenu(true);
4499		updateWidgetInPublic(true);
4500		updateWidgetInPublicMob(true);
4501	}
4502	else
4503	{
4504		updateMiniWidgetInMenu(false);
4505		updateWidgetInPublic(false);
4506		updateWidgetInPublicMob(false);
4507	}
4508	updateBtnsAdd2Basket();
4509
4510	$(".basket-count-value").html(globalBasketItems["COUNT"]);
4511	
4512}
4513
4514$(document).on("click", ".btn-add2basket.added", function() {
4515	openCart();
4516});
4517
4518$(document).on("click", ".btn-fast-order", function() {
4519	var productID = 0,
4520		mainID = 0,
4521		isOffer = "N",
4522		formId = "N",
4523		params = {};
4524
4525
4526	if(typeof $(this).attr("data-product-id") != "undefined")
4527		productID = mainID = $(this).attr("data-product-id");
4528
4529	if(typeof $(this).attr("data-main-id") != "undefined")
4530	{
4531		isOffer = "Y";
4532		mainID = $(this).attr("data-main-id");
4533	}
4534
4535	if(typeof $(this).attr("data-form-id") != "undefined")
4536		formId = $(this).attr("data-form-id");
4537
4538
4539	if(productID&&mainID&&formId!="N")
4540	{
4541		params = {
4542			"element_type": "CTL",
4543			"element_id": productID,
4544			"main_id": mainID,
4545			"isOffer": isOffer,
4546			"formId": formId,
4547			"action": "order"
4548		};
4549
4550		callFormDialog(params);
4551	}
4552});
4553
4554
4555
4556$(document).on("click", ".callDialogForm", function() {
4557	var productID = 0,
4558		mainID = 0,
4559		isOffer = "N",
4560		formId = "N",
4561		elementType = "",
4562		action = "",
4563		params = {};
4564
4565
4566	if(typeof $(this).attr("data-product-id") != "undefined")
4567		productID = mainID = $(this).attr("data-product-id");
4568
4569	if(typeof $(this).attr("data-main-id") != "undefined")
4570	{
4571		if(productID != $(this).attr("data-main-id"))
4572		{
4573			isOffer = "Y";
4574			mainID = $(this).attr("data-main-id");
4575		}
4576		
4577	}
4578
4579	if(typeof $(this).attr("data-form-id") != "undefined")
4580		formId = $(this).attr("data-form-id");
4581
4582	if(typeof $(this).attr("data-elementtype") != "undefined")
4583		elementType = $(this).attr("data-elementtype");
4584
4585	if(typeof $(this).attr("data-action") != "undefined")
4586		action = $(this).attr("data-action");
4587
4588
4589	if(productID&&mainID&&formId!="N")
4590	{
4591		params = {
4592			"element_type": elementType,
4593			"element_id": productID,
4594			"main_id": mainID,
4595			"isOffer": isOffer,
4596			"formId": formId,
4597			"action": action
4598		};
4599
4600		callFormDialog(params);
4601	}
4602});
4603
4604
4605
4606function callFormDialog(params)
4607{
4608	params = params || null;
4609
4610	$('.google-spin-wrapper').addClass('active');
4611
4612	$.post("/bitrix/tools/kraken/ajax/formmodal.php", 
4613		Object.assign({
4614			"site_id": $("input.site_id").val()
4615		}, params)
4616		,
4617		function(html)
4618		{
4619			$("body").addClass("modal-open");
4620			if (isIos) {
4621				$("body").addClass("modal-ios");
4622			}
4623
4624			$('div.modalAreaForm').html(html);
4625			setTimeout(function() {
4626				$('div.modalAreaForm').find(".kraken-modal").addClass("active");
4627				$("input[name='url']").val(decodeURIComponent(location.href));
4628				$('div.modalAreaForm form.form .date').datetimepicker({
4629                    timepicker: false,
4630                    format: 'd/m/Y',
4631                    scrollMonth: false,
4632                    scrollInput: false,
4633                    dayOfWeekStart: 1
4634                });
4635			},300);
4636
4637			$('.google-spin-wrapper').removeClass('active');
4638			
4639		}
4640	);
4641}
4642
4643function updateBasketFly(templ)
4644{
4645	$.post('/bitrix/tools/kraken/ajax/cart/component_cart.php',{
4646        site_id: $("input.site_id").val(),
4647        templ: templ
4648    }, 
4649    function(html)
4650    {
4651        $(".area_for_" + templ).html(html);
4652
4653    });
4654}
4655
4656
4657
4658function animateToBasket(id)
4659{
4660	if($("img[data-cart-id-img = '" + id + "']").length>0)
4661	{
4662
4663		if($(".btn-add2basket[data-product-id = '" + id + "']").length>0)
4664		{
4665			if(!$(".btn-add2basket[data-product-id = '" + id + "']").hasClass('added'))
4666			{
4667
4668				var obj_img = $("img[data-cart-id-img = '" + id + "']");
4669				var mini_cart = $(".open-cart");
4670
4671				if ($(window).width() < 767)
4672					mini_cart = $(".open-cart-mob");
4673
4674				var width_parent_img = $(this).parents(".element").find(
4675					"td.parent_anim_img_area").width() / 2;
4676				var height_parent_img = $(this).parents(".element").find(
4677					"td.parent_anim_img_area").height() / 2;
4678
4679				obj_img.clone().css({
4680					'width': 70 + 'px',
4681					'height': 70 + 'px',
4682					'position': 'absolute',
4683					'z-index': '9999',
4684					'borderRadius': 50 + '%',
4685					top: obj_img.offset().top + height_parent_img,
4686					left: obj_img.offset().left + width_parent_img
4687				}).appendTo("body").animate({
4688					opacity: 0.05,
4689					left: mini_cart.offset()['left'],
4690					top: mini_cart.offset()['top'],
4691					width: 20,
4692					height: 20
4693				}, 700, function(){
4694					$(this).remove();
4695				});
4696			}
4697
4698		}
4699
4700	}
4701}
4702
4703function openCart() {
4704    $('.no-click-block').addClass('on');
4705    $('div.cart-parent').addClass('open');
4706    $('.wrapper').addClass('blur');
4707    $('body').addClass('modal-open');
4708    
4709
4710    var cartOut = setTimeout(function() {
4711        $('div.cart-parent').addClass('on');
4712        clearTimeout(cartOut);
4713        
4714    }, 200);
4715
4716    $('.lazyload', 'div.cart-parent').each(
4717        function(index, element)
4718        {
4719            $(element).attr("src", $(element).attr("data-src"));
4720            $(element).removeAttr('data-src');
4721        }
4722    );
4723}
4724
4725function closeCart(){
4726	$('.wrapper').removeClass('blur');
4727	$('body').removeClass('modal-open');
4728	$('div.cart-parent').removeClass('on');
4729	$('.no-click-block').removeClass('on');
4730	var closeCartOut = setTimeout(function() {
4731		$('div.cart-parent').removeClass('open');
4732		clearTimeout(closeCartOut);
4733	}, 700);
4734}
4735
4736
4737function controlAjaxBasketInfo (params)
4738{
4739	params = params || null;
4740
4741	if(params === null)
4742		return false;
4743
4744
4745	if(params.action == "update")
4746    {
4747    	$(".total-parent-preload-circleG").addClass('active');
4748    	$(".parent-preload-circleG[data-product-id=\""+params.idcartEl+"\"]").addClass('active');
4749    }
4750
4751	$.ajax({
4752        url: "/bitrix/tools/kraken/ajax/cart/cart.php",
4753        dataType: 'json',
4754        method: 'POST',
4755        data: Object.assign({
4756			"site_id": $("input.site_id").val()
4757			}, params)
4758		,
4759        success: function(json)
4760        {
4761            globalBasketItems = {};
4762            globalBasketItems = json.BASKET;
4763
4764
4765            if(params.action == "add")
4766            {
4767            	animateToBasket(params.idcartEl);
4768
4769            	if($(".first-click-show-basket").length>0)
4770            	{
4771            		if(!$(".first-click-show-basket").hasClass("active"))
4772            		{
4773            			$(".first-click-show-basket").addClass("active");
4774            			openCart();
4775            		}
4776            	}
4777
4778            	addGoal('ADD2BASKET');
4779            }
4780            
4781        	
4782        	if(typeof params.callback != "undefined")
4783            	params.callback();
4784
4785            
4786
4787            if (json.EMPTY == "Y"){
4788                closeCart();
4789                if($(".first-click-show-basket").length>0)
4790            	{
4791            		if($(".first-click-show-basket").hasClass("active"))
4792            			$(".first-click-show-basket").removeClass("active");
4793            		
4794            	}
4795
4796            	if($(".cart_page_wrap").length>0)
4797            		$(".cart_page_wrap").removeClass("cart-no-empty").addClass("cart-empty");
4798
4799
4800            	if ($(".cart-first-block").length>0) {
4801                    $(".cart-page-inner-js").addClass('cart-empty');
4802                }
4803            }
4804
4805        	updateBasketFly("list");
4806        	updateBasketFly("total");
4807            
4808            updateBasketPublicInfo();
4809        }
4810    });
4811}
4812
4813function add2Basket(productID, count, mainId, callback){
4814
4815	var params = {
4816        "action": "add",
4817		"idcartEl":productID,
4818        "countCart": count,
4819        "main_id": mainId,
4820        "callback": callback
4821	};
4822	controlAjaxBasketInfo(params);
4823
4824}
4825
4826
4827$(document).on('click', '.action-add2basket', function()
4828{
4829	var productID=0, count=1, mainId=0;
4830
4831	if(typeof $(this).attr("data-product-id") != "undefined")
4832		productID = mainId = $(this).attr("data-product-id");
4833
4834	if(typeof $(this).attr("data-main-id") != "undefined")
4835		mainId = $(this).attr("data-main-id");
4836
4837	if(typeof $(this).attr("data-cart-quantity") != "undefined")
4838		count = $(this).attr("data-cart-quantity");
4839
4840	if(productID&&count&&mainId)
4841		add2Basket(productID, count, mainId);
4842});
4843
4844function updateBasket(productID, count, mainId, callback){
4845
4846	var params = {
4847        "action": "update",
4848		"idcartEl": productID,
4849        "countCart": count,
4850        "main_id": mainId
4851	};
4852
4853	clearTimeout($.data(this, 'cart_count'));
4854
4855	$.data(this, 'cart_count', setTimeout($.proxy(function() {
4856		controlAjaxBasketInfo(params);
4857	}, this), 700));
4858	
4859	
4860}
4861
4862
4863$(document).on('click', '.removeBasketProduct', function()
4864{
4865	if(typeof $(this).attr("data-cart-id") != "undefined")
4866    	deleteItemBasket($(this).attr("data-cart-id"));
4867});
4868
4869$(document).on('click', '.action-clear-cart', function()
4870{
4871	clearBasket();
4872});
4873
4874
4875function clearBasket(){
4876	var params = {
4877        "action": "clear"
4878	};
4879	controlAjaxBasketInfo(params);
4880}
4881
4882function deleteItemBasket(productID, callback){
4883
4884	var params = {
4885        "action": "delete",
4886		"idcartEl":productID
4887	};
4888	controlAjaxBasketInfo(params);
4889}
4890
4891$(document).ready(function()
4892{
4893	if($(".fly-basket").length>0)
4894	{
4895		updateBasketFly("list");
4896		updateBasketFly("total");
4897	}
4898	$("input[name='url']").val(decodeURIComponent(location.href));
4899});
4900
4901$(document).on('click', '.wrapper-select-input', function()
4902{
4903    if(!$(this).hasClass('open'))
4904        $(this).addClass('open');
4905    
4906    else
4907    {
4908        $(this).removeClass('open');
4909    }
4910    
4911});
4912
4913
4914
4915$(document).on('click', '.section-with-hidden-items .head-filter', 
4916    function()
4917    {
4918        var btn = $(this);
4919        var content = $(".content-animate-slide-down[data-show ='"+btn.attr("data-show")+"']");
4920        var btns = $(".click-animate-slide-down[data-show ='"+btn.attr("data-show")+"']");
4921
4922        content.slideUp(400, function()
4923            {
4924                btns.addClass('noactive-mob').removeClass('active-mob');
4925                content.addClass('noactive-mob').removeClass('active-mob');
4926            }
4927        );
4928    }
4929);
4930
4931$(document).on('click', '.click-animate-slide-down', 
4932    function()
4933    {
4934        var btn = $(this);
4935        var content = $(".content-animate-slide-down[data-show ='"+btn.attr("data-show")+"']");
4936
4937        if($(window).width() > 768)
4938        {
4939
4940            if(!btn.hasClass('active'))
4941            {
4942                content.slideDown(400, function()
4943                    {
4944                        btn.addClass('active').removeClass('noactive');
4945                        content.addClass('active').removeClass('noactive');
4946                    }
4947                );
4948                BX.setCookie($(".domen-url-for-cookie").val()+'_catalog_tab_'+btn.attr("data-show")+$("input.site_id").val(), 'active', {expires: 60*60*60*60, path: "/"});
4949            }
4950            else
4951            {
4952                content.slideUp(400, function()
4953                    {
4954                        btn.addClass('noactive').removeClass('active');
4955                        content.addClass('noactive').removeClass('active');
4956                    }
4957                );
4958                BX.setCookie($(".domen-url-for-cookie").val()+'_catalog_tab_'+btn.attr("data-show")+$("input.site_id").val(), 'noactive', {expires: 60*60*60*60, path: "/"});
4959            }
4960
4961        }
4962        else
4963        {
4964            if(!btn.hasClass('active-mob'))
4965            {
4966                content.addClass('active-mob').removeClass('noactive-mob');
4967                content.slideDown(400, function()
4968                    {
4969                        btn.addClass('active-mob').removeClass('noactive-mob');
4970                    }
4971                );
4972                
4973            }
4974            else
4975            {
4976                content.slideUp(400, function()
4977                    {
4978                        btn.addClass('noactive-mob').removeClass('active-mob');
4979                        content.addClass('noactive-mob').removeClass('active-mob');
4980                    }
4981                );
4982            }
4983        }
4984        
4985    }
4986);
4987
4988if ($(window).width() > 1024)
4989{
4990
4991	$( ".service-item" )
4992	.mouseenter(function()
4993	{
4994		if($(this).find(".panel-bottom").length>0)
4995		{
4996			$(this).css({
4997		        'height': ($(this).height() - $(this).find(".panel-bottom").outerHeight()) + 'px'
4998		    });
4999		}
5000	    
5001  	})
5002  	.mouseleave(
5003		function()
5004			{
5005				if($(this).find(".panel-bottom").length>0)
5006				{
5007				    $(this).css({
5008				        'height': 'auto'
5009				    } );
5010				}
5011
5012		  	}
5013		);
5014}
5015
5016
5017$(document).on('click', '.open-dialog-window', 
5018    function()
5019    {
5020
5021    	if($(this).attr("data-typename"))
5022    	{
5023	    	var params = {
5024	    		"typeName": $(this).attr("data-typename"),
5025	    		"elementID": $(this).attr("data-elementid"),
5026	    		"blockTitle": $(this).attr("data-blocktitle"),
5027	    		"iblockID": $("input.LAND_iblockID").val(),
5028	    		"iblockTypeID": $("input.LAND_iblockTypeID").val(),
5029	    		"site_id": $("input.site_id").val()
5030	    	};
5031
5032	    	callDialogWindow(params);
5033    	}
5034
5035    }
5036);
5037function callDialogWindow(params){
5038
5039	params = params || null;
5040
5041	if(params)
5042	{
5043		showProcessLoad();
5044		startBlurWrapperContainer();
5045
5046		$.post("/bitrix/tools/kraken/ajax/modal.php", params, 
5047		function(html)
5048		{
5049			closeProcessLoad();
5050			$(".modalAreaDetail").html(html);
5051
5052			setTimeout(function() {
5053				$('div.modalAreaDetail').find('.kraken-modal').addClass('active');
5054			}, 100);
5055		});
5056	}
5057}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.