PageSourceSearch

https://stellazhi-dlya-doma.ru/local/templates/aspro_next/componen…/catalog_block/script.js?170169683159005

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