PageSourceSearch

https://pk-intellekt.ru/bitrix/templates/aspro_next/components/bitrix/catalog.section/catalog_block/script.js

js pk-intellekt.ru collected 2026-10-08 20:36:54 UTC 59,292 bytes, 2,117 lines download raw bytes

1$(document).ready(function(){
2	setTimeout(function(){
3		$('.catalog_block .catalog_item_wrapp .catalog_item .item-title').sliceHeight();
4		$('.catalog_block .catalog_item_wrapp .catalog_item .cost').sliceHeight();
5		$('.catalog_block .catalog_item_wrapp .item_info').sliceHeight();
6		$('.catalog_block .catalog_item_wrapp').sliceHeight({classNull: '.footer_button'});
7	}, 100);
8	$('.catalog_block .catalog_item_wrapp .catalog_item .to-cart').on('click',function() {
9		yaCounter55825063.reachGoal('addToCart');
10	});
11});
12
13BX.addCustomEvent(window, "onAjaxSuccess", function(eventdata){
14	if(typeof eventdata !== 'undefined' && typeof eventdata !== 'string'  && eventdata !== null)
15	{
16		if('action' in eventdata && eventdata.action == 'ajaxContentLoadedTab')
17		{
18			setTimeout(function(){
19				$('.catalog_block .catalog_item_wrapp .catalog_item .item-title').sliceHeight({resize: false});
20				$('.catalog_block .catalog_item_wrapp .catalog_item .cost').sliceHeight({resize: false});
21				$('.catalog_block .catalog_item_wrapp .item_info').sliceHeight({resize: false});
22				$('.catalog_block .catalog_item_wrapp').sliceHeight({classNull: '.footer_button', resize: false});
23			}, 100);
24		}
25	}
26});
27
28(function (window) {
29if (!window.JCCatalogSectionOnlyElement)
30{
31
32	window.JCCatalogSectionOnlyElement = function (arParams)
33	{
34		if (typeof arParams === 'object')
35		{
36			this.params = arParams;
37
38			this.obProduct = null;
39			this.set_quantity = 1;
40
41			this.currentPriceMode = '';
42			this.currentPrices = [];
43			this.currentPriceSelected = 0;
44			this.currentQuantityRanges = [];
45			this.currentQuantityRangeSelected = 0;
46
47			if (this.params.MESS)
48			{
49				this.mess = this.params.MESS;
50			}
51
52			this.init();
53		}
54	}
55	window.JCCatalogSectionOnlyElement.prototype = {
56		init: function()
57		{
58			var i = 0,
59				j = 0,
60				treeItems = null;
61
62			this.obProduct = BX(this.params.ID);
63
64			if(!!this.obProduct)
65			{
66				$(this.obProduct).find('.counter_wrapp .counter_block input').data('product', 'ob'+this.obProduct.id+'el');
67				this.currentPriceMode = this.params.ITEM_PRICE_MODE;
68				this.currentPrices = this.params.ITEM_PRICES;
69				this.currentQuantityRanges = this.params.ITEM_QUANTITY_RANGES;
70			}
71
72		},
73
74		setPriceAction: function()
75		{
76			this.set_quantity = this.params.MIN_QUANTITY_BUY;			
77			if($(this.obProduct).find('input[name=quantity]').length)
78				this.set_quantity = $(this.obProduct).find('input[name=quantity]').val();
79			
80			this.checkPriceRange(this.set_quantity);
81
82			$(this.obProduct).find('.not_matrix').hide();
83			$(this.obProduct).find('.with_matrix .price_value_block').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_PRICE));
84
85			if($(this.obProduct).find('.with_matrix .discount'))
86			{
87				$(this.obProduct).find('.with_matrix .discount').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].BASE_PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_BASE_PRICE));
88			}
89			
90			$(this.obProduct).find('.with_matrix .sale_block .text .values_wrapper').html(function(){
91				return getCurrentPrice(this.currentPrices[this.currentPriceSelected].DISCOUNT, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_DISCOUNT)
92			});
93			
94			$(this.obProduct).find('.with_matrix').show();
95
96			if(arNextOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
97			{
98				if(typeof this.currentPrices[this.currentPriceSelected] !== 'undefined')
99					setPriceItem($(this.obProduct), this.set_quantity, this.currentPrices[this.currentPriceSelected].PRICE);
100			}
101		},
102
103		checkPriceRange: function(quantity)
104		{
105			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
106				return;
107
108			var range, found = false;
109			
110			for (var i in this.currentQuantityRanges)
111			{
112				if (this.currentQuantityRanges.hasOwnProperty(i))
113				{
114					range = this.currentQuantityRanges[i];
115
116					if (
117						parseInt(quantity) >= parseInt(range.SORT_FROM)
118						&& (
119							range.SORT_TO == 'INF'
120							|| parseInt(quantity) <= parseInt(range.SORT_TO)
121						)
122					)
123					{
124						found = true;
125						this.currentQuantityRangeSelected = range.HASH;
126						break;
127					}
128				}
129			}
130
131			if (!found && (range = this.getMinPriceRange()))
132			{
133				this.currentQuantityRangeSelected = range.HASH;
134			}
135
136			for (var k in this.currentPrices)
137			{
138				if (this.currentPrices.hasOwnProperty(k))
139				{
140					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
141					{
142						this.currentPriceSelected = k;
143						break;
144					}
145				}
146			}
147		},
148
149		getMinPriceRange: function()
150		{
151			var range;
152
153			for (var i in this.currentQuantityRanges)
154			{
155				if (this.currentQuantityRanges.hasOwnProperty(i))
156				{
157					if (
158						!range
159						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
160					)
161					{
162						range = this.currentQuantityRanges[i];
163					}
164				}
165			}
166
167			return range;
168		}
169	}
170}
171
172
173if (!!window.JCCatalogSection)
174{
175	return;
176}
177
178window.JCCatalogSection = function (arParams)
179{
180	this.skuVisualParams = {
181		SELECT:
182		{
183			TAG_BIND: 'select',
184			TAG: 'option',
185			ACTIVE_CLASS: 'active',
186			HIDE_CLASS: 'hidden',
187			EVENT: 'change',
188		},
189		LI:
190		{
191			TAG_BIND: 'li',
192			TAG: 'li',
193			ACTIVE_CLASS: 'active',
194			HIDE_CLASS: 'missing',
195			EVENT: 'click',
196		}
197	};
198	this.productType = 0;
199	this.showQuantity = true;
200	this.showAbsent = true;
201	this.secondPict = false;
202	this.showOldPrice = false;
203	this.showPercent = false;
204	this.showSkuProps = false;
205	this.basketAction = 'ADD';
206	this.basketLinkURL = '';
207	this.showClosePopup = false;
208	this.useCompare = false;
209	this.visual = {
210		ID: '',
211		PICT_ID: '',
212		SECOND_PICT_ID: '',
213		QUANTITY_ID: '',
214		QUANTITY_UP_ID: '',
215		QUANTITY_DOWN_ID: '',
216		STORE_QUANTITY: '',
217		PRICE_ID: '',
218		PRICE_OLD_ID: '',
219		DSC_PERC: '',
220		SECOND_DSC_PERC: '',
221		DISPLAY_PROP_DIV: '',
222		BASKET_PROP_DIV: ''
223	};
224	this.product = {
225		checkQuantity: false,
226		maxQuantity: 0,
227		stepQuantity: 1,
228		isDblQuantity: false,
229		canBuy: true,
230		canSubscription: true,
231		name: '',
232		pict: {},
233		id: 0,
234		addUrl: '',
235		buyUrl: ''
236	};
237
238	this.basketMode = '';
239	this.basketData = {
240		useProps: false,
241		emptyProps: false,
242		quantity: 'quantity',
243		props: 'prop',
244		basketUrl: '',
245		sku_props: '',
246		sku_props_var: 'basket_props',
247		add_url: '',
248		buy_url: ''
249	};
250
251	this.compareData = {
252		compareUrl: '',
253		comparePath: ''
254	};
255
256	this.defaultPict = {
257		pict: null,
258		secondPict: null
259	};
260
261	this.checkQuantity = false;
262	this.maxQuantity = 0;
263	this.stepQuantity = 1;
264	this.defaultCount = 1;
265	this.isDblQuantity = false;
266	this.canBuy = true;
267	this.currentBasisPrice = {};
268	this.canSubscription = true;
269	this.precision = 6;
270	this.precisionFactor = Math.pow(10,this.precision);
271
272	this.currentPriceMode = '';
273	this.currentPrices = [];
274	this.currentPriceSelected = 0;
275	this.currentQuantityRanges = [];
276	this.currentQuantityRangeSelected = 0;
277
278	this.offers = [];
279	this.offerNum = 0;
280	this.treeProps = [];
281	this.obTreeRows = [];
282	this.showCount = [];
283	this.showStart = [];
284	this.selectedValues = {};
285
286	this.obProduct = null;
287	this.obQuantity = null;
288	this.obQuantityUp = null;
289	this.obQuantityDown = null;
290	this.obPict = null;
291	this.obSecondPict = null;
292	this.obPrice = null;
293	this.obTree = null;
294	this.obBuyBtn = null;
295	this.obBasketBtn = null;
296	this.obBasketActions = null;
297	this.obNotAvail = null;
298	this.obDscPerc = null;
299	this.obSecondDscPerc = null;
300	this.obSkuProps = null;
301	this.obMeasure = null;
302	this.obCompare = null;
303
304	this.obPopupWin = null;
305	this.basketUrl = '';
306	this.basketParams = {};
307
308	this.treeRowShowSize = 5;
309	this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 };
310	this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 };
311
312	this.lastElement = false;
313	this.containerHeight = 0;
314
315	this.errorCode = 0;
316
317	if ('object' === typeof arParams)
318	{
319		this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
320		this.showQuantity = arParams.SHOW_QUANTITY;
321		this.showAbsent = arParams.SHOW_ABSENT;
322		this.secondPict = !!arParams.SECOND_PICT;
323		this.showOldPrice = !!arParams.SHOW_OLD_PRICE;
324		this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT;
325		this.showSkuProps = !!arParams.SHOW_SKU_PROPS;
326		if (!!arParams.ADD_TO_BASKET_ACTION)
327		{
328			this.basketAction = arParams.ADD_TO_BASKET_ACTION;
329		}
330		this.showClosePopup = !!arParams.SHOW_CLOSE_POPUP;
331		this.useCompare = !!arParams.DISPLAY_COMPARE;
332
333		this.visual = arParams.VISUAL;
334		this.defaultCount = arParams.DEFAULT_COUNT;
335		this.basketLinkURL = arParams.BASKET_URL;
336		switch (this.productType)
337		{
338			case 1://product
339			case 2://set
340				if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
341				{
342					if (this.showQuantity)
343					{
344						this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
345						this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
346						if (this.product.checkQuantity)
347						{
348							this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
349						}
350						this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
351
352						this.checkQuantity = this.product.checkQuantity;
353						this.isDblQuantity = this.product.isDblQuantity;
354						this.maxQuantity = this.product.maxQuantity;
355						this.stepQuantity = this.product.stepQuantity;
356						if (this.isDblQuantity)
357						{
358							this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor;
359						}
360					}
361					this.product.canBuy = arParams.PRODUCT.CAN_BUY;
362					this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
363					if (!!arParams.PRODUCT.BASIS_PRICE)
364					{
365						this.currentBasisPrice = arParams.PRODUCT.BASIS_PRICE;
366					}
367
368					this.canBuy = this.product.canBuy;
369					this.canSubscription = this.product.canSubscription;
370
371					this.product.name = arParams.PRODUCT.NAME;
372					this.product.pict = arParams.PRODUCT.PICT;
373					this.product.id = arParams.PRODUCT.ID;
374					if (!!arParams.PRODUCT.ADD_URL)
375					{
376						this.product.addUrl = arParams.PRODUCT.ADD_URL;
377					}
378					if (!!arParams.PRODUCT.BUY_URL)
379					{
380						this.product.buyUrl = arParams.PRODUCT.BUY_URL;
381					}
382					if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
383					{
384						this.basketData.useProps = !!arParams.BASKET.ADD_PROPS;
385						this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS;
386					}
387				}
388				else
389				{
390					this.errorCode = -1;
391				}
392				break;
393			case 3://sku
394				if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
395				{
396					if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
397					{
398						this.product.name = arParams.PRODUCT.NAME;
399						this.product.id = arParams.PRODUCT.ID;
400					}
401					this.offers = arParams.OFFERS;
402					this.offerNum = 0;
403					if (!!arParams.OFFER_SELECTED)
404					{
405						this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
406					}
407					if (isNaN(this.offerNum))
408					{
409						this.offerNum = 0;
410					}
411					if (!!arParams.TREE_PROPS)
412					{
413						this.treeProps = arParams.TREE_PROPS;
414					}
415					if (!!arParams.DEFAULT_PICTURE)
416					{
417						this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
418						this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
419					}
420				}
421				else
422				{
423					this.errorCode = -1;
424				}
425				break;
426			default:
427				this.errorCode = -1;
428		}
429		if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
430		{
431			if (!!arParams.BASKET.QUANTITY)
432			{
433				this.basketData.quantity = arParams.BASKET.QUANTITY;
434			}
435			if (!!arParams.BASKET.PROPS)
436			{
437				this.basketData.props = arParams.BASKET.PROPS;
438			}
439			if (!!arParams.BASKET.BASKET_URL)
440			{
441				this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
442			}
443			if (3 === this.productType)
444			{
445				if (!!arParams.BASKET.SKU_PROPS)
446				{
447					this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
448				}
449			}
450			if (!!arParams.BASKET.ADD_URL_TEMPLATE)
451			{
452				this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE;
453			}
454			if (!!arParams.BASKET.BUY_URL_TEMPLATE)
455			{
456				this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE;
457			}
458			if (this.basketData.add_url === '' && this.basketData.buy_url === '')
459			{
460				this.errorCode = -1024;
461			}
462		}
463		if (this.useCompare)
464		{
465			if (!!arParams.COMPARE && typeof(arParams.COMPARE) === 'object')
466			{
467				if (!!arParams.COMPARE.COMPARE_PATH)
468				{
469					this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH;
470				}
471				if (!!arParams.COMPARE.COMPARE_URL_TEMPLATE_DEL)
472				{
473					this.compareData.compareUrlDel = arParams.COMPARE.COMPARE_URL_TEMPLATE_DEL;
474				}
475				if (!!arParams.COMPARE.COMPARE_URL_TEMPLATE)
476				{
477					this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE;
478				}
479				else
480				{
481					this.useCompare = false;
482				}
483			}
484			else
485			{
486				this.useCompare = false;
487			}
488		}
489
490		this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT);
491	}
492	if (0 === this.errorCode)
493	{
494		BX.ready(BX.delegate(this.Init,this));
495	}
496};
497
498window.JCCatalogSection.prototype.Init = function()
499{
500	var i = 0,
501		strPrefix = '',
502		TreeItems = null;
503
504	this.obProduct = BX(this.visual.ID);
505	if (!this.obProduct)
506	{
507		this.errorCode = -1;
508	}
509	this.obPict = BX(this.visual.PICT_ID);
510	if (!this.obPict)
511	{
512		this.errorCode = -2;
513	}
514	if (this.secondPict && !!this.visual.SECOND_PICT_ID)
515	{
516		this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
517	}
518	this.storeQuanity = BX(this.visual.STORE_QUANTITY);
519	this.obPrice = BX(this.visual.PRICE_ID);
520	this.obPriceOld = BX(this.visual.PRICE_OLD_ID);
521	if (!this.obPrice)
522	{
523		this.errorCode = -16;
524	}
525	if (this.showQuantity && !!this.visual.QUANTITY_ID)
526	{
527		this.obQuantity = BX(this.visual.QUANTITY_ID);
528		if (!!this.visual.QUANTITY_UP_ID)
529		{
530			this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
531		}
532		if (!!this.visual.QUANTITY_DOWN_ID)
533		{
534			this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
535		}
536	}
537	if (3 === this.productType)
538	{
539		if (!!this.visual.TREE_ID)
540		{
541			this.obTree = BX(this.visual.TREE_ID);
542			if (!this.obTree)
543			{
544				this.errorCode = -256;
545			}
546			strPrefix = this.visual.TREE_ITEM_ID;
547			for (i = 0; i < this.treeProps.length; i++)
548			{
549				this.obTreeRows[i] = {
550					LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
551					CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
552				};
553				if (!this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
554				{
555					this.errorCode = -512;
556					break;
557				}
558			}
559		}
560		if (!!this.visual.QUANTITY_MEASURE)
561		{
562			this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
563		}
564	}
565
566	this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID);
567	if (!!this.obBasketActions)
568	{
569		if (!!this.visual.BUY_ID)
570		{
571			this.obBuyBtn = BX(this.visual.BUY_ID);
572		}
573		if (!!this.visual.BASKET_LINK)
574		{
575			this.obBasketBtn = BX(this.visual.BASKET_LINK);
576		}
577	}
578	this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS);
579
580	if (this.showPercent)
581	{
582		if (!!this.visual.DSC_PERC)
583		{
584			this.obDscPerc = BX(this.visual.DSC_PERC);
585		}
586		if (this.secondPict && !!this.visual.SECOND_DSC_PERC)
587		{
588			this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
589		}
590	}
591
592	if (this.showSkuProps)
593	{
594		if (!!this.visual.DISPLAY_PROP_DIV)
595		{
596			this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
597		}
598	}
599
600	if (0 === this.errorCode)
601	{
602		if (this.showQuantity)
603		{
604			if (!!this.obQuantityUp)
605			{
606				BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
607			}
608			if (!!this.obQuantityDown)
609			{
610				BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
611			}
612			if (!!this.obQuantity)
613			{
614				BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
615			}
616		}
617		switch (this.productType)
618		{
619			case 1://product
620				break;
621			case 3://sku
622				for(var key in this.skuVisualParams){
623					var TreeItems = BX.findChildren(this.obTree, {tagName: this.skuVisualParams[key].TAG_BIND}, true);
624					if (!!TreeItems && 0 < TreeItems.length){
625						for (i = 0; i < TreeItems.length; i++){
626							$(TreeItems[i]).on(this.skuVisualParams[key].EVENT, BX.delegate(this.SelectOfferProp, this));
627							//BX.bind(TreeItems[i], this.skuVisualParams[key].EVENT, BX.delegate(this.SelectOfferProp, this));
628						}
629					}
630				}
631				this.SetCurrent('init');
632				break;
633		}
634		// $(this.obProduct).find(".read_more.to-cart").on('click', BX.delegate(this.Add2Basket, this));
635		if (!!this.obBuyBtn)
636		{
637			if (this.basketAction === 'ADD')
638			{
639				// BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Add2Basket, this));
640
641
642			}
643			else
644			{
645				BX.bind(this.obBuyBtn, 'click', BX.delegate(this.BuyBasket, this));
646			}
647		}
648		if (this.useCompare){
649			this.obCompare = BX(this.visual.COMPARE_LINK_ID);
650		}
651	}
652};
653
654window.JCCatalogSection.prototype.checkHeight = function()
655{
656	this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
657	if (isNaN(this.containerHeight)){
658		this.containerHeight = 0;
659	}
660};
661
662window.JCCatalogSection.prototype.setHeight = function()
663{
664	if (0 < this.containerHeight){
665		BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}});
666	}
667};
668
669window.JCCatalogSection.prototype.clearHeight = function()
670{
671	BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}});
672};
673
674window.JCCatalogSection.prototype.QuantityUp = function()
675{
676	var curValue = 0,
677		boolSet = true,
678		calcPrice;
679
680	if (0 === this.errorCode && this.showQuantity && this.canBuy)
681	{
682		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
683		if (!isNaN(curValue))
684		{
685			curValue += this.stepQuantity;
686			if (this.checkQuantity)
687			{
688				if (curValue > this.maxQuantity)
689				{
690					boolSet = false;
691				}
692			}
693			if (boolSet)
694			{
695				if (this.isDblQuantity)
696				{
697					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
698				}
699				this.obQuantity.value = curValue;
700			}
701		}
702	}
703};
704
705window.JCCatalogSection.prototype.QuantityDown = function()
706{
707	var curValue = 0,
708		boolSet = true,
709		calcPrice;
710
711	if (0 === this.errorCode && this.showQuantity && this.canBuy)
712	{
713		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10));
714		if (!isNaN(curValue))
715		{
716			curValue -= this.stepQuantity;
717			if (curValue < this.stepQuantity)
718			{
719				boolSet = false;
720			}
721			if (boolSet)
722			{
723				if (this.isDblQuantity)
724				{
725					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
726				}
727				this.obQuantity.value = curValue;
728			}
729		}
730	}
731};
732
733window.JCCatalogSection.prototype.QuantityChange = function()
734{
735	var curValue = 0,
736		calcPrice,
737		intCount,
738		count;
739
740	if (0 === this.errorCode && this.showQuantity)
741	{
742		if (this.canBuy)
743		{
744			curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
745			if (!isNaN(curValue))
746			{
747				if (this.checkQuantity)
748				{
749					if (curValue > this.maxQuantity)
750					{
751						curValue = this.maxQuantity;
752					}
753				}
754				if (curValue < this.stepQuantity)
755				{
756					curValue = this.stepQuantity;
757				}
758				else
759				{
760					count = curValue/this.stepQuantity;
761					intCount = parseInt(count, 10);
762					if (isNaN(intCount))
763					{
764						intCount = 1;
765						count = 1.1;
766					}
767					if (count > intCount)
768					{
769						curValue = (intCount <= 1 ? this.stepQuantity : intCount*this.stepQuantity);
770						curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
771					}
772				}
773				this.obQuantity.value = curValue;
774			}
775			else
776			{
777				this.obQuantity.value = this.stepQuantity;
778			}
779		}
780		else
781		{
782			this.obQuantity.value = this.stepQuantity;
783		}
784	}
785};
786
787window.JCCatalogSection.prototype.QuantitySet = function(index)
788{
789	if (0 === this.errorCode)
790	{
791		this.canBuy = this.offers[index].CAN_BUY;
792		this.currentPriceMode = this.offers[index].ITEM_PRICE_MODE;
793		this.currentPrices = this.offers[index].ITEM_PRICES;
794		this.currentPriceSelected = this.offers[index].ITEM_PRICE_SELECTED;
795		this.currentQuantityRanges = this.offers[index].ITEM_QUANTITY_RANGES;
796		this.currentQuantityRangeSelected = this.offers[index].ITEM_QUANTITY_RANGE_SELECTED;
797
798		if (this.canBuy)
799		{
800			if (!!this.obBasketActions)
801			{
802				BX.style(this.obBasketActions, 'display', '');
803			}
804			if (!!this.obNotAvail)
805			{
806				BX.style(this.obNotAvail, 'display', 'none');
807			}
808		}
809		else
810		{
811			if (!!this.obBasketActions)
812			{
813				//BX.style(this.obBasketActions, 'display', 'none');
814				BX.style(this.obBasketActions, 'opacity', '0');
815				BX.style(BX.findParent(BX(this.obQuantity), { 'class':'counter_block' }), 'display', 'none');
816			}
817			if (!!this.obNotAvail)
818			{
819				BX.style(this.obNotAvail, 'display', '');
820			}
821		}
822		if (this.showQuantity)
823		{
824			this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
825			this.checkQuantity = this.offers[index].CHECK_QUANTITY;
826			if (this.isDblQuantity)
827			{
828				this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY);
829				this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor;
830			}
831			else
832			{
833				this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10);
834				this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10);
835			}
836			if(!!this.obQuantity){
837				this.obQuantity.value = this.defaultCount;
838				this.obQuantity.disabled = !this.canBuy;
839			}
840			if (!!this.obMeasure)
841			{
842				if (!!this.offers[index].MEASURE)
843				{
844					BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
845				}
846				else
847				{
848					BX.adjust(this.obMeasure, { html : ''});
849				}
850			}
851		}
852		this.currentBasisPrice = this.offers[index].BASIS_PRICE;
853	}
854};
855
856window.JCCatalogSection.prototype.SelectOfferProp = function()
857{
858	var i = 0,
859		value = '',
860		strTreeValue = '',
861		arTreeItem = [],
862		RowItems = null,
863		target = BX.proxy_context;
864	if(typeof target.options !== 'undefined' && typeof target.options[target.selectedIndex] !== 'undefined')
865		target = target.options[target.selectedIndex];
866
867	if (!!target && target.hasAttribute('data-treevalue'))
868	{
869		strTreeValue = target.getAttribute('data-treevalue');
870		propModes = target.getAttribute('data-showtype');
871		arTreeItem = strTreeValue.split('_');
872		if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
873		{
874			RowItems = BX.findChildren(target.parentNode, {tagName: this.skuVisualParams[propModes.toUpperCase()].TAG}, false);
875
876			if (!!RowItems && 0 < RowItems.length)
877			{
878				for (i = 0; i < RowItems.length; i++)
879				{
880					value = RowItems[i].getAttribute('data-onevalue');
881
882					// for SELECTBOXES
883					if(propModes == 'TEXT'){
884						if (value === arTreeItem[1]){
885							RowItems[i].setAttribute('selected', 'selected');
886						}else{
887							RowItems[i].removeAttribute('selected');
888						}
889					}else{
890						if (value === arTreeItem[1]){
891							$(RowItems[i]).addClass(this.skuVisualParams[propModes.toUpperCase()].ACTIVE_CLASS);
892						}else{
893							$(RowItems[i]).removeClass(this.skuVisualParams[propModes.toUpperCase()].ACTIVE_CLASS);
894						}
895					}
896				}
897			}
898		}
899	}
900};
901
902window.JCCatalogSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
903{
904	var strName = '',
905		arShowValues = false,
906		i, j,
907		arCanBuyValues = [],
908		allValues = [],
909		index = -1,
910		arFilter = {},
911		tmpFilter = [];
912
913	for (i = 0; i < this.treeProps.length; i++)
914	{
915		if (this.treeProps[i].ID === strPropID)
916		{
917			index = i;
918			break;
919		}
920	}
921
922	if (-1 < index)
923	{
924		for (i = 0; i < index; i++)
925		{
926			strName = 'PROP_'+this.treeProps[i].ID;
927			arFilter[strName] = this.selectedValues[strName];
928		}
929		strName = 'PROP_'+this.treeProps[index].ID;
930		arShowValues = this.GetRowValues(arFilter, strName);
931		if (!arShowValues)
932		{
933			return false;
934		}
935		if (!BX.util.in_array(strPropValue, arShowValues))
936		{
937			return false;
938		}
939		arFilter[strName] = strPropValue;
940		for (i = index+1; i < this.treeProps.length; i++)
941		{
942			strName = 'PROP_'+this.treeProps[i].ID;
943			arShowValues = this.GetRowValues(arFilter, strName);
944
945			if (!arShowValues)
946			{
947				break;
948			}
949			allValues = [];
950			if (this.showAbsent)
951			{
952				arCanBuyValues = [];
953				tmpFilter = [];
954				tmpFilter = BX.clone(arFilter, true);
955				for (j = 0; j < arShowValues.length; j++)
956				{
957					tmpFilter[strName] = arShowValues[j];
958					allValues[allValues.length] = arShowValues[j];
959					if (this.GetCanBuy(tmpFilter))
960					{
961						arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
962					}
963				}
964			}
965			else
966			{
967				arCanBuyValues = arShowValues;
968			}
969
970			if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
971			{
972				arFilter[strName] = this.selectedValues[strName];
973			}
974			else
975			{
976				if (this.showAbsent)
977				{
978					arFilter[strName] = (arCanBuyValues.length ? arCanBuyValues[0] : allValues[0]);
979				}
980				else
981				{
982					arFilter[strName] = arCanBuyValues[0];
983				}
984			}
985
986			this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
987		}
988		this.selectedValues = arFilter;
989		this.ChangeInfo('click');
990	}
991	return true;
992};
993
994window.JCCatalogSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
995{
996	var i = 0,
997		showI = 0,
998		value = '',
999		countShow = 0,
1000		strNewLen = '',
1001		obData = {},
1002		obDataCont = {},
1003		pictMode = false,
1004		extShowMode = false,
1005		isCurrent = false,
1006		selectIndex = 0,
1007		obLeft = this.treeEnableArrow,
1008		obRight = this.treeEnableArrow,
1009		currentShowStart = 0,
1010		RowItems = null;
1011
1012	if (-1 < intNumber && intNumber < this.obTreeRows.length){
1013		propMode = this.treeProps[intNumber].DISPLAY_TYPE;
1014		RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: this.skuVisualParams[propMode].TAG}, false);
1015		if (!!RowItems && 0 < RowItems.length){
1016			selectMode = ('SELECT' === this.treeProps[intNumber].DISPLAY_TYPE);
1017			countShow = showID.length;
1018			obData = {
1019				style: {},
1020				props: {
1021					disabled: '',
1022					selected: '',
1023				},
1024			};
1025			obDataCont = {
1026				style: {},
1027			};
1028
1029			for (i = 0; i < RowItems.length; i++){
1030				value = RowItems[i].getAttribute('data-onevalue');
1031				isCurrent = (value === activeID && value !=0);
1032				if (BX.util.in_array(value, canBuyID)){
1033					obData.props.className = (isCurrent ? this.skuVisualParams[propMode].ACTIVE_CLASS : '');
1034				}else{
1035					obData.props.className = (isCurrent ? this.skuVisualParams[propMode].ACTIVE_CLASS+' '+this.skuVisualParams[propMode].HI
1035DE_CLASS : this.skuVisualParams[propMode].HIDE_CLASS);
1036				}
1037				// obData.props.className = (isCurrent ? this.skuVisualParams[propMode].ACTIVE_CLASS : '');
1038
1039				if(selectMode){
1040					obData.props.disabled = 'disabled';
1041					obData.props.selected = (isCurrent ? 'selected' : '');
1042				}else{
1043					obData.style.display = 'none';
1044				}
1045
1046				if (BX.util.in_array(value, showID)){
1047					if(selectMode){
1048						obData.props.disabled = '';
1049					}else{
1050						obData.style.display = '';
1051					}
1052					if (isCurrent){
1053						selectIndex = showI;
1054					}
1055					showI++;
1056				}
1057				BX.adjust(RowItems[i], obData);
1058			}
1059
1060			if(!showI)
1061				obDataCont.style.display = 'none';
1062			else
1063				obDataCont.style.display = '';
1064			BX.adjust(this.obTreeRows[intNumber].CONT, obDataCont);
1065
1066			if(selectMode){
1067				if($(this.obTreeRows[intNumber].LIST).parent().hasClass('ik_select'))
1068					$(this.obTreeRows[intNumber].LIST).ikSelect('reset');
1069			}
1070
1071			this.showCount[intNumber] = countShow;
1072			this.showStart[intNumber] = currentShowStart;
1073		}
1074	}
1075};
1076
1077window.JCCatalogSection.prototype.GetRowValues = function(arFilter, index)
1078{
1079	var i = 0,
1080		j,
1081		arValues = [],
1082		boolSearch = false,
1083		boolOneSearch = true;
1084
1085	if (0 === arFilter.length)
1086	{
1087		for (i = 0; i < this.offers.length; i++)
1088		{
1089			if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
1090			{
1091				arValues[arValues.length] = this.offers[i].TREE[index];
1092			}
1093		}
1094		boolSearch = true;
1095	}
1096	else
1097	{
1098		for (i = 0; i < this.offers.length; i++)
1099		{
1100			boolOneSearch = true;
1101			for (j in arFilter)
1102			{
1103				if (arFilter[j] !== this.offers[i].TREE[j])
1104				{
1105					boolOneSearch = false;
1106					break;
1107				}
1108			}
1109			if (boolOneSearch)
1110			{
1111				if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
1112				{
1113					arValues[arValues.length] = this.offers[i].TREE[index];
1114				}
1115				boolSearch = true;
1116			}
1117		}
1118	}
1119	return (boolSearch ? arValues : false);
1120};
1121
1122window.JCCatalogSection.prototype.GetCanBuy = function(arFilter)
1123{
1124	var i = 0,
1125		j,
1126		boolSearch = false,
1127		boolOneSearch = true;
1128
1129	for (i = 0; i < this.offers.length; i++)
1130	{
1131		boolOneSearch = true;
1132		for (j in arFilter)
1133		{
1134			if (arFilter[j] !== this.offers[i].TREE[j])
1135			{
1136				boolOneSearch = false;
1137				break;
1138			}
1139		}
1140		if (boolOneSearch)
1141		{
1142			if (this.offers[i].CAN_BUY)
1143			{
1144				boolSearch = true;
1145				break;
1146			}
1147		}
1148	}
1149	return boolSearch;
1150};
1151
1152window.JCCatalogSection.prototype.SetCurrent = function(type)
1153{
1154	var i = 0,
1155		j = 0,
1156		arCanBuyValues = [],
1157		strName = '',
1158		arShowValues = false,
1159		arFilter = {},
1160		tmpFilter = [],
1161		current = this.offers[this.offerNum].TREE;
1162	for (i = 0; i < this.treeProps.length; i++)
1163	{
1164		strName = 'PROP_'+this.treeProps[i].ID;
1165		arShowValues = this.GetRowValues(arFilter, strName);
1166		if (!arShowValues)
1167		{
1168			break;
1169		}
1170		if (BX.util.in_array(current[strName], arShowValues))
1171		{
1172			arFilter[strName] = current[strName];
1173		}
1174		else
1175		{
1176			arFilter[strName] = arShowValues[0];
1177			this.offerNum = 0;
1178		}
1179		if (this.showAbsent)
1180		{
1181			arCanBuyValues = [];
1182			tmpFilter = [];
1183			tmpFilter = BX.clone(arFilter, true);
1184			for (j = 0; j < arShowValues.length; j++)
1185			{
1186				tmpFilter[strName] = arShowValues[j];
1187				if (this.GetCanBuy(tmpFilter))
1188				{
1189					arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
1190				}
1191			}
1192		}
1193		else
1194		{
1195			arCanBuyValues = arShowValues;
1196		}
1197		this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
1198	}
1199	this.selectedValues = arFilter;
1200	this.ChangeInfo(type);
1201};
1202
1203window.JCCatalogSection.prototype.ChangeInfo = function(type)
1204{
1205	var i = 0,
1206		j,
1207		index = -1,
1208		compareParams,
1209		boolOneSearch = true;
1210
1211	for (i = 0; i < this.offers.length; i++)
1212	{
1213		boolOneSearch = true;
1214		for (j in this.selectedValues)
1215		{
1216			if (this.selectedValues[j] !== this.offers[i].TREE[j])
1217			{
1218				boolOneSearch = false;
1219				break;
1220			}
1221		}
1222		if (boolOneSearch)
1223		{
1224			index = i;
1225			break;
1226		}
1227	}
1228	if (-1 < index){
1229		if (!!this.obPict){
1230			var obData = {
1231				attrs: {}
1232			};
1233
1234			if (!!this.offers[index].PREVIEW_PICTURE){
1235				obData.attrs.src = this.offers[index].PREVIEW_PICTURE.SRC;
1236			}else{
1237				obData.attrs.src = this.defaultPict.pict.SRC;
1238			}
1239			BX.adjust(BX.findChild(this.obPict, {"tag": "img"}), obData);
1240		}
1241		if (this.secondPict && !!this.obSecondPict)
1242		{
1243			if (!!this.offers[index].PREVIEW_PICTURE_SECOND)
1244			{
1245				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}});
1246			}
1247			else if (!!this.offers[index].PREVIEW_PICTURE.SRC)
1248			{
1249				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1250			}
1251			else if (!!this.defaultPict.secondPict)
1252			{
1253				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}});
1254			}
1255			else
1256			{
1257				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1258			}
1259		}
1260		if (this.showSkuProps && !!this.obSkuProps)
1261		{
1262			if (0 === this.offers[index].DISPLAY_PROPERTIES.length)
1263			{
1264				BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
1265			}
1266			else
1267			{
1268				BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
1269			}
1270		}
1271
1272		if($(this.obProduct).find('.article_block'))
1273		{
1274			var article_text = (this.offers[index].ARTICLE ? this.offers[index].ARTICLE : '');
1275			if(!article_text && this.offers[index].SHOW_ARTICLE_SKU == 'Y' && this.offers[index].ARTICLE_SKU)
1276				article_text = this.offers[index].ARTICLE_SKU;
1277			$(this.obProduct).find('.article_block').text(article_text);
1278		}
1279		$(this.obBuyBtn).data("item", this.offers[index].ID);
1280		$(this.obBasketBtn).data("item", this.offers[index].ID);
1281
1282		$(this.obBasketActions).closest('.counter_wrapp').css('opacity', 0);
1283
1284		this.setQuantityStore(this.offers[index].MAX_QUANTITY, this.offers[index].AVAILIABLE.TEXT);
1285		this.offerNum = index;
1286		this.QuantitySet(this.offerNum);
1287
1288		$(this.obProduct).find('.item-title a').attr('href', this.offers[this.offerNum].URL);
1289		$(this.obProduct).find('.image_wrapper_block > a').attr('href', this.offers[this.offerNum].URL);
1290
1291		/*quantity discount start*/
1292
1293		if($(this.obProduct).find('.quantity_block .values').length)
1294			$(this.obProduct).find('.quantity_block .values .item span.value').text(this.offers[index].MAX_QUANTITY).css({'opacity':'1'});
1295
1296		if(this.offers[index].SHOW_DISCOUNT_TIME_EACH_SKU == 'Y')
1297			initCountdownTime($(this.obProduct), this.offers[index].DISCOUNT_ACTIVE);
1298
1299		/*quantity discount end*/
1300
1301		var obj=this.offers[index],
1302			th=$(this.obProduct).closest('.catalog_item_wrapp'),
1303			_th = this;
1304		if(typeof type !== 'undefined')
1305			this.init_type = type;
1306
1307		if(typeof arBasketAspro !=="undefined"){
1308			this.setActualDataBlock(th, obj);
1309		}else{
1310			if(typeof window.frameCacheVars !== "undefined"){
1311				BX.addCustomEvent("onFrameDataReceived", function(){
1312					_th.setActualDataBlock(th, obj);
1313				});
1314			}
1315		}
1316	}
1317};
1318
1319/*set blocks start*/
1320window.JCCatalogSection.prototype.setActualDataBlock = function(th, obj)
1321{
1322	/*like block start*/
1323	this.setLikeBlock(th, '.like_icons .wish_item_button', obj, 'DELAY');
1324	this.setLikeBlock(th, '.like_icons .compare_item_button',obj, 'COMPARE');
1325	/*like block end*/
1326
1327	/*buy block start*/
1328	this.setBuyBlock(th, obj);
1329	/*buy block end*/
1330}
1331/*set blocks end*/
1332
1333/*set compare/wish*/
1334window.JCCatalogSection.prototype.setLikeBlock = function(th, className, obj, type)
1335{
1336	var block=th;
1337	if(type=="DELAY"){
1338		if(obj.CAN_BUY){
1339			block.find(className).css('display','block');
1340		}else{
1341			block.find(className).hide();
1342		}
1343	}
1344	block.find(className).attr('data-item', obj.ID);
1345	block.find(className).find('span').attr('data-item', obj.ID);
1346	if(arBasketAspro[type]){
1347		block.find(className).find('.to').removeClass('added').css('display','block');
1348		block.find(className).find('.in').hide();
1349
1350		if(arBasketAspro[type][obj.ID]!==undefined){
1351			block.find(className).find('.to').hide();
1352			block.find(className).find('.in').css('display','block');
1353		}
1354	}
1355}
1356
1357/*set buy*/
1358window.JCCatalogSection.prototype.setBuyBlock = function(th, obj)
1359{
1360	var buyBlock=th.find('.offer_buy_block'),
1361		input_value = obj.CONFIG.MIN_QUANTITY_BUY;
1362
1363	if(buyBlock.find('.counter_wrapp .counter_block').length){
1364		buyBlock.find('.counter_wrapp .counter_block').attr('data-item', obj.ID);
1365	}
1366
1367	if(this.offers[this.offerNum].offer_set_quantity)
1368		input_value = this.offers[this.offerNum].offer_set_quantity;
1369
1370	if((obj.CONFIG.OPTIONS.USE_PRODUCT_QUANTITY_DETAIL && obj.CONFIG.ACTION == "ADD") && obj.CAN_BUY){
1371		var max=(obj.CONFIG.MAX_QUANTITY_BUY>0 ? "data-max='"+obj.CONFIG.MAX_QUANTITY_BUY+"'" : ""),
1372			counterHtml='<span class="minus">-</span>'+
1373				'<input type="text" class="text" name="'+obj.PRODUCT_QUANTITY_VARIABLE+'" value="'+input_value+'" />'+
1374				'<span class="plus" '+max+'>+</span>';
1375		if(arBasketAspro["BASKET"] && arBasketAspro["BASKET"][obj.ID]!==undefined){
1376			if(buyBlock.find('.counter_wrapp .counter_block').length){
1377				buyBlock.find('.counter_wrapp .counter_block').hide();
1378			}else{
1379				buyBlock.find('.counter_wrapp').prepend('<div class="counter_block" data-item="'+obj.ID+'"></div>');
1380				buyBlock.find('.counter_wrapp .counter_block').html(counterHtml).hide();
1381			}
1382		}else{
1383			if(buyBlock.find('.counter_wrapp .counter_block').length){
1384				buyBlock.find('.counter_wrapp .counter_block').html(counterHtml).show();
1385			}else{
1386				buyBlock.find('.counter_wrapp').prepend('<div class="counter_block" data-item="'+obj.ID+'"></div>');
1387				buyBlock.find('.counter_wrapp .counter_block').html(counterHtml);
1388			}
1389		}
1390	}else{
1391		if(buyBlock.find('.counter_wrapp .counter_block').length){
1392			buyBlock.find('.counter_wrapp .counter_block').hide();
1393		}
1394	}
1395
1396	var className=((obj.CONFIG.ACTION == "ORDER") || !obj.CAN_BUY || !obj.CONFIG.OPTIONS.USE_PRODUCT_QUANTITY_DETAIL || (
1396obj.CONFIG.ACTION == "SUBSCRIBE" && obj.CATALOG_SUBSCRIBE == "Y") ? "wide" : "" ),
1397		buyBlockBtn=$('<div class="button_block"></div>');
1398
1399	if(buyBlock.find('.counter_wrapp').find('.button_block').length){
1400		if(arBasketAspro["BASKET"] && arBasketAspro["BASKET"][obj.ID]!==undefined){
1401			buyBlock.find('.counter_wrapp').find('.button_block').addClass('wide').html(obj.HTML);
1402			markProductAddBasket(obj.ID);
1403		}else{
1404			if(className){
1405				buyBlock.find('.counter_wrapp').find('.button_block').addClass('wide').html(obj.HTML);
1406				if(arBasketAspro["SUBSCRIBE"] && arBasketAspro["SUBSCRIBE"][obj.ID]!==undefined){
1407					markProductSubscribe(obj.ID);
1408				}
1409			}else{
1410				buyBlock.find('.counter_wrapp').find('.button_block').removeClass('wide').html(obj.HTML);
1411			}
1412		}
1413	}else{
1414		buyBlock.find('.counter_wrapp').append('<div class="button_block '+className+'">'+obj.HTML+'</div>');
1415		if(arBasketAspro["BASKET"] && arBasketAspro["BASKET"][obj.ID]!==undefined)
1416			markProductAddBasket(obj.ID);
1417		if(arBasketAspro["SUBSCRIBE"] && arBasketAspro["SUBSCRIBE"][obj.ID]!==undefined)
1418			markProductSubscribe(obj.ID);
1419	}
1420
1421	if(obj.CONFIG.ACTION !== "NOTHING"){
1422		if(obj.CONFIG.ACTION == "ADD" && obj.CAN_BUY && obj.SHOW_ONE_CLICK_BUY!="N"){
1423			var ocb='<span class="transparent big_btn type_block button one_click" data-offers="Y" data-item="'+obj.ID+'" data-iblockID="'+obj.IBLOCK_ID+'" data-quantity="'+obj.CONFIG.MIN_QUANTITY_BUY+'" data-props="'+obj.OFFER_PROPS+'" onclick="oneClickBuy('+obj.ID+', '+obj.IBLOCK_ID+', this)">'+
1424				'<span>'+obj.ONE_CLICK_BUY+'</span>'+
1425				'</span>';
1426			if(buyBlock.find('.wrapp_one_click').length){
1427				buyBlock.find('.wrapp_one_click').html(ocb);
1428			}else{
1429				buyBlock.append('<div class="wrapp_one_click">'+ocb+'</div>');
1430			}
1431		}else{
1432			if(buyBlock.find('.wrapp_one_click').length){
1433				buyBlock.find('.wrapp_one_click').remove();
1434			}
1435		}
1436	}else{
1437		if(buyBlock.find('.wrapp_one_click').length){
1438			buyBlock.find('.wrapp_one_click').remove();
1439		}
1440	}
1441
1442	buyBlock.fadeIn();
1443
1444
1445	buyBlock.find('.counter_wrapp .counter_block input').data('product', 'ob'+this.obProduct.id);
1446	this.setPriceAction('', 'Y');
1447
1448	if(arNextOptions['THEME']['CHANGE_TITLE_ITEM'] == 'Y')
1449	{
1450		$(this.obProduct).find('.item-title a').text(obj.NAME);
1451	}
1452
1453	if('init_type' in this && this.init_type == 'click')
1454	{
1455		$('.catalog_block .catalog_item_wrapp .catalog_item .item-title').sliceHeight({resize: false});
1456		$('.catalog_block .catalog_item_wrapp .catalog_item .cost').sliceHeight({resize: false});
1457		$('.catalog_block .catalog_item_wrapp .item_info').sliceHeight({resize: false});
1458		$('.catalog_block .catalog_item_wrapp').sliceHeight({classNull: '.footer_button', resize: false});
1459	}
1460}
1461
1462/*get compare sku*/
1463window.JCCatalogSection.prototype.CompareCountResult = function(result)
1464{
1465	if(result.COMPARE_COUNT){
1466		for(var i in result.ITEMS){
1467			if(result.ITEMS[i]==this.offers[this.offerNum].ID){
1468				this.offers[this.offerNum].COMPARE_ACTIVE=true;
1469				break;
1470			}else{
1471				this.offers[this.offerNum].COMPARE_ACTIVE=false;
1472			}
1473		}
1474		if(this.offers[this.offerNum].COMPARE_ACTIVE){
1475			$(this.obCompare).find('.compare_item.to').hide();
1476			$(this.obCompare).find('.compare_item.added').show();
1477		}else{
1478			$(this.obCompare).find('.compare_item.added').hide();
1479			$(this.obCompare).find('.compare_item.to').show();
1480		}
1481	}
1482}
1483
1484/*get item info*/
1485window.JCCatalogSection.prototype.ItemInfoResult = function(result)
1486{
1487	if(result.HTML){
1488		$(this.obBasketActions).html(result.HTML);
1489		$(this.obBasketActions).show();
1490		this.obBuyBtn = BX(this.visual.BUY_ID);
1491		this.obBasketBtn = BX(this.visual.BASKET_LINK);
1492		this.obSubscribeBtn = BX(this.visual.SUBSCRIBE_ID);
1493		this.obSubscribedBtn = BX(this.visual.SUBSCRIBED_ID);
1494		BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Add2Basket, this));
1495		$(this.obBasketActions).removeClass('wide');
1496		this.ajax_type_item=result.BUYMISSINGGOODS;
1497		if(result.BUYMISSINGGOODS!="ADD" && !this.canBuy){
1498			$(this.obBasketActions).addClass('wide');
1499		}else{
1500			$(this.obQuantity).css('display','');
1501		}
1502	}
1503	//if(this.canBuy){
1504		basketParams = {
1505			ajax_action: 'Y'
1506		};
1507		BX.ajax.loadJSON(
1508			arNextOptions['SITE_DIR']+'ajax/get_basket_count.php',
1509			basketParams,
1510			BX.delegate(this.BasketCountResult, this)
1511		);
1512	//}
1513}
1514
1515/*get basket items*/
1516window.JCCatalogSection.prototype.BasketCountResult = function(result)
1517{
1518	//if(result.TOTAL_COUNT){
1519		for(var i in result.ITEMS){
1520			if(result.ITEMS[i].PRODUCT_ID==this.offers[this.offerNum].ID){
1521				this.offers[this.offerNum].BASKET_ACTIVE=true;
1522				break;
1523			}else{
1524				this.offers[this.offerNum].BASKET_ACTIVE=false;
1525			}
1526		}
1527		for(var i in result.SUBSCRIBE_ITEMS){
1528			if(result.SUBSCRIBE_ITEMS[i].PRODUCT_ID==this.offers[this.offerNum].ID){
1529				this.offers[this.offerNum].SUBSCRIBE_ACTIVE=true;
1530				break;
1531			}else{
1532				this.offers[this.offerNum].SUBSCRIBE_ACTIVE=false;
1533			}
1534		}
1535
1536		this.BasketStateRefresh();
1537	//}
1538}
1539
1540window.JCCatalogSection.prototype.BasketStateRefresh = function(buy_basket)
1541{
1542	/*if(this.offers[this.offerNum].SUBSCRIBE_ACTIVE){
1543		$(this.obBasketActions).addClass('wide');
1544		$(this.obSubscribeBtn).hide();
1545		$(this.obSubscribedBtn).show();
1546	}else{
1547		$(this.obBasketActions).addClass('wide');
1548		$(this.obSubscribedBtn).hide();
1549		$(this.obSubscribeBtn).show();
1550	}
1551	if(this.offers[this.offerNum].BASKET_ACTIVE){
1552		$(this.obBuyBtn).hide();
1553		$(this.obBasketBtn).show();
1554		$(this.obQuantity).closest('.counter_wrapp').find('.counter_block').hide();
1555		$(this.obBasketActions).addClass('wide');
1556	}else{
1557		$(this.obBasketActions).removeClass('wide');
1558		$(this.obBasketBtn).hide();
1559		$(this.obBuyBtn).show();
1560		if(this.ajax_type_item=="ADD" || this.canBuy)
1561			$(this.obQuantity).closest('.counter_wrapp').find('.counter_block').show();
1562
1563	}
1564	if(!this.canBuy){
1565		$(this.obBasketActions).addClass('wide');
1566	}*/
1567	if(this.offers[this.offerNum].SUBSCRIBE_ACTIVE){
1568		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .to-subscribe').hide();
1569		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .in-subscribe').show();
1570	}else{
1571		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .to-subscribe').show();
1572		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .in-subscribe').hide();
1573	}
1574	if(this.offers[this.offerNum].BASKET_ACTIVE){
1575		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID).addClass('wide');
1576		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .button_block').addClass('wide');
1577		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .to-cart').hide();
1578		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .in-cart').show();
1579		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .counter_block').hide();
1580	}else{
1581		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID).removeClass('wide');
1582		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .button_block').removeClass('wide');
1583		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .to-cart').show();
1584		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .in-cart').hide();
1585		$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID+' .counter_block').show();
1586
1587	}
1588	BX.style(this.obBasketActions, 'opacity', '1');
1589	$(this.obBasketActions).closest('.counter_wrapp').css('opacity', 1);
1590	if(buy_basket!== 'undefined' && buy_basket=="Y"){
1591		if($("#basket_line .basket_fly").length && $(window).outerWidth()>768)
1592		{
1593			// preAnimateBasketFly($("#basket_line .basket_fly"), 200, 333);
1594			basketFly('open');
1595		}
1596		else if($("#basket_line .cart").length)
1597		{
1598			if($("#basket_line .cart").is(".empty_cart"))
1599			{
1600				$("#basket_line .cart").removeClass("empty_cart").find(".cart_wrapp a.basket_link").removeAttr("href").addClass("cart-call");
1601				touchBasket('.cart:not(.empty_cart) .basket_block .link');
1602			}
1603			reloadTopBasket('add', $('#basket_line'), 200, 2000, 'Y');
1604			/*if($(window).outerWidth() > 520){
1605				//if(arNextOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
1606					preAnimateBasketPopup('', $('.card_popup_frame'), 0, 200);
1607				//}
1608			};*/
1609		}
1610		animateBasketLine(200);
1611	}
1612}
1613
1614window.JCCatalogSection.prototype.setPriceAction = function(change, sku)
1615{
1616	var measure = this.offers[this.offerNum].MEASURE && this.offers[this.offerNum].SHOW_MEASURE=="Y" ? this.offers[this.offerNum].MEASURE : '';
1617	var product = $(this.obProduct),
1618		check_quantity = '',
1619		is_sku = (typeof sku !== 'undefined' && sku == 'Y');
1620		
1621	this.offers[this.offerNum].offer_set_quantity = this.offers[this.offerNum].CONFIG.MIN_QUANTITY_BUY;			
1622	if($(product).find('input[name=quantity]').length)
1623		this.offers[this.offerNum].offer_set_quantity = $(product).find('input[name=quantity]').val();
1624
1625
1626	if(this.offers[this.offerNum].USE_PRICE_COUNT && this.offers[this.offerNum].PRICE_MATRIX)
1627	{
1628		this.checkPriceRange(this.offers[this.offerNum].offer_set_quantity);
1629		this.setPriceMatrix(this.offers[this.offerNum].PRICE_MATRIX);
1630	}
1631	else
1632	{
1633		if('PRICES' in this.offers[this.offerNum] && this.offers[this.offerNum].PRICES)		
1634			this.setPrice(this.offers[this.offerNum].PRICES, measure);
1635	}
1636
1637	if(arNextOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
1638	{
1639		if(this.offers[this.offerNum].check_quantity)
1640			check_quantity = 'Y';
1641		else
1642		{
1643			var check_quantity = ((typeof change !== 'undefined' && change == 'Y') ? change : '');
1644			if(check_quantity)
1645				this.offers[this.offerNum].check_quantity = true;
1646		}
1647		if(typeof this.currentPrices[this.currentPriceSelected] !== 'undefined')
1648			setPriceItem(product, this.offers[this.offerNum].offer_set_quantity, this.currentPrices[this.currentPriceSelected].PRICE, check_quantity, is_sku);
1649	}
1650}
1651
1652window.JCCatalogSection.prototype.setPriceMatrix = function(sPriceMatrix)
1653{
1654	var prices = '';
1655	if (!!this.obPrice)
1656	{
1657		var measure = this.offers[this.offerNum].MEASURE && this.offers[this.offerNum].SHOW_MEASURE=="Y" ? this.offers[this.offerNum].MEASURE : '',
1658			strPrice = '';
1659		strPrice = getCurrentPrice(this.currentPrices[this.currentPriceSelected].PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_PRICE);
1660		if(measure)
1661			strPrice += '<span class="price_measure">/'+measure+'</span>';
1662		$(this.obProduct).find('.not_matrix').hide();
1663		$(this.obProduct).find('.with_matrix .price_value_block').html(strPrice);
1664
1665		if (this.showOldPrice)
1666		{
1667			if(parseFloat(this.currentPrices[this.currentPriceSelected].BASE_PRICE) > parseFloat(this.currentPrices[this.currentPriceSelected].PRICE))
1668			{
1669				$(this.obProduct).find('.with_matrix .discount').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].BASE_PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_BASE_PRICE));
1670				$(this.obProduct).find('.with_matrix .discount').css('display', 'inline-block');
1671			}
1672			else
1673			{
1674				$(this.obProduct).find('.with_matrix .discount').html('');
1675				$(this.obProduct).find('.with_matrix .discount').css('display', 'none');
1676			}
1677		}
1678		else
1679		{
1680			$(this.obProduct).find('.with_matrix .discount').html('');
1681			$(this.obProduct).find('.with_matrix .discount').css('display', 'none');
1682		}
1683
1684		if(this.currentPrices[this.currentPriceSelected].PERCENT > 0)
1685		{
1686			$(this.obProduct).find('.with_matrix .sale_block .text .values_wrapper').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].DISCOUNT, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_DISCOUNT));
1687			$(this.obProduct).find('.with_matrix .sale_block').show();
1688		}
1689		else
1690		{
1691			$(this.obProduct).find('.with_matrix .sale_block').hide();
1692		}
1693		
1694		$(this.obProduct).find('.sale_block.normal').hide();
1695		$(this.obProduct).find('.with_matrix').show();
1696
1697		BX.adjust(this.obPrice, {html: sPriceMatrix});
1698
1699		var eventdata = {product: $(this.obProduct), measure: measure, config: this.config, offer: this.offers[this.offerNum], obPrice: this.currentPrices[this.currentPriceSelected]};
1700		BX.onCustomEvent('onAsproSkuSetPriceMatrix', [eventdata])
1701	}
1702}
1703
1704window.JCCatalogSection.prototype.setPrice = function(obPrices, measure)
1705{
1706	var strPrice,
1707		obData;
1708
1709	if (!!this.obPrice){
1710		var measure = this.offers[this.offerNum].MEASURE && this.offers[this.offerNum].SHOW_MEASURE=="Y" ? this.offers[this.offerNum].MEASURE : '',
1711			product = $(this.obProduct),
1712			obPrices = this.offers[this.offerNum].PRICES;
1713		if(typeof(obPrices) == 'object')
1714		{
1715			var strPrice = '',
1716				count = Object.keys(obPrices).length,
1717				arStikePrices = [];
1718
1719			if(arNextOptions['THEME']['DISCOUNT_PRICE'])
1720			{
1721				arStikePrices = arNextOptions['THEME']['DISCOUNT_PRICE'].split(',');
1722			}
1723
1724			strPrice = '<div class="offers_price_wrapper">';
1725			$(this.obProduct).find('.with_matrix').hide();
1726			$(this.obProduct).find('.not_matrix').show();
1727			for(var j in obPrices)
1728			{
1729				if(obPrices[j])
1730				{
1731					if('GROUP_NAME' in obPrices[j])
1732					{
1733						if(count > 1)
1734						{
1735							strPrice += '<div class="offers_price_title">';
1736							strPrice += obPrices[j].GROUP_NAME;
1737							strPrice += '</div>';
1738						}
1739					}
1740					let values_wrapper = (obPrices[j].DISCOUNT_VALUE>0)?getCurrentPrice(obPrices[j].DISCOUNT_VALUE, obPrices[j].CURRENCY, obPrices[j].PRINT_DISCOUNT_VALUE):'цена по запросу';
1741					strPrice += '<div class="offers_price'+(arStikePrices ? (BX.util.in_array(obPrices[j].PRICE_ID, arStikePrices) ? ' strike_block' : '') : '')+'">';
1742						strPrice += '<span class="values_wrapper">'+values_wrapper+'</span>';
1743						if(measure && obPrices[j].DISCOUNT_VALUE>0)
1744							strPrice += '<span class="price_measure">/'+measure+'</span>';
1745						
1746					strPrice += '</div>';
1747					if (obPrices[j].DISCOUNT_VALUE !== obPrices[j].VALUE)
1748					{
1749						if(this.showOldPrice)
1750						{
1751							strPrice += '<div class="offers_price_old">';
1752								strPrice += '<span class="values_wrapper">'+getCurrentPrice(obPrices[j].VALUE, obPrices[j].CURRENCY, obPrices[j].PRINT_VALUE)+'</span>';
1753							strPrice += '</div>';
1754						}
1755						if(this.showPercent)
1756						{
1757							strPrice += '<div class="sale_block matrix"><div class="sale_wrapper">';
1758								strPrice += '<span class="title">'+BX.message('ITEM_ECONOMY')+'</span>';
1759								strPrice += '<div class="text">';
1760									strPrice += '<span class="values_wrapper">'+getCurrentPrice(obPrices[j].DISCOUNT_DIFF, obPrices[j].CURRENCY, obPrices[j].PRINT_DISCOUNT_DIFF)+'</span>';
1761								strPrice += '</div>';
1762							strPrice += '<div class="clearfix"></div></div></div>';
1763						}
1764					}
1765				}
1766			}
1767			if(this.showPercent)
1768			{
1769				$(this.obPrice).closest('.cost').find('.sale_block:not(.matrix)').hide();
1770				$(this.obPrice).closest('.cost').find('.sale_block:not(.matrix) .text span').html('');
1771			}
1772			if(this.showOldPrice)
1773			{
1774				$(this.obPrice).closest('.cost').find('.price.discount').hide();
1775			}
1776
1777			strPrice += '</div>';
1778			BX.adjust(this.obPrice, {html: strPrice});
1779
1780			var eventdata = {product: product, measure: measure, config: this.config, offer: this.offers[this.offerNum], obPrices: obPrices};
1781			BX.onCustomEvent('onAsproSkuSetPrice', [eventdata])
1782		}
1783	}
1784};
1785
1786window.JCCatalogSection.prototype.checkPriceRange = function(quantity)
1787{
1788	if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
1789		return;
1790
1791	var range, found = false;
1792	for (var i in this.currentQuantityRanges)
1793	{
1794		if (this.currentQuantityRanges.hasOwnProperty(i))
1795		{
1796			range = this.currentQuantityRanges[i];
1797
1798			if (
1799				parseInt(quantity) >= parseInt(range.SORT_FROM)
1800				&& (
1801					range.SORT_TO == 'INF'
1802					|| parseInt(quantity) <= parseInt(range.SORT_TO)
1803				)
1804			)
1805			{
1806				found = true;
1807				this.currentQuantityRangeSelected = range.HASH;
1808				break;
1809			}
1810		}
1811	}
1812
1813	if (!found && (range = this.getMinPriceRange()))
1814	{
1815		this.currentQuantityRangeSelected = range.HASH;
1816	}
1817
1818	for (var k in this.currentPrices)
1819	{
1820		if (this.currentPrices.hasOwnProperty(k))
1821		{
1822			if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
1823			{
1824				this.currentPriceSelected = k;
1825				break;
1826			}
1827		}
1828	}
1829};
1830
1831window.JCCatalogSection.prototype.getMinPriceRange = function()
1832{
1833	var range;
1834
1835	for (var i in this.currentQuantityRanges)
1836	{
1837		if (this.currentQuantityRanges.hasOwnProperty(i))
1838		{
1839			if (
1840				!range
1841				|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
1842			)
1843			{
1844				range = this.currentQuantityRanges[i];
1845			}
1846		}
1847	}
1848
1849	return range;
1850}
1851
1852/*set store quantity*/
1853window.JCCatalogSection.prototype.setQuantityStore = function(quantity, text)
1854{
1855	if(parseFloat(quantity)>0){
1856		$(this.storeQuanity).find('.icon').removeClass('order').addClass('stock');
1857	}else{
1858		$(this.storeQuanity).find('.icon').removeClass('stock').addClass('order');
1859	}
1860	$(this.storeQuanity).find('.icon + span').html(text);
1861}
1862
1863window.JCCatalogSection.prototype.Compare = function()
1864{
1865	var compareParams, compareLink;
1866	$(this.obProduct).find('.like_icons .o_'+this.offers[this.offerNum].ID).data('changed','Y');
1867	// if($(this.obCompare).find('.compare_item.added').is(':visible')){
1868	if($(this.obProduct).find('.like_icons .o_'+this.offers[this.offerNum].ID).find('.compare_item.added').is(':visible')){
1869		compareLink = this.compareData.compareUrlDel;
1870		this.compareData.Added = false;
1871	}else{
1872		compareLink = this.compareData.compareUrl;
1873		this.compareData.Added = true;
1874	}
1875	if (!!compareLink){
1876		switch (this.productType){
1877			case 1://product
1878			case 2://set
1879				compareLink = compareLink.replace('#ID#', this.product.id.toString());
1880				break;
1881			case 3://sku
1882				compareLink = compareLink.replace('#ID#', this.offers[this.offerNum].ID);
1883				break;
1884		}
1885		compareParams = {
1886			ajax_action: 'Y'
1887		};
1888		BX.ajax.loadJSON(
1889			compareLink,
1890			compareParams,
1891			BX.proxy(this.CompareResult, this)
1892		);
1893	}
1894};
1895
1896window.JCCatalogSection.prototype.CompareResult = function(result)
1897{
1898	var popupContent, popupButtons, popupTitle;
1899
1900	if (typeof result !== 'object'){
1901		return false;
1902	}
1903
1904	if (result.STATUS === 'OK'){
1905		BX.onCustomEvent('OnCompareChange');
1906		/*if(!this.compareData.Added){
1907			$(this.obCompare).find('.in').hide();
1908			$(this.obCompare).find('.to').show();
1909		}
1910		else{
1911			$(this.obCompare).find('.to').hide();
1912			$(this.obCompare).find('.in').show();
1913		}*/
1914		if(!this.compareData.Added){
1915			$(this.obProduct).find('.like_icons .o_'+this.offers[this.offerNum].ID).find('.in').hide();
1916			$(this.obProduct).find('.like_icons .o_'+this.offers[this.offerNum].ID).find('.to').show();
1917		}
1918		else{
1919			$(this.obProduct).find('.like_icons .o_'+this.offers[this.offerNum].ID).find('.to').hide();
1920			$(this.obProduct).find('.like_icons .o_'+this.offers[this.offerNum].ID).find('.in').show();
1921		}
1922		jsAjaxUtil.InsertDataToNode(arNextOptions['SITE_DIR'] + 'ajax/show_compare_preview_top.php', 'compare_line', false);
1923	}else{
1924		console.log(BX.message('ADD_ERROR_COMPARE'));
1925	}
1926	return false;
1927};
1928
1929window.JCCatalogSection.prototype.CompareRedirect = function()
1930{
1931	if (!!this.compareData.comparePath){
1932		location.href = this.compareData.comparePath;
1933	}else{
1934		this.obPopupWin.close();
1935	}
1936};
1937
1938window.JCCatalogSection.prototype.InitBasketUrl = function()
1939{
1940	this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url);
1941	switch (this.productType)
1942	{
1943		case 1://product
1944		case 2://set
1945			this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString());
1946			break;
1947		case 3://sku
1948			this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID);
1949			break;
1950	}
1951	this.basketParams = {
1952		'ajax_basket': 'Y'
1953	};
1954	if (this.showQuantity)
1955	{
1956		// this.basketParams[this.basketData.quantity] = this.obQuantity.value;
1957		this.basketParams[this.basketData.quantity] = $(this.obProduct).find('.counter_wrapp').find('.counter_block .text').val();
1958	}
1959	if (!!this.basketData.sku_props)
1960	{
1961		this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
1962	}
1963};
1964
1965window.JCCatalogSection.prototype.FillBasketProps = function()
1966{
1967	if (!this.visual.BASKET_PROP_DIV)
1968	{
1969		return;
1970	}
1971	var
1972		i = 0,
1973		propCollection = null,
1974		foundValues = false,
1975		obBasketProps = null;
1976
1977	if (this.basketData.useProps && !this.basketData.emptyProps)
1978	{
1979		if (!!this.obPopupWin && !!this.obPopupWin.contentContainer)
1980		{
1981			obBasketProps = this.obPopupWin.contentContainer;
1982		}
1983	}
1984	else
1985	{
1986		obBasketProps = BX(this.visual.BASKET_PROP_DIV);
1987	}
1988	if (!!obBasketProps)
1989	{
1990		propCollection = obBasketProps.getElementsByTagName('select');
1991		if (!!propCollection && !!propCollection.length)
1992		{
1993			for (i = 0; i < propCollection.length; i++)
1994			{
1995				if (!propCollection[i].disabled)
1996				{
1997					switch(propCollection[i].type.toLowerCase())
1998					{
1999						case 'select-one':
2000							this.basketParams[propCollection[i].name] = propCollection[i].value;
2001							foundValues = true;
2002							break;
2003						default:
2004							break;
2005					}
2006				}
2007			}
2008		}
2009		propCollection = obBasketProps.getElementsByTagName('input');
2010		if (!!propCollection && !!propCollection.length)
2011		{
2012			for (i = 0; i < propCollection.length; i++)
2013			{
2014				if (!propCollection[i].disabled)
2015				{
2016					switch(propCollection[i].type.toLowerCase())
2017					{
2018						case 'hidden':
2019							this.basketParams[propCollection[i].name] = propCollection[i].value;
2020							foundValues = true;
2021							break;
2022						case 'radio':
2023							if (propCollection[i].checked)
2024							{
2025								this.basketParams[propCollection[i].name] = propCollection[i].value;
2026								foundValues = true;
2027							}
2028							break;
2029						default:
2030							break;
2031					}
2032				}
2033			}
2034		}
2035	}
2036	if (!foundValues)
2037	{
2038		this.basketParams[this.basketData.props] = [];
2039		this.basketParams[this.basketData.props][0] = 0;
2040	}
2041};
2042
2043window.JCCatalogSection.prototype.Add2Basket = function()
2044{
2045	this.basketMode = 'ADD';
2046	this.Basket();
2047};
2048
2049window.JCCatalogSection.prototype.BuyBasket = function()
2050{
2051	this.basketMode = 'BUY';
2052	this.Basket();
2053};
2054
2055window.JCCatalogSection.prototype.SendToBasket = function()
2056{
2057	if (!this.canBuy){
2058		return;
2059	}
2060
2061	this.InitBasketUrl();
2062	this.FillBasketProps();
2063
2064	BX.ajax.loadJSON(
2065		this.basketUrl,
2066		this.basketParams,
2067		BX.delegate(this.BasketResult, this)
2068	);
2069};
2070
2071window.JCCatalogSection.prototype.Basket = function()
2072{
2073	var contentBasketProps = '';
2074	if (!this.canBuy){
2075		return;
2076	}
2077
2078	this.SendToBasket();
2079};
2080
2081window.JCCatalogSection.prototype.BasketResult = function(arResult)
2082{
2083	var strContent = '',
2084		strPict = '',
2085		successful,
2086		buttons = [];
2087
2088	if (!!this.obPopupWin){
2089		this.obPopupWin.close();
2090	}
2091	if ('object' !== typeof arResult){
2092		return false;
2093	}
2094	successful = (arResult.STATUS === 'OK');
2095	if (successful && this.basketAction === 'BUY'){
2096		this.BasketRedirect();
2097	}else{
2098		if (successful){
2099			getActualBasket();
2100			markProductAddBasket(this.offers[this.offerNum].ID);
2101			BX.onCustomEvent('OnBasketChange');
2102			this.offers[this.offerNum].BASKET_ACTIVE=true;
2103			this.BasketStateRefresh("Y");
2104			$(this.obProduct).find('.hover_block .o_'+this.offers[this.offerNum].ID).data('changed','Y');
2105
2106		}else{
2107			console.log(BX.message('ADD_ERROR_BASKET'));
2108		}
2109	}
2110};
2111
2112window.JCCatalogSection.prototype.BasketRedirect = function()
2113{
2114	location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
2115};
2116
2117})(window);

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.