PageSourceSearch

https://kealan.ru/bitrix/templates/aspro_mshop/js/main.js?177364273360206

js kealan.ru collected 2026-10-04 00:08:00 UTC 60,206 bytes, 1,848 lines download raw bytes

1var basketTimeoutSlide;
2var resizeEventTimer;
3
4var funcDefined = function(func){
5	try {
6		if (typeof func == 'function') {
7			return true;
8		} else {
9			return typeof window[func] === "function";
10		}
11	} catch (e) {
12		return false;
13	}
14}
15
16if(!funcDefined('setLocationSKU')){
17	function setLocationSKU(curLoc){
18		try {
19			history.pushState(null, null, curLoc);
20			return;
21		} catch(e) {}
22			location.hash = '#' + curLoc.substr(1)
23	}
24}
25
26if(!funcDefined('trimPrice')){
27	var trimPrice = function trimPrice(s){
28		s=s.split(" ").join("");
29		s=s.split(" ").join("");
30		return s;
31	}
32}
33
34if(!funcDefined('markProductRemoveBasket')){
35	var markProductRemoveBasket = function markProductRemoveBasket(id){
36		$('.in-cart[data-item='+id+']').hide();
37		$('.to-cart[data-item='+id+']').show();
38		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
39		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
40		$('.counter_block[data-item='+id+']').show();
41		$('.in-subscribe[data-item='+id+']').hide();
42		$('.to-subscribe[data-item='+id+']').show();
43		// $('.wish_item[data-item='+id+']').removeClass("added");
44		// $('.wish_item[data-item='+id+'] .value:not(.added)').show();
45		// $('.wish_item[data-item='+id+'] .value.added').hide();
46	}
47}
48
49if(!funcDefined('markProductAddBasket')){
50	var markProductAddBasket = function markProductAddBasket(id){
51		$('.to-cart[data-item='+id+']').hide();
52		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').hide();
53		$('.to-cart[data-item='+id+']').closest('.button_block').addClass('wide');
54		$('.in-cart[data-item='+id+']').show();
55		// $('.wish_item[data-item='+id+']').removeClass("added");
56		// $('.wish_item[data-item='+id+'] .value:not(.added)').show();
57		// $('.wish_item[data-item='+id+'] .value.added').hide();
58	}
59}
60
61if(!funcDefined('markProductDelay')){
62	var markProductDelay = function markProductDelay(id){
63		$('.in-cart[data-item='+id+']').hide();
64		$('.to-cart[data-item='+id+']').show();
65		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
66		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
67		// $('.wish_item[data-item='+id+']').addClass("added");
68		// $('.wish_item[data-item='+id+'] .value:not(.added)').hide();
69		// // $('.wish_item[data-item='+id+'] .value.added').show();
70		// $('.wish_item[data-item='+id+'] .value.added').css('display','inline-block');
71	}
72}
73
74if(!funcDefined('basketFly')){
75	var basketFly = function basketFly(action){
76		$.post( arMShopOptions['SITE_DIR']+"ajax/reload_basket_fly.php", "PARAMS="+$("#basket_form").find("input#fly_basket_params").val(), $.proxy(function( data ){
77			var small=$('.opener .basket_count').hasClass('small'),
78				basket_count=$(data).find('.basket_count').find('.items div').text();
79			$('#basket_line .basket_fly').html(data);
80			if(parseInt(basket_count)){
81				$('#basket_line .basket_fly').removeClass('basket_empty');
82			}else{
83				$('#basket_line .basket_fly').addClass('basket_empty');
84			}
85
86			if (action=='open') {
87				if(small){
88					$('.opener .basket_count').click();
89				}else{
90					$('.opener .basket_count').removeClass('small')
91					$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
92					$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
93				}
94			} else if (action=='wish') {
95				if(small){
96					$('.opener .wish_count').click();
97				}else{
98					$('.opener .wish_count').removeClass('small')
99					$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
100					$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
101				}
102			} else {
103				$('.opener .basket_count').click();
104			}
105
106		}));
107	}
108}
109
110
111
112if(!funcDefined('initSelects')){
113	function initSelects(target){
114		var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
115		if ( iOS ) return;
116		// SELECT STYLING
117		$(target).find('.wrapper select').ikSelect({
118			syntax: '<div class="ik_select_link"> \
119						<span class="ik_select_link_text"></span> \
120						<div class="trigger"></div> \
121					</div> \
122					<div class="ik_select_dropdown"> \
123						<div class="ik_select_list"> \
124						</div> \
125					</div>',
126			dynamicWidth: true,
127			ddMaxHeight: 112,
128			customClass: 'common_select',
129			//equalWidths: true,
130			onShow: function(inst){
131				inst.$dropdown.css('top', (parseFloat(inst.$dropdown.css('top'))-5)+'px');
132				if ( inst.$dropdown.outerWidth() < inst.$link.outerWidth() ){
133					inst.$dropdown.css('width', inst.$link.outerWidth());
134				}
135				if ( inst.$dropdown.outerWidth() > inst.$link.outerWidth() ){
136					inst.$dropdown.css('width', inst.$link.outerWidth());
137				}
138				var count=0,
139					client_height=0;
140				inst.$dropdown.css('left', inst.$link.offset().left);
141				$(inst.$listInnerUl).find('li').each(function(){
142					if(!$(this).hasClass('ik_select_option_disabled')){
143						++count;
144						client_height+=$(this).outerHeight();
145					}
146				})
147				if(client_height<112){
148					inst.$listInner.css('height', 'auto');
149				}else{
150					inst.$listInner.css('height', '112px');
151				}
152				inst.$link.addClass('opened');
153				inst.$listInner.addClass('scroller');
154			},
155			onHide: function(inst){
156				inst.$link.removeClass('opened');
157			}
158		});
159		// END OF SELECT STYLING
160
161		var timeout;
162		$(window).on('resize', function(){
163			clearTimeout(timeout);
164			timeout = setTimeout(function(){
165				//$('select:visible').ikSelect('redraw');
166				var inst='';
167				if(inst=$('.common_select-link.opened + select').ikSelect().data('plugin_ikSelect')){
168					inst.$dropdown.css('left', inst.$link.offset().left+'px');
169				}
170			}, 20);
171		});
172	}
173}
174
175if(!funcDefined('initHoverBlock')){
176	function initHoverBlock(target){
177		$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
178			$(this).addClass('hover');
179		})
180		$(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
181			$(this).removeClass('hover');
182		})
183	}
184}
184
185
186if(!funcDefined('setStatusButton')){
187	function setStatusButton(){
188		$.ajax({
189			url: arMShopOptions["SITE_DIR"]+'ajax/get_basket_count.php',
190			type: 'POST',
191			success: function(data){
192				if(data.ITEMS || data.DELAY_ITEMS || data.SUBSCRIBE_ITEMS) {
193					if(data.ITEMS){
194						for( var i in data.ITEMS ){
195							$('.to-cart[data-item='+data.ITEMS[i].PRODUCT_ID+']').hide();
196							$('.counter_block[data-item='+data.ITEMS[i].PRODUCT_ID+']').hide();
197							$('.in-cart[data-item='+data.ITEMS[i].PRODUCT_ID+']').show();
198							$('.in-cart[data-item='+data.ITEMS[i].PRODUCT_ID+']').closest('.button_block').addClass('wide');
199						}
200					}
201					// if(data.DELAY_ITEMS){
202					// 	for( var i in data.DELAY_ITEMS ){
203					// 		$('.wish_item.to[data-item='+data.DELAY_ITEMS[i].PRODUCT_ID+']').hide();
204					// 		$('.wish_item.in[data-item='+data.DELAY_ITEMS[i].PRODUCT_ID+']').show();
205					// 		if ($('.wish_item[data-item='+data.DELAY_ITEMS[i].PRODUCT_ID+']').find(".value.added").length) {
206					// 			$('.wish_item[data-item='+data.DELAY_ITEMS[i].PRODUCT_ID+']').addClass("added");
207					// 			$('.wish_item[data-item='+data.DELAY_ITEMS[i].PRODUCT_ID+']').find(".value").hide();
208					// 			$('.wish_item[data-item='+data.DELAY_ITEMS[i].PRODUCT_ID+']').find(".value.added").show();
209					// 		}
210					// 	}
211					// }
212					// if(data.SUBSCRIBE_ITEMS){
213					// 	for( var i in data.SUBSCRIBE_ITEMS ){
214					// 		$('.to-subscribe[data-item='+data.SUBSCRIBE_ITEMS[i].PRODUCT_ID+']').hide();
215					// 		$('.in-subscribe[data-item='+data.SUBSCRIBE_ITEMS[i].PRODUCT_ID+']').show();
216					// 	}
217					// }
218				}
219			}
220		});
221		$.ajax({
222			url: arMShopOptions["SITE_DIR"]+'ajax/get_compare_count.php',
223			type: 'POST',
224			success: function(data){
225				if(data.ITEMS) {
226					if(data.ITEMS){
227						for( var i in data.ITEMS ){
228							$('.compare_item.to[data-item='+data.ITEMS[i]+']').hide();
229							$('.compare_item.in[data-item='+data.ITEMS[i]+']').show();
230							if ($('.compare_item[data-item='+data.ITEMS[i]+']').find(".value.added").length){
231								$('.compare_item[data-item='+data.ITEMS[i]+']').find(".value").hide();
232								$('.compare_item[data-item='+data.ITEMS[i]+']').find(".value.added").show();
233							}
234						}
235					}
236				}
237			}
238		})
239	}
240}
241
242
243if(!funcDefined('onLoadjqm')){
244	var onLoadjqm = function(name, hash, requestData, selector){
245		hash.w.addClass('show').css({
246			'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
247			'top': $(document).scrollTop() + (($(window).height() > hash.w.outerHeight() ? ($(window).height() - hash.w.outerHeight()) / 2 : 10))   + 'px'
248		});
249		if(typeof(requestData) == 'undefined'){
250			requestData = '';
251		}
252		if(typeof(selector) == 'undefined'){
253			selector = false;
254		}
255		var width = $('.'+name+'_frame').width();
256		$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');
257
258		if(name=='order-popup-call') {
259		}
260		else if(name=='order-button') {
261			$(".order-button_frame").find("div[product_name]").find("input").val(hash.t.title).attr("readonly", "readonly").css({"overflow": "hidden", "text-overflow": "ellipsis"});
262		}
263		else if(name == "to-order" && selector){
264			$(".to-order_frame").find('[data-sid="PRODUCT_NAME"]').val($(selector).data('name')).attr("readonly", "readonly").css({"overflow": "hidden", "text-overflow": "ellipsis"});
265			$(".to-order_frame").find('[data-sid="PRODUCT_ID"]').val($(selector).attr('data-item'));
266		}
267		else if(name == "services" && selector) {
268			$(".services_frame").find('[data-sid="SERVICE"]').val($(selector).attr('data-title'));
269		}
270		else if(name == "resume" && selector) {
271			if($(selector).attr('data-jobs')){
272				$(".resume_frame").find('[data-sid="POST"]').attr("readonly", "readonly").val($(selector).attr('data-jobs'));
273			}
274		}
275		else if( name == 'one_click_buy') {
276			$('#one_click_buy_form_button').on("click", function() {
277				$("#one_click_buy_form").submit();  //otherwise don't works
278			});
279
280			$('#one_click_buy_form').submit( function() {
281				if($('.'+name+'_frame form input.error').length || $('.'+name+'_frame form textarea.error').length) {
282					return false
283				}
284				else{
285					$.ajax({
286						url: $(this).attr('action'),
287						data: $(this).serialize(),
288						type: 'POST',
289						dataType: 'json',
290						error: function(data) {
291							alert('Error connecting server');
292						},
293						success: function(data) {
294							if(data.result == 'Y'){
295								$('.one_click_buy_result').show();
296								$('.one_click_buy_result_success').show();
297								purchaseCounter(data.message, arMShopOptions["COUNTERS"]["TYPE"]["ONE_CLICK"]);
298							}
299							else{
300								$('.one_click_buy_result').show();
301								$('.one_click_buy_result_fail').show();
302								$('.one_click_buy_result_text').text(data.message);
303							}
304							$('.one_click_buy_modules_button', self).removeClass('disabled');
305							$('#one_click_buy_form').hide();
306							$('#one_click_buy_form_result').show();
307						}
308					});
309				}
310				return false;
311			});
312		}
313		else if( name == 'one_click_buy_basket') {
314			$('#one_click_buy_form_button').on("click", function() {
315				$("#one_click_buy_form").submit();  //otherwise don't works
316			});
317
318			$('#one_click_buy_form').on("submit", function(){
319				$.ajax({
320					url: $(this).attr('action'),
321					data: $(this).serialize(),
322					type: 'POST',
323					dataType: 'json',
324					error: function(data) {
325						window.console&&console.log(data);
326					},
327					success: function(data) {
328						if(data.result == 'Y') {
329							$('.one_click_buy_result').show();
330							$('.one_click_buy_result_success').show();
331							purchaseCounter(data.message, arMShopOptions["COUNTERS"]["TYPE"]["QUICK_ORDER"]);
332						}
333						else{
334							$('.one_click_buy_result').show();
335							$('.one_click_buy_result_fail').show();
336							$('.one_click_buy_result_text').text(data.message);
337						}
338						$('.one_click_buy_modules_button', self).removeClass('disabled');
339						$('#one_click_buy_form').hide();
340						$('#one_click_buy_form_result').show();
341					}
342				});
343				return false;
344			});
345		}
346
347		$('.'+name+'_frame').show();
348	}
349}
350
351if(!funcDefined('onHidejqm')){
352	var onHidejqm = function(name, hash){
353		if (hash.w.find('.one_click_buy_result_success').is(':visible') && name=="one_click_buy_basket") {
354			window.location.href = window.location.href;
355		}
356		hash.w.css('opacity', 0).hide();
357		hash.w.empty();
358		hash.o.remove();
359		hash.w.removeClass('show');
360	}
361}
362
363if(!funcDefined("oneClickBuy")) {
364	var oneClickBuy = function (elementID, iblockID, that) {
365		name = 'one_click_buy';
366		if(typeof(that) !== 'undefined'){
367			elementQuantity = $(that).attr('data-quantity');
368		}
369		$('body').find('.'+name+'_frame').remove();
370		$('body').append('<div class="'+name+'_frame popup"></div>');
371		$('.'+name+'_frame').jqm({trigger: '.'+name+'_frame.popup', onHide: function(hash) { onHidejqm(name,hash) }, toTop: false, onLoad: function( hash ){ onLoadjqm(name, hash ); }, ajax: arMShopOptions["SITE_DIR"]+'ajax/one_click_buy.php?ELEMENT_ID='+elementID+'&IBLOCK_ID='+iblockID+'&ELEMENT_QUANTITY='+elementQuantity});
372		$('.'+name+'_frame.popup').click();
373	}
374}
375
376if(!funcDefined("oneClickBuyBasket")) {
377	var oneClickBuyBasket = function () {
378		name = 'one_click_buy_basket'
379		$('body').find('.'+name+'_frame').remove();
380		$('body').append('<div class="'+name+'_frame popup"></div>');
381		$('.'+name+'_frame').jqm({trigger: '.'+name+'_frame.popup', onHide: function(hash) { onHidejqm(name,hash) }, onLoad: function( hash ){ onLoadjqm( name, hash ); }, ajax: arMShopOptions["SITE_DIR"]+'ajax/one_click_buy_basket.php'});
382		$('.'+name+'_frame.popup').click();
383	}
384}
385
386if(!funcDefined("scroll_block")) {
387	function scroll_block(block){
388		var topPos = block.offset().top,
389			headerH = $('header').outerHeight(true,true);
390		if($(".stores_tab").length){
391			$(".stores_tab").addClass("current").siblings().removeClass("current");
392		}else{
393			$(".prices_tab").addClass("current").siblings().removeClass("current");
394			if($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length){
395				var item = $(".prices_tab .opener").first();
396				item.find(".opener_icon").addClass("opened");
397				item.parents("tr").addClass("nb")
398				item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
399			}
400		}
401		$('html,body').animate({'scrollTop':topPos-30},150);
402	}
403}
404
405if(!funcDefined("jqmEd")) {
406	var jqmEd = function (name, form_id, open_trigger, requestData, selector){
407		if(typeof(requestData) == "undefined"){
408			requestData = '';
409		}
410		if(typeof(selector) == "undefined"){
411			selector = false;
412		}
413		$('body').find('.'+name+'_frame').remove();
414		$('body').append('<div class="'+name+'_frame popup"></div>');
415		if(typeof open_trigger == "undefined" ){
416			$('.'+name+'_frame').jqm({trigger: '.'+name+'_frame.popup', onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arMShopOptions["SITE_DIR"]+'ajax/form.php?form_id='+form_id+(requestData.length ? '&' + requestData : '')});
417		}else{
418			if(name == 'enter'){
419				$('.'+name+'_frame').jqm({trigger: open_trigger,  onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }
419, ajax: arMShopOptions["SITE_DIR"]+'ajax/auth.php'});
420			}else{
421				$('.'+name+'_frame').jqm({trigger: open_trigger,  onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arMShopOptions["SITE_DIR"]+'ajax/form.php?form_id='+form_id+(requestData.length ? '&' + requestData : '')});
422			}
423			$(open_trigger).dblclick(function(){return false;})
424		}
425		return true;
426	}
427}
428
429if (!funcDefined("replaceBasketPopup")){
430	function replaceBasketPopup (hash){
431		if(typeof hash != "undefined"){
432			hash.w.hide();
433			hash.o.hide();
434		}
435	}
436}
437
438if(!funcDefined("waitLayer")){
439	function waitLayer(delay, callback){
440		if((typeof dataLayer !== 'undefined') && (typeof callback === 'function')){
441			callback();
442		}
443		else{
444			setTimeout(function() {
445				waitLayer(delay, callback);
446			}, delay);
447		}
448	}
449}
450
451if(!funcDefined("checkCounters")){
452	function checkCounters(name){
453		if(typeof name !== "undefined"){
454			if(name == "google" && (arMShopOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arMShopOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)){
455				return true;
456			}
457			else if(name == "yandex" && (arMShopOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arMShopOptions["COUNTERS"]["YANDEX_COUNTER"] > 0)){
458				return true;
459			}
460			else{
461				return false;
462			}
463		}
464		else if((arMShopOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arMShopOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) || (arMShopOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arMShopOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
465			return true;
466		}
467		else{
468			return false;
469		}
470	}
471}
472
473if(!funcDefined("addBasketCounter")){
474	function addBasketCounter(id){
475		if(checkCounters()){
476			$.ajax({
477				url:arMShopOptions['SITE_DIR'] + "ajax/goals.php",
478				dataType: "json",
479				type: "POST",
480				data: {"ID": id},
481				success: function(item){
482					if(!!item && !!item.ID){
483						waitLayer(100, function() {
484							dataLayer.push({
485								"event": arMShopOptions["COUNTERS"]['GOOGLE_EVENTS']['ADD2BASKET'],
486							    "ecommerce": {
487							    	"currencyCode": item.CURRENCY,
488							        "add": {
489							            "products": [{
490						                    "id": item.ID,
491						                    "name": item.NAME,
492						                    "price": item.PRICE,
493						                    "brand": item.BRAND,
494						                    "category": item.CATEGORY,
495						                    "quantity": item.QUANTITY
496						                }]
497							        }
498							    }
499							});
500						});
501					}
502				}
503			});
504		}
505	}
506}
507
508if(!funcDefined("purchaseCounter")){
509	function purchaseCounter(order_id, type){
510		if(checkCounters()){
511			$.ajax({
512				url:arMShopOptions['SITE_DIR'] + "ajax/goals.php",
513				dataType: "json",
514				type: "POST",
515				data: {"ORDER_ID": order_id, "TYPE": type},
516				success: function(order){
517					var products = [];
518					if(order.ITEMS){
519						for(var i in order.ITEMS){
520							products.push({
521								"id": order.ITEMS[i].ID,
522								"sku": order.ITEMS[i].ID,
523			                    "name": order.ITEMS[i].NAME,
524			                    "price": order.ITEMS[i].PRICE,
525			                    "brand": order.ITEMS[i].BRAND,
526			                    "category": order.ITEMS[i].CATEGORY,
527			                    "quantity": order.ITEMS[i].QUANTITY
528							});
529						}
530					}
531					if(order.ID){
532						waitLayer(100, function() {
533							dataLayer.push({
534							    "ecommerce": {
535							    	"purchase": {
536								    	"actionField":{
537								    		"id": order.ACCOUNT_NUMBER,
538								    		"shipping": order.PRICE_DELIVERY,
539								    		"tax": order.TAX_VALUE,
540								    		"list": type,
541								    		"revenue": order.PRICE
542								    	},
543							            "products": products
544							        }
545							    }
546							});
547						});
548					}
549				}
550			});
551		}
552	}
553}
554
555if(!funcDefined("viewItemCounter")){
556	function viewItemCounter(id, price_id){
557		if(checkCounters()){
558			$.ajax({
559				url:arMShopOptions['SITE_DIR'] + "ajax/goals.php",
560				dataType: "json",
561				type: "POST",
562				data: {"PRODUCT_ID": id, "PRICE_ID": price_id},
563				success: function(item){
564					if(item.ID){
565						waitLayer(100, function() {
566							dataLayer.push({
567								//"event": "",
568								"ecommerce": {
569									"detail": {
570										"products": [{
571											"id": item.ID,
572											"name": item.NAME,
573											"price": item.PRICE,
574											"brand": item.BRAND,
575											"category": item.CATEGORY
576										}]
577									}
578								}
579							});
580						});
581					}
582				}
583			});
584		}
585	}
586}
587
588if(!funcDefined("checkoutCounter")){
589	function checkoutCounter(step, option, url){
590		if(checkCounters('google')){
591			$.ajax({
592				url:arMShopOptions['SITE_DIR'] + "ajax/goals.php",
593				dataType: "json",
594				type: "POST",
595				data: {"BASKET": "Y"},
596				success: function(basket){
597					var products = [];
598					if(basket.ITEMS){
599						for(var i in basket.ITEMS){
600							products.push({
601								"id": basket.ITEMS[i].ID,
602			                    "name": basket.ITEMS[i].NAME,
603			                    "price": basket.ITEMS[i].PRICE,
604			                    "brand": basket.ITEMS[i].BRAND,
605			                    "category": basket.ITEMS[i].CATEGORY,
606			                    "quantity": basket.ITEMS[i].QUANTITY
607							});
608						}
609					}
610					if(products){
611						waitLayer(100, function() {
612							dataLayer.push({
613								"event": arMShopOptions["COUNTERS"]['GOOGLE_EVENTS']['CHECKOUT_ORDER'],
614							    "ecommerce": {
615							    	"actionField":{
616							    		"step": step,
617							    		"option": option
618							    	},
619							        "products": products
620							    },
621							    "eventCallback": function() {
622							    	document.location = url;
623							   }
624							});
625						});
626					}
627				}
628			});
629		}
630	}
631}
632
633if(!funcDefined("delFromBasketCounter")){
634	function delFromBasketCounter(id, callback){
635		if(checkCounters()){
636			$.ajax({
637				url:arMShopOptions['SITE_DIR'] + "ajax/goals.php",
638				dataType: "json",
639				type: "POST",
640				data: {"ID": id},
641				success: function(item){
642					if(item.ID){
643						waitLayer(100, function() {
644							dataLayer.push({
645								"event": arMShopOptions["COUNTERS"]['GOOGLE_EVENTS']['REMOVE_BASKET'],
646							    "ecommerce": {
647							        "remove": {
648							            "products": [{
649						                    "id": item.ID,
650						                    "name": item.NAME,
651						                    "category": item.CATEGORY
652						                }]
653							        }
654							    }
655							});
656							if(typeof callback == 'function'){
657								callback();
658							}
659						});
660					}
661				}
662			});
663		}
664	}
665}
666
667if(!funcDefined("setHeightCompany")){
668	function setHeightCompany(){
669		$('.md-50.img').height($('.md-50.big').outerHeight()-35);
670	}
671}
672
673if(!funcDefined("initSly")){
674	function initSly(){
675		var $frame  = $(document).find('.frame');
676		var $slidee = $frame.children('ul').eq(0);
677		var $wrap   = $frame.parent();
678
679		$frame.sly({
680			horizontal: 1,
681			itemNav: 'basic',
682			smart: 1,
683			mouseDragging: 0,
684			touchDragging: 1,
685			releaseSwing: 0,
686			startAt: 0,
687			scrollBar: $wrap.find('.scrollbar'),
688			scrollBy: 1,
689			speed: 300,
690			elasticBounds: 0,
691			easing: 'swing',
692			dragHandle: 1,
693			dynamicHandle: 1,
694			clickBar: 1,
695
696			// Buttons
697			forward: $wrap.find('.forward'),
698			backward: $wrap.find('.backward'),
699		});
700		$frame.sly('reload');
701	}
702}
703if(!funcDefined("createTableCompare")){
704	function createTableCompare(originalTable, appendDiv){
705		var clone = originalTable.clone().removeAttr('id').addClass('clone');
706		appendDiv.append(clone);
707	}
708}
709
710if(!funcDefined("isRealValue")){
711	function isRealValue(obj){
712		return obj && obj !== "null" && obj!== "undefined";
713	}
714}
715
716if(!funcDefined("rightScroll")){
717	function rightScroll(prop, id){
718		var el = BX('prop_' + prop + '_' + id);
719		if (el) {
720			var curVal = parseInt(el.style.marginLeft);
721			if (curVal >= 0) el.style.marginLeft = curVal - 20 + '%';
722		}
723	}
724}
725
726if(!funcDefined("leftScroll")){
727	function leftScroll(prop, id){
728		var el = BX('prop_' + prop + '_' + id);
729		if (el) {
730			var curVal = parseInt(el.style.marginLeft);
731			if (curVal < 0) el.style.marginLeft = curVal + 20 + '%';
732		}
733	}
734}
735
736checkPopupWidth = function(){
737	$('.popup.show').each(function() {
738		var width_form = $(this).actual('width');
739		$(this).css({
740			'margin-left': ($(window).width() > width_form ? '-' + width_form / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
741		});
742	});
743}
744
745checkFormWidth = function(){
746	$('.form .form_left').each(function() {
747		var form = $(this).parents('.form');
748		var width = form.actual('width');
749		if(form.hasClass('b')){
750			if(width > 417){
751				form.removeClass('b');
752			}
753		}
754		else{
755			if(width <= 417){
756				form.addClass('b');
757			}
758		}
759	});
760}
761
762checkFormControlWidth = function(){
763	$('.form-control').each(function() {
764		var width = $(this).actual('width');
765		var labelWidth = $(this).find('label:not(.error) > span').actual('width');
766		var errorWidth = $(this).find('label.error').actual('width');
767		if(errorWidth > 0){
768			if($(this).hasClass('h')){
769				if(width > (labelWidth + errorWidth + 5)){
770					$(this).removeClass('h');
771				}
772			}
773			else{
774				if(width <= (labelWidth + errorWidth + 5)){
775					$(this).addClass('h');
776				}
777			}
778		}
779		else{
780			$(this).removeClass('h');
781		}
782	});
783}
784
785scrollToTop = function(){
786	if(arMShopOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE'){
787		var _isScrolling = false;
788		// Append Button
789		$('body').append($('<a />').addClass('scroll-to-top ' + arMShopOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arMShopOptions['THEME']['SCROLLTOTOP_POSITION']).attr({'href': '#', 'id': 'scrollToTop'}));
790		$('#scrollToTop').click(function(e){
791			e.preventDefault();
792			$('body, html').animate({scrollTop : 0}, 500);
793			return false;
794		});
795		// Show/Hide Button on Window Scroll event.
796		$(window).scroll(function(){
797			if(!_isScrolling) {
798				_isScrolling = true;
799				if($(window).scrollTop() > 150){
800					$('#scrollToTop').stop(true, true).addClass('visible');
801					_isScrolling = false;
802				}
803				else{
804					$('#scrollToTop').stop(true, true).removeClass('visible');
805					_isScrolling = false;
806				}
807				checkScrollToTop();
808			}
809		});
810	}
811}
812
813checkScrollToTop = function(){
814
815	if(!$('footer').length){
816		return false;
817	}
818
819	var bottom = 55,
820		scrollVal = $(window).scrollTop(),
821		windowHeight = $(window).height(),
822		footerOffset = $('footer').offset().top+80;
823
824	if(arMShopOptions['THEME']['SCROLLTOTOP_POSITION'] == 'CONTENT'){
825		warpperWidth = $('body > .wrapper > .wrapper_inner').width();
826		$('#scrollToTop').css('margin-left', Math.ceil(warpperWidth / 2) + 23);
827	}
828
829
830	if(scrollVal + windowHeight > footerOffset){
831		$('#scrollToTop').css('bottom', bottom + scrollVal + windowHeight - footerOffset);
832	}
833	else if(parseInt($('#scrollToTop').css('bottom')) > bottom){
834		$('#scrollToTop').css('bottom', bottom);
835	}
836}
837
838if(!funcDefined('reloadTopBasket')){
839	var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item){
840		var obj={
841				"PARAMS": $('#top_basket_params').val(),
842				"ACTION": action
843			};
844		if(typeof item !== "undefined" ){
845			obj.delete_top_item='Y';
846			obj.delete_top_item_id=item.data('id');
847		}
848		$.post( arMShopOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
849			$(basketWindow).html(data);
850			if($(window).outerWidth() > 520){
851				if(slideDown=="Y")
852					$(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
853				clearTimeout(basketTimeoutSlide);
854				basketTimeoutSlide = setTimeout(function() {
855					var _this = $('#basket_line').find('.basket_popup_wrapp');
856					if (_this.is(':hover')) {
857						_this.show();
858					}else{
859						$('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
860					}
861				},delay);
862			}
863
864			$(document).trigger('counter-menu-refresh')
865		}))
866	}
867}
868
869$(document).ready(function(){
870	scrollToTop();
871	$('body').on( 'click', '.captcha_reload', function(e){
872		var captcha = $(this).parents('.captcha-row');
873		e.preventDefault();
874		$.ajax({
875			url: arMShopOptions['SITE_DIR'] + 'ajax/captcha.php'
876		}).done(function(text){
877			captcha.find('input[name=captcha_sid]').val(text);
878			captcha.find('img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
879			captcha.find('input[name=captcha_word]').val('').removeClass('error').next().remove();
880
881		});
882	});
883
884	$(window).resize(function(){
885		checkScrollToTop();
886		checkPopupWidth();
887		checkFormWidth();
888		checkFormControlWidth();
889		touchMenu('ul.menu:not(.opened) > li.menu_item_l1');
890		touchBasket('.cart:not(.empty_cart) .basket_block .link');
891
892		initSly();
893		if(resizeEventTimer) {
894			clearTimeout(resizeEventTimer);
895		}
896
897		resizeEventTimer = setTimeout(function(){
898			if($(window).outerWidth()>600){
899				//$("#header ul.menu").removeClass("opened").css("display", "");
900
901				if($(".authorization-cols").length){
902					$('.authorization-cols').equalize({children: '.col .auth-title', reset: true});
903					$('.authorization-cols').equalize({children: '.col .form-block', reset: true});
904				}
905			} else {
906				$('.authorization-cols .auth-title').css("height", "");
907				$('.authorization-cols .form-block').css("height", "");
908			}
909
910
911			if ($(window).width()>=400) {
912				var textWrapper = $(".catalog_block .catalog_item .item-title").height();
913				var textContent = $(".catalog_block .catalog_item .item-title a");
914				$(textContent).each(function(){
915					if($(this).outerHeight()>textWrapper) {
916						$(this).text(function (index, text) { return text.replace(/\[^a-zA-Z0-9_\u0400-\u052F]*\s(\S)*$/, '...'); });
917					}
918				});
919				$('.catalog_block').equalize({children: '.catalog_item .cost', reset: true});
920				$('.catalog_block').equalize({children: '.catalog_item .item-title', reset: true});
921				$('.catalog_block').equalize({children: '.catalog_item', reset: true});
922			} else {
923				$(".catalog_block .catalog_item").removeAttr("style");
924				$(".catalog_block .catalog_item .item-title").removeAttr("style");
925				$(".catalog_block .catalog_item .cost").removeAttr("style");
926			}
927
928			if($("#basket_form").length && $(window).outerWidth()<=600){
929				$("#basket_form .tabs_content.basket > li.cur td").each(function() { $(this).css("width","");});
930			}
931
932
933			if($("#header .catalog_menu").length && $("#header .catalog_menu").css("display")!="none"){
934				if($(window).outerWidth()>600){
935					reCalculateMenu();
936				}
937			}
938
939			if($(".front_slider_wrapp").length){
940				$(".extended_pagination li i").each(function(){
941					$(this).css({"borderBottomWidth": ($(this).parent("li").outerHeight()/2), "borderTopWidth": ($(this).parent("li").outerHeight()/2)});
942				});
943			}
944
945			setHeightCompany();
946			$(".bx_filter_section .bx_filter_select_container").each(function(){
947				var prop_id=$(this).closest('.bx_filter_parameters_box').attr('property_id');
948				if($('#smartFilterDropDown'+prop_id).length){
949					$('#smartFilterDropDown'+prop_id).css("max-width", $(this).width());
950				}
951			})
952			$('.specials_slider_wrapp .tabs_content > li.cur, .tab_slider_wrapp .tabs_content > li.cur, .wrapper_block .wr').equalize({children: '.item-title'});
953			$('.specials_slider_wrapp .tabs_content > li.cur, .tab_slider_wrapp .tabs_content > li.cur, .wrapper_block .wr').equalize({children: '.item_info'});
954			$('.specials_slider_wrapp .tabs_content > li.cur, .tab_slider_wrapp .tabs_content > li.cur, .wrapper_block .wr').equalize({children: '.catalog_item'});
955		},
956		50, 0);
957	});
958
959	setTimeout(function() {
960		$(window).resize();
961		$(window).scroll();
962	}, 400);
963
964	$(".show_props").live('click', function(){
965		$(this).next(".props_list_wrapp").stop().slideToggle(333);
966		$(this).find("a").toggleClass("opened");
967	});
968
969	$('.see_more').live('click', function(e) {
970		e.preventDefault();
971		var see_more = ($(this).is('.see_more') ? $(this) : $(this).parents('.see_more').first());
972		var see_moreText = (see_more.find('> a').length ? see_more.find('> a') : see_more);
973		var see_moreHiden = see_more.parent().find('> .d');
974		if(see_more.hasClass('open')){
975			see_moreText.text(BX.message('CATALOG_VIEW_MORE'));
976			see_more.removeClass('open');
977			see_moreHiden.hide();
978		}
979		else{
980			see_moreText.text(BX.message('CATALOG_VIEW_LESS'));
981			see_more.addClass('open');
982			see_moreHiden.show();
983		}
984		return false;
985	});
986
987	$('.avtorization-call.enter').live('click', function(e){
988		e.preventDefault();
989		$("body").append("<span class='evb-enter' style='display:none;'></span>");
990		jqmEd('enter', 'auth', '.evb-enter', '', this);
991		$("body .evb-enter").click();
992		$("body .evb-enter").remove();
993	});
994
995	$('.button.faq_button').click(function(e){
996		e.preventDefault();
997		$(this).toggleClass('opened');
998		$('.faq_ask .form').slideToggle();
999	});
1000
1001	$('.staff.list .staff_section .staff_section_title a').click(function(e) {
1002		e.preventDefault();
1003		$(this).parents('.staff_section').toggleClass('opened');
1004		$(this).parents('.staff_section').find('.staff_section_items').stop().slideToggle(600);
1005		$(this).parents('.staff_section_title').find('.opener_icon').toggleClass('opened');
1006	});
1007
1008	$('.jobs_wrapp .item .name tr').click(function(e) {
1009		$(this).closest('.item').toggleClass('opened');
1010		$(this).closest('.item').find('.description_wrapp').stop().slideToggle(600);
1011		$(this).closest('.item').find('.opener_icon').toggleClass('opened');
1012	});
1013
1014	$('.faq.list .item .q a').on('click', function(e){
1015		e.preventDefault();
1016		$(this).parents('.item').toggleClass('opened');
1017		$(this).parents('.item').find('.a').stop().slideToggle();
1018		$(this).parents('.item').find('.q .opener_icon').toggleClass('opened');
1019	});
1020
1021	$('.opener_icon').click(function(e) {
1022		e.preventDefault();
1023		$(this).parent().find('a').trigger('click');
1024	});
1025
1026	$('.to-order').on('click', function(e){
1027		e.preventDefault();
1028		$("body").append("<span class='evb-toorder' style='display:none;'></span>");
1029		jqmEd('to-order', arMShopOptions['FORM']['TOORDER_FORM_ID'], '.evb-toorder', '', this);
1030		$("body .evb-toorder").click();
1031		$("body .evb-toorder").remove();
1032	});
1033
1034	$(document).on('click','.counter_block:not(.basket) .plus',function() {
1035		if ($(this).parent().data("offers") != "Y") {
1036			var isDetailSKU2 = $(this).parents('.counter_block_wr').length,
1037				input = $(this).parents(".counter_block").find("input[type=text]"),
1038				tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this)
1039					.parents('tr').first().find("td.buy .to-cart").data('ratio'),
1040				isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart")
1041					.data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
1042				ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)), max_value = '',
1043				currentValue = input.val(),
1044				curValue;
1045
1046			if (isDblQuantity) {
1047				ratio = Math.round(ratio * arMShopOptions.JS_ITEM_CLICK.precisionFactor) /
1048					arMShopOptions.JS_ITEM_CLICK.precisionFactor;
1049			}
1050
1051			curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
1052			curValue += ratio;
1053			if (isDblQuantity) {
1054				curValue = Math.round(curValue * arMShopOptions.JS_ITEM_CLICK.precisionFactor) /
1055					arMShopOptions.JS_ITEM_CLICK.precisionFactor;
1056			}
1057
1058			if (input.val() >= parseFloat($(this).data('max'))) {
1059				$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "");
1060				$(this).addClass("plus_hover_min");
1061			} else if (input.val() < parseFloat($(this).data('max'))) {
1062				if (parseInt(input.val()) + 1 == parseInt(parseFloat($(this).data('max')))) {
1063					$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "");
1064				} else {
1065					$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "none");
1066				}
1067				$(this).removeClass("plus_hover_min");
1068			}
1069
1070			if (parseFloat($(this).data('max')) > 0) {
1071				if (input.val() < $(this).data('max')) {
1072					if (curValue > $(this).data('max')) {
1073						$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "");
1074						// nothing
1075						//input.val($(this).data('max'));
1076					} else {
1077						$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "none");
1078						input.val(curValue);
1079					}
1080					input.change();
1081				}
1082			} else {
1083				input.val(curValue);
1084				input.change();
1085			}
1086		}
1087	});
1088
1089	$(document).on('click','.counter_block:not(.basket) .minus',function() {
1090		if($(this).parent().data("offers")!="Y"){
1091			var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
1092			input = $(this).parents(".counter_block").find("input[type=text]")
1093			tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
1094				isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
1095				ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
1096				max_value='';
1097			currentValue = input.val();
1098
1099			if(isDblQuantity)
1100				ratio = Math.round(ratio*arMShopOptions.JS_ITEM_CLICK.precisionFactor)/arMShopOptions.JS_ITEM_CLICK.precisionFactor;
1101
1102			curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
1103
1104			curValue -= ratio;
1105			if (isDblQuantity){
1106				curValue = Math.round(curValue*arMShopOptions.JS_ITEM_CLICK.precisionFactor)/arMShopOptions.JS_ITEM_CLICK.precisionFactor;
1107			}
1108
1109			$(".dialog_wind"+$(this).parent().attr("data-item")).css("display","none");
1110			$(this).siblings('.plus').removeClass("plus_hover_min");
1111
1112			if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))>0){
1113				if(currentValue > ratio){
1114					if(curValue<ratio){
1115						input.val(ratio);
1116					}else{
1117						input.val(curValue);
1118					}
1119					input.change();
1120				}
1121			}else{
1122				if(curValue > ratio){
1123					input.val(curValue);
1124				}else{
1125					if(ratio){
1126						input.val(ratio);
1127					}else if(currentValue > 1){
1128						input.val(curValue);
1129					}
1130				}
1131				input.change();
1132			}
1133		}
1134	});
1135
1136	$(document).on('change','.counter_block input[type=text]',function() {
1137		var val = $(this).val(), tmp_ratio = $(this).parents(".counter_wrapp").find(".to-cart").data('ratio'),
1138			isDblQuantity = $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio'),
1139			ratio = (isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
1140			maxValue = parseFloat($(this).parent().find('.plus').data('max'));
1141
1142		if (isDblQuantity) {
1143			ratio = Math.round(ratio * arMShopOptions.JS_ITEM_CLICK.precisionFactor) /
1144				arMShopOptions.JS_ITEM_CLICK.precisionFactor;
1145		}
1146
1147		if (val >= parseFloat($(this).parents(".counter_block").find(".plus").data('max'))) {
1148			$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "");
1149			$(this).siblings('.plus').addClass("plus_hover_min");
1150		} else {
1151			$(".dialog_wind" + $(this).parent().attr("data-item")).css("display", "none");
1152			$(this).siblings('.plus').removeClass("plus_hover_min");
1153		}
1154		if (parseFloat($(this).parents(".counter_block").find(".plus").data('max')) > 0) {
1155			if (val > parseFloat($(this).parents(".counter_block").find(".plus").data('max'))) {
1156				val = parseFloat($(this).parents(".counter_block").find(".plus").data('max'));
1157			} else if (val < ratio) {
1158				val = ratio;
1159			}
1160		} else if (!parseFloat(val)) {
1161			val = 1;
1162		}
1163		//-- ratio
1164		if (isNaN(ratio)) {
1165			ratio = $(this).parent().find('#product_ratio_id_2235').val();
1166		}
1167		if (val < ratio) {
1168			val = ratio;
1169		}
1170		if ((val % ratio) > 0) {
1171
1172			if (val >= maxValue) {
1173				val = Math.floor((maxValue / ratio)) * ratio;
1174			} else {
1175				val = (val / ratio).toFixed(0) * ratio;
1176			}
1177		}
1178		//--/ratio
1179
1180		$(this).parents('.counter_block').parent().parent().find('.to-cart').attr('data-quantity', val);
1181		$(this).parents('.counter_block').parent().parent().find('.one_click').attr('data-quantity', val);
1182		$(this).val(val);
1183	});
1184
1185	$('.counter_block input[type=text]').numeric({allow:"."});
1186
1187	/*slide cart*/
1188	//if(arMShopOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
1189		$(document).on('mouseenter', '#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ', function() {
1190			$(this).closest('.basket_normal').find('.popup').addClass('block');
1191			$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slideDown(150);
1192		});
1193		$(document).on('mouseleave', '#basket_line .basket_normal .basket_block ', function() {
1194			var th=$(this);
1195			$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slideUp(150, function(){
1196				th.closest('.basket_normal').find('.popup').removeClass('block');
1197			});
1198		});
1199	//}
1200
1201	$(document).on( 'click', '.to-cart:not(.read_more)', function(e){
1202		e.preventDefault();
1203		var th=$(this);
1204		var val = $(this).attr('data-quantity'),
1205			offer = $(this).data('offers'),
1206			iblockid = $(this).data('iblockid'),
1207			tmp_props=$(this).data("props"),
1208			props='',
1209			item = $(this).attr('data-item');
1210		if(!val) $val = 1;
1211		if(offer!="Y") offer = "N";
1212		if(tmp_props){
1213			props=tmp_props.split(";");
1214		}
1215		$(this).hide();
1216		$(this).closest('.counter_wrapp').find('.counter_block').hide();
1217		$(this).parents('tr').find('.counter_block_wr .counter_block').hide();
1218		$(this).closest('.button_block').addClass('wide');
1219		$(this).parent().find('.in-cart').show();
1220
1221		$.get( arMShopOptions['SITE_DIR']+"ajax/item.php?item="+item+"&quantity="+val+"&add_item=Y"+"&offers="+offer+"&iblockID="+iblockid+"&props="+JSON.stringify(props),
1222			$.proxy
1223			(
1224				function(){
1225					addBasketCounter(item);
1226					// $('.wish_item[data-item='+item+']').removeClass("added");
1227					// $('.wish_item[data-item='+item+']').find(".value").show();
1228					// $('.wish_item[data-item='+item+']').find(".value.added").hide();
1229					if($("#basket_line .basket_fly").length && $(window).outerWidth()>768){
1230						basketFly('open');
1231					}
1232					else if($("#basket_line .cart").length)
1233					{
1234						if($("#basket_line .cart").is(".empty_cart"))
1235						{
1236							$("#basket_line .cart").removeClass("empty_cart").find(".cart_wrapp a.basket_link").removeAttr("href").addClass("cart-call");
1237							$("#basket_line .cart").removeClass("ecart");
1238							touchBasket('.cart:not(.empty_cart) .basket_block .link');
1239						}
1240
1241						reloadTopBasket('add', $('#basket_line'), 200, 2000, 'Y');
1242
1243					}
1244				}
1245			)
1246		);
1247	})
1248
1249	// $(document).on('click', '.to-subscribe', function(e){
1250	// 	e.preventDefault();
1251	// 	if($(this).is('.auth')){
1252	// 		$('.avtorization-call.enter').click();
1253	// 	}
1254	// 	else{
1255	// 		var item = $(this).attr('data-item');
1256	// 		$(this).hide();
1257	// 		$(this).parent().find('.in-subscribe').show();
1258	// 		$.get(arMShopOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
1259	// 			$.proxy(function(data){
1260	// 				$('.wish_item[data-item=' + item + ']').removeClass('added');
1261	// 				$.getJSON(arMShopOptions['SITE_DIR']+'ajax/get_basket_count.php', function(data){
1262	// 				});
1263	// 			})
1264	// 		);
1265	// 	}
1266	// })
1267
1268	// $(document).on('click', '.in-subscribe', function(e){
1269	// 	e.preventDefault();
1270	// 	var item = $(this).attr('data-item');
1271	// 	$(this).hide();
1272	// 	$(this).parent().find('.to-subscribe').show();
1273	// 	$.get(arMShopOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
1274	// 		$.proxy(function(data){
1275	// 			$.getJSON(arMShopOptions['SITE_DIR'] + 'ajax/get_basket_count.php', function(data){
1276	// 			});
1277	// 		})
1278	// 	);
1279	// })
1280
1281	// $(document).on('click', '.wish_item', function(e){
1282	// 	e.preventDefault();
1283	// 	var val = $(this).attr('data-quantity'),
1284	// 		offer = $(this).data('offers'),
1285	// 		iblockid = $(this).data('iblock'),
1286	// 		tmp_props=$(this).data("props"),
1287	// 		props='',
1288	// 		item = $(this).attr('data-item');
1289	// 	if(!val) $val = 1;
1290	// 	if(offer!="Y") offer = "N";
1291	// 	if(tmp_props){
1292	// 		props=tmp_props.split(";");
1293	// 	}
1294	//
1295	// 	if(!$(this).hasClass('text')){
1296	// 		if($(this).hasClass('added')){
1297	// 			$(this).hide();
1298	// 			$(this).closest('.wish_item_button').find('.to').show();
1299	// 		}
1300	// 		else{
1301	// 			$(this).hide();
1302	// 			$(this).closest('.wish_item_button').find('.in').addClass('added').show();
1303	// 		}
1304	// 	}else{
1305	// 		if(!$(this).hasClass('added')){
1306	// 			$('.wish_item[data-item=' + item + ']').addClass('added');
1307	// 			$('.wish_item[data-item=' + item + ']').find('.value').hide();
1308	// 			$('.wish_item[data-item=' + item + ']').find('.value.added').css('display','inline-block');
1309	// 		}else{
1310	// 			$('.wish_item[data-item=' + item + ']').removeClass('added');
1311	// 			$('.wish_item[data-item=' + item + ']').find('.value').show();
1312	// 			$('.wish_item[data-item=' + item + ']').find('.value.added').hide();
1313	// 		}
1314	// 	}
1315	//
1316	// 	$('.in-cart[data-item=' + item + ']').hide();
1317	// 	$('.to-cart[data-item=' + item + ']').parent().removeClass('wide');
1318	// 	$('.to-cart[data-item=' + item + ']').show();
1319	// 	$('.counter_block[data-item=' + item + ']').show();
1320	// 	if(!$(this).closest('.module-cart').size()){
1321	// 		$.get( arMShopOptions['SITE_DIR']+"ajax/item.php?item="+item+"&quantity="+val+"&wish_item=Y"+"&offers="+offer+"&iblockID="+iblockid+"&props="+JSON.stringify(props),
1322	// 			$.proxy(function(data){
1323	// 				if($('.basket_fly').size()){
1324	// 					basketFly('wish');
1325	// 				}else{
1326	// 					reloadTopBasket('wish', $('#basket_line'), 200, 2000, 'N');
1327	// 				}
1328	// 			})
1329	// 		);
1330	// 	}
1331	// })
1332
1333	$(document).on('click', '.wish_item', function(e){
1334		var
1335			$context = $(this),
1336			id = $context.attr('data-item'),
1337			action;
1338
1339		e.preventDefault();
1340
1341		if (id === undefined) {
1342			return false;
1343		}
1344
1345		if ($context.hasClass('added')) {
1346			action = 'del';
1347		} else {
1348			action = 'add';
1349		}
1350
1351		$.ajax({
1352			url: '/ajax/add_favorite.php',
1353			type: 'POST',
1354			data: {
1355				favorite: 'y',
1356				action: action,
1357				id: id
1358			}
1359		})
1360		.success(function(res) {
1361			if(typeof(res) == "string"){
1362				res = JSON.parse(res);
1363			}
1364			if (res.success) {
1365				if (action == 'del') {
1366					$('.wish_item[data-item=' + id + ']').removeClass('added');
1367					$('.wish_item[data-item=' + id + ']').find('.value').show();
1368					$('.wish_item[data-item=' + id + ']').find('.value.added').hide();
1369					if (window.location.pathname == '/favorite/') {
1370						$('.wish_item[data-item=' + id + ']').closest(`.${templateType}_item_wrapp`).remove();
1371					}
1372				} else {
1373					$('.wish_item[data-item=' + id + ']').addClass("added");
1374					$('.wish_item[data-item=' + id + '] .value:not(.added)').hide();
1375					$('.wish_item[data-item=' + id + '] .value.added').css('display','inline-block')
1376				}
1377
1378				if (Array.isArray(res.msg)) {
1379					$('#fav_top_count').html(res.msg.length);
1380				} else {
1381					$('#fav_top_count').html('0');
1382				}
1383			} else {
1384				alert(res.msg);
1385			}
1386
1387			$(document).trigger('counter-menu-refresh');
1388		});
1389
1390		return false;
1391	})
1392
1393	$.ajax({
1394		url: '/ajax/add_favorite.php',
1395		type: 'GET',
1396		data: {
1397			favorite: 'y',
1398			action: 'get',
1399			id: 0
1400		}
1401	})
1402	.success(function(res) {
1403		if (res.success) {
1404			if (Array.isArray(res.msg)) {
1405				$.each(res.msg, function (idx, id) {
1406					$('.wish_item[data-item=' + id + ']').addClass("added");
1407					$('.wish_item[data-item=' + id + '] .value:not(.added)').hide();
1408					$('.wish_item[data-item=' + id + '] .value.added').css('display','inline-block');
1409				});
1410			}
1411		}
1412	});
1413
1414	// $('.compare_item').live('click', function(e){
1415	$(document).on('click', '.compare_item', function(e){
1416		e.preventDefault();
1417		var item = $(this).attr('data-item');
1418		var iblockID = $(this).attr('data-iblock');
1419		if(!$(this).hasClass('text')){
1420			if($(this).hasClass('added')){
1421				$(this).hide();
1422				$(this).closest('.compare_item_button').find('.to').show();
1423				$('.header-compare-block .count a').html(parseInt($('.header-compare-block .count a').html(), 10) - 1);
1424			}
1425			else{
1426				$(this).hide();
1427				$(this).closest('.compare_item_button').find('.in').show();
1428				$('.header-compare-block .count a').html(parseInt($('.header-compare-block .count a').html(), 10) + 1);
1429			}
1430		}else{
1431			if(!$(this).hasClass('added')){
1432				$('.compare_item[data-item=' + item + ']').addClass('added');
1433				$('.compare_item[data-item=' + item + ']').find('.value').hide();
1434				$('.compare_item[data-item=' + item + ']').find('.value.added').css('display','inline-block');
1435				$('.header-compare-block .count a').html(parseInt($('.header-compare-block .count a').html(), 10) + 1);
1436			}else{
1437				$('.compare_item[data-item=' + item + ']').removeClass('added');
1438				$('.compare_item[data-item=' + item + ']').find('.value').show();
1439				$('.compare_item[data-item=' + item + ']').find('.value.added').hide();
1440				$('.header-compare-block .count a').html(parseInt($('.header-compare-block .count a').html(), 10) - 1);
1441			}
1442		}
1443
1444		$.get(arMShopOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&compare_item=Y&iblock_id=' + iblockID,
1445			$.proxy(function(data){
1446				//jsAjaxUtil.InsertDataToNode(arMShopOptions['SITE_DIR'] + 'ajax/show_compare_preview_top.php', 'compare_line', false);
1447			})
1448		);
1449	});
1450
1451	$('.fancy').fancybox({
1452		openEffect  : 'fade',
1453		closeEffect : 'fade',
1454		nextEffect : 'fade',
1455		prevEffect : 'fade',
1456		tpl:{
1457			closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
1458			next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
1459			prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
1460		},
1461	});
1462
1463	/*search click*/
1464	$('.search_block .icon').on('click', function(){
1465		var th=$(this);
1466		if($(this).hasClass('open')){
1467			$(this).closest('.center_block').find('.search_middle_block').removeClass('active');
1468			$(this).removeClass('open');
1469			$(this).closest('.center_block').find('.search_middle_block').find('.noborder').hide();
1470		}else{
1471			setTimeout(function(){
1472				th.closest('.center_block').find('.search_middle_block').find('.noborder').show();
1473			},100);
1474			$(this).closest('.center_block').find('.search_middle_block').addClass('active');
1475			$(this).addClass('open');
1476		}
1477	})
1478	$(document).on('mouseenter', '.display_list .item_wrap', function(){
1479		$(this).prev().addClass('prev');
1480	});
1481	$(document).on('mouseleave', '.display_list .item_wrap', function(){
1482		$(this).prev().removeClass('prev');
1483	});
1484	$(document).on('mouseenter', '.catalog_block .item_wrap', function(){
1485		$(this).addClass('shadow_delay');
1486	});
1487	$(document).on('mouseleave', '.catalog_block .item_wrap', function(){
1488		$(this).removeClass('shadow_delay');
1489	});
1490	$(document).on('click', '.no_goods .button', function(){
1491		$('.bx_filter .smartfilter .bx_filter_search_reset').trigger('click');
1492	});
1493
1494	$(document).on('click', '.more_text_ajax', function(){
1495		if (setBlock('.more_text_ajax')) {
1496			var url = $(this).closest('.right_block').find('.module-pagination .flex-direction-nav .flex-next').attr('href'),
1497				th = $(this);
1498			if(!url){
1499				url = $('.flex-next').attr('href');
1500			}
1501			th.addClass('loading');
1502
1503			$.ajax({
1504				url: url,
1505				data: {"ajax_get": "Y"},
1506				success: function (html) {
1507					var new_html = $.parseHTML(html);
1508					th.removeClass('loading');
1509					if ($('.display_list').length) {
1510						//$('.display_list').append($(new_html).find('.display_list').html());
1511						$('.display_list').append(html);
1512					} else if ($('.catalog_block').length) {
1513						$('.catalog_block').append(html);
1514						touchItemBlock('.catalog_item a');
1515						$('.catalog_block').ready(function () {
1516							$('.catalog_block').equalize({children: '.catalog_item .cost', reset: true});
1517							$('.catalog_block').equalize({children: '.catalog_item .item-title', reset: true});
1518							$('.catalog_block').equalize({children: '.catalog_item .counter_block', reset: true});
1519							$('.catalog_block').equalize({children: '.catalog_item_wrapp', reset: true});
1520						})
1521					} else if ($('.module_products_list').length) {
1522						$('.module_products_list tbody').append(html);
1523					}
1524					setStatusButton();
1525					$('.bottom_nav').html($(html).find('.bottom_nav').html());
1526					clearBlock('.more_text_ajax');
1527				}
1528			})
1529		}
1530
1531	});
1532
1533
1534	$(document).on('click', '.bx_compare .tabs-head li', function(){
1535		var url=$(this).find('.sortbutton').data('href');
1536		BX.showWait(BX("bx_catalog_compare_block"));
1537		$.ajax({
1538			url: url,
1539			data: {'ajax_action': 'Y'},
1540			success: function(html){
1541				history.pushState(null, null, url);
1542				$('#bx_catalog_compare_block').html(html);
1543				BX.closeWait();
1544			}
1545		})
1546	})
1547	var hoveredTrs;
1548	$(document).on({
1549		mouseover: function(e){
1550			var _ = $(this);
1551			var tbodyIndex = _.closest('tbody').index()+1; //+1 for nth-child
1552			var trIndex = _.index()+1; // +1 for nth-child
1553			hoveredTrs = $(e.delegateTarget).find('.data_table_props')
1554				.children(':nth-child('+tbodyIndex+')')
1555				.children(':nth-child('+trIndex+')').addClass('hovered');
1556		},
1557		mouseleave: function(e){
1558			if(hoveredTrs)
1559				hoveredTrs.removeClass('hovered');
1560		}
1561	}, '.bx_compare .data_table_props tbody>tr');
1562	$(document).on('click', '.fancy_offer', function(e){
1563		e.preventDefault();
1564		var arPict=[];
1565		$('.sliders[data-id='+$(this).data('id')+'] li').each(function(){
1566			if($(this).hasClass('current')){
1567				arPict.unshift($(this).data('big'));
1568			}else{
1569				arPict.push($(this).data('big'));
1570			}
1571		})
1572		$.fancybox(arPict, {
1573			openEffect  : 'fade',
1574			closeEffect : 'fade',
1575			nextEffect : 'fade',
1576			prevEffect : 'fade',
1577			//'type'              : 'image',
1578			tpl:{
1579				closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
1580				next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
1581				prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
1582			},
1583		});
1584	})
1585
1586	/*tabs*/
1587	$(".tabs_section .tabs-head li").live("click", function(){
1588		if(!$(this).is(".current")){
1589			$(".tabs_section .tabs-head li").removeClass("current");
1590			$(this).addClass("current");
1591			$(".tabs_section ul.tabs_content li").removeClass("current");
1592			if($(this).attr("id") == "product_reviews_tab"){
1593				$(".shadow.common").hide(); $("#reviews_content").show();
1594			}
1595			else{
1596				$(".shadow.common").show();
1597				$("#reviews_content").hide();
1598				$(".tabs_section ul.tabs_content > li:eq("+$(this).index()+")").addClass("current");
1599			}
1600		}
1601	});
1602	/*open first section slide*/
1603	setTimeout(function() {
1604		$('.jobs_wrapp .item:first .name tr').trigger('click');
1605	}, 300);
1606
1607	$('.buy_block .slide_offer').on('click', function(){
1608		scroll_block($('.tabs_section'));
1609	});
1610	$('.share_wrapp .text').on('click', function(){
1611		$(this).parent().find('.shares').fadeToggle();
1612	})
1613	$('html, body').live('mousedown', function(e) {
1614		e.stopPropagation();
1615		$('.shares').fadeOut();
1616		$('.search_middle_block').removeClass('active_wide');
1617	})
1618	$('.share_wrapp').find('*').live('mousedown', function(e) {
1619		e.stopPropagation();
1620	});
1621	$(document).on('click', '.reviews-collapse-link', function(){
1622		$('.reviews-reply-form').slideToggle();
1623	})
1624	//$('.form_mobile_block .search_middle_block').html($('.main-nav .search_middle_block').html());
1625
1626	/*touch event*/
1627	document.addEventListener('touchend', function(event) {
1628		if(!$(event.target).closest('.menu_item_l1').length){
1629			$('.child').css({'display':'none'});
1630			$('.menu_item_l1').removeClass('hover');
1631		}
1632		if(!$(event.target).closest('.basket_block').length){
1633			$('.basket_block .link').removeClass('hover');
1634			$('.basket_block .basket_popup_wrapp').slideUp();
1635		}
1636		if(!$(event.target).closest('.catalog_item').length){
1637			var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
1638			$('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
1639			$('.tab:visible').find('.catalog_item').removeClass('hover');
1640			$('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
1641			if($('.catalog_block').length){
1642				$('.catalog_block').find('.catalog_item').removeClass('hover');
1643				//$('.catalog_block').find('.catalog_item').blur();
1644			}
1645		}
1646	}, false);
1647	//touchItemBlock('.catalog_item a');
1648	$(document).on('keyup', '.coupon .input_coupon input', function(){
1649		if($(this).val().length){
1650			$(this).removeClass('error');
1651			$(this).closest('.input_coupon').find('.error').remove();
1652		}else{
1653			$(this).addClass('error');
1654			$("<label class='error'>"+BX.message("INPUT_COUPON")+"</label>").insertBefore($(this));
1655		}
1656	})
1657	BX.addCustomEvent(window, "onAjaxSuccess", function(){
1658		initSelects(document);
1659	});
1660	BX.addCustomEvent(window, "onFrameDataRequestFail", function(response){
1661		console.log(response);
1662	});
1663});
1664function touchMenu(selector){
1665	if($(window).outerWidth()>600){
1666		$(selector).each(function(){
1667			var th=$(this);
1668			th.on('touchend', function(e) {
1669				if (th.find('.child').length && !th.hasClass('hover')) {
1670					e.preventDefault();
1671					e.stopPropagation();
1672					th.siblings().removeClass('hover');
1673					th.addClass('hover');
1674					$('.child').css({'display':'none'});
1675					th.find('.child').css({'display':'block'});
1676				}
1677			})
1678		})
1679	}else{
1680		$(selector).off();
1681	}
1682}
1683function touchItemBlock(selector){
1684	$(selector).each(function(){
1685		var th=$(this),
1686			item=th.closest('.catalog_item');
1687		th.on('touchend', function(e) {
1688			if (!item.hasClass('hover')) {
1689				e.preventDefault();
1690				e.stopPropagation();
1691				item.siblings().removeClass('hover');
1692				item.siblings().blur();
1693				item.closest('.catalog_block').find('.catalog_item').removeClass('hover');
1694				item.addClass('hover');
1695				item.addClass('touch');
1696
1697				var tabsContentHover = th.closest('.tab').attr('data-hover') * 1,
1698					tabsContentUnhoverHover = th.closest('.tab').attr('data-unhover') * 1;
1699
1700				th.closest('.tab').stop().animate({'height': tabsContentUnhoverHover}, 100);
1701				th.closest('.catalog_item').siblings().find('.buttons_block').stop().fadeOut(233)
1702
1703				th.closest('.tab').fadeTo(100, 1);
1704				th.closest('.tab').stop().css({'height': tabsContentHover});
1705				th.closest('.catalog_item').find('.buttons_block').fadeIn(450, 'easeOutCirc');
1706			}
1707		})
1708	})
1709}
1710function touchBasket(selector){
1711	if($(window).outerWidth()>600){
1712		$(document).find(selector).on('touchend', function(e) {
1713			if ($(this).parent().find('.basket_popup_wrapp').length && !$(this).hasClass('hover')) {
1714				e.preventDefault();
1715				e.stopPropagation();
1716				$(this).addClass('hover');
1717				$(this).parent().find('.basket_popup_wrapp').slideDown();
1718			}
1719		})
1720	}else{
1721		$(selector).off();
1722	}
1723}
1724function initFull(){
1725	initSelects(document);
1726	initHoverBlock(document);
1727	$(window).resize();
1728	touchItemBlock('.catalog_item a');
1729}
1730
1731var isFrameDataReceived = false;
1732if (typeof window.frameCacheVars !== "undefined")
1733{
1734	BX.addCustomEvent("onFrameDataReceived", function (json){
1735		initFull();
1736		isFrameDataReceived = true;
1737	});
1738} else {
1739	$( document ).ready(initFull);
1740}
1741
1742$(document).ready(function() {
1743
1744	$(window).load(function() {
1745
1746		$('img[data-retina][width][height]').each(function() {
1747
1748			var img = new Image();
1749			img.src = $(this).attr('data-retina');
1750
1751			var width = img.width;
1752			var height = img.height;
1753			if(window.devicePixelRatio > 1) {
1754
1755				//$(this).width(width/2);
1756				//$(this).height(height/2);
1757				$(this).attr('src', $(this).attr('data-retina'));
1758
1759			}
1760
1761		});
1762
1763	});
1764
1765});
1766
1767function validateEmail(email) {
1768	var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
1769	return re.test(email);
1770}
1771function productAvaliableNotify(this_s,id){
1772	if($('.tovarAvaliable_' + id).hasClass('signup')) return;
1773
1774    if($('.tovarAvaliable_' + id).hasClass('signup')) return;
1775    var $notice = $('.js-notice');
1776
1777    var allowSend = false;
1778    var email = $(this_s).prevAll(".email").val();
1779    if(validateEmail(email)){
1780        allowSend = true;
1781        $(this_s).prevAll(".email").css('display','none');
1782    } else {
1783        if($('.tovarAvaliable_' + id).hasClass('need_email')){
1784            if(validateEmail($(this_s).prevAll(".email").val())){
1785                email =  $(this_s).prevAll(".email").css('display','none');
1786                allowSend = true;
1787                $(this_s).prevAll(".email").css('display','none');
1788            }
1789        }else
1790        {
1791            $(this_s).prevAll(".email").css('display','block');
1792        }
1793    }
1794    if(!allowSend) return;
1795	$.post(
1796		"/ajax/signUp.php",
1797		{
1798			'ID': id,
1799			'EMAIL': email,
1800		},
1801		onAjaxSuccess
1802	);
1803	function onAjaxSuccess(data) {
1804		console.log(data);
1805		if(data == 'SUCCESS'){
1806            $(this_s).prevAll(".notice").css('display','block');
1807		}
1808	}
1809}
1810function productPriceNotify(this_s,id){
1811	if($('.tovarAvaliable_' + id).hasClass('signup')) return;
1812	var $notice = $('.js-notice');
1813
1814	var allowSend = false;
1815	var email = $(this_s).prevAll(".email").val();
1816	if(validateEmail(email)){
1817		allowSend = true;
1818        $(this_s).prevAll(".email").css('display','none');
1819	} else {
1820		if($('.tovarAvaliable_' + id).hasClass('need_email')){
1821			if(validateEmail($(this_s).prevAll(".email").val())){
1822				email =  $(this_s).prevAll(".email").css('display','none');
1823				allowSend = true;
1824                $(this_s).prevAll(".email").css('display','none');
1825			}
1826		}else
1827		{
1828            $(this_s).prevAll(".email").css('display','block');
1829        }
1830	}
1831	if(!allowSend) return;
1832
1833	$.post(
1834		"/ajax/price_sub.php",
1835		{
1836			'ID': id,
1837			'EMAIL': email
1838		},
1839		onAjaxSuccess
1840	);
1841	function onAjaxSuccess(data) {
1842		console.log(data);
1843		if(data == 'SUCCESS'){
1844			$notice.text('Спасибо, ответ пришлем в ближайшее время');
1845            $(this_s).prevAll(".notice").css('display','block');
1846		}
1847	}
1848}

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.