PageSourceSearch

https://xn-----dlccfbfdksbbn6ccdrcazo.xn--p1ai/bitrix/cache/js/s1/…3938a1cfbfade4d097a0_v1.js?1787070401109211

js xn-----dlccfbfdksbbn6ccdrcazo.xn--p1ai collected 2026-10-04 23:53:34 UTC 109,211 bytes, 3,290 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:97:"/local/templates/main/components/bitrix/catalog.smart.filter/costum/script.min.js?170215560014592";s:6:"source";s:77:"/local/templates/main/components/bitrix/catalog.smart.filter/costum/script.js";s:3:"min";s:81:"/local/templates/main/components/bitrix/catalog.smart.filter/costum/script.min.js";s:3:"map";s:81:"/local/templates/main/components/bitrix/catalog.smart.filter/costum/script.map.js";}"*/
3function JCSmartFilter(t,e,i){this.ajaxURL=t;this.form=null;this.timer=null;this.cacheKey="";this.cache=[];this.popups=[];this.viewMode=e;if(i&&i.SEF_SET_FILTER_URL){this.bindUrlToButton("set_filter",i.SEF_SET_FILTER_URL);this.sef=true}if(i&&i.SEF_DEL_FILTER_URL){this.bindUrlToButton("del_filter",i.SEF_DEL_FILTER_URL)}}JCSmartFilter.prototype.keyup=function(t){if(!!this.timer){clearTimeout(this.timer)}this.timer=setTimeout(BX.delegate((function(){this.reload(t)}),this),500)};JCSmartFilter.prototype.click=function(t){if(!!this.timer){clearTimeout(this.timer)}this.timer=setTimeout(BX.delegate((function(){this.reload(t)}),this),500)};JCSmartFilter.prototype.reload=function(t){if(this.cacheKey!==""){if(!!this.timer){clearTimeout(this.timer)}this.timer=setTimeout(BX.delegate((function(){this.reload(t)}),this),1e3);return}this.cacheKey="|";this.position=BX.pos(t,true);this.form=BX.findParent(t,{tag:"form"});if(this.form){var e=[];e[0]={name:"ajax",value:"y"};this.gatherInputsValues(e,BX.findChildren(this.form,{tag:new RegExp("^(input|select)$","i")},true));for(var i=0;i<e.length;i++)this.cacheKey+=e[i].name+":"+e[i].value+"|";if(this.cache[this.cacheKey]){this.curFilterinput=t;this.postHandler(this.cache[this.cacheKey],true)}else{if(this.sef){var r=BX("set_filter");r.disabled=true}this.curFilterinput=t;BX.ajax.loadJSON(this.ajaxURL,this.values2post(e),BX.delegate(this.postHandler,this))}}};JCSmartFilter.prototype.updateItem=function(t,e){if(e.PROPERTY_TYPE==="N"||e.PRICE){var i=window["trackBar"+t];if(!i&&e.ENCODED_ID)i=window["trackBar"+e.ENCODED_ID];if(i&&e.VALUES){if(e.VALUES.MIN){if(e.VALUES.MIN.FILTERED_VALUE)i.setMinFilteredValue(e.VALUES.MIN.FILTERED_VALUE);else i.setMinFilteredValue(e.VALUES.MIN.VALUE)}if(e.VALUES.MAX){if(e.VALUES.MAX.FILTERED_VALUE)i.setMaxFilteredValue(e.VALUES.MAX.FILTERED_VALUE);else i.setMaxFilteredValue(e.VALUES.MAX.VALUE)}}}else if(e.VALUES){for(var r in e.VALUES){if(e.VALUES.hasOwnProperty(r)){var s=e.VALUES[r];var n=BX(s.CONTROL_ID);if(!!n){var l=document.querySelector('[data-role="label_'+s.CONTROL_ID+'"]');if(s.DISABLED){if(l)BX.addClass(l,"disabled");else BX.addClass(n.parentNode,"disabled")}else{if(l)BX.removeClass(l,"disabled");else BX.removeClass(n.parentNode,"disabled")}if(s.hasOwnProperty("ELEMENT_COUNT")){l=document.querySelector('[data-role="count_'+s.CONTROL_ID+'"]');if(l)l.innerHTML=s.ELEMENT_COUNT}}}}}};JCSmartFilter.prototype.postHandler=function(t,e){var i,r,s;var n=BX("modef");var l=BX("modef_num");if(!!t&&!!t.ITEMS){for(var a in this.popups){if(this.popups.hasOwnProperty(a)){this.popups[a].destroy()}}this.popups=[];for(var o in t.ITEMS){if(t.ITEMS.hasOwnProperty(o)){this.updateItem(o,t.ITEMS[o])}}if(!!n&&!!l){l.innerHTML=t.ELEMENT_COUNT;i=BX.findChildren(n,{tag:"A"},true);if(t.FILTER_URL&&i){i[0].href=BX.util.htmlspecialcharsback(t.FILTER_URL)}if(t.FILTER_AJAX_URL&&t.COMPONENT_CONTAINER_ID){BX.unbindAll(i[0]);BX.bind(i[0],"click",(function(e){r=BX.util.htmlspecialcharsback(t.FILTER_AJAX_URL);BX.ajax.insertToNode(r,t.COMPONENT_CONTAINER_ID);return BX.PreventDefault(e)}))}if(t.INSTANT_RELOAD&&t.COMPONENT_CONTAINER_ID){r=BX.util.htmlspecialcharsback(t.FILTER_AJAX_URL);BX.ajax.insertToNode(r,t.COMPONENT_CONTAINER_ID)}else{if(n.style.display==="none"){n.style.display="inline-block"}if(this.viewMode=="VERTICAL"){s=BX.findChild(BX.findParent(this.curFilterinput,{class:"bx-filter-parameters-box"}),{class:"bx-filter-container-modef"},true,false);s.appendChild(n)}if(t.SEF_SET_FILTER_URL){this.bindUrlToButton("set_filter",t.SEF_SET_FILTER_URL)}}}}if(this.sef){var c=BX("set_filter");c.disabled=false;c.focus()}if(!e&&this.cacheKey!==""){this.cache[this.cacheKey]=t}this.cacheKey=""};JCSmartFilter.prototype.bindUrlToButton=function(t,e){var i=BX(t);if(i){var r=function(t,e){return function(){return e(t)}};
3if(i.type=="submit")i.type="button";BX.bind(i,"click",r(e,(function(t){window.location.href=t;return false})))}};JCSmartFilter.prototype.gatherInputsValues=function(t,e){if(e){for(var i=0;i<e.length;i++){var r=e[i];if(r.disabled||!r.type)continue;switch(r.type.toLowerCase()){case"text":case"textarea":case"password":case"hidden":case"select-one":if(r.value.length)t[t.length]={name:r.name,value:r.value};break;case"radio":case"checkbox":if(r.checked)t[t.length]={name:r.name,value:r.value};break;case"select-multiple":for(var s=0;s<r.options.length;s++){if(r.options[s].selected)t[t.length]={name:r.name,value:r.options[s].value}}break;default:break}}}};JCSmartFilter.prototype.values2post=function(t){var e=[];var i=e;var r=0;while(r<t.length){var s=t[r].name.indexOf("[");if(s==-1){i[t[r].name]=t[r].value;i=e;r++}else{var n=t[r].name.substring(0,s);var l=t[r].name.substring(s+1);if(!i[n])i[n]=[];var a=l.indexOf("]");if(a==-1){i=e;r++}else if(a==0){i=i[n];t[r].name=""+i.length}else{i=i[n];t[r].name=l.substring(0,a)+l.substring(a+1)}}}return e};JCSmartFilter.prototype.hideFilterProps=function(t){var e=t.parentNode,i=e.querySelector("[data-role='bx_filter_block']"),r=e.querySelector("[data-role='prop_angle']");if(BX.hasClass(e,"bx-active")){new BX.easing({duration:300,start:{opacity:1,height:i.offsetHeight},finish:{opacity:0,height:0},transition:BX.easing.transitions.quart,step:function(t){i.style.opacity=t.opacity;i.style.height=t.height+"px"},complete:function(){i.setAttribute("style","");BX.removeClass(e,"bx-active")}}).animate();BX.addClass(r,"fa-angle-down");BX.removeClass(r,"fa-angle-up")}else{i.style.display="block";i.style.opacity=0;i.style.height="auto";var s=i.offsetHeight;i.style.height=0;new BX.easing({duration:300,start:{opacity:0,height:0},finish:{opacity:1,height:s},transition:BX.easing.transitions.quart,step:function(t){i.style.opacity=t.opacity;i.style.height=t.height+"px"},complete:function(){}}).animate();BX.addClass(e,"bx-active");BX.removeClass(r,"fa-angle-down");BX.addClass(r,"fa-angle-up")}};JCSmartFilter.prototype.showDropDownPopup=function(t,e){var i=t.querySelector('[data-role="dropdownContent"]');this.popups["smartFilterDropDown"+e]=BX.PopupWindowManager.create("smartFilterDropDown"+e,t,{autoHide:true,offsetLeft:0,offsetTop:3,overlay:false,draggable:{restrict:true},closeByEsc:true,content:BX.clone(i)});this.popups["smartFilterDropDown"+e].show()};JCSmartFilter.prototype.selectDropDownItem=function(t,e){this.keyup(BX(e));var i=BX.findParent(BX(e),{className:"bx-filter-select-container"},false);var r=i.querySelector('[data-role="currentOption"]');r.innerHTML=t.innerHTML;BX.PopupWindowManager.getCurrentPopup().close()};BX.namespace("BX.Iblock.SmartFilter");BX.Iblock.SmartFilter=function(){var t=function(t){if(typeof t==="object"){this.leftSlider=BX(t.leftSlider);this.rightSlider=BX(t.rightSlider);this.tracker=BX(t.tracker);this.trackerWrap=BX(t.trackerWrap);this.minInput=BX(t.minInputId);this.maxInput=BX(t.maxInputId);this.minPrice=parseFloat(t.minPrice);this.maxPrice=parseFloat(t.maxPrice);this.curMinPrice=parseFloat(t.curMinPrice);this.curMaxPrice=parseFloat(t.curMaxPrice);this.fltMinPrice=t.fltMinPrice?parseFloat(t.fltMinPrice):parseFloat(t.curMinPrice);this.fltMaxPrice=t.fltMaxPrice?parseFloat(t.fltMaxPrice):parseFloat(t.curMaxPrice);this.precision=t.precision||0;this.priceDiff=this.maxPrice-this.minPrice;this.leftPercent=0;this.rightPercent=0;this.fltMinPercent=0;this.fltMaxPercent=0;this.colorUnavailableActive=BX(t.colorUnavailableActive);this.colorAvailableActive=BX(t.colorAvailableActive);this.colorAvailableInactive=BX(t.colorAvailableInactive);this.isTouch=false;this.init();if("ontouchstart"in document.documentElement){this.isTouch=true;BX.bind(this.leftSlider,"touchstart",BX.proxy((function(t){this.onMoveLeftSlider(t)}),this));BX.bind(this.rightSlider,"touchstart",BX.proxy((function(t){this.onMoveRightSlider(t)}),this))}else{BX.bind(this.leftSlider,"mousedown",BX.proxy((function(t){this.onMoveLeftSlider(t)}),this));BX.bind(this.rightSlider,"mousedown",BX.proxy((function(t){this.onMoveRightSlider(t)}),this))}BX.bind(this.minInput,"keyup",BX.proxy((function(t){this.onInputChange()}),this));BX.bind(this.maxInput,"keyup",BX.proxy((function(t){this.onInputChange()}),this))}};t.prototype.init=function(){var t;if(this.curMinPrice>this.minPrice){t=this.curMinPrice-this.minPrice;this.leftPercent=t*100/this.priceDiff;this.leftSlider.style.left=this.leftPercent+"%";this.colorUnavailableActive.style.left=this.leftPercent+"%"}this.setMinFilteredValue(this.fltMinPrice);if(this.curMaxPrice<this.maxPrice){t=this.maxPrice-this.curMaxPrice;this.rightPercent=t*100/this.priceDiff;this.rightSlider.style.right=this.rightPercent+"%";this.colorUnavailableActive.style.right=this.rightPercent+"%"}this.setMaxFilteredValue(this.fltMaxPrice)};t.prototype.setMinFilteredValue=function(t){this.fltMinPrice=parseFloat(t);if(this.fltMinPrice>=this.minPrice){var e=this.fltMinPrice-this.minPrice;this.fltMinPercent=e*100/this.priceDiff;if(this.leftPercent>this.fltMinPercent)this.colorAvailableActive.style.left=this.leftPercent+"%";else this.colorAvailableActive.style.left=this.fltMinPercent+"%";this.colorAvailableInactive.style.left=this.fltMinPercent+"%"}else{this.colorAvailableActive.style.left="0%";this.colorAvailableInactive.style.left="0%"}};t.prototype.setMaxFilteredValue=function(t){this.fltMaxPrice=parseFloat(t);if(this.fltMaxPrice<=this.maxPrice){var e=this.maxPrice-this.fltMaxPrice;this.fltMaxPercent=e*100/this.priceDiff;if(this.rightPercent>this.fltMaxPercent)this.colorAvailableActive.style.right=this.rightPercent+"%";else this.colorAvailableActive.style.right=this.fltMaxPercent+"%";this.colorAvailableInactive.style.right=this.fltMaxPercent+"%"}else{this.colorAvailableActive.style.right="0%";this.colorAvailableInactive.style.right="0%"}};t.prototype.getXCoord=function(t){var e=t.getBoundingClientRect();var i=document.body;var r=document.documentElement;var s=window.pageXOffset||r.scrollLeft||i.scrollLeft;var n=r.clientLeft||i.clientLeft||0;var l=e.left+s-n;return Math.round(l)};t.prototype.getPageX=function(t){t=t||window.event;var e=null;if(this.isTouch&&event.targetTouches[0]!=null){e=t.targetTouches[0].pageX}else if(t.pageX!=null){e=t.pageX}else if(t.clientX!=null){var i=document.documentElement;var r=document.body;e=t.clientX+(i.scrollLeft||r&&r.scrollLeft||0);e-=i.clientLeft||0}return e};t.prototype.recountMinPrice=function(){var t=this.priceDiff*this.leftPercent/100;t=(this.minPrice+t).toFixed(this.precision);if(t!=this.minPrice)this.minInput.value=t;else this.minInput.value="";smartFilter.keyup(this.minInput)};t.prototype.recountMaxPrice=function(){var t=this.priceDiff*this.rightPercent/100;t=(this.maxPrice-t).toFixed(this.precision);if(t!=this.maxPrice)this.maxInput.value=t;else this.maxInput.value="";smartFilter.keyup(this.maxInput)};t.prototype.onInputChange=function(){var t;if(this.minInput.value){var e=this.minInput.value;if(e<this.minPrice)e=this.minPrice;if(e>this.maxPrice)e=this.maxPrice;t=e-this.minPrice;this.leftPercent=t*100/this.priceDiff;this.makeLeftSliderMove(false)}if(this.maxInput.value){var i=this.maxInput.value;if(i<this.minPrice)i=this.minPrice;if(i>this.maxPrice)i=this.maxPrice;t=this.maxPrice-i;this.rightPercent=t*100/this.priceDiff;this.makeRightSliderMove(false)}};t.prototype.makeLeftSliderMove=function(t){t=t!==false;this.leftSlider.style.left=this.leftPercent+"%";this.colorUnavailableActive.style.left=this.leftPercent+"%";var e=false;if(this.leftPercent+this.rightPercent>=100){e=true;this.rightPercent=100-this.leftPercent;this.rightSlider.style.right=this.rightPercent+"%";this.colorUnavailableActive.style.right=this.rightPercent+"%"}if(this.leftPercent>=this.fltMinPercent&&this.leftPercent<=100-this.fltMaxPercent){this.colorAvailableActive.style.left=this.leftPercent+"%";if(e){this.colorAvailableActive.style.right=100-this.leftPercent+"%"}}else if(this.leftPercent<=this.fltMinPercent){this.colorAvailableActive.style.left=this.fltMinPercent+"%";if(e){this.colorAvailableActive.style.right=100-this.fltMinPercent+"%"}}else if(this.leftPercent>=this.fltMaxPercent){this.colorAvailableActive.style.left=100-this.fltMaxPercent+"%";if(e){this.colorAvailableActive.style.right=this.fltMaxPercent+"%"}}if(t){this.recountMinPrice();if(e)this.recountMaxPrice()}};t.prototype.countNewLeft=function(t){var e=this.getPageX(t);var i=this.getXCoord(this.trackerWrap);var r=this.trackerWrap.offsetWidth;var s=e-i;if(s<0)s=0;else if(s>r)s=r;return s};t.prototype.onMoveLeftSlider=function(t){if(!this.isTouch){this.leftSlider.ondragstart=function(){return false}}if(!this.isTouch){document.onmousemove=BX.proxy((function(t){this.leftPercent=this.countNewLeft(t)*100/this.trackerWrap.offsetWidth;this.makeLeftSliderMove()}),this);document.onmouseup=function(){document.onmousemove=document.onmouseup=null}}else{document.ontouchmove=BX.proxy((function(t){this.leftPercent=this.countNewLeft(t)*100/this.trackerWrap.offsetWidth;this.makeLeftSliderMove()}),this);document.ontouchend=function(){document.ontouchmove=document.touchend=null}}return false};t.prototype.makeRightSliderMove=function(t){t=t!==false;this.rightSlider.style.right=this.rightPercent+"%";this.colorUnavailableActive.style.right=this.rightPercent+"%";var e=false;if(this.leftPercent+this.rightPercent>=100){e=true;this.leftPercent=100-this.rightPercent;this.leftSlider.style.left=this.leftPercent+"%";this.colorUnavailableActive.style.left=this.leftPercent+"%"}if(100-this.rightPercent>=this.fltMinPercent&&this.rightPercent>=this.fltMaxPercent){this.colorAvailableActive.style.right=this.rightPercent+"%";if(e){this.colorAvailableActive.style.left=100-this.rightPercent+"%"}}else if(this.rightPercent<=this.fltMaxPercent){this.colorAvailableActive.style.right=this.fltMaxPercent+"%";if(e){this.colorAvailableActive.style.left=100-this.fltMaxPercent+"%"}}else if(100-this.rightPercent<=this.fltMinPercent){this.colorAvailableActive.style.right=100-this.fltMinPercent+"%";if(e){this.colorAvailableActive.style.left=this.fltMinPercent+"%"}}if(t){this.recountMaxPrice();if(e)this.recountMinPrice()}};t.prototype.onMoveRightSlider=function(t){if(!this.isTouch){this.rightSlider.ondragstart=function(){return false}}if(!this.isTouch){document.onmousemove=BX.proxy((function(t){this.rightPercent=100-this.countNewLeft(t)*100/this.trackerWrap.offsetWidth;this.makeRightSliderMove()}),this);document.onmouseup=function(){document.onmousemove=document.onmouseup=null}}else{document.ontouchmove=BX.proxy((function(t){this.rightPercent=100-this.countNewLeft(t)*100/this.trackerWrap.offsetWidth;this.makeRightSliderMove()}),this);document.ontouchend=function(){document.ontouchmove=document.ontouchend=null}}return false};return t}();
4/* End */
5;
6; /* Start:"a:4:{s:4:"full";s:113:"/local/templates/main/components/bitrix/catalog/catalog/bitr
6ix/catalog.section/.default/script.js?170215560039848";s:6:"source";s:97:"/local/templates/main/components/bitrix/catalog/catalog/bitrix/catalog.section/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7(function (window) {
8
9if (!!window.JCCatalogSection)
10{
11	return;
12}
13
14var BasketButton = function(params)
15{
16	BasketButton.superclass.constructor.apply(this, arguments);
17	this.nameNode = BX.create('span', {
18		props : { className : 'bx_medium bx_bt_button', id : this.id },
19		style: typeof(params.style) === 'object' ? params.style : {},
20		text: params.text
21	});
22	this.buttonNode = BX.create('span', {
23		attrs: { className: params.ownerClass },
24		style: { marginBottom: '0', borderBottom: '0 none transparent' },
25		children: [this.nameNode],
26		events : this.contextEvents
27	});
28	if (BX.browser.IsIE())
29	{
30		this.buttonNode.setAttribute("hideFocus", "hidefocus");
31	}
32};
33BX.extend(BasketButton, BX.PopupWindowButton);
34
35window.JCCatalogSection = function (arParams)
36{
37	this.productType = 0;
38	this.showQuantity = true;
39	this.showAbsent = true;
40	this.secondPict = false;
41	this.showOldPrice = false;
42	this.showPercent = false;
43	this.showSkuProps = false;
44	this.basketAction = 'ADD';
45	this.showClosePopup = false;
46	this.useCompare = false;
47	this.visual = {
48		ID: '',
49		PICT_ID: '',
50		SECOND_PICT_ID: '',
51		QUANTITY_ID: '',
52		QUANTITY_UP_ID: '',
53		QUANTITY_DOWN_ID: '',
54		PRICE_ID: '',
55		DSC_PERC: '',
56		SECOND_DSC_PERC: '',
57		DISPLAY_PROP_DIV: '',
58		BASKET_PROP_DIV: ''
59	};
60	this.product = {
61		checkQuantity: false,
62		maxQuantity: 0,
63		stepQuantity: 1,
64		isDblQuantity: false,
65		canBuy: true,
66		canSubscription: true,
67		name: '',
68		pict: {},
69		id: 0,
70		addUrl: '',
71		buyUrl: ''
72	};
73
74	this.basketMode = '';
75	this.basketData = {
76		useProps: false,
77		emptyProps: false,
78		quantity: 'quantity',
79		props: 'prop',
80		basketUrl: '',
81		sku_props: '',
82		sku_props_var: 'basket_props',
83		add_url: '',
84		buy_url: ''
85	};
86
87	this.compareData = {
88		compareUrl: '',
89		comparePath: ''
90	};
91
92	this.defaultPict = {
93		pict: null,
94		secondPict: null
95	};
96
97	this.checkQuantity = false;
98	this.maxQuantity = 0;
99	this.stepQuantity = 1;
100	this.isDblQuantity = false;
101	this.canBuy = true;
102	this.currentBasisPrice = {};
103	this.canSubscription = true;
104	this.precision = 6;
105	this.precisionFactor = Math.pow(10,this.precision);
106
107	this.offers = [];
108	this.offerNum = 0;
109	this.treeProps = [];
110	this.obTreeRows = [];
111	this.showCount = [];
112	this.showStart = [];
113	this.selectedValues = {};
114
115	this.obProduct = null;
116	this.obQuantity = null;
117	this.obQuantityUp = null;
118	this.obQuantityDown = null;
119	this.obPict = null;
120	this.obSecondPict = null;
121	this.obPrice = null;
122	this.obTree = null;
123	this.obBuyBtn = null;
124	this.obBasketActions = null;
125	this.obNotAvail = null;
126	this.obDscPerc = null;
127	this.obSecondDscPerc = null;
128	this.obSkuProps = null;
129	this.obMeasure = null;
130	this.obCompare = null;
131
132	this.obPopupWin = null;
133	this.basketUrl = '';
134	this.basketParams = {};
135
136	this.treeRowShowSize = 5;
137	this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 };
138	this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 };
139
140	this.lastElement = false;
141	this.containerHeight = 0;
142
143	this.errorCode = 0;
144
145	if ('object' === typeof arParams)
146	{
147		this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
148		this.showQuantity = arParams.SHOW_QUANTITY;
149		this.showAbsent = arParams.SHOW_ABSENT;
150		this.secondPict = !!arParams.SECOND_PICT;
151		this.showOldPrice = !!arParams.SHOW_OLD_PRICE;
152		this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT;
153		this.showSkuProps = !!arParams.SHOW_SKU_PROPS;
154		if (!!arParams.ADD_TO_BASKET_ACTION)
155		{
156			this.basketAction = arParams.ADD_TO_BASKET_ACTION;
157		}
158		this.showClosePopup = !!arParams.SHOW_CLOSE_POPUP;
159		this.useCompare = !!arParams.DISPLAY_COMPARE;
160
161		this.visual = arParams.VISUAL;
162
163		switch (this.productType)
164		{
165			case 1://product
166			case 2://set
167				if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
168				{
169					if (this.showQuantity)
170					{
171						this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
172						this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
173						if (this.product.checkQuantity)
174						{
175							this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
176						}
177						this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
178
179						this.checkQuantity = this.product.checkQuantity;
180						this.isDblQuantity = this.product.isDblQuantity;
181						this.maxQuantity = this.product.maxQuantity;
182						this.stepQuantity = this.product.stepQuantity;
183						if (this.isDblQuantity)
184						{
185							this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor;
186						}
187					}
188					this.product.canBuy = arParams.PRODUCT.CAN_BUY;
189					this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
190					if (!!arParams.PRODUCT.BASIS_PRICE)
191					{
192						this.currentBasisPrice = arParams.PRODUCT.BASIS_PRICE;
193					}
194
195					this.canBuy = this.product.canBuy;
196					this.canSubscription = this.product.canSubscription;
197
198					this.product.name = arParams.PRODUCT.NAME;
199					this.product.pict = arParams.PRODUCT.PICT;
200					this.product.id = arParams.PRODUCT.ID;
201					if (!!arParams.PRODUCT.ADD_URL)
202					{
203						this.product.addUrl = arParams.PRODUCT.ADD_URL;
204					}
205					if (!!arParams.PRODUCT.BUY_URL)
206					{
207						this.product.buyUrl = arParams.PRODUCT.BUY_URL;
208					}
209					if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
210					{
211						this.basketData.useProps = !!arParams.BASKET.ADD_PROPS;
212						this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS;
213					}
214				}
215				else
216				{
217					this.errorCode = -1;
218				}
219				break;
220			case 3://sku
221				if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
222				{
223					if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
224					{
225						this.product.name = arParams.PRODUCT.NAME;
226						this.product.id = arParams.PRODUCT.ID;
227					}
228					this.offers = arParams.OFFERS;
229					this.offerNum = 0;
230					if (!!arParams.OFFER_SELECTED)
231					{
232						this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
233					}
234					if (isNaN(this.offerNum))
235					{
236						this.offerNum = 0;
237					}
238					if (!!arParams.TREE_PROPS)
239					{
240						this.treeProps = arParams.TREE_PROPS;
241					}
242					if (!!arParams.DEFAULT_PICTURE)
243					{
244						this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
245						this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
246					}
247				}
248				break;
249			default:
250				this.errorCode = -1;
251		}
252		if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
253		{
254			if (!!arParams.BASKET.QUANTITY)
255			{
256				this.basketData.quantity = arParams.BASKET.QUANTITY;
257			}
258			if (!!arParams.BASKET.PROPS)
259			{
260				this.basketData.props = arParams.BASKET.PROPS;
261			}
262			if (!!arParams.BASKET.BASKET_URL)
263			{
264				this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
265			}
266			if (3 === this.productType)
267			{
268				if (!!arParams.BASKET.SKU_PROPS)
269				{
270					this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
271				}
272			}
273			if (!!arParams.BASKET.ADD_URL_TEMPLATE)
274			{
275				this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE;
276			}
277			if (!!arParams.BASKET.BUY_URL_TEMPLATE)
278			{
279				this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE;
280			}
281			if (this.basketData.add_url === '' && this.basketData.buy_url === '')
282			{
283				this.errorCode = -1024;
284			}
285		}
286		if (this.useCompare)
287		{
288			if (!!arParams.COMPARE && typeof(arParams.COMPARE) === 'object')
289			{
290				if (!!arParams.COMPARE.COMPARE_PATH)
291				{
292					this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH;
293				}
294				if (!!arParams.COMPARE.COMPARE_URL_TEMPLATE)
295				{
296					this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE;
297				}
298				else
299				{
300					this.useCompare = false;
301				}
302			}
303			else
304			{
305				this.useCompare = false;
306			}
307		}
308
309		this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT);
310	}
311	if (0 === this.errorCode)
312	{
313		BX.ready(BX.delegate(this.Init,this));
314	}
315};
316
317window.JCCatalogSection.prototype.Init = function()
318{
319	var i = 0,
320		strPrefix = '',
321		TreeItems = null;
322
323	this.obProduct = BX(this.visual.ID);
324	if (!this.obProduct)
325	{
326		this.errorCode = -1;
327	}
328	this.obPict = BX(this.visual.PICT_ID);
329	if (!this.obPict)
330	{
331		this.errorCode = -2;
332	}
333	if (this.secondPict && !!this.visual.SECOND_PICT_ID)
334	{
335		this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
336	}
337	this.obPrice = BX(this.visual.PRICE_ID);
338	if (!this.obPrice)
339	{
340		this.errorCode = -16;
341	}
342	if (this.showQuantity && !!this.visual.QUANTITY_ID)
343	{
344		this.obQuantity = BX(this.visual.QUANTITY_ID);
345		if (!!this.visual.QUANTITY_UP_ID)
346		{
347			this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
348		}
349		if (!!this.visual.QUANTITY_DOWN_ID)
350		{
351			this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
352		}
353	}
354	if (3 === this.productType && this.offers.length > 0)
355	{
356		if (!!this.visual.TREE_ID)
357		{
358			this.obTree = BX(this.visual.TREE_ID);
359			if (!this.obTree)
360			{
361				this.errorCode = -256;
362			}
363			strPrefix = this.visual.TREE_ITEM_ID;
364			for (i = 0; i < this.treeProps.length; i++)
365			{
366				this.obTreeRows[i] = {
367					LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'),
368					RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'),
369					LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
370					CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
371				};
372				if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
373				{
374					this.errorCode = -512;
375					break;
376				}
377			}
378		}
379		if (!!this.visual.QUANTITY_MEASURE)
380		{
381			this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
382		}
383	}
384
385	this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID);
386	if (!!this.obBasketActions)
387	{
388		if (!!this.visual.BUY_ID)
389		{
390			this.obBuyBtn = BX(this.visual.BUY_ID);
391		}
392	}
393	this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS);
394
395	if (this.showPercent)
396	{
397		if (!!this.visual.DSC_PERC)
398		{
399			this.obDscPerc = BX(this.visual.DSC_PERC);
400		}
401		if (this.secondPict && !!this.visual.SECOND_DSC_PERC)
402		{
403			this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
404		}
405	}
406
407	if (this.showSkuProps)
408	{
409		if (!!this.visual.DISPLAY_PROP_DIV)
410		{
411			this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
412		}
413	}
414
415	if (0 === this.errorCode)
416	{
417		if (this.showQuantity)
418		{
419			if (!!this.obQuantityUp)
420			{
421				BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
422			}
423			if (!!this.obQuantityDown)
424			{
425				BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
426			}
427			if (!!this.obQuantity)
428			{
429				BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
430			}
431		}
432		switch (this.productType)
433		{
434			case 1://product
435				break;
436			case 3://sku
437				if (this.offers.length > 0)
438				{
439					TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
440					if (!!TreeItems && 0 < TreeItems.length)
441					{
442						for (i = 0; i < TreeItems.length; i++)
443						{
444							BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this));
445						}
446					}
447					for (i = 0; i < this.obTreeRows.length; i++)
448					{
449						BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(this.RowLeft, this));
450						BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(this.RowRight, this));
451					}
452					this.SetCurrent();
453				}
454				break;
455		}
456		if (!!this.obBuyBtn)
457		{
458			if (this.basketAction === 'ADD')
459			{
460				BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Add2Basket, this));
461			}
462			else
463			{
464				BX.bind(this.obBuyBtn, 'click', BX.delegate(this.BuyBasket, this));
465			}
466		}
467		if (this.lastElement)
468		{
469			this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
470			if (isNaN(this.containerHeight))
471			{
472				this.containerHeight = 0;
473			}
474			this.setHeight();
475			BX.bind(window, 'resize', BX.delegate(this.checkHeight, this));
476			BX.bind(this.obProduct.parentNode, 'mouseover', BX.delegate(this.setHeight, this));
477			BX.bind(this.obProduct.parentNode, 'mouseout', BX.delegate(this.clearHeight, this));
478		}
479		if (this.useCompare)
480		{
481			this.obCompare = BX(this.visual.COMPARE_LINK_ID);
482			if (!!this.obCompare)
483			{
484				BX.bind(this.obCompare, 'click', BX.proxy(this.Compare, this));
485			}
486		}
487	}
488};
489
490window.JCCatalogSection.prototype.checkHeight = function()
491{
492	this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
493	if (isNaN(this.containerHeight))
494	{
495		this.containerHeight = 0;
496	}
497};
498
499window.JCCatalogSection.prototype.setHeight = function()
500{
501	if (0 < this.containerHeight)
502	{
503		BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}});
504	}
505};
506
507window.JCCatalogSection.prototype.clearHeight = function()
508{
509	BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}});
510};
511
512window.JCCatalogSection.prototype.QuantityUp = function()
513{
514	var curValue = 0,
515		boolSet = true,
516		calcPrice;
517
518	if (0 === this.errorCode && this.showQuantity && this.canBuy)
519	{
520		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
521		if (!isNaN(curValue))
522		{
523			curValue += this.stepQuantity;
524			if (this.checkQuantity)
525			{
526				if (curValue > this.maxQuantity)
527				{
528					boolSet = false;
529				}
530			}
531			if (boolSet)
532			{
533				if (this.isDblQuantity)
534				{
535					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
536				}
537				this.obQuantity.value = curValue;
538				calcPrice = {
539					DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue,
540					VALUE: this.currentBasisPrice.VALUE * curValue,
541					DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue,
542					DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT,
543					CURRENCY: this.currentBasisPrice.CURRENCY
544				};
545				this.setPrice(calcPrice);
546			}
547		}
548	}
549};
550
551window.JCCatalogSection.prototype.QuantityDown = function()
552{
553	var curValue = 0,
554		boolSet = true,
555		calcPrice;
556
557	if (0 === this.errorCode && this.showQuantity && this.canBuy)
558	{
559		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10));
560		if (!isNaN(curValue))
561		{
562			curValue -= this.stepQuantity;
563			if (curValue < this.stepQuantity)
564			{
565				boolSet = false;
566			}
567			if (boolSet)
568			{
569				if (this.isDblQuantity)
570				{
571					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
572				}
573				this.obQuantity.value = curValue;
574				calcPrice = {
575					DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue,
576					VALUE: this.currentBasisPrice.VALUE * curValue,
577					DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue,
578					DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT,
579					CURRENCY: this.currentBasisPrice.CURRENCY
580				};
581				this.setPrice(calcPrice);
582			}
583		}
584	}
585};
586
587window.JCCatalogSection.prototype.QuantityChange = function()
588{
589	var curValue = 0,
590		calcPrice,
591		intCount,
592		count;
593
594	if (0 === this.errorCode && this.showQuantity)
595	{
596		if (this.canBuy)
597		{
598			curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
599			if (!isNaN(curValue))
600			{
601				if (this.checkQuantity)
602				{
603					if (curValue > this.maxQuantity)
604					{
605						curValue = this.maxQuantity;
606					}
607				}
608				if (curValue < this.stepQuantity)
609				{
610					curValue = this.stepQuantity;
611				}
612				else
613				{
614					count = Math.round((curValue*this.precisionFactor)/this.stepQuantity)/this.precisionFactor;
615					intCount = parseInt(count, 10);
616					if (isNaN(intCount))
617					{
618						intCount = 1;
619						count = 1.1;
620					}
621					if (count > intCount)
622					{
623						curValue = (intCount <= 1 ? this.stepQuantity : intCount*this.stepQuantity);
624						curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
625					}
626				}
627				this.obQuantity.value = curValue;
628			}
629			else
630			{
631				this.obQuantity.value = this.stepQuantity;
632			}
633		}
634		else
635		{
636			this.obQuantity.value = this.stepQuantity;
637		}
638		calcPrice = {
639			DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * this.obQuantity.value,
640			VALUE: this.currentBasisPrice.VALUE * this.obQuantity.value,
641			DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * this.obQuantity.value,
642			DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT,
643			CURRENCY: this.currentBasisPrice.CURRENCY
644		};
645		this.setPrice(calcPrice);
646	}
647};
648
649window.JCCatalogSection.prototype.QuantitySet = function(index)
650{
651	if (0 === this.errorCode)
652	{
653		this.canBuy = this.offers[index].CAN_BUY;
654		if (this.canBuy)
655		{
656			if (!!this.obBasketActions)
657			{
658				BX.style(this.obBasketActions, 'display', '');
659			}
660			if (!!this.obNotAvail)
661			{
662				BX.style(this.obNotAvail, 'display', 'none');
663			}
664		}
665		else
666		{
667			if (!!this.obBasketActions)
668			{
669				BX.style(this.obBasketActions, 'display', 'none');
670			}
671			if (!!this.obNotAvail)
672			{
673				BX.style(this.obNotAvail, 'display', '');
674			}
675		}
676		if (this.showQuantity)
677		{
678			this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
679			this.checkQuantity = this.offers[index].CHECK_QUANTITY;
680			if (this.isDblQuantity)
681			{
682				this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY);
683				this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor;
684			}
685			else
686			{
687				this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10);
688				this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10);
689			}
690
691			this.obQuantity.value = this.stepQuantity;
692			this.obQuantity.disabled = !this.canBuy;
693			if (!!this.obMeasure)
694			{
695				if (!!this.offers[index].MEASURE)
696				{
697					BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
698				}
699				else
700				{
701					BX.adjust(this.obMeasure, { html : ''});
702				}
703			}
704		}
705		this.currentBasisPrice = this.offers[index].BASIS_PRICE;
706	}
707};
708
709window.JCCatalogSection.prototype.SelectOfferProp = function()
710{
711	var i = 0,
712		value = '',
713		strTreeValue = '',
714		arTreeItem = [],
715		RowItems = null,
716		target = BX.proxy_context;
717
718	if (!!target && target.hasAttribute('data-treevalue'))
719	{
720		strTreeValue = target.getAttribute('data-treevalue');
721		arTreeItem = strTreeValue.split('_');
722		if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
723		{
724			RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
725			if (!!RowItems && 0 < RowItems.length)
726			{
727				for (i = 0; i < RowItems.length; i++)
728				{
729					value = RowItems[i].getAttribute('data-onevalue');
730					if (value === arTreeItem[1])
731					{
732						BX.addClass(RowItems[i], 'bx_active');
733					}
734					else
735					{
736						BX.removeClass(RowItems[i], 'bx_active');
737					}
738				}
739			}
740		}
741	}
742};
743
744window.JCCatalogSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
745{
746	var strName = '',
747		arShowValues = false,
748		i, j,
749		arCanBuyValues = [],
750		allValues = [],
751		index = -1,
752		arFilter = {},
753		tmpFilter = [];
754
755	for (i = 0; i < this.treeProps.length; i++)
756	{
757		if (this.treeProps[i].ID === strPropID)
758		{
759			index = i;
760			break;
761		}
762	}
763
764	if (-1 < index)
765	{
766		for (i = 0; i < index; i++)
767		{
768			strName = 'PROP_'+this.treeProps[i].ID;
769			arFilter[strName] = this.selectedValues[strName];
770		}
771		strName = 'PROP_'+this.treeProps[index].ID;
772		arShowValues = this.GetRowValues(arFilter, strName);
773		if (!arShowValues)
774		{
775			return false;
776		}
777		if (!BX.util.in_array(strPropValue, arShowValues))
778		{
779			return false;
780		}
781		arFilter[strName] = strPropValue;
782		for (i = index+1; i < this.treeProps.length; i++)
783		{
784			strName = 'PROP_'+this.treeProps[i].ID;
785			arShowValues = this.GetRowValues(arFilter, strName);
786			if (!arShowValues)
787			{
788				return false;
789			}
790			allValues = [];
791			if (this.showAbsent)
792			{
793				arCanBuyValues = [];
794				tmpFilter = [];
795				tmpFilter = BX.clone(arFilter, true);
796				for (j = 0; j < arShowValues.length; j++)
797				{
798					tmpFilter[strName] = arShowValues[j];
799					allValues[allValues.length] = arShowValues[j];
800					if (this.GetCanBuy(tmpFilter))
801						arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
802				}
803			}
804			else
805			{
806				arCanBuyValues = arShowValues;
807			}
808			if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
809			{
810				arFilter[strName] = this.selectedValues[strName];
811			}
812			else
813			{
814				if (this.config.showAbsent)
815					arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]);
816				else
817					arFilter[strName] = arCanBuyValues[0];
818			}
819			this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
820		}
821		this.selectedValues = arFilter;
822		this.ChangeInfo();
823	}
824	return true;
825};
826
827window.JCCatalogSection.prototype.RowLeft = function()
828{
829	var i = 0,
830		strTreeValue = '',
831		index = -1,
832		target = BX.proxy_context;
833
834	if (!!target && target.hasAttribute('data-treevalue'))
835	{
836		strTreeValue = target.getAttribute('data-treevalue');
837		for (i = 0; i < this.treeProps.length; i++)
838		{
839			if (this.treeProps[i].ID === strTreeValue)
840			{
841				index = i;
842				break;
843			}
844		}
845		if (-1 < index && this.treeRowShowSize < this.showCount[index])
846		{
847			if (0 > this.showStart[index])
848			{
849				this.showStart[index]++;
850				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
851				BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeEnableArrow });
852			}
853
854			if (0 <= this.showStart[index])
855			{
856				BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeDisableArrow });
857			}
858		}
859	}
860};
861
862window.JCCatalogSection.prototype.RowRight = function()
863{
864	var i = 0,
865		strTreeValue = '',
866		index = -1,
867		target = BX.proxy_context;
868
869	if (!!target && target.hasAttribute('data-treevalue'))
870	{
871		strTreeValue = target.getAttribute('data-treevalue');
872		for (i = 0; i < this.treeProps.length; i++)
873		{
874			if (this.treeProps[i].ID === strTreeValue)
875			{
876				index = i;
877				break;
878			}
879		}
880		if (-1 < index && this.treeRowShowSize < this.showCount[index])
881		{
882			if ((this.treeRowShowSize - this.showStart[index]) < this.showCount[index])
883			{
884				this.showStart[index]--;
885				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
886				BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeEnableArrow });
887			}
888
889			if ((this.treeRowShowSize - this.showStart[index]) >= this.showCount[index])
890			{
891				BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeDisableArrow });
892			}
893		}
894	}
895};
896
897window.JCCatalogSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
898{
899	var i = 0,
900		showI = 0,
901		value = '',
902		countShow = 0,
903		strNewLen = '',
904		obData = {},
905		pictMode = false,
906		extShowMode = false,
907		isCurrent = false,
908		selectIndex = 0,
909		obLeft = this.treeEnableArrow,
910		obRight = this.treeEnableArrow,
911		currentShowStart = 0,
912		RowItems = null;
913
914	if (-1 < intNumber && intNumber < this.obTreeRows.length)
915	{
916		RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false);
917		if (!!RowItems && 0 < RowItems.length)
918		{
919			pictMode = ('PICT' === this.treeProps[intNumber].SHOW_MODE);
920			countShow = showID.length;
921			extShowMode = this.treeRowShowSize < countShow;
922			strNewLen = (extShowMode ? (100/countShow)+'%' : '20%');
923			obData = {
924				props: { className: '' },
925				style: {
926					width: strNewLen
927				}
928			};
929			if (pictMode)
930			{
931				obData.style.paddingTop = strNewLen;
932			}
933			for (i = 0; i < RowItems.length; i++)
934			{
935				value = RowItems[i].getAttribute('data-onevalue');
936				isCurrent = (value === activeID);
937				if (BX.util.in_array(value, canBuyID))
938				{
939					obData.props.className = (isCurrent ? 'bx_active' : '');
940				}
941				else
942				{
943					obData.props.className = (isCurrent ? 'bx_active bx_missing' : 'bx_missing');
944				}
945				obData.style.display = 'none';
946				if (BX.util.in_array(value, showID))
947				{
948					obData.style.display = '';
949					if (isCurrent)
950					{
951						selectIndex = showI;
952					}
953					showI++;
954				}
955				BX.adjust(RowItems[i], obData);
956			}
957
958			obData = {
959				style: {
960					width: (extShowMode ? 20*countShow : 100)+'%',
961					marginLeft: '0%'
962				}
963			};
964			if (pictMode)
965			{
966				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}});
967			}
968			else
969			{
970				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_size full' : 'bx_item_detail_size')}});
971			}
972			if (extShowMode)
973			{
974				if (selectIndex +1 === countShow)
975				{
976					obRight = this.treeDisableArrow;
977				}
978				if (this.treeRowShowSize <= selectIndex)
979				{
980					currentShowStart = this.treeRowShowSize - selectIndex - 1;
981					obData.style.marginLeft = currentShowStart*20+'%';
982				}
983				if (0 === currentShowStart)
984				{
985					obLeft = this.treeDisableArrow;
986				}
987				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: obLeft });
988				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: obRight });
989			}
990			else
991			{
992				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}});
993				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}});
994			}
995			BX.adjust(this.obTreeRows[intNumber].LIST, obData);
996			this.showCount[intNumber] = countShow;
997			this.showStart[intNumber] = currentShowStart;
998		}
999	}
1000};
1001
1002window.JCCatalogSection.prototype.GetRowValues = function(arFilter, index)
1003{
1004	var i = 0,
1005		j,
1006		arValues = [],
1007		boolSearch = false,
1008		boolOneSearch = true;
1009
1010	if (0 === arFilter.length)
1011	{
1012		for (i = 0; i < this.offers.length; i++)
1013		{
1014			if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
1015			{
1016				arValues[arValues.length] = this.offers[i].TREE[index];
1017			}
1018		}
1019		boolSearch = true;
1020	}
1021	else
1022	{
1023		for (i = 0; i < this.offers.length; i++)
1024		{
1025			boolOneSearch = true;
1026			for (j in arFilter)
1027			{
1028				if (arFilter[j] !== this.offers[i].TREE[j])
1029				{
1030					boolOneSearch = false;
1031					break;
1032				}
1033			}
1034			if (boolOneSearch)
1035			{
1036				if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
1037				{
1038					arValues[arValues.length] = this.offers[i].TREE[index];
1039				}
1040				boolSearch = true;
1041			}
1042		}
1043	}
1044	return (boolSearch ? arValues : false);
1045};
1046
1047window.JCCatalogSection.prototype.GetCanBuy = function(arFilter)
1048{
1049	var i = 0,
1050		j,
1051		boolSearch = false,
1052		boolOneSearch = true;
1053
1054	for (i = 0; i < this.offers.length; i++)
1055	{
1056		boolOneSearch = true;
1057		for (j in arFilter)
1058		{
1059			if (arFilter[j] !== this.offers[i].TREE[j])
1060			{
1061				boolOneSearch = false;
1062				break;
1063			}
1064		}
1065		if (boolOneSearch)
1066		{
1067			if (this.offers[i].CAN_BUY)
1068			{
1069				boolSearch = true;
1070				break;
1071			}
1072		}
1073	}
1074	return boolSearch;
1075};
1076
1077window.JCCatalogSection.prototype.SetCurrent = function()
1078{
1079	var i = 0,
1080		j = 0,
1081		arCanBuyValues = [],
1082		strName = '',
1083		arShowValues = false,
1084		arFilter = {},
1085		tmpFilter = [],
1086		current = this.offers[this.offerNum].TREE;
1087
1088	for (i = 0; i < this.treeProps.length; i++)
1089	{
1090		strName = 'PROP_'+this.treeProps[i].ID;
1091		arShowValues = this.GetRowValues(arFilter, strName);
1092		if (!arShowValues)
1093		{
1094			break;
1095		}
1096		if (BX.util.in_array(current[strName], arShowValues))
1097		{
1098			arFilter[strName] = current[strName];
1099		}
1100		else
1101		{
1102			arFilter[strName] = arShowValues[0];
1103			this.offerNum = 0;
1104		}
1105		if (this.showAbsent)
1106		{
1107			arCanBuyValues = [];
1108			tmpFilter = [];
1109			tmpFilter = BX.clone(arFilter, true);
1110			for (j = 0; j < arShowValues.length; j++)
1111			{
1112				tmpFilter[strName] = arShowValues[j];
1113				if (this.GetCanBuy(tmpFilter))
1114				{
1115					arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
1116				}
1117			}
1118		}
1119		else
1120		{
1121			arCanBuyValues = arShowValues;
1122		}
1123		this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
1124	}
1125	this.selectedValues = arFilter;
1126	this.ChangeInfo();
1127};
1128
1129window.JCCatalogSection.prototype.ChangeInfo = function()
1130{
1131	var i = 0,
1132		j,
1133		index = -1,
1134		boolOneSearch = true;
1135
1136	for (i = 0; i < this.offers.length; i++)
1137	{
1138		boolOneSearch = true;
1139		for (j in this.selectedValues)
1140		{
1141			if (this.selectedValues[j] !== this.offers[i].TREE[j])
1142			{
1143				boolOneSearch = false;
1144				break;
1145			}
1146		}
1147		if (boolOneSearch)
1148		{
1149			index = i;
1150			break;
1151		}
1152	}
1153	if (-1 < index)
1154	{
1155		if (!!this.obPict)
1156		{
1157			if (!!this.offers[index].PREVIEW_PICTURE)
1158			{
1159				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1160			}
1161			else
1162			{
1163				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1164			}
1165		}
1166		if (this.secondPict && !!this.obSecondPict)
1167		{
1168			if (!!this.offers[index].PREVIEW_PICTURE_SECOND)
1169			{
1170				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}});
1171			}
1172			else if (!!this.offers[index].PREVIEW_PICTURE.SRC)
1173			{
1174				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1175			}
1176			else if (!!this.defaultPict.secondPict)
1177			{
1178				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}});
1179			}
1180			else
1181			{
1182				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1183			}
1184		}
1185		if (this.showSkuProps && !!this.obSkuProps)
1186		{
1187			if (0 === this.offers[index].DISPLAY_PROPERTIES.length)
1188			{
1189				BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
1190			}
1191			else
1192			{
1193				BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
1194			}
1195		}
1196		this.setPrice(this.offers[index].PRICE);
1197		this.offerNum = index;
1198		this.QuantitySet(this.offerNum);
1199	}
1200};
1201
1202window.JCCatalogSection.prototype.setPrice = function(price)
1203{
1204	var strPrice,
1205		obData;
1206
1207	if (!!this.obPrice)
1208	{
1209		strPrice = BX.Currency.currencyFormat(price.DISCOUNT_VALUE, price.CURRENCY, true);
1210		if (this.showOldPrice && (price.DISCOUNT_VALUE !== price.VALUE))
1211		{
1212			strPrice += ' <span>'+BX.Currency.currencyFormat(price.VALUE, price.CURRENCY, true)+'</span>';
1213		}
1214		BX.adjust(this.obPrice, {html: strPrice});
1215		if (this.showPercent)
1216		{
1217			if (price.DISCOUNT_VALUE !== price.VALUE)
1218			{
1219				obData = {
1220					style: {
1221						display: ''
1222					},
1223					html: price.DISCOUNT_DIFF_PERCENT
1224				};
1225			}
1226			else
1227			{
1228				obData = {
1229					style: {
1230						display: 'none'
1231					},
1232					html: ''
1233				};
1234			}
1235			if (!!this.obDscPerc)
1236			{
1237				BX.adjust(this.obDscPerc, obData);
1238			}
1239			if (!!this.obSecondDscPerc)
1240			{
1241				BX.adjust(this.obSecondDscPerc, obData);
1242			}
1243		}
1244	}
1245};
1246
1247window.JCCatalogSection.prototype.Compare = function()
1248{
1249	var compareParams, compareLink;
1250	if (!!this.compareData.compareUrl)
1251	{
1252		switch (this.productType)
1253		{
1254			case 1://product
1255			case 2://set
1256				compareLink = this.compareData.compareUrl.replace('#ID#', this.product.id.toString());
1257				break;
1258			case 3://sku
1259				compareLink = this.compareData.compareUrl.replace('#ID#', this.offers[this.offerNum].ID);
1260				break;
1261		}
1262		compareParams = {
1263			ajax_action: 'Y'
1264		};
1265		BX.ajax.loadJSON(
1266			compareLink,
1267			compareParams,
1268			BX.proxy(this.CompareResult, this)
1269		);
1270	}
1271};
1272
1273window.JCCatalogSection.prototype.CompareResult = function(result)
1274{
1275	var popupContent, popupButtons, popupTitle;
1276	if (!!this.obPopupWin)
1277	{
1278		this.obPopupWin.close();
1279	}
1280	if (typeof result !== 'object')
1281	{
1282		return false;
1283	}
1284	this.InitPopupWindow();
1285	popupTitle = {
1286		content: BX.create('div', {
1287			style: { marginRight: '30px', whiteSpace: 'nowrap' },
1288			text: BX.message('COMPARE_TITLE')
1289		})
1290	};
1291	if (result.STATUS === 'OK')
1292	{
1293		BX.onCustomEvent('OnCompareChange');
1294		popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+BX.message('COMPARE_MESSAGE_OK')+'</p></div>';
1295		if (this.showClosePopup)
1296		{
1297			popupButtons = [
1298				new BasketButton({
1299					ownerClass: this.obProduct.parentNode.parentNode.className,
1300					text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
1301					events: {
1302						click: BX.delegate(this.CompareRedirect, this)
1303					},
1304					style: {marginRight: '10px'}
1305				}),
1306				new BasketButton({
1307					ownerClass: this.obProduct.parentNode.parentNode.className,
1308					text: BX.message('BTN_MESSAGE_CLOSE_POPUP'),
1309					events: {
1310						click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1311					}
1312				})
1313			];
1314		}
1315		else
1316		{
1317			popupButtons = [
1318				new BasketButton({
1319					ownerClass: this.obProduct.parentNode.parentNode.className,
1320					text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
1321					events: {
1322						click: BX.delegate(this.CompareRedirect, this)
1323					}
1324				})
1325			];
1326		}
1327	}
1328	else
1329	{
1330		popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))+'</p></div>';
1331		popupButtons = [
1332			new BasketButton({
1333				ownerClass: this.obProduct.parentNode.parentNode.className,
1334				text: BX.message('BTN_MESSAGE_CLOSE'),
1335				events: {
1336					click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1337				}
1338
1339			})
1340		];
1341	}
1342	this.obPopupWin.setTitleBar(popupTitle);
1343	this.obPopupWin.setContent(popupContent);
1344	this.obPopupWin.setButtons(popupButtons);
1345	this.obPopupWin.show();
1346	return false;
1347};
1348
1349window.JCCatalogSection.prototype.CompareRedirect = function()
1350{
1351	if (!!this.compareData.comparePath)
1352	{
1353		location.href = this.compareData.comparePath;
1354	}
1355	else
1356	{
1357		this.obPopupWin.close();
1358	}
1359};
1360
1361window.JCCatalogSection.prototype.InitBasketUrl = function()
1362{
1363	this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url);
1364	switch (this.productType)
1365	{
1366		case 1://product
1367		case 2://set
1368			this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString());
1369			break;
1370		case 3://sku
1371			this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID);
1372			break;
1373	}
1374	this.basketParams = {
1375		'ajax_basket': 'Y'
1376	};
1377	if (this.showQuantity)
1378	{
1379		this.basketParams[this.basketData.quantity] = this.obQuantity.value;
1380	}
1381	if (!!this.basketData.sku_props)
1382	{
1383		this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
1384	}
1385};
1386
1387window.JCCatalogSection.prototype.FillBasketProps = function()
1388{
1389	if (!this.visual.BASKET_PROP_DIV)
1390	{
1391		return;
1392	}
1393	var
1394		i = 0,
1395		propCollection = null,
1396		foundValues = false,
1397		obBasketProps = null;
1398
1399	if (this.basketData.useProps && !this.basketData.emptyProps)
1400	{
1401		if (!!this.obPopupWin && !!this.obPopupWin.contentContainer)
1402		{
1403			obBasketProps = this.obPopupWin.contentContainer;
1404		}
1405	}
1406	else
1407	{
1408		obBasketProps = BX(this.visual.BASKET_PROP_DIV);
1409	}
1410	if (!!obBasketProps)
1411	{
1412		propCollection = obBasketProps.getElementsByTagName('select');
1413		if (!!propCollection && !!propCollection.length)
1414		{
1415			for (i = 0; i < propCollection.length; i++)
1416			{
1417				if (!propCollection[i].disabled)
1418				{
1419					switch(propCollection[i].type.toLowerCase())
1420					{
1421						case 'select-one':
1422							this.basketParams[propCollection[i].name] = propCollection[i].value;
1423							foundValues = true;
1424							break;
1425						default:
1426							break;
1427					}
1428				}
1429			}
1430		}
1431		propCollection = obBasketProps.getElementsByTagName('input');
1432		if (!!propCollection && !!propCollection.length)
1433		{
1434			for (i = 0; i < propCollection.length; i++)
1435			{
1436				if (!propCollection[i].disabled)
1437				{
1438					switch(propCollection[i].type.toLowerCase())
1439					{
1440						case 'hidden':
1441							this.basketParams[propCollection[i].name] = propCollection[i].value;
1442							foundValues = true;
1443							break;
1444						case 'radio':
1445							if (propCollection[i].checked)
1446							{
1447								this.basketParams[propCollection[i].name] = propCollection[i].value;
1448								foundValues = true;
1449							}
1450							break;
1451						default:
1452							break;
1453					}
1454				}
1455			}
1456		}
1457	}
1458	if (!foundValues)
1459	{
1460		this.basketParams[this.basketData.props] = [];
1461		this.basketParams[this.basketData.props][0] = 0;
1462	}
1463};
1464
1465window.JCCatalogSection.prototype.Add2Basket = function()
1466{
1467	this.basketMode = 'ADD';
1468	this.Basket();
1469};
1470
1471window.JCCatalogSection.prototype.BuyBasket = function()
1472{
1473	this.basketMode = 'BUY';
1474	this.Basket();
1475};
1476
1477window.JCCatalogSection.prototype.SendToBasket = function()
1478{
1479	if (!this.canBuy)
1480	{
1481		return;
1482	}
1483	this.InitBasketUrl();
1484	this.FillBasketProps();
1485	BX.ajax.loadJSON(
1486		this.basketUrl,
1487		this.basketParams,
1488		BX.delegate(this.BasketResult, this)
1489	);
1490};
1491
1492window.JCCatalogSection.prototype.Basket = function()
1493{
1494	var contentBasketProps = '';
1495	if (!this.canBuy)
1496	{
1497		return;
1498	}
1499	switch (this.productType)
1500	{
1501	case 1://product
1502	case 2://set
1503		if (this.basketData.useProps && !this.basketData.emptyProps)
1504		{
1505			this.InitPopupWindow();
1506			this.obPopupWin.setTitleBar({
1507				content: BX.create('div', {
1508					style: { marginRight: '30px', whiteSpace: 'nowrap' },
1509					text: BX.message('TITLE_BASKET_PROPS')
1510				})
1511			});
1512			if (BX(this.visual.BASKET_PROP_DIV))
1513			{
1514				contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
1515			}
1516			this.obPopupWin.setContent(contentBasketProps);
1517			this.obPopupWin.setButtons([
1518				new BasketButton({
1519					ownerClass: this.obProduct.parentNode.parentNode.className,
1520					text: BX.message('BTN_MESSAGE_SEND_PROPS'),
1521					events: {
1522						click: BX.delegate(this.SendToBasket, this)
1523					}
1524				})
1525			]);
1526			this.obPopupWin.show();
1527		}
1528		else
1529		{
1530			this.SendToBasket();
1531		}
1532		break;
1533	case 3://sku
1534		this.SendToBasket();
1535		break;
1536	}
1537};
1538
1539window.JCCatalogSection.prototype.BasketResult = function(arResult)
1540{
1541	var strContent = '',
1542		strPict = '',
1543		successful,
1544		buttons = [];
1545
1546	if (!!this.obPopupWin)
1547	{
1548		this.obPopupWin.close();
1549	}
1550	if ('object' !== typeof arResult)
1551	{
1552		return false;
1553	}
1554	successful = (arResult.STATUS === 'OK');
1555	if (successful && this.basketAction === 'BUY')
1556	{
1557		this.BasketRedirect();
1558	}
1559	else
1560	{
1561		this.InitPopupWindow();
1562		if (successful)
1563		{
1564			BX.onCustomEvent('OnBasketChange');
1565			switch(this.productType)
1566			{
1567			case 1://
1568			case 2://
1569				strPict = this.product.pict.SRC;
1570				break;
1571			case 3:
1572				strPict = (!!this.offers[this.offerNum].PREVIEW_PICTURE ?
1573					this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
1574					this.defaultPict.pict.SRC
1575				);
1576				break;
1577			}
1578			strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><img src="'+strPict+'" height="130"><p>'+this.product.name+'</p></div>';
1579			if (this.showClosePopup)
1580			{
1581				buttons = [
1582					new BasketButton({
1583						ownerClass: this.obProduct.parentNode.parentNode.className,
1584						text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
1585						events: {
1586							click: BX.delegate(this.BasketRedirect, this)
1587						},
1588						style: {marginRight: '10px'}
1589					}),
1590					new BasketButton({
1591						ownerClass: this.obProduct.parentNode.parentNode.className,
1592						text: BX.message("BTN_MESSAGE_CLOSE_POPUP"),
1593						events: {
1594							click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1595						}
1596					})
1597				];
1598			}
1599			else
1600			{
1601				buttons = [
1602					new BasketButton({
1603						ownerClass: this.obProduct.parentNode.parentNode.className,
1604						text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
1605						events: {
1606							click: BX.delegate(this.BasketRedirect, this)
1607						}
1608					})
1609				];
1610			}
1611		}
1612		else
1613		{
1614			strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))+'</p></div>';
1615			buttons = [
1616				new BasketButton({
1617					ownerClass: this.obProduct.parentNode.parentNode.className,
1618					text: BX.message('BTN_MESSAGE_CLOSE'),
1619					events: {
1620						click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1621					}
1622				})
1623			];
1624		}
1625		this.obPopupWin.setTitleBar({
1626			content: BX.create('div', {
1627				style: { marginRight: '30px', whiteSpace: 'nowrap' },
1628				text: (successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR'))
1629			})
1630		});
1631		this.obPopupWin.setContent(strContent);
1632		this.obPopupWin.setButtons(buttons);
1633		this.obPopupWin.show();
1634	}
1635};
1636
1637window.JCCatalogSection.prototype.BasketRedirect = function()
1638{
1639	location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
1640};
1641
1642window.JCCatalogSection.prototype.InitPopupWindow = function()
1643{
1644	if (!!this.obPopupWin)
1645	{
1646		return;
1647	}
1648	this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_'+this.visual.ID, null, {
1649		autoHide: false,
1650		offsetLeft: 0,
1651		offsetTop: 0,
1652		overlay : true,
1653		closeByEsc: true,
1654		titleBar: true,
1655		closeIcon: {top: '10px', right: '10px'}
1656	});
1657};
1658})(window);
1659/* End */
1660;
1661; /* Start:"a:4:{s:4:"full";s:59:"/local/components/project/webform/webform.js?17858987467585";s:6:"source";s:44:"/local/components/project/webform/webform.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1662if(!window.Project)
1663    window.Project = {};
1664
1665window.Project.Ajax = function(component, method, data)
1666{
1667    let params = {
1668        mode: 'class',
1669        data: {post: data}
1670    };
1671    let bx_promise = BX.ajax.runComponentAction(component, method, params);
1672    return new Promise(function(resolve, reject){
1673        bx_promise.then(function(response) {
1674            if (response.status === 'success')
1675            {
1676                resolve(response);
1677            }
1678            else
1679            {
1680                reject();
1681            }
1682        });
1683    });
1684}
1685
1686window.Project.Validity = {
1687    email: function(email) {
1688        let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
1689        return re.test(email);
1690    },
1691    input: function(input)
1692    {
1693        if(input.required && !input.value) return "Это поле должно быть заполнено";
1694        if(input.type === 'email' && !window.Project.Validity.email(input.value)) return "Некорректный email";
1695        if(input.type === 'checkbox' && input.classList.contains('visually-hidden') && !input.checked) return "Необходимо согласиться с условиями оферты";
1696
1697        if(input.pattern)
1698        {
1699            const pa = new RegExp(".{18,18}")
1700            if(!pa.test(input.value)) return "Это поле заполненно некорректно";
1701        }
1702
1703        console.log("[validity]", input);
1704
1705        return false;
1706    }
1707};
1708
1709window.Project.Webform = function(form_name, arParams)
1710{
1711    this.form_name = form_name;
1712    this.arParams = arParams;
1713    let self = this;
1714    this.ajax = function(data)
1715    {
1716        return window.Project.Ajax('project:webform', 'send', {
1717            fields: data,
1718            arParams: self.arParams
1719        })
1720    }
1721}
1722
1723window.Project.Webform.prototype = {
1724    constructor: window.Project.Webform,
1725    find: function(selector)
1726    {
1727        return this.findContainer().querySelector(selector)
1728    },
1729
1730    findAll: function(selector)
1731    {
1732        return this.findContainer().querySelectorAll(selector)
1733    },
1734
1735    findInputs: function()
1736    {
1737        return this.findAll('input, select, textarea');
1738    },
1739
1740    findContainer: function()
1741    {
1742        return document.forms[this.form_name];
1743    },
1744
1745    findSubmiters: function()
1746    {
1747        return this.findAll('button.btn');
1748    },
1749
1750
1751    bind: function()
1752    {
1753        let self = this;
1754        this.findSubmiters().forEach(function(btn){
1755            btn.addEventListener('click', self.submit.bind(self, btn));
1756        });
1757        this.findAll('input[type=file]').forEach(function(file_input){
1758            let hidden = self.find("[name="+file_input.dataset.name+"]");
1759            if(hidden)
1760            {
1761                self.bindFile(new window.Project.WebformFile(file_input, hidden));
1762            }
1763        })
1764
1765        this.bindCustom();
1766    },
1767
1768    bindFile: function(webform_file)
1769    {
1770
1771    },
1772
1773    bindCustom: function()
1774    {
1775
1776    },
1777
1778    //////////////////////////////
1779
1780    createHint(is_error, msg)
1781    {
1782        let hint = document.createElement('p');
1783        if(is_error)
1784        {
1785            hint.classList.add('form_error');
1786            hint.style.color = '#f00';
1787        }
1788        else
1789        {
1790            hint.classList.add('form_success');
1791            hint.style.color = 'rgb(5 154 5)';
1792        }
1793
1794        hint.innerText = msg;
1795        return hint;
1796    },
1797
1798
1799
1800    clearHints: function()
1801    {
1802        this.findAll('.form_error').forEach(function(ep){
1803            ep.parentNode.removeChild(ep);
1804        })
1805
1806        this.findAll('.form_success').forEach(function(ep){
1807            ep.parentNode.removeChild(ep);
1808        })
1809    },
1810
1811    attachHint(target, hint)
1812    {
1813        target.after(hint);
1814    },
1815
1816    /////////////////////////
1817
1818    collectAll: function()
1819    {
1820        let collect = {form: {}, js: []};
1821        this.findInputs().forEach(function(input){
1822            if(input.type === 'checkbox' || input.type === 'radio')
1823            {
1824                if(input.checked)collect.form[input.name] = input.value;
1825            }
1826            else
1827            {
1828                collect.form[input.name] = input.value;
1829            }
1830            collect.js.push(input);
1831        });
1832
1833        return collect;
1834    },
1835
1836    checkState: function()
1837    {
1838        let success = true;
1839        let self = this;
1840
1841        this.collectAll().js.forEach(function(input){
1842            let error = window.Project.Validity.input(input);
1843            if(error) {
1844                self.attachHint(input, self.createHint(true, error));
1845                success = false;
1846            }
1847        });
1848
1849        return success;
1850    },
1851
1852    submit: function(btn, e)
1853    {
1854        e.preventDefault();
1855        this.clearHints();
1856        if(this.checkState())
1857        {
1858            let self = this;
1859            this.ajax(this.collectAll().form).then(function(response){
1860                if(response.data.status)
1861                {
1862                    document.dispatchEvent(new CustomEvent('project:webform:success', {
1863                        detail: {
1864                            form: self.findContainer(),
1865                            button: btn,
1866                            formCode: self.arParams && self.arParams.CODE ? self.arParams.CODE : ''
1867                        }
1868                    }));
1869                    self.OnSuccess(btn);
1870                }
1871                else
1872                {
1873                    for (let i in response.data.errors)
1874                    {
1875                        let error = response.data.errors[i];
1876                        self.attachHint(btn, self.createHint(true, error));
1877                    }
1878                }
1879            })
1880        }
1881    },
1882
1883    OnSuccess: function(btn)
1884    {
1885        this.attachHint(btn, this.createHint(false, 'Форма успешно отправлена'));
1886        this.findContainer().reset();
1887    }
1888};
1889
1890
1891window.Project.WebformFile = function(input, hidden)
1892{
1893    this.input = input;
1894    this.hidden = hidden;
1895    this.proxy = new window.Project.Proxy();
1896
1897    this.bind();
1898}
1899
1900window.Project.WebformFile.prototype = {
1901    constructor: window.Project.WebformFile,
1902    bind: function()
1903    {
1904        this.input.addEventListener('change', this.update.bind(this));
1905    },
1906
1907    update: function()
1908    {
1909        console.log("[file] update", this.input.files[0])
1910        let self = this;
1911        if(this.input.files && this.input.files[0])
1912        {
1913            let file = this.input.files[0];
1914            let reader = new FileReader();
1915            reader.onload = function(e)
1916            {
1917                self.hidden.value = JSON.stringify({
1918                    name: file.name,
1919                    value: btoa(e.target.result)
1920                });
1921
1922                self.proxy.release(file.name);
1923            }
1924
1925            reader.readAsBinaryString(file);
1926        }
1927        else
1928        {
1929            self.hidden.value = '';
1930        }
1931    },
1932}
1933
1934window.Project.Proxy = function()
1935{
1936    this.handlers = [];
1937}
1938
1939window.Project.Proxy.prototype = {
1940    assign: function(callback)
1941    {
1942        this.handlers.push(callback);
1943    },
1944
1945    release: function(value)
1946    {
1947        this.handlers.forEach(function(handler){
1948            handler(value);
1949        })
1950    }
1951}
1952
1953/* End */
1954;
1955; /* Start:"a:4:{s:4:"full";s:102:"/local/templates/main/components/bitrix/catalog.viewed.products/catalog_veiw/script.js?170215560045475";s:6:"source";s:86:"/local/templates/main/components/bitrix/catalog.viewed.products/catalog_veiw/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1956(function (window) {
1957
1958    if (!!window.JCCatalogSectionViewed)
1959    {
1960        return;
1961    }
1962
1963    var BasketButton = function(params)
1964    {
1965        BasketButton.superclass.constructor.apply(this, arguments);
1966        this.nameNode = BX.create('span', {
1967            props : { className : 'bx_medium bx_bt_button', id : this.id },
1968            text: params.text
1969        });
1970        this.buttonNode = BX.create('span', {
1971            attrs: { className: params.ownerClass },
1972            style: { marginBottom: '0', borderBottom: '0 none transparent' },
1973            children: [this.nameNode],
1974            events : this.contextEvents
1975        });
1976        if (BX.browser.IsIE())
1977        {
1978            this.buttonNode.setAttribute("hideFocus", "hidefocus");
1979        }
1980    };
1981    BX.extend(BasketButton, BX.PopupWindowButton);
1982
1983    window.JCCatalogSectionViewed = function (arParams)
1984    {
1985        this.productType = 0;
1986        this.showQuantity = true;
1987        this.showAbsent = true;
1988        this.secondPict = false;
1989        this.showOldPrice = false;
1990        this.showPercent = false;
1991        this.showSkuProps = false;
1992        this.visual = {
1993            ID: '',
1994            PICT_ID: '',
1995            SECOND_PICT_ID: '',
1996            QUANTITY_ID: '',
1997            QUANTITY_UP_ID: '',
1998            QUANTITY_DOWN_ID: '',
1999            PRICE_ID: '',
2000            DSC_PERC: '',
2001            SECOND_DSC_PERC: '',
2002            DISPLAY_PROP_DIV: '',
2003            BASKET_PROP_DIV: ''
2004        };
2005        this.product = {
2006            checkQuantity: false,
2007            maxQuantity: 0,
2008            stepQuantity: 1,
2009            isDblQuantity: false,
2010            canBuy: true,
2011            canSubscription: true,
2012            name: '',
2013            pict: {},
2014            id: 0,
2015            addUrl: '',
2016            buyUrl: ''
2017        };
2018        this.basketData = {
2019            useProps: false,
2020            emptyProps: false,
2021            quantity: 'quantity',
2022            props: 'prop',
2023            basketUrl: ''
2024        };
2025
2026        this.defaultPict = {
2027            pict: null,
2028            secondPict: null
2029        };
2030
2031        this.checkQuantity = false;
2032        this.maxQuantity = 0;
2033        this.stepQuantity = 1;
2034        this.isDblQuantity = false;
2035        this.canBuy = true;
2036        this.canSubscription = true;
2037        this.precision = 6;
2038        this.precisionFactor = Math.pow(10,this.precision);
2039
2040        this.offers = [];
2041        this.offerNum = 0;
2042        this.treeProps = [];
2043        this.obTreeRows = [];
2044        this.showCount = [];
2045        this.showStart = [];
2046        this.selectedValues = {};
2047
2048        this.obProduct = null;
2049        this.obQuantity = null;
2050        this.obQuantityUp = null;
2051        this.obQuantityDown = null;
2052        this.obPict = null;
2053        this.obSecondPict = null;
2054        this.obPrice = null;
2055        this.obTree = null;
2056        this.obBuyBtn = null;
2057        this.obDscPerc = null;
2058        this.obSecondDscPerc = null;
2059        this.obSkuProps = null;
2060        this.obMeasure = null;
2061
2062        this.obPopupWin = null;
2063        this.basketUrl = '';
2064        this.basketParams = {};
2065
2066        this.treeRowShowSize = 5;
2067        this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 };
2068        this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 };
2069
2070        this.lastElement = false;
2071        this.containerHeight = 0;
2072
2073        this.errorCode = 0;
2074
2075        if ('object' === typeof arParams)
2076        {
2077            this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
2078            this.showQuantity = arParams.SHOW_QUANTITY;
2079            this.showAbsent = arParams.SHOW_ABSENT;
2080            this.secondPict = !!arParams.SECOND_PICT;
2081            this.showOldPrice = !!arParams.SHOW_OLD_PRICE;
2082            this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT;
2083            this.showSkuProps = !!arParams.SHOW_SKU_PROPS;
2084
2085            this.visual = arParams.VISUAL;
2086            switch (this.productType)
2087            {
2088                case 1://product
2089                case 2://set
2090                    if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
2091                    {
2092                        if (this.showQuantity)
2093                        {
2094                            this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
2095                            this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
2096                            if (this.product.checkQuantity)
2097                            {
2098                                this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
2099                            }
2100                            this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
2101
2102                            this.checkQuantity = this.product.checkQuantity;
2103                            this.isDblQuantity = this.product.isDblQuantity;
2104                            this.maxQuantity = this.product.maxQuantity;
2105                            this.stepQuantity = this.product.stepQuantity;
2106                            if (this.isDblQuantity)
2107                            {
2108                                this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor;
2109                            }
2110                        }
2111                        this.product.canBuy = arParams.PRODUCT.CAN_BUY;
2112                        this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
2113
2114                        this.canBuy = this.product.canBuy;
2115                        this.canSubscription = this.product.canSubscription;
2116
2117                        this.product.name = arParams.PRODUCT.NAME;
2118                        this.product.pict = arParams.PRODUCT.PICT;
2119                        this.product.id = arParams.PRODUCT.ID;
2120                        if (!!arParams.PRODUCT.ADD_URL)
2121                        {
2122                            this.product.addUrl = arParams.PRODUCT.ADD_URL;
2123                        }
2124                        if (!!arParams.PRODUCT.BUY_URL)
2125                        {
2126                            this.product.buyUrl = arParams.PRODUCT.BUY_URL;
2127                        }
2128                        if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
2129                        {
2130                            this.basketData.useProps = !!arParams.BASKET.ADD_PROPS;
2131                            this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS;
2132                        }
2133                    }
2134                    else
2135                    {
2136                        this.errorCode = -1;
2137                    }
2138                    break;
2139                case 3://sku
2140                    if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
2141                    {
2142                        if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
2143                        {
2144                            this.product.name = arParams.PRODUCT.NAME;
2145                            this.product.id = arParams.PRODUCT.ID;
2146                        }
2147                        this.offers = arParams.OFFERS;
2148                        this.offerNum = 0;
2149                        if (!!arParams.OFFER_SELECTED)
2150                        {
2151                            this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
2152                        }
2153                        if (isNaN(this.offerNum))
2154                        {
2155                            this.offerNum = 0;
2156                        }
2157                        if (!!arParams.TREE_PROPS)
2158                        {
2159                            this.treeProps = arParams.TREE_PROPS;
2160                        }
2161                        if (!!arParams.DEFAULT_PICTURE)
2162                        {
2163                            this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
2164                            this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
2165                        }
2166                    }
2167                    else
2168                    {
2169                        this.errorCode = -1;
2170                    }
2171                    break;
2172                default:
2173                    this.errorCode = -1;
2174            }
2175            if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
2176            {
2177                if (!!arParams.BASKET.QUANTITY)
2178                {
2179                    this.basketData.quantity = arParams.BASKET.QUANTITY;
2180                }
2181                if (!!arParams.BASKET.PROPS)
2182                {
2183                    this.basketData.props = arParams.BASKET.PROPS;
2184                }
2185                if (!!arParams.BASKET.BASKET_URL)
2186                {
2187                    this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
2188                }
2189            }
2190            this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT);
2191        }
2192        if (0 === this.errorCode)
2193        {
2194            BX.ready(BX.delegate(this.Init,this));
2195        }
2196    };
2197
2198    window.JCCatalogSectionViewed.prototype.Init = function()
2199    {
2200        var i = 0,
2201            strPrefix = '',
2202            TreeItems = null;
2203
2204        this.obProduct = BX(this.visual.ID);
2205        if (!this.obProduct)
2206        {
2207            this.errorCode = -1;
2208        }
2209        this.obPict = BX(this.visual.PICT_ID);
2210        if (!this.obPict)
2211        {
2212            this.errorCode = -2;
2213        }
2214        if (this.secondPict && !!this.visual.SECOND_PICT_ID)
2215        {
2216            this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
2217        }
2218        this.obPrice = BX(this.visual.PRICE_ID);
2219        if (!this.obPrice)
2220        {
2221            this.errorCode = -16;
2222        }
2223        if (this.showQuantity && !!this.visual.QUANTITY_ID)
2224        {
2225            this.obQuantity = BX(this.visual.QUANTITY_ID);
2226            if (!!this.visual.QUANTITY_UP_ID)
2227            {
2228                this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
2229            }
2230            if (!!this.visual.QUANTITY_DOWN_ID)
2231            {
2232                this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
2233            }
2234        }
2235        if (3 === this.productType)
2236        {
2237            if (!!this.visual.TREE_ID)
2238            {
2239                this.obTree = BX(this.visual.TREE_ID);
2240                if (!this.obTree)
2241                {
2242                    this.errorCode = -256;
2243                }
2244                strPrefix = this.visual.TREE_ITEM_ID;
2245                for (i = 0; i < this.treeProps.length; i++)
2246                {
2247                    this.obTreeRows[i] = {
2248                        LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'),
2249                        RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'),
2250                        LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
2251                        CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
2252                    };
2253                    if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
2254                    {
2255                        this.errorCode = -512;
2256                        break;
2257                    }
2258                }
2259            }
2260            if (!!this.visual.QUANTITY_MEASURE)
2261            {
2262                this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
2263            }
2264        }
2265        if (!!this.visual.BUY_ID)
2266        {
2267            this.obBuyBtn = BX(this.visual.BUY_ID);
2268        }
2269
2270        if (this.showPercent)
2271        {
2272            if (!!this.visual.DSC_PERC)
2273            {
2274                this.obDscPerc = BX(this.visual.DSC_PERC);
2275            }
2276            if (this.secondPict && !!this.visual.SECOND_DSC_PERC)
2277            {
2278                this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
2279            }
2280        }
2281
2282        if (this.showSkuProps)
2283        {
2284            if (!!this.visual.DISPLAY_PROP_DIV)
2285            {
2286                this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
2287            }
2288        }
2289
2290        if (0 === this.errorCode)
2291        {
2292            if (this.showQuantity)
2293            {
2294                if (!!this.obQuantityUp)
2295                {
2296                    BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
2297                }
2298                if (!!this.obQuantityDown)
2299                {
2300                    BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
2301                }
2302                if (!!this.obQuantity)
2303                {
2304                    BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
2305                }
2306            }
2307            switch (this.productType)
2308            {
2309                case 1://product
2310                    break;
2311                case 3://sku
2312                    TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
2313                    if (!!TreeItems && 0 < TreeItems.length)
2314                    {
2315                        for (i = 0; i < TreeItems.length; i++)
2316                        {
2317                            BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this));
2318                        }
2319                    }
2320                    for (i = 0; i < this.obTreeRows.length; i++)
2321                    {
2322                        BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(this.RowLeft, this));
2323                        BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(this.RowRight, this));
2324                    }
2325                    this.SetCurrent();
2326                    break;
2327            }
2328            if (!!this.obBuyBtn)
2329            {
2330                BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this));
2331            }
2332            if (this.lastElement)
2333            {
2334                this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
2335                if (isNaN(this.containerHeight))
2336                {
2337                    this.containerHeight = 0;
2338                }
2339                this.setHeight();
2340                BX.bind(window, 'resize', BX.delegate(this.checkHeight, this));
2341                BX.bind(this.obProduct.parentNode, 'mouseover', BX.delegate(this.setHeight, this));
2342                BX.bind(this.obProduct.parentNode, 'mouseout', BX.delegate(this.clearHeight, this));
2343            }
2344        }
2345    };
2346
2347    window.JCCatalogSectionViewed.prototype.checkHeight = function()
2348    {
2349        this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
2350        if (isNaN(this.containerHeight))
2351        {
2352            this.containerHeight = 0;
2353        }
2354    };
2355
2356    window.JCCatalogSectionViewed.prototype.setHeight = function()
2357    {
2358        if (0 < this.containerHeight)
2359        {
2360            BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}});
2361        }
2362    };
2363
2364    window.JCCatalogSectionViewed.prototype.clearHeight = function()
2365    {
2366        BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}});
2367    };
2368
2369    window.JCCatalogSectionViewed.prototype.QuantityUp = function()
2370    {
2371        var curValue = 0,
2372            boolSet = true;
2373
2374        if (0 === this.errorCode && this.showQuantity && this.canBuy)
2375        {
2376            curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
2377            if (!isNaN(curValue))
2378            {
2379                curValue += this.stepQuantity;
2380                if (this.checkQuantity)
2381                {
2382                    if (curValue > this.maxQuantity)
2383                    {
2384                        boolSet = false;
2385                    }
2386                }
2387                if (boolSet)
2388                {
2389                    if (this.isDblQuantity)
2390                    {
2391                        curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
2392                    }
2393                    this.obQuantity.value = curValue;
2394                }
2395            }
2396        }
2397    };
2398
2399    window.JCCatalogSectionViewed.prototype.QuantityDown = function()
2400    {
2401        var curValue = 0,
2402            boolSet = true;
2403
2404        if (0 === this.errorCode && this.showQuantity && this.canBuy)
2405        {
2406            curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10));
2407            if (!isNaN(curValue))
2408            {
2409                curValue -= this.stepQuantity;
2410                if (curValue < this.stepQuantity)
2411                {
2412                    boolSet = false;
2413                }
2414                if (boolSet)
2415                {
2416                    if (this.isDblQuantity)
2417                    {
2418                        curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
2419                    }
2420                    this.obQuantity.value = curValue;
2421                }
2422            }
2423        }
2424    };
2425
2426    window.JCCatalogSectionViewed.prototype.QuantityChange = function()
2427    {
2428        var curValue = 0,
2429            boolSet = true;
2430
2431        if (0 === this.errorCode && this.showQuantity)
2432        {
2433            if (this.canBuy)
2434            {
2435                curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
2436                if (!isNaN(curValue))
2437                {
2438                    if (this.checkQuantity)
2439                    {
2440                        if (curValue > this.maxQuantity)
2441                        {
2442                            boolSet = false;
2443                            curValue = this.maxQuantity;
2444                        }
2445                        else if (curValue < this.stepQuantity)
2446                        {
2447                            boolSet = false;
2448                            curValue = this.stepQuantity;
2449                        }
2450                    }
2451                    if (!boolSet)
2452                    {
2453                        this.obQuantity.value = curValue;
2454                    }
2455                }
2456                else
2457                {
2458                    this.obQuantity.value = this.stepQuantity;
2459                }
2460            }
2461            else
2462            {
2463                this.obQuantity.value = this.stepQuantity;
2464            }
2465        }
2466    };
2467
2468    window.JCCatalogSectionViewed.prototype.QuantitySet = function(index)
2469    {
2470        if (0 === this.errorCode)
2471        {
2472            this.canBuy = this.offers[index].CAN_BUY;
2473            if (this.canBuy)
2474            {
2475                BX.addClass(this.obBuyBtn, 'bx_bt_button');
2476                BX.removeClass(this.obBuyBtn, 'bx_bt_button_type_2');
2477                this.obBuyBtn.innerHTML = BX.message('CVP_MESS_BTN_BUY');
2478            }
2479            else
2480            {
2481                BX.addClass(this.obBuyBtn, 'bx_bt_button_type_2');
2482                BX.removeClass(this.obBuyBtn, 'bx_bt_button');
2483                this.obBuyBtn.innerHTML = BX.message('CVP_MESS_NOT_AVAILABLE');
2484            }
2485            if (this.showQuantity)
2486            {
2487                this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
2488                this.checkQuantity = this.offers[index].CHECK_QUANTITY;
2489                if (this.isDblQuantity)
2490                {
2491                    this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY);
2492                    this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor;
2493                }
2494                else
2495                {
2496                    this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10);
2497                    this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10);
2498                }
2499
2500                this.obQuantity.value = this.stepQuantity;
2501                this.obQuantity.disabled = !this.canBuy;
2502                if (!!this.obMeasure)
2503                {
2504                    if (!!this.offers[index].MEASURE)
2505                    {
2506                        BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
2507                    }
2508                    else
2509                    {
2510                        BX.adjust(this.obMeasure, { html : ''});
2511                    }
2512                }
2513            }
2514        }
2515    };
2516
2517    window.JCCatalogSectionViewed.prototype.SelectOfferProp = function()
2518    {
2519        var i = 0,
2520            value = '',
2521            strTreeValue = '',
2522            arTreeItem = [],
2523            RowItems = null,
2524            target = BX.proxy_context;
2525
2526        if (!!target && target.hasAttribute('data-treevalue'))
2527        {
2528            strTreeValue = target.getAttribute('data-treevalue');
2529            arTreeItem = strTreeValue.split('_');
2530            if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
2531            {
2532                RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
2533                if (!!RowItems && 0 < RowItems.length)
2534                {
2535                    for (i = 0; i < RowItems.length; i++)
2536                    {
2537                        value = RowItems[i].getAttribute('data-onevalue');
2538                        if (value === arTreeItem[1])
2539                        {
2540                            BX.addClass(RowItems[i], 'bx_active');
2541                        }
2542                        else
2543                        {
2544                            BX.removeClass(RowItems[i], 'bx_active');
2545                        }
2546                    }
2547                }
2548            }
2549        }
2550    };
2551
2552    window.JCCatalogSectionViewed.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
2553    {
2554        var strName = '',
2555            arShowValues = false,
2556            i, j,
2557            arCanBuyValues = [],
2558            index = -1,
2559            arFilter = {},
2560            tmpFilter = [];
2561
2562        for (i = 0; i < this.treeProps.length; i++)
2563        {
2564            if (this.treeProps[i].ID === strPropID)
2565            {
2566                index = i;
2567                break;
2568            }
2569        }
2570
2571        if (-1 < index)
2572        {
2573            for (i = 0; i < index; i++)
2574            {
2575                strName = 'PROP_'+this.treeProps[i].ID;
2576                arFilter[strName] = this.selectedValues[strName];
2577            }
2578            strName = 'PROP_'+this.treeProps[index].ID;
2579            arShowValues = this.GetRowValues(arFilter, strName);
2580            if (!arShowValues)
2581            {
2582                return false;
2583            }
2584            if (!BX.util.in_array(strPropValue, arShowValues))
2585            {
2586                return false;
2587            }
2588            arFilter[strName] = strPropValue;
2589            for (i = index+1; i < this.treeProps.length; i++)
2590            {
2591                strName = 'PROP_'+this.treeProps[i].ID;
2592                arShowValues = this.GetRowValues(arFilter, strName);
2593                if (!arShowValues)
2594                {
2595                    return false;
2596                }
2597                if (this.showAbsent)
2598                {
2599                    arCanBuyValues = [];
2600                    tmpFilter = [];
2601                    tmpFilter = BX.clone(arFilter, true);
2602                    for (j = 0; j < arShowValues.length; j++)
2603                    {
2604                        tmpFilter[strName] = arShowValues[j];
2605                        if (this.GetCanBuy(tmpFilter))
2606                        {
2607                            arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
2608                        }
2609                    }
2610                }
2611                else
2612                {
2613                    arCanBuyValues = arShowValues;
2614                }
2615                if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
2616                {
2617                    arFilter[strName] = this.selectedValues[strName];
2618                }
2619                else
2620                {
2621                    arFilter[strName] = arCanBuyValues[0];
2622                }
2623                this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
2624            }
2625            this.selectedValues = arFilter;
2626            this.ChangeInfo();
2627        }
2628        return true;
2629    };
2630
2631    window.JCCatalogSectionViewed.prototype.RowLeft = function()
2632    {
2633        var i = 0,
2634            strTreeValue = '',
2635            index = -1,
2636            target = BX.proxy_context;
2637
2638        if (!!target && target.hasAttribute('data-treevalue'))
2639        {
2640            strTreeValue = target.getAttribute('data-treevalue');
2641            for (i = 0; i < this.treeProps.length; i++)
2642            {
2643                if (this.treeProps[i].ID === strTreeValue)
2644                {
2645                    index = i;
2646                    break;
2647                }
2648            }
2649            if (-1 < index && this.treeRowShowSize < this.showCount[index])
2650            {
2651                if (0 > this.showStart[index])
2652                {
2653                    this.showStart[index]++;
2654                    BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
2655                    BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeEnableArrow });
2656                }
2657
2658                if (0 <= this.showStart[index])
2659                {
2660                    BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeDisableArrow });
2661                }
2662            }
2663        }
2664    };
2665
2666    window.JCCatalogSectionViewed.prototype.RowRight = function()
2667    {
2668        var i = 0,
2669            strTreeValue = '',
2670            index = -1,
2671            target = BX.proxy_context;
2672
2673        if (!!target && target.hasAttribute('data-treevalue'))
2674        {
2675            strTreeValue = target.getAttribute('data-treevalue');
2676            for (i = 0; i < this.treeProps.length; i++)
2677            {
2678                if (this.treeProps[i].ID === strTreeValue)
2679                {
2680                    index = i;
2681                    break;
2682                }
2683            }
2684            if (-1 < index && this.treeRowShowSize < this.showCount[index])
2685            {
2686                if ((this.treeRowShowSize - this.showStart[index]) < this.showCount[index])
2687                {
2688                    this.showStart[index]--;
2689                    BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
2690                    BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeEnableArrow });
2691                }
2692
2693                if ((this.treeRowShowSize - this.showStart[index]) >= this.showCount[index])
2694                {
2695                    BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeDisableArrow });
2696                }
2697            }
2698        }
2699    };
2700
2701    window.JCCatalogSectionViewed.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
2702    {
2703		var i = 0,
2704			showI = 0,
2705			value = '',
2706			countShow = 0,
2707			strNewLen = '',
2708			obData = {},
2709			pictMode = false,
2710			extShowMode = false,
2711			isCurrent = false,
2712			selectIndex = 0,
2713			obLeft = this.treeEnableArrow,
2714			obRight = this.treeEnableArrow,
2715			currentShowStart = 0,
2716			RowItems = null;
2717
2718		if (-1 < intNumber && intNumber < this.obTreeRows.length)
2719		{
2720			RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false);
2721			if (!!RowItems && 0 < RowItems.length)
2722			{
2723				pictMode = ('PICT' === this.treeProps[intNumber].SHOW_MODE);
2724				countShow = showID.length;
2725				extShowMode = this.treeRowShowSize < countShow;
2726				strNewLen = (extShowMode ? (100/countShow)+'%' : '20%');
2727				obData = {
2728					props: { className: '' },
2729					style: {
2730						width: strNewLen
2731					}
2732				};
2733				if (pictMode)
2734				{
2735					obData.style.paddingTop = strNewLen;
2736				}
2737				for (i = 0; i < RowItems.length; i++)
2738				{
2739					value = RowItems[i].getAttribute('data-onevalue');
2740					isCurrent = (value === activeID);
2741					if (BX.util.in_array(value, canBuyID))
2742					{
2743						obData.props.className = (isCurrent ? 'bx_active' : '');
2744					}
2745					else
2746					{
2747						obData.props.className = (isCurrent ? 'bx_active bx_missing' : 'bx_missing');
2748					}
2749					obData.style.display = 'none';
2750					if (BX.util.in_array(value, showID))
2751					{
2752						obData.style.display = '';
2753						if (isCurrent)
2754						{
2755							selectIndex = showI;
2756						}
2757						showI++;
2758					}
2759					BX.adjust(RowItems[i], obData);
2760				}
2761
2762				obData = {
2763					style: {
2764						width: (extShowMode ? 20*countShow : 100)+'%',
2765						marginLeft: '0%'
2766					}
2767				};
2768				if (pictMode)
2769				{
2770					BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}});
2771				}
2772				else
2773				{
2774					BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_size full' : 'bx_item_detail_size')}});
2775				}
2776				if (extShowMode)
2777				{
2778					if (selectIndex +1 === countShow)
2779					{
2780						obRight = this.treeDisableArrow;
2781					}
2782					if (this.treeRowShowSize <= selectIndex)
2783					{
2784						currentShowStart = this.treeRowShowSize - selectIndex - 1;
2785						obData.style.marginLeft = currentShowStart*20+'%';
2786					}
2787					if (0 === currentShowStart)
2788					{
2789						obLeft = this.treeDisableArrow;
2790					}
2791					BX.adjust(this.obTreeRows[intNumber].LEFT, {style: obLeft });
2792					BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: obRight });
2793				}
2794				else
2795				{
2796					BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}});
2797					BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}});
2798				}
2799				BX.adjust(this.obTreeRows[intNumber].LIST, obData);
2800				this.showCount[intNumber] = countShow;
2801				this.showStart[intNumber] = currentShowStart;
2802            }
2803        }
2804    };
2805
2806    window.JCCatalogSectionViewed.prototype.GetRowValues = function(arFilter, index)
2807    {
2808        var i = 0,
2809            j,
2810            arValues = [],
2811            boolSearch = false,
2812            boolOneSearch = true;
2813
2814        if (0 === arFilter.length)
2815        {
2816            for (i = 0; i < this.offers.length; i++)
2817            {
2818                if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
2819                {
2820                    arValues[arValues.length] = this.offers[i].TREE[index];
2821                }
2822            }
2823            boolSearch = true;
2824        }
2825        else
2826        {
2827            for (i = 0; i < this.offers.length; i++)
2828            {
2829                boolOneSearch = true;
2830                for (j in arFilter)
2831                {
2832                    if (arFilter[j] !== this.offers[i].TREE[j])
2833                    {
2834                        boolOneSearch = false;
2835                        break;
2836                    }
2837                }
2838                if (boolOneSearch)
2839                {
2840                    if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
2841                    {
2842                        arValues[arValues.length] = this.offers[i].TREE[index];
2843                    }
2844                    boolSearch = true;
2845                }
2846            }
2847        }
2848        return (boolSearch ? arValues : false);
2849    };
2850
2851    window.JCCatalogSectionViewed.prototype.GetCanBuy = function(arFilter)
2852    {
2853        var i = 0,
2854            j,
2855            boolSearch = false,
2856            boolOneSearch = true;
2857
2858        for (i = 0; i < this.offers.length; i++)
2859        {
2860            boolOneSearch = true;
2861            for (j in arFilter)
2862            {
2863                if (arFilter[j] !== this.offers[i].TREE[j])
2864                {
2865                    boolOneSearch = false;
2866                    break;
2867                }
2868            }
2869            if (boolOneSearch)
2870            {
2871                if (this.offers[i].CAN_BUY)
2872                {
2873                    boolSearch = true;
2874                    break;
2875                }
2876            }
2877        }
2878        return boolSearch;
2879    };
2880
2881    window.JCCatalogSectionViewed.prototype.SetCurrent = function()
2882    {
2883        var i = 0,
2884            j = 0,
2885            arCanBuyValues = [],
2886            strName = '',
2887            arShowValues = false,
2888            arFilter = {},
2889            tmpFilter = [],
2890            current = this.offers[this.offerNum].TREE;
2891
2892        for (i = 0; i < this.treeProps.length; i++)
2893        {
2894            strName = 'PROP_'+this.treeProps[i].ID;
2895            arShowValues = this.GetRowValues(arFilter, strName);
2896            if (!arShowValues)
2897            {
2898                break;
2899            }
2900            if (BX.util.in_array(current[strName], arShowValues))
2901            {
2902                arFilter[strName] = current[strName];
2903            }
2904            else
2905            {
2906                arFilter[strName] = arShowValues[0];
2907                this.offerNum = 0;
2908            }
2909            if (this.showAbsent)
2910            {
2911                arCanBuyValues = [];
2912                tmpFilter = [];
2913                tmpFilter = BX.clone(arFilter, true);
2914                for (j = 0; j < arShowValues.length; j++)
2915                {
2916                    tmpFilter[strName] = arShowValues[j];
2917                    if (this.GetCanBuy(tmpFilter))
2918                    {
2919                        arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
2920                    }
2921                }
2922            }
2923            else
2924            {
2925                arCanBuyValues = arShowValues;
2926            }
2927            this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
2928        }
2929        this.selectedValues = arFilter;
2930        this.ChangeInfo();
2931    };
2932
2933    window.JCCatalogSectionViewed.prototype.ChangeInfo = function()
2934    {
2935        var i = 0,
2936            j,
2937            index = -1,
2938            obData = {},
2939            boolOneSearch = true,
2940            strPrice = '';
2941
2942        for (i = 0; i < this.offers.length; i++)
2943        {
2944            boolOneSearch = true;
2945            for (j in this.selectedValues)
2946            {
2947                if (this.selectedValues[j] !== this.offers[i].TREE[j])
2948                {
2949                    boolOneSearch = false;
2950                    break;
2951                }
2952            }
2953            if (boolOneSearch)
2954            {
2955                index = i;
2956                break;
2957            }
2958        }
2959        if (-1 < index)
2960        {
2961            if (!!this.obPict)
2962            {
2963                if (!!this.offers[index].PREVIEW_PICTURE)
2964                {
2965                    BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
2966                }
2967                else
2968                {
2969                    BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
2970                }
2971            }
2972            if (this.secondPict && !!this.obSecondPict)
2973            {
2974                if (!!this.offers[index].PREVIEW_PICTURE_SECOND)
2975                {
2976                    BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}});
2977                }
2978                else if (!!this.offers[index].PREVIEW_PICTURE.SRC)
2979                {
2980                    BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
2981                }
2982                else if (!!this.defaultPict.secondPict)
2983                {
2984                    BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}});
2985                }
2986                else
2987                {
2988                    BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
2989                }
2990            }
2991            if (this.showSkuProps && !!this.obSkuProps)
2992            {
2993                if (0 === this.offers[index].DISPLAY_PROPERTIES.length)
2994                {
2995                    BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
2996                }
2997                else
2998                {
2999                    BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
3000                }
3001            }
3002            if (!!this.obPrice)
3003            {
3004                strPrice = this.offers[index].PRICE.PRINT_DISCOUNT_VALUE;
3005                if (this.showOldPrice && (this.offers[index].PRICE.DISCOUNT_VALUE !== this.offers[index].PRICE.VALUE))
3006                {
3007                    strPrice += ' <span>'+this.offers[index].PRICE.PRINT_VALUE+'</span>';
3008                }
3009                BX.adjust(this.obPrice, {html: strPrice});
3010                if (this.showPercent)
3011                {
3012                    if (this.offers[index].PRICE.DISCOUNT_VALUE !== this.offers[index].PRICE.VALUE)
3013                    {
3014                        obData = {
3015                            style: {
3016                                display: ''
3017                            },
3018                            html: this.offers[index].PRICE.DISCOUNT_DIFF_PERCENT
3019                        };
3020                    }
3021                    else
3022                    {
3023                        obData = {
3024                            style: {
3025                                display: 'none'
3026                            },
3027                            html: ''
3028                        };
3029                    }
3030                    if (!!this.obDscPerc)
3031                    {
3032                        BX.adjust(this.obDscPerc, obData);
3033                    }
3034                    if (!!this.obSecondDscPerc)
3035                    {
3036                        BX.adjust(this.obSecondDscPerc, obData);
3037                    }
3038                }
3039            }
3040            this.offerNum = index;
3041            this.QuantitySet(this.offerNum);
3042        }
3043    };
3044
3045    window.JCCatalogSectionViewed.prototype.InitBasketUrl = function()
3046    {
3047        switch (this.productType)
3048        {
3049            case 1://product
3050            case 2://set
3051                this.basketUrl = this.product.addUrl;
3052                break;
3053            case 3://sku
3054                this.basketUrl = this.offers[this.offerNum].ADD_URL;
3055                break;
3056        }
3057        this.basketParams = {
3058            'ajax_basket': 'Y'
3059        };
3060        if (this.showQuantity)
3061        {
3062            this.basketParams[this.basketData.quantity] = this.obQuantity.value;
3063        }
3064    };
3065
3066    window.JCCatalogSectionViewed.prototype.FillBasketProps = function()
3067    {
3068        if (!this.visual.BASKET_PROP_DIV)
3069        {
3070            return;
3071        }
3072        var
3073            i = 0,
3074            propCollection = null,
3075            foundValues = false,
3076            obBasketProps = null;
3077
3078        if (this.basketData.useProps && !this.basketData.emptyProps)
3079        {
3080            if (!!this.obPopupWin && !!this.obPopupWin.contentContainer)
3081            {
3082                obBasketProps = this.obPopupWin.contentContainer;
3083            }
3084        }
3085        else
3086        {
3087            obBasketProps = BX(this.visual.BASKET_PROP_DIV);
3088        }
3089        if (!obBasketProps)
3090        {
3091            return;
3092        }
3093        propCollection = obBasketProps.getElementsByTagName('select');
3094        if (!!propCollection && !!propCollection.length)
3095        {
3096            for (i = 0; i < propCollection.length; i++)
3097            {
3098                if (!propCollection[i].disabled)
3099                {
3100                    switch(propCollection[i].type.toLowerCase())
3101                    {
3102                        case 'select-one':
3103                            this.basketParams[propCollection[i].name] = propCollection[i].value;
3104                            foundValues = true;
3105                            break;
3106                        default:
3107                            break;
3108                    }
3109                }
3110            }
3111        }
3112        propCollection = obBasketProps.getElementsByTagName('input');
3113        if (!!propCollection && !!propCollection.length)
3114        {
3115            for (i = 0; i < propCollection.length; i++)
3116            {
3117                if (!propCollection[i].disabled)
3118                {
3119                    switch(propCollection[i].type.toLowerCase())
3120                    {
3121                        case 'hidden':
3122                            this.basketParams[propCollection[i].name] = propCollection[i].value;
3123                            foundValues = true;
3124                            break;
3125                        case 'radio':
3126                            if (propCollection[i].checked)
3127                            {
3128                                this.basketParams[propCollection[i].name] = propCollection[i].value;
3129                                foundValues = true;
3130                            }
3131                            break;
3132                        default:
3133                            break;
3134                    }
3135                }
3136            }
3137        }
3138        if (!foundValues)
3139        {
3140            this.basketParams[this.basketData.props] = [];
3141            this.basketParams[this.basketData.props][0] = 0;
3142        }
3143    };
3144
3145    window.JCCatalogSectionViewed.prototype.SendToBasket = function()
3146    {
3147        if (!this.canBuy)
3148        {
3149            return;
3150        }
3151        this.InitBasketUrl();
3152        this.FillBasketProps();
3153        BX.ajax.loadJSON(
3154            this.basketUrl,
3155            this.basketParams,
3156            BX.delegate(this.BasketResult, this)
3157        );
3158    };
3159
3160    window.JCCatalogSectionViewed.prototype.Basket = function()
3161    {
3162        var contentBasketProps = '';
3163        if (!this.canBuy)
3164        {
3165            return;
3166        }
3167        switch (this.productType)
3168        {
3169            case 1://product
3170            case 2://set
3171                if (this.basketData.useProps && !this.basketData.emptyProps)
3172                {
3173                    this.InitPopupWindow();
3174                    this.obPopupWin.setTitleBar(BX.message('CVP_TITLE_BASKET_PROPS'));
3175                    if (BX(this.visual.BASKET_PROP_DIV))
3176                    {
3177                        contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
3178                    }
3179                    this.obPopupWin.setContent(contentBasketProps);
3180                    this.obPopupWin.setButtons([
3181                        new BasketButton({
3182                            ownerClass: this.obProduct.parentNode.parentNode.parentNode.className,
3183                            text: BX.message('CVP_BTN_MESSAGE_SEND_PROPS'),
3184                            events: {
3185                                click: BX.delegate(this.SendToBasket, this)
3186                            }
3187                        })
3188                    ]);
3189                    this.obPopupWin.show();
3190                }
3191                else
3192                {
3193                    this.SendToBasket();
3194                }
3195                break;
3196            case 3://sku
3197                this.SendToBasket();
3198                break;
3199        }
3200    };
3201
3202    window.JCCatalogSectionViewed.prototype.BasketResult = function(arResult)
3203    {
3204        var strContent = '',
3205            strName = '',
3206            strPict = '',
3207            successful,
3208            buttons = [];
3209
3210        if (!!this.obPopupWin)
3211            this.obPopupWin.close();
3212
3213        if (!BX.type.isPlainObject(arResult))
3214            return;
3215
3216        successful = ('OK' === arResult.STATUS);
3217        if (successful)
3218        {
3219            BX.onCustomEvent('OnBasketChange');
3220            strName = this.product.name;
3221            switch(this.productType)
3222            {
3223                case 1://
3224                case 2://
3225                    strPict = this.product.pict.SRC;
3226                    break;
3227                case 3:
3228                    strPict = (!!this.offers[this.offerNum].PREVIEW_PICTURE ?
3229                        this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
3230                        this.defaultPict.pict.SRC
3231                        );
3232                    break;
3233            }
3234            strContent = '<div style="width: 100%; margin: 0; text-align: center;"><img src="'+strPict+'" height="130" style="max-height:130px"><p>
3234'+strName+'</p></div>';
3235            buttons = [
3236                new BasketButton({
3237                    ownerClass: this.obProduct.parentNode.parentNode.parentNode.className,
3238                    text: BX.message("CVP_BTN_MESSAGE_BASKET_REDIRECT"),
3239                    events: {
3240                        click: BX.delegate(function(){
3241                            location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('CVP_BASKET_URL'));
3242                        }, this)
3243                    }
3244                })
3245            ];
3246        }
3247        else
3248        {
3249            strContent = (!!arResult.MESSAGE ? arResult.MESSAGE : BX.message('CVP_BASKET_UNKNOWN_ERROR'));
3250            buttons = [
3251                new BasketButton({
3252                    ownerClass: this.obProduct.parentNode.parentNode.parentNode.className,
3253                    text: BX.message('CVP_BTN_MESSAGE_CLOSE'),
3254                    events: {
3255                        click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
3256                    }
3257                })
3258            ];
3259        }
3260        this.InitPopupWindow();
3261        this.obPopupWin.setTitleBar(successful ? BX.message('CVP_TITLE_SUCCESSFUL') : BX.message('CVP_TITLE_ERROR'));
3262        this.obPopupWin.setContent(strContent);
3263        this.obPopupWin.setButtons(buttons);
3264        this.obPopupWin.show();
3265    };
3266
3267    window.JCCatalogSectionViewed.prototype.InitPopupWindow = function()
3268    {
3269        if (!!this.obPopupWin)
3270            return;
3271
3272        this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_'+this.visual.ID, null, {
3273            autoHide: false,
3274            offsetLeft: 0,
3275            offsetTop: 0,
3276            overlay : true,
3277            closeByEsc: true,
3278            titleBar: true,
3279            closeIcon: true,
3280            contentColor: 'white'
3281        });
3282    };
3283})(window);
3284/* End */
3285;; /* /local/templates/main/components/bitrix/catalog.smart.filter/costum/script.min.js?170215560014592*/
3286; /* /local/templates/main/components/bitrix/catalog/catalog/bitrix/catalog.section/.default/script.js?170215560039848*/
3287; /* /local/components/project/webform/webform.js?17858987467585*/
3288; /* /local/templates/main/components/bitrix/catalog.viewed.products/catalog_veiw/script.js?170215560045475*/
3289
3290//# sourceMappingURL=page_718503c9a8f43938a1cfbfade4d097a0.map.js

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.