PageSourceSearch

https://auraf.ru/bitrix/templates/aura-flowers-new/components/bitr…/.default/script.js?171562863229412

js auraf.ru collected 2026-10-07 17:01:42 UTC 29,412 bytes, 1,210 lines download raw bytes

1JCCatalogElement = function (arParams)
2{
3	this.productType = 0;
4	this.showQuantity = true;
5	this.showAbsent = true;
6	this.checkQuantity = false;
7	this.maxQuantity = 0;
8	this.stepQuantity = 1;
9	this.isDblQuantity = false;
10	this.canBuy = true;
11	this.canSubscription = true;
12
13	this.showOldPrice = false;
14	this.showPercent = false;
15	this.showSkuProps = false;
16	this.showOfferGroup = false;
17	
18	this.visual = {
19		ID: '',
20		PICT_ID: '',
21		QUANTITY_ID: '',
22		QUANTITY_UP_ID: '',
23		QUANTITY_DOWN_ID: '',
24		PRICE_ID: '',
25		OLD_PRICE_ID: '',
26		DISCOUNT_VALUE_ID: '',
27		DISCOUNT_PERC_ID: '',
28		OFFER_GROUP: ''
29	};
30	this.product = {
31		checkQuantity: false,
32		maxQuantity: 0,
33		stepQuantity: 1,
34		isDblQuantity: false,
35		canBuy: true,
36		canSubscription: true,
37		name: '',
38		pict: {},
39		id: 0
40	};
41	this.ajaxPath = '';
42	this.mess = {};
43	
44	this.defaultPict = {
45		preview: null,
46		detail: null
47	};
48
49	this.offers = [];
50	this.offerNum = 0;
51	this.treeProps = [];
52	this.obTreeRows = [];
53	this.showCount = [];
54	this.showStart = [];
55	this.selectedValues = {};
56	this.sliders = [];
57
58	this.obProduct = null;
59	this.obQuantity = null;
60	this.obQuantityUp = null;
61	this.obQuantityDown = null;
62	this.obPict = null;
63	this.obPrice = {
64		price: null,
65		full: null,
66		discount: null,
67		percent: null
68	};
69	this.obTree = null;
70	this.obBuyBtn = null;
71	this.obSkuProps = null;
72	this.obSlider = null;
73	this.obMeasure = null;
74	this.obQuantityLimit = {
75		all: null,
76		value: null
77	};
78	
79	this.obZoom = {
80		cont: null,
81		pict: null
82	};
83	this.enableZoom = false;
84	this.showZoom = false;
85	
86	this.errorCode = 0;
87	
88	if ('object' == typeof(arParams))
89	{
90		this.productType = parseInt(arParams.PRODUCT_TYPE);
91		this.showQuantity = arParams.SHOW_QUANTITY;
92		if (!!arParams.SHOW_DISCOUNT_PERCENT)
93			this.showPercent = true;
94		if (!!arParams.SHOW_OLD_PRICE)
95			this.showOldPrice = true;
96		if (!!arParams.SHOW_SKU_PROPS)
97			this.showSkuProps = true;
98		if (!!arParams.OFFER_GROUP)
99			this.showOfferGroup = true;
100		this.visual = arParams.VISUAL;
101		this.ajaxPath = arParams.AJAX_PATH;
102		if (!!arParams.MESS)
103			this.mess = arParams.MESS;
104		switch (this.productType)
105		{
106			case 1://product
107			case 2://set
108				if (!!arParams.PRODUCT && 'object' == typeof(arParams.PRODUCT))
109				{
110					if (this.showQuantity)
111					{
112						this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
113						this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
114						if (this.product.checkQuantity)
115							this.product.maxQuantity = (this.product.isDblQuantity
116									? parseFloat(arParams.PRODUCT.MAX_QUANTITY)
117									: parseInt(arParams.PRODUCT.MAX_QUANTITY)
118							);
119						this.product.stepQuantity = (this.product.isDblQuantity
120							? parseFloat(arParams.PRODUCT.STEP_QUANTITY)
121							: parseInt(arParams.PRODUCT.STEP_QUANTITY)
122						);
123						
124						this.checkQuantity = this.product.checkQuantity;
125						this.isDblQuantity = this.product.isDblQuantity;
126						this.maxQuantity = this.product.maxQuantity;
127						this.stepQuantity = this.product.stepQuantity;
128					}
129					this.product.canBuy = arParams.PRODUCT.CAN_BUY;
130					this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
131					this.product.buyUrl = arParams.PRODUCT.BUY_URL;
132					
133					this.canBuy = this.product.canBuy;
134					this.canSubscription = this.product.canSubscription;
135					
136					this.product.name = arParams.PRODUCT.NAME;
137					this.product.pict = arParams.PRODUCT.PICT;
138					this.product.id = arParams.PRODUCT.ID;
139				}
140				else
141				{
142					this.errorCode = -1;
143				}
144				break;
145			case 3://sku
146				if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
147				{
148					this.offers = arParams.OFFERS;
149					this.offerNum = 0;
150					if (!!arParams.OFFER_SELECTED)
151						this.offerNum = parseInt(arParams.OFFER_SELECTED);
152					if (isNaN(this.offerNum))
153						this.offerNum = 0;
154					if (!!arParams.TREE_PROPS)
155						this.treeProps = arParams.TREE_PROPS;
156					if (!!arParams.DEFAULT_PICTURE)
157					{
158						this.defaultPict.preview = arParams.DEFAULT_PICTURE.PREVIEW_PICTIRE;
159						this.defaultPict.detail = arParams.DEFAULT_PICTURE.DETAIL_PICTURE;
160					}
161				}
162				else
163				{
164					this.errorCode = -1;
165				}
166				break;
167			default:
168				this.errorCode = -1;
169		}
170	}
171	if (0 == this.errorCode)
172	{
173		BX.ready(BX.delegate(this.Init,this));
174	}
175};
176
177JCCatalogElement.prototype.Init = function()
178{
179	var i = 0;
180	var j = 0;
181	this.obProduct = BX(this.visual.ID);
182	if (!this.obProduct)
183		this.errorCode = -1;
184	this.obPict = BX(this.visual.PICT_ID);
185	if (!this.obPict)
186		this.errorCode = -2;
187	this.obPrice.price = BX(this.visual.PRICE_ID);
188	if (!this.obPrice.price)
189	{
190		this.errorCode = -16;
191	}
192	else
193	{
194		if (!!this.visual.OLD_PRICE_ID)
195		{
196			this.obPrice.full = BX(this.visual.OLD_PRICE_ID);
197			if (!this.obPrice.full)
198				this.errorCode = -17;
199		}
200		if (!!this.visual.DISCOUNT_VALUE_ID)
201		{
202			this.obPrice.discount = BX(this.visual.DISCOUNT_VALUE_ID);
203			if (!this.obPrice.discount)
204				this.errorCode = -18;
205		}
206		if (this.showPercent)
207		{
208		if (!!this.visual.DISCOUNT_PERC_ID)
209		{
210			this.obPrice.percent = BX(this.visual.DISCOUNT_PERC_ID);
211			if (!this.obPrice.percent)
212				this.errorCode = -19;
213		}
214		}
215	}
216
217	if (this.showQuantity && !!this.visual.QUANTITY_ID)
218	{
219		this.obQuantity = BX(this.visual.QUANTITY_ID);
220		if (!this.obQuantity)
221			this.errorCode = -32;
222		if (!!this.visual.QUANTITY_UP_ID)
223		{
224			this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
225			if (!this.obQuantityUp)
226				this.errorCode = -64;
227		}
228		if (!!this.visual.QUANTITY_DOWN_ID)
229		{
230			this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
231			if (!this.obQuantityDown)
232				this.errorCode = -128;
233		}
234	}
235	if (3 == this.productType)
236	{
237		if (!!this.visual.TREE_ID)
238		{
239			this.obTree = BX(this.visual.TREE_ID);
240			if (!this.obTree)
241				this.errorCode = -256;
242			var strPrefix = this.visual.TREE_ITEM_ID;
243			for (i = 0; i < this.treeProps.length; i++)
244			{
245				this.obTreeRows[i] = {
246					LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'),
247					RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'),
248					LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
249					CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
250				};
251				if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
252				{
253					this.errorCode = -512;
254					break;
255				}
256			}
257		}
258		if (!!this.visual.QUANTITY_MEASURE)
259		{
260			this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
261		}
262		if (!!this.visual.QUANTITY_LIMIT)
263		{
264			this.obQuantityLimit.all = BX(this.visual.QUANTITY_LIMIT);
265			if (!!this.obQuantityLimit.all)
266			{
267				this.obQuantityLimit.value = BX.findChild(this.obQuantityLimit.all, {tagName: 'span'}, false, false);
268				if (!this.obQuantityLimit.value)
269					this.obQuantityLimit.all = null;
270			}
271		}
272	}
273	
274	if (!!this.visual.BIG_SLIDER_ID)
275	{
276		this.obSlider = BX(this.visual.BIG_SLIDER_ID);
277		if (!this.obSlider)
278		{
279			this.errorCode = -1024;
280		}
281	}
282	if (!!this.visual.BUY_ID)
283	{
284		this.obBuyBtn = BX(this.visual.BUY_ID);
285		if (!this.obBuyBtn)
286		{
287			
288		}
289	}
290	if (this.showSkuProps)
291	{
292		if (!!this.visual.DISPLAY_PROP_DIV)
293		{
294			this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
295		}
296	}
297	
298/*	if (!!this.visual.ZOOM_DIV && !!this.visual.ZOOM_PICT)
299	{
300		this.obZoom.cont = BX(this.visual.ZOOM_DIV);
301		this.obZoom.pict = BX(this.visual.ZOOM_PICT);
302		if (!this.obZoom.cont || !this.obZoom.pict)
303		{
304			
305		}
306		else
307		{
308			
309		}
310	} */
311	
312	if (0 == this.errorCode)
313	{
314		if (this.showQuantity)
315		{
316			BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
317			BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
318			BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
319		}
320		switch (this.productType)
321		{
322			case 1://product
323				break;
324			case 3://sku
325				var TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
326				if (!!TreeItems && 0 < TreeItems.length)
327				{
328					for (i = 0; i < TreeItems.length; i++)
329					{
330						BX.bind(TreeItems[i], 'click', BX.delegate(function(e){this.SelectOfferProp(e); }, this));
331					}
332				}
333				for (i = 0; i < this.obTreeRows.length; i++)
334				{
335					BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(function(e){this.RowLeft(e); }, this));
336					BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(function(e){this.RowRight(e); }, this));
337				}
338				for (i = 0; i < this.offers.length; i++)
339				{
340					if (0 == this.offers[i].SLIDER_COUNT)
341					{
342						this.sliders[i] = {
343							COUNT: this.offers[i].SLIDER_COUNT,
344							ID: ''
345						};
346					}
347					else
348					{
349						for (j = 0; j < this.offers[i].SLIDER.length; j++)
350						{
351							this.offers[i].SLIDER[j].WIDTH = parseInt(this.offers[i].SLIDER[j].WIDTH);
352							this.offers[i].SLIDER[j].HEIGHT = parseInt(this.offers[i].SLIDER[j].HEIGHT);
353						}
354						this.sliders[i] = {
355							COUNT: this.offers[i].SLIDER_COUNT,
356							OFFER_ID: this.offers[i].ID,
357							ID: this.visual.SLIDER_CONT_OF_ID+this.offers[i].ID,
358							CONT: BX(this.visual.SLIDER_CONT_OF_ID+this.offers[i].ID),
359							LIST: BX(this.visual.SLIDER_LIST_OF_ID+this.offers[i].ID),
360							LEFT: BX(this.visual.SLIDER_LEFT_OF_ID+this.offers[i].ID),
361							RIGHT: BX(this.visual.SLIDER_RIGHT_OF_ID+this.offers[i].ID),
362							START: 0
363						};
364						var SliderImgs = BX.findChildren(this.sliders[i].LIST, {tagName: 'li'}, true);
365						if (!!SliderImgs && 0 < SliderImgs.length)
366						{
367							for (j = 0; j < SliderImgs.length; j++)
368							{
369								BX.bind(SliderImgs[j], 'click', BX.delegate(function(e){this.SelectSliderImg(e); }, this));
370							}
371						}
372						if (!!this.sliders[i].LEFT)
373							BX.bind(this.sliders[i].LEFT, 'click', BX.delegate(function(e){this.SliderRowLeft(e); }, this));
374						if (!!this.sliders[i].RIGHT)
375							BX.bind(this.sliders[i].RIGHT, 'click', BX.delegate(function(e){this.SliderRowRight(e); }, this));
376					}
377				}
378				this.SetCurrent();
379				break;
380		}
381		
382		if (!!this.obBuyBtn)
383			BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this));
384	}
385};
386
387JCCatalogElement.prototype.SliderRowLeft = function(e)
388{
389	if (!e) e = window.event;
390	var target = BX.proxy_context;
391	if (!!target && target.hasAttribute('data-value'))
392	{
393		var strValue = target.getAttribute('data-value');
394		var index = -1;
395		for (var i = 0; i < this.sliders.length; i++)
396		{
397			if (this.sliders[i].OFFER_ID == strValue)
398			{
399				index = i;
400				break;
401			}
402		}
403		if (-1 < index && 5 < this.sliders[index].COUNT)
404		{
405			if ((5 - this.sliders[index].START) < this.sliders[index].COUNT)
406			{
407				this.sliders[index].START--;
408				BX.adjust(this.sliders[index].LIST, { style: { marginLeft: this.sliders[index].START*20+'%' }});
409			}
410		}
411	}
412};
413
414JCCatalogElement.prototype.SliderRowRight = function(e)
415{
416	if (!e) e = window.event;
417	var target = BX.proxy_context;
418	if (!!target && target.hasAttribute('data-value'))
419	{
420		var strValue = target.getAttribute('data-value');
421		var index = -1;
422		for (var i = 0; i < this.sliders.length; i++)
423		{
424			if (this.sliders[i].OFFER_ID == strValue)
425			{
426				index = i;
427				break;
428			}
429		}
430		if (-1 < index && 5 < this.sliders[index].COUNT)
431		{
432			if (0 > this.sliders[index].START)
433			{
434				this.sliders[index].START++;
435				BX.adjust(this.sliders[index].LIST, { style: { marginLeft: this.sliders[index].START*20+'%' }});
436			}
437		}
438	}
439};
440
441JCCatalogElement.prototype.SelectSliderImg = function(e)
442{
443	if (!e) e = window.event;
444	var target = BX.proxy_context;
445	if (!!target && target.hasAttribute('data-value'))
446	{
447		var strValue = target.getAttribute('data-value');
448		var arItem = strValue.split('_');
449		this.SetMainPict(arItem[0], arItem[1]);
450	}
451};
452
453JCCatalogElement.prototype.SetMainPict = function(intSlider, intPict)
454{
455	var index = -1;
456	var indexPict = -1;
457	var i = 0;
458	var j = 0;
459	for (i = 0; i < this.offers.length; i++)
460	{
461		if (intSlider == this.offers[i].ID)
462		{
463			index = i;
464			break;
465		}
466	}
467	if (-1 < index)
468	{
469		if (0 < this.offers[index].SLIDER_COUNT)
470		{
471			for (j = 0; j < this.offers[index].SLIDER.length; j++)
472			{
473				if (intPict == this.offers[index].SLIDER[j].ID)
474				{
475					indexPict = j;
476					break;
477				}
478			}
479			if (-1 < indexPict)
480			{
481				if (!!this.obPict && !!this.offers[index].SLIDER[indexPict])
482				{
483					BX.adjust(
484						this.obPict,
485						{
486							props: {
487								src: this.offers[index].SLIDER[indexPict].SRC,
488/*								className: (this.offers[index].SLIDER[indexPict].WIDTH > this.offers[index].SLIDER[indexPict].HEIGHT ? 'landscape' : 'portrait') */
489								className: ''
490							}
491						}
492					);
493				}
494				var RowItems = BX.findChildren(this.sliders[index].LIST, {tagName: 'li'}, false);
495				if (!!RowItems && 0 < RowItems.length)
496				{
497					var strValue = intSlider+'_'+intPict;
498					for (i = 0; i < RowItems.length; i++)
499					{
500						value = RowItems[i].getAttribute('data-value');
501						if (value == strValue)
502							BX.addClass(RowItems[i], 'bx_active');
503						else
504							BX.removeClass(RowItems[i], 'bx_active');
505					}
506				}
507			}
508		}
509	}
510};
511
512JCCatalogElement.prototype.SetMainPictFromItem = function(index)
513{
514	if (!!this.obPict)
515	{
516		var boolSet = false;
517		var obNewPicture = {};
518		if (!!this.offers[index])
519		{
520			if (!!this.offers[index].DETAIL_PICTURE)
521			{
522				obNewPict = this.offers[index].DETAIL_PICTURE;
523				boolSet = true;
524			}
525			else if (!!this.offers[index].PREVIEW_PICTURE)
526			{
527				obNewPict = this.offers[index].PREVIEW_PICTURE;
528				boolSet = true;
529			}
530		}
531		if (!boolSet)
532		{
533			if (!!this.defaultPict.detail)
534			{
535				obNewPict = this.defaultPict.detail;
536				boolSet = true;
537			}
538			else if (!!this.defaultPict.preview)
539			{
540				obNewPict = this.defaultPict.preview;
541				boolSet = true;
542			}
543		}
544		if (boolSet)
545		{
546			BX.adjust(
547				this.obPict,
548				{
549					props: {
550						src: obNewPict.SRC,
551						className: (obNewPict.WIDTH > obNewPict.HEIGHT ? 'landscape' : 'portrait')
552					}
553				}
554			);
555		}
556	}
557};
558
559JCCatalogElement.prototype.QuantityUp = function()
560{
561	var curValue = 0;
562	var boolSet = true;
563	if (0 == this.errorCode && this.showQuantity)
564	{
565		curValue = (
566			this.isDblQuantity
567			? parseFloat(this.obQuantity.value)
568			: parseInt(this.obQuantity.value)
569		);
570		if (!isNaN(curValue))
571		{
572			curValue += this.stepQuantity;
573			if (this.checkQuantity)
574			{
575				if (curValue > this.maxQuantity)
576					boolSet = false;
577			}
578			
579			if (boolSet)
580			{
581				this.obQuantity.value = curValue;
582			}
583		}
584	}
585};
586
587JCCatalogElement.prototype.QuantityDown = function()
588{
589	var curValue = 0;
590	var boolSet = true;
591	if (0 == this.errorCode && this.showQuantity)
592	{
593		curValue = (
594			this.isDblQuantity
595			? parseFloat(this.obQuantity.value)
596			: parseInt(this.obQuantity.value)
597		);
598		if (!isNaN(curValue))
599		{
600			curValue -= this.stepQuantity;
601			if (curValue < this.stepQuantity)
602				boolSet = false;
603			if (boolSet)
604			{
605				this.obQuantity.value = curValue;
606			}
607		}
608	}
609};
610
611JCCatalogElement.prototype.QuantityChange = function()
612{
613	var curValue = 0;
614	var boolSet = true;
615	if (0 == this.errorCode && this.showQuantity)
616	{
617		curValue = (
618			this.isDblQuantity
619			? parseFloat(this.obQuantity.value)
620			: parseInt(this.obQuantity.value)
621		);
622		if (!isNaN(curValue))
623		{
624			if (this.checkQuantity)
625			{
626				if (curValue > this.maxQuantity)
627				{
628					boolSet = false;
629					curValue = this.maxQuantity;
630				}
631				else if (curValue < this.stepQuantity)
632				{
633					boolSet = false;
634					curValue = this.stepQuantity;
635				}
636			}
637			if (!boolSet)
638			{
639				this.obQuantity.value = curValue;
640				//
641			}
642		}
643		else
644		{
645			this.obQuantity.value = this.stepQuantity;
646			//
647		}
648	}
649};
650
651JCCatalogElement.prototype.QuantitySet = function(index)
652{
653	if (0 == this.errorCode)
654	{
655		this.canBuy = this.offers[index].CAN_BUY;
656		if (this.showQuantity)
657		{
658			this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
659			this.checkQuantity = this.offers[index].CHECK_QUANTITY;
660			this.maxQuantity = (this.isDblQuantity
661				? parseFloat(this.offers[index].MAX_QUANTITY)
662				: parseInt(this.offers[index].MAX_QUANTITY)
663			);
664			this.stepQuantity = (this.isDblQuantity
665				? parseFloat(this.offers[index].STEP_QUANTITY)
666				: parseInt(this.offers[index].STEP_QUANTITY)
667			);
668			this.obQuantity.value = this.stepQuantity;
669			if (!!this.obMeasure)
670			{
671				if (!!this.offers[index].MEASURE)
672				{
673					BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
674				}
675				else
676				{
677					BX.adjust(this.obMeasure, { html : ''});
678				}
679			}
680			if (!!this.obQuantityLimit.all)
681			{
682				if (!this.checkQuantity)
683				{
684					BX.adjust(this.obQuantityLimit.value, { html: '' });
685					BX.adjust(this.obQuantityLimit.all, { style: {display: 'none'} });
686				}
687				else
688				{
689					var strLimit = this.offers[index].MAX_QUANTITY;
690					if (!!this.offers[index].MEASURE)
691						strLimit += (' '+this.offers[index].MEASURE);
692					BX.adjust(this.obQuantityLimit.value, { html: strLimit});
693					BX.adjust(this.obQuantityLimit.all, { style: {display: ''} });
694				}
695			}
696		}
697	}
698};
699
700JCCatalogElement.prototype.SelectOfferProp = function(e)
701{
702	if (!e) e = window.event;
703	var target = BX.proxy_context;
704	if (!!target && target.hasAttribute('data-treevalue'))
705	{
706		var strTreeValue = target.getAttribute('data-treevalue');
707		var arTreeItem = strTreeValue.split('_');
708		this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]);
709		var 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				BX.removeClass(RowItems[i], 'bx_active');
715			}
716		}
717		BX.addClass(target, 'bx_active');
718	}
719};
720
721JCCatalogElement.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
722{
723	var index = -1;
724	for (var i = 0; i < this.treeProps.length; i++)
725	{
726		if (this.treeProps[i].ID == strPropID)
727		{
728			index = i;
729			break;
730		}
731	}
732
733	if (-1 < index)
734	{
735		var arFilter = {};
736		for (i = 0; i < index; i++)
737		{
738			var strName = 'PROP_'+this.treeProps[i].ID;
739			arFilter[strName] = this.selectedValues[strName];
740		}
741		var strName = 'PROP_'+this.treeProps[index].ID;
742		arFilter[strName] = strPropValue;
743		for (i = index+1; i < this.treeProps.length; i++)
744		{
745			strName = 'PROP_'+this.treeProps[i].ID;
746			var arShowValues = this.GetRowValues(arFilter, strName);
747			if (!arShowValues)
748				break;
749			if (this.showAbsent)
750			{
751				var arCanBuyValues = [];
752				var tmpFilter = []; 
753				tmpFilter = BX.clone(arFilter, true);
754				for (var j = 0; j < arShowValues.length; j++)
755				{
756					tmpFilter[strName] = arShowValues[j];
757					if (this.GetCanBuy(tmpFilter))
758						arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
759				}
760			}
761			else
762			{
763				var arCanBuyValues = arShowValues;
764			}
765			if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
766				arFilter[strName] = this.selectedValues[strName];
767			else
768				arFilter[strName] = arCanBuyValues[0];
769			this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
770		}
771		this.selectedValues = arFilter;
772		this.ChangeInfo();
773	}
774};
775
776JCCatalogElement.prototype.RowLeft = function(e)
777{
778	if (!e) e = window.event;
779	var target = BX.proxy_context;
780	if (!!target && target.hasAttribute('data-treevalue'))
781	{
782		var strTreeValue = target.getAttribute('data-treevalue');
783		var index = -1;
784		for (var i = 0; i < this.treeProps.length; i++)
785		{
786			if (this.treeProps[i].ID == strTreeValue)
787			{
788				index = i;
789				break;
790			}
791		}
792		if (-1 < index && 5 < this.showCount[index])
793		{
794			if ((5 - this.showStart[index]) < this.showCount[index])
795			{
796				this.showStart[index]--;
797				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
798			}
799		}
800	}
801};
802
803JCCatalogElement.prototype.RowRight = function(e)
804{
805	if (!e) e = window.event;
806	var target = BX.proxy_context;
807	if (!!target && target.hasAttribute('data-treevalue'))
808	{
809		var strTreeValue = target.getAttribute('data-treevalue');
810		var index = -1;
811		for (var i = 0; i < this.treeProps.length; i++)
812		{
813			if (this.treeProps[i].ID == strTreeValue)
814			{
815				index = i;
816				break;
817			}
818		}
819		if (-1 < index && 5 < this.showCount[index])
820		{
821			if (0 > this.showStart[index])
822			{
823				this.showStart[index]++;
824				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
825			}
826		}
827	}
828};
829
830JCCatalogElement.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
831{
832	var i = 0;
833	var value;
834	var countShow = 0;
835	var strNewLen = '';
836	if (-1 < intNumber && intNumber < this.obTreeRows.length)
837	{
838		var RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false);
839		if (!!RowItems && 0 < RowItems.length)
840		{
841			countShow = showID.length;
842			strNewLen = (5 < countShow ? (100/countShow)+'%' : '20%');
843			obData = {
844				props: { className: '' },
845				style: {
846					width: strNewLen
847				}
848			};
849			if ('E' == this.treeProps[intNumber].TYPE)
850				obData.style.paddingTop = strNewLen;
851			for (i = 0; i < RowItems.length; i++)
852			{
853				value = RowItems[i].getAttribute('data-onevalue');
854				if (BX.util.in_array(value, canBuyID))
855				{
856					if (value == activeID)
857						obData.props.className = 'bx_active';
858					else
859						obData.props.className = '';
860				}
861				else
862				{
863					if (value == activeID)
864						obData.props.className = 'bx_active bx_missing';
865					else
866						obData.props.className = 'bx_missing';
867				}
868				if (BX.util.in_array(value, showID))
869					obData.style.display = '';
870				else
871					obData.style.display = 'none';
872				BX.adjust(RowItems[i], obData);
873			}
874			obData = {
875				style: {
876					width: (5 < countShow ? 20*countShow : 100)+'%',
877					marginLeft: '0%'
878				} 
879			};
880			BX.adjust(this.obTreeRows[intNumber].LIST, obData);
881			if ('E' == this.treeProps[intNumber].TYPE)
882				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}});
883			else
884				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_size full' : 'bx_item_detail_size')}});
885			if (5 < countShow)
886			{
887				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: ''}});
888				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: ''}});
889			}
890			else
891			{
892				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}});
893				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}});				
894			}
895			this.showCount[intNumber] = countShow;
896			this.showStart[intNumber] = 0;
897		}
898	}
899};
900
901JCCatalogElement.prototype.GetRowValues = function(arFilter, index)
902{
903	var arValues = [];
904	var boolSearch = false;
905	if (0 == arFilter.length)
906	{
907		for (var i = 0; i < this.offers.length; i++)
908		{
909			if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
910				arValues[arValues.length] = this.offers[i].TREE[index];
911		}
912		boolSearch = true;
913	}
914	else
915	{
916		for (var i = 0; i < this.offers.length; i++)
917		{
918			var boolOneSearch = true;
919			for (var j in arFilter)
920			{
921				if (arFilter[j] != this.offers[i].TREE[j])
922				{
923					boolOneSearch = false;
924					break;
925				}
926			}
927			if (boolOneSearch)
928			{
929				if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
930					arValues[arValues.length] = this.offers[i].TREE[index];
931				boolSearch = true;
932			}
933		}
934	}
935	return (boolSearch ? arValues : false);
936};
937
938JCCatalogElement.prototype.GetCanBuy = function(arFilter)
939{
940	var boolSearch = false;
941	for (var i = 0; i < this.offers.length; i++)
942	{
943		var boolOneSearch = true;
944		for (var j in arFilter)
945		{
946			if (arFilter[j] != this.offers[i].TREE[j])
947			{
948				boolOneSearch = false;
949				break;
950			}
951		}
952		if (boolOneSearch)
953		{
954			if (this.offers[i].CAN_BUY)
955			{
956				boolSearch = true;
957				break;
958			}
959		}
960	}
961	return boolSearch;
962};
963
964JCCatalogElement.prototype.SetCurrent = function()
965{
966	var arFilter = {};
967	var current = this.offers[this.offerNum].TREE;
968	for (var i = 0; i < this.treeProps.length; i++)
969	{
970		var strName = 'PROP_'+this.treeProps[i].ID;
971		var arShowValues = this.GetRowValues(arFilter, strName);
972		if (!arShowValues)
973			break;
974		if (BX.util.in_array(current[strName], arShowValues))
975		{
976			arFilter[strName] = current[strName];
977		}
978		else
979		{
980			arFilter[strName] = arShowValues[0];
981			this.offerNum = 0;
982		}
983		if (this.showAbsent)
984		{
985			var arCanBuyValues = [];
986			var tmpFilter = []; 
987			tmpFilter = BX.clone(arFilter, true);
988			for (var j = 0; j < arShowValues.length; j++)
989			{
990				tmpFilter[strName] = arShowValues[j];
991				if (this.GetCanBuy(tmpFilter))
992					arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
993			}
994		}
995		else
996		{
997			var arCanBuyValues = arShowValues;
998		}
999		this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
1000	}
1001	this.selectedValues = arFilter;
1002	this.ChangeInfo();
1003};
1004
1005JCCatalogElement.prototype.ChangeInfo = function()
1006{
1007	var index = -1;
1008	for (var i = 0; i < this.offers.length; i++)
1009	{
1010		var boolOneSearch = true;
1011		for (var j in this.selectedValues)
1012		{
1013			if (this.selectedValues[j] != this.offers[i].TREE[j])
1014			{
1015				boolOneSearch = false;
1016				break;
1017			}
1018		}
1019		if (boolOneSearch)
1020		{
1021			index = i;
1022			break;
1023		}
1024	}
1025	if (-1 < index)
1026	{
1027		if (!!this.obPrice.price)
1028		{
1029			BX.adjust(this.obPrice.price, {html: this.offers[index].PRICE.PRINT_DISCOUNT_VALUE});
1030			if (this.offers[index].PRICE.DISCOUNT_VALUE != this.offers[index].PRICE.VALUE)
1031			{
1032				if (this.showOldPrice)
1033				{
1034					if (!!this.obPrice.full)
1035						BX.adjust(this.obPrice.full, {style: {display: ''}, html: this.offers[index].PRICE.PRINT_VALUE});
1036					if (!!this.obPrice.discount)
1037						BX.adjust(this.obPrice.discount, {style: {display: ''}, html: this.offers[index].PRICE.PRINT_DISCOUNT_DIFF});
1038				}
1039				if (this.showPercent)
1040				{
1041					if (!!this.obPrice.percent)
1042						BX.adjust(this.obPrice.percent, {style: {display: ''}, html: this.offers[index].PRICE.DISCOUNT_DIFF_PERCENT+'%'});
1043				}
1044			}
1045			else
1046			{
1047				if (this.showOldPrice)
1048				{
1049					if (!!this.obPrice.full)
1050						BX.adjust(this.obPrice.full, {style: {display: 'none'}, html: ''});
1051					if (!!this.obPrice.discount)
1052						BX.adjust(this.obPrice.discount, {style: {display: 'none'}, html: ''});
1053				}
1054				if (this.showPercent)
1055				{
1056					if (!!this.obPrice.percent)
1057						BX.adjust(this.obPrice.percent, {style: {display: 'none'}, html: ''});
1058				}
1059			}
1060		}
1061		for (i = 0; i < this.offers.length; i++)
1062		{
1063			if (this.showOfferGroup && this.offers[i].OFFER_GROUP)
1064			{
1065				if (i != index)
1066				{
1067					BX.adjust(BX(this.visual.OFFER_GROUP+this.offers[i].ID), { style: {display: 'none'} });
1068				}
1069			}
1070			if ('' == this.sliders[i].ID)
1071				continue;
1072			if (i == index)
1073			{
1074				this.sliders[i].START = 0;
1075				BX.adjust(this.sliders[i].LIST, {style: { marginLeft: '0%' }});
1076				BX.adjust(this.sliders[i].CONT, {style: { display: ''}});
1077			}
1078			else
1079			{	
1080				BX.adjust(this.sliders[i].CONT, {style: { display: 'none'}});
1081			}
1082		}
1083		if (this.showOfferGroup && this.offers[index].OFFER_GROUP)
1084		{
1085			BX.adjust(BX(this.visual.OFFER_GROUP+this.offers[index].ID), { style: {display: ''} });
1086		}
1087		if (0 < this.offers[index].SLIDER_COUNT)
1088		{
1089			this.SetMainPict(this.offers[index].ID, this.offers[index].SLIDER[0].ID);			
1090		}
1091		else
1092		{
1093			this.SetMainPictFromItem(index);
1094		}
1095		if (this.showSkuProps && !!this.obSkuProps)
1096		{
1097			if (0 == this.offers[index].DISPLAY_PROPERTIES.length)
1098			{
1099				BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
1100			}
1101			else
1102			{
1103				BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
1104			}
1105		}
1106		this.offerNum = index;
1107		if (this.showQuantity)
1108		{
1109			this.QuantitySet(this.offerNum);
1110		}
1111		BX.onCustomEvent('onCatalogStoreProductChange', [this.offers[this.offerNum].ID]);
1112	}
1113};
1114
1115JCCatalogElement.prototype.Basket = function()
1116{
1117	if (!this.canBuy)
1118		return;
1119	
1120	switch (this.productType)
1121	{
1122	case 1://product
1123	case 2://set
1124		var strBasket = this.product.buyUrl;
1125		if (this.showQuantity)
1126			strBasket += '&quantity='+this.obQuantity.value;
1127		location.href=strBasket;
1128		break;
1129	case 3://sku
1130		var strBasket = this.offers[this.offerNum].BUY_URL;
1131		if (this.showQuantity)
1132			strBasket += '&quantity='+this.obQuantity.value;
1133		location.href=strBasket;
1134		break;
1135	default:
1136		return;
1137	}
1138};
1139
1140JCCatalogElement.prototype.ShowBasketPopup = function(arResult)
1141{
1142	var strContent = '';
1143	if ('object' == typeof(arResult))
1144	{
1145		if ('OK' == arResult.STATUS)
1146		{
1147			strName = '';
1148			strPict = '';
1149			switch(this.productType)
1150			{
1151			case 1://
1152			case 2:
1153				strName = this.product.name;
1154				strPict = this.product.pict.SRC;
1155				break;
1156			case 3:
1157				strName = this.offers[this.offerNum].NAME;
1158				strPict = this.offers[this.offerNum].PICT.SRC;
1159				break;
1160			}
1161			strContent = '<p>'+BX.message('ADD_TO_BASKET_OK')+'</p>';
1162			strContent += '<img src="'+strPict+'" height="130"><p>'+strName+'</p>';
1163		}
1164		else
1165		{
1166			
1167		}
1168	}
1169	else
1170	{
1171		
1172	}
1173    var popup = BX.PopupWindowManager.create('CatalogSectionBasket'+this.visual.ID, null, {
1174        autoHide: false,
1175        //    zIndex: 0,
1176        offsetLeft: 0,
1177        offsetTop: 0,
1178        overlay : true,
1179        draggable: {restrict:true},
1180        closeByEsc: true,
1181        closeIcon: { right : "12px", top : "10px"},
1182        content: '' +
1183            '<div style="width:300px;text-align: center;padding-top:5px; margin-bottom: 10px;">' +
1184            strContent+
1185            '<a class="bx_bt_blue bx_medium" href="'+BX.message("setButtonBuyUrl")+'"><span class="bx_icon_cart"></span><span>'+BX.message("setButtonBuyName")+'</span></a>'+
1186            '</div>'
1187	    });
1188
1189    popup.show();
1190};
1191
1192JCCatalogElementZoom = function(arParams)
1193{
1194
1195};
1196
1197JCCatalogElementZoom.prototype.Init = function()
1198{
1199	
1200};
1201
1202JCCatalogElementZoom.prototype.SetPict = function(arPict)
1203{
1204	
1205};
1206
1207JCCatalogElementZoom.prototype.Show = function(e)
1208{
1209	
1210};

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.