PageSourceSearch

https://www.rimi-studio.ru/bitrix/templates/rimi_shop/components/b…/catalog.top/rimi_works_n/section/script.js

js rimi-studio.ru collected 2026-10-09 03:42:43 UTC 39,869 bytes, 1,644 lines download raw bytes

1(function (window)
2{
3if (!!window.JCCatalogTopSection)
4{
5	return;
6}
7
8var BasketButton = function(params)
9{
10	BasketButton.superclass.constructor.apply(this, arguments);
11	this.nameNode = BX.create('span', {
12		props : { className : 'bx_medium bx_bt_button', id : this.id },
13		style: typeof(params.style) === 'object' ? params.style : {},
14		text: params.text
15	});
16	this.buttonNode = BX.create('span', {
17		attrs: { className: params.ownerClass },
18		style: { marginBottom: '0', borderBottom: '0 none transparent' },
19		children: [this.nameNode],
20		events : this.contextEvents
21	});
22	if (BX.browser.IsIE())
23	{
24		this.buttonNode.setAttribute("hideFocus", "hidefocus");
25	}
26};
27BX.extend(BasketButton, BX.PopupWindowButton);
28
29window.JCCatalogTopSection = function (arParams)
30{
31	this.productType = 0;
32	this.showQuantity = true;
33	this.showAbsent = true;
34	this.secondPict = false;
35	this.showOldPrice = false;
36	this.showPercent = false;
37	this.showSkuProps = false;
38	this.basketAction = 'ADD';
39	this.showClosePopup = false;
40	this.useCompare = false;
41	this.visual = {
42		ID: '',
43		PICT_ID: '',
44		SECOND_PICT_ID: '',
45		QUANTITY_ID: '',
46		QUANTITY_UP_ID: '',
47		QUANTITY_DOWN_ID: '',
48		PRICE_ID: '',
49		DSC_PERC: '',
50		SECOND_DSC_PERC: '',
51		DISPLAY_PROP_DIV: ''
52	};
53	this.product = {
54		checkQuantity: false,
55		maxQuantity: 0,
56		stepQuantity: 1,
57		isDblQuantity: false,
58		canBuy: true,
59		canSubscription: true,
60		name: '',
61		pict: {},
62		id: 0,
63		addUrl: '',
64		buyUrl: ''
65	};
66
67	this.basketMode = '';
68	this.basketData = {
69		useProps: false,
70		emptyProps: false,
71		quantity: 'quantity',
72		props: 'prop',
73		basketUrl: '',
74		sku_props: '',
75		sku_props_var: 'basket_props',
76		add_url: '',
77		buy_url: ''
78	};
79
80	this.compareData = {
81		compareUrl: '',
82		comparePath: ''
83	};
84
85	this.defaultPict = {
86		pict: null,
87		secondPict: null
88	};
89
90	this.checkQuantity = false;
91	this.maxQuantity = 0;
92	this.stepQuantity = 1;
93	this.isDblQuantity = false;
94	this.canBuy = true;
95	this.currentBasisPrice = {};
96	this.canSubscription = true;
97	this.precision = 6;
98	this.precisionFactor = Math.pow(10,this.precision);
99
100	this.offers = [];
101	this.offerNum = 0;
102	this.treeProps = [];
103	this.obTreeRows = [];
104	this.showCount = [];
105	this.showStart = [];
106	this.selectedValues = {};
107
108	this.obProduct = null;
109	this.obQuantity = null;
110	this.obQuantityUp = null;
111	this.obQuantityDown = null;
112	this.obPict = null;
113	this.obSecondPict = null;
114	this.obPrice = null;
115	this.obTree = null;
116	this.obBuyBtn = null;
117	this.obBasketActions = null;
118	this.obNotAvail = null;
119	this.obDscPerc = null;
120	this.obSecondDscPerc = null;
121	this.obSkuProps = null;
122	this.obMeasure = null;
123	this.obCompare = null;
124
125	this.treeRowShowSize = 5;
126	this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 };
127	this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 };
128
129	this.lastElement = false;
130	this.containerHeight = 0;
131
132	this.errorCode = 0;
133
134	if ('object' === typeof arParams)
135	{
136		this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
137		this.showQuantity = arParams.SHOW_QUANTITY;
138		this.showAbsent = arParams.SHOW_ABSENT;
139		this.secondPict = !!arParams.SECOND_PICT;
140		this.showOldPrice = !!arParams.SHOW_OLD_PRICE;
141		this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT;
142		this.showSkuProps = !!arParams.SHOW_SKU_PROPS;
143		if (!!arParams.ADD_TO_BASKET_ACTION)
144		{
145			this.basketAction = arParams.ADD_TO_BASKET_ACTION;
146		}
147		this.showClosePopup = !!arParams.SHOW_CLOSE_POPUP;
148		this.useCompare = !!arParams.DISPLAY_COMPARE;
149
150		this.visual = arParams.VISUAL;
151
152		switch (this.productType)
153		{
154			case 0://no catalog
155			case 1://product
156			case 2://set
157				if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
158				{
159					if (this.showQuantity)
160					{
161						this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
162						this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
163						if (this.product.checkQuantity)
164						{
165							this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
166						}
167						this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
168
169						this.checkQuantity = this.product.checkQuantity;
170						this.isDblQuantity = this.product.isDblQuantity;
171						this.maxQuantity = this.product.maxQuantity;
172						this.stepQuantity = this.product.stepQuantity;
173						if (this.isDblQuantity)
174						{
175							this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor;
176						}
177					}
178					this.product.canBuy = arParams.PRODUCT.CAN_BUY;
179					this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
180					if (!!arParams.PRODUCT.BASIS_PRICE)
181					{
182						this.currentBasisPrice = arParams.PRODUCT.BASIS_PRICE;
183					}
184
185					this.canBuy = this.product.canBuy;
186					this.canSubscription = this.product.canSubscription;
187
188					this.product.name = arParams.PRODUCT.NAME;
189					this.product.pict = arParams.PRODUCT.PICT;
190					this.product.id = arParams.PRODUCT.ID;
191					if (!!arParams.PRODUCT.ADD_URL)
192					{
193						this.product.addUrl = arParams.PRODUCT.ADD_URL;
194					}
195					if (!!arParams.PRODUCT.BUY_URL)
196					{
197						this.product.buyUrl = arParams.PRODUCT.BUY_URL;
198					}
199					if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
200					{
201						this.basketData.useProps = !!arParams.BASKET.ADD_PROPS;
202						this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS;
203					}
204				}
205				else
206				{
207					this.errorCode = -1;
208				}
209				break;
210			case 3://sku
211				if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
212				{
213					this.product.name = arParams.PRODUCT.NAME;
214					this.product.id = arParams.PRODUCT.ID;
215					this.offers = arParams.OFFERS;
216					this.offerNum = 0;
217					if (!!arParams.OFFER_SELECTED)
218					{
219						this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
220					}
221					if (isNaN(this.offerNum))
222					{
223						this.offerNum = 0;
224					}
225					if (!!arParams.TREE_PROPS)
226					{
227						this.treeProps = arParams.TREE_PROPS;
228					}
229					if (!!arParams.DEFAULT_PICTURE)
230					{
231						this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
232						this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
233					}
234				}
235				break;
236			default:
237				this.errorCode = -1;
238		}
239		if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
240		{
241			if (!!arParams.BASKET.QUANTITY)
242			{
243				this.basketData.quantity = arParams.BASKET.QUANTITY;
244			}
245			if (!!arParams.BASKET.PROPS)
246			{
247				this.basketData.props = arParams.BASKET.PROPS;
248			}
249			if (!!arParams.BASKET.BASKET_URL)
250			{
251				this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
252			}
253			if (3 === this.productType)
254			{
255				if (!!arParams.BASKET.SKU_PROPS)
256				{
257					this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
258				}
259			}
260			if (!!arParams.BASKET.ADD_URL_TEMPLATE)
261			{
262				this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE;
263			}
264			if (!!arParams.BASKET.BUY_URL_TEMPLATE)
265			{
266				this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE;
267			}
268			if (this.basketData.add_url === '' && this.basketData.buy_url === '')
269			{
270				this.errorCode = -1024;
271			}
272		}
273		if (this.useCompare)
274		{
275			if (!!arParams.COMPARE && typeof(arParams.COMPARE) === 'object')
276			{
277				if (!!arParams.COMPARE.COMPARE_PATH)
278				{
279					this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH;
280				}
281				if (!!arParams.COMPARE.COMPARE_URL_TEMPLATE)
282				{
283					this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE;
284				}
285				else
286				{
287					this.useCompare = false;
288				}
289			}
290			else
291			{
292				this.useCompare = false;
293			}
294		}
295		this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT);
296	}
297	if (0 === this.errorCode)
298	{
299		BX.ready(BX.delegate(this.Init,this));
300	}
301};
302
303window.JCCatalogTopSection.prototype.Init = function()
304{
305	var i = 0,
306		strPrefix = '',
307		TreeItems = null;
308
309	this.obProduct = BX(this.visual.ID);
310	if (!this.obProduct)
311	{
312		this.errorCode = -1;
313	}
314	this.obPict = BX(this.visual.PICT_ID);
315	if (!this.obPict)
316	{
317		this.errorCode = -2;
318	}
319	if (this.secondPict && !!this.visual.SECOND_PICT_ID)
320	{
321		this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
322	}
323	this.obPrice = BX(this.visual.PRICE_ID);
324	if (!this.obPrice)
325	{
326		this.errorCode = -16;
327	}
328	if (this.showQuantity && !!this.visual.QUANTITY_ID)
329	{
330		this.obQuantity = BX(this.visual.QUANTITY_ID);
331		if (!!this.visual.QUANTITY_UP_ID)
332		{
333			this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
334		}
335		if (!!this.visual.QUANTITY_DOWN_ID)
336		{
337			this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
338		}
339	}
340	if (3 === this.productType && this.offers.length > 0)
341	{
342		if (!!this.visual.TREE_ID)
343		{
344			this.obTree = BX(this.visual.TREE_ID);
345			if (!this.obTree)
346			{
347				this.errorCode = -256;
348			}
349			strPrefix = this.visual.TREE_ITEM_ID;
350			for (i = 0; i < this.treeProps.length; i++)
351			{
352				this.obTreeRows[i] = {
353					LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'),
354					RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'),
355					LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
356					CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
357				};
358				if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
359				{
360					this.errorCode = -512;
361					break;
362				}
363			}
364		}
365		if (!!this.visual.QUANTITY_MEASURE)
366		{
367			this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
368		}
369	}
370	this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID);
371	if (!!this.obBasketActions)
372	{
373		if (!!this.visual.BUY_ID)
374		{
375			this.obBuyBtn = BX(this.visual.BUY_ID);
376		}
377	}
378	this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS);
379
380	if (this.showPercent)
381	{
382		if (!!this.visual.DSC_PERC)
383		{
384			this.obDscPerc = BX(this.visual.DSC_PERC);
385		}
386		if (this.secondPict && !!this.visual.SECOND_DSC_PERC)
387		{
388			this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
389		}
390	}
391
392	if (this.showSkuProps)
393	{
394		if (!!this.visual.DISPLAY_PROP_DIV)
395		{
396			this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
397		}
398	}
399
400	if (0 === this.errorCode)
401	{
402		if (this.showQuantity)
403		{
404			if (!!this.obQuantityUp)
405			{
406				BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
407			}
408			if (!!this.obQuantityDown)
409			{
410				BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
411			}
412			if (!!this.obQuantity)
413			{
414				BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
415			}
416		}
417		switch (this.productType)
418		{
419			case 1://product
420				break;
421			case 3://sku
422				if (this.offers.length > 0)
423				{
424					TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
425					if (!!TreeItems && 0 < TreeItems.length)
426					{
427						for (i = 0; i < TreeItems.length; i++)
428						{
429							BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this));
430						}
431					}
432					for (i = 0; i < this.obTreeRows.length; i++)
433					{
434						BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(this.RowLeft, this));
435						BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(this.RowRight, this));
436					}
437					this.SetCurrent();
438				}
439				break;
440		}
441		if (!!this.obBuyBtn)
442		{
443			if (this.basketAction === 'ADD')
444			{
445				BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Add2Basket, this));
446			}
447			else
448			{
449				BX.bind(this.obBuyBtn, 'click', BX.delegate(this.BuyBasket, this));
450			}
451		}
452		if (this.lastElement)
453		{
454			this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
455			if (isNaN(this.containerHeight))
456			{
457				this.containerHeight = 0;
458			}
459			this.setHeight();
460			BX.bind(window, 'resize', BX.delegate(this.checkHeight, this));
461			BX.bind(this.obProduct.parentNode, 'mouseover', BX.delegate(this.setHeight, this));
462			BX.bind(this.obProduct.parentNode, 'mouseout', BX.delegate(this.clearHeight, this));
463		}
464		if (this.useCompare)
465		{
466			this.obCompare = BX(this.visual.COMPARE_LINK_ID);
467			if (!!this.obCompare)
468			{
469				BX.bind(this.obCompare, 'click', BX.proxy(this.Compare, this));
470			}
471		}
472	}
473};
474
475window.JCCatalogTopSection.prototype.checkHeight = function()
476{
477	this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
478	if (isNaN(this.containerHeight))
479	{
480		this.containerHeight = 0;
481	}
482};
483
484window.JCCatalogTopSection.prototype.setHeight = function()
485{
486	if (0 < this.containerHeight)
487	{
488		BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}});
489	}
490};
491
492window.JCCatalogTopSection.prototype.clearHeight = function()
493{
494	BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}});
495};
496
497window.JCCatalogTopSection.prototype.QuantityUp = function()
498{
499	var curValue = 0,
500		boolSet = true,
501		calcPrice;
502
503	if (0 === this.errorCode && this.showQuantity && this.canBuy)
504	{
505		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
506		if (!isNaN(curValue))
507		{
508			curValue += this.stepQuantity;
509			if (this.checkQuantity)
510			{
511				if (curValue > this.maxQuantity)
512				{
513					boolSet = false;
514				}
515			}
516			if (boolSet)
517			{
518				if (this.isDblQuantity)
519				{
520					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
521				}
522				this.obQuantity.value = curValue;
523				calcPrice = {
524					DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue,
525					VALUE: this.currentBasisPrice.VALUE * curValue,
526					DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue,
527					DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT,
528					CURRENCY: this.currentBasisPrice.CURRENCY
529				};
530				this.setPrice(calcPrice);
531			}
532		}
533	}
534};
535
536window.JCCatalogTopSection.prototype.QuantityDown = function()
537{
538	var curValue = 0,
539		boolSet = true,
540		calcPrice;
541
542	if (0 === this.errorCode && this.showQuantity && this.canBuy)
543	{
544		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10));
545		if (!isNaN(curValue))
546		{
547			curValue -= this.stepQuantity;
548			if (curValue < this.stepQuantity)
549			{
550				boolSet = false;
551			}
552			if (boolSet)
553			{
554				if (this.isDblQuantity)
555				{
556					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
557				}
558				this.obQuantity.value = curValue;
559				calcPrice = {
560					DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue,
561					VALUE: this.currentBasisPrice.VALUE * curValue,
562					DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue,
563					DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT,
564					CURRENCY: this.currentBasisPrice.CURRENCY
565				};
566				this.setPrice(calcPrice);
567			}
568		}
569	}
570};
571
572window.JCCatalogTopSection.prototype.QuantityChange = function()
573{
574	var curValue = 0,
575		calcPrice,
576		intCount,
577		count;
578
579	if (0 === this.errorCode && this.showQuantity)
580	{
581		if (this.canBuy)
582		{
583			curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
584			if (!isNaN(curValue))
585			{
586				if (this.checkQuantity)
587				{
588					if (curValue > this.maxQuantity)
589					{
590						curValue = this.maxQuantity;
591					}
592				}
593				if (curValue < this.stepQuantity)
594				{
595					curValue = this.stepQuantity;
596				}
597				else
598				{
599					count = Math.round((curValue*this.precisionFactor)/this.stepQuantity)/this.precisionFactor;
600					intCount = parseInt(count, 10);
601					if (isNaN(intCount))
602					{
603						intCount = 1;
604						count = 1.1;
605					}
606					if (count > intCount)
607					{
608						curValue = (intCount <= 1 ? this.stepQuantity : intCount*this.stepQuantity);
609						curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
610					}
611				}
612				this.obQuantity.value = curValue;
613			}
614			else
615			{
616				this.obQuantity.value = this.stepQuantity;
617			}
618		}
619		else
620		{
621			this.obQuantity.value = this.stepQuantity;
622		}
623		calcPrice = {
624			DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * this.obQuantity.value,
625			VALUE: this.currentBasisPrice.VALUE * this.obQuantity.value,
626			DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * this.obQuantity.value,
627			DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT,
628			CURRENCY: this.currentBasisPrice.CURRENCY
629		};
630		this.setPrice(calcPrice);
631	}
632};
633
634window.JCCatalogTopSection.prototype.QuantitySet = function(index)
635{
636	if (0 === this.errorCode)
637	{
638		this.canBuy = this.offers[index].CAN_BUY;
639		if (this.canBuy)
640		{
641			if (!!this.obBasketActions)
642			{
643				BX.style(this.obBasketActions, 'display', '');
644			}
645			if (!!this.obNotAvail)
646			{
647				BX.style(this.obNotAvail, 'display', 'none');
648			}
649		}
650		else
651		{
652			if (!!this.obBasketActions)
653			{
654				BX.style(this.obBasketActions, 'display', 'none');
655			}
656			if (!!this.obNotAvail)
657			{
658				BX.style(this.obNotAvail, 'display', '');
659			}
660		}
661		if (this.showQuantity)
662		{
663			this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
664			this.checkQuantity = this.offers[index].CHECK_QUANTITY;
665			if (this.isDblQuantity)
666			{
667				this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY);
668				this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor;
669			}
670			else
671			{
672				this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10);
673				this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10);
674			}
675
676			this.obQuantity.value = this.stepQuantity;
677			this.obQuantity.disabled = !this.canBuy;
678			if (!!this.obMeasure)
679			{
680				if (!!this.offers[index].MEASURE)
681				{
682					BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
683				}
684				else
685				{
686					BX.adjust(this.obMeasure, { html : ''});
687				}
688			}
689		}
690		this.currentBasisPrice = this.offers[index].BASIS_PRICE;
691	}
692};
693
694window.JCCatalogTopSection.prototype.SelectOfferProp = function()
695{
696	var i = 0,
697		value = '',
698		strTreeValue = '',
699		arTreeItem = [],
700		RowItems = null,
701		target = BX.proxy_context;
702
703	if (!!target && target.hasAttribute('data-treevalue'))
704	{
705		strTreeValue = target.getAttribute('data-treevalue');
706		arTreeItem = strTreeValue.split('_');
707		if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
708		{
709			RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
710			if (!!RowItems && 0 < RowItems.length)
711			{
712				for (i = 0; i < RowItems.length; i++)
713				{
714					value = RowItems[i].getAttribute('data-onevalue');
715					if (value === arTreeItem[1])
716					{
717						BX.addClass(RowItems[i], 'bx_active');
718					}
719					else
720					{
721						BX.removeClass(RowItems[i], 'bx_active');
722					}
723				}
724			}
725		}
726	}
727};
728
729window.JCCatalogTopSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
730{
731	var strName = '',
732		arShowValues = false,
733		i, j,
734		arCanBuyValues = [],
735		allValues = [],
736		index = -1,
737		arFilter = {},
738		tmpFilter = [];
739
740	for (i = 0; i < this.treeProps.length; i++)
741	{
742		if (this.treeProps[i].ID === strPropID)
743		{
744			index = i;
745			break;
746		}
747	}
748
749	if (-1 < index)
750	{
751		for (i = 0; i < index; i++)
752		{
753			strName = 'PROP_'+this.treeProps[i].ID;
754			arFilter[strName] = this.selectedValues[strName];
755		}
756		strName = 'PROP_'+this.treeProps[index].ID;
757		arShowValues = this.GetRowValues(arFilter, strName);
758		if (!arShowValues)
759		{
760			return false;
761		}
762		if (!BX.util.in_array(strPropValue, arShowValues))
763		{
764			return false;
765		}
766		arFilter[strName] = strPropValue;
767		for (i = index+1; i < this.treeProps.length; i++)
768		{
769			strName = 'PROP_'+this.treeProps[i].ID;
770			arShowValues = this.GetRowValues(arFilter, strName);
771			if (!arShowValues)
772			{
773				return false;
774			}
775			allValues = [];
776			if (this.showAbsent)
777			{
778				arCanBuyValues = [];
779				tmpFilter = [];
780				tmpFilter = BX.clone(arFilter, true);
781				for (j = 0; j < arShowValues.length; j++)
782				{
783					tmpFilter[strName] = arShowValues[j];
784					allValues[allValues.length] = arShowValues[j];
785					if (this.GetCanBuy(tmpFilter))
786						arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
787				}
788			}
789			else
790			{
791				arCanBuyValues = arShowValues;
792			}
793			if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
794			{
795				arFilter[strName] = this.selectedValues[strName];
796			}
797			else
798			{
799				if (this.showAbsent)
800					arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]);
801				else
802					arFilter[strName] = arCanBuyValues[0];
803			}
804			this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
805		}
806		this.selectedValues = arFilter;
807		this.ChangeInfo();
808	}
809	return true;
810};
811
812window.JCCatalogTopSection.prototype.RowLeft = function()
813{
814	var i = 0,
815		strTreeValue = '',
816		index = -1,
817		target = BX.proxy_context;
818
819	if (!!target && target.hasAttribute('data-treevalue'))
820	{
821		strTreeValue = target.getAttribute('data-treevalue');
822		for (i = 0; i < this.treeProps.length; i++)
823		{
824			if (this.treeProps[i].ID === strTreeValue)
825			{
826				index = i;
827				break;
828			}
829		}
830		if (-1 < index && this.treeRowShowSize < this.showCount[index])
831		{
832			if (0 > this.showStart[index])
833			{
834				this.showStart[index]++;
835				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
836				BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeEnableArrow });
837			}
838
839			if (0 <= this.showStart[index])
840			{
841				BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeDisableArrow });
842			}
843		}
844	}
845};
846
847window.JCCatalogTopSection.prototype.RowRight = function()
848{
849	var i = 0,
850		strTreeValue = '',
851		index = -1,
852		target = BX.proxy_context;
853
854	if (!!target && target.hasAttribute('data-treevalue'))
855	{
856		strTreeValue = target.getAttribute('data-treevalue');
857		for (i = 0; i < this.treeProps.length; i++)
858		{
859			if (this.treeProps[i].ID === strTreeValue)
860			{
861				index = i;
862				break;
863			}
864		}
865		if (-1 < index && this.treeRowShowSize < this.showCount[index])
866		{
867			if ((this.treeRowShowSize - this.showStart[index]) < this.showCount[index])
868			{
869				this.showStart[index]--;
870				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
871				BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeEnableArrow });
872			}
873
874			if ((this.treeRowShowSize - this.showStart[index]) >= this.showCount[index])
875			{
876				BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeDisableArrow });
877			}
878		}
879	}
880};
881
882window.JCCatalogTopSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
883{
884	var i = 0,
885		showI = 0,
886		value = '',
887		countShow = 0,
888		strNewLen = '',
889		obData = {},
890		pictMode = false,
891		extShowMode = false,
892		isCurrent = false,
893		selectIndex = 0,
894		obLeft = this.treeEnableArrow,
895		obRight = this.treeEnableArrow,
896		currentShowStart = 0,
897		RowItems = null;
898
899	if (-1 < intNumber && intNumber < this.obTreeRows.length)
900	{
901		RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false);
902		if (!!RowItems && 0 < RowItems.length)
903		{
904			pictMode = ('PICT' === this.treeProps[intNumber].SHOW_MODE);
905			countShow = showID.length;
906			extShowMode = this.treeRowShowSize < countShow;
907			strNewLen = (extShowMode ? (100/countShow)+'%' : '20%');
908			obData = {
909				props: { className: '' },
910				style: {
911					width: strNewLen
912				}
913			};
914			if (pictMode)
915			{
916				obData.style.paddingTop = strNewLen;
917			}
918			for (i = 0; i < RowItems.length; i++)
919			{
920				value = RowItems[i].getAttribute('data-onevalue');
921				isCurrent = (value === activeID);
922				if (BX.util.in_array(value, canBuyID))
923				{
924					obData.props.className = (isCurrent ? 'bx_active' : '');
925				}
926				else
927				{
928					obData.props.className = (isCurrent ? 'bx_active bx_missing' : 'bx_missing');
929				}
930				obData.style.display = 'none';
931				if (BX.util.in_array(value, showID))
932				{
933					obData.style.display = '';
934					if (isCurrent)
935					{
936						selectIndex = showI;
937					}
938					showI++;
939				}
940				BX.adjust(RowItems[i], obData);
941			}
942
943			obData = {
944				style: {
945					width: (extShowMode ? 20*countShow : 100)+'%',
946					marginLeft: '0%'
947				}
948			};
949			if (pictMode)
950			{
951				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}});
952			}
953			else
954			{
955				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_size full' : 'bx_item_detail_size')}});
956			}
957			if (extShowMode)
958			{
959				if (selectIndex +1 === countShow)
960				{
961					obRight = this.treeDisableArrow;
962				}
963				if (this.treeRowShowSize <= selectIndex)
964				{
965					currentShowStart = this.treeRowShowSize - selectIndex - 1;
966					obData.style.marginLeft = currentShowStart*20+'%';
967				}
968				if (0 === currentShowStart)
969				{
970					obLeft = this.treeDisableArrow;
971				}
972				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: obLeft });
973				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: obRight });
974			}
975			else
976			{
977				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}});
978				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}});
979			}
980			BX.adjust(this.obTreeRows[intNumber].LIST, obData);
981			this.showCount[intNumber] = countShow;
982			this.showStart[intNumber] = currentShowStart;
983		}
984	}
985};
986
987window.JCCatalogTopSection.prototype.GetRowValues = function(arFilter, index)
988{
989	var i = 0,
990		j,
991		arValues = [],
992		boolSearch = false,
993		boolOneSearch = true;
994
995	if (0 === arFilter.length)
996	{
997		for (i = 0; i < this.offers.length; i++)
998		{
999			if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
1000			{
1001				arValues[arValues.length] = this.offers[i].TREE[index];
1002			}
1003		}
1004		boolSearch = true;
1005	}
1006	else
1007	{
1008		for (i = 0; i < this.offers.length; i++)
1009		{
1010			boolOneSearch = true;
1011			for (j in arFilter)
1012			{
1013				if (arFilter[j] !== this.offers[i].TREE[j])
1014				{
1015					boolOneSearch = false;
1016					break;
1017				}
1018			}
1019			if (boolOneSearch)
1020			{
1021				if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
1022				{
1023					arValues[arValues.length] = this.offers[i].TREE[index];
1024				}
1025				boolSearch = true;
1026			}
1027		}
1028	}
1029	return (boolSearch ? arValues : false);
1030};
1031
1032window.JCCatalogTopSection.prototype.GetCanBuy = function(arFilter)
1033{
1034	var i = 0,
1035		j,
1036		boolSearch = false,
1037		boolOneSearch = true;
1038
1039	for (i = 0; i < this.offers.length; i++)
1040	{
1041		boolOneSearch = true;
1042		for (j in arFilter)
1043		{
1044			if (arFilter[j] !== this.offers[i].TREE[j])
1045			{
1046				boolOneSearch = false;
1047				break;
1048			}
1049		}
1050		if (boolOneSearch)
1051		{
1052			if (this.offers[i].CAN_BUY)
1053			{
1054				boolSearch = true;
1055				break;
1056			}
1057		}
1058	}
1059	return boolSearch;
1060};
1061
1062window.JCCatalogTopSection.prototype.SetCurrent = function()
1063{
1064	var i = 0,
1065		j = 0,
1066		arCanBuyValues = [],
1067		strName = '',
1068		arShowValues = false,
1069		arFilter = {},
1070		tmpFilter = [],
1071		current = this.offers[this.offerNum].TREE;
1072
1073	for (i = 0; i < this.treeProps.length; i++)
1074	{
1075		strName = 'PROP_'+this.treeProps[i].ID;
1076		arShowValues = this.GetRowValues(arFilter, strName);
1077		if (!arShowValues)
1078		{
1079			break;
1080		}
1081		if (BX.util.in_array(current[strName], arShowValues))
1082		{
1083			arFilter[strName] = current[strName];
1084		}
1085		else
1086		{
1087			arFilter[strName] = arShowValues[0];
1088			this.offerNum = 0;
1089		}
1090		if (this.showAbsent)
1091		{
1092			arCanBuyValues = [];
1093			tmpFilter = [];
1094			tmpFilter = BX.clone(arFilter, true);
1095			for (j = 0; j < arShowValues.length; j++)
1096			{
1097				tmpFilter[strName] = arShowValues[j];
1098				if (this.GetCanBuy(tmpFilter))
1099				{
1100					arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
1101				}
1102			}
1103		}
1104		else
1105		{
1106			arCanBuyValues = arShowValues;
1107		}
1108		this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
1109	}
1110	this.selectedValues = arFilter;
1111	this.ChangeInfo();
1112};
1113
1114window.JCCatalogTopSection.prototype.ChangeInfo = function()
1115{
1116	var i = 0,
1117		j,
1118		index = -1,
1119		boolOneSearch = true;
1120
1121	for (i = 0; i < this.offers.length; i++)
1122	{
1123		boolOneSearch = true;
1124		for (j in this.selectedValues)
1125		{
1126			if (this.selectedValues[j] !== this.offers[i].TREE[j])
1127			{
1128				boolOneSearch = false;
1129				break;
1130			}
1131		}
1132		if (boolOneSearch)
1133		{
1134			index = i;
1135			break;
1136		}
1137	}
1138	if (-1 < index)
1139	{
1140		if (!!this.obPict)
1141		{
1142			if (!!this.offers[index].PREVIEW_PICTURE)
1143			{
1144				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1145			}
1146			else
1147			{
1148				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1149			}
1150		}
1151		if (this.secondPict && !!this.obSecondPict)
1152		{
1153			if (!!this.offers[index].PREVIEW_PICTURE_SECOND)
1154			{
1155				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}});
1156			}
1157			else if (!!this.offers[index].PREVIEW_PICTURE.SRC)
1158			{
1159				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1160			}
1161			else if (!!this.defaultPict.secondPict)
1162			{
1163				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}});
1164			}
1165			else
1166			{
1167				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1168			}
1169		}
1170		if (this.showSkuProps && !!this.obSkuProps)
1171		{
1172			if (0 === this.offers[index].DISPLAY_PROPERTIES.length)
1173			{
1174				BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
1175			}
1176			else
1177			{
1178				BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
1179			}
1180		}
1181		this.setPrice(this.offers[index].PRICE);
1182		this.offerNum = index;
1183		this.QuantitySet(this.offerNum);
1184	}
1185};
1186
1187window.JCCatalogTopSection.prototype.setPrice = function(price)
1188{
1189	var strPrice,
1190		obData;
1191
1192	if (!!this.obPrice)
1193	{
1194		strPrice = BX.Currency.currencyFormat(price.DISCOUNT_VALUE, price.CURRENCY, true);
1195		if (this.showOldPrice && (price.DISCOUNT_VALUE !== price.VALUE))
1196		{
1197			strPrice += ' <span>'+BX.Currency.currencyFormat(price.VALUE, price.CURRENCY, true)+'</span>';
1198		}
1199		BX.adjust(this.obPrice, {html: strPrice});
1200		if (this.showPercent)
1201		{
1202			if (price.DISCOUNT_VALUE !== price.VALUE)
1203			{
1204				obData = {
1205					style: {
1206						display: ''
1207					},
1208					html: price.DISCOUNT_DIFF_PERCENT
1209				};
1210			}
1211			else
1212			{
1213				obData = {
1214					style: {
1215						display: 'none'
1216					},
1217					html: ''
1218				};
1219			}
1220			if (!!this.obDscPerc)
1221			{
1222				BX.adjust(this.obDscPerc, obData);
1223			}
1224			if (!!this.obSecondDscPerc)
1225			{
1226				BX.adjust(this.obSecondDscPerc, obData);
1227			}
1228		}
1229	}
1230};
1231
1232window.JCCatalogTopSection.prototype.Compare = function()
1233{
1234	var compareParams, compareLink;
1235	if (!!this.compareData.compareUrl)
1236	{
1237		switch (this.productType)
1238		{
1239			case 0://no catalog
1240			case 1://product
1241			case 2://set
1242				compareLink = this.compareData.compareUrl.replace('#ID#', this.product.id.toString());
1243				break;
1244			case 3://sku
1245				compareLink = this.compareData.compareUrl.replace('#ID#', this.offers[this.offerNum].ID);
1246				break;
1247		}
1248		compareParams = {
1249			ajax_action: 'Y'
1250		};
1251		BX.ajax.loadJSON(
1252			compareLink,
1253			compareParams,
1254			BX.proxy(this.CompareResult, this)
1255		);
1256	}
1257};
1258
1259window.JCCatalogTopSection.prototype.CompareResult = function(result)
1260{
1261	var popupContent, popupButtons, popupTitle;
1262	if (!!this.obPopupWin)
1263	{
1264		this.obPopupWin.close();
1265	}
1266	if (typeof result !== 'object')
1267	{
1268		return false;
1269	}
1270	this.InitPopupWindow();
1271	popupTitle = {
1272		content: BX.create('div', {
1273			style: { marginRight: '30px', whiteSpace: 'nowrap' },
1274			text: BX.message('COMPARE_TITLE')
1275		})
1276	};
1277	if (result.STATUS === 'OK')
1278	{
1279		BX.onCustomEvent('OnCompareChange');
1280		popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+BX.message('COMPARE_MESSAGE_OK')+'</p></div>';
1281		if (this.showClosePopup)
1282		{
1283			popupButtons = [
1284				new BasketButton({
1285					ownerClass: this.obProduct.parentNode.parentNode.className,
1286					text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
1287					events: {
1288						click: BX.delegate(this.CompareRedirect, this)
1289					},
1290					style: {marginRight: '10px'}
1291				}),
1292				new BasketButton({
1293					ownerClass: this.obProduct.parentNode.parentNode.className,
1294					text: BX.message('BTN_MESSAGE_CLOSE_POPUP'),
1295					events: {
1296						click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1297					}
1298				})
1299			];
1300		}
1301		else
1302		{
1303			popupButtons = [
1304				new BasketButton({
1305					ownerClass: this.obProduct.parentNode.parentNode.className,
1306					text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
1307					events: {
1308						click: BX.delegate(this.CompareRedirect, this)
1309					}
1310				})
1311			];
1312		}
1313	}
1314	else
1315	{
1316		popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))+'</p></div>';
1317		popupButtons = [
1318			new BasketButton({
1319				ownerClass: this.obProduct.parentNode.parentNode.className,
1320				text: BX.message('BTN_MESSAGE_CLOSE'),
1321				events: {
1322					click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1323				}
1324
1325			})
1326		];
1327	}
1328	this.obPopupWin.setTitleBar(popupTitle);
1329	this.obPopupWin.setContent(popupContent);
1330	this.obPopupWin.setButtons(popupButtons);
1331	this.obPopupWin.show();
1332	return false;
1333};
1334
1335window.JCCatalogTopSection.prototype.CompareRedirect = function()
1336{
1337	if (!!this.compareData.comparePath)
1338	{
1339		location.href = this.compareData.comparePath;
1340	}
1341	else
1342	{
1343		this.obPopupWin.close();
1344	}
1345};
1346
1347window.JCCatalogTopSection.prototype.InitBasketUrl = function()
1348{
1349	this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url);
1350	switch (this.productType)
1351	{
1352		case 1://product
1353		case 2://set
1354			this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString());
1355			break;
1356		case 3://sku
1357			this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID);
1358			break;
1359	}
1360	this.basketParams = {
1361		'ajax_basket': 'Y'
1362	};
1363	if (this.showQuantity)
1364	{
1365		this.basketParams[this.basketData.quantity] = this.obQuantity.value;
1366	}
1367	if (!!this.basketData.sku_props)
1368	{
1369		this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
1370	}
1371};
1372
1373window.JCCatalogTopSection.prototype.FillBasketProps = function()
1374{
1375	if (!this.visual.BASKET_PROP_DIV)
1376	{
1377		return;
1378	}
1379	var
1380		i = 0,
1381		propCollection = null,
1382		foundValues = false,
1383		obBasketProps = null;
1384
1385	if (this.basketData.useProps && !this.basketData.emptyProps)
1386	{
1387		if (!!this.obPopupWin && !!this.obPopupWin.contentContainer)
1388		{
1389			obBasketProps = this.obPopupWin.contentContainer;
1390		}
1391	}
1392	else
1393	{
1394		obBasketProps = BX(this.visual.BASKET_PROP_DIV);
1395	}
1396	if (!!obBasketProps)
1397	{
1398		propCollection = obBasketProps.getElementsByTagName('select');
1399		if (!!propCollection && !!propCollection.length)
1400		{
1401			for (i = 0; i < propCollection.length; i++)
1402			{
1403				if (!propCollection[i].disabled)
1404				{
1405					switch(propCollection[i].type.toLowerCase())
1406					{
1407						case 'select-one':
1408							this.basketParams[propCollection[i].name] = propCollection[i].value;
1409							foundValues = true;
1410							break;
1411						default:
1412							break;
1413					}
1414				}
1415			}
1416		}
1417		propCollection = obBasketProps.getElementsByTagName('input');
1418		if (!!propCollection && !!propCollection.length)
1419		{
1420			for (i = 0; i < propCollection.length; i++)
1421			{
1422				if (!propCollection[i].disabled)
1423				{
1424					switch(propCollection[i].type.toLowerCase())
1425					{
1426						case 'hidden':
1427							this.basketParams[propCollection[i].name] = propCollection[i].value;
1428							foundValues = true;
1429							break;
1430						case 'radio':
1431							if (propCollection[i].checked)
1432							{
1433								this.basketParams[propCollection[i].name] = propCollection[i].value;
1434								foundValues = true;
1435							}
1436							break;
1437						default:
1438							break;
1439					}
1440				}
1441			}
1442		}
1443	}
1444	if (!foundValues)
1445	{
1446		this.basketParams[this.basketData.props] = [];
1447		this.basketParams[this.basketData.props][0] = 0;
1448	}
1449};
1450
1451window.JCCatalogTopSection.prototype.Add2Basket = function()
1452{
1453	this.basketMode = 'ADD';
1454	this.Basket();
1455};
1456
1457window.JCCatalogTopSection.prototype.BuyBasket = function()
1458{
1459	this.basketMode = 'BUY';
1460	this.Basket();
1461};
1462
1463window.JCCatalogTopSection.prototype.SendToBasket = function()
1464{
1465	if (!this.canBuy)
1466	{
1467		return;
1468	}
1469	this.InitBasketUrl();
1470	this.FillBasketProps();
1471	BX.ajax.loadJSON(
1472		this.basketUrl,
1473		this.basketParams,
1474		BX.delegate(this.BasketResult, this)
1475	);
1476};
1477
1478window.JCCatalogTopSection.prototype.Basket = function()
1479{
1480	var contentBasketProps = '';
1481	if (!this.canBuy)
1482	{
1483		return;
1484	}
1485	switch (this.productType)
1486	{
1487		case 1://product
1488		case 2://set
1489			if (this.basketData.useProps && !this.basketData.emptyProps)
1490			{
1491				this.InitPopupWindow();
1492				this.obPopupWin.setTitleBar({
1493					content: BX.create('div', {
1494						style: { marginRight: '30px', whiteSpace: 'nowrap' },
1495						text: BX.message('TITLE_BASKET_PROPS')
1496					})
1497				});
1498				if (BX(this.visual.BASKET_PROP_DIV))
1499				{
1500					contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
1501				}
1502				this.obPopupWin.setContent(contentBasketProps);
1503				this.obPopupWin.setButtons([
1504					new BasketButton({
1505						ownerClass: this.obProduct.parentNode.parentNode.className,
1506						text: BX.message('BTN_MESSAGE_SEND_PROPS'),
1507						events: {
1508							click: BX.delegate(this.SendToBasket, this)
1509						}
1510					})
1511				]);
1512				this.obPopupWin.show();
1513			}
1514			else
1515			{
1516				this.SendToBasket();
1517			}
1518			break;
1519		case 3://sku
1520			this.SendToBasket();
1521			break;
1522	}
1523};
1524
1525window.JCCatalogTopSection.prototype.BasketResult = function(arResult)
1526{
1527	var strContent = '',
1528		strPict = '',
1529		successful,
1530		buttons = [];
1531
1532	if (!!this.obPopupWin)
1533	{
1534		this.obPopupWin.close();
1535	}
1536	if ('object' !== typeof arResult)
1537	{
1538		return false;
1539	}
1540	successful = (arResult.STATUS === 'OK');
1541	if (successful && this.basketAction === 'BUY')
1542	{
1543		this.BasketRedirect();
1544	}
1545	else
1546	{
1547		this.InitPopupWindow();
1548		if (successful)
1549		{
1550			BX.onCustomEvent('OnBasketChange');
1551			switch(this.productType)
1552			{
1553				case 1://
1554				case 2://
1555					strPict = this.product.pict.SRC;
1556					break;
1557				case 3:
1558					strPict = (!!this.offers[this.offerNum].PREVIEW_PICTURE ?
1559						this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
1560						this.defaultPict.pict.SRC
1561						);
1562					break;
1563			}
1564			strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><img src="'+strPict+'" height="130" style="max-height:130px"><p>'+this.product.name+'</p></div>';
1565			if (this.showClosePopup)
1566			{
1567				buttons = [
1568					new BasketButton({
1569						ownerClass: this.obProduct.parentNode.parentNode.className,
1570						text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
1571						events: {
1572							click: BX.delegate(this.BasketRedirect, this)
1573						},
1574						style: {marginRight: '10px'}
1575					}),
1576					new BasketButton({
1577						ownerClass: this.obProduct.parentNode.parentNode.className,
1578						text: BX.message("BTN_MESSAGE_CLOSE_POPUP"),
1579						events: {
1580							click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1581						}
1582					})
1583				];
1584			}
1585			else
1586			{
1587				buttons = [
1588					new BasketButton({
1589						ownerClass: this.obProduct.parentNode.parentNode.className,
1590						text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
1591						events: {
1592							click: BX.delegate(this.BasketRedirect, this)
1593						}
1594					})
1595				];
1596			}
1597		}
1598		else
1599		{
1600			strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))+'</p></div>';
1601			buttons = [
1602				new BasketButton({
1603					ownerClass: this.obProduct.parentNode.parentNode.className,
1604					text: BX.message('BTN_MESSAGE_CLOSE'),
1605					events: {
1606						click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1607					}
1608				})
1609			];
1610		}
1611		this.obPopupWin.setTitleBar({
1612			content: BX.create('div', {
1613				style: { marginRight: '30px', whiteSpace: 'nowrap' },
1614				text: (successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR'))
1615			})
1616		});
1617		this.obPopupWin.setContent(strContent);
1618		this.obPopupWin.setButtons(buttons);
1619		this.obPopupWin.show();
1620	}
1621};
1622
1623window.JCCatalogTopSection.prototype.BasketRedirect = function()
1624{
1625	location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
1626};
1627
1628window.JCCatalogTopSection.prototype.InitPopupWindow = function()
1629{
1630	if (!!this.obPopupWin)
1631	{
1632		return;
1633	}
1634	this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_'+this.visual.ID, null, {
1635		autoHide: false,
1636		offsetLeft: 0,
1637		offsetTop: 0,
1638		overlay : true,
1639		closeByEsc: true,
1640		titleBar: true,
1641		closeIcon: {top: '10px', right: '10px'}
1642	});
1643};
1644})(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.