PageSourceSearch

https://7tour-phuket.ru/t/v4224/images/js/main_local.js

js 7tour-phuket.ru collected 2026-10-07 18:21:49 UTC 57,090 bytes, 1,891 lines download raw bytes

1shop2.queue.addToCart = function() {
2
3	$(document).on('click', '.shop_product_button', function(e) {
4
5		var $this = $(this),
6			$form = $this.closest('form'),
7			form = $form.get(0),
8			adds = $form.find('.additional-cart-params'),
9			len = adds.length,
10			i, el,
11			a4 = form.amount.value,
12			kind_id = form.kind_id.value;
13
14		e.preventDefault();
15
16		if (len) {
17			a4 = {
18				amount: a4
19			};
20
21			for (i = 0; i < len; i += 1) {
22				el = adds[i];
23				if (el.value) {
24					a4[el.name] = el.value;
25				}
26			}
27		}
28
29		shop2.cart.add(kind_id, a4, function(d) {
30
31			$('#shop2-cart-preview').replaceWith(d.data);
32
33			if (d.errstr) {
34				shop2.msg(d.errstr, $this);
35				$('#shop2-cart-preview').addClass('class_name');
36				setTimeout(function() {
37					$('#shop2-cart-preview').removeClass('class_name');
38				}, 1500);
39			} else {
40				shop2.msg(window._s3Lang.JS_ADDED, $this);
41			}
42
43			if (d.panel) {
44				$('#shop2-panel').replaceWith(d.panel);
45			}
46		});
47
48	});
49},
50shop2.filter.sort = function(name, elem) {
51    var re = new RegExp(this.escape('s[sort_by]') + '=([^&]*)'),
52        params = this.str.match(re),
53        desc = name + ' desc',
54        asc = name + ' asc',
55        isDesc = (elem.is('.sort-param-desc'));
56
57
58    params = (params && params.length > 1) ? params[1] : '';
59    
60    params = (isDesc) ? desc : asc;
61
62    this.remove('s[sort_by]');
63    this.add('s[sort_by]', params);
64    return this;
65},
66shop2.queue.sort = function() {
67    var wrap = $('.sorting');
68
69    wrap.find('.sort-param').on('click', function(e) {
70        var $this = $(this),
71            name = $this.data('name');
72
73        e.preventDefault();
74        shop2.filter.sort(name, $this);
75        shop2.filter.go();
76    });
77
78    wrap.find('.sort-reset').on('click', function(e) {
79        e.preventDefault();
80        shop2.filter.remove('s[sort_by]');
81        shop2.filter.go();
82    });
83},
84shop2.queue.cart = function() {
85
86    var updateBtn = $('.shop2-cart-update'),
87        cartTable = $('.shop_cart_wrapper'),
88        form = $('#shop2-cart');
89
90    shop2.on('afterCartRemoveItem, afterCartUpdate', function() {
91        document.location.reload();
92    });
93
94    function updateBtnShow() {
95        updateBtn.show();
96    }
97
98    cartTable.find('input:text').on('keypress', function(e) {
99        if (e.keyCode == 13) {
100            shop2.cart.update(form);
101        } else {
102            updateBtnShow();
103        }
104    });
105
106    cartTable.find('.amount-minus, .amount-plus').on('click', updateBtnShow);
107
108    updateBtn.on('click', function(e) {
109        e.preventDefault();
110        shop2.cart.update(form);
111        return false;
112    });
113
114
115    $('.cart-delete a').on('click', function(e) {
116        var $this = $(this),
117            id = $this.data('id');
118
119        e.preventDefault();
120
121        shop2.cart.remove(id);
122
123    });
124
125},
126shop2.queue.product = function() {
127
128	shop2.product._reload = function(node) {
129
130		var $node = $(node);
131		var kinds = shop2.product.getNodeData(node, 'kinds', true);
132		var paramName = shop2.product.getNodeData(node, 'name');
133		var paramValue = shop2.product.getNodeData(node, 'value');
134		var $form = $node.closest('form');
135		var form = $form.get(0);
136		var meta;
137		var kind_id;
138		var product_id;
139		var keys = {};
140
141		if (kinds && $.type(paramName) !== 'undefined' && $.type(paramValue) !== 'undefined' && form) {
142
143			meta = $form.find('input[name=meta]').val();
144
145			product_id = $form.find('input[name=product_id]').val();
146
147			$form.find('[name=submit]').prop('disabled', true);
148
149			$form.find('select.shop2-cf>option, li.shop2-cf, li.shop2-color-ext-selected, ul.shop2-color-ext-list>li').each(function() {
150				var name = $(this).data('name');
151				if (name) {
152					keys[name] = true;
153				}
154			});
155
156			kind_id = shop2.product.findKindId(product_id, kinds, paramName, paramValue, meta, keys);
157
158			if (shop2.mode == 'product') {
159
160				if (shop2.uri) {
161					document.location = shop2.uri + '/product/' + kind_id;
162				} else {
163					document.location = document.location.href.replace(/\/product\/.+/, '/product/' + kind_id);
164				}
165
166			} else {
167
168				shop2.product.getProductListItem(product_id, kind_id, function(d, status) {
169					var cont, newCont, body;
170					if (status === 'success') {
171
172						cont = $node.closest('.shop2-product-item');
173						cont.hide();
174
175						body = $.trim(d.data.body);
176						newCont = $(body).insertBefore(cont);
177
178						cont.remove();
179
180						shop2.queue.heights();
181
182						$('.product_list_in select').styler();
183						
184							var $optionsBlock = $('.prod_list_wrap .shop2_product_item');
185
186							$optionsBlock.each(function(){
187								var $optionsClone = $(this).find('.product_all_params').clone().addClass('cloned'),
188									$compareClone = $(this).find('.product-compare').clone().addClass('cloned'),
189									$priceBlock = $(this).find('.product-price');
190			
191								if (!$priceBlock.find('.price-old ').length) {
192									$priceBlock.addClass('no_old');
193								}
194								
195								if (!$(this).find('.product_all_params.cloned').length>0) {
196									$(this).find('.product_top_in')
197										.append($optionsClone);
198								}
199								
200								if (!$(this).find('.product-compare.cloned').length>0) {
201									if (!$(this).find('.product-compare-added').length>0) {
202										var compareLength = $(this).find('.product-compare').length;
203										if (compareLength < 2) {
204											$(this).find('.prod_bot_top')
205												.append($compareClone);
206										}
207									}
208								}
209							});
210						
211						$('.shop_cart_product, .shop2-product-item, .shop2-product').each(function(index) {
212					        var $this = $(this),
213					            $amountInput = $this.find('.shop2-product-amount input[type="text"]'),
214					            amountInputValue = $amountInput.val(),
215					            amountMax = $this.find('.shop2-product-amount input[type="text"]').attr('data-max'),
216								amountMaxNum = +amountMax,
217								amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(),
218								amountInputNum = +amountInput2;
219								
220							$this.find('.shop2-product-amount input').on('change', function(e) {
221					        	amInputVal = +$(this).val();
222					        	amNumber = 1;
223					        	
224					        	if (amInputVal < 1) {
225					        		$(this).val(amNumber);
226					        	}
227					        });
228					
229					        function amounMinus() {
230					            if (amountInputValue >= 2) {
231					                $this.find('.shop2-product-amount button.amount-minus').removeAttr('disabled');
232					            } else {
233					                $this.find('.shop2-product-amount button.amount-minus').attr('disabled', 'disabled');
234					            }
235					        }
236					        amounMinus();
237					        
238					        if (amountInputNum >= amountMaxNum) {
239								$this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled');
240							} else {
241								$this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled');
242							}
243					        
244					        $this.find('.shop2-product-amount button').on('click', function(e) {
245					            setTimeout(function() {
246					                amountInputValue = $amountInput.val();
247					
248					                amounMinus();
249					            }, 100);
250					            setTimeout(function() {
251						            var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(),
252										amountInputNum = +amountInput2;
253									if (amountInputNum == amountMaxNum) {
254										$this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled');
255									} else {
256										$this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled');
257									}
258					            }, 100);
259					        });
260					        $this.find('.shop2-product-amount input').on('keyup', function(e) {
261					            setTimeout(function() {
262					                amountInputValue = $amountInput.val();
263					
264					                amounMinus();
265					                
266					                var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(),
267										amountInputNum = +amountInput2;
268										
269									if (amountInputNum >= amountMaxNum) {
270										$this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled');
271									} else {
272										$this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled');
273									}
274					            }, 100);
275					        });
276					    });
277					}
278
279				});
280
281			}
282		}
283
284	};
285
286	$.on('select.shop2-cf', {
287		change: function() {
288			shop2.product._reload(this);
289		}
290	});
291
292	$.on('li.shop2-cf:not(.active-color, .active-texture)', {
293		click: function() {
294			shop2.product._reload(this);
295		}
296	});
297
298},
299shop2.queue.filter = function() {
300
301    var wrap = $('.shop2-filter'),
302        result = $('.result');
303
304    shop2.filter.init();
305
306    shop2.on('afterGetSearchMatches', function (d, status) {
307
308        if (d.data.total_found === 0) {
309
310            result.addClass('no-result');
311        } else {
312            result.removeClass('no-result');
313        }
314
315        $('#filter-result').html(d.data.total_found);
316
317        result.removeClass('hide');
318    });
319
320    wrap.find('.param-val').on('click', function(e) {
321        var $this = $(this),
322            name = $this.data('name'),
323            value = $this.data('value');
324
325        e.preventDefault();
326
327        $this.toggleClass('active-val');
328        shop2.filter.toggle(name, value);
329        shop2.filter.count();
330    });
331
332    wrap.find('select').on('change', function() {
333        var $this = $(this),
334            name = this.name,
335            value = $this.val();
336
337        shop2.filter.add(name, value);
338        shop2.filter.count();
339    });
340
341    wrap.find('input:text').keyup(function() {
342        var $this = $(this),
343            name = $this.attr('name');
344
345        $.s3throttle('filter: ' + name, function() {
346            var value = $this.val();
347
348            shop2.filter.add(name, value);
349            shop2.filter.count();
350        }, 500);
351    });
352    wrap.find('.input_range_slider').on('slide', function(e){
353        var $this = $(this),
354            $parent = $this.closest('.range_slider_wrapper'),
355            $input = $parent.find('input:text');
356            
357        $.each($input, function(i, elem) {
358            var name = $(elem).attr('name');
359
360            $.s3throttle('filter: ' + name, function() {
361                var value = $(elem).val();
362        
363                shop2.filter.add(name, value);
364                shop2.filter.count();
365            }, 500);
366        });
367    });
368
369    wrap.find('.shop2-filter-go').on('click', function(e) {
370        e.preventDefault();
371        shop2.filter.go();
372    });
373},
374
375$(function() {
376
377	var $win = $(window),
378		$doc = $(document),
379		$html = $(document.documentElement),
380		isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
381		isApple = /iPod|iPad|iPhone/i.test(navigator.userAgent),
382		clickStart = (isMobile) ? 'touchend.respons' : 'click.respons';
383		if (document.location.search.indexOf('mobile') != -1) {isMobile = true};
384
385	$('table').wrap('<div class="table-wrapper"></div>');
386	
387	shop2.on('afterCartAddItem', function() {
388		$('.header_inner').addClass('showed');
389	});
390
391	// Top slider block
392	function scrollArrow() {
393		var scrollHeight = $win.height();
394		$('.scroll_arrow_wr').on('click', function(){
395			$('html, body').animate({
396        		scrollTop: scrollHeight
397        	}, 800);
398		});
399	};
400	scrollArrow();
401
402	var topPadding = 100;
403
404	function topPad(){
405		if ($win.width() <= 1580) {
406			topPadding = 60;
407		}
408	}
409	topPad();
410
411	$win.resize(function() {
412		topPad();
413	});
414
415	function sliderHeight(){
416		var winHeight = $win.height(),
417			headerHeight = $('.site_header').outerHeight(),
418			slHeight = winHeight - headerHeight;
419		
420		$('.top_slider_wrap .sl_item_in').css('height',slHeight - topPadding);
421		$('.top_slider_wrapper .bx-viewport').css('height',slHeight - topPadding);
422		$('.top_slider_wrapper').css('height',slHeight - topPadding);
423	};
424	
425	//sliderHeight();
426
427	$win.on('resize', function(){
428		//sliderHeight();
429	});
430
431	/*if ($('.top_slider_wrap .sl_item').length>1) {
432		var slider = $('.top_slider_wrap').bxSlider({
433	        mode: 'fade',
434	        speed: 1000,
435	  		pause: 3000,
436	        auto: false,
437	        controls: true,
438	        pagerCustom: '.pager_wrap',
439	        onSlideBefore: function(){
440	        	sliderHeight();
441	        },
442	        nextSelector: '.next_arrow',
443	        prevSelector: '.prev_arrow',
444	        autoControls: true,
445	        pager: true,
446	        autoHover: true,
447	        useCSS: false,
448	        preloadImages: 'all',
449	        onSlideAfter: function(){
450	            if(this.auto){
451	                //slider.startAuto();
452	            }
453	        }
454	    });
455	}*/
456	if ($('.top_slider_wrap .sl_item').length > 1) {
457    var slider = $('.top_slider_wrap').bxSlider({
458        mode: 'fade',
459        speed: 1000,
460        pause: 3000,
461        auto: true, // Enable autoplay
462        controls: true,
463        pagerCustom: '.pager_wrap',
464        /*onSlideBefore: function() {
465            sliderHeight();
466        },*/
467        nextSelector: '.next_arrow',
468        prevSelector: '.prev_arrow',
469        autoControls: false,
470        pager: true,
471        autoHover: true,
472        useCSS: false,
473        preloadImages: 'all',
474        onSlideAfter: function() {
475            if (this.auto) {
476                //slider.startAuto();
477            }
478        }
479    });
480}
481
482	setTimeout(function(){
483		if ($('.prod_form_wr').length) {
484			var imgOffsetTop = $('.prod_form_wr').offset().top;
485
486			$('.top_slider_wrapper.product .sl_button').on('click', function(){
487				$('html, body').animate({
488		        	scrollTop: imgOffsetTop
489		        }, 800);
490			})
491		}
492	}, 300);
493
494	var revFlag = 1;
495
496	if ($('.rev_bl_slider .rev_bl_item').length<=3) {
497		revFlag = 0;
498	}
499
500	if($('.rev_bl_slider .rev_bl_item').length>1) {
501		$('.rev_bl_slider').owlCarousel({
502	        loop: false,
503	        margin: 30,
504	        dots: revFlag,
505	        mouseDrag: revFlag,
506	        autoplay:false,
507	        autoHeight : false,
508	        responsive: {
509	        	0: {
510	        		nav: false,
511	        		margin: 0,
512	        		items: 1
513	        	},
514	        	768: {
515	        		nav: true,
516	        		margin: 22,
517	        		items: 2
518	        	},
519	        	1024: {
520	        		nav: true,
521	        		margin: 30,
522	        		items: 3
523	        	}
524	        }
525	    });
526    }
527	// Top slider end
528
529	// Header fix begin
530	var headroomTop  = new Headroom(document.querySelector(".site_header_wr"), {
531        offset : 40,
532        tolerance : {
533            up : 0,
534            down : 0
535        },
536        classes : {
537            initial : "headroom",
538            pinned : "showed",
539            unpinned : "hidden",
540            top : "on_top",
541            notTop : "not_top"
542        },
543        onPin : function() {},
544        onUnpin : function() {},
545        onTop : function() {},
546        onNotTop : function() {},
547    });
548    headroomTop.init();
549    
550    var headroomTop4  = new Headroom(document.querySelector(".site_header"), {
551        offset : 40,
552        tolerance : {
553            up : 0,
554            down : 0
555        },
556        classes : {
557            initial : "headroom",
558            pinned : "showed",
559            unpinned : "hidden",
560            top : "on_top",
561            notTop : "not_top"
562        },
563        onPin : function() {},
564        onUnpin : function() {},
565        onTop : function() {},
566        onNotTop : function() {},
567    });
568    headroomTop4.init();
569
570    var headroomTop2  = new Headroom(document.querySelector(".header_inner"), {
571        offset : 40,
572        tolerance : {
573            up : 0,
574            down : 0
575        },
576        classes : {
577            initial : "headroom",
578            pinned : "showed",
579            unpinned : "hidden",
580            top : "on_top",
581            notTop : "not_top"
582        },
583        onPin : function() {},
584        onUnpin : function() {},
585        onTop : function() {},
586        onNotTop : function() {},
587    });
588    headroomTop2.init();
589    
590    var headroomTop3  = new Headroom(document.querySelector(".link_top_wrap"), {
591        offset : 0,
592        tolerance : {
593            up : 0,
594            down : 0
595        },
596        classes : {
597            initial : "headroom",
598            pinned : "showed",
599            unpinned : "hidden",
600            top : "on_top",
601            notTop : "not_top",
602            bottom : "bottom",
603            notBottom : "not_bottom"
604        },
605        onPin : function() {},
606        onUnpin : function() {},
607        onTop : function() {},
608        onNotTop : function() {},
609        onBottom : function() {},
610	    onNotBottom : function() {}
611    });
612    headroomTop3.init();
613    
614    $('.link_top_button').on('click', function(){
615    	$('html, body').animate({
616    		scrollTop: 0
617    	}, 800);
618    });
619	// Header fix end
620
621	function scrollWidth(){
622	    var div = $('<div>').css({
623	        position: "absolute",
624	        top: "0px",
625	        left: "0px",
626	        width: "100px",
627	        height: "100px",
628	        visibility: "hidden",
629	        overflow: "scroll"
630	    });
631	    
632	    $('body').eq(0).append(div);
633	    
634	    var width = div.get(0).offsetWidth - div.get(0).clientWidth;
635	    
636	    div.remove();
637
638	    var searchHeight = $('.search_bl2_wrap').height(),
639	    	windowHeight = $(window).height();
640	    		    
641	    $('html').css('padding-right', width);
642	    if (searchHeight <= windowHeight) {
643	    	$('.search_bl2_top').css('margin-right', width);
644	    };
645	    return width;
646	};
647	
648	function scrollWidth2(overflowClass){
649	    var div = $('<div>').css({
650	        position: "absolute",
651	        top: "0px",
652	        left: "0px",
653	        width: "100px",
654	        height: "100px",
655	        visibility: "hidden",
656	        overflow: "scroll"
657	    });
658	    
659	    $('body').eq(0).append(div);
660	    
661	    var width = div.get(0).offsetWidth - div.get(0).clientWidth;
662	    
663	    div.remove();
664	    
665	    $('html').css('padding-right', width).addClass(overflowClass);
666	    $('.site_header .site_header_wr.headroom').css('margin-right', width);
667	    $('.cat_bl_wrapper').css('padding-right', width);
668	    
669	    return width;
670	};
671
672	// Menu block begin
673	$('.menu_bl_button').on('click', function(){
674		$('.menu_top_wrapper').addClass('opened');
675		$('.fixed_bg').addClass('active');
676		$('.mobile_fixed_wrapper').addClass('opened');
677		if ($(window).width()<1024) {
678			$('html').addClass('overflowHidden');
679		};
680	});
681
682	$('.mobile_close').on('click', function(){
683		$('.mobile_fixed_wrapper').removeClass('opened');
684		$('html').removeClass('overflowHidden');
685		$('.fixed_bg').removeClass('active');
686	})
687
688	resizeController([0, 1023], function() {
689    	$('.menu_top').flexMenu({undo: true});
690    });
691
692    resizeController([1024, Infinity], function() {
693    	$('.menu_top').flexMenu({
694			linkText:'Еще'
695		});
696    });
697
698	$('.menu_bl2_button').on('click', function(){
699		$('.menu_top_wrapper').removeClass('opened');
700		$('.fixed_bg').removeClass('active');
701		$('.cat_bl_wrapper').removeClass('opened');
702		$('html').removeClass('overflowHidden').css('padding-right', 0);
703		$('.site_header .site_header_wr.headroom').css('margin-right', 0);
704	});
705	
706	var $folderSpan = $('li.dontsplit');
707	
708	$folderSpan.each(function(){
709		$(this).find('>a').prepend('<span class="open_ul"></span>');
710	});
711
712	var $reg = $('.reg_bl_title').first(),
713		$menuTop = $('.menu_top').first(),
714		menuTop = $menuTop.clone().addClass('mobile'),
715		menuBot = $('.bot_menu').clone().addClass('mobile'),
716		regTitle = $reg.clone().addClass('mobile'),
717		catBlock = $('.cat_bl_wrapper').clone().addClass('mobile');
718
719	$('.mobile_fixed_wrapper').prepend(catBlock);
720	$('.mobile_fixed_wrapper').prepend(regTitle);
721	$('.reg_bl_title.mobile').wrap('<div class="reg_title_mobile"></div>');
722	$('.mobile_fixed_wrapper .mobile_fixed_in').append(menuTop);
723	$('.mobile_fixed_wrapper .mobile_fixed_in').append(menuBot);
724
725	if (isMobile) {
726		if ($win.width() > 1023) {
727			$('.menu_top_wrap .menu_top').s3MenuAllIn({
728			    type: 'dropdown',
729			    activateTimeout: 250,
730			    showTime: 0,
731			    hideTime: 0,
732			    showFn: $.fn.fadeIn,
733			    hideFn: $.fn.fadeOut
734			});
735
736			$('.menu_top_wrap .menu_top li a').on('click', function() {
737			    if ($(this).hasClass('s3-menu-allin-open')) {
738			        document.location.href = $(this).attr('href');
739			    };
740			});
741
742			$(document).on('click touchstart', function(menuDesktop){
743			    if( $(menuDesktop.target).closest('.menu_top_wrap .menu_top').length || $(menuDesktop.target).closest('.menu_top_wrap .menu_top ul').length || $(menuDesktop.target).closest('.flexMenu-viewMore').length)
744			      return;
745			  	$('.flexMenu-viewMore').removeClass('active');
746			    $('.menu_top_wrap .menu_top li a').removeClass('s3-menu-allin-open');
747			    $('.menu_top_wrap .menu_top ul').removeAttr('style');
748			});
749		}
750	} else {
751		$('.menu_top_wrap .menu_top').s3MenuAllIn({
752		    type: 'bottom',
753		    debug: false,
754		    activateTimeout: 0,
755		    showTime: 250,
756		    hideTime: 250,
757		    showFn: $.fn.fadeIn,
758		    hideFn: $.fn.fadeOut
759		});
760	}
761
762	// Menu block end
763
764	// Categories block begin
765
766	resizeController([0, 1023], function() {
767		$('.folders_block').uncolumnize();
768		setTimeout(function(){
769			$('.folders_block').columnize({
770				columns: 2,
771				lastNeverTallest: true
772			});
773		}, 100);
774		$('.cat_bl_wrapper').removeClass('opened');
775		$('html').removeClass('overflowHidden');
776	});
777
778	resizeController([0, 499], function() {
779		$(".folders_block li").each(function(index, el) {
780			$(el).closest("li").find("> a > .open_ul").on("click", function(event) {
781				$(this).closest("li").toggleClass("opened_level").find('> ul').slideToggle(150);
782				return false;
783			});
784		});
785	});
786
787	resizeController([1024, Infinity], function() {
788		$('.folders_block').uncolumnize();
789		setTimeout(function(){
790			$('.folders_block').columnize({
791				columns: 3,
792				lastNeverTallest: false
793			});
794		}, 100);
795	});
796
797	$('.folder_bl_title').on('click', function(){
798		$('.cat_bl_wrapper').addClass('opened');
799		//$('html').addClass('overflowHidden');
800		scrollWidth2('overflowHidden');
801	});
802
803	$('.cat_close').on('click', function(){
804		$('.cat_bl_wrapper').removeClass('opened');
805		$('html').removeClass('overflowHidden');
806	});
807	// Categories block end
808
809	// Search block begin
810	$('.search_bl_button').on('click', function(){
811		$('.search_bl_wrapper').addClass('opened');
812		$('.fixed_bg').addClass('active');
813	});
814	
815	$(document).on('click', '.search_bl2_wrapper .shop2-block.search-form .row .shop2-color-ext-select', function(){
816		$('#shop2-color-ext-select').css('margin-top', 53);	
817	});
818	
819	$(document).on('click', function(event){
820	    if( $(event.target).closest('#shop2-color-ext-select').length ) 
821	      return;
822	    $('#shop2-color-ext-select').removeAttr('style');
823	});
824
825	$('.search_close').on('click', function(){
826		$('.search_bl_wrapper').removeClass('opened');
827		$('.fixed_bg').removeClass('active');
828		$('body').removeClass('overflowHidden');
829        $('.search_bl2_wrapper').removeClass('apple');
830	});
831
832	$('.w_search_title').on('click', function(){
833		$('.search_bl2_wrapper').addClass('opened');
834		$('html').addClass('overflowHidden');
835		if (isApple) {
836			$('body').addClass('overflowHidden');
837            $('.search_bl2_wrapper').addClass('apple');
838        };
839		scrollWidth();
840	});
841
842	$('.search_bl2_close').on('click', function(){
843		$('.search_bl2_wrapper').removeClass('opened');
844		$('.search_bl_wrapper').removeClass('opened');
845		$('.fixed_bg').removeClass('active');
846		$('html').css('padding-right', 0);
847		$('html').removeClass('overflowHidden');
848		if (isApple) {
849			$('body').removeClass('overflowHidden');
850            $('.search_bl2_wrapper').removeClass('apple');
851        };
852	});
853
854	$('.search_bl2_back').on('click', function(){
855		$('.search_bl2_wrapper').removeClass('opened');
856		$('html').removeClass('overflowHidden');
857		if (isApple) {
858			$('body').removeClass('overflowHidden');
859			$('.search_bl2_wrapper').removeClass('apple');
860		};
861		//$('.fixed_bg').removeClass('active');
862		$('html').css('padding-right', 0);
863		$('.search_bl2_top').css('margin-right', 0);
864	});
865        
866	$(document).on('click', '.search_bl2_wrapper .row-title', function(){
867		$(this).toggleClass('active').next('.row_body').slideToggle(150);
868	});
869
870	$('.shop2-block.search-form select').styler({
871		selectPlaceholder: 'Все'
872	});
873	$('.shop2-block.search-form input[type="checkbox"]').styler();
874	
875	$.ajaxSetup({complete: function(){
876			$('.shop2-block.search-form .block-body .row select').styler({
877				selectPlaceholder: 'Все'
878			});
879			$('.shop2-block.search-form .block-body .row input[type="checkbox"]').styler();
880			$('.shop2-delivery select').trigger('refresh');
881		    $('.shop2-delivery input[type="radio"]').styler();
882		    $('.shop2-delivery input[type="checkbox"]').styler();
883		    
884		    $('.shop2-edost input[type="radio"]').styler('destroy');
885			$('.shop2-edost-variant > label').on('click', function(){
886				if ($('.shop2-edost-variant > label > .shop2-edost-control input[type="radio"]:checked')) {
887					$('.shop2-edost-variant > label > .shop2-edost-control').removeClass('active');
888					$('.shop2-edost-variant > label > .shop2-edost-control input[type="radio"]:checked').parent().addClass('active');
889				}
890				
891				if ($('.shop2-edost-office > label > .shop2-edost-control input[type="radio"]:checked')) {
892					$('.shop2-edost-office > label > .shop2-edost-control').removeClass('active');
893					$('.shop2-edost-office > label > .shop2-edost-control input[type="radio"]:checked').parent().addClass('active');
894				}
895			});
896			
897			$('.shop2-edost-office > label').on('click', function(){
898		
899				if ($('.shop2-edost-office > label > .shop2-edost-control input[type="radio"]:checked')) {
900					$('.shop2-edost-office > label > .shop2-edost-control').removeClass('active');
901					$('.shop2-edost-office > label > .shop2-edost-control input[type="radio"]:checked').parent().addClass('active');
902				}
903			});
904		}
905	});
906	// Search block end
907
908	// Registration block begin
909	$('.reg_bl_title').on('click', function(){
910		$('.reg_bl_wrapper').addClass('opened');
911		$('html').addClass('overflowHidden');
912	});
913	
914	$(document).on('click', '.shop2-cart-auth__expand.js-shop2-cart-auth__expand', function(){
915		$('.reg_bl_wrapper').addClass('opened');
916		$('html').addClass('overflowHidden');
917	});
918
919	$('.reg_top_back').on('click', function(){
920		$('.reg_bl_wrapper').removeClass('opened');
921		$('html').removeClass('overflowHidden');
922	});
923
924	$('.reg_close').on('click', function(){
925		$('.reg_bl_wrapper').removeClass('opened');
926		$('html').removeClass('overflowHidden');
927		$('.fixed_bg').removeClass('active');
928		$('.menu_top_wrapper').removeClass('opened');
929		$('.mobile_fixed_wrapper').removeClass('opened');
930		$('.cat_bl_wrapper').removeClass('opened');
931	});
932	// Registration block end
933
934	// NoUislider begin
935    var inputRangeMax = parseInt($('.shop2-block.search-form input.small.big').data('max'));
936
937    $('.input_range_slider').each(function(index, el) {
938
939        var $this = $(this),
940            $lower = $this.closest('.range_slider_wrapper').find('.low'),
941            $upper = $this.closest('.range_slider_wrapper').find('.big'),
942            arr = [0,inputRangeMax];
943            
944        var slider = $this.noUiSlider({
945            start: [$lower.attr('value'), $upper.attr('value')],
946            connect: true,
947            behaviour: 'drag-tap',
948            format: wNumb({
949                decimals: 0
950            }),
951            range: {
952                'min': [ arr[0] ],
953                'max': [ arr[1] ]
954            }
955        });
956
957        slider.Link('lower').to($lower);
958        slider.Link('upper').to($upper);
959    });
960    // NoUislider end
961
962    // Bind image load begin
963    $.fn.bindImageLoad = function (callback) {
964      function isImageLoaded(img) {
965          if (!img.complete) {
966              return false;
967          }
968          if (typeof img.naturalWidth !== "undefined" && img.naturalWidth === 0) {
969              return false;
970          }
971          return true;
972      }
973
974      return this.each(function () {
975          var ele = $(this);
976          if (ele.is("img") && $.isFunction(callback)) {
977              ele.one("load", callback);
978              if (isImageLoaded(this)) {
979                  ele.trigger("load");
980              }
981          }
982      });
983    };
984	// Bind image load end
985
986    // Product block begin
987    function bindIng() {
988		var temp = 1;
989        $('.kind-image img').bindImageLoad(function(){
990            temp++;
991            
992            if($('.kind-image img').length) {
993                var heights = [],
994                    maxHeight;
995                    
996                $('.kind-image img').css('height', 'auto');
997
998                $('.kind-image img').each(function(){
999                    heights.push($(this).height());
1000                });
1001                maxHeight = Math.max.apply(null, heights);
1002                
1003                $('.kind-image img').each(function(){                        
1004                    $(this).css('height', maxHeight);
1005                    
1006                });
1007            }
1008            
1009        });
1010	}
1011
1012	setTimeout(function(){
1013		bindIng();
1014	}, 100);
1015
1016	$win.resize(function(event) {
1017		bindIng();
1018	});
1019	
1020	var $mainBlocks = $('.shop_main_block');
1021	
1022	$mainBlocks.each(function(){
1023		if ($(this).find('.prod_list_wrap').length) {
1024			$(this).addClass('main_prod_block');
1025		}
1026	});
1027
1028	$('.product_list_in .option_body select').styler();
1029	$('.shop2-product .option_body select').styler();
1030	
1031	$(document).on('click', '.shop2-color-ext-select', function(){
1032		$(this).toggleClass('opened');
1033	});
1034	
1035	$(document).on(clickStart, function(event){
1036	    if( $(event.target).closest('.shop2-color-ext-options').length ) 
1037	      return;
1038	    $('.shop2-color-ext-select').removeClass('opened');
1039	});
1040	
1041	if ($('.shop2-product .shop2-product-amount').hasClass('disabled')) {
1042		$('.shop2-product .shop2-product-amount').parents('.prod_form_price').addClass('disabled');
1043	}
1044	
1045	var $optionsBlock = $('.prod_list_wrap .shop2_product_item');
1046
1047	$optionsBlock.each(function(){
1048		var $optionsClone = $(this).find('.product_all_params').clone().addClass('cloned'),
1049			$compareClone = $(this).find('.product-compare').clone().addClass('cloned'),
1050			$priceBlock = $(this).find('.product-price');
1051			
1052		if (!$priceBlock.find('.price-old ').length) {
1053			$priceBlock.addClass('no_old');
1054		}
1055		
1056		if (!$(this).find('.product_all_params.cloned').length>0) {
1057			$(this).find('.product_top_in')
1058				.append($optionsClone);
1059		}
1060		
1061		if (!$(this).find('.product-compare.cloned').length>0) {
1062			$(this).find('.prod_bot_top')
1063				.append($compareClone);
1064		}
1065		
1066		var ratWidth = $(this).find('.tpl-rating').width();
1067		if (ratWidth==0) {
1068			$(this).find('.tpl-stars').hide();
1069		}
1070	});
1071
1072	var sliderFlag = 0;
1073
1074	if ($('.cart_product_slider .product-pic').length>2) {
1075		sliderFlag = 1;
1076	}
1077
1078	if ($('.cart_product_slider .product-pic').length>1){
1079	    $('.cart_product_slider').owlCarousel({
1080	        loop: sliderFlag,
1081	        margin: 0,
1082	        nav: true,
1083	        dots: true,
1084	        center: true,
1085	        mouseDrag: true,
1086	        autoplay:false,
1087	        autoHeight : false,
1088	        onInitialized: function(){
1089	    		if ($('.cart_product_slider .owl-dot').length <= 6) {
1090	    			$('.cart_product_slider .owl-dot').css('width', 30);
1091	    		} else if (($('.cart_product_slider .owl-dot').length > 6) <= 12) {
1092	    			$('.cart_product_slider .owl-dot').css('width', 10);
1093	    		} else if (($('.cart_product_slider .owl-dot').length > 12)) {
1094	    			$('.cart_product_slider .owl-dot').css('width', 4);
1095	    		}
1096	        },
1097	        responsive: {
1098	        	0: {
1099	        		center: false,
1100	        		items: 1
1101	        	}, 
1102	        	640: {
1103	        		center: true,
1104	        		items: 3
1105	        	}
1106	        }
1107	    });
1108	} else {
1109		$('.cart_product_slider').addClass('no_owl');
1110	}
1111
1112	$('.cart_product_slider').lightGallery({
1113		thumbnail: false,
1114	    download: true,
1115	    loop: false,
1116	    counter: false,
1117	    getCaptionFromTitleOrAlt: true,
1118		selector: '.product-pic a'
1119    });
1120
1121    if ($('.prod_form_actions .dt_wrap').length==1) {
1122    	$('.shop2-product-actions').addClass('center');
1123    }
1124    
1125    
1126    if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') {
1127    	var reviewsLang1 = 'Leave a review',
1128    		reviewsLang2 = 'Do not leave a review';
1129    } else {
1130    	var reviewsLang1 = 'Оставить отзыв',
1131    		reviewsLang2 = 'Не оставлять отзыв';
1132    }
1133    
1134
1135    $('.comments_button').on('click', function(){
1136		$('.comments_form_wr').slideToggle();
1137		$(this).toggleClass('active');
1138
1139		if ($(this).hasClass('active')){
1140			$(this).text(reviewsLang2);
1141		} else {
1142			$(this).text(reviewsLang1);
1143		}
1144    });
1145
1146    $('.comments_form_wr .tpl-form input[type="checkbox"]').styler();
1147
1148    var tplFlag = 0,
1149    	tplFlag2 = 1;
1150
1151    if ($win.width() > 1023 && $('.comments_wrapper .tpl_comment').length>3) {
1152    	tplFlag = 1;
1153    }
1154
1155    if ($win.width() > 1335 && $('.comments_wrapper .tpl_comment').length<4) {
1156    	tplFlag2 = 0;
1157    }
1158
1159    if (($win.width() > 768 < 1336) && $('.comments_wrapper .tpl_comment').length>2) {
1160		tplFlag = 1;
1161	}
1162
1163	if (($win.width() > 768 < 1336) && $('.comments_wrapper .tpl_comment').length<4) {
1164    	tplFlag2 = 0;
1165    }
1166
1167    if (($win.width() > 640 < 768) && $('.comments_wrapper .tpl_comment').length>2) {
1168		tplFlag = 1;
1169	}
1170
1171	if (($win.width() > 640 < 768) && $('.comments_wrapper .tpl_comment').length<3) {
1172    	tplFlag2 = 0;
1173    }
1174
1175    if ($('.comments_wrapper .tpl_comment').length>1){
1176	    $('.comments_wrapper').owlCarousel({
1177	        loop: false,
1178	        margin: 30,
1179	        nav: true,
1180	        dots: true,
1181	        items: 3,
1182	        mouseDrag: tplFlag2,
1183	        touchDrag: true,
1184	        autoplay:false,
1185	        autoHeight : false,
1186	        onInitialized: function(){
1187	    		if ($('.comments_wrapper .owl-dot').length <= 6) {
1188	    			$('.comments_wrapper .owl-dot').css('width', 30);
1189	    		} else if (($('.comments_wrapper .owl-dot').length > 6) <= 12) {
1190	    			$('.comments_wrapper .owl-dot').css('width', 10);
1191	    		} else if (($('.comments_wrapper .owl-dot').length > 12)) {
1192	    			$('.comments_wrapper .owl-dot').css('width', 4);
1193	    		}
1194	        },
1195	        responsive: {
1196	        	0: {
1197	        		margin: 0,
1198	        		items: 1
1199	        	},
1200	        	600: {
1201	        		margin: 20,
1202	        		items: 2
1203	        	},
1204	        	768: {
1205	        		margin: 20,
1206	        		items: 2
1207	        	},
1208	        	1024: {
1209	        		items: 3,
1210	        		margin: 30
1211	        	}
1212	        }
1213	    });
1214	}
1215
1216    var $kindClass = $('.shop-group-kinds');
1217
1218    $kindClass.each(function() {
1219    	var $this = $(this),
1220    		kindFlag = 0;
1221
1222    	if ($win.width() > 1365 && $(this).find('.shop-kind-item').length>4) {
1223    		kindFlag = 1;
1224    	}
1225
1226    	if (($win.width() > 768 < 1336) && $(this).find('.shop-kind-item').length>3) {
1227    		kindFlag = 1;
1228    	}
1229
1230    	if (($win.width() > 479 < 768) && $(this).find('.shop-kind-item').length>2) {
1231    		kindFlag = 1;
1232    	}
1233
1234    	if ($(this).find('.shop-kind-item').length>1) {
1235    		$(this).owlCarousel({
1236    			loop: false,
1237		        dots: kindFlag,
1238		        mouseDrag: kindFlag,
1239		        touchDrag: kindFlag,
1240		        autoplay:false,
1241		        autoHeight : false,
1242		        onInitialized: function(){
1243		        	if ($this.find('.owl-dot').length <= 6) {
1244		    			$this.find('.owl-dot').css('width', 30);
1245		    		} else if (($this.find('.owl-dot').length > 6) <= 12) {
1246		    			$this.find('.owl-dot').css('width', 10);
1247		    		} else if (($this.find('.owl-dot').length > 12)) {
1248		    			$this.find('.owl-dot').css('width', 4);
1249		    		}
1250		        },
1251		        responsive: {
1252		        	0: {
1253		        		margin: 0,
1254		        		items: 1,
1255		        		nav: false
1256		        	},
1257		        	480: {
1258		        		margin: 15,
1259		        		items: 2,
1260		        		nav: false
1261		        	},
1262		        	768: {
1263		        		margin: 15,
1264		        		items: 3,
1265		        		nav: kindFlag
1266		        	},
1267		        	1024: {
1268		        		margin: 0,
1269		        		items: 3,
1270		        		nav: kindFlag
1271		        	},
1272		        	1336: {
1273		        		margin: 0,
1274		        		items: 4,
1275		        		nav: kindFlag
1276		        	}
1277		        }
1278    		});
1279    	}
1280    });
1281
1282	function blocksMatchHeight(arr) {
1283		for (var i = 0; i< arr.length; i++) {
1284			$(arr[i]).matchHeight();
1285		}
1286	}
1287
1288	var allignBlocks = function(){
1289		blocksMatchHeight([
1290			'.tpl_comment .tpl_name',
1291			'.tpl_comment .tpl-body',
1292			'.shop-kind-item',
1293			'.rev_bl_item .bl_item_title',
1294			'.rev_bl_item .bl_item_text',
1295			'.shop-group-kinds .shop-kind-item .kind-name',
1296			'.kind-price'
1297		]);	
1298	}
1299	allignBlocks();
1300	
1301	window.addEventListener("orientationchange", function() {
1302		setTimeout(function(){
1303			allignBlocks();
1304		}, 500);
1305		bindIng();
1306	}, false);
1307    // Product block end
1308
1309    // Sorting block begin
1310    $('.sort_bl_title').on('click', function(){
1311    	if (!$(this).is(":animated")){
1312	    	$(this).toggleClass('opened');
1313	    }
1314    	if (!$('.sort_body').is(":animated")){
1315    		$('.sort_body').slideToggle(150);
1316    	}
1317    });
1318    
1319    $(document).on('click', function(srtEvent){
1320	    if($(srtEvent.target).closest('.shop_sorting_panel .sort_bl_title').length) 
1321	      return;
1322	    $('.shop_sorting_panel .sort_bl_title').removeClass('opened');
1323	    $('.sort_body').slideUp(150);
1324	});
1325    
1326    var ratingWidth = $('.shop2-product .product_form_top .tpl-rating-block .tpl-rating').width();
1327    if (ratingWidth==0) {
1328    	$('.shop2-product .product_form_top .tpl-rating-block .tpl-stars').hide();
1329    }
1330    // Sorting block end
1331
1332    // View block begin
1333    $('.view-shop-wrap').on('click', function(){
1334    	$('.view_close').addClass('active');
1335    	$(this).addClass('opened');
1336    });
1337
1338    $('.view_close').on('click', function(){
1339    	$(this).removeClass('active');
1340    	$('.view-shop-wrap').removeClass('opened');
1341    });
1342    
1343    $(document).on('click', function(viewEvent){
1344	    if($(viewEvent.target).closest('.view-shop2 .view-shop-wrap').length) 
1345	      return;
1346	    $('.view_close').removeClass('active');
1347	    $('.view-shop2 .view-shop-wrap').removeClass('opened');
1348	});
1349
1350    var $btnThumbs = $('.view-shop2 .thumbs'),
1351		$btnSimple = $('.view-shop2 .simple'),
1352		$btnPrice = $('.view-shop2 .pricelist'),
1353		$lotsWrap = $('.product_list_in');
1354
1355	function thumbsLots() {
1356		$btnThumbs.addClass('active-view');
1357		$btnSimple.removeClass('active-view');
1358		$btnPrice.removeClass('active-view');
1359		setTimeout(function(){
1360			$('.prod_list_wrap .product_list_in .product_top_wr').matchHeight();
1361		}, 150);
1362		if (shop2.mode=='main') {
1363			
1364		} else {
1365			$lotsWrap.addClass('product-list-thumbs');
1366			$lotsWrap.removeClass('product-list-simple');
1367			$lotsWrap.removeClass('product-list-price');
1368		}
1369
1370		setTimeout(function(){
1371			bindIng();
1372		}, 150);
1373		
1374	}
1375
1376	function simpleLots() {
1377		$btnSimple.addClass('active-view');
1378		$btnThumbs.removeClass('active-view');
1379		$btnPrice.removeClass('active-view');
1380		$('.prod_list_wrap .product_list_in.product-list-price .product_top_wr').removeAttr('style');
1381		if (shop2.mode=='main') {
1382			
1383		} else {
1384			$lotsWrap.addClass('product-list-simple');
1385			$lotsWrap.removeClass('product-list-thumbs');
1386			$lotsWrap.removeClass('product-list-price');
1387		}
1388
1389		setTimeout(function(){
1390			bindIng();
1391		}, 150);
1392	}
1393
1394	function priceLots() {
1395		$btnPrice.addClass('active-view');
1396		$btnThumbs.removeClass('active-view');
1397		$btnSimple.removeClass('active-view');
1398		$('.prod_list_wrap .product_list_in.product-list-price .product_top_wr').removeAttr('style');
1399		if (shop2.mode=='main') {
1400			
1401		} else {
1402			$lotsWrap.addClass('product-list-price');
1403			$lotsWrap.removeClass('product-list-thumbs');
1404			$lotsWrap.removeClass('product-list-simple');
1405		}
1406
1407		setTimeout(function(){
1408			bindIng();
1409		}, 150);
1410	}
1411
1412	$btnThumbs.on(clickStart, function(e) {
1413		e.preventDefault();
1414		thumbsLots();
1415		
1416		if ( typeof(Event) === 'function' ) {
1417		     window.dispatchEvent(new Event('resize'));
1418		   } else {
1419		     var evt = window.document.createEvent('UIEvents'); 
1420		     evt.initUIEvent('resize', true, false, window, 0); 
1421		     window.dispatchEvent(evt);
1422		   }
1423
1424		$('.view-shop-wrap').removeClass('opened');
1425		$('.view_close').removeClass('active');
1426		eraseCookie('simple');
1427		eraseCookie('price');
1428		createCookie('thumbs', 1, 1);
1429		return false;
1430		
1431	});
1432
1433	$btnSimple.on(clickStart, function(e) {
1434		e.preventDefault();
1435		simpleLots();
1436
1437		$('.view-shop-wrap').removeClass('opened');
1438		$('.view_close').removeClass('active');
1439		eraseCookie('price');
1440		eraseCookie('thumbs');
1441		createCookie('simple', 1, 1);
1442		return false;
1443	});
1444
1445	$btnPrice.on(clickStart, function(e) {
1446		e.preventDefault();
1447		priceLots();
1448
1449		$('.view-shop-wrap').removeClass('opened');
1450		$('.view_close').removeClass('active');
1451		eraseCookie('simple');
1452		eraseCookie('thumbs');
1453		createCookie('price', 1, 1);
1454		return false;
1455	});
1456
1457	function viewLots() {
1458		var	$mainBlock = $('.shop2-product-item').closest('.shop-main-block-wr').length;
1459			
1460		if (readCookie('thumbs') || $mainBlock == 1) {
1461			thumbsLots();
1462		} else if (readCookie('simple') && !$mainBlock == 1) {
1463			simpleLots();
1464		} else if (readCookie('price') && !$mainBlock == 1) {
1465			priceLots();
1466		}
1467	}
1468
1469	$(window).on('resize', viewLots).trigger('resize');
1470	$('.prod_list_wrap .product_list_in.product-list-thumbs .product_top_wr').matchHeight();
1471    // View block begin
1472
1473    // Filter block begin
1474    $(document).on('click', '.table-filter-param .param_title', function(){
1475		$(this).toggleClass('active').next('.param_body').slideToggle(150);
1476	});
1477	
1478	$('.shop2-filter-fields select').styler({
1479		selectPlaceholder: 'Все'
1480	});
1481
1482	$('.filter_title').on('click', function(){
1483		$('.filter_bl_wr').addClass('opened');
1484		$('html').addClass('overflowHidden');
1485	});
1486
1487	$('.filter_close').on('click', function(){
1488		$('.filter_bl_wr').removeClass('opened');
1489		$('html').removeClass('overflowHidden');
1490	})
1491
1492	setTimeout(function(){
1493		$(".shop2-color-ext-caption").click();
1494		var colorList = $('#shop2-color-ext-popup').clone().addClass('cloned_list');
1495		$('#shop2-color-ext-popup').remove();
1496		$('.shop2-color-ext-popup').append(colorList);
1497	}, 300);
1498    // Filter block end
1499
1500    // Amount-minus-disabled begin
1501    if( shop2.mode != "product" && shop2.mode != "cart" ){
1502		$('.shop_cart_product, .shop2-product-item, .shop2-product').each(function(index) {
1503	        var $this = $(this),
1504	            $amountInput = $this.find('.shop2-product-amount input[type="text"]'),
1505	            amountInputValue = $amountInput.val(),
1506	            amountMax = $this.find('.shop2-product-amount input[type="text"]').attr('data-max'),
1507				amountMaxNum = +amountMax,
1508				amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(),
1509				amountInputNum = +amountInput2;
1510				
1511			$this.find('.shop2-product-amount input').on('change', function(e) {
1512	        	amInputVal = +$(this).val();
1513	        	amNumber = 1;
1514	        	
1515	        	if (amInputVal < 1) {
1516	        		$(this).val(amNumber);
1517	        	}
1518	        });
1519	
1520	        function amounMinus() {
1521	            if (amountInputValue >= 2) {
1522	                $this.find('.shop2-product-amount button.amount-minus').removeAttr('disabled');
1523	            } else {
1524	                $this.find('.shop2-product-amount button.amount-minus').attr('disabled', 'disabled');
1525	            }
1526	        }
1527	        amounMinus();
1528	        
1529	        if (amountInputNum >= amountMaxNum) {
1530				$this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled');
1531			} else {
1532				$this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled');
1533			}
1534	        
1535	        $this.find('.shop2-product-amount button').on('click', function(e) {
1536	            setTimeout(function() {
1537	                amountInputValue = $amountInput.val();
1538	
1539	                amounMinus();
1540	            }, 100);
1541	            setTimeout(function() {
1542		            var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(),
1543						amountInputNum = +amountInput2;
1544					if (amountInputNum == amountMaxNum) {
1545						$this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled');
1546					} else {
1547						$this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled');
1548					}
1549	            }, 100);
1550	        });
1551	        $this.find('.shop2-product-amount input').on('keyup', function(e) {
1552	            setTimeout(function() {
1553	                amountInputValue = $amountInput.val();
1554	
1555	                amounMinus();
1556	                
1557	                var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(),
1558						amountInputNum = +amountInput2;
1559						
1560					if (amountInputNum >= amountMaxNum) {
1561						$this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled');
1562					} else {
1563						$this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled');
1564					}
1565	            }, 100);
1566	        });
1567	    });
1568    }
1569	// Amount-minus-disabled end
1570
1571	// Hide-params and details begin
1572	$(document).on('click', '.hide_params', function(){
1573		$(this).toggleClass('opened').next().slideToggle(250);
1574
1575		if ($(this).hasClass('opened')) {
1576			$(this).text(window._s3Lang['JS_HIDE_OPTIONS']);
1577		} else {
1578			$(this).text(window._s3Lang['JS_ALL_OPTIONS']);
1579		}
1580	});
1581
1582	$('.hide_cart_details').on('click', function(){
1583		$(this).toggleClass('opened').next().slideToggle(250);
1584
1585		if ($(this).hasClass('opened')) {
1586			$(this).text(window._s3Lang['JS_HIDE_OPTIONS']);
1587		} else {
1588			$(this).text(window._s3Lang['JS_ALL_OPTIONS']);
1589		}
1590	});
1591	// Hide-params and details end
1592	
1593	// Buy-one-click begin
1594	$('.tpl-anketa.type-select select').styler();
1595	$('.tpl-anketa input[type="checkbox"]').styler();
1596	$('.tpl-anketa input[type="radio"]').styler();
1597	
1598    (function(){
1599    if(!$('.buy-one-click-wr').length) return;
1600    
1601        var $form = $('.buy-one-click-form-wr'),
1602            $closeFormBtn = $('.buy-one-click-form-in .close-btn');
1603        
1604        $('.buy-one-click-wr > a').on(clickStart, function(e){
1605            e.preventDefault();
1606            var productLink = (shop2.mode!=="product") ? (document.location.origin)+$(this).closest('.shop2-product').find('.product-name > a').attr('href') : (document.location.href),
1607                productName = (shop2.mode!=="product") ? $(this).closest('.shop2-product').find('.product-name > a').html() + (' Количество:' + $(this).closest('.shop2-product').find('.shop2-product-amount input[type="text"]').val()) : $(this).closest('.site_container').find('h1').html() + (' Количество:' + $(this).closest('.prod_form_wr').find('.shop2-product-amount input[type="text"]').val());
1608            
1609            $form.addClass('active');
1610            setTimeout(function() {
1611                $form.find('input.productName').val(productName);
1612                $form.find('input.productLink').val(productLink);
1613            }, 800);
1614            
1615            if (isApple) {
1616                $('html, body').addClass('overflowHidden');
1617            } else {
1618                $(document.documentElement).addClass('overflowHidden');
1619            }
1620        });
1621        
1622        $closeFormBtn.on(clickStart, function(e){
1623            e.preventDefault();
1624            
1625            $form.removeClass('active');
1626            
1627            if (isApple) {
1628                $('html, body').removeClass('overflowHidden');
1629            } else {
1630                $(document.documentElement).removeClass('overflowHidden');
1631            }
1632        });
1633    })();
1634    
1635    $(document).on('click touchstart', function(buyOnclick){
1636	    if( $(buyOnclick.target).closest('.buy-one-click-form-in').length || $(buyOnclick.target).closest('.buy-one-click').length || $(buyOnclick.target).closest('.ui-datepicker').length || $(buyOnclick.target).closest('.ui-corner-all').length || !$(buyOnclick.target).closest('.upload-button').length) 
1637	      return;
1638	    $('.buy-one-click-form-wr').removeClass('active');
1639	    $('html, body').removeClass('overflowHidden');
1640	});
1641    // Buy-one-click end
1642
1643	// Cart form begin
1644    $('.popup_cart').on('click', function(){
1645    	$('.shop2_cart_reg_wr').addClass('opened');
1646    	$('html').addClass('cartOverflow');
1647    });
1648
1649    $('.cart_form_close').on('click', function(){
1650    	$('.shop2_cart_reg_wr').removeClass('opened');
1651    	$('html').removeClass('cartOverflow');
1652    });
1653
1654    $('.login_btn_wr span').on('click', function(){
1655    	$(this).addClass('active');
1656    	$('.reg_form_in').slideToggle();
1657    });
1658    // Cart form end
1659
1660    // Pagelist block begin
1661    var pageListPrev = $('.page_prev').clone().addClass('clone'),
1662    	pageListNext = $('.page_next').clone().addClass('clone');
1663
1664    $('.shop2-pagelist').prepend('<div class="pagelist_mobile"></div>');
1665    $('.pagelist_mobile').prepend(pageListNext);
1666    $('.pagelist_mobile').prepend(pageListPrev);
1667    // Pagelist block end
1668
1669    // Coupon block begin
1670    $('.coupon_popup').on('click', function(){
1671    	$('.shop2-coupon').addClass('opened');
1672    	$('html').addClass('cartOverflow');
1673    });
1674
1675    $('.coupon_close').on('click', function(){
1676    	$('.shop2-coupon').removeClass('opened');
1677    	$('html').removeClass('cartOverflow');
1678    });
1679    // Coupon block end
1680    
1681    // Shop compare panel begin
1682    var $panelCompare = $('.shop2-panel').clone();
1683    $('.shop2-panel').remove();
1684    $('.link_top_in').prepend($panelCompare);
1685    // Shop compare panel end
1686    
1687    //Cart order form begin
1688    $('#orderForm select').styler();
1689    $('#orderForm input[type="radio"]').styler();
1690    $('#orderForm input[type="checkbox"]').styler();
1691    $('.shop2-cart-order-form select').styler();
1692    $('.shop2-cart-order-form input[type="radio"]').styler();
1693    $('.shop2-cart-order-form input[type="checkbox"]').styler();
1694    $('.shop2-delivery select').styler({
1695    	onSelectClosed: function() {
1696	    	$('.shop2-delivery select').trigger('refresh');
1697	  	}
1698    });
1699    $('.shop2-delivery input[type="radio"]').styler();
1700    $('.shop2-delivery input[type="checkbox"]').styler();
1701    $(document).on('click', '.option-label', function(){
1702    	setTimeout(function(){
1703    		$('.shop2-cart-order-form select').trigger('refresh');
1704    		$('.shop2-delivery select').trigger('refresh');
1705    	}, 300);
1706    });
1707    //Cart order form end
1708    
1709    resizeController([1024, Infinity], function() {
1710		$('html').removeClass('overflowHidden');
1711		$('html').removeClass('cartOverflow');
1712	});
1713	
1714	$('.shop_main_block .product_list_in').removeClass('product-list-simple');
1715	$('.shop_main_block .product_list_in').removeClass('product-list-price');
1716	$('.shop_main_block .product_list_in').addClass('product-list-thumbs');
1717
1718    // Esc button begin
1719    $(document).on('keyup', function(keyUp){
1720	    if (keyUp.keyCode == 27) {
1721	        $('.shop2-coupon').removeClass('opened');
1722	        $('.buy-one-click-form-wr').removeClass('active');
1723    		$('html').removeClass('cartOverflow');
1724    		$('.shop2_cart_reg_wr').removeClass('opened');
1725    		$('html').removeClass('cartOverflow');
1726    		$('.mobile_fixed_wrapper').removeClass('opened');
1727			$('html').removeClass('overflowHidden');
1728			$('.fixed_bg').removeClass('active');
1729			$('.search_bl2_wrapper').removeClass('opened');
1730			$('.search_bl_wrapper').removeClass('opened');
1731			$('.fixed_bg').removeClass('active');
1732			$('.reg_bl_wrapper').removeClass('opened');
1733			$('.reg_bl_wrapper').removeClass('opened');
1734			$('.fixed_bg').removeClass('active');
1735			$('.menu_top_wrapper').removeClass('opened');
1736			$('.mobile_fixed_wrapper').removeClass('opened');
1737			$('.filter_bl_wr').removeClass('opened');
1738			$('html').removeClass('overflowHidden');
1739			$('.cat_bl_wrapper').removeClass('opened');
1740	        return false;
1741	    };
1742	});
1743	// Esc button end
1744	
1745	// Document click asd
1746	$(document).on('click', function(event){
1747	    if ( $(event.target).closest('.w_search_title, .search_bl_wrap_in, .search_bl_button, .search_bl2_back, .search_bl2_wrap, #shop2-color-ext-select, .menu_bl_button, .menu_top_wrap, .reg_bl_title, .reg_bl_wrapper, .search_bl2_back').length){}else {
1748			$('.search_bl_wrapper').removeClass('opened');
1749			$('.fixed_bg').removeClass('active');
1750			$('#shop2-color-ext-select').removeAttr('style');
1751        };
1752        
1753        if ( $(event.target).closest('.menu_bl_button, .menu_top_wrap, .reg_bl_title, .reg_bl_wrapper, .search_bl_button, .search_bl_wrapper, .w_search_title, .search_bl2_back').length){}else {
1754			$('.menu_top_wrapper').removeClass('opened');
1755			$('.fixed_bg').removeClass('active');
1756        };
1757	});
1758	// Document click
1759
1760    // Resize-controller begin
1761    function resizeController() {
1762		var $win = $(window),
1763			winWidth = $win.width(),
1764			range = [],
1765			func = [],
1766			toggleState = [undefined, undefined];
1767
1768		if (!!arguments.length) {
1769			for (var i = 0; i <= arguments.length-1; i++) {
1770				
1771				if ($.isArray(arguments[i])) {
1772					range = arguments[i];
1773				} else if ($.isNumeric(arguments[i])) {
1774					range.push(arguments[i]);
1775				} else if ($.isFunction(arguments[i])) {
1776					func.push(arguments[i]);
1777				} 
1778			};
1779		}
1780
1781		$win.resize(function(event) {
1782			winWidth = $win.width();
1783			
1784			if (range.length > 1) {
1785				if (winWidth >= range[0] && winWidth <= range[range.length-1] && typeof toggleState[0] === "undefined") {
1786					func[0]();
1787					toggleState[0] = true;
1788					toggleState[1] = undefined;												
1789				} else if ((winWidth < range[0] || winWidth > range[range.length-1]) && typeof toggleState[1] === "undefined") {						
1790					toggleState[0] = undefined;
1791					toggleState[1] = true;
1792
1793					if ($.isFunction(func[1])) {
1794						func[1]();
1795					}
1796				}
1797			} else if (range.length == 1) {
1798				if (winWidth <= range[0] && typeof toggleState[0] === "undefined") {
1799					func[0]();
1800					toggleState[0] = true;
1801					toggleState[1] = undefined;
1802				} else if (winWidth > range[0] && typeof toggleState[1] === "undefined") {
1803					toggleState[0] = undefined;
1804					toggleState[1] = true;
1805
1806					if ($.isFunction(func[1])) {
1807						func[1]();
1808					}
1809				}
1810			}
1811		}).trigger('resize');
1812	};
1813    // Resize-controller end
1814    
1815    
1816    setTimeout(function(){
1817		$('html').css('visibility','visible');
1818	}, 100);
1819});
1820
1821if( shop2.mode == "product" || shop2.mode == "cart" ){
1822	shop2.queue.amount = function() {
1823
1824		var $document = $(document);
1825	
1826		function validate(input) {
1827			var kind = input.data('kind'),
1828				max = input.data('max'),
1829				val = Number(input.val()),
1830				amount = 0,
1831				available;
1832	
1833			if (kind && max > 0) {
1834				$('input[data-kind=' + kind + ']').each(function() {
1835					amount += Number(this.value);
1836				});
1837	
1838				if (amount > max) {
1839					available = max - amount + val;
1840					input.val(available);
1841					shop2.msg(_s3Lang.JS_AVAILABLE_ONLY + ' ' + available, input);
1842				}
1843			}
1844		}
1845	
1846		$document.on('click', '.amount-minus', function() {
1847			var $this = $(this),
1848				text = $this.siblings('input:text'),
1849				value = text.getVal();
1850	
1851			if (value) {
1852				value = value[0];
1853			}
1854			value -= shop2.options.amountDefaultInc;
1855			value = value.toFixed(5) - 0;
1856	
1857			if (value < shop2.options.amountDefaultValue ) {
1858				value = 0;
1859			}
1860	
1861			text.val(value);
1862			text.trigger('keyup');
1863		});
1864	
1865		$document.on('click', '.amount-plus', function() {
1866	
1867			var $this = $(this),
1868				text = $this.siblings('input:text'),
1869				value = text.getVal();
1870	
1871			if (value) {
1872				value = value[0];
1873			}
1874	
1875			value += shop2.options.amountDefaultInc;
1876			value = value.toFixed(5) - 0;
1877	
1878			text.val(value);
1879			text.trigger('keyup');
1880		});
1881	
1882		$document.on('keyup', '.shop2-product-amount input:text', function() {
1883			var $this = $(this);
1884			validate($this);
1885		});
1886	
1887		$document.keyFilter('.shop2-product-amount input:text', {
1888			type: shop2.options.amountType
1889		});
1890	}
1891}

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.