PageSourceSearch

https://0not1.ru/bitrix/cache/js/s1/main/page_eeb7b8138b390b678071…90b6780718b43babe0b00_v1.js?179062933281120

js 0not1.ru collected 2026-10-06 15:16:49 UTC 81,120 bytes, 3,365 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:92:"/local/templates/.default/components/bitrix/catalog.section/catalog/script.js?16839788578181";s:6:"source";s:77:"/local/templates/.default/components/bitrix/catalog.section/catalog/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3(function() {
4	'use strict';
5
6	if (!!window.JCCatalogSectionComponent)
7		return;
8
9	window.JCCatalogSectionComponent = function(params) {
10		this.formPosting = false;
11		this.siteId = params.siteId || '';
12		this.ajaxId = params.ajaxId || '';
13		this.template = params.template || '';
14		this.componentPath = params.componentPath || '';
15		this.parameters = params.parameters || '';
16
17		if (params.navParams)
18		{
19			this.navParams = {
20				NavNum: params.navParams.NavNum || 1,
21				NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
22				NavPageCount: parseInt(params.navParams.NavPageCount) || 1
23			};
24		}
25
26		this.bigData = params.bigData || {enabled: false};
27		this.container = document.querySelector('[data-entity="' + params.container + '"]');
28		this.showMoreButton = null;
29		this.showMoreButtonMessage = null;
30
31		if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0)
32		{
33			BX.cookie_prefix = this.bigData.js.cookiePrefix || '';
34			BX.cookie_domain = this.bigData.js.cookieDomain || '';
35			BX.current_server_time = this.bigData.js.serverTime;
36
37			BX.ready(BX.delegate(this.bigDataLoad, this));
38		}
39
40		if (params.initiallyShowHeader)
41		{
42			BX.ready(BX.delegate(this.showHeader, this));
43		}
44
45		if (params.deferredLoad)
46		{
47			BX.ready(BX.delegate(this.deferredLoad, this));
48		}
49
50		if (params.lazyLoad)
51		{
52			this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
53			this.showMoreButtonMessage = this.showMoreButton.innerHTML;
54			BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
55		}
56
57		if (params.loadOnScroll)
58		{
59			BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
60		}
61	};
62
63	window.JCCatalogSectionComponent.prototype =
64	{
65		checkButton: function()
66		{
67			if (this.showMoreButton)
68			{
69				if (this.navParams.NavPageNomer == this.navParams.NavPageCount)
70				{
71					BX.remove(this.showMoreButton);
72				}
73				else
74				{
75					this.container.appendChild(this.showMoreButton);
76				}
77			}
78		},
79
80		enableButton: function()
81		{
82			if (this.showMoreButton)
83			{
84				BX.removeClass(this.showMoreButton, 'disabled');
85				this.showMoreButton.innerHTML = this.showMoreButtonMessage;
86			}
87		},
88
89		disableButton: function()
90		{
91			if (this.showMoreButton)
92			{
93				BX.addClass(this.showMoreButton, 'disabled');
94				this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER');
95			}
96		},
97
98		loadOnScroll: function()
99		{
100			var scrollTop = BX.GetWindowScrollPos().scrollTop,
101				containerBottom = BX.pos(this.container).bottom;
102
103			if (scrollTop + window.innerHeight > containerBottom)
104			{
105				this.showMore();
106			}
107		},
108
109		showMore: function()
110		{
111			if (this.navParams.NavPageNomer < this.navParams.NavPageCount)
112			{
113				var data = {};
114				data['action'] = 'showMore';
115				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
116
117				if (!this.formPosting)
118				{
119					this.formPosting = true;
120					this.disableButton();
121					this.sendRequest(data);
122				}
123			}
124		},
125
126		bigDataLoad: function()
127		{
128			var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
129				data = BX.ajax.prepareData(this.bigData.params);
130
131			if (data)
132			{
133				url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
134			}
135
136			var onReady = BX.delegate(function(result){
137				this.sendRequest({
138					action: 'deferredLoad',
139					bigData: 'Y',
140					items: result && result.items || [],
141					rid: result && result.id,
142					count: this.bigData.count,
143					rowsRange: this.bigData.rowsRange,
144					shownIds: this.bigData.shownIds
145				});
146			}, this);
147
148			BX.ajax({
149				method: 'GET',
150				dataType: 'json',
151				url: url,
152				timeout: 3,
153				onsuccess: onReady,
154				onfailure: onReady
155			});
156		},
157
158		deferredLoad: function()
159		{
160			this.sendRequest({action: 'deferredLoad'});
161		},
162
163		sendRequest: function(data)
164		{
165			var defaultData = {
166				siteId: this.siteId,
167				template: this.template,
168				parameters: this.parameters
169			};
170
171			if (this.ajaxId)
172			{
173				defaultData.AJAX_ID = this.ajaxId;
174			}
175
176			BX.ajax({
177				url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
178				method: 'POST',
179				dataType: 'json',
180				timeout: 60,
181				data: BX.merge(defaultData, data),
182				onsuccess: BX.delegate(function(result){
183					if (!result || !result.JS)
184						return;
185
186					BX.ajax.processScripts(
187						BX.processHTML(result.JS).SCRIPT,
188						false,
189						BX.delegate(function(){this.showAction(result, data);}, this)
190					);
191				}, this)
192			});
193		},
194
195		showAction: function(result, data)
196		{
197			if (!data)
198				return;
199
200			switch (data.action)
201			{
202				case 'showMore':
203					this.processShowMoreAction(result);
204					break;
205				case 'deferredLoad':
206					this.processDeferredLoadAction(result, data.bigData === 'Y');
207					break;
208			}
209		},
210
211		processShowMoreAction: function(result)
212		{
213			this.formPosting = false;
214			this.enableButton();
215
216			if (result)
217			{
218				this.navParams.NavPageNomer++;
219				this.processItems(result.items);
220				this.processPagination(result.pagination);
221				this.processEpilogue(result.epilogue);
222				this.checkButton();
223			}
224		},
225
226		processDeferredLoadAction: function(result, bigData)
227		{
228			if (!result)
229				return;
230
231			var position = bigData ? this.bigData.rows : {};
232
233			this.processItems(result.items, BX.util.array_keys(position));
234		},
235
236		processItems: function(itemsHtml, position)
237		{
238			if (!itemsHtml)
239				return;
240
241			var processed = BX.processHTML(itemsHtml, false),
242				temporaryNode = BX.create('DIV');
243
244			var items, k, origRows;
245
246			temporaryNode.innerHTML = processed.HTML;
247			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
248
249			if (items.length)
250			{
251				this.showHeader(true);
252
253				for (k in items)
254				{
255					if (items.hasOwnProperty(k))
256					{
257						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
258						items[k].style.opacity = 0;
259
260						if (origRows && BX.type.isDomNode(origRows[position[k]]))
261						{
262							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
263						}
264						else
265						{
266							this.container.appendChild(items[k]);
267						}
268					}
269				}
270
271				new BX.easing({
272					duration: 2000,
273					start: {opacity: 0},
274					finish: {opacity: 100},
275					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
276					step: function(state){
277						for (var k in items)
278						{
279							if (items.hasOwnProperty(k))
280							{
281								items[k].style.opacity = state.opacity / 100;
282							}
283						}
284					},
285					complete: function(){
286						for (var k in items)
287						{
288							if (items.hasOwnProperty(k))
289							{
290								items[k].removeAttribute('style');
291							}
292						}
293					}
294				}).animate();
295			}
296
297			BX.ajax.processScripts(processed.SCRIPT);
298		},
299
300		processPagination: function(paginationHtml)
301		{
302			if (!paginationHtml)
303				return;
304
305			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
306			for (var k in pagination)
307			{
308				if (pagination.hasOwnProperty(k))
309				{
310					pagination[k].innerHTML = paginationHtml;
311				}
312			}
313		},
314
315		processEpilogue: function(epilogueHtml)
316		{
317			if (!epilogueHtml)
318				return;
319
320			var processed = BX.processHTML(epilogueHtml, false);
321			BX.ajax.processScripts(processed.SCRIPT);
322		},
323
324		showHeader: function(animate)
325		{
326			var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}),
327				header;
328
329			if (parentNode && BX.type.isDomNode(parentNode))
330			{
331				header = parentNode.querySelector('[data-entity="header"]');
332
333				if (header && header.getAttribute('data-showed') != 'true')
334				{
335					header.style.display = '';
336
337					if (animate)
338					{
339						new BX.easing({
340							duration: 2000,
341							start: {opacity: 0},
342							finish: {opacity: 100},
343							transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
344							step: function(state){
345								header.style.opacity = state.opacity / 100;
346							},
347							complete: function(){
348								header.removeAttribute('style');
349								header.setAttribute('data-showed', 'true');
350							}
351						}).animate();
352					}
353					else
354					{
355						header.style.opacity = 100;
356					}
357				}
358			}
359		}
360	};
361})();
362/* End */
363;
364; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/.default/components/bitrix/catalog.item/main/script.
364js?176121190463643";s:6:"source";s:71:"/local/templates/.default/components/bitrix/catalog.item/main/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
365(function (window){
366	'use strict';
367
368	if (window.JCCatalogItem)
369		return;
370
371	var BasketButton = function(params)
372	{
373		BasketButton.superclass.constructor.apply(this, arguments);
374		this.buttonNode = BX.create('span', {
375			props: {className: 'btn btn-default btn-buy btn-sm', id: this.id},
376			style: typeof params.style === 'object' ? params.style : {},
377			text: params.text,
378			events: this.contextEvents
379		});
380
381		if (BX.browser.IsIE())
382		{
383			this.buttonNode.setAttribute("hideFocus", "hidefocus");
384		}
385	};
386	BX.extend(BasketButton, BX.PopupWindowButton);
387
388	window.JCCatalogItem = function (arParams)
389	{
390		this.productType = 0;
391		this.showQuantity = true;
392		this.showAbsent = true;
393		this.secondPict = false;
394		this.showOldPrice = false;
395		this.showMaxQuantity = 'N';
396		this.relativeQuantityFactor = 5;
397		this.showPercent = false;
398		this.showSkuProps = false;
399		this.basketAction = 'ADD';
400		this.showClosePopup = false;
401		this.useCompare = false;
402		this.showSubscription = false;
403		this.visual = {
404			ID: '',
405			PICT_ID: '',
406			SECOND_PICT_ID: '',
407			PICT_SLIDER_ID: '',
408			QUANTITY_ID: '',
409			QUANTITY_UP_ID: '',
410			QUANTITY_DOWN_ID: '',
411			PRICE_ID: '',
412			PRICE_OLD_ID: '',
413			DSC_PERC: '',
414			SECOND_DSC_PERC: '',
415			DISPLAY_PROP_DIV: '',
416			BASKET_PROP_DIV: '',
417			SUBSCRIBE_ID: ''
418		};
419		this.product = {
420			checkQuantity: false,
421			maxQuantity: 0,
422			stepQuantity: 1,
423			isDblQuantity: false,
424			canBuy: true,
425			name: '',
426			pict: {},
427			id: 0,
428			addUrl: '',
429			buyUrl: ''
430		};
431
432		this.basketMode = '';
433		this.basketData = {
434			useProps: false,
435			emptyProps: false,
436			quantity: 'quantity',
437			props: 'prop',
438			basketUrl: '',
439			sku_props: '',
440			sku_props_var: 'basket_props',
441			add_url: '',
442			buy_url: ''
443		};
444
445		this.compareData = {
446			compareUrl: '',
447			compareDeleteUrl: '',
448			comparePath: ''
449		};
450
451		this.defaultPict = {
452			pict: null,
453			secondPict: null
454		};
455
456		this.defaultSliderOptions = {
457			interval: 3000,
458			wrap: true
459		};
460		this.slider = {
461			options: {},
462			items: [],
463			active: null,
464			sliding: null,
465			paused: null,
466			interval: null,
467			progress: null
468		};
469		this.touch = null;
470
471		this.quantityDelay = null;
472		this.quantityTimer = null;
473
474		this.checkQuantity = false;
475		this.maxQuantity = 0;
476		this.minQuantity = 0;
477		this.stepQuantity = 1;
478		this.isDblQuantity = false;
479		this.canBuy = true;
480		this.precision = 6;
481		this.precisionFactor = Math.pow(10, this.precision);
482		this.bigData = false;
483		this.fullDisplayMode = false;
484		this.viewMode = '';
485		this.templateTheme = '';
486
487		this.currentPriceMode = '';
488		this.currentPrices = [];
489		this.currentPriceSelected = 0;
490		this.currentQuantityRanges = [];
491		this.currentQuantityRangeSelected = 0;
492
493		this.offers = [];
494		this.offerNum = 0;
495		this.treeProps = [];
496		this.selectedValues = {};
497
498		this.obProduct = null;
499		this.blockNodes = {};
500		this.obQuantity = null;
501		this.obQuantityUp = null;
502		this.obQuantityDown = null;
503		this.obQuantityLimit = {};
504		this.obPict = null;
505		this.obSecondPict = null;
506		this.obPictSlider = null;
507		this.obPictSliderIndicator = null;
508		this.obPrice = null;
509		this.obTree = null;
510		this.obBuyBtn = null;
511		this.obBasketActions = null;
512		this.obNotAvail = null;
513		this.obSubscribe = null;
514		this.obDscPerc = null;
515		this.obSecondDscPerc = null;
516		this.obSkuProps = null;
517		this.obMeasure = null;
518		this.obCompare = null;
519
520		this.obPopupWin = null;
521		this.basketUrl = '';
522		this.basketParams = {};
523		this.isTouchDevice = BX.hasClass(document.documentElement, 'bx-touch');
524		this.hoverTimer = null;
525		this.hoverStateChangeForbidden = false;
526		this.mouseX = null;
527		this.mouseY = null;
528
529		this.useEnhancedEcommerce = false;
530		this.dataLayerName = 'dataLayer';
531		this.brandProperty = false;
532
533		this.errorCode = 0;
534
535		if (typeof arParams === 'object')
536		{
537			if (arParams.PRODUCT_TYPE)
538			{
539				this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
540			}
541
542			this.showQuantity = arParams.SHOW_QUANTITY;
543			this.showAbsent = arParams.SHOW_ABSENT;
544			this.secondPict = arParams.SECOND_PICT;
545			this.showOldPrice = arParams.SHOW_OLD_PRICE;
546			this.showMaxQuantity = arParams.SHOW_MAX_QUANTITY;
547			this.relativeQuantityFactor = parseInt(arParams.RELATIVE_QUANTITY_FACTOR);
548			this.showPercent = arParams.SHOW_DISCOUNT_PERCENT;
549			this.showSkuProps = arParams.SHOW_SKU_PROPS;
550			this.showSubscription = arParams.USE_SUBSCRIBE;
551
552			if (arParams.ADD_TO_BASKET_ACTION)
553			{
554				this.basketAction = arParams.ADD_TO_BASKET_ACTION;
555			}
556
557			this.showClosePopup = arParams.SHOW_CLOSE_POPUP;
558			this.useCompare = arParams.DISPLAY_COMPARE;
559			this.fullDisplayMode = arParams.PRODUCT_DISPLAY_MODE === 'Y';
560			this.bigData = arParams.BIG_DATA;
561			this.viewMode = arParams.VIEW_MODE || '';
562			this.templateTheme = arParams.TEMPLATE_THEME || '';
563			this.useEnhancedEcommerce = arParams.USE_ENHANCED_ECOMMERCE === 'Y';
564			this.dataLayerName = arParams.DATA_LAYER_NAME;
565			this.brandProperty = arParams.BRAND_PROPERTY;
566
567			this.visual = arParams.VISUAL;
568
569			switch (this.productType)
570			{
571				case 0: // no catalog
572				case 1: // product
573				case 2: // set
574					if (arParams.PRODUCT && typeof arParams.PRODUCT === 'object')
575					{
576						this.currentPriceMode = arParams.PRODUCT.ITEM_PRICE_MODE;
577						this.currentPrices = arParams.PRODUCT.ITEM_PRICES;
578						this.currentPriceSelected = arParams.PRODUCT.ITEM_PRICE_SELECTED;
579						this.currentQuantityRanges = arParams.PRODUCT.ITEM_QUANTITY_RANGES;
580						this.currentQuantityRangeSelected = arParams.PRODUCT.ITEM_QUANTITY_RANGE_SELECTED;
581
582						if (this.showQuantity)
583						{
584							this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
585							this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
586
587							if (this.product.checkQuantity)
588							{
589								this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
590							}
591
592							this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
593
594							this.checkQuantity = this.product.checkQuantity;
595							this.isDblQuantity = this.product.isDblQuantity;
596							this.stepQuantity = this.product.stepQuantity;
597							this.maxQuantity = this.product.maxQuantity;
598							this.minQuantity = this.currentPriceMode === 'Q'
599								? parseFloat(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY)
600								: this.stepQuantity;
601
602							if (this.isDblQuantity)
603							{
604								this.stepQuantity = Math.round(this.stepQuantity * this.precisionFactor) / this.precisionFactor;
605							}
606						}
607
608						this.product.canBuy = arParams.PRODUCT.CAN_BUY;
609
610						if (arParams.PRODUCT.MORE_PHOTO_COUNT)
611						{
612							this.product.morePhotoCount = arParams.PRODUCT.MORE_PHOTO_COUNT;
613							this.product.morePhoto = arParams.PRODUCT.MORE_PHOTO;
614						}
615
616						if (arParams.PRODUCT.RCM_ID)
617						{
618							this.product.rcmId = arParams.PRODUCT.RCM_ID;
619						}
620
621						this.canBuy = this.product.canBuy;
622						this.product.name = arParams.PRODUCT.NAME;
623						this.product.pict = arParams.PRODUCT.PICT;
624						this.product.id = arParams.PRODUCT.ID;
625						this.product.DETAIL_PAGE_URL = arParams.PRODUCT.DETAIL_PAGE_URL;
626
627						if (arParams.PRODUCT.ADD_URL)
628						{
629							this.product.addUrl = arParams.PRODUCT.ADD_URL;
630						}
631
632						if (arParams.PRODUCT.BUY_URL)
633						{
634							this.product.buyUrl = arParams.PRODUCT.BUY_URL;
635						}
636
637						if (arParams.BASKET && typeof arParams.BASKET === 'object')
638						{
639							this.basketData.useProps = arParams.BASKET.ADD_PROPS;
640							this.basketData.emptyProps = arParams.BASKET.EMPTY_PROPS;
641						}
642					}
643					else
644					{
645						this.errorCode = -1;
646					}
647
648					break;
649				case 3: // sku
650					if (arParams.PRODUCT && typeof arParams.PRODUCT === 'object')
651					{
652						this.product.name = arParams.PRODUCT.NAME;
653						this.product.id = arParams.PRODUCT.ID;
654						this.product.DETAIL_PAGE_URL = arParams.PRODUCT.DETAIL_PAGE_URL;
655						this.product.morePhotoCount = arParams.PRODUCT.MORE_PHOTO_COUNT;
656						this.product.morePhoto = arParams.PRODUCT.MORE_PHOTO;
657
658						if (arParams.PRODUCT.RCM_ID)
659						{
660							this.product.rcmId = arParams.PRODUCT.RCM_ID;
661						}
662					}
663
664					if (arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
665					{
666						this.offers = arParams.OFFERS;
667						this.offerNum = 0;
668
669						if (arParams.OFFER_SELECTED)
670						{
671							this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
672						}
673
674						if (isNaN(this.offerNum))
675						{
676							this.offerNum = 0;
677						}
678
679						if (arParams.TREE_PROPS)
680						{
681							this.treeProps = arParams.TREE_PROPS;
682						}
683
684						if (arParams.DEFAULT_PICTURE)
685						{
686							this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
687							this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
688						}
689					}
690
691					break;
692				default:
693					this.errorCode = -1;
694			}
695			if (arParams.BASKET && typeof arParams.BASKET === 'object')
696			{
697				if (arParams.BASKET.QUANTITY)
698				{
699					this.basketData.quantity = arParams.BASKET.QUANTITY;
700				}
701
702				if (arParams.BASKET.PROPS)
703				{
704					this.basketData.props = arParams.BASKET.PROPS;
705				}
706
707				if (arParams.BASKET.BASKET_URL)
708				{
709					this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
710				}
711
712				if (3 === this.productType)
713				{
714					if (arParams.BASKET.SKU_PROPS)
715					{
716						this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
717					}
718				}
719
720				if (arParams.BASKET.ADD_URL_TEMPLATE)
721				{
722					this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE;
723				}
724
725				if (arParams.BASKET.BUY_URL_TEMPLATE)
726				{
727					this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE;
728				}
729
730				if (this.basketData.add_url === '' && this.basketData.buy_url === '')
731				{
732					this.errorCode = -1024;
733				}
734			}
735
736			if (this.useCompare)
737			{
738				if (arParams.COMPARE && typeof arParams.COMPARE === 'object')
739				{
740					if (arParams.COMPARE.COMPARE_PATH)
741					{
742						this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH;
743					}
744
745					if (arParams.COMPARE.COMPARE_URL_TEMPLATE)
746					{
747						this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE;
748					}
749					else
750					{
751						this.useCompare = false;
752					}
753
754					if (arParams.COMPARE.COMPARE_DELETE_URL_TEMPLATE)
755					{
756						this.compareData.compareDeleteUrl = arParams.COMPARE.COMPARE_DELETE_URL_TEMPLATE;
757					}
758					else
759					{
760						this.useCompare = false;
761					}
762				}
763				else
764				{
765					this.useCompare = false;
766				}
767			}
768
769			this.isFacebookConversionCustomizeProductEventEnabled
770				= arParams.IS_FACEBOOK_CONVERSION_CUSTOMIZE_PRODUCT_EVENT_ENABLED
771			;
772		}
773
774		if (this.errorCode === 0)
775		{
776			BX.ready(BX.delegate(this.init,this));
777		}
778	};
779
780	window.JCCatalogItem.prototype = {
781		init: function()
782		{
783			var i = 0,
784				treeItems = null;
785
786			this.obProduct = BX(this.visual.ID);
787			if (!this.obProduct)
788			{
789				this.errorCode = -1;
790			}
791
792			this.obPict = BX(this.visual.PICT_ID);
793			if (!this.obPict)
794			{
795				this.errorCode = -2;
796			}
797
798			if (this.secondPict && this.visual.SECOND_PICT_ID)
799			{
800				this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
801			}
802
803			this.obPictSlider = BX(this.visual.PICT_SLIDER_ID);
804			this.obPictSliderIndicator = BX(this.visual.PICT_SLIDER_ID + '_indicator');
805			this.obPictSliderProgressBar = BX(this.visual.PICT_SLIDER_ID + '_progress_bar');
806			if (!this.obPictSlider)
807			{
808				this.errorCode = -4;
809			}
810
811			this.obPrice = BX(this.visual.PRICE_ID);
812			this.obPriceOld = BX(this.visual.PRICE_OLD_ID);
813			this.obPriceTotal = BX(this.visual.PRICE_TOTAL_ID);
814			if (!this.obPrice)
815			{
816				this.errorCode = -16;
817			}
818
819			if (this.showQuantity && this.visual.QUANTITY_ID)
820			{
821				this.obQuantity = BX(this.visual.QUANTITY_ID);
822				this.blockNodes.quantity = this.obProduct.querySelector('[data-entity="quantity-block"]');
823
824				if (!this.isTouchDevice)
825				{
826					BX.bind(this.obQuantity, 'focus', BX.proxy(this.onFocus, this));
827					BX.bind(this.obQuantity, 'blur', BX.proxy(this.onBlur, this));
828				}
829
830				if (this.visual.QUANTITY_UP_ID)
831				{
832					this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
833				}
834
835				if (this.visual.QUANTITY_DOWN_ID)
836				{
837					this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
838				}
839			}
840
841			if (this.visual.QUANTITY_LIMIT && this.showMaxQuantity !== 'N')
842			{
843				this.obQuantityLimit.all = BX(this.visual.QUANTITY_LIMIT);
844				if (this.obQuantityLimit.all)
845				{
846					this.obQuantityLimit.value = this.obQuantityLimit.all.querySelector('[data-entity="quantity-limit-value"]');
847					if (!this.obQuantityLimit.value)
848					{
849						this.obQuantityLimit.all = null;
850					}
851				}
852			}
853
854			if (this.productType === 3 && this.fullDisplayMode)
855			{
856				if (this.visual.TREE_ID)
857				{
858					this.obTree = BX(this.visual.TREE_ID);
859					if (!this.obTree)
860					{
861						this.errorCode = -256;
862					}
863				}
864
865				if (this.visual.QUANTITY_MEASURE)
866				{
867					this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
868				}
869			}
870
871			this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID);
872			if (this.obBasketActions)
873			{
874				if (this.visual.BUY_ID)
875				{
876					this.obBuyBtn = BX(this.visual.BUY_ID);
877				}
878			}
879
880			this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS);
881
882			if (this.showSubscription)
883			{
884				this.obSubscribe = BX(this.visual.SUBSCRIBE_ID);
885			}
886
887			if (this.showPercent)
888			{
889				if (this.visual.DSC_PERC)
890				{
891					this.obDscPerc = BX(this.visual.DSC_PERC);
892				}
893				if (this.secondPict && this.visual.SECOND_DSC_PERC)
894				{
895					this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
896				}
897			}
898
899			if (this.showSkuProps)
900			{
901				if (this.visual.DISPLAY_PROP_DIV)
902				{
903					this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
904				}
905			}
906
907			if (this.errorCode === 0)
908			{
909				// product slider events
910				if (this.isTouchDevice)
911				{
912					BX.bind(this.obPictSlider, 'touchstart', BX.proxy(this.touchStartEvent, this));
913					BX.bind(this.obPictSlider, 'touchend', BX.proxy(this.touchEndEvent, this));
914					BX.bind(this.obPictSlider, 'touchcancel', BX.proxy(this.touchEndEvent, this));
915				}
916				else
917				{
918					if (this.viewMode === 'CARD')
919					{
920						// product hover events
921						BX.bind(this.obProduct, 'mouseenter', BX.proxy(this.hoverOn, this));
922						BX.bind(this.obProduct, 'mouseleave', BX.proxy(this.hoverOff, this));
923					}
924
925					// product slider events
926					BX.bind(this.obProduct, 'mouseenter', BX.proxy(this.cycleSlider, this));
927					BX.bind(this.obProduct, 'mouseleave', BX.proxy(this.stopSlider, this));
928				}
929
930				if (this.bigData)
931				{
932					var links = BX.findChildren(this.obProduct, {tag:'a'}, true);
933					if (links)
934					{
935						for (i in links)
936						{
937							if (links.hasOwnProperty(i))
938							{
939								if (links[i].getAttribute('href') == this.product.DETAIL_PAGE_URL)
940								{
941									BX.bind(links[i], 'click', BX.proxy(this.rememberProductRecommendation, this));
942								}
943							}
944						}
945					}
946				}
947
948				if (this.showQuantity)
949				{
950					var startEventName = this.isTouchDevice ? 'touchstart' : 'mousedown';
951					var endEventName = this.isTouchDevice ? 'touchend' : 'mouseup';
952
953					if (this.obQuantityUp)
954					{
955						BX.bind(this.obQuantityUp, startEventName, BX.proxy(this.startQuantityInterval, this));
956						BX.bind(this.obQuantityUp, endEventName, BX.proxy(this.clearQuantityInterval, this));
957						BX.bind(this.obQuantityUp, 'mouseout', BX.proxy(this.clearQuantityInterval, this));
958						BX.bind(this.obQuantityUp, 'click', BX.delegate(this.quantityUp, this));
959					}
960
961					if (this.obQuantityDown)
962					{
963						BX.bind(this.obQuantityDown, startEventName, BX.proxy(this.startQuantityInterval, this));
964						BX.bind(this.obQuantityDown, endEventName, BX.proxy(this.clearQuantityInterval, this));
965						BX.bind(this.obQuantityDown, 'mouseout', BX.proxy(this.clearQuantityInterval, this));
966						BX.bind(this.obQuantityDown, 'click', BX.delegate(this.quantityDown, this));
967					}
968
969					if (this.obQuantity)
970					{
971						BX.bind(this.obQuantity, 'change', BX.delegate(this.quantityChange, this));
972					}
973				}
974
975				switch (this.productType)
976				{
977					case 0: // no catalog
978					case 1: // product
979					case 2: // set
980					case 7: // service
981						if (parseInt(this.product.morePhotoCount) > 1 && this.obPictSlider)
982						{
983							this.initializeSlider();
984						}
985
986						this.checkQuantityControls();
987
988						break;
989					case 3: // sku
990						if (this.offers.length > 0)
991						{
992							treeItems = BX.findChildren(this.obTree, {tagName: 'div'}, true);
993
994							if (treeItems && treeItems.length)
995							{
996								for (i = 0; i < treeItems.length; i++)
997								{
998									BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this));
999								}
1000							}
1001
1002							this.setCurrent();
1003						}
1004						else if (parseInt(this.product.morePhotoCount) > 1 && this.obPictSlider)
1005						{
1006							this.initializeSlider();
1007						}
1008
1009						break;
1010				}
1011
1012				if (this.obBuyBtn)
1013				{
1014					if (this.basketAction === 'ADD')
1015					{
1016						BX.bind(this.obBuyBtn, 'click', BX.proxy(this.add2Basket, this));
1017					}
1018					else
1019					{
1020						BX.bind(this.obBuyBtn, 'click', BX.proxy(this.buyBasket, this));
1021					}
1022				}
1023
1024				if (this.useCompare)
1025				{
1026					this.obCompare = BX(this.visual.COMPARE_LINK_ID);
1027					if (this.obCompare)
1028					{
1029						BX.bind(this.obCompare, 'click', BX.proxy(this.compare, this));
1030					}
1031
1032					BX.addCustomEvent('onCatalogDeleteCompare', BX.proxy(this.checkDeletedCompare, this));
1033				}
1034			}
1035		},
1036
1037		setAnalyticsDataLayer: function(action)
1038		{
1039			if (!this.useEnhancedEcommerce || !this.dataLayerName)
1040				return;
1041
1042			var item = {},
1043				info = {},
1044				variants = [],
1045				i, k, j, propId, skuId, propValues;
1046
1047			switch (this.productType)
1048			{
1049				case 0: //no catalog
1050				case 1: //product
1051				case 2: //set
1052					item = {
1053						'id': this.product.id,
1054						'name': this.product.name,
1055						'price': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].PRICE,
1056						'brand': BX.type.isArray(this.brandProperty) ? this.brandProperty.join('/') : this.brandProperty
1057					};
1058					break;
1059				case 3: //sku
1060					for (i in this.offers[this.offerNum].TREE)
1061					{
1062						if (this.offers[this.offerNum].TREE.hasOwnProperty(i))
1063						{
1064							propId = i.substring(5);
1065							skuId = this.offers[this.offerNum].TREE[i];
1066
1067							for (k in this.treeProps)
1068							{
1069								if (this.treeProps.hasOwnProperty(k) && this.treeProps[k].ID == propId)
1070								{
1071									for (j in this.treeProps[k].VALUES)
1072									{
1073										propValues = this.treeProps[k].VALUES[j];
1074										if (propValues.ID == skuId)
1075										{
1076											variants.push(propValues.NAME);
1077											break;
1078										}
1079									}
1080
1081								}
1082							}
1083						}
1084					}
1085
1086					item = {
1087						'id': this.offers[this.offerNum].ID,
1088						'name': this.offers[this.offerNum].NAME,
1089						'price': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].PRICE,
1090						'brand': BX.type.isArray(this.brandProperty) ? this.brandProperty.join('/') : this.brandProperty,
1091						'variant': variants.join('/')
1092					};
1093					break;
1094			}
1095
1096			switch (action)
1097			{
1098				case 'addToCart':
1099					info = {
1100						'ecommerce': {
1101							'currencyCode': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].CURRENCY || '',
1102							'add': {
1103								'products': [{
1104									'name': item.name || '',
1105									'id': item.id || '',
1106									'price': item.price || 0,
1107									'brand': item.brand || '',
1108									'category': item.category || '',
1109									'variant': item.variant || '',
1110									'quantity': this.showQuantity && this.obQuantity ? this.obQuantity.value : 1
1111								}]
1112							}
1113						}
1114					};
1115					break;
1116			}
1117
1118			window[this.dataLayerName] = window[this.dataLayerName] || [];
1119			window[this.dataLayerName].push(info);
1120		},
1121
1122		hoverOn: function(event)
1123		{
1124			clearTimeout(this.hoverTimer);
1125			this.obProduct.style.height = getComputedStyle(this.obProduct).height;
1126			BX.addClass(this.obProduct, 'hover');
1127
1128			BX.PreventDefault(event);
1129		},
1130
1131		hoverOff: function(event)
1132		{
1133			if (this.hoverStateChangeForbidden)
1134				return;
1135
1136			BX.removeClass(this.obProduct, 'hover');
1137			this.hoverTimer = setTimeout(
1138				BX.delegate(function(){
1139				}, this),
1140				300
1141			);
1142
1143			BX.PreventDefault(event);
1144		},
1145
1146		onFocus: function()
1147		{
1148			this.hoverStateChangeForbidden = true;
1149			BX.bind(document, 'mousemove', BX.proxy(this.captureMousePosition, this));
1150		},
1151
1152		onBlur: function()
1153		{
1154			this.hoverStateChangeForbidden = false;
1155			BX.unbind(document, 'mousemove', BX.proxy(this.captureMousePosition, this));
1156
1157			var cursorElement = document.elementFromPoint(this.mouseX, this.mouseY);
1158			if (!cursorElement || !this.obProduct.contains(cursorElement))
1159			{
1160				this.hoverOff();
1161			}
1162		},
1163
1164		captureMousePosition: function(event)
1165		{
1166			this.mouseX = event.clientX;
1167			this.mouseY = event.clientY;
1168		},
1169
1170		getCookie: function(name)
1171		{
1172			var matches = document.cookie.match(new RegExp(
1173				"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
1174			));
1175
1176			return matches ? decodeURIComponent(matches[1]) : null;
1177		},
1178
1179		rememberProductRecommendation: function()
1180		{
1181			// save to RCM_PRODUCT_LOG
1182			var cookieName = BX.cookie_prefix + '_RCM_PRODUCT_LOG',
1183				cookie = this.getCookie(cookieName),
1184				itemFound = false;
1185
1186			var cItems = [],
1187				cItem;
1188
1189			if (cookie)
1190			{
1191				cItems = cookie.split('.');
1192			}
1193
1194			var i = cItems.length;
1195
1196			while (i--)
1197			{
1198				cItem = cItems[i].split('-');
1199
1200				if (cItem[0] == this.product.id)
1201				{
1202					// it's already in recommendations, update the date
1203					cItem = cItems[i].split('-');
1204
1205					// update rcmId and date
1206					cItem[1] = this.product.rcmId;
1207					cItem[2] = BX.current_server_time;
1208
1209					cItems[i] = cItem.join('-');
1210					itemFound = true;
1211				}
1212				else
1213				{
1214					if ((BX.current_server_time - cItem[2]) > 3600 * 24 * 30)
1215					{
1216						cItems.splice(i, 1);
1217					}
1218				}
1219			}
1220
1221			if (!itemFound)
1222			{
1223				// add recommendation
1224				cItems.push([this.product.id, this.product.rcmId, BX.current_server_time].join('-'));
1225			}
1226
1227			// serialize
1228			var plNewCookie = cItems.join('.'),
1229				cookieDate = new Date(new Date().getTime() + 1000 * 3600 * 24 * 365 * 10).toUTCString();
1230
1231			document.cookie = cookieName + "=" + plNewCookie + "; path=/; expires=" + cookieDate + "; domain=" + BX.cookie_domain;
1232		},
1233
1234		startQuantityInterval: function()
1235		{
1236			var target = BX.proxy_context;
1237			var func = target.id === this.visual.QUANTITY_DOWN_ID
1238				? BX.proxy(this.quantityDown, this)
1239				: BX.proxy(this.quantityUp, this);
1240
1241			this.quantityDelay = setTimeout(
1242				BX.delegate(function() {
1243					this.quantityTimer = setInterval(func, 150);
1244				}, this),
1245				300
1246			);
1247		},
1248
1249		clearQuantityInterval: function()
1250		{
1251			clearTimeout(this.quantityDelay);
1252			clearInterval(this.quantityTimer);
1253		},
1254
1255		quantityUp: function()
1256		{
1257			var curValue = 0,
1258				boolSet = true;
1259
1260			if (this.errorCode === 0 && this.showQuantity && this.canBuy)
1261			{
1262				curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
1263				if (!isNaN(curValue))
1264				{
1265					curValue += this.stepQuantity;
1266					if (this.checkQuantity)
1267					{
1268						if (curValue > this.maxQuantity)
1269						{
1270							boolSet = false;
1271						}
1272					}
1273
1274					if (boolSet)
1275					{
1276						if (this.isDblQuantity)
1277						{
1278							curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
1279						}
1280
1281						this.obQuantity.value = curValue;
1282
1283						this.setPrice();
1284					}
1285				}
1286			}
1287		},
1288
1289		quantityDown: function()
1290		{
1291			var curValue = 0,
1292				boolSet = true;
1293
1294			if (this.errorCode === 0 && this.showQuantity && this.canBuy)
1295			{
1296				curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
1297				if (!isNaN(curValue))
1298				{
1299					curValue -= this.stepQuantity;
1300
1301					this.checkPriceRange(curValue);
1302
1303					if (curValue < this.minQuantity)
1304					{
1305						boolSet = false;
1306					}
1307
1308					if (curValue === 0) {
1309						boolSet = true;
1310					}
1311
1312					if (boolSet)
1313					{
1314						if (this.isDblQuantity)
1315						{
1316							curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
1317						}
1318
1319						this.obQuantity.value = curValue;
1320
1321						this.setPrice();
1322					}
1323				}
1324			}
1325		},
1326
1327		quantityChange: function()
1328		{
1329			var curValue = 0,
1330				intCount;
1331
1332			if (this.errorCode === 0 && this.showQuantity)
1333			{
1334				if (this.canBuy)
1335				{
1336					curValue = this.isDblQuantity ? parseFloat(this.obQuantity.value) : Math.round(this.obQuantity.value);
1337					if (!isNaN(curValue))
1338					{
1339						if (this.checkQuantity)
1340						{
1341							if (curValue > this.maxQuantity)
1342							{
1343								curValue = this.maxQuantity;
1344							}
1345						}
1346
1347						this.checkPriceRange(curValue);
1348
1349						intCount = Math.floor(
1350							Math.round(curValue * this.precisionFactor / this.stepQuantity) / this.precisionFactor
1351						) || 1;
1352						curValue = (intCount <= 1 ? this.stepQuantity : intCount * this.stepQuantity);
1353						curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
1354
1355						if (curValue < this.minQuantity)
1356						{
1357							curValue = this.minQuantity;
1358						}
1359
1360						this.obQuantity.value = curValue;
1361					}
1362					else
1363					{
1364						this.obQuantity.value = this.minQuantity;
1365					}
1366				}
1367				else
1368				{
1369					this.obQuantity.value = this.minQuantity;
1370				}
1371
1372				this.setPrice();
1373			}
1374		},
1375
1376		quantitySet: function(index)
1377		{
1378			var resetQuantity, strLimit;
1379
1380			var newOffer = this.offers[index],
1381				oldOffer = this.offers[this.offerNum];
1382
1383			if (this.errorCode === 0)
1384			{
1385				this.canBuy = newOffer.CAN_BUY;
1386
1387				this.currentPriceMode = newOffer.ITEM_PRICE_MODE;
1388				this.currentPrices = newOffer.ITEM_PRICES;
1389				this.currentPriceSelected = newOffer.ITEM_PRICE_SELECTED;
1390				this.currentQuantityRanges = newOffer.ITEM_QUANTITY_RANGES;
1391				this.currentQuantityRangeSelected = newOffer.ITEM_QUANTITY_RANGE_SELECTED;
1392
1393				if (this.canBuy)
1394				{
1395					if (this.blockNodes.quantity)
1396					{
1397						BX.style(this.blockNodes.quantity, 'display', '');
1398					}
1399
1400					if (this.obBasketActions)
1401					{
1402						BX.style(this.obBasketActions, 'display', '');
1403					}
1404
1405					if (this.obNotAvail)
1406					{
1407						BX.style(this.obNotAvail, 'display', 'none');
1408					}
1409
1410					if (this.obSubscribe)
1411					{
1412						BX.style(this.obSubscribe, 'display', 'none');
1413					}
1414				}
1415				else
1416				{
1417					if (this.blockNodes.quantity)
1418					{
1419						BX.style(this.blockNodes.quantity, 'display', 'none');
1420					}
1421
1422					if (this.obBasketActions)
1423					{
1424						BX.style(this.obBasketActions, 'display', 'none');
1425					}
1426
1427					if (this.obNotAvail)
1428					{
1429						BX.style(this.obNotAvail, 'display', '');
1430					}
1431
1432					if (this.obSubscribe)
1433					{
1434						if (newOffer.CATALOG_SUBSCRIBE === 'Y')
1435						{
1436							BX.style(this.obSubscribe, 'display', '');
1437							this.obSubscribe.setAttribute('data-item', newOffer.ID);
1438							BX(this.visual.SUBSCRIBE_ID + '_hidden').click();
1439						}
1440						else
1441						{
1442							BX.style(this.obSubscribe, 'display', 'none');
1443						}
1444					}
1445				}
1446
1447				this.isDblQuantity = newOffer.QUANTITY_FLOAT;
1448				this.checkQuantity = newOffer.CHECK_QUANTITY;
1449
1450				if (this.isDblQuantity)
1451				{
1452					this.stepQuantity = Math.round(parseFloat(newOffer.STEP_QUANTITY) * this.precisionFactor) / this.precisionFactor;
1453					this.maxQuantity = parseFloat(newOffer.MAX_QUANTITY);
1454					this.minQuantity = this.currentPriceMode === 'Q' ? parseFloat(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY) : this.stepQuantity;
1455				}
1456				else
1457				{
1458					this.stepQuantity = parseInt(newOffer.STEP_QUANTITY, 10);
1459					this.maxQuantity = parseInt(newOffer.MAX_QUANTITY, 10);
1460					this.minQuantity = this.currentPriceMode === 'Q' ? parseInt(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY) : this.stepQuantity;
1461				}
1462
1463				if (this.showQuantity)
1464				{
1465					var isDifferentMinQuantity = oldOffer.ITEM_PRICES.length
1466						&& oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED]
1467						&& oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED].MIN_QUANTITY != this.minQuantity;
1468
1469					if (this.isDblQuantity)
1470					{
1471						resetQuantity = Math.round(parseFloat(oldOffer.STEP_QUANTITY) * this.precisionFactor) / this.precisionFactor !== this.stepQuantity
1472							|| isDifferentMinQuantity
1473							|| oldOffer.MEASURE !== newOffer.MEASURE
1474							|| (
1475								this.checkQuantity
1476								&& parseFloat(oldOffer.MAX_QUANTITY) > this.maxQuantity
1477								&& parseFloat(this.obQuantity.value) > this.maxQuantity
1478							);
1479					}
1480					else
1481					{
1482						resetQuantity = parseInt(oldOffer.STEP_QUANTITY, 10) !== this.stepQuantity
1483							|| isDifferentMinQuantity
1484							|| oldOffer.MEASURE !== newOffer.MEASURE
1485							|| (
1486								this.checkQuantity
1487								&& parseInt(oldOffer.MAX_QUANTITY, 10) > this.maxQuantity
1488								&& parseInt(this.obQuantity.value, 10) > this.maxQuantity
1489							);
1490					}
1491
1492					this.obQuantity.disabled = !this.canBuy;
1493
1494					if (resetQuantity)
1495					{
1496						this.obQuantity.value = this.minQuantity;
1497					}
1498
1499					if (this.obMeasure)
1500					{
1501						if (newOffer.MEASURE)
1502						{
1503							BX.adjust(this.obMeasure, {html: newOffer.MEASURE});
1504						}
1505						else
1506						{
1507							BX.adjust(this.obMeasure, {html: ''});
1508						}
1509					}
1510				}
1511
1512				if (this.obQuantityLimit.all)
1513				{
1514					if (!this.checkQuantity || this.maxQuantity == 0)
1515					{
1516						BX.adjust(this.obQuantityLimit.value, {html: ''});
1517						BX.adjust(this.obQuantityLimit.all, {style: {display: 'none'}});
1518					}
1519					else
1520					{
1521						if (this.showMaxQuantity === 'M')
1522						{
1523							strLimit = (this.maxQuantity / this.stepQuantity >= this.relativeQuantityFactor)
1524								? BX.message('RELATIVE_QUANTITY_MANY')
1525								: BX.message('RELATIVE_QUANTITY_FEW');
1526						}
1527						else
1528						{
1529							strLimit = this.maxQuantity;
1530
1531							if (newOffer.MEASURE)
1532							{
1533								strLimit += (' ' + newOffer.MEASURE);
1534							}
1535						}
1536
1537						BX.adjust(this.obQuantityLimit.value, {html: strLimit});
1538						BX.adjust(this.obQuantityLimit.all, {style: {display: ''}});
1539					}
1540				}
1541			}
1542		},
1543
1544		initializeSlider: function()
1545		{
1546			var wrap = this.obPictSlider.getAttribute('data-slider-wrap');
1547			if (wrap)
1548			{
1549				this.slider.options.wrap = wrap === 'true';
1550			}
1551			else
1552			{
1553				this.slider.options.wrap = this.defaultSliderOptions.wrap;
1554			}
1555
1556			if (this.isTouchDevice)
1557			{
1558				this.slider.options.interval = false;
1559			}
1560			else
1561			{
1562				this.slider.options.interval = parseInt(this.obPictSlider.getAttribute('data-slider-interval')) || this.defaultSliderOptions.interval;
1563				// slider interval must be more than 700ms because of css transitions
1564				if (this.slider.options.interval < 700)
1565				{
1566					this.slider.options.interval = 700;
1567				}
1568
1569				if (this.obPictSliderIndicator)
1570				{
1571					var controls = this.obPictSliderIndicator.querySelectorAll('[data-go-to]');
1572					for (var i in controls)
1573					{
1574						if (controls.hasOwnProperty(i))
1575						{
1576							BX.bind(controls[i], 'click', BX.proxy(this.sliderClickHandler, this));
1577						}
1578					}
1579				}
1580
1581				if (this.obPictSliderProgressBar)
1582				{
1583					if (this.slider.progress)
1584					{
1585						this.resetProgress();
1586						this.cycleSlider();
1587					}
1588					else
1589					{
1590						this.slider.progress = new BX.easing({
1591							transition: BX.easing.transitions.linear,
1592							step: BX.delegate(function(state){
1593								this.obPictSliderProgressBar.style.width = state.width / 10 + '%';
1594							}, this)
1595						});
1596					}
1597				}
1598			}
1599		},
1600
1601		checkTouch: function(event)
1602		{
1603			if (!event || !event.changedTouches)
1604				return false;
1605
1606			return event.changedTouches[0].identifier === this.touch.identifier;
1607		},
1608
1609		touchStartEvent: function(event)
1610		{
1611			if (event.touches.length != 1)
1612				return;
1613
1614			this.touch = event.changedTouches[0];
1615		},
1616
1617		touchEndEvent: function(event)
1618		{
1619			if (!this.checkTouch(event))
1620				return;
1621
1622			var deltaX = this.touch.pageX - event.changedTouches[0].pageX,
1623				deltaY = this.touch.pageY - event.changedTouches[0].pageY;
1624
1625			if (Math.abs(deltaX) >= Math.abs(deltaY) + 10)
1626			{
1627				if (deltaX > 0)
1628				{
1629					this.slideNext();
1630				}
1631
1632				if (deltaX < 0)
1633				{
1634					this.slidePrev();
1635				}
1636			}
1637		},
1638
1639		sliderClickHandler: function(event)
1640		{
1641			var target = BX.getEventTarget(event),
1642				slideIndex = target.getAttribute('data-go-to');
1643
1644			if (slideIndex)
1645			{
1646				this.slideTo(slideIndex)
1647			}
1648
1649			BX.PreventDefault(event);
1650		},
1651
1652		slideNext: function()
1653		{
1654			if (this.slider.sliding)
1655				return;
1656
1657			return this.slide('next');
1658		},
1659
1660		slidePrev: function()
1661		{
1662			if (this.slider.sliding)
1663				return;
1664
1665			return this.slide('prev');
1666		},
1667
1668		slideTo: function(pos)
1669		{
1670			this.slider.active = BX.findChild(this.obPictSlider, {className: 'item active'}, true, false);
1671			this.slider.progress && (this.slider.interval = true);
1672
1673			var activeIndex = this.getItemIndex(this.slider.active);
1674
1675			if (pos > (this.slider.items.length - 1) || pos < 0)
1676				return;
1677
1678			if (this.slider.sliding)
1679				return false;
1680
1681			if (activeIndex == pos)
1682			{
1683				this.stopSlider();
1684				this.cycleSlider();
1685				return;
1686			}
1687
1688			return this.slide(pos > activeIndex ? 'next' : 'prev', this.eq(this.slider.items, pos));
1689		},
1690
1691		slide: function(type, next)
1692		{
1693			var active = BX.findChild(this.obPictSlider, {className: 'item active'}, true, false),
1694				isCycling = this.slider.interval,
1695				direction = type === 'next' ? 'left' : 'right';
1696
1697			next = next || this.getItemForDirection(type, active);
1698
1699			if (BX.hasClass(next, 'active'))
1700			{
1701				return (this.slider.sliding = false);
1702			}
1703
1704			this.slider.sliding = true;
1705
1706			isCycling && this.stopSlider();
1707
1708			if (this.obPictSliderIndicator)
1709			{
1710				BX.removeClass(this.obPictSliderIndicator.querySelector('.active'), 'active');
1711				var nextIndicator = this.obPictSliderIndicator.querySelectorAll('[data-go-to]')[this.getItemIndex(next)];
1712				nextIndicator && BX.addClass(nextIndicator, 'active');
1713			}
1714
1715			if (BX.hasClass(this.obPictSlider, 'slide') && !BX.browser.IsIE())
1716			{
1717				var self = this;
1718				BX.addClass(next, type);
1719				next.offsetWidth; // force reflow
1720				BX.addClass(active, direction);
1721				BX.addClass(next, direction);
1722				setTimeout(function() {
1723					BX.addClass(next, 'active');
1724					BX.removeClass(active, 'active');
1725					BX.removeClass(active, direction);
1726					BX.removeClass(next, type);
1727					BX.removeClass(next, direction);
1728					self.slider.sliding = false;
1729				}, 700);
1730			}
1731			else
1732			{
1733				BX.addClass(next, 'active');
1734				this.slider.sliding = false;
1735			}
1736
1737			this.obPictSliderProgressBar && this.resetProgress();
1738			isCycling && this.cycleSlider();
1739		},
1740
1741		stopSlider: function(event)
1742		{
1743			event || (this.slider.paused = true);
1744
1745			this.slider.interval && clearInterval(this.slider.interval);
1746
1747			if (this.slider.progress)
1748			{
1749				this.slider.progress.stop();
1750
1751				var width = parseInt(this.obPictSliderProgressBar.style.width);
1752
1753				this.slider.progress.options.duration = this.slider.options.interval * width / 200;
1754				this.slider.progress.options.start = {width: width * 10};
1755				this.slider.progress.options.finish = {width: 0};
1756				this.slider.progress.options.complete = null;
1757				this.slider.progress.animate();
1758			}
1759		},
1760
1761		cycleSlider: function(event)
1762		{
1763			event || (this.slider.paused = false);
1764
1765			this.slider.interval && clearInterval(this.slider.interval);
1766
1767			if (this.slider.options.interval && !this.slider.paused)
1768			{
1769				if (this.slider.progress)
1770				{
1771					this.slider.progress.stop();
1772
1773					var width = parseInt(this.obPictSliderProgressBar.style.width);
1774
1775					this.slider.progress.options.duration = this.slider.options.interval * (100 - width) / 100;
1776					this.slider.progress.options.start = {width: width * 10};
1777					this.slider.progress.options.finish = {width: 1000};
1778					this.slider.progress.options.complete = BX.delegate(function(){
1779						this.slider.interval = true;
1780						this.slideNext();
1781					}, this);
1782					this.slider.progress.animate();
1783				}
1784				else
1785				{
1786					this.slider.interval = setInterval(BX.proxy(this.slideNext, this), this.slider.options.interval);
1787				}
1788			}
1789		},
1790
1791		resetProgress: function()
1792		{
1793			this.slider.progress && this.slider.progress.stop();
1794			this.obPictSliderProgressBar.style.width = 0;
1795		},
1796
1797		getItemForDirection: function(direction, active)
1798		{
1799			var activeIndex = this.getItemIndex(active),
1800				willWrap = direction === 'prev' && activeIndex === 0
1801					|| direction === 'next' && activeIndex == (this.slider.items.length - 1);
1802
1803			if (willWrap && !this.slider.options.wrap)
1804				return active;
1805
1806			var delta = direction === 'prev' ? -1 : 1,
1807				itemIndex = (activeIndex + delta) % this.slider.items.length;
1808
1809			return this.eq(this.slider.items, itemIndex);
1810		},
1811
1812		getItemIndex: function(item)
1813		{
1814			this.slider.items = BX.findChildren(item.parentNode, {className: 'item'}, true);
1815
1816			return this.slider.items.indexOf(item || this.slider.active);
1817		},
1818
1819		eq: function(obj, i)
1820		{
1821			var len = obj.length,
1822				j = +i + (i < 0 ? len : 0);
1823
1824			return j >= 0 && j < len ? obj[j] : {};
1825		},
1826
1827		selectOfferProp: function()
1828		{
1829			var i = 0,
1830				value = '',
1831				strTreeValue = '',
1832				arTreeItem = [],
1833				rowItems = null,
1834				target = BX.proxy_context;
1835
1836			if (target && target.hasAttribute('data-treevalue'))
1837			{
1838				if (BX.hasClass(target, 'is-active'))
1839					return;
1840
1841				strTreeValue = target.getAttribute('data-treevalue');
1842				arTreeItem = strTreeValue.split('_');
1843				if (this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
1844				{
1845					rowItems = BX.findChildren(target.parentNode, {className: 'js-tree_el'}, false);
1846					if (rowItems && 0 < rowItems.length)
1847					{
1848						for (i = 0; i < rowItems.length; i++)
1849						{
1850							value = rowItems[i].getAttribute('data-onevalue');
1851							if (value === arTreeItem[1])
1852							{
1853								BX.addClass(rowItems[i], 'is-active');
1854							}
1855							else
1856							{
1857								BX.removeClass(rowItems[i], 'is-active');
1858							}
1859						}
1860					}
1861				}
1862			}
1863		},
1864
1865		searchOfferPropIndex: function(strPropID, strPropValue)
1866		{
1867			var strName = '',
1868				arShowValues = false,
1869				i, j,
1870				arCanBuyValues = [],
1871				allValues = [],
1872				index = -1,
1873				arFilter = {},
1874				tmpFilter = [];
1875
1876			for (i = 0; i < this.treeProps.length; i++)
1877			{
1878				if (this.treeProps[i].ID === strPropID)
1879				{
1880					index = i;
1881					break;
1882				}
1883			}
1884
1885			if (-1 < index)
1886			{
1887				for (i = 0; i < index; i++)
1888				{
1889					strName = 'PROP_'+this.treeProps[i].ID;
1890					arFilter[strName] = this.selectedValues[strName];
1891				}
1892				strName = 'PROP_'+this.treeProps[index].ID;
1893				arShowValues = this.getRowValues(arFilter, strName);
1894				if (!arShowValues)
1895				{
1896					return false;
1897				}
1898				if (!BX.util.in_array(strPropValue, arShowValues))
1899				{
1900					return false;
1901				}
1902				arFilter[strName] = strPropValue;
1903				for (i = index+1; i < this.treeProps.length; i++)
1904				{
1905					strName = 'PROP_'+this.treeProps[i].ID;
1906					arShowValues = this.getRowValues(arFilter, strName);
1907					if (!arShowValues)
1908					{
1909						return false;
1910					}
1911					allValues = [];
1912					if (this.showAbsent)
1913					{
1914						arCanBuyValues = [];
1915						tmpFilter = [];
1916						tmpFilter = BX.clone(arFilter, true);
1917						for (j = 0; j < arShowValues.length; j++)
1918						{
1919							tmpFilter[strName] = arShowValues[j];
1920							allValues[allValues.length] = arShowValues[j];
1921							if (this.getCanBuy(tmpFilter))
1922								arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
1923						}
1924					}
1925					else
1926					{
1927						arCanBuyValues = arShowValues;
1928					}
1929					if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
1930					{
1931						arFilter[strName] = this.selectedValues[strName];
1932					}
1933					else
1934					{
1935						if (this.showAbsent)
1936							arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]);
1937						else
1938							arFilter[strName] = arCanBuyValues[0];
1939					}
1940					this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
1941				}
1942				this.selectedValues = arFilter;
1943				this.changeInfo();
1944			}
1945			return true;
1946		},
1947
1948		updateRow: function(intNumber, activeID, showID, canBuyID)
1949		{
1950			var i = 0,
1951				value = '',
1952				isCurrent = false,
1953				rowItems = null;
1954
1955			var lineContainer = this.obTree.querySelectorAll('[data-entity="sku-line-block"]'),
1956				listContainer;
1957
1958			if (intNumber > -1 && intNumber < lineContainer.length)
1959			{
1960				listContainer = lineContainer[intNumber].querySelector('div');
1961				rowItems = BX.findChildren(lineContainer[intNumber], {className: 'js-tree_el'}, false);
1962				if (rowItems && 0 < rowItems.length)
1963				{
1964					for (i = 0; i < rowItems.length; i++)
1965					{
1966						value = rowItems[i].getAttribute('data-onevalue');
1967						isCurrent = value === activeID;
1968
1969						if (isCurrent)
1970						{
1971							BX.addClass(rowItems[i], 'is-active');
1972						}
1973						else
1974						{
1975							BX.removeClass(rowItems[i], 'is-active');
1976						}
1977
1978						if (BX.util.in_array(value, canBuyID))
1979						{
1980							BX.removeClass(rowItems[i], 'notallowed');
1981						}
1982						else
1983						{
1984							BX.addClass(rowItems[i], 'notallowed');
1985						}
1986
1987						rowItems[i].style.display = BX.util.in_array(value, showID) ? '' : 'none';
1988
1989						if (isCurrent)
1990						{
1991							lineContainer[intNumber].style.display = (value == 0 && canBuyID.length == 1) ? 'none' : '';
1992						}
1993					}
1994				}
1995			}
1996		},
1997
1998		getRowValues: function(arFilter, index)
1999		{
2000			var i = 0,
2001				j,
2002				arValues = [],
2003				boolSearch = false,
2004				boolOneSearch = true;
2005
2006			if (0 === arFilter.length)
2007			{
2008				for (i = 0; i < this.offers.length; i++)
2009				{
2010					if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
2011					{
2012						arValues[arValues.length] = this.offers[i].TREE[index];
2013					}
2014				}
2015				boolSearch = true;
2016			}
2017			else
2018			{
2019				for (i = 0; i < this.offers.length; i++)
2020				{
2021					boolOneSearch = true;
2022					for (j in arFilter)
2023					{
2024						if (arFilter[j] !== this.offers[i].TREE[j])
2025						{
2026							boolOneSearch = false;
2027							break;
2028						}
2029					}
2030					if (boolOneSearch)
2031					{
2032						if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
2033						{
2034							arValues[arValues.length] = this.offers[i].TREE[index];
2035						}
2036						boolSearch = true;
2037					}
2038				}
2039			}
2040			return (boolSearch ? arValues : false);
2041		},
2042
2043		getCanBuy: function(arFilter)
2044		{
2045			var i, j,
2046				boolSearch = false,
2047				boolOneSearch = true;
2048
2049			for (i = 0; i < this.offers.length; i++)
2050			{
2051				boolOneSearch = true;
2052				for (j in arFilter)
2053				{
2054					if (arFilter[j] !== this.offers[i].TREE[j])
2055					{
2056						boolOneSearch = false;
2057						break;
2058					}
2059				}
2060				if (boolOneSearch)
2061				{
2062					if (this.offers[i].CAN_BUY)
2063					{
2064						boolSearch = true;
2065						break;
2066					}
2067				}
2068			}
2069
2070			return boolSearch;
2071		},
2072
2073		setCurrent: function()
2074		{
2075			var i,
2076				j = 0,
2077				arCanBuyValues = [],
2078				strName = '',
2079				arShowValues = false,
2080				arFilter = {},
2081				tmpFilter = [],
2082				current = this.offers[this.offerNum].TREE;
2083			for (i = 0; i < this.treeProps.length; i++)
2084			{
2085				strName = 'PROP_'+this.treeProps[i].ID;
2086				arShowValues = this.getRowValues(arFilter, strName);
2087				if (!arShowValues)
2088				{
2089					break;
2090				}
2091				if (BX.util.in_array(current[strName], arShowValues))
2092				{
2093					arFilter[strName] = current[strName];
2094				}
2095				else
2096				{
2097					arFilter[strName] = arShowValues[0];
2098					this.offerNum = 0;
2099				}
2100				if (this.showAbsent)
2101				{
2102					arCanBuyValues = [];
2103					tmpFilter = [];
2104					tmpFilter = BX.clone(arFilter, true);
2105					for (j = 0; j < arShowValues.length; j++)
2106					{
2107						tmpFilter[strName] = arShowValues[j];
2108						if (this.getCanBuy(tmpFilter))
2109						{
2110							arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
2111						}
2112					}
2113				}
2114				else
2115				{
2116					arCanBuyValues = arShowValues;
2117				}
2118				this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
2119			}
2120			this.selectedValues = arFilter;
2121			this.changeInfo();
2122		},
2123
2124		changeInfo: function()
2125		{
2126			var i, j,
2127				index = -1,
2128				boolOneSearch = true,
2129				quantityChanged;
2130
2131			for (i = 0; i < this.offers.length; i++)
2132			{
2133				boolOneSearch = true;
2134				for (j in this.selectedValues)
2135				{
2136					if (this.selectedValues[j] !== this.offers[i].TREE[j])
2137					{
2138						boolOneSearch = false;
2139						break;
2140					}
2141				}
2142				if (boolOneSearch)
2143				{
2144					index = i;
2145					break;
2146				}
2147			}
2148			if (index > -1)
2149			{
2150				this.obPictSlider = false;
2151				if (parseInt(this.offers[index].MORE_PHOTO_COUNT) > 1 && this.obPictSlider)
2152				{
2153					// hide pict and second_pict containers
2154					if (this.obPict)
2155					{
2156						this.obPict.style.display = 'none';
2157					}
2158
2159					if (this.obSecondPict)
2160					{
2161						this.obSecondPict.style.display = 'none';
2162					}
2163
2164					// clear slider container
2165					BX.cleanNode(this.obPictSlider);
2166
2167					// fill slider container with slides
2168					for (i in this.offers[index].MORE_PHOTO)
2169					{
2170						if (this.offers[index].MORE_PHOTO.hasOwnProperty(i))
2171						{
2172							this.obPictSlider.appendChild(
2173								BX.create('SPAN', {
2174									props: {className: 'product-item-image-slide item' + (i == 0 ? ' active' : '')},
2175									style: {backgroundImage: 'url(\'' + this.offers[index].MORE_PHOTO[i].SRC + '\')'}
2176								})
2177							);
2178						}
2179					}
2180
2181					// fill slider indicator if exists
2182					if (this.obPictSliderIndicator)
2183					{
2184						BX.cleanNode(this.obPictSliderIndicator);
2185
2186						for (i in this.offers[index].MORE_PHOTO)
2187						{
2188							if (this.offers[index].MORE_PHOTO.hasOwnProperty(i))
2189							{
2190								this.obPictSliderIndicator.appendChild(
2191									BX.create('DIV', {
2192										attrs: {'data-go-to': i},
2193										props: {className: 'product-item-image-slider-control' + (i == 0 ? ' active' : '')}
2194									})
2195								);
2196								this.obPictSliderIndicator.appendChild(document.createTextNode(' '));
2197							}
2198						}
2199
2200						this.obPictSliderIndicator.style.display = '';
2201					}
2202
2203					if (this.obPictSliderProgressBar)
2204					{
2205						this.obPictSliderProgressBar.style.display = '';
2206					}
2207
2208					// show slider container
2209					this.obPictSlider.style.display = '';
2210					this.initializeSlider();
2211				}
2212				else
2213				{
2214					// hide slider container
2215					if (this.obPictSlider)
2216					{
2217						this.obPictSlider.style.display = 'none';
2218					}
2219
2220					if (this.obPictSliderIndicator)
2221					{
2222						this.obPictSliderIndicator.style.display = 'none';
2223					}
2224
2225					if (this.obPictSliderProgressBar)
2226					{
2227						this.obPictSliderProgressBar.style.display = 'none';
2228					}
2229					// show pict and pict_second containers
2230					if (this.obPict)
2231					{
2232						if (this.offers[index].PREVIEW_PICTURE)
2233						{
2234							BX.adjust(this.obPict, {style: {backgroundImage: 'url(\'' + this.offers[index].PREVIEW_PICTURE.SRC + '\')'}});
2235						}
2236						else
2237						{
2238							BX.adjust(this.obPict, {style: {backgroundImage: 'url(\'' + this.defaultPict.pict.SRC + '\')'}});
2239						}
2240
2241						this.obPict.style.display = '';
2242					}
2243
2244					if (this.secondPict && this.obSecondPict)
2245					{
2246						if (this.offers[index].PREVIEW_PICTURE_SECOND)
2247						{
2248							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.offers[index].PREVIEW_PICTURE_SECOND.SRC + '\')'}});
2249						}
2250						else if (this.offers[index].PREVIEW_PICTURE.SRC)
2251						{
2252							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.offers[index].PREVIEW_PICTURE.SRC + '\')'}});
2253						}
2254						else if (this.defaultPict.secondPict)
2255						{
2256							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.defaultPict.secondPict.SRC + '\')'}});
2257						}
2258						else
2259						{
2260							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.defaultPict.pict.SRC + '\')'}});
2261						}
2262
2263						this.obSecondPict.style.display = '';
2264					}
2265				}
2266
2267				if (this.showSkuProps && this.obSkuProps)
2268				{
2269					if (this.offers[index].DISPLAY_PROPERTIES.length)
2270					{
2271						BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
2272					}
2273					else
2274					{
2275						BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
2276					}
2277				}
2278
2279				this.quantitySet(index);
2280				this.setPrice();
2281				this.setCompared(this.offers[index].COMPARED);
2282
2283				this.offerNum = index;
2284			}
2285		},
2286
2287		checkPriceRange: function(quantity)
2288		{
2289			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
2290				return;
2291
2292			var range, found = false;
2293
2294			for (var i in this.currentQuantityRanges)
2295			{
2296				if (this.currentQuantityRanges.hasOwnProperty(i))
2297				{
2298					range = this.currentQuantityRanges[i];
2299
2300					if (
2301						parseInt(quantity) >= parseInt(range.SORT_FROM)
2302						&& (
2303							range.SORT_TO == 'INF'
2304							|| parseInt(quantity) <= parseInt(range.SORT_TO)
2305						)
2306					)
2307					{
2308						found = true;
2309						this.currentQuantityRangeSelected = range.HASH;
2310						break;
2311					}
2312				}
2313			}
2314
2315			if (!found && (range = this.getMinPriceRange()))
2316			{
2317				this.currentQuantityRangeSelected = range.HASH;
2318			}
2319
2320			for (var k in this.currentPrices)
2321			{
2322				if (this.currentPrices.hasOwnProperty(k))
2323				{
2324					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
2325					{
2326						this.currentPriceSelected = k;
2327						break;
2328					}
2329				}
2330			}
2331		},
2332
2333		getMinPriceRange: function()
2334		{
2335			var range;
2336
2337			for (var i in this.currentQuantityRanges)
2338			{
2339				if (this.currentQuantityRanges.hasOwnProperty(i))
2340				{
2341					if (
2342						!range
2343						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
2344					)
2345					{
2346						range = this.currentQuantityRanges[i];
2347					}
2348				}
2349			}
2350
2351			return range;
2352		},
2353
2354		checkQuantityControls: function()
2355		{
2356			if (!this.obQuantity)
2357				return;
2358
2359			var reachedTopLimit = this.checkQuantity && parseFloat(this.obQuantity.value) + this.stepQuantity > this.maxQuantity,
2360				reachedBottomLimit = parseFloat(this.obQuantity.value) - this.stepQuantity < this.minQuantity;
2361
2362			if (reachedTopLimit)
2363			{
2364				BX.addClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled');
2365			}
2366			else if (BX.hasClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled'))
2367			{
2368				BX.removeClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled');
2369			}
2370
2371			if (reachedBottomLimit)
2372			{
2373				BX.addClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled');
2374			}
2375			else if (BX.hasClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled'))
2376			{
2377				BX.removeClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled');
2378			}
2379
2380			if (reachedTopLimit && reachedBottomLimit)
2381			{
2382				this.obQuantity.setAttribute('disabled', 'disabled');
2383			}
2384			else
2385			{
2386				this.obQuantity.removeAttribute('disabled');
2387			}
2388		},
2389
2390		setPrice: function()
2391		{
2392			var obData, price;
2393
2394			if (this.obQuantity)
2395			{
2396				this.checkPriceRange(this.obQuantity.value);
2397			}
2398
2399			this.checkQuantityControls();
2400
2401			price = this.currentPrices[this.currentPriceSelected];
2402
2403			if (this.obPrice)
2404			{
2405				if (price)
2406				{
2407					if (price.RATIO_PRICE > 0) {
2408						let $sPriceHtml = BX.Currency.currencyFormat(price.RATIO_PRICE, price.CURRENCY, true);
2409						$sPriceHtml += '';
2410						BX.adjust(this.obPrice, {html: $sPriceHtml});
2411					}
2412
2413				}
2414				else
2415				{
2416					BX.adjust(this.obPrice, {html: ''});
2417				}
2418
2419				if (this.obPriceOld)
2420				{
2421					if (price && price.RATIO_PRICE !== price.OLD_PRICE_CUSTOM_PRINT && price.OLD_PRICE_CUSTOM > 0)
2422					{
2423						BX.adjust(this.obPriceOld, {
2424							style: {display: ''},
2425							html: BX.Currency.currencyFormat(price.OLD_PRICE_CUSTOM, price.CURRENCY, true)
2426						});
2427					}
2428					else
2429					{
2430						BX.adjust(this.obPriceOld, {
2431							style: {display: 'none'},
2432							html: ''
2433						});
2434					}
2435				}
2436
2437				if (this.obPriceTotal)
2438				{
2439					if (price && this.obQuantity && this.obQuantity.value != this.stepQuantity)
2440					{
2441						BX.adjust(this.obPriceTotal, {
2442							html: BX.message('PRICE_TOTAL_PREFIX') + ' <strong>'
2443								+ BX.Currency.currencyFormat(price.PRICE * this.obQuantity.value, price.CURRENCY, true)
2444								+ '</strong>',
2445							style: {display: ''}
2446						});
2447					}
2448					else
2449					{
2450						BX.adjust(this.obPriceTotal, {
2451							html: '',
2452							style: {display: 'none'}
2453						});
2454					}
2455				}
2456
2457				if (this.showPercent)
2458				{
2459					if (price && parseInt(price.DISCOUNT) > 0)
2460					{
2461						obData = {style: {display: ''}, html: -price.PERCENT + '%'};
2462					}
2463					else
2464					{
2465						obData = {style: {display: 'none'}, html: ''};
2466					}
2467
2468					if (this.obDscPerc)
2469					{
2470						BX.adjust(this.obDscPerc, obData);
2471					}
2472
2473					if (this.obSecondDscPerc)
2474					{
2475						BX.adjust(this.obSecondDscPerc, obData);
2476					}
2477				}
2478			}
2479		},
2480
2481		compare: function(event)
2482		{
2483			var checkbox = this.obCompare,
2484				target = BX.hasClass(checkbox, 'is-added'),
2485				checked = true;
2486
2487			if (checkbox)
2488			{
2489				checked = target === checkbox ? checkbox.checked : !checkbox.checked;
2490			}
2491
2492			var url = checked ? this.compareData.compareUrl : this.compareData.compareDeleteUrl,
2493				compareLink;
2494
2495			if (url)
2496			{
2497				if (target !== checkbox)
2498				{
2499					BX.PreventDefault(event);
2500
2501					this.setCompared(checked);
2502					if (checked) {
2503						// $('.js-compare_popup_name').html($(checkbox).data('name'));
2504						// $('body').addClass('added-comparison__active');
2505					}
2506
2507				}
2508
2509
2510				compareLink = url.replace('#ID#', this.product.id.toString());
2511
2512				BX.ajax({
2513					method: 'POST',
2514					dataType: checked ? 'json' : 'html',
2515					url: compareLink + (compareLink.indexOf('?') !== -1 ? '&' : '?') + 'ajax_action=Y',
2516					onsuccess: checked
2517						? BX.proxy(this.compareResult, this)
2518						: BX.proxy(this.compareDeleteResult, this)
2519				});
2520			}
2521		},
2522
2523		compareResult: function(result)
2524		{
2525			var popupContent, popupButtons;
2526
2527			if (this.obPopupWin)
2528			{
2529				this.obPopupWin.close();
2530			}
2531
2532			if (!BX.type.isPlainObject(result))
2533				return;
2534
2535			this.initPopupWindow();
2536
2537			if (this.offers.length > 0)
2538			{
2539				this.offers[this.offerNum].COMPARED = result.STATUS === 'OK';
2540			}
2541
2542			if (result.STATUS === 'OK')
2543			{
2544				BX.onCustomEvent('OnCompareChange');
2545
2546				popupContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
2547					+ BX.message('COMPARE_MESSAGE_OK')
2548					+ '</p></div>';
2549
2550				if (this.showClosePopup)
2551				{
2552					popupButtons = [
2553						new BasketButton({
2554							text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
2555							events: {
2556								click: BX.delegate(this.compareRedirect, this)
2557							},
2558							style: {marginRight: '10px'}
2559						}),
2560						new BasketButton({
2561							text: BX.message('BTN_MESSAGE_CLOSE_POPUP'),
2562							events: {
2563								click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
2564							}
2565						})
2566					];
2567				}
2568				else
2569				{
2570					popupButtons = [
2571						new BasketButton({
2572							text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
2573							events: {
2574								click: BX.delegate(this.compareRedirect, this)
2575							}
2576						})
2577					];
2578				}
2579			}
2580			else
2581			{
2582				popupContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
2583					+ (result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))
2584					+ '</p></div>';
2585				popupButtons = [
2586					new BasketButton({
2587						text: BX.message('BTN_MESSAGE_CLOSE'),
2588						events: {
2589							click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
2590						}
2591					})
2592				];
2593			}
2594
2595			// this.obPopupWin.setTitleBar(BX.message('COMPARE_TITLE'));
2596			// this.obPopupWin.setContent(popupContent);
2597			// this.obPopupWin.setButtons(popupButtons);
2598			// this.obPopupWin.show();
2599		},
2600
2601		compareDeleteResult: function()
2602		{
2603			BX.onCustomEvent('OnCompareChange');
2604
2605			if (this.offers && this.offers.length)
2606			{
2607				this.offers[this.offerNum].COMPARED = false;
2608			}
2609		},
2610
2611		setCompared: function(state)
2612		{
2613			if (!this.obCompare)
2614				return;
2615
2616			var checkbox = this.obCompare;
2617
2618			if (checkbox)
2619			{
2620				if (state) {
2621
2622					BX.addClass(checkbox, 'is-added');
2623					BX.adjust(checkbox, {attrs: {title: 'Удалить из сравнения'}});
2624				} else {
2625					BX.removeClass(checkbox, 'is-added');
2626					BX.adjust(checkbox, {attrs: {title: 'Добавить к сравнению'}});
2627				}
2628				checkbox.checked = state;
2629			}
2630		},
2631
2632		setCompareInfo: function(comparedIds)
2633		{
2634			if (!BX.type.isArray(comparedIds))
2635				return;
2636
2637			for (var i in this.offers)
2638			{
2639				if (this.offers.hasOwnProperty(i))
2640				{
2641					this.offers[i].COMPARED = BX.util.in_array(this.offers[i].ID, comparedIds);
2642				}
2643			}
2644		},
2645
2646		compareRedirect: function()
2647		{
2648			if (this.compareData.comparePath)
2649			{
2650				location.href = this.compareData.comparePath;
2651			}
2652			else
2653			{
2654				this.obPopupWin.close();
2655			}
2656		},
2657
2658		checkDeletedCompare: function(id)
2659		{
2660			switch (this.productType)
2661			{
2662				case 0: // no catalog
2663				case 1: // product
2664				case 2: // set
2665					if (this.product.id == id)
2666					{
2667						this.setCompared(false);
2668					}
2669
2670					break;
2671				case 3: // sku
2672					var i = this.offers.length;
2673					while (i--)
2674					{
2675						if (this.offers[i].ID == id)
2676						{
2677							this.offers[i].COMPARED = false;
2678
2679							if (this.offerNum == i)
2680							{
2681								this.setCompared(false);
2682							}
2683
2684							break;
2685						}
2686					}
2687			}
2688		},
2689
2690		initBasketUrl: function()
2691		{
2692			this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url);
2693			switch (this.productType)
2694			{
2695				case 1: // product
2696				case 2: // set
2697					this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString());
2698					break;
2699				case 3: // sku
2700					this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID);
2701					break;
2702			}
2703			this.basketParams = {
2704				'ajax_basket': 'Y'
2705			};
2706			if (this.showQuantity)
2707			{
2708				this.basketParams[this.basketData.quantity] = this.obQuantity.value;
2709			}
2710			if (this.basketData.sku_props)
2711			{
2712				this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
2713			}
2714		},
2715
2716		fillBasketProps: function()
2717		{
2718			if (!this.visual.BASKET_PROP_DIV)
2719			{
2720				return;
2721			}
2722			var
2723				i = 0,
2724				propCollection = null,
2725				foundValues = false,
2726				obBasketProps = null;
2727
2728			if (this.basketData.useProps && !this.basketData.emptyProps)
2729			{
2730				if (this.obPopupWin && this.obPopupWin.contentContainer)
2731				{
2732					obBasketProps = this.obPopupWin.contentContainer;
2733				}
2734			}
2735			else
2736			{
2737				obBasketProps = BX(this.visual.BASKET_PROP_DIV);
2738			}
2739			if (obBasketProps)
2740			{
2741				propCollection = obBasketProps.getElementsByTagName('select');
2742				if (propCollection && propCollection.length)
2743				{
2744					for (i = 0; i < propCollection.length; i++)
2745					{
2746						if (!propCollection[i].disabled)
2747						{
2748							switch (propCollection[i].type.toLowerCase())
2749							{
2750								case 'select-one':
2751									this.basketParams[propCollection[i].name] = propCollection[i].value;
2752									foundValues = true;
2753									break;
2754								default:
2755									break;
2756							}
2757						}
2758					}
2759				}
2760				propCollection = obBasketProps.getElementsByTagName('input');
2761				if (propCollection && propCollection.length)
2762				{
2763					for (i = 0; i < propCollection.length; i++)
2764					{
2765						if (!propCollection[i].disabled)
2766						{
2767							switch (propCollection[i].type.toLowerCase())
2768							{
2769								case 'hidden':
2770									this.basketParams[propCollection[i].name] = propCollection[i].value;
2771									foundValues = true;
2772									break;
2773								case 'radio':
2774									if (propCollection[i].checked)
2775									{
2776										this.basketParams[propCollection[i].name] = propCollection[i].value;
2777										foundValues = true;
2778									}
2779									break;
2780								default:
2781									break;
2782							}
2783						}
2784					}
2785				}
2786			}
2787			if (!foundValues)
2788			{
2789				this.basketParams[this.basketData.props] = [];
2790				this.basketParams[this.basketData.props][0] = 0;
2791			}
2792		},
2793
2794		add2Basket: function()
2795		{
2796			this.basketMode = 'ADD';
2797			this.basket();
2798		},
2799
2800		buyBasket: function()
2801		{
2802			this.basketMode = 'BUY';
2803			this.basket();
2804		},
2805
2806		sendToBasket: function()
2807		{
2808			if (!this.canBuy)
2809			{
2810				return;
2811			}
2812
2813			// check recommendation
2814			if (this.product && this.product.id && this.bigData)
2815			{
2816				this.rememberProductRecommendation();
2817			}
2818
2819			this.initBasketUrl();
2820			this.fillBasketProps();
2821			BX.ajax({
2822				method: 'POST',
2823				dataType: 'json',
2824				url: this.basketUrl,
2825				data: this.basketParams,
2826				onsuccess: BX.proxy(this.basketResult, this)
2827			});
2828		},
2829
2830		basket: function()
2831		{
2832			var contentBasketProps = '';
2833			if (!this.canBuy)
2834			{
2835				return;
2836			}
2837			switch (this.productType)
2838			{
2839				case 1: // product
2840				case 2: // set
2841					if (this.basketData.useProps && !this.basketData.emptyProps)
2842					{
2843						this.initPopupWindow();
2844						this.obPopupWin.setTitleBar(BX.message('TITLE_BASKET_PROPS'));
2845						if (BX(this.visual.BASKET_PROP_DIV))
2846						{
2847							contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
2848						}
2849						this.obPopupWin.setContent(contentBasketProps);
2850						this.obPopupWin.setButtons([
2851							new BasketButton({
2852								text: BX.message('BTN_MESSAGE_SEND_PROPS'),
2853								events: {
2854									click: BX.delegate(this.sendToBasket, this)
2855								}
2856							})
2857						]);
2858						this.obPopupWin.show();
2859					}
2860					else
2861					{
2862						this.sendToBasket();
2863					}
2864					break;
2865				case 3: // sku
2866					this.sendToBasket();
2867					break;
2868			}
2869		},
2870
2871		basketResult: function(arResult)
2872		{
2873			var strContent = '',
2874				strPict = '',
2875				successful,
2876				buttons = [];
2877
2878			if (this.obPopupWin)
2879				this.obPopupWin.close();
2880
2881			if (!BX.type.isPlainObject(arResult))
2882				return;
2883
2884			successful = arResult.STATUS === 'OK';
2885
2886			if (successful)
2887			{
2888				this.setAnalyticsDataLayer('addToCart');
2889			}
2890
2891			if (successful && this.basketAction === 'BUY')
2892			{
2893				this.basketRedirect();
2894			}
2895			else
2896			{
2897				this.initPopupWindow();
2898
2899				if (successful)
2900				{
2901					BX.onCustomEvent('OnBasketChange');
2902
2903					if  (BX.findParent(this.obProduct, {className: 'bx_sale_gift_main_products'}, 10))
2904					{
2905						BX.onCustomEvent('onAddToBasketMainProduct', [this]);
2906					}
2907
2908					switch (this.productType)
2909					{
2910						case 1: // product
2911						case 2: // set
2912							strPict = this.product.pict.SRC;
2913							break;
2914						case 3: // sku
2915							strPict = (this.offers[this.offerNum].PREVIEW_PICTURE ?
2916									this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
2917									this.defaultPict.pict.SRC
2918							);
2919							break;
2920					}
2921
2922					strContent = '<div style="width: 100%; margin: 0; text-align: center;"><img src="'
2923						+ strPict + '" height="130" style="max-height:130px"><p>' + this.product.name + '</p></div>';
2924
2925					if (this.showClosePopup)
2926					{
2927						buttons = [
2928							new BasketButton({
2929								text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
2930								events: {
2931									click: BX.delegate(this.basketRedirect, this)
2932								},
2933								style: {marginRight: '10px'}
2934							}),
2935							new BasketButton({
2936								text: BX.message("BTN_MESSAGE_CLOSE_POPUP"),
2937								events: {
2938									click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
2939								}
2940							})
2941						];
2942					}
2943					else
2944					{
2945						buttons = [
2946							new BasketButton({
2947								text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
2948								events: {
2949									click: BX.delegate(this.basketRedirect, this)
2950								}
2951							})
2952						];
2953					}
2954				}
2955				else
2956				{
2957					strContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
2958						+ (arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))
2959						+ '</p></div>';
2960					buttons = [
2961						new BasketButton({
2962							text: BX.message('BTN_MESSAGE_CLOSE'),
2963							events: {
2964								click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
2965							}
2966						})
2967					];
2968				}
2969				$('.js-added_cart').addClass('_visible');
2970				setTimeout(function () {
2971					$('.js-added_cart').removeClass('_visible');
2972				}, 2000);
2973			}
2974		},
2975
2976		basketRedirect: function()
2977		{
2978			location.href = (this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
2979		},
2980
2981		initPopupWindow: function()
2982		{
2983			if (this.obPopupWin)
2984				return;
2985
2986			this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_' + this.visual.ID, null, {
2987				autoHide: true,
2988				offsetLeft: 0,
2989				offsetTop: 0,
2990				overlay : true,
2991				closeByEsc: true,
2992				titleBar: true,
2993				closeIcon: true,
2994				contentColor: 'white',
2995				className: this.templateTheme ? 'bx-' + this.templateTheme : ''
2996			});
2997		}
2998	};
2999})(window);
3000/* End */
3001;
3002; /* Start:"a:4:{s:4:"full";s:91:"/local/templates/.default/components/bitrix/catalog.section/slider/script.js?16839788578181";s:6:"source";s:76:"/local/templates/.default/components/bitrix/catalog.section/slider/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3003(function() {
3004	'use strict';
3005
3006	if (!!window.JCCatalogSectionComponent)
3007		return;
3008
3009	window.JCCatalogSectionComponent = function(params) {
3010		this.formPosting = false;
3011		this.siteId = params.siteId || '';
3012		this.ajaxId = params.ajaxId || '';
3013		this.template = params.template || '';
3014		this.componentPath = params.componentPath || '';
3015		this.parameters = params.parameters || '';
3016
3017		if (params.navParams)
3018		{
3019			this.navParams = {
3020				NavNum: params.navParams.NavNum || 1,
3021				NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
3022				NavPageCount: parseInt(params.navParams.NavPageCount) || 1
3023			};
3024		}
3025
3026		this.bigData = params.bigData || {enabled: false};
3027		this.container = document.querySelector('[data-entity="' + params.container + '"]');
3028		this.showMoreButton = null;
3029		this.showMoreButtonMessage = null;
3030
3031		if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0)
3032		{
3033			BX.cookie_prefix = this.bigData.js.cookiePrefix || '';
3034			BX.cookie_domain = this.bigData.js.cookieDomain || '';
3035			BX.current_server_time = this.bigData.js.serverTime;
3036
3037			BX.ready(BX.delegate(this.bigDataLoad, this));
3038		}
3039
3040		if (params.initiallyShowHeader)
3041		{
3042			BX.ready(BX.delegate(this.showHeader, this));
3043		}
3044
3045		if (params.deferredLoad)
3046		{
3047			BX.ready(BX.delegate(this.deferredLoad, this));
3048		}
3049
3050		if (params.lazyLoad)
3051		{
3052			this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
3053			this.showMoreButtonMessage = this.showMoreButton.innerHTML;
3054			BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
3055		}
3056
3057		if (params.loadOnScroll)
3058		{
3059			BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
3060		}
3061	};
3062
3063	window.JCCatalogSectionComponent.prototype =
3064	{
3065		checkButton: function()
3066		{
3067			if (this.showMoreButton)
3068			{
3069				if (this.navParams.NavPageNomer == this.navParams.NavPageCount)
3070				{
3071					BX.remove(this.showMoreButton);
3072				}
3073				else
3074				{
3075					this.container.appendChild(this.showMoreButton);
3076				}
3077			}
3078		},
3079
3080		enableButton: function()
3081		{
3082			if (this.showMoreButton)
3083			{
3084				BX.removeClass(this.showMoreButton, 'disabled');
3085				this.showMoreButton.innerHTML = this.showMoreButtonMessage;
3086			}
3087		},
3088
3089		disableButton: function()
3090		{
3091			if (this.showMoreButton)
3092			{
3093				BX.addClass(this.showMoreButton, 'disabled');
3094				this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER');
3095			}
3096		},
3097
3098		loadOnScroll: function()
3099		{
3100			var scrollTop = BX.GetWindowScrollPos().scrollTop,
3101				containerBottom = BX.pos(this.container).bottom;
3102
3103			if (scrollTop + window.innerHeight > containerBottom)
3104			{
3105				this.showMore();
3106			}
3107		},
3108
3109		showMore: function()
3110		{
3111			if (this.navParams.NavPageNomer < this.navParams.NavPageCount)
3112			{
3113				var data = {};
3114				data['action'] = 'showMore';
3115				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
3116
3117				if (!this.formPosting)
3118				{
3119					this.formPosting = true;
3120					this.disableButton();
3121					this.sendRequest(data);
3122				}
3123			}
3124		},
3125
3126		bigDataLoad: function()
3127		{
3128			var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
3129				data = BX.ajax.prepareData(this.bigData.params);
3130
3131			if (data)
3132			{
3133				url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
3134			}
3135
3136			var onReady = BX.delegate(function(result){
3137				this.sendRequest({
3138					action: 'deferredLoad',
3139					bigData: 'Y',
3140					items: result && result.items || [],
3141					rid: result && result.id,
3142					count: this.bigData.count,
3143					rowsRange: this.bigData.rowsRange,
3144					shownIds: this.bigData.shownIds
3145				});
3146			}, this);
3147
3148			BX.ajax({
3149				method: 'GET',
3150				dataType: 'json',
3151				url: url,
3152				timeout: 3,
3153				onsuccess: onReady,
3154				onfailure: onReady
3155			});
3156		},
3157
3158		deferredLoad: function()
3159		{
3160			this.sendRequest({action: 'deferredLoad'});
3161		},
3162
3163		sendRequest: function(data)
3164		{
3165			var defaultData = {
3166				siteId: this.siteId,
3167				template: this.template,
3168				parameters: this.parameters
3169			};
3170
3171			if (this.ajaxId)
3172			{
3173				defaultData.AJAX_ID = this.ajaxId;
3174			}
3175
3176			BX.ajax({
3177				url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
3178				method: 'POST',
3179				dataType: 'json',
3180				timeout: 60,
3181				data: BX.merge(defaultData, data),
3182				onsuccess: BX.delegate(function(result){
3183					if (!result || !result.JS)
3184						return;
3185
3186					BX.ajax.processScripts(
3187						BX.processHTML(result.JS).SCRIPT,
3188						false,
3189						BX.delegate(function(){this.showAction(result, data);}, this)
3190					);
3191				}, this)
3192			});
3193		},
3194
3195		showAction: function(result, data)
3196		{
3197			if (!data)
3198				return;
3199
3200			switch (data.action)
3201			{
3202				case 'showMore':
3203					this.processShowMoreAction(result);
3204					break;
3205				case 'deferredLoad':
3206					this.processDeferredLoadAction(result, data.bigData === 'Y');
3207					break;
3208			}
3209		},
3210
3211		processShowMoreAction: function(result)
3212		{
3213			this.formPosting = false;
3214			this.enableButton();
3215
3216			if (result)
3217			{
3218				this.navParams.NavPageNomer++;
3219				this.processItems(result.items);
3220				this.processPagination(result.pagination);
3221				this.processEpilogue(result.epilogue);
3222				this.checkButton();
3223			}
3224		},
3225
3226		processDeferredLoadAction: function(result, bigData)
3227		{
3228			if (!result)
3229				return;
3230
3231			var position = bigData ? this.bigData.rows : {};
3232
3233			this.processItems(result.items, BX.util.array_keys(position));
3234		},
3235
3236		processItems: function(itemsHtml, position)
3237		{
3238			if (!itemsHtml)
3239				return;
3240
3241			var processed = BX.processHTML(itemsHtml, false),
3242				temporaryNode = BX.create('DIV');
3243
3244			var items, k, origRows;
3245
3246			temporaryNode.innerHTML = processed.HTML;
3247			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
3248
3249			if (items.length)
3250			{
3251				this.showHeader(true);
3252
3253				for (k in items)
3254				{
3255					if (items.hasOwnProperty(k))
3256					{
3257						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
3258						items[k].style.opacity = 0;
3259
3260						if (origRows && BX.type.isDomNode(origRows[position[k]]))
3261						{
3262							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
3263						}
3264						else
3265						{
3266							this.container.appendChild(items[k]);
3267						}
3268					}
3269				}
3270
3271				new BX.easing({
3272					duration: 2000,
3273					start: {opacity: 0},
3274					finish: {opacity: 100},
3275					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
3276					step: function(state){
3277						for (var k in items)
3278						{
3279							if (items.hasOwnProperty(k))
3280							{
3281								items[k].style.opacity = state.opacity / 100;
3282							}
3283						}
3284					},
3285					complete: function(){
3286						for (var k in items)
3287						{
3288							if (items.hasOwnProperty(k))
3289							{
3290								items[k].removeAttribute('style');
3291							}
3292						}
3293					}
3294				}).animate();
3295			}
3296
3297			BX.ajax.processScripts(processed.SCRIPT);
3298		},
3299
3300		processPagination: function(paginationHtml)
3301		{
3302			if (!paginationHtml)
3303				return;
3304
3305			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
3306			for (var k in pagination)
3307			{
3308				if (pagination.hasOwnProperty(k))
3309				{
3310					pagination[k].innerHTML = paginationHtml;
3311				}
3312			}
3313		},
3314
3315		processEpilogue: function(epilogueHtml)
3316		{
3317			if (!epilogueHtml)
3318				return;
3319
3320			var processed = BX.processHTML(epilogueHtml, false);
3321			BX.ajax.processScripts(processed.SCRIPT);
3322		},
3323
3324		showHeader: function(animate)
3325		{
3326			var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}),
3327				header;
3328
3329			if (parentNode && BX.type.isDomNode(parentNode))
3330			{
3331				header = parentNode.querySelector('[data-entity="header"]');
3332
3333				if (header && header.getAttribute('data-showed') != 'true')
3334				{
3335					header.style.display = '';
3336
3337					if (animate)
3338					{
3339						new BX.easing({
3340							duration: 2000,
3341							start: {opacity: 0},
3342							finish: {opacity: 100},
3343							transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
3344							step: function(state){
3345								header.style.opacity = state.opacity / 100;
3346							},
3347							complete: function(){
3348								header.removeAttribute('style');
3349								header.setAttribute('data-showed', 'true');
3350							}
3351						}).animate();
3352					}
3353					else
3354					{
3355						header.style.opacity = 100;
3356					}
3357				}
3358			}
3359		}
3360	};
3361})();
3362/* End */
3363;; /* /local/templates/.default/components/bitrix/catalog.section/catalog/script.js?16839788578181*/
3364; /* /local/templates/.default/components/bitrix/catalog.item/main/script.js?176121190463643*/
3365; /* /local/templates/.default/components/bitrix/catalog.section/slider/script.js?16839788578181*/

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.