PageSourceSearch

https://tricolor-nnov.ru/t/images/scripts.js?v=1.1.4

js tricolor-nnov.ru collected 2026-10-08 16:34:57 UTC 54,437 bytes, 1,873 lines download raw bytes

1var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(navigator.userAgent);
2var clickStart = (isMobile) ? 'touchend.respons' : 'click.respons';
3(function(){
4	var topMenuCall = $('.top-menu-call');
5
6	function callDropdownCloseClick(e){
7		var linkClass = 'top-menu-call__link';
8		var submitButton = $('.top-menu-call__dropdown input[type="submit"]').eq(0);
9
10	    if (!submitButton.is(e.target) && (!topMenuCall.is(e.target) || topMenuCall.has(e.target).length === 0)) {
11	        topMenuCall.find('.'+linkClass).removeClass(linkClass+'--active');
12	    }
13	}
14
15	$('.top-menu-call__link').on('click', function(e) {
16	    e.preventDefault();
17	    e.stopPropagation();
18	    $(this).toggleClass('top-menu-call__link--active');
19
20	    if ($(this).is('.top-menu-call__link--active')) {
21	    	$('.overlay-bg').addClass('active');
22			$('body').bind('click', callDropdownCloseClick);
23	        if (/iPod|iPad|iPhone/i.test(navigator.userAgent)) {
24	            $('html, body').addClass('overflowHidden');
25	        } else {
26	            $(document.documentElement).addClass('overflowHidden');
27	        }
28	        
29	    } else {
30	        $('.overlay-bg').removeClass('active');
31			$('body').unbind('click', callDropdownCloseClick);
32	        if (/iPod|iPad|iPhone/i.test(navigator.userAgent)) {
33	            $('html, body').removeClass('overflowHidden');
34	        } else {
35	            $(document.documentElement).removeClass('overflowHidden');
36	        }
37	    }	
38	});
39		
40})();
41
42$('.form-control').on('click', function(e){
43    e.stopPropagation();
44});
45$('.top-menu-call__form').on('submit', function(e){
46    e.preventDefault();
47    $.post('/obratnyy-zvonok', $(this).serialize());
48    $(this).find('input:not([type="submit"])').val('');
49    $('.top-menu-call__link--active').removeClass('top-menu-call__link--active');
50    $('.overlay-bg.active').removeClass('active');
51    
52    iziToast.success({
53        title: 'Ваша заявка отправлена'
54    });
55});
56$(document).ready(function(){
57    // if($(window).width() > 700){
58        stickybits('.site-sidebar.left', {
59            stickyBitStickyOffset: 90,
60            useStickyClasses: true
61        });
62    // }
63});
64
65// begin /g/templates/shop2/2.33.2/js/main.js
66// YandexMap
67
68(function() {
69
70	function coords(str) {
71		return str.split(',');
72	}
73
74
75	function init(options) {
76		options.center = coords(options.center);
77
78		$.each(options.data, function(key, item) {
79			item.coords = coords(item.coords);
80		});
81
82		if (options.type == 'google') {
83
84			google.maps.event.addDomListener(window, 'load', function() {
85				
86				var map = new google.maps.Map(document.getElementById(options.id), {
87					zoom: 15,
88					center: new google.maps.LatLng(options.center[0], options.center[1]),
89					scrollwheel: false
90				});
91
92				$.each(options.data, function(key, item) {
93					
94
95					var marker = new google.maps.Marker({
96						position: new google.maps.LatLng(item.coords[0], item.coords[1]),
97						map: map,
98						title: item.name
99					});
100
101					var infowindow = new google.maps.InfoWindow({
102						content: '<div class="baloon-content">' +
103									'<h3>' + item.name + '</h3>' +
104									item.desc +
105								 '</div>'
106					});
107
108					google.maps.event.addListener(marker, 'click', function() {
109						infowindow.open(map, marker);
110					});
111
112				});
113			});
114
115		} else {
116
117			ymaps.ready(function() {
118
119				var map = new ymaps.Map(options.id, {
120					center: options.center,
121					zoom: options.zoom,
122					behaviors: ['drag', 'rightMouseButtonMagnifier'],
123				});
124
125				map.controls.add(
126					new ymaps.control.ZoomControl()
127				);
128
129				var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass(
130					'<div class="baloon-content">' +
131						'<h3>$[properties.name]</h3>' +
132						'$[properties.desc]' +
133					'</div>'
134				);
135
136				var myCollection = new ymaps.GeoObjectCollection();
137
138				$.each(options.data, function(key, item) {
139					myCollection.add(new ymaps.Placemark(
140						item.coords,
141						item, 
142						{balloonContentLayout: MyBalloonContentLayoutClass}
143					));
144				});
145
146				map.geoObjects.add(myCollection);
147
148			});
149
150		}
151
152	}
153
154	window.mjsMap = init;
155
156})();
157
158// /YandexMap
159(function($) {
160	$.fn.sizePic = function(options) {
161		var opts = $.extend({}, $.fn.sizePic.defaults, options);
162		return this.each(function() {
163			var o = $(this), img = new Image(), width, height, marginTop = 0, wToMaxW, hToMaxH, params = {};
164			img.onload = function() {
165				width = img.width;
166				height = img.height;
167				wToMaxW = width / opts.width;
168				hToMaxH = height / opts.height;
169				if(wToMaxW > 1 || hToMaxH > 1) {
170					if(wToMaxW > hToMaxH) {
171						params.width = opts.width;
172						params.height = height / wToMaxW;
173					} else {
174						params.width = width / hToMaxH;
175						params.height = opts.height;
176					}
177					o.css(params);
178				};
179			};
180			img.src = this.src;
181		});
182	}
183
184	$.fn.sizePic.defaults = {
185		width : 298,
186		height : 170
187	};
188})(jQuery);
189
190shop2.queue.amount = function() {
191
192	var $document = $(document);
193
194	function validate(input) {
195		var kind = input.data('kind'),
196			max = input.data('max'),
197			val = Number(input.val()),
198			amount = 0,
199			available;
200
201		if (kind && max > 0) {
202			$('input[data-kind=' + kind + ']').each(function() {
203				amount += Number(this.value);
204			});
205
206			if (amount > max) {
207				available = max - amount + val;
208				input.val(available);
209				shop2.msg(_s3Lang.JS_AVAILABLE_ONLY + ' ' + available, input);
210			}
211		}
212	}
213
214	$document.on('click', '.amount-minus', function() {
215		var $this = $(this),
216			text = $this.siblings('input:text'),
217			value = text.getVal();
218
219		if (value) {
220			value = value[0];
221		}
222		value -= shop2.options.amountDefaultInc;
223		value = value.toFixed(5) - 0;
224
225		if (value <= shop2.options.amountDefaultValue) {
226			value = shop2.options.amountDefaultValue;
227		}
228
229		text.val(value);
230		text.trigger('keyup');
231	});
232
233	$document.on('click', '.amount-plus', function() {
234
235		var $this = $(this),
236			text = $this.siblings('input:text'),
237			value = text.getVal();
238
239		if (value) {
240			value = value[0];
241		}
242
243		value += shop2.options.amountDefaultInc;
244		value = value.toFixed(5) - 0;
245
246		text.val(value);
247		text.trigger('keyup');
248	});
249
250	$document.on('keyup', '.shop-product-amount input:text', function() {
251		var $this = $(this);
252		validate($this);
253	});
254
255	$document.keyFilter('.shop-product-amount input:text', {
256		type: shop2.options.amountType
257	});
258},
259
260
261shop2.filter.sort = function(name, elem) {
262	var re = new RegExp(this.escape('s[sort_by]') + '=([^&]*)'),
263		params = this.str.match(re),
264		desc = name + ' desc',
265		asc = name + ' asc',
266		isDesc = (elem.is('.sort-param-desc'));
267
268
269	params = (params && params.length > 1) ? params[1] : '';
270	
271	params = (isDesc) ? desc : asc;
272
273
274	this.remove('s[sort_by]');
275	this.add('s[sort_by]', params);
276	return this;
277}
278shop2.queue.sort = function() {
279	var wrap = $('.sorting');
280
281	wrap.find('.sort-param').on('click', function(e) {
282		var $this = $(this),
283			name = $this.data('name');
284
285		e.preventDefault();
286		shop2.filter.sort(name, $this);
287		shop2.filter.go();
288	});
289
290	wrap.find('.sort-reset').on('click', function(e) {
291		e.preventDefault();
292		shop2.filter.remove('s[sort_by]');
293		shop2.filter.go();
294	});
295};
296
297shop2.queue.cart = function() {
298
299	var updateBtn = $('.shop2-cart-update'),
300		cartTable = $('.shop2-cart-wrapper .left-side'),
301		form = $('#shop2-cart');
302
303	shop2.on('afterCartRemoveItem, afterCartUpdate', function() {
304		// document.location.reload();
305	});
306
307	function updateBtnShow() {
308		updateBtn.show();
309	}
310
311	cartTable.find('input:text').on('keypress', function(e) {
312		if (e.keyCode == 13) {
313			shop2.cart.update(form);
314		} else {
315			updateBtnShow();
316		}
317	});
318
319	cartTable.find('.amount-minus, .amount-plus').on('click', updateBtnShow);
320
321	updateBtn.on('click', function(e) {
322		e.preventDefault();
323		shop2.cart.update(form);
324		return false;
325	});
326
327
328	$('.cart-delete a').on('click', function(e) {
329		var $this = $(this),
330			id = $this.data('id');
331
332		e.preventDefault();
333
334		shop2.cart.remove(id);
335
336	});
337
338}
339
340shop2.queue.addToCart = function() {
341
342	$(document).on('click', '.shop-product-button', function(e) {
343
344		var $this = $(this),
345			$form = $this.closest('form'),
346			form = $form.get(0),
347			adds = $form.find('.additional-cart-params'),
348			len = adds.length,
349			i, el,
350			a4 = form.amount.value,
351			kind_id = form.kind_id.value;
352
353		e.preventDefault();
354
355		if (len) {
356			a4 = {
357				amount: a4
358			};
359
360			for (i = 0; i < len; i += 1) {
361				el = adds[i];
362				if (el.value) {
363					a4[el.name] = el.value;
364				}
365			}
366		}
367
368		shop2.cart.add(kind_id, a4, function(d) {
369
370			$('#shop2-cart-preview').replaceWith(d.data);
371
372			if (d.errstr) {
373				shop2.msg(d.errstr, $this);
374				$('#shop2-cart-preview').addClass('class_name');
375				setTimeout(function() {
376			        $('#shop2-cart-preview').removeClass('class_name');
377			    }, 1500);
378			} else {
379				//shop2.msg(window._s3Lang.JS_ADDED, $this);
380				var $text = window._s3Lang.JS_SHOP2_ADD_CART_WITH_LINK;
381	            shop2.msg($text.replace('%s', shop2.uri + '/cart'), $this);
382			}
383
384			if (d.panel) {
385				$('#shop2-panel').replaceWith(d.panel);
386			}
387		});
388
389	});
390
391},
392
393shop2.queue.hs = function() {
394
395	$('.shop-compare-product-image a img, .shop-compare-data a img, .cart-product-image a img, .cart-product-param a img').closest('a').on('click', function() {
396		hs.expand(this);
397		return false;
398	}
398).addClass('highslide');
399	
400	$(document).on('click', '.shop2-edost-office-address a', function() {
401		hs.htmlExpand(this, {
402			objectType: 'iframe',
403			wrapperClassName: 'draggable-header',
404			outlineType: 'rounded-white',
405			width: 900,
406			height: 600,
407			align: 'center'
408		});
409		return false;
410	});
411
412
413},
414
415shop2.msg = function(text, obj) {
416    var selector = '#shop2-msg',
417        msg = $(selector),
418        offset = obj.offset(),
419        width = obj.outerWidth(true),
420        height = obj.outerHeight(true);
421
422    if (!msg.get(0)) {
423        msg = $('<div id="shop2-msg">');
424        $(document.body).append(msg);
425        msg = $(selector);
426    }
427    var topMinus = parseInt($('.site-wrapper').css('marginTop'));
428
429    msg.html(text).show();
430
431    var msgWidth = msg.outerWidth();
432    var left = offset.left;
433    var top = offset.top + height - topMinus;
434
435    if (left + msgWidth > $(window).width()) {
436        left = offset.left - msgWidth;
437    }
438
439    msg.css({
440        left: left,
441        top: top
442    });
443
444    $.s3throttle('msg', function() {
445        msg.hide();
446    }, shop2.options.msgTime);
447
448};
449
450shop2.queue.question = function() {
451    var cls = '.price-old.question, .shop-cart-total .question';
452    
453    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || /[\?&]panel_fake_mobile=1(&|$)/.test(document.location.search)){
454        $('.price-old.question, .shop-cart-total .question').on('click', function(event) {
455            var $this = $(this),
456                win = $this.next().show(),
457                position = $this.position(),
458                height = win.outerHeight(true);
459            
460            if (!$this.next().hasClass('classThis')) {
461                $this.next().addClass('classThis');
462                win.css({
463                    top: position.top - height - 5,
464                    left: position.left
465                });
466            } else {
467                var $this = $(this),
468                    win = $this.next();
469                    
470                $this.next().removeClass('classThis');
471                
472                win.hide();
473            }
474        });
475    } else {
476        $(document).on('mouseenter', cls, function() {
477            var $this = $(this),
478                win = $this.next().show(),
479                position = $this.position(),
480                height = win.outerHeight(true);
481    
482            win.css({
483                top: position.top - height - 5,
484                left: position.left
485            });
486    
487        }).on('mouseleave', cls, function() {
488    
489            var $this = $(this),
490                win = $this.next();
491    
492            win.hide();
493    
494        });
495    }
496
497};
498
499(function($) {
500$(function() {
501	var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(navigator.userAgent),
502		isApple = /iPod|iPad|iPhone/i.test(navigator.userAgent);
503	var clickStart = (isMobile) ? 'touchend.respons' : 'click.respons';
504
505	$('table').wrap('<div class="table-wrapper"></div>');
506
507	function searchHeight() {
508		var seachBlcok = $('.search-online-store'),
509			seachBlcokPosition = seachBlcok.offset().top,
510			seachBlcokMaxHeight = ($(document).height()) - seachBlcokPosition - 56;
511			$('.search-online-store .block-body').css('maxHeight', seachBlcokMaxHeight);
512	}
513
514	setTimeout(function() {
515		searchHeight();
516	}, 1500);
517
518	
519	$.ajaxSetup({complete: function(){$('.search-online-store select, .shop-filter select, .product-options select, .shop-filter input[type="checkbox"], .shop-filter input[type="radio"], .search-online-store input[type="radio"], .search-online-store input[type="radio"], .product-options input[type="radio"], .product-options input[type="radio"]').styler({selectPlaceholder: 'Все'}); }});
520	
521	$('input[type="radio"], input[type="checkbox"]')
522		.not('.type-checkbox.type-checkbox--policy input[type="checkbox"], .anketa-wrapper .input[type="radio"], .anketa-wrapper input[type="checkbox"], .product-compare input[type="checkbox"], .sg-page-article__comment-list input[type="checkbox"]').styler();
523
524	$('.search-online-store select, .shop-filter select, .product-options select').styler({
525		selectPlaceholder: 'Все'
526	});
527
528	$('.product-compare input[type="checkbox"], .sg-page-article__comment-list input[type="checkbox"], #form_g-user-register input[type="radio"]').styler('destroy');
529
530
531   
532    shop2.on('afterGetProductListItem', function() {
533          $('.product-list select').styler('destroy').styler();
534    });
535    
536    $.ajaxSetup({
537		complete: function(){
538			$('.search-online-store input[type=checkbox], .search-online-store input[type=radio], .search-online-store select').styler({selectPlaceholder: 'Все'})
539		}
540	});
541
542	$('.block-user .block-title').on(clickStart, function() {
543		if($('.block-user .block-body').is(':hidden')) {
544			$('.block-user .block-body').fadeIn();
545			$('.overlay-bg').addClass('active');
546
547			if (/iPod|iPad|iPhone/i.test(navigator.userAgent)) {
548				$('html, body').addClass('overflowHidden');
549			} else {
550				$(document.documentElement).addClass('overflowHidden');
551			}
552
553		} else {
554			$('.block-user .block-body').fadeOut();
555			$('.overlay-bg').removeClass('active');
556
557			if (/iPod|iPad|iPhone/i.test(navigator.userAgent)) {
558				$('html, body').removeClass('overflowHidden');
559			} else {
560				$(document.documentElement).removeClass('overflowHidden');
561			}
562		}	
563	});
564
565	$('.search-online-store .block-title').on(clickStart, function() {
566
567		if($('.search-online-store .block-body').is(':hidden')) {
568			$('.search-online-store .block-body').fadeIn();
569			$('.search-online-store .block-title').toggleClass('active');
570			$('.overlay-bg').addClass('active');
571			$('.search-panel .right-side').toggleClass('mobile');
572
573			$('.search-online-store').css({"z-index":101});
574
575		} else {
576			$('.search-online-store .block-body').fadeOut();
577			$('.search-online-store .block-title').removeClass('active');
578			$('.overlay-bg').removeClass('active');
579			$('.search-panel .right-side').removeClass('mobile');
580
581			$('.search-online-store').css({"z-index":2});
582		}
583
584		if (!$('.search-online-store .block-title').hasClass("active")) return false;
585		if ($('html, body').is(':animated')) return false;
586			hash = $('.search-panel');
587
588		if ($(hash).length) {
589			k = false;
590			
591			$('html, body').animate({
592				scrollTop : $(hash).offset().top - $('.top-panel-wrapper').height()
593			}, 600, function() {
594				setTimeout(function() {k = true}, 100);
595			});
596		}
597
598		return false;
599
600	});
601
602
603	(function() {
604		var $wrapper = $(".top-menu-wrapper"),
605			$button = $(".top-menu-button"),
606			$close = $(".top-menu-close"),
607			$list = $(".top-menu"),
608			options = {
609				wrapper: ".site-wrapper"
610			};
611
612		$close.on("click", function() {
613			$wrapper.pudgeJS("close");
614		});
615
616		// menu init
617		$wrapper.pudgeJS(/* options */);
618
619		resizeController(1124, function() {
620
621			// menu toggle
622			$wrapper.pudgeJS(/*, options */);
623			$button.on(clickStart, menuPudgeToggle);
624
625		}, function() {
626
627			// menu destroy
628			$wrapper.pudgeJS("destroy");
629			$button.off(clickStart, menuPudgeToggle);
630		});
631		
632		function menuPudgeToggle(event) {
633			event.preventDefault();
634			$wrapper.pudgeJS("toggle");
635		};
636	})();
637	
638	(function() {
639		var $menu = $('.top-menu');
640
641		resizeController(980, function() {
642			$('.top-menu').addClass('mobile');
643			$menu.off('mouseenter mouseleave');
644			$menu.find('.s3-menu-allin-has').removeClass('s3-menu-allin-has');
645			$menu.find('ul').removeAttr('style');
646			
647			$('.top-menu li').each(function(){
648		        var $this = $(this),
649		        $spanS1 = $('<span class="s1"></span>');
650		        
651		        if ($this.find('> ul').get(0)) {
652		            $this.append($spanS1);
653		        }	
654		    });
655		
656		    $('.top-menu').on('click', '.s1', function() {
657				var $this = $(this);
658				var $li = $this.closest('li');
659				var $ul = $li.find('>ul');
660				
661				if ($li.hasClass('opened')) {
662					$ul.stop().slideUp(400, function(){
663		
664						$li.removeClass('opened');
665					});
666				} else {
667					$ul.stop().slideDown(400, function(){
668				
669						$li.addClass('opened');
670					});
671					$li.siblings().filter(':has(">ul")').each(function(){
672						var $this = $(this);
673						$this.find('>ul').stop().slideUp(400, function(){
674			
675							$this.removeClass('opened');
676						});
677					});
678				}
679			});
680		}, function() {
681                        
682			$menu.s3MenuAllIn({
683				type: 'bottom',
684				debug: false,
685				activateTimeout: 250,
686				showTime: 250,
687				hideTime: 250,
688				showFn: $.fn.fadeIn,
689				hideFn: $.fn.fadeOut
690			});
691		});
692	})();
693
694
695	
696
697	$('.shop-group-kinds').each(function(){
698        function startCarousel($element){
699            $element.owlCarousel({
700                loop:false,
701                margin:17,
702                nav:true,
703                autoplay:true,
704                autoplayHoverPause:true,
705                responsive:{
706                    320:{
707                        items:1,
708                    },
709                    520:{
710                        items:2,
711                    },
712                    785:{
713                        items:3,
714                    },
715                    1010:{
716                        items:4,
717                    },
718                    1180:{
719                        items:1,
720                    }
721                }
722            });
723        }
724
725        function stopCarousel($element) {
726            $element.trigger('destroy.owl.carousel');
727            $element.addClass('off');
728        }
729
730        var $self = $(this);
731
732        if ($self.prev().text() === 'Могут пригодиться') {
733            $(document).ready(function() {
734                if ( $(window).width() < 1179 ) {
735                  startCarousel($self);
736                } else {
737                  $self.addClass('off');
738                }
739            });
740              
741            $(window).resize(function() {
742                if ( $(window).width() < 1179 ) {
743                    startCarousel($self);
744                } else {
745                    stopCarousel($self);
746                }
747            });
748        } else {
749            startCarousel($self);
750        }
751    })
752    
753    
754
755
756
757	/*filter ---------------------------------------------------*/ 
758
759	$('.shop-filter .filter-title').click(function() {
760		$(this).toggleClass('open');
761		$(this).parent().find('.filter-param').slideToggle();
762		return false;
763	});	
764
765	var wrap = $('.shop-filter'),
766		result = $('.result');
767
768	shop2.filter.init();
769
770	shop2.on('afterGetSearchMatches', function (d, status) {
771
772		if (d.data.total_found === 0) {
773
774			result.addClass('no-result');
775		} else {
776			result.removeClass('no-result');
777		}
778
779		$('#filter-result').html(d.data.total_found);
780		
781		result.removeClass('hide');
782	});
783
784	wrap.find('.param-val').on(clickStart, function(e) {
785		var $this = $(this),
786			name = $this.data('name'),
787			value = $this.data('value');
788
789		e.preventDefault();
790
791		$this.toggleClass('active-val');
792		shop2.filter.toggle(name, value);
793		shop2.filter.count();
794	});
795
796	wrap.find('select').on('change', function() {
797		var $this = $(this),
798			name = this.name,
799			value = $this.val();
800		shop2.filter.remove(name);
801		shop2.filter.add(name, value);
802		shop2.filter.count();
803	});
804
805	wrap.find('input:text').keyup(function() {
806		var $this = $(this),
807			name = $this.attr('name');
808
809		$.s3throttle('filter: ' + name, function() {
810			var value = $this.val();
811
812			shop2.filter.add(name, value);
813			shop2.filter.count();
814		}, 500);
815	});
816
817	wrap.find('.input_range_slider').on('slide', function(e){
818        var $this = $(this),
819            $parent = $this.closest('.range_slider_wrapper'),
820            $input = $parent.find('input:text');
821            
822        $.each($input, function(i, elem) {
823            var name = $(elem).attr('name');
824
825            $.s3throttle('filter: ' + name, function() {
826                var value = $(elem).val();
827        
828                shop2.filter.add(name, value);
829                shop2.filter.count();
830            }, 500);
831        });
832    });
833	wrap.find('.shop2-filter-go').on(clickStart, function(e) {
834		e.preventDefault();
835		shop2.filter.go();
836	});	
837
838	$('.shop2-filter-title').on(clickStart, function() {
839		if($('.shop2-filter-wr').hasClass("active")) {
840			$('.shop2-filter-wr').removeClass("active")
841		} else {
842			$('.shop2-filter-wr').addClass("active");
843		}
844
845
846		
847		if (!$('.shop2-filter-wr').hasClass("active")) return false;
848		if ($('html, body').is(':animated')) return false;
849			hash = $('.shop2-filter-wr');
850
851		if ($(hash).length) {
852			k = false;
853			
854			$('html, body').animate({
855				scrollTop : $(hash).offset().top - $('.top-panel-wrapper').height()
856			}, 600, function() {
857				setTimeout(function() {k = true}, 100);
858			});
859		}
860
861		return false;
862	});
863
864	$('.shop-product-item, .shop2-cart-product').each(function(){
865		$(this).find('.product-info-wr .product-info-title, .cart-product-info-wr .product-info-title').on(clickStart, function() {
866			if($(this).closest('.shop-product-item, .shop2-cart-product').find('.product-info-wr .product-info-in, .cart-product-param-wr').is(':hidden')) {
867				$(this).closest('.shop-product-item, .shop2-cart-product').find('.product-info-wr .product-info-in, .cart-product-param-wr').fadeIn();
868				$(this).addClass("active")
869			} else {
870				$(this).closest('.shop-product-item, .shop2-cart-product').find('.product-info-wr .product-info-in, .cart
870-product-param-wr').fadeOut();
871				$(this).removeClass("active")
872				
873			}	
874		});
875	});
876
877	
878
879	//Sorting
880
881	var $sortingBtn = $('.shop-sorting-panel .sorting-wrap .sort-edit-block'),
882		$sortingBlock = $('.shop-sorting-panel .sorting-wrap .sorting-block'),
883		sortingParamLink = $('.shop-sorting-panel .sorting-wrap .sort-param.active');
884
885	$sortingBtn.click(function(event) {
886			$('.sorting-wrap').toggleClass('opened');
887			$('.sorting-block').fadeIn();
888			
889	});
890
891	$(document).on(clickStart, function(event) {
892	
893	if ($('.sorting-wrap').hasClass('opened')) {
894			if ($(event.target).closest('.sorting-wrap').length) return;
895			$('.sorting-wrap').removeClass('opened');
896			
897			$('.sorting-block').fadeOut();
898		}
899	});
900
901	function sortingTitle() {
902		var paramClone = sortingParamLink.first().clone().addClass('clone');
903
904		$sortingBtn.html(paramClone);
905
906		$('.shop2-panel-sorting .sorting-wrap .sort-param.clone').click(function(event) {
907			event.preventDefault();
908		});
909	}
910	if (sortingParamLink.hasClass('active')){
911		sortingTitle();
912	}
913
914	//-----View-btn
915	var $btnThumbs = $('.view-shop2 .thumbs'),
916		$btnSimple = $('.view-shop2 .simple'),
917		$btnPrice = $('.view-shop2 .pricelist'),
918		$lotsWrap = $('.product-list-in');
919
920	function thumbsLots() {
921		$btnThumbs.addClass('active-view');
922		$btnSimple.removeClass('active-view');
923		$btnPrice.removeClass('active-view');
924		$lotsWrap.addClass('product-list-thumbs');
925		$lotsWrap.removeClass('product-list-simple');
926		$lotsWrap.removeClass('product-list-price');
927		$('.pricelist-name-wr').removeClass('product-list-price');
928		$('.product-info-wr .product-info-in').removeAttr('style');
929		$('.product-info-wr .product-info-title').removeClass('active');
930
931		if ($(window).width()>=479){
932			$('.shop-product-item').each(function(){
933				$(this).find('.product-label').appendTo($(this).find('.product-image'));
934			});
935		}
936	}
937	function simpleLots() {
938		$btnSimple.addClass('active-view');
939		$btnThumbs.removeClass('active-view');
940		$btnPrice.removeClass('active-view');
941		$lotsWrap.addClass('product-list-simple');
942		$lotsWrap.removeClass('product-list-thumbs');
943		$lotsWrap.removeClass('product-list-price');
944		$('.pricelist-name-wr').removeClass('product-list-price');
945		$('.product-info-wr .product-info-in').removeAttr('style');
946		$('.product-info-wr .product-info-title').removeClass('active');
947
948		$('.shop-product-item').each(function(){
949			$(this).find('.product-label').appendTo($(this).find('.product-image'));
950		});
951	}
952	function priceLots() {
953		$btnPrice.addClass('active-view');
954		$btnThumbs.removeClass('active-view');
955		$btnSimple.removeClass('active-view');
956		$lotsWrap.addClass('product-list-price');
957		$lotsWrap.removeClass('product-list-thumbs');
958		$lotsWrap.removeClass('product-list-simple');
959		$('.pricelist-name-wr').addClass('product-list-price');
960
961		$('.shop-product-item').each(function(){
962			$(this).find('.product-label').prependTo($(this).find('.product-info-wr'));
963		});
964	}
965	function mobileLots() {
966		$lotsWrap.addClass('product-list-thumbs');
967		$lotsWrap.removeClass('product-list-simple');
968		$lotsWrap.removeClass('product-list-price');
969		$('.pricelist-name-wr').removeClass('product-list-price');
970	}
971
972	$btnThumbs.on(clickStart, function(e) {
973		e.preventDefault();
974		thumbsLots();
975
976		eraseCookie('simple');
977		eraseCookie('price');
978		createCookie('thumbs', 1, 1);
979		return false;
980	});
981
982	$btnSimple.on(clickStart, function(e) {
983		e.preventDefault();
984		simpleLots();
985
986		eraseCookie('price');
987		eraseCookie('thumbs');
988		createCookie('simple', 1, 1);
989		return false;
990	});
991
992	$btnPrice.on(clickStart, function(e) {
993		e.preventDefault();
994		priceLots();
995
996		eraseCookie('simple');
997		eraseCookie('thumbs');
998		createCookie('price', 1, 1);
999		return false;
1000	});
1001	function viewLots() {
1002		var	$mainBlock = $lotsWrap.closest('.main-blocks-wrapper').length;
1003
1004		if ($(window).width() <= 979) {
1005			thumbsLots();
1006
1007		} else {
1008			
1009			if (readCookie('thumbs') || $mainBlock == 1) {
1010				thumbsLots();
1011			} else if (readCookie('simple') && !$mainBlock == 1) {
1012				simpleLots();
1013			} else if (readCookie('price') && !$mainBlock == 1) {
1014				priceLots();
1015			}
1016
1017		}
1018	}
1019
1020	resizeController(400, function() {
1021		$('.shop-product .product-price-wr .shop-product-button').prependTo('.shop-product .product-btn-in');		
1022
1023	}, function() {
1024		$('.shop-product .product-btn-in .shop-product-button').appendTo('.shop-product .product-price-wr');
1025	
1026	});
1027
1028	resizeController(980, function() {
1029			$('.shop-product .product-btn-in .shop-product-button').appendTo('.shop-product .product-price-wr');
1030	}, function() {
1031			$('.shop-product .product-price-wr .shop-product-button').prependTo('.shop-product .product-btn-in');
1032			
1033	});
1034
1035
1036	resizeController(479, function() {
1037			$('.shop-product-item').each(function(){
1038				$(this).find('.product-label').prependTo($(this));
1039			});
1040	}, function() {
1041			$('.shop-product-item').each(function(){
1042				$(this).find('.product-label').appendTo($(this).find('.product-image'));
1043			});			
1044	});
1045
1046
1047	// resizeController(700, function() {
1048	// 	$('.main-slider-in .edit-block-wr').prependTo('.site-sidebar.left');	
1049		
1050
1051	// }, function() {
1052	// 	$('.site-sidebar.left .edit-block-wr').prependTo('.main-slider-in');
1053		
1054	// });
1055	
1056
1057	$('.main-slider .owl-carousel').owlCarousel({
1058		loop:true,
1059		items:1,
1060		margin:0,
1061		nav:true,
1062		autoplay:true,
1063		autoplayHoverPause:true
1064	});
1065	
1066	$('.main-slider').css({height: 'auto', opacity: '1'});
1067
1068	resizeController(785, function() {
1069		$('.shop2-cart-product').each(function(){
1070				$(this).find('.cart-product-info-in').appendTo($(this).find('.cart-product-right'));
1071		});
1072		
1073	}, function() {
1074		$('.shop2-cart-product').each(function(){
1075			$(this).find('.cart-product-info-in').appendTo($(this).find('.cart-product-info-wr'));
1076		});
1077		
1078	});
1079
1080	$(window).on('resize', viewLots).trigger('resize');
1081
1082	$(window).on('resize', folderBlock).trigger('resize');
1083
1084	if($(window).width() <= 400){
1085
1086	 	$('.shop-product .product-price-wr .shop-product-button').prependTo('.shop-product .product-btn-in');	
1087
1088	 }else if($(window).width() > 400 && $(window).width() <= 980) {
1089
1090	 	$('.shop-product .product-btn-in .shop-product-button').appendTo('.shop-product .product-price-wr');
1091	
1092	 }
1093
1094	// настройки хайслайда на странице товара
1095
1096	(function() {
1097		if (shop2.mode!=="product") return;
1098			hs.align = 'center';
1099			hs.transitions = ['expand', 'crossfade'];
1100			hs.outlineType = 'rounded-white';
1101			hs.fadeInOut = true;
1102			hs.dimmingOpacity = 0.75; 
1103			hs.registerOverlay({
1104			 thumbnailId: null,
1105			 overlayId: 'controlbar',
1106			 position: 'bottom right',
1107			 hideOnMouseOut: true
1108		});
1109		hs.dimmingOpacity = 0.5;
1110		hs.align = 'center';
1111
1112		hs.addSlideshow({
1113			slideshowGroup: 'gr1',
1114			interval: 5000, //интервал слайд-шоу в мс
1115			repeat: false,
1116			useControls: true,
1117			fixedControls: true,
1118
1119			overlayOptions: {
1120				opacity: .6,
1121				position: 'bottom center'
1122			}
1123		});
1124
1125		// смена картинок
1126		var $thumbs = $('.product-thumbnails a'),
1127			$images = $('.product-image a');
1128			$imagesLi = $('.product-thumbnails li')
1129
1130		$thumbs.on(clickStart, function(e) {
1131			var ind = $thumbs.index(this);
1132			e.preventDefault();
1133			$images.hide().removeClass('active').eq(ind).show().addClass('active');
1134		});
1135
1136		$thumbs.on(clickStart, function(e) {
1137			var ind = $thumbs.index(this);
1138			e.preventDefault();
1139			$imagesLi.removeClass('active').eq(ind).addClass('active');
1140		});
1141		
1142	})();
1143
1144	$('.product-thumbnails').owlCarousel({
1145		loop:false,
1146		items:3,
1147		margin:12,
1148		nav:true,
1149		autoplay:true,
1150		autoplayHoverPause:true,
1151		responsive:{
1152			785:{
1153				margin:6
1154			}
1155		}
1156	});
1157
1158	//PRODUCT_TABS-------------------------------------------//
1159
1160	var $tabs = $('#product_tabs'),
1161		$win = $(window),
1162		$doc = $(document),
1163		isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
1164		click = clickStart,
1165		srchIsOpen = false;
1166
1167	$tabs.responsiveTabs({
1168		rotate: false,
1169		startCollapsed: 'accordion',
1170		collapsible: 'accordion',
1171		animation: 'slide',
1172		setHash: true,
1173		scrollToAccordion: true,
1174		scrollToAccordionOffset: 50
1175	});
1176
1177	resizeController(1200, function() {
1178		$('.shop-cart-registration').appendTo('#shop2-cart');
1179				
1180	}, function() {
1181		$('.shop-cart-registration').appendTo('.shop2-cart-wrapper');
1182	
1183	});
1184
1185	$('.left-categor-title').on(clickStart, function() {
1186
1187        if($('.left-categor-wrapper').hasClass('drop')) {
1188            $('.left-categor-wrapper').removeClass('drop');
1189            $('.overlay-bg').removeClass('active');
1190 			$('.left-categor-wrapper').css({"z-index":2});
1191            
1192
1193        } else {
1194        	$('.left-categor-wrapper').addClass('drop');
1195            $('.overlay-bg').addClass('active');
1196			$('.left-categor-wrapper').css({"z-index":101});
1197        }
1198
1199    });
1200
1201	folderBlock();
1202	
1203	function folderBlock() {
1204
1205		var widthFolder = $('.site-wrapper').width() - 40;
1206
1207		$('.left-categor-wrapper .left-folders').css('width', widthFolder);
1208	};
1209
1210
1211	$('.top-categor li').each(function(){
1212        var $this = $(this),
1213        $spanS1 = $('<span class="s1"></span>');
1214        
1215        if ($this.find('> ul').get(0)) {
1216            $this.append($spanS1);
1217        }	
1218    });
1219
1220    $('.top-categor').on('click', '.s1', function() {
1221		var $this = $(this);
1222		var $li = $this.closest('li');
1223		var $ul = $li.find('>ul');
1224		
1225		if ($li.hasClass('opened')) {
1226			$ul.stop().slideUp(400, function(){
1227
1228				$li.removeClass('opened');
1229			});
1230		} else {
1231			$ul.stop().slideDown(400, function(){
1232		
1233				$li.addClass('opened');
1234			});
1235			$li.siblings().filter(':has(">ul")').each(function(){
1236				var $this = $(this);
1237				$this.find('>ul').stop().slideUp(400, function(){
1238	
1239					$this.removeClass('opened');
1240				});
1241			});
1242		}
1243	});
1244
1245	//---Main-tabs
1246	(function(){
1247		$('.main-block-tab-wr li:first, .main-tabs:first').addClass('active');
1248		$('.main-block-tab-wr li').on(clickStart, function(e) {
1249			e.preventDefault();
1250
1251			if($(this).hasClass('active')) return;
1252
1253			$(this).addClass('active').siblings('li').removeClass('active');
1254			$('.main-tabs[data-tab-index="' + $(this).data('tab-index') + '"]').addClass('active').siblings('.main-tabs').removeClass('active');
1255		});
1256	})();
1257
1258	//---Main-blocks-slider
1259    $('.owl-slider-tab .product-list-in.product-list-thumbs').owlCarousel ({
1260        margin: 1,
1261        loop: false,
1262        autoplay: 0,
1263        nav: true,
1264        dots: true,
1265        margin: 18,
1266        responsive: {
1267          0: {
1268            items: 1
1269          },
1270          420: {
1271            items: 2
1272          },
1273          600: {
1274            items: 3
1275          },
1276          785: {
1277            items: 4
1278          },
1279          1024: {
1280            items: 5
1281          }
1282        }
1283    });
1284    
1285    $(window).load(function() {
1286		$('.main-tabs').each(function(){
1287	    	var heights = [],
1288	    		maxHeight,
1289	    		myPaddingTop,
1290				slideCount = $(this).find('.owl-item').length;
1291				
1292			if (slideCount <= 4) {
1293				$(this).find('.owl-controls').hide();
1294			}
1295		    $(this).find('.owl-item .shop-product-item').each(function(){
1296		        heights.push($(this).height());
1297		    });
1298		    maxHeight = Math.max.apply(null, heights);
1299		    
1300		    $(this).find('.owl-item .shop-product-item').each(function(){
1301			    myPaddingTop = (maxHeight - $(this).height() + 15);
1302	
1303				$(this).find('.product-price').css('paddingTop', myPaddingTop);
1304		    });
1305		});
1306    })
1307
1308    	$(document).on(clickStart, function(event) {
1309
1310		if ($(event.target).closest('.block-user .block-title, .block-user .block-body, .search-online-store .block-title, .search-online-store .block-body, .left-categor-wrapper .left-nav, .buy-one-click, .buy-one-click-form-in, .left-categor-wrapper .left-categor-title, .left-folders').length) return;
1311
1312		$('.search-online-store .block-body').fadeOut()
1313		$('.block-user .block-body').fadeOut();
1314		
1315		
1316		$('.search-online-store .block-title').removeClass('active');
1317		$('.search-panel .right-side').removeClass('mobile');
1318		
1319
1320		$('.left-categor-wrapper').removeClass('drop')
1321		$('.left-categor-wrapper .left-categor-title').removeClass('active');
1322		
1323		$('.buy-one-click-form-wr').removeClass('active')
1324		
1325		$('.shop2-product-discount-desc').hide()
1326	
1327		if (/iPod|iPad|iPhone/i.test(navigator.userAgent)) {
1328			$('html, body').removeClass('overflowHidden');
1329			
1330		} else {
1331			$(document.documentElement).removeClass('overflowHidden');
1332		}
1333
1334		if ($(event.target).closest('.left-categor-wrapper').length) return;
1335		$('.overlay-bg').removeClass('active');
1336	});
1337	
1338	//Buy-one-click
1339	
1340	(function(){
1341		if(!$('.buy-one-click').length) return;
1342		
1343		var $form = $('.buy-one-click-form-wr'),
1344			$closeFormBtn = $('.buy-one-click-form-in .close-btn');
1345		
1346		$('.buy-one-click > a').on(clickStart, function(e){
1347			e.preventDefault();
1348			var productLink = (shop2.mode!=="product") ? (document.location.origin)+$(this).closest('.shop2-item-product').find('.product-name > a').attr('href') : (document.location.href),
1349				productName = (shop2.mode!=="product") ? $(this).closest('.shop2-item-product').find('.product-name > a').html() + (' Количество:' + $(this).closest('.shop2-item-product').find('.shop-product-amount input[type="text"]').val()) : $(this).closest('.site-container').find('h1').html() + (' Количество:' + $(this).closest('.product-side-r').find('.shop-product-amount input[type="text"]').val());
1350			
1351			$form.addClass('active');
1352			setTimeout(function() {
1353				$form.find('input.productName').val(productName);
1354				$form.find('input.productLink').val(productLink);
1355			}, 800);
1356			
1357			if (isApple) {
1358				$('html, body').addClass('overflowHidden');
1359			} else {
1360				$(document.documentElement).addClass('overflowHidden');
1361			}
1362		});
1363		
1364		$closeFormBtn.on(clickStart, function(e){
1365			e.preventDefault();
1366			
1367			$form.removeClass('active');
1368			
1369			if (isApple) {
1370				$('html, boremove').removeClass('overflowHidden');
1371			} else {
1372				$(document.documentElement).removeClass('overflowHidden');
1373			}
1374		});
1375	})();
1376	
1377	$(this).keydown(function(eventObject){
1378        if (eventObject.which == 27){
1379	        $('.buy-one-click-form-wr').removeClass('active');
1380	        $('.block-user .block-body').fadeOut();
1381	        $('.overlay-bg').removeClass('active');
1382        }
1383        if (/iPod|iPad|iPhone/i.test(navigator.userAgent)) {
1384            $('html, body').removeClass('overflowHidden');
1385        } else {
1386            $(document.documentElement).removeClass('overflowHidden');
1387        }
1388    });
1389
1390	function resizeController() {
1391		var $win = $(window),
1392			winWidth = $win.width(),
1393			range = [],
1394			func = [],
1395			toggleState = [undefined, undefined];
1396
1397		if (!!arguments.length) {
1398			for (var i = 0; i <= arguments.length-1; i++) {
1399				
1400				if ($.isArray(arguments[i])) {
1401					range = arguments[i];
1402				} else if ($.isNumeric(arguments[i])) {
1403					range.push(arguments[i]);
1404				} else if ($.isFunction(arguments[i])) {
1405					func.push(arguments[i]);
1406				} 
1407			};
1408		}
1409
1410		$win.resize(function(event) {
1411			winWidth = $win.width();
1412			
1413			if (range.length > 1) {
1414				if (winWidth >= range[0] && winWidth <= range[range.length-1] && typeof toggleState[0] === "undefined") {
1415					func[0]();
1416					toggleState[0] = true;
1417					toggleState[1] = undefined;												
1418				} else if ((winWidth < range[0] || winWidth > range[range.length-1]) && typeof toggleState[1] === "undefined") {						
1419					toggleState[0] = undefined;
1420					toggleState[1] = true;
1421
1422					if ($.isFunction(func[1])) {
1423						func[1]();
1424					}
1425				}
1426			} else if (range.length == 1) {
1427				if (winWidth <= range[0] && typeof toggleState[0] === "undefined") {
1428					func[0]();
1429					toggleState[0] = true;
1430					toggleState[1] = undefined;
1431				} else if (winWidth > range[0] && typeof toggleState[1] === "undefined") {
1432					toggleState[0] = undefined;
1433					toggleState[1] = true;
1434
1435					if ($.isFunction(func[1])) {
1436						func[1]();
1437					}
1438				}
1439			}
1440		}).trigger('resize');
1441	};
1442
1443});
1444})(jQuery);
1445// end /g/templates/shop2/2.33.2/js/main.js
1446
1447
1448$(document).ready(function(){
1449	$('a.tab').on('click', function(e){
1450		e.preventDefault();
1451		var tabActiveClass = 'tab--active';
1452		if($(this).hasClass(tabActiveClass)) return;
1453		$('.'+tabActiveClass).removeClass(tabActiveClass);
1454		$(this).addClass(tabActiveClass);
1455		var hash = $(this).attr('href');
1456		var activeClass = 'tab__content--active';
1457		$('.'+activeClass).removeClass(activeClass);
1458		$(hash).addClass(activeClass);
1459	});
1460});
1461
1462var $contactMap = $('#contact-map');
1463if($contactMap.length){
1464	ymaps.ready(init);
1465    function init(){ 
1466        // Создание карты.    
1467        var myMap = new ymaps.Map("contact-map", {
1468            // Координаты центра карты.
1469            // Порядок по умолчанию: «широта, долгота».
1470            // Чтобы не определять координаты центра карты вручную,
1471            // воспользуйтесь инструментом Определение координат.
1472            center: [56.314229, 43.895144],
1473            // Уровень масштабирования. Допустимые значения:
1474            // от 0 (весь мир) до 19.
1475            zoom: 16
1476        });
1477        var MyIconContentLayout = ymaps.templateLayoutFactory.createClass(
1478            '<div style="color: #000000; font-weight: bold;">$[properties.iconContent]</div>'
1479        );
1480        var myPlacemarkWithContent = new ymaps.Placemark([56.314229, 43.895144], {
1481            //hintContent: 'Собственный значок метки с контентом',
1482            balloonContent: 'Московское шоссе, дом 108'
1483        }, {
1484        	
1485            // Опции.
1486            // Необходимо указать данный тип макета.
1487            iconLayout: 'default#imageWithContent',
1488            // Своё изображение иконки метки.
1489            iconImageHref: '/t/images/pin.png',
1490            // Размеры метки.
1491            iconImageSize: [48, 48],
1492            // Смещение левого верхнего угла иконки относительно
1493            // её "ножки" (точки привязки).
1494            iconImageOffset: [-24, -24],
1495            // Смещение слоя с содержимым относительно слоя с картинкой.
1496            iconContentOffset: [15, 15],
1497            // Макет содержимого.
1498            iconContentLayout: MyIconContentLayout
1499        });
1500        myMap.geoObjects.add(myPlacemarkWithContent);
1501        myMap.behaviors.disable('scrollZoom');
1502    }	
1503}
1504
1505document
1506.querySelectorAll('form[action="/shop"]')
1507.forEach(function(form){
1508	var buyOneClickStorage = window.localStorage.getItem('buy-one-click');
1509	var nameField = form.querySelector('input[name="d[3]"]');
1510	var phoneField = form.querySelector('input[name="d[4]"]');
1511	if(buyOneClickStorage){
1512		buyOneClickStorage = JSON.parse(buyOneClickStorage);
1513		nameField.value = buyOneClickStorage.name;
1514		phoneField.value = buyOneClickStorage.phone;
1515	}
1516	form.addEventListener('submit', function(e){
1517		window.localStorage.setItem('buy-one-click', JSON.stringify({
1518			name: nameField.value,
1519			phone: phoneField.value
1520		}));
1521	});
1522});
1523
1524if(document.getElementById('map-contacts'))
1525ymaps.ready(function () {
1526    var myMap = new ymaps.Map('map-contacts', {
1527            center: [56.314212, 43.895062],
1528            zoom: 16
1529        }), 
1530
1531        myPlacemark = new ymaps.Placemark(myMap.getCenter(), {
1532            hintContent: 'Фирменный салон Нижний Новгород',
1533            balloonContent: '<div style="line-height:1.5em;font-size:16px"><div style="display:flex;align-items:flex-start;margin-bottom:15px"><div style="width:15px;height:15px;background:#00adef;border-radius:100%;margin-right:10px;position:relative;top:4px"></div><span><b>Фирменный салон Нижний Новгород</b></span></div><div style="display:flex;align-items:flex-start;margin-bottom:15px"><img src="/t/images/i-pin.svg" style="height:15px;margin-right:10px;position:relative;top:4px"><span>г.Нижний Новгород, Московское шоссе, д.108</span></div><div style="display:flex;align-items:flex-start;margin-bottom:15px"><img src="/t/images/i-phone.svg" style="height:15px;margin-right:10px;position:relative;top:4px"><span>8 (831) 2-300-777;<br>8 (953) 55-77-997;<br>8 (903) 043-11-83</span></div><div style="display:flex;align-items:flex-start"><img src="/t/images/i-clock.svg" style="height:15px;margin-right:10px;position:relative;top:4px"><span>Пн-Пт 10:00-18:00;<br>Сб 9:00-15:00;<br>Вс выходной</span></div></div>'
1534        }, {
1535            iconLayout: 'default#image',
1536            iconImageHref: '/t/images/map-pin.png',
1537            iconImageSize: [46, 64],
1538            iconImageOffset: [-24, -67]
1539        });
1540        
1541    myMap.behaviors.disable('scrollZoom');
1542
1543    myMap.geoObjects
1544        .add(myPlacemark);
1545});
1546
1547$('.product-image:not(.product-image--thumbs)').magnificPopup({
1548	delegate: 'a',
1549	type: 'image',
1550	mainClass: 'mfp-img-mobile',
1551	gallery: {
1552		enabled: true,
1553		navigateByImgClick: true,
1554		preload: [0,1]
1555	}
1556});
1557
1558$.extend(true, $.magnificPopup.defaults, {
1559  tClose: 'Закрыть (Esc)',
1560  tLoading: 'Загрузка...',
1561  gallery: {
1562    tPrev: 'Назад',
1563    tNext: 'Вперед',
1564    tCounter: '%curr% / %total%'
1565  },
1566  image: {
1567    tError: 'Ошибка загрузки <a href="%url%">изображения</a>.'
1568  },
1569  ajax: {
1570    tError: '<a href="%url%">The content</a> could not be loaded.'
1571  }
1572});
1573
1574$(document).ready(function(){
1575	
1576	shop2.options.msgTime = 120000;
1577	window._s3Lang['JS_SHOP2_ADD_CART_WITH_LINK'] = "<a href='%s'>Перейти в корзину</a>";
1578	
1579	$('body').click(function(){
1580	    var $msgCart = $('#shop2-msg');
1581	
1582	    if($msgCart.length) {
1583	        $msgCart.hide();
1584	    }
1585	}).on('click', '#shop2-msg', function(e){
1586	    e.stopPropagation();
1587	});
1588});
1589
1590function getNoun(number, one, two, five) {
1591    var n = Math.abs(number);
1592    n %= 100;
1593
1594    if (n >= 5 && n <= 20) {
1595        return five;
1596    }
1597
1598    n %= 10;
1599
1600    if (n === 1) {
1601        return one;
1602    }
1603
1604    if (n >= 2 && n <= 4) {
1605        return two;
1606    }
1607
1608    return five;
1609}
1610
1611$(document).ready(function(){
1612
1613function removeItem(kind_id, func) {
1614    kind_id = kind_id.toString().replace(/\"/g, '\\"').replace(/\'/g, '"');
1615    kind_id = $.parseJSON(kind_id);
1616
1617    shop2.trigger('beforeCartRemoveItem');
1618
1619    $.getJSON(
1620      '/-/shop2-api/?cmd=cartRemoveItem', {
1621        hash: shop2.apiHash.cartRemoveItem,
1622        ver_id: shop2.verId,
1623        kind_id: kind_id
1624      },
1625      function(d, status) {
1626        shop2.fire('afterCartRemoveItem', func, d, status);
1627      }
1628    );
1629
1630    return false;
1631}
1632
1633function makeCartElement(d) {
1634    var amount = d.data.totals.amount;
1635    var total = d.data.totals.total;
1636
1637    return {data:'<div id="shop2-cart-preview"><div class="shop2-block cart-preview opened"><a href="/shop/cart"><div class="block-body"><div class="cart-sum">'+total+' <span>руб.</span></div><div class="cart-col">'+amount+' <span>товаров</span></div></div></a></div></div>'};
1638}
1639
1640function updateCart(d){
1641    $('#shop2-cart-preview').replaceWith(d.data);
1642
1643    if (d.errstr) {
1644        $('#shop2-cart-preview').addClass('class_name');
1645        setTimeout(function() {
1646            $('#shop2-cart-preview').removeClass('class_name');
1647        }, 1500);
1648    }
1649
1650    if (d.panel) {
1651        $('#shop2-panel').replaceWith(d.panel);
1652    }
1653}
1654
1655function cartCallback(callback){
1656    var matches, cart;
1657
1658    $.ajax({
1659        url: '/shop/cart',
1660        success: function(data) {
1661            matches = data.match(/\(cart\)([\w\d\W]+?)\(\/cart\)/);
1662
1663            if (matches && matches[1]) {
1664                cart = JSON.parse(matches[1]);
1665            } else {
1666                cart = {};
1667            }
1668
1669            callback(cart);            
1670        }
1671    });
1672}
1673
1674
1675
1676function updateCartElement(cart) {
1677    var cartKeys = Object.keys(cart),
1678        amount = 0,
1679        total = 0,
1680        dataCart = {data: ''},
1681        pluralNoun = '';
1682
1683    cartKeys.forEach(function(kindId) {
1684        amount += cart[kindId].amount;
1685        total += cart[kindId].sum;
1686    });
1687
1688    if (amount === 0) {
1689        dataCart.data = '<div id="shop2-cart-preview"><div class="shop2-block cart-preview opened"><a href="/shop/cart"><div class="block-body"><div class="cart-sum emp">Корзина пуста</div></div></a></div></div>';
1690    } else {
1691        pluralNoun = getNoun(amount, 'товар', 'товара', 'товаров');
1692        dataCart.data = '<div id="shop2-cart-preview"><div class="shop2-block cart-preview opened"><a href="/shop/cart"><div class="block-body"><div class="cart-sum"><b class="cart-change-total">'+total+'</b> <span>руб.</span></div><div class="cart-col"><span class="cart-change-amount">'+amount+'</span> <span class="cart-change-noun">'+pluralNoun+'</span></div></div></a></div></div>';
1693    }
1694
1695    updateCart(dataCart);
1696}
1697
1698cartCallback(updateCartElement);
1699
1700if ($('.jq-checkbox.collection-add').length) {
1701    $('.jq-checkbox.collection-add').click(function(){
1702        var kindId = $(this).data('kind'),
1703            $self = $(this),
1704            otherCheckbox;
1705    
1706            if (kindId) {
1707            otherCheckbox = $('.jq-checkbox.collection-add[data-kind="'+kindId+'"]').not(this);
1708            if (otherCheckbox.length) {
1709                setTimeout(function(){
1710                    if ($self.hasClass('checked')) {
1711                        otherCheckbox.addClass('checked');
1712                        otherCheckbox.find('input').prop('checked', true);
1713                    } else {
1714                        otherCheckbox.removeClass('checked');
1715                        otherCheckbox.find('input').prop('checked', false);
1716                    }
1717                }, 1000);
1718                
1719            }
1720        }
1721    });
1722
1723    cartCallback(function(cart) {
1724        Object.keys(cart).forEach(function(kindId) {
1725            var $checkbox = $('.jq-checkbox.collection-add[data-kind="'+kindId+'"]');
1726
1727            if (!$checkbox.hasClass('checked')) {
1728                $checkbox.click();
1729            }
1730        });
1731
1732        $('.jq-checkbox.collection-add').click(function(e){
1733            var kindId = $(this).data('kind');
1734        
1735            if ($(this).find('input').prop('checked')) {
1736                shop2.cart.add(kindId, 1, updateCart);
1737            } else {
1738                removeItem(kindId, function(d){
1739                    cartCallback(updateCartElement);
1740                });
1741            }
1742        });
1743    });
1744}
1745
1746});
1747
1748
1749$(document).ready(function(){
1750	$('a[href="#map-popup"]').magnificPopup({
1751		type: 'inline'
1752	})
1753});
1754
1755(function(){
1756    function updateOrderInfo($amountInput) {
1757        var itemId = $amountInput.data('kind'),
1758            $rowTotal = $amountInput.parents('.shop2-cart-product').find('.change-price-row'),
1759            $topTotal = $('#top-total-sum');
1760    
1761        shop2.cart.update($shopCartForm, function(response){
1762            if(!response || 
1763            !response.data || 
1764            !response.data.cart ||
1765            !response.data.cart[itemId]) {
1766                return;
1767            }
1768
1769            var $miniCart = $('#shop2-cart-preview');
1770            var $miniCartTotal = $miniCart.find('.cart-change-total');
1771            var $miniCartAmount = $miniCart.find('.cart-change-amount');
1772            var $miniCartNoun = $miniCart.find('.cart-change-noun');
1773    
1774            var changedItem = response.data.cart[itemId];
1775            var itemSum = changedItem.sum;
1776    
1777            var changedTotals = response.data.totals;
1778            var totalAmount = changedTotals.amount; 
1779            var totalSum = changedTotals.total;
1780            var changedNoun = getNoun(totalAmount, 'товар', 'товара', 'товаров'); 
1781    
1782            $rowTotal.text(itemSum);
1783            $topTotal.text(totalSum);
1784            $miniCartTotal.text(totalSum);
1785            $miniCartAmount.text(totalAmount);
1786            $miniCartNoun.text(changedNoun);
1787        });
1788    }
1789
1790    var $shopCartForm = $('#shop2-cart'),
1791        timeout = 0;
1792
1793    $shopCartForm
1794        .find('.amount-plus, .amount-minus')
1795        .click(function(){
1796            var self = this;
1797
1798            clearTimeout(timeout);
1799            
1800            timeout = setTimeout(function(){
1801                var $input = $(self).parent().find('input');
1802
1803                updateOrderInfo($input);
1804            }, 500);
1805        });
1806    
1807    $shopCartForm
1808        .find('input[name^="amounts"]')
1809        .on('change', function(){
1810            var $input = $(this);
1811
1812            updateOrderInfo($input);
1813        });
1814})();
1815
1816$('.cart-delete a[title="Удалить"]').click(function(){
1817	document.location.reload();
1818});
1819
1820$('.wizard-step').click(function(e){
1821  var active = 'wizard-step--active';
1822  var index = $(this).index();
1823  var disabledBtn = 'wizard-btn--disabled';
1824  e.preventDefault();
1825  
1826  if ($(this).hasClass(active)) {
1827    return false;
1828  }
1829  
1830  $('.'+active).removeClass(active);
1831  $(this).addClass(active);
1832  
1833  $('.wizard-body').slideUp();
1834  $('.wizard-body').eq(index).slideDown();
1835  
1836  if ($(this).is(':last-child')) {
1837    $('.wizard-prev').removeClass(disabledBtn);
1838    $('.wizard-next').addClass(disabledBtn);
1839  } else {
1840    $('.wizard-prev').addClass(disabledBtn);
1841    $('.wizard-next').removeClass(disabledBtn);
1842  }
1843  
1844  $([document.documentElement, document.body]).animate({
1845        scrollTop: $('.wizard-step-line').offset().top - 100
1846  }, 1000);
1847});
1848
1849$('.wizard-nav').click(function(e){
1850  var $activeTab = $('.wizard-step--active');
1851  var disabled = 'wizard-btn--disabled';
1852  e.preventDefault();
1853  
1854  if ($(this).hasClass('wizard-next')) {
1855    var $tab = $activeTab.next();
1856    
1857    $tab.click();
1858    
1859    if ($tab.is(':last-child')) {
1860      $('.'+disabled).removeClass(disabled);
1861      $(this).addClass(disabled);
1862    }
1863  } else {
1864    var $tab = $activeTab.prev();
1865    
1866    $tab.click();
1867    
1868    if ($tab.is(':first-child')) {
1869      $('.'+disabled).removeClass(disabled);
1870      $(this).addClass(disabled);
1871    }
1872  }
1873});

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.