function createCookie(name,value,days,options={}){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()}else var expires="";var updatedCookie=name+"="+encodeURIComponent(value)+expires+"; path=/";for(let optionKey in options){updatedCookie+="; "+optionKey;let optionValue=options[optionKey];if(optionValue!==true){updatedCookie+="="+optionValue}}document.cookie=updatedCookie}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)}return null}function eraseCookie(name){createCookie(name,"",-1)}var widgets=(function(){var widgets={preloaderURL:'/shared/images/preloader.gif',addToCart:function(shop_id,product_id,price,obj){var amount=1;product_id=Number(product_id);price=Number(price);$.post('/my/s3/xapi/public/?method=shop/getProduct',{'shop_id':shop_id,'product_id':product_id},function(data){if(widgets.isEmptyObject(data)&&typeof obj.href=="string"){location.href=obj.href;return true}data=data.result;if(data&&data.product_price!=undefined){price=Number(data.product_price)}var result=true,amount_limit=amount;var has_amount_limit=(data.product_amount_limit=='1'?true:false);if(has_amount_limit){amount_limit=Number(data.product_amount);if(amount_limit<amount){amount=amount_limit}}if(!isNaN(shop_id)&&(shop_id>0)&&!isNaN(product_id)&&(product_id>0)&&!isNaN(price)&&!isNaN(amount)&&(amount>0)){var cart_new="",cart_item_split,found=false,total_amount=0,ta,e;var total=readCookie('CART_TOTAL_'+shop_id);var cart=unescape(readCookie('CART_'+shop_id));var cart_split=cart.split(';');if(isNaN(total))total=Number(total);for(var i=0;i<cart_split.length;i++){cart_item_split=cart_split[i].split("=");if(cart_item_split.length==2){if(!found&&cart_item_split[0]==product_id){if(!(has_amount_limit&&cart_item_split[1]>=amount_limit))total=Number(total)+price*amount;ta=amount+Number(cart_item_split[1]);if(has_amount_limit&&ta>amount_limit){ta=amount_limit;result=false;widgets.msg(window._s3Lang['JS_SHOP_PRODUCT_AMOUNT_TOTAL']+': '+amount_limit,obj)}found=true;if(cart_new!="")cart_new=cart_new+";";cart_new=cart_new+product_id+"="+ta;total_amount+=ta}else{if(cart_new!="")cart_new=cart_new+";";cart_new=cart_new+cart_item_split[0]+"="+cart_item_split[1];total_amount+=Number(cart_item_split[1])}}}if(!found){if(cart_new!="")cart_new=cart_new+";";cart_new=cart_new+product_id+"="+amount;total=Number(total)+price*amount;total_amount+=amount}total=Math.round(total*100)/100;createCookie('CART_'+shop_id,cart_new,10);createCookie('CART_TOTAL_'+shop_id,total,10);createCookie('CART_TOTAL_AMOUNT_'+shop_id,total_amount,10);e=document.getElementById('cart_total');if(e)e.innerHTML=total;e=document.getElementById('cart_total_amount');if(e)e.innerHTML=total_amount;if(result)widgets.msg(window._s3Lang['JS_ADDED'],obj);return true}},'json');return false},formatPrice:function(str,ts,dot){if(typeof str!='string')str=String(str);if(ts==null)ts=' ';if(dot==null)dot='.';if(dot!='.')str=str.replace('.',dot);var parts=str.split(dot),res=[],i;if(parts[0].length>=4){for(i=(parts[0].length-1),j=1;i>=0;--i,++j){res.unshift(parts[0].charAt(i));if(j%3==0&&i>0)res.unshift(ts)}return res.join('')+(parts[1]?dot+parts[1]:'')}return str},addOnloadEvent:function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func}else{window.onload=function(){if(oldonload){oldonload()}func()}}},msg:function(text,obj,className){if(!obj)return;var pos=findPos(obj);var d=document.createElement("DIV");if(d){d.style.position='absolute';d.innerHTML=text;d.style.display='block';d.className=className?className:'added-to-cart';d.style.left=(pos.x+obj.offsetWidth)+'px';d.style.top=(pos.y+obj.offsetHeight)+'px';try{if($(window).width()<=(parseInt(d.style.left)+120)){d.style.left=(pos.x-80)+'px';d.style.top=(pos.y+obj.offsetHeight)+'px'}}catch(e){}document.body.appendChild(d);window.setTimeout(function(){if(d&&d.parentNode)d.parentNode.removeChild(d);delete d},1500)}},createPreloader:function(node){var pos=findPos(node);var div=document.createElement('div');with(div.style){position='absolute';display='block';left=(pos.x+node.offsetWidth)+'px';top=(pos.y+node.offsetHeight)+'px';width=32;height=32;background="url("+this.preloaderURL+") center center no-repeat transparent";zIndex=2000}return div},addEvent:function(elem,evType,fn){if(elem.addEventListener){elem.addEventListener(evType,fn,false)}else if(elem.attachEvent){elem.attachEvent('on'+evType,fn)}},isEmptyObject:function(obj){var name;for(name in obj){return false}return true}};window.findPos=function findPos(obj){var result={x:0,y:0};if(obj.offsetParent){while(obj.offsetParent){result.y+=obj.offsetTop;result.x+=obj.offsetLeft;obj=obj.offsetParent}}else{if(obj.x)result.x+=obj.x;if(obj.y)result.y+=obj.y}return result};String.prototype.trim=function(s){var d=(s?s:'[\\t\\s\\n\\r]');return this.replace(new RegExp("^"+d+"+"),'').replace(new RegExp(d+"+$"),'')};function parseQuery(query){var res={};if(query.charAt(0)==='?'){query=query.slice(1)}query.split('&').forEach(function(part){var parts=part.split('=');var key=parts[0];var value;if(parts.length===2){value=parts[1]}res[key]=value});return res}function loadScript(url){var script=document.createElement('script');script.src=url;(document.head||document.body).appendChild(script)}var query=parseQuery(location.search);eraseCookie('IS_CSSPATCH');if(('debug')in query||sessionStorage.getItem('csspatchDebug')){loadScript('//debug-frontend.oml.ru/g/s3/csspatch/csspatch.client.js?_='+Date.now());sessionStorage.setItem('csspatchDebug',1)}else if(('csspatch'in query||sessionStorage.getItem('csspatch'))&&window.top!==window.self){loadScript('/g/s3/csspatch/csspatch.client.js?_='+Date.now());sessionStorage.setItem('csspatch',1);createCookie('IS_CSSPATCH',1,1,{SameSite:'None',Secure:true})}if(('fastEdit')in query||sessionStorage.getItem('fastedit')){loadScript('/my/s3/js/fastedit.client.js?_='+Date.now());sessionStorage.setItem('fastedit',1)}return widgets})();var A_TCALDEF={'months':['January','February','March','April','May','June','July','August','September','October','November','December'],'weekdays':['Su','Mo','Tu','We','Th','Fr','Sa'],'yearscroll':true,'weekstart':0,'centyear':70,'imgpath':'/my/s3/images/calendar/','close':window._s3Lang["JS_CLOSE_CALENDAR"]||'','open':window._s3Lang["JS_OPEN_CALENDAR"]||''};var RU_TCALDEF={'months':['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],'weekdays':['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],'yearscroll':true,'weekstart':1,'centyear':70,'imgpath':'/my/s3/images/calendar/','close':"Закрыть календарь",'open':"Открыть календарь"};function f_tcalParseDate(s_date){var re_date=/^\s*(\d{1,2})\.(\d{1,2})\.(\d{2,4})\s*$/;if(!re_date.exec(s_date))return alert("Invalid date: '"+s_date+"'.\nAccepted format is mm/dd/yyyy.");var n_day=Number(RegExp.$1),n_month=Number(RegExp.$2),n_year=Number(RegExp.$3);if(n_year<100)n_year+=(n_year<this.a_tpl.centyear?2000:1900);if(n_month<1||n_month>12)return alert("Invalid month value: '"+n_month+"'.\nAllowed range is 01-12.");var d_numdays=new Date(n_year,n_month,0);if(n_day>d_numdays.getDate())return alert("Invalid day of month value: '"+n_day+"'.\nAllowed range for selected month is 01 - "+d_numdays.getDate()+".");return new Date(n_year,n_month-1,n_day)}function f_tcalGenerDate(d_date){return((d_date.getDate()<10?'0':'')+d_date.getDate()+"."+(d_date.getMonth()<9?'0':'')+(d_date.getMonth()+1)+"."+d_date.getFullYear())}function tcal(a_cfg,a_tpl){if(!a_tpl){if(a_cfg.lang&&a_cfg.lang=='ru'){a_tpl=RU_TCALDEF}else{a_tpl=A_TCALDEF}}if(!window.A_TCALS)window.A_TCALS=[];if(!window.A_TCALSIDX)window.A_TCALSIDX=[];this.s_id=a_cfg.id?a_cfg.id:A_TCALS.length;window.A_TCALS[this.s_id]=this;window.A_TCALSIDX[window.A_TCALSIDX.length]=this;this.f_show=f_tcalShow;this.f_hide=f_tcalHide;this.f_toggle=f_tcalToggle;this.f_update=f_tcalUpdate;this.f_relDate=f_tcalRelDate;this.f_parseDate=f_tcalParseDate;this.f_generDate=f_tcalGenerDate;this.s_iconId='tcalico_'+this.s_id;this.e_icon=f_getElement(this.s_iconId);if(!this.e_icon){var divPlace=document.createElement('div');divPlace.innerHTML='<img src="'+a_tpl.imgpath+'cal.gif" id="'+this.s_iconId+'" onclick="A_TCALS[\''+this.s_id+'\'].f_toggle()" class="tcalIcon" alt="#JS_OPEN_CALENDAR#|s3_localize" />';a_cfg['place'].appendChild(divPlace.firstChild);this.e_icon=f_getElement(this.s_iconId)}this.a_cfg=a_cfg;this.a_tpl=a_tpl}function f_tcalShow(d_date){if(!this.a_cfg.controlname)throw("TC: control name is not specified");if(this.a_cfg.formname){var e_form=document.forms[this.a_cfg.formname];if(!e_form)throw("TC: form '"+this.a_cfg.formname+"' can not be found");this.e_input=e_form.elements[this.a_cfg.controlname]}else this.e_input=this.a_cfg.place.querySelector('input[id="'+this.a_cfg.controlname+'"]');if(!this.e_input||!this.e_input.tagName||this.e_input.tagName!='INPUT')throw("TC: element '"+this.a_cfg.controlname+"' does not exist in "+(this.a_cfg.formname?"form '"+this.a_cfg.controlname+"'":'this document'));this.e_div=f_getElement('tcal');if(!this.e_div){this.e_div=document.createElement("DIV");this.e_div.id='tcal';document.body.appendChild(this.e_div)}this.e_iframe=f_getElement('tcalIF');if(b_ieFix&&!this.e_iframe){this.e_iframe=document.createElement("IFRAME");this.e_iframe.style.filter='alpha(opacity=0)';this.e_iframe.id='tcalIF';this.e_iframe.src=this.a_tpl.imgpath+'pixel.gif';document.body.appendChild(this.e_iframe)}f_tcalHideAll();this.e_icon=f_getElement(this.s_iconId);this.e_div.style.display='block';if(this.e_iframe){this.e_iframe.style.display='block'}if(!this.f_update())return;this.e_div.style.visibility='visible';this.e_div.style.display='block';if(this.e_iframe){this.e_iframe.style.visibility='visible';this.e_iframe.style.display='block'}this.e_icon.src=this.a_tpl.imgpath+'no_cal.gif';this.e_icon.title=this.a_tpl.close;this.b_visible=true}function f_tcalHide(n_date){if(n_date)this.e_input.value=this.f_generDate(new Date(n_date));if(!this.b_visible)return;if(this.e_iframe){this.e_iframe.style.visibility='hidden';this.e_iframe.style.display='none'}this.e_div.style.visibility='hidden';this.e_div.style.display='none';this.e_icon=f_getElement(this.s_iconId);this.e_icon.src=this.a_tpl.imgpath+'cal.gif';this.e_icon.title=window._s3Lang['JS_OPEN_CALENDAR'];this.b_visible=false}function f_tcalToggle(){return this.b_visible?this.f_hide():this.f_show()}function f_tcalUpdate(d_date){var d_client=new Date();d_client.setHours(0);d_client.setMinutes(0);d_client.setSeconds(0);d_client.setMilliseconds(0);var d_today=this.a_cfg.today?this.f_parseDate(this.a_cfg.today):d_client;var d_selected=this.e_input.value==''?(this.a_cfg.selected?this.f_parseDate(this.a_cfg.selected):d_today):this.f_parseDate(this.e_input.value);if(!d_date)d_date=d_selected;else if(typeof(d_date)=='number')d_date=new Date(d_date);else if(typeof(d_date)=='string')this.f_parseDate(d_date);if(!d_date)return false;var d_firstday=new Date(d_date);d_firstday.setDate(1);d_firstday.setDate(1-(7+d_firstday.getDay()-this.a_tpl.weekstart)%7);var a_class,s_html='<table class="ctrl"><tbody><tr>'+(this.a_tpl.yearscroll?'<td'+this.f_relDate(d_date,-1,'y')+' title="Previous Year"><img src="'+this.a_tpl.imgpath+'prev_year.gif" /></td>':'')+'<td'+this.f_relDate(d_date,-1)+' title="Previous Month"><img src="'+this.a_tpl.imgpath+'prev_mon.gif" /></td><th>'+this.a_tpl.months[d_date.getMonth()]+' '+d_date.getFullYear()+'</th><td'+this.f_relDate(d_date,1)+' title="Next Month"><img src="'+this.a_tpl.imgpath+'next_mon.gif" /></td>'+(this.a_tpl.yearscroll?'<td'+this.f_relDate(d_date,1,'y')+' title="Next Year"><img src="'+this.a_tpl.imgpath+'next_year.gif" /></td></td>':'')+'</tr></tbody></table><table><tbody><tr class="wd">';for(var i=0;i<7;i++)s_html+='<th>'+this.a_tpl.weekdays[(this.a_tpl.weekstart+i)%7]+'</th>';s_html+='</tr>';var d_current=new Date(d_firstday);while(d_current.getMonth()==d_date.getMonth()||d_current.getMonth()==d_firstday.getMonth()){s_html+='<tr>';for(var n_wday=0;n_wday<7;n_wday++){a_class=[];if(d_current.getMonth()!=d_date.getMonth())a_class[a_class.length]='othermonth';if(d_current.getDay()==0||d_current.getDay()==6)a_class[a_class.length]='weekend';if(d_current.valueOf()==d_today.valueOf())a_class[a_class.length]='today';if(d_current.valueOf()==d_selected.valueOf())a_class[a_class.length]='selected';s_html+='<td onclick="A_TCALS[\''+this.s_id+'\'].f_hide('+d_current.valueOf()+')"'+(a_class.length?' class="'+a_class.join(' ')+'">':'>')+d_current.getDate()+'</td>';d_current.setDate(d_current.getDate()+1)}s_html+='</tr>'}s_html+='</tbody></table>';this.e_div.innerHTML=s_html;var n_width=this.e_div.offsetWidth;var n_height=this.e_div.offsetHeight;var n_top=f_getPosition(this.e_icon,'Top')+this.e_icon.offsetHeight;var n_left=f_getPosition(this.e_icon,'Left')-n_width+this.e_icon.offsetWidth;if(n_left<0)n_left=0;this.e_div.style.left=n_left+'px';this.e_div.style.top=n_top+'px';if(this.e_iframe){this.e_iframe.style.left=n_left+'px';this.e_iframe.style.top=n_top+'px';this.e_iframe.style.width=(n_width+6)+'px';this.e_iframe.style.height=(n_height+6)+'px'}return true}function f_getPosition(e_elemRef,s_coord){var n_pos=0,n_offset,e_elem=e_elemRef;while(e_elem){n_offset=e_elem["offset"+s_coord];n_pos+=n_offset;e_elem=e_elem.offsetParent}if(b_ieMac)n_pos+=parseInt(document.body[s_coord.toLowerCase()+'Margin']);else if(b_safari)n_pos-=n_offset;e_elem=e_elemRef;while(e_elem!=document.body){n_offset=e_elem["scroll"+s_coord];if(n_offset&&e_elem.style.overflow=='scroll')n_pos-=n_offset;e_elem=e_elem.parentNode}return n_pos}function f_tcalRelDate(d_date,d_diff,s_units){var s_units=(s_units=='y'?'FullYear':'Month');var d_result=new Date(d_date);d_result['set'+s_units](d_date['get'+s_units]()+d_diff);if(d_result.getDate()!=d_date.getDate())d_result.setDate(0);return' onclick="A_TCALS[\''+this.s_id+'\'].f_update('+d_result.valueOf()+')"'}function f_tcalHideAll(){for(var i=0;i<window.A_TCALSIDX.length;i++)window.A_TCALSIDX[i].f_hide()}f_getElement=document.all?function(s_id){return document.all[s_id]}:function(s_id){return document.getElementById(s_id)};var s_userAgent=navigator.userAgent.toLowerCase(),re_webkit=/WebKit\/(\d+)/i;var b_mac=s_userAgent.indexOf('mac')!=-1,b_ie5=s_userAgent.indexOf('msie 5')!=-1,b_ie6=s_userAgent.indexOf('msie 6')!=-1&&s_userAgent.indexOf('opera')==-1;var b_ieFix=b_ie5||b_ie6,b_ieMac=b_mac&&b_ie5,b_safari=b_mac&&re_webkit.exec(s_userAgent)&&Number(RegExp.$1)<500;