PageSourceSearch

https://kealan.ru/bitrix/templates/aspro_mshop/components/bitrix/news.list/news_tov/script.js

js kealan.ru collected 2026-10-04 00:08:44 UTC 41,920 bytes, 1,595 lines download raw bytes

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

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.