[SPOILER="тут js"]/*!
* jQuery Cookie Plugin v1.3
*
https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
*
http://www.opensource.org/licenses/mit-license.php
*
http://www.opensource.org/licenses/GPL-2.0
*/
(function($,document,undefined){var pluses=/\+/g;function raw(s){return s;}
function decoded(s){return decodeURIComponent(s.replace(pluses,' '));}
var config=$.cookie=function(key,value,options){if(value!==undefined){options=$.extend({},config.defaults,options);if(value===null){options.expires=-1;}
if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}
value=config.json?JSON.stringify(value):String(value);return(document.cookie=[encodeURIComponent(key),'=',config.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}
var decode=config.raw?raw:decoded;var cookies=document.cookie.split('; ');for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');if(decode(parts.shift())===key){var cookie=decode(parts.join('='));return config.json?JSON.parse(cookie):cookie;}}
return null;};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)!==null){$.cookie(key,null,options);return true;}
return false;};})(jQuery,document);(function(a){function e(b,c,e){var f=c.split(/\s+/);b.each(function(){for(var b=0;b<f.length;++b){var c=a.trim(f[b]).match(/[^\.]+/i)[0];d(a(this),c,e)}})}function d(a,d,e){var f=c(a),g=f[d];if(!b){var h=g.pop();g.splice(e?0:g.delegateCount||0,0,h)}else e?f.live.unshift(f.live.pop()):g.unshift(g.pop())}function c©{return b?c.data("events"):a._data(c[0]).events}var b=parseFloat(a.fn.jquery)<1.7;a.fn.bindFirst=function(){var b=a(this),c=a.makeArray(arguments),d=c.shift();d&&(a.fn.bind.apply(b,arguments),e(b,d));return b},a.fn.delegateFirst=function(){var b=a(this),c=a.makeArray(arguments),d=c[1];d&&(c.splice(0,2),a.fn.delegate.apply(b,arguments),e(a(this),d,!0));return b},a.fn.liveFirst=function(){var b=a(this),c=a.makeArray(arguments);c.unshift(b.selector),a.fn.delegateFirst.apply(a(document),c);return b}})(jQuery);function servicePortalInput(){var serviceInput=$('.service_inner .activation_row input[type="text"]');serviceInput.keydown(function(e){if($.inArray(e.keyCode,[46,8,9,27,13,110])!==-1||(e.keyCode==65&&e.ctrlKey===true)||(e.keyCode>=35&&e.keyCode<=39)){return;}
if((e.shiftKey||(e.keyCode<48||e.keyCode>57))&&(e.keyCode<96||e.keyCode>105)){e.preventDefault();}});serviceInput.keyup(function(){if(this.value.length==this.maxLength&&$(this).next("hr").length>0){$(this).next("hr").next("input").focus();}});}
$.fn.scrollStopped=function(callback){var $this=$(this),self=this;$this.scroll(function(){if($this.data('scrollTimeout')){clearTimeout($this.data('scrollTimeout'));}
$this.data('scrollTimeout',setTimeout(callback,250,self));});};function loginForms(){$('.cabinet.popup .input_block').focusin(function(){$(this).removeClass('error');});}
function catalogBlocksize(){catalogContentW=$('.catalog_block').width()-$('.filter_block').width();$('.catalog_content:not(".search_results")').css('width',catalogContentW);news_blockleftW=$('.news_block').width()-$('.news_blockright').outerWidth();$('.news_blockleft').css('width',news_blockleftW);tovar_blockleftW=$('.tovar_maininfo').width()-$('.tovar_info').outerWidth();$('.tovar_imageblock, .descr_n_comments .description').css('width',tovar_blockleftW);}
function blocksFAQ(){$('.faq_title').click(function(){if($(this).hasClass('active')){$(this).removeClass('active');$(this).siblings('.faq_text').slideUp(300);}
else{$('.faq_title').removeClass('active');$(this).addClass('active');$('.faq_text').slideUp(300);$(this).siblings('.faq_text').slideDown(300);}});}
function visitedSlider(){if($('.viewed_slider .for_slider').length>0){$('.viewed_slider').each(function(){if($(this).find('.slide').length<4){$(this).addClass('less');}
$(this).find('.for_slider').owlCarousel({pagination:false,loop:true,mouseDrag:false,nav:true,responsive:{0:{items:1},500:{items:2},700:{items:3},1050:{items:4}}});});}}
function defaultSlider(){$('.defaultSlider').each(function(){if($(this).find('.slide').length>1&&$(this).hasClass('promotion_block')){$(this).find('.for_slider').bxSlider({slideMargin:0,controls:false,pager:true,useCSS:false,auto:true,autoStart:true,pause:5000,speed:2000});}
if($(this).find('.slide').length>1&&$(this).hasClass('left_block')){$(this).find('.for_slider').bxSlider({slideMargin:0,controls:false,pager:true,useCSS:false,auto:true,autoStart:true,pause:6000,speed:2000});}});}
function filterSlider(){$('.commercial_href .for_slider').bxSlider({slideMargin:0,controls:false,pager:true,useCSS:false,auto:true,autoStart:true,pause:5000,speed:2000,});}
function portalBrands_slider(){if($('.portalBrands_slider').length){$('.portalBrands_slider .for_slider').owlCarousel({pagination:false,loop:true,mouseDrag:false,nav:true,responsive:{0:{items:2},500:{items:3},700:{items:4},1050:{items:5}}});}}
function salesStiker(){$('.soon, .hit, .sale, .new, .akcia, .partsp').each(function(){var saleHolder='<div class="saleHolder"></div>';if($(this).find('.saleHolder').length<1){$(this).prepend(saleHolder);}
if($(this).hasClass('partsp')&&$(this).find('.partspSt').length<1){$(this).find('.saleHolder').prepend('<div class="partspSt">'+$('#phrase_holder_partsp').val()+'</div>');}
if($(this).hasClass('soon')&&$(this).find('.soonSt').length<1){$(this).find('.saleHolder').append('<div class="soonSt">'+$('#phrase_holder_soon').val()+'</div>');}
if($(this).hasClass('hit')&&$(this).find('.hitSt').length<1){$(this).find('.saleHolder').append('<div class="hitSt">'+$('#phrase_holder_hit').val()+'</div>');}
if($(this).hasClass('sale')&&$(this).find('.saleSt').length<1){$(this).find('.saleHolder').append('<div class="saleSt">'+$('#phrase_holder_sale').val()+'</div>');}
if($(this).hasClass('new')&&$(this).find('.newSt').length<1){$(this).find('.saleHolder').append('<div class="newSt">'+$('#phrase_holder_new').val()+'</div>');}
if($(this).hasClass('akcia')&&$(this).find('.akciaSt').length<1){$(this).find('.saleHolder').append('<div class="akciaSt">'+$('#phrase_holder_action').val()+'</div>');}})}
function mainNavDropdown(){function mainNavHideDropdown(){$('.nav_dropdown .main_content').css({height:0});$('.dropdown_inner').removeClass('active');$('body').removeClass('pc_dropdown');}
$('nav a').hover(function(){nthChild=$(this).index()+1;Dropdown=$('.dropdown_inner:nth-child('+nthChild+')');DropdownHeight=Dropdown.outerHeight();$('nav a').mousestop(function(){if(Dropdown.length){$('.dropdown_inner').removeClass('active');$('.nav_dropdown .main_content').css({height
ropdownHeight});Dropdown.addClass('active');$('body').addClass('pc_dropdown');}
else{mainNavHideDropdown();}});});$('.dropdown_inner').mouseenter(function(){$('.nav_dropdown .main_content').css({height
ropdownHeight});$(this).addClass('active');});$('.mainnav_wrap').mouseleave(function(){mainNavHideDropdown();});}
function infoHorblock_nav(){$('.infoHorblock_navigation div').click(function(){if($(this).hasClass('active')){return false}
else{infoTextChild=$(this).index()+1;infoParent=$(this).parents('.infoHorblock_container');infoTextBlock=infoParent.find('.infoHorblock_text div:nth-child('+infoTextChild+')');infoParent.find('.infoHorblock_text').height(infoTextBlock.height());$(this).siblings().removeClass('active');$(this).addClass('active');infoTextBlock.addClass('active');infoParent.find('.infoHorblock_text div').removeClass('active');infoTextBlock.addClass('active');}});$.urlParam=function(name){var results=new RegExp('[\?&]'+name+'=([^&#]*)').exec(window.location.href);if(results==null){return null;}
else{return results[1]||0;}}
var InfoToShow=$.urlParam('infopage');$('.infoHorblock_container').each(function(){var InfoBlockClick=$(this).find('.infoHorblock_navigation div[data-id="'+InfoToShow+'"]');if(InfoBlockClick.length){InfoBlockClick.click();}
else{$(this).find('.infoHorblock_navigation div:first-child').click();}});}
function masonryCatalog(){if($(".goods_list.tiles").length){$('.goods_list.tiles').masonry({itemSelector:'.goods_item',isResizable:true});}}
function deliveryControls(){$('.deliverytype_click').click(function(){if($(this).hasClass('active')){return false}
else{$('.deliverytype_click, .deliverytype_block').removeClass('active');$(this).addClass('active');var blockDelivery=$(this).index()+1;$('.deliverytype_block:nth-child('+blockDelivery+')').addClass('active');$('.mapPopup').addClass('hidden');}});$('.showonmap, .mapPopup .popup_close').click(function(){$('.mapPopup').toggleClass('hidden ');});$('.return_call .show_callpopup, .popup_returncall .popup_close').on('click',function(){$('.popup_returncall').toggleClass('hidden');if($(this).hasClass('from404')){$('html, body').animate({scrollTop:97},500);}
return false});$('.city_dropdown .selectdiv_title').click(function(){$('.mapPopup').addClass('hidden');});$('.info_to_fill span').click(function(){$('html, body').animate({scrollTop:$('.catalog_title').offset().top},500);});$('.promocode input[type="text"]').click(function(){$(this).addClass('focus').attr("placeholder","xxx-xxx-xxx-xxx");;});$('.promocode input[type="submit"]').click(function(){$(this).siblings('input[type="text"]').removeClass('focus').attr("placeholder","Ввести промокод");;});$('.deliveryface_click').click(function(){if($(this).hasClass('active')){return false}
else{$(this).addClass('active').siblings().removeClass('active');var formsDelivery=$(this).attr('data-type');$('.delivery_forms[data-type='+formsDelivery+']').addClass('active').siblings().removeClass('active');$(this).parents('.customer_types').attr("data-type",formsDelivery);$('.payment_type').attr("data-type",formsDelivery);if(formsDelivery=="legal"){$('.payment_type').find('.forLegal').click();}
else{$('.payment_type .payment_item:first-child').click();}}});$('.deliveryinput_row.file .block_file').click(function(){$(this).siblings('input[type="file"]').click();})
$('.deliveryinput_row.file .remove_file').click(function(){$(this).siblings('.file_row').find('input[type="file"]').val("").trigger("change");return false});}
function actionsList(){$('.filter_actions .el_filters').click(function(){if($(this).hasClass('active')){return false;}
else{$(this).addClass('active').siblings().removeClass('active');var blockNamber=$(this).attr('data-type');$('.filter_actions .category_actions[data-type='+blockNamber+']').addClass('active').siblings().removeClass('active');return false;}})
$('.category_actions>a').click(function(){$(this).toggleClass('active');return false;})}
function getName(str){var fn=$(str).val();if(fn.lastIndexOf('\\')){var i=fn.lastIndexOf('\\')+1;}
else{var i=fn.lastIndexOf('/')+1;}
var filename=fn.slice(i);$(str).siblings(".fileformlabel").val(filename);}
function cityChoice(){$('.city_item').click(function(){$('.city_item').removeClass('active');$(this).addClass('active');$('.delivery .show_popup').text($(this).text());popupClose();});}
function popupClose(){$('.popup').fadeOut(200).removeClass('visible').attr('style','');$('.popups_overlay').fadeOut(200).removeClass(popUptoShow);}
function popupControls(){$('body').on('click','.show_popup',function(){$('.popup').fadeOut();popUptoShow=$('.popup.'+$(this).attr('data-class')+'');popUptoShow.css({"margin-top":-popUptoShow.outerHeight()/2,"margin-left":-popUptoShow.outerWidth()/2}).fadeIn().addClass('visible');$('.popups_overlay').fadeIn().addClass(popUptoShow);return false});$('body').on('click','.popup_close, .popups_overlay',function(){popupClose();});}
function commentsControls(){$('.new_comment textarea.main_area').focus(function(){$('.stars_newcomment').animate({opacity:1},500);$(this).animate({height:82},200);$(this).parents('.new_comment').find('.comment_hidden').slideDown();});$('.new_comment .plus_minus').click(function(){$(this).toggleClass('opened');$(this).siblings('.plusminus_inputs').slideToggle();});$('.answerComment').click(function(){$('.new_comment textarea.main_area').focus();$('html, body').animate({scrollTop:$('.new_comment textarea.main_area').offset().top-98},800);return false});}
function expertForms(){$('.experts_inner .button_meals.ask').click(function(){$(this).addClass('active');$('.new_comment textarea.main_area').focus();$('html, body').animate({scrollTop:$('.new_comment textarea.main_area').offset().top-98},800);return false});$('.container_experts .button_meals.ask').click(function(){$(this).addClass('active').parents('.block_expert ').find('.styled_forms').slideDown();return false});}
function mobSearchControls(){$('.seachMobile_trigger').click(function(){if($('body').hasClass('mobmenu_opened')){hideMobMenu();$('body').addClass('seach_opened');}
else if($('body').hasClass('seach_opened')){$('body').removeClass('seach_opened');}
else{$('body').addClass('seach_opened');}
return false});}
function showMobMenu(){$('body').removeClass('seach_opened');$('body').height($(window).height());$('.mainnav_wrap').show();$('body, .menuMain_mobile').addClass('mobmenu_opened');}
function hideMobMenu(){$('body').height('');$('.mainnav_wrap').hide();$('body, .menuMain_mobile').removeClass('mobmenu_opened');}
function mobMenuControls(){$('.menuMain_mobile').click(function(){if($(this).hasClass('mobmenu_opened')){hideMobMenu();}
else{showMobMenu();}});}
function filtersControls(){$('.filter_controls').click(function(){if($('body').hasClass('filters_opened')){$('body').removeClass('filters_opened');}
else{$('body').addClass('filters_opened');$('html, body').animate({scrollTop:0},500);}});}
function mobMenuRisize(){if(mediaQueriesWidth>1024){$('body').height('');$('.mainnav_wrap').hide();$('body, .menuMain_mobile').removeClass('mobmenu_opened');}
else if($('body').hasClass('mobmenu_opened')){$('body').height($(window).height());}
if(mediaQueriesWidth>568){$('body').removeClass('seach_opened');}}
function compareHeightFix(){var compareLiHeight=0;$('.compare_block li:nth-child('+childRow+')').each(function(){if($(this).height()>compareLiHeight){compareLiHeight=$(this).height();}});$('.compare_block li:nth-child('+childRow+')').height(compareLiHeight);childRow++;if(childRow<=maxChild){compareHeightFix();}
else{var HeightLi=$('.horscroll .compare_col:first-child').height()
$(".horscroll_inner").height(HeightLi);$(".horscroll").height(HeightLi+25);}}
function bonusHeightFix(){$('.bonus_warp .getbonus_info .cell').css({height:""});var bonusHeight=0;$('.bonus_warp .getbonus_info .cell').each(function(){if($(this).height()>bonusHeight){bonusHeight=$(this).height();}});$('.bonus_warp .getbonus_info .cell').height(bonusHeight);}
function kreditCircle(){var isDragging=false;$(".yesno .circle").mousedown(function(){$(window).mousemove(function(){isDragging=true;$(window).unbind("mousemove");});})
$(".yesno").mouseup(function(){var wasDragging=isDragging;if(!wasDragging){$(this).toggleClass('active');}
else{$(this).toggleClass('active');}});$('.kredit_text .separator').click(function(){$(this).remove();});}
function mainNavFixed(){if($(window).scrollTop()>180){$('body').addClass('fixed');}else{$('body').removeClass('fixed');}}
function filterControlsFixed(){if($('.filter_controls').length>0){var catalogBlockBot=$('.catalog_block').offset().top+$('.catalog_block').height()-500;if($(window).scrollTop()>catalogBlockBot){$('.filter_controls').hide();}else{$('.filter_controls').show();}}}
function tovarPagenav(){$('.anim_scroll a').click(function(){var ancorId=$(this).attr('data-scroll');var ancor=$('*[scroll-id="'+ancorId+'"]');if(ancor.length>0){$('html, body').animate({scrollTop:ancor.offset().top-98},800);}
else if(ancorId=="top"){$('html, body').animate({scrollTop:0},800);}
return false});}
function moreToShowDDD(initUnit){if($(initUnit).parent().parent().hasClass('portallink_text')){var ellipsisSign='';var wrapBreak='children';}
else{var ellipsisSign='... ';var wrapBreak='letter';}
$(initUnit).dotdotdot({ellipsis:ellipsisSign,wrap:wrapBreak,watch:true,callback:function(isTruncated){if(isTruncated){$(initUnit).addClass('hiddentext');}}});}
function moreToShow(){$('.moretoshow .text').each(function(){var initUnit=$(this);moreToShowDDD(initUnit);});$(".moretoshow .more").click(function(){var initUnit=$(this).siblings('.text');if(initUnit.hasClass('hiddentext')){initUnit.trigger("destroy").toggleClass('hiddentext visibletext');}
else if(initUnit.hasClass('visibletext')){initUnit.removeClass('visibletext');moreToShowDDD(initUnit);}});$(".withHidden .more").click(function(){$(this).parents('.withHidden').toggleClass('opened');});}
function alertPopUp(alertColor,alertText){$('#alert_popup').attr("data-color",alertColor).fadeIn(200).find('.text').html(alertText);$('.popups_overlay').fadeIn(200);}
function hideOutPopup(){$(document).bind('click touch',function(event){if(!$(event.target).parents().addBack().is('.popTrigger')){$('.hideOut').hide();}});$('.hideOut .innerContent').bind('click touch',function(event){event.stopPropagation();});$('.hideOut .popup_close').click(function(){$(this).parent().hide();});$(document).on('click','.popTrigger',function(){$(this).siblings('.hideOut').show();});}
function initZoom(){$('.slide.zoom').each(function(){var data_big=$(this).attr('data-zoom');$(this).zoom({url:''+data_big+'',on:'click',touch:false,magnify:1,onZoomIn:function(){$(this).parent('.zoom').addClass('out');},onZoomOut:function(){$(this).parent('.zoom').removeClass('out');}});});}
function gallerypopSliders(){if($('.tovar_imageblock .slider_block').length>0){$('.tovar_imageblock .slider_block').each(function(){if($(this).find('.slide').length<2){$(this).addClass('less');}
else{$(this).find('.for_slider').owlCarousel({pagination:false,loop:true,mouseDrag:false,nav:true,responsive:{0:{items:3},461:{items:4},768:{items:3},820:{items:4}}});}});}
$('.gallerypop_slider .for_slider').each(function(){var slideCount=$(this).find('.slide').length;if(slideCount>1){gallerypopSliders=$(this).bxSlider({slideMargin:0,auto:false,useCSS:false,controls:false,pager:false,infiniteLoop:false,mode:'fade'});}
else{$(this).addClass('less');}});$('.gallerypop_thumbs .for_slider').each(function(){var slideCount=$(this).find('.thumb').length;if(slideCount>1){gallerypopThumbs=$(this).bxSlider({slideMargin:5,auto:false,controls:true,pager:false,mode:'vertical',minSlides:4,maxSlides:4,slideWidth:80,moveSlides:1,infiniteLoop:false});}
else{$(this).addClass('less');}});$('.tovar_imageblock .slide').click(function(){var attrSlide=$(this).attr('data-number');if(!$(this).hasClass('show_popup')){var mainTovarImage=$(this).attr('data-image');$('.tovar_mainimage').find('img').attr('src',mainTovarImage);$('.gallerypop_thumbs .thumb[data-slide-index="'+attrSlide+'"]').click();}
else if($(this).hasClass('YouTubeSlide')){showYouTube();}
else if($(this).hasClass('Slide3d')){show3d();}});$('.gallerypop .toVidoeSlide').click(function(){showYouTube();return false});$('.gallerypop .to3dSlide').click(function(){show3d();return false});$('.gallerypop_thumbs .thumb ').click(function(){$(this).addClass('active').siblings().removeClass('active');gallerypopSliders.goToSlide($(this).attr('data-slide-index'));if($('.gallerypop_slider .YouTubeSlide').hasClass('videoPlayed')){$('.gallerypop_slider .YouTubeSlide').removeClass('videoPlayed').fadeOut(200,function(){$('.YouTubeSlide iframe[src*="youtube"]').each(function(){$(this).attr('src',$(this).attr('src'));});});}
if($('.gallerypop_slider .Slide3d').hasClass('played3d')){$('.gallerypop_slider .Slide3d').removeClass('played3d').fadeOut(200);};return false;});}
function showYouTube(){$('.gallerypop_thumbs .thumb').removeClass('active');if($('.gallerypop_slider .Slide3d').hasClass('played3d')){$('.gallerypop_slider .Slide3d').removeClass('played3d').fadeOut(200);};$('.gallerypop_slider .YouTubeSlide').fadeIn().addClass('videoPlayed');}
function show3d(){$('.gallerypop_thumbs .thumb').removeClass('active');if($('.gallerypop_slider .YouTubeSlide').hasClass('videoPlayed')){$('.gallerypop_slider .YouTubeSlide').removeClass('videoPlayed').fadeOut(200,function(){$('.gallerypop_slider .YouTubeSlide iframe[src*="youtube"]').each(function(){$(this).attr('src',$(this).attr('src'));});});}
$('.gallerypop_slider .Slide3d').fadeIn().addClass('played3d');}
function catologDrop(){$('.filter_block').on('click','.filter_title',function(){$(this).parents('.filter_type').toggleClass('filtereach_drop');});$('.filter_block').on('click','.showDisabled',function(){$(this).parents('.filter_type').addClass('disabledShown');$(this).remove();return false});}
function newsblogCategiries(){$('.news_droplist a').click(function(){var parentli=$(this).parent();if(parentli.hasClass('has_child')){parentli.toggleClass('current').children('ul').slideToggle();return false}});}
function cartActive(){$('.cart_color .cartactive').click(function(){if($(this).hasClass('active')){return false;}else{$(this).siblings().removeClass('active');$(this).addClass('active');}})}
function decIncNumber(){$('.decinc a').click(function(){var numparent=$(this).parent();var numholder=$(this).siblings('input');var num=numholder.val();if($(this).hasClass('inc')){num++;var num=Math.min(num,parseInt(numparent.attr("data-max-value")));}
else if($(this).hasClass('dec')){num--;if(num<1)num=1;}
numholder.val(num).change();return false});}
function textareaRemaining(){$('.remainingText').each(function(){var remainingBlock=$(this);var remainingTextarea=remainingBlock.find('textarea');var maxLength=remainingTextarea.attr('maxlength');remainingBlock.append('<div class="textareaFeedback">'+maxLength+'</div>');remainingTextarea.keyup(function(){var curLength=remainingTextarea.val().length;$(this).val($(this).val().substr(0,maxLength));var remaining=maxLength-curLength;var textareaFeedback=remainingBlock.find('.textareaFeedback')
if(remaining<0)remaining=0;textareaFeedback.html(remaining);if(remaining<10)remainingBlock.addClass('warning');else remainingBlock.removeClass('warning');})});}
function mapTovar(){$('.goods_store_map .dropdown_item ').click(function(){var attrId=$(this).attr('data-id');$('.goods_store_map .container_map_element').removeClass('showPane')
$('.goods_store_map .container_map_element[data-id='+attrId+']').addClass('showPane')})
$('.goods_store_map .address').click(function(){if(!$(this).hasClass('active')){$('.goods_store_map .address').removeClass('active');$(this).addClass('active')}})}
$(document).ready(function(){hideOutPopup();bonusHeightFix();blocksFAQ();loginForms();servicePortalInput();infoHorblock_nav();portalBrands_slider();defaultSlider();visitedSlider();mainNavDropdown();salesStiker();catalogBlocksize();deliveryControls();cityChoice();popupControls();commentsControls();viewPortSize();maxChild=$('.compare_titles li').length;childRow=1;compareHeightFix();mobMenuControls();filtersControls();mobSearchControls();kreditCircle();tovarPagenav();moreToShow();initZoom();gallerypopSliders();catologDrop();newsblogCategiries();actionsList();cartActive();expertForms();decIncNumber();textareaRemaining();filterSlider();mapTovar();$('.click_astive').click(function(){$(this).toggleClass('active');});$('.selectdiv_title').click(function(){if($(this).hasClass('active')){$(this).removeClass('active');$(this).siblings('.selectdiv_dropdown').slideUp(100);}
else{$('.selectdiv_dropdown').slideUp(100);$('.selectdiv_title').removeClass('active');$(this).addClass('active');$(this).siblings('.selectdiv_dropdown').slideDown(300);}});$('.selectdiv_dropdown .dropdown_item').click(function(){$(this).parents('.selectdiv').find('.selectdiv_title').text($(this).text()).removeClass('active');$(this).parents('.selectdiv').find('.selectdiv_dropdown').slideUp(100);$(this).siblings('.dropdown_item').removeClass('active');$(this).addClass('active');});$('.topright_menu').hover(function(){$('.topright_menu li').hover(function(){var lineLeft=$(this).position().left;var lineWidth=$(this).width();$('.topright_menu_line').css({opacity:1,width:lineWidth,left:lineLeft});});},function(){$('.topright_menu_line').css({opacity:0,width:'',left:''});});$('.countdown').each(function(){var startDate=$(this).attr('data-time').replace(/,/g,'/');$(this).countdown({date
tartDate,render:function(data){$(this.el).html("<div>"+this.leadingZeros(data.days,2)+" <span>дней</span></div><div>"+this.leadingZeros(data.hours,2)+" <span>часов</span></div><div>"+this.leadingZeros(data.min,2)+" <span>мин</span></div><div>"+this.leadingZeros(data.sec,2)+" <span>сек</span></div>");},onEnd:function(){$(this.el).addClass('ended');}});});$(document).on('click','.more_filters',function(){$(this).hide();$(this).siblings('.hidden_filters').show();});$('.price_range').each(function(){var bottomRange=parseInt($(this).attr('data-bottom'));var topRange=parseInt($(this).attr('data-top'));var currentBot=parseInt($(this).attr('data-botcurrent'));var currentTop=parseInt($(this).attr('data-topcurrent'));$(this).slider({range:true,min:bottomRange,max:12000,values:[2500,10245],create:function(event,ui){$(this).find('a.ui-slider-handle:nth-child(2)').text(currentBot);$(this).find('a.ui-slider-handle:nth-child(3)').text(currentTop);},slide:function(event,ui){$(".price_range>a:nth-child(2)").text(ui.values[0]);$(this).attr('data-botcurrent',''+ui.values[0]+'');$(".price_range>a:nth-child(3)").text(ui.values[1]);$(this).attr('data-topcurrent',''+ui.values[1]+'');}});});$('.dropdown_inner').masonry({columnWidth:'.col:first-child',itemSelector:'.col',"stamp":".outc"});$('.service_item .checkbox').click(function(){$(this).parent('.service_item').toggleClass('active');});$('.severalAtive').click(function(){$(this).toggleClass('active');});$('.soloAtive').click(function(){$(this).siblings('.soloAtive').removeClass('active');$(this).addClass('active');});$('.scrollPane').jScrollPane();$('.dotdotdot, .ddd, .expert_comment .block_comment').dotdotdot({ellipsis:'... ',wrap:'letter',watch:true,});$('.rankingStar').hover(function(){currentRate=$(this).parent('.rankingStars').attr('data-rating');toRate=$(this).attr('data-rating');if(!$(this).parent().parent().hasClass('tovar_title')){$(this).parent('.rankingStars').attr('data-rating',''+toRate+'');}},function(){if($(this).parent('.rankingStars').hasClass('clicked')){return false}
else{$(this).parent('.rankingStars').attr('data-rating',''+currentRate+'');}});$('.rankingStar').click(function(){if(!$(this).parent().parent().hasClass('tovar_title')){toRate=$(this).attr('data-rating');$(this).parent('.rankingStars').attr('data-rating',''+toRate+'').addClass('clicked');}});$('.similar').click(function(){$('html, body').animate({scrollTop:$('.similarBlock').offset().top-100},500);});$(document).on('click',function(event){if(!$(event.target).closest('.popup_returncall:not(.hidden)').length){if($('.popup_returncall').hasClass('hidden')){}
else{$('.popup_returncall').addClass('hidden')};}});});$(window).resize(function(){viewPortSize();mobMenuRisize();bonusHeightFix();initZoom();catalogBlocksize();});$(window).scroll(function(){mainNavFixed();filterControlsFixed();});$(document).ready(function(){var compareProducts=new Array();searchAutocomplete();if($.cookie('compareProducts')){compareProducts=JSON.parse($.cookie('compareProducts'));}
$('div.popup_returncall input[type=submit]').click(function(){$.post(siteBaseUrl+"/site/NoticeCallback/",{'NoticesCallback':{'name':$('#notices_callback_name').val(),'phone':$('#notices_callback_phone').val()}},function(data){if(data.error){alertPopUp("error",data.error);}else{alertPopUp("success",data.notify);$('div.popup_returncall').find('div.popup_close').click();}},"json");});$('.return_call .show_callpopup').on('click',function(){if(!$('.popup_returncall').hasClass('hidden')){$('div.popup_returncall div.timing').text("");$.post(siteBaseUrl+"/site/NoticeCallback/",{'NoticesCallbackTime':1},function(data){if(data.error){alertPopUp("error",data.error);}else{$('div.popup_returncall div.timing').text(data.notify);}},"json");}
return false});$('.service_item .checkbox').click(function(){if($(this).parent('.service_item').hasClass('active')){$(this).parent('.service_item').find('input').attr("checked","checked");}else{$(this).parent('.service_item').find('input').removeAttr("checked");}});$(".other_city input").autocomplete({source
iteBaseUrl+"/site/cityAutoComplete/",minLength:4,autoFocus:true,select:function(event,ui){$('.delivery .show_popup').text(ui.item.value);$("#user_city_id").val(ui.item.id);if($('.city_item[data-id='+ui.item.id+']').length){$('.city_item[data-id='+ui.item.id+']').click();}else{$.cookie('cityActiveId',ui.item.id,{path:'/'});$('.othercity_title').click();popupClose();}}});$('.city_item,.othercity_title').click(function(){$.cookie('cityActiveId',$(this).data("id"),{path:'/'});});$('.city_item').click(function(){$(".other_city input").attr("placeholder","Найдите свой город");$(".other_city input").val("");});$('.othercity_title').click(function(){$('.city_item').removeClass('active');});$("body").on("click",".compare,.goods_compare",function(){var productId=$(this).data('id');if($(this).hasClass('active')){$(this).removeClass('active');removeCompareProducts(productId);}else{$(this).addClass('active');addCompareProducts(productId);}});$('.compare_remove_product').click(function(){removeCompareProducts($(this).data('id'));location.reload();});$('.more_gooods.searchText').click(function(){var itemHolder=$('.goods_list.tiles');var CatalogBlock=$('.catalog_block');CatalogBlock.addClass('loading');var moreProducts=$(this);var searchOffset=moreProducts.data("searchOffset");var searchCount=moreProducts.data("searchCount");var searchText=moreProducts.data("searchText");var searchCategoryId=moreProducts.data("searchCategoryId");var searchMax=moreProducts.data("searchMax");var searchResidue=searchMax-(searchOffset+searchCount);$.post(siteBaseUrl+"/products/searchMore",{text
earchText,categoryId
earchCategoryId,offsetShow
earchOffset},function(data){itemHolder.animate({opacity:0},350,function(){itemHolder.append(data);$('.goods_list').waitForImages({finished:function(){itemHolder.animate({opacity:1},350,function(){salesStiker();CatalogBlock.removeClass('loading');if(searchCount>=searchResidue&&searchResidue>0){$(".more_gooods span").text(searchMax-(searchOffset+searchCount));}
moreProducts.data("searchOffset",searchOffset+searchCount);if(moreProducts.data("searchOffset")>=searchMax){$(".more_gooods").hide();}});},each:function(){},waitForAll:true});});});});function removeCompareProducts(productId){if(compareProducts.indexOf(productId)>-1){while(compareProducts.indexOf(productId)>-1){compareProducts.splice(compareProducts.indexOf(productId),1);}
$.cookie('compareProducts',JSON.stringify(compareProducts),{path:'/'});}}
function addCompareProducts(productId){compareProducts.push(productId);$.cookie('compareProducts',JSON.stringify(compareProducts),{path:'/'});}
$('.delivery_choice div').click(function(){$("#deliveryType").val($(this).data("id"));});$('.deliveryface_click').click(function(){$("#deliveryFace").val($(this).data("id"));});$('.selectdiv_dropdown .dropdown_item').click(function(){$("#shopId").val($(this).attr("shop-id"));$.post(siteBaseUrl+"/basket/updateIdShop/",{shopId:$(this).attr("shop-id")},function(data){if(data.data){updateCountSumPriceProduct(data.data);}},"json");});$('.soloAtive').click(function(){$("#payment").val($(this).data("id"));});$('#formCheckoutOrderBottom').click(function(){$('#formCheckoutOrderBottom').unbind('click');$("#checkoutOrder").submit();return false;});$('.compare_filter_equal').click(function(){$('.compare_block').find('ul.compare_product_properties li').hide();$('.compare_block').find('ul.compare_product_properties li'+$(this).data('filter')).show();});$('.searchAll').on('click',function(){$('#searchForm').submit();});$('#more_news').on('click',function(){var moreNews=$(this);var newsOffset=moreNews.data("offset");var newsCount=moreNews.data("count");var newsMax=moreNews.data("max");var newsResidue=newsMax-(newsOffset+newsCount);$.post(siteBaseUrl+"/news/next",{offsetShow:newsOffset},function(data){$("#box_load_news").append(data);if(newsCount>=newsResidue&&newsResidue>0){$(".more_news span").text(newsMax-(newsOffset+newsCount));}
moreNews.data("offset",newsOffset+newsCount);if(moreNews.data("offset")>=newsMax){$(".more_news").hide();}});});$(".all_history").on("click",function(){$.post(siteBaseUrl+"/users/historyOrdersMore",function(data){$(".cabinethistory_block").append(data);$(".all_history").hide();});});$('#userActiveDiscountCard .soloAtive').click(function(){$(this).parent('.type_circle').find('input').val($(this).data("id"));});$('#userActiveDiscountCard .dropdown_item').click(function(){$(this).parent('.selectdiv_dropdown').find('input').val($(this).data("id"));});$('#userActiveDiscountCard .severalAtive').click(function(){var checkbox=this;var data="";$(checkbox).parent('.type_square').find('.active').each(function(){if(data!=""){data=data+","+$(this).data("id");}else{data=$(this).data("id");}});$(this).parent('.type_square').find('input').val(data);});$('#more_services').on('click',function(){var moreServices=$(this);var servicesCategoryId=moreServices.data("categoryId");var servicesOffset=moreServices.data("offset");var servicesCount=moreServices.data("count");var servicesMax=moreServices.data("max");var servicesResidue=servicesMax-(servicesOffset+servicesCount);$.post(siteBaseUrl+"/services/catalogNext",{'offsetShow'
ervicesOffset,'categoryId'
ervicesCategoryId},function(data){$(".service_blocks").append(data);if(servicesCount>=servicesResidue&&servicesResidue>0){$(".more_news span").text(servicesMax-(servicesOffset+servicesCount));}
moreServices.data("offset",servicesOffset+servicesCount);if(moreServices.data("offset")>=servicesMax){$(".more_news").hide();}});});$('#more_page_brand').on('click',function(){var itemHolder=$('.goods_list.tiles');var morePageBrand=$(this);var pageBrandOffset=morePageBrand.data("offset");var pageBrandAlias=morePageBrand.data("alias");var pageBrandCount=morePageBrand.data("count");var pageBrandMax=morePageBrand.data("max");var pageBrandResidue=pageBrandMax-(pageBrandOffset+pageBrandCount);$.post(siteBaseUrl+"/site/nextProductPageBrand",{offsetShow:pageBrandOffset,alias:pageBrandAlias},function(data){itemHolder.animate({opacity:0},350,function(){itemHolder.append(data);masonryCatalog();itemHolder.animate({opacity:1},350);});if(pageBrandCount>=pageBrandResidue&&pageBrandResidue>0){$(".more_gooods span").text(pageBrandMax-(pageBrandOffset+pageBrandCount));}
morePageBrand.data("offset",pageBrandOffset+pageBrandCount);if(morePageBrand.data("offset")>=pageBrandMax){$("#more_page_brand").hide();}});});updateBasketProduct();$(".promocode input[type='submit']").on("click",function(){var promoCode=$(".promocode input[type='text']").val();if(promoCode.length!=12){alertPopUp("error","Количество символов не равняется 10");return false;}
$.post(siteBaseUrl+"/basket/validatePromoCode",{code:promoCode,shopId:$("#shopId").val()},function(data){if(data.error){alertPopUp("error",data.error);}else{if(data.data){updateCountSumPriceProduct(data.data);}}},"json");return false;});function updateCountSumPriceProduct(data){$("#product_list").html(data.products);$("#countProducts").val(data.basketProductsCount);$("#sumPriceProducts").val(data.basketProductsMoney);$("#titleSumPriceProducts").text(data.basketProductsMoney);$("#title2SumPriceProducts").text(data.basketProductsMoney);$(".goods_number").text(data.basketProductsCount);$("#titleCountProduct").text(data.basketProductsCount);$("#titleCountPayment").text(data.basketProductsMoney);if($('#pixelPokuponDelivery').length){console.log('Ajax Update pixel Pokupon');var pixelPokuponDelivery=$('#pixelPokuponDelivery').attr('src');$('#pixelPokuponDelivery').attr('src',pixelPokuponDelivery.substring(0,pixelPokuponDelivery.indexOf('amount')+7)+data.basketProductsMoney);}
if(data.basketProductsCount>0&&data.basketTypes!=basketTypes){location.reload();}
updateBasketProduct();decIncNumber();}
buttonBuyProduct();popupMasterClass();$(".show_popup_masterclass").on("click",function(){$('.popup').fadeOut();popUptoShow=$('.popup.'+$(this).attr('data-class')+'');popUptoShow.fadeIn().addClass('visible');$('.popups_overlay').fadeIn();return false});$("#buttonNewProposal").on("click",function(){var idMasterClass=$("#idMasterClass").val();var phone=$("#phone").val();var name=$(".user_name").val();var cityId=$("#masterClassCityId").val();cityId=(cityId?cityId:0);var count_seats=$(".count_seats").val();$("#phone").parent().removeClass("error");$("#count_seats").parent().removeClass("error");$.post(siteBaseUrl+"/services/newProposal",{id:idMasterClass,phone:phone,name:name,cityId:cityId,count_seats:count_seats},function(data){if(data.error){$("#masterClassError").text(data.error);var err=data.data;$.each(err,function(index,data){$("#"+index).parent().addClass("error");});}else{$('div.masterclass').find('div.popup_close').click();alertPopUp("success",data.notify);$("#phone").val("");$(".user_name").val("");$(".count_seats").val("");}},"json");});$(".masterclass .popup_close").on("click",function(){$("#phone").val("");$(".user_name").val("");$(".count_seats").val("");});$(".triggMine_email").on("focusout",function(){TriggMineApi.updateBuyerEmail($(".triggMine_email").val());});$(".triggMine_email_company").on("focusout",function(){TriggMineApi.updateBuyerEmail($(".triggMine_email_company").val());});$(".cabinet_content .cabinet_chosen .goodsitem_inner .remove_chosen").on("click",function(){var productId=$(this).data("productId");var product=$(this).parents(".goods_item");$.post(siteBaseUrl+"/users/delMyProduct",{productId:productId},function(data){if(data.error){alertPopUp("error",data.error);}else{$(product).remove();}},"json");});});function checkphonenumber(inp){var rgxp=/^([0-9]{12})$/i;return rgxp.test(inp);}
function searchAutocomplete(){var searchAutocompleteCountProducts=0;var searchAutocomplete=$(".search_block input[type='text']").autocomplete({source:function(request,response){$.post(siteBaseUrl+"/products/searchAutoComplete",{text:request.term},function(data){searchAutocompleteCountProducts=data.count;response($.map(data.products,function(item1){return{label:item1.label,photo:item1.photo,price:item1.price,url:item1.url};}));},"json");},minLength:3}).data("ui-autocomplete");searchAutocomplete._renderMenu=function(ul,items){var that=this;$.each(items,function(index,item){that._renderItemData(ul,item);});$(ul).append('<a class="searchAll" href="#">Смотреть все результаты ('+searchAutocompleteCountProducts+')</a>').on('click','a.searchAll',function(){$('.search_block input[type="submit"]').click();return false});};searchAutocomplete._renderItem=function(ul,item){var inner_html='<a href="'+item.url+'"><div class="search_item_container"><div class="search_item_image"><span class="vfix"></span><img src="'+item.photo+'"></div><div class="search_item_label">'+item.label+'</div><div class="search_item_price">'+item.price+' грн</div></div></a>';return $("<li></li>").data("item.autocomplete",item).append(inner_html).appendTo(ul);};$.mask.definitions['~']='[+-]';$('.input_phone_mask').mask('+38(999)-999-99-99');$('.input_phone_mask').attr("placeholder","+38(___)___-__-__");$('.input_promo_code').mask('***-***-****');$("#quickOrder_form a.zakazat-v-1-klik").click(function(){$("#quickOrder_form").submit();return;});$("#quickOrder_form").submit(function(){if($('#quickOrder_form').parents('div.tovar_info').hasClass('tovarout')==false){if(!$("#quickOrder_phone").val().length){alertPopUp("error",'Не верный формат номера телефона!');return false;}
$.post(siteBaseUrl+"/basket/quickOrder",{price:$("#quickOrder_productPrice").val(),phone:$("#quickOrder_phone").val(),productId:$("#quickOrder_productID").val()},function(data){if(data.error){alertPopUp("error",data.error);}else{alertPopUp("success",data.notify);window.location.href=siteBaseUrl+'/moyobasket/okbuy.html'+"?id="+data.data;}},"json");}
return false;});$("body").on("click",".show_popup.click_inform_me",function(){$('.popup.catalogpop.inform_me').find('.input_block.important').removeClass('error');$('.popup.catalogpop.inform_me').attr("data-productId",$(this).attr("data-productId"));});$("body").on("click",".show_popup.inform_me",function(){$('.popup.catalogpop.inform_me').find('.input_block.important').removeClass('error');$('.popup.catalogpop.inform_me').attr("data-productId",$(this).attr("data-productId"));});$('.popup.catalogpop.inform_me input[type="submit"]').click(function(){var popupBlock=$(this).parents('.popup.catalogpop.inform_me');$.post(siteBaseUrl+"/products/reportAvailable",{email:popupBlock.find('.input_row input[type="text"]').val(),productId:popupBlock.attr("data-productId")},function(data){if(data.error){!popupBlock.find('.input_block.important').addClass('error');}else{popupBlock.find('.input_row input[type="text"]').val("");popupBlock.find('.popup_close').click();alertPopUp("success",data.notify);}},"json");});$("body").on("click",".show_popup.click_one_click",function(){$('.popup.catalogpop.one_click').find('.input_block.important').removeClass('error');$('.popup.catalogpop.one_click').attr("data-productId",$(this).attr("data-productId"));});$('.popup.catalogpop.one_click input[type="submit"]').click(function(){var popupBlock=$(this).parents('.popup.catalogpop.one_click');if(!popupBlock.find('.input_row input[type="text"]').val().length){!popupBlock.find('.input_block.important').addClass('error');return false;}
$.post(siteBaseUrl+"/basket/quickOrder",{phone:popupBlock.find('.input_row input[type="text"]').val(),productId:popupBlock.attr("data-productId")},function(data){if(data.error){alertPopUp("error",data.error);}else{popupBlock.find('.input_row input[type="text"]').val("");popupBlock.find('.popup_close').click();alertPopUp("success",data.notify);window.location.href=siteBaseUrl+'/moyobasket/okbuy.html'+"?id="+data.data;}},"json");return false;});}
function updateBasketProduct(){$(".remove_cartitem").off("click");$(".editCountProduct").off("keyup");$(".editCountProduct").off("change");$(".editCountProduct").off("blur");$(".soloAtive").off("click");$(".remove_cartitem").on("click",function(){var id=$(this).data("id");$.post(siteBaseUrl+"/basket/delProduct/",{basketId:id,shopId:$("#shopId").val()},function(data){updateCountSumPriceProduct(data.data);},"json");});$(".editCountProduct").on({change:function(){editCountProduct(this)},keyup:function(){editCountProduct(this)}});function editCountProduct(block){var count=$(block).val();count=count.replace(/\D+/g,'');if(count>100){count=100;}
if(count==0||count=="")count=1;$(block).val(count);$.post(siteBaseUrl+"/basket/updateCountProduct/",{count:count,productId:$(block).data("id"),shopId:$("#shopId").val()},function(data){if(data.data){updateCountSumPriceProduct(data.data);}},"json");}
$(".editCountProduct").on("blur",function(){var count=$(this).val();if(count==0||count=="")count=1;$(this).val(count);});$('.soloAtive').click(function(){$(this).siblings('.soloAtive').removeClass('active');$(this).addClass('active');$("#payment").val($(this).data("id"));});if(!$('.payment_item.soloAtive.active').length){$('.payment_item.soloAtive:first').addClass('active');$('#payment').val($('.payment_item.soloAtive:first').data('id'));}
function updateCountProduct(count,productId){if(count==0||count=="")count=1;$.post(siteBaseUrl+"/basket/updateCountProduct/",{count:count,productId:productId,shopId:$("#shopId").val()},function(data){if(data.data){updateCountSumPriceProduct(data.data);}},"json");}
function updateCountSumPriceProduct(data){$("#product_list").html(data.products);$("#countProducts").val(data.basketProductsCount);$("#sumPriceProducts").val(data.basketProductsMoney);$("#titleSumPriceProducts").text(data.basketProductsMoney);$("#title2SumPriceProducts").text(data.basketProductsMoney);$(".goods_number").text(data.basketProductsCount);$("#titleCountProduct").text(data.basketProductsCount);$('#productsCountText').text(getWordFormat(data.basketProductsCount,['товар','товара','товаров']));$("#titleCountPayment").text(data.basketProductsMoney);$(".numberMonths").text(data.basketCreditNumberMonths);$("#paymentTypes").html(data.basketPaymentTypes);$("#paymentTypes").find('.payment_item').removeClass('active');var deliveryFaceClickId=$("#deliveryFace").val();$("#deliveryFace").parent('.container_face').find('.deliveryface_click').removeClass('active');$('.deliveryface_click[data-id='+deliveryFaceClickId+']').click();if($('#pixelPokuponDelivery').length){var pixelPokuponDelivery=$('#pixelPokuponDelivery').attr('src');console.log('Ajax Update pixel Pokupon');var amount=data.basketProductsMoney;if(data.basketCreditNumberMonths>0){amount=data.basketProductsMoney*data.basketCreditNumberMonths;}
$('#pixelPokuponDelivery').attr('src',pixelPokuponDelivery.substring(0,pixelPokuponDelivery.indexOf('amount')+7)+amount);}
if(data.basketProductsCount>0&&data.basketTypes!=basketTypes){location.reload();}
updateBasketProduct();var formsDelivery=$('.deliveryface_click[data-id='+deliveryFaceClickId+']').data('type');if(formsDelivery=="legal"){$('.payment_type').find('.forLegal').click();}
decIncNumber();}}
function popupMasterClass(){$('.masterclass_dropdown .selectdiv_title').off("click");$('.masterclass_dropdown .selectdiv_dropdown .dropdown_item').off("click");$('#masterClassTitle .dropdown_item').off("click");$('#masterClassCity .dropdown_item').off("click");$('.masterclass_dropdown .selectdiv_title').click(function(){if($(this).hasClass('active')){$(this).removeClass('active');$(this).siblings('.selectdiv_dropdown').slideUp(100);}
else{$('.selectdiv_dropdown').slideUp(100);$('.selectdiv_title').removeClass('active');$(this).addClass('active');$(this).siblings('.selectdiv_dropdown').slideDown(300);}});$('.masterclass_dropdown .selectdiv_dropdown .dropdown_item').click(function(){$(this).parents('.selectdiv').find('.selectdiv_title').text($(this).text()).removeClass('active');$(this).parents('.selectdiv').find('.selectdiv_dropdown').slideUp(100);$(this).siblings('.dropdown_item').removeClass('active');$(this).addClass('active');});$("#masterClassTitle .dropdown_item").on("click",function(){var masterClassId=$(this).data("id");$("#idMasterClass").val(masterClassId);$.post(siteBaseUrl+"/services/masterClassesOnRequestCity",{masterClassId:masterClassId},function(data){$("#masterClassCity").html(data);popupMasterClass();});});$("#masterClassCity .dropdown_item").on("click",function(){$("#masterClassCityId").val($(this).data("id"));});}
function buttonBuyProduct(){$(".button_buy_product").off("click");$(".button_buy_product").on("click",function(){var url=$(this).data("href");window.location.href=url;return false;});}
function getWordFormat(number,forms){var n=number%10;var N=number%100;if(N>10&&N<20)
return forms[2];if(n==1)
return forms[0];if(n>1&&n<5)
return forms[1];return forms[2];}
var userIds=[];$(function(){$.each($('.user_comment_avatar'),function(){var userId=$(this).data('user_id');var isAjax=$(this).data('ajax_avatar');if(isAjax&&($.inArray(userId,userIds)<0)){userIds.push(userId);loadCommentAvatar($(this).data('user_id'),$(this).data('size'));}})});function loadCommentAvatar(user_id,size){$.ajax({url:'/users/getUserCommentAvatar',dataType:'json',data:{user_id:user_id,size
ize}}).done(function(data){$('.user_comment_avatar[data-user_id="'+user_id+'"]').css("background-image","url('"+data.data.url+"')");});}
function viewPortSize(){var viewportwidth;var viewportheight;if(typeof window.innerWidth!='undefined')
{viewportwidth=window.innerWidth,viewportheight=window.innerHeight}
else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)
{viewportwidth=document.documentElement.clientWidth,viewportheight=document.documentElement.clientHeight}
else
{viewportwidth=document.getElementsByTagName('body')[0].clientWidth,viewportheight=document.getElementsByTagName('body')[0].clientHeight}
mediaQueriesWidth=viewportwidth;mediaQueriesHeight=viewportheight;}
(function(){(function($){$.countdown=function(el,options){var getDateData,_this=this;this.el=el;this.$el=$(el);this.$el.data("countdown",this);this.init=function(){_this.options=$.extend({},$.countdown.defaultOptions,options);if(_this.options.refresh){_this.interval=setInterval(function(){return _this.render();},_this.options.refresh);}
_this.render();return _this;};getDateData=function(endDate){var dateData,diff;endDate=Date.parse($.isPlainObject(_this.options.date)?_this.options.date:new Date(_this.options.date));diff=(endDate-Date.parse(new Date))/1000;if(diff<=0){diff=0;if(_this.interval){_this.stop();}
_this.options.onEnd.apply(_this);}
dateData={years:0,days:0,hours:0,min:0,sec:0,millisec:0};if(diff>=(365.25*86400)){dateData.years=Math.floor(diff/(365.25*86400));diff-=dateData.years*365.25*86400;}
if(diff>=86400){dateData.days=Math.floor(diff/86400);diff-=dateData.days*86400;}
if(diff>=3600){dateData.hours=Math.floor(diff/3600);diff-=dateData.hours*3600;}
if(diff>=60){dateData.min=Math.floor(diff/60);diff-=dateData.min*60;}
dateData.sec=diff;return dateData;};this.leadingZeros=function(num,length){if(length==null){length=2;}
num=String(num);while(num.length<length){num="0"+num;}
return num;};this.update=function(newDate){_this.options.date=newDate;return _this;};this.render=function(){_this.options.render.apply(_this,[getDateData(_this.options.date)]);return _this;};this.stop=function(){if(_this.interval){clearInterval(_this.interval);}
_this.interval=null;return _this;};this.start=function(refresh){if(refresh==null){refresh=_this.options.refresh||$.countdown.defaultOptions.refresh;}
if(_this.interval){clearInterval(_this.interval);}
_this.render();_this.options.refresh=refresh;_this.interval=setInterval(function(){return _this.render();},_this.options.refresh);return _this;};return this.init();};$.countdown.defaultOptions={date:"June 7, 2087 15:03:25",refresh:1000,onEnd:$.noop,render:function(date){return $(this.el).html(""+date.years+" years, "+date.days+" days, "+(this.leadingZeros(date.hours))+" hours, "+(this.leadingZeros(date.min))+" min and "+(this.leadingZeros(date.sec))+" sec");}};$.fn.countdown=function(options){return $.each(this,function(i,el){var $el;$el=$(el);if(!$el.data('countdown')){return $el.data('countdown',new $.countdown(el,options));}});};return void 0;})(jQuery);}).call(this);
/*! Social Likes v3.0.4 by Artem Sapegin -
http://sapegin.github.com/social-likes - Licensed MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a,b){"use strict";function c(a,b){this.container=a,this.options=b,this.init()}function d(b,c){this.widget=b,this.options=a.extend({},c),this.detectService(),this.service&&this.init()}function e(a){function b(a,b){return b.toUpper()}var c={},d=a.data();for(var e in d){var f=d[e];"yes"===f?f=!0:"no"===f&&(f=!1),c[e.replace(/-(\w)/g,b)]=f}return c}function f(a,b){return g(a,b,encodeURIComponent)}function g(a,b,c){return a.replace(/\{([^\}]+)\}/g,function(a,d){return d in b?c?c(b[d]):b[d]:a})}function h(a,b){var c=l+a;return c+" "+c+"_"+b}function i(b,c){function d(g){"keydown"===g.type&&27!==g.which||a(g.target).closest(b).length||(b.removeClass(m),e.off(f,d),a.isFunction©&&c())}var e=a(document),f="click touchstart keydown";e.on(f,d)}function j(a){var b=10;if(document.documentElement.getBoundingClientRect){var c=parseInt(a.css("left"),10),d=parseInt(a.css("top"),10),e=a[0].getBoundingClientRect();e.left<b?a.css("left",b-e.left+c):e.right>window.innerWidth-b&&a.css("left",window.innerWidth-e.right-b+c),e.top<b?a.css("top",b-e.top+d):e.bottom>window.innerHeight-b&&a.css("top",window.innerHeight-e.bottom-b+d)}a.addClass(m)}var k="social-likes",l=k+"__",m=k+"_opened",n="https:"===location.protocol?"https:":"http:",o={facebook:{counterUrl:"https://graph.facebook.com/fql?q=SELECT+total_count+FROM+link_stat+WHERE+url%3D%22{url}%22&callback=?",convertNumber:function(a){return a.data[0].total_count},popupUrl:"https://www.facebook.com/sharer/sharer.php?u={url}",popupWidth:600,popupHeight:500},twitter:{counterUrl:"https://cdn.api.twitter.com/1/urls/count.json?url={url}&callback=?",convertNumber:function(a){return a.count},popupUrl:"https://twitter.com/intent/tweet?url={url}&text={title}",popupWidth:600,popupHeight:450,click:function(){return/[\.:\-–—]\s*$/.test(this.options.title)||(this.options.title+=":"),!0}},mailru:{counterUrl:n+"//connect.mail.ru/share_count?url_list={url}&callback=1&func=?",convertNumber:function(a){for(var b in a)if(a.hasOwnProperty(b))return a[b].shares},popupUrl:n+"//connect.mail.ru/share?share_url={url}&title={title}",popupWidth:550,popupHeight:360},vkontakte:{counterUrl:n+"//vk.com/share.php?act=count&url={url}&index={index}",counter:function(b,c){var d=o.vkontakte;d._||(d._=[],window.VK||(window.VK={}),window.VK.Share={count:function(a,b){d._[a].resolve(b)}});var e=d._.length;d._.push©,a.getScript(f(b,{index:e})).fail(c.reject)},popupUrl:n+"//vk.com/share.php?url={url}&title={title}",popupWidth:550,popupHeight:330},odnoklassniki:{counterUrl:n+"//www.odnoklassniki.ru/dk?st.cmd=shareData&ref={url}&cb=?",convertNumber:function(a){return a.count},popupUrl:n+"//www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl={url}",popupWidth:550,popupHeight:360},plusone:{counterUrl:"http:"===n?"http://share.yandex.ru/gpp.xml?url={url}":b,counter:function(b,c){var d=o.plusone;return d._?void c.reject()
window.services||(window.services={}),window.services.gplus={cb:function(a){d._.resolve(a)}},d._=c,void a.getScript(f(b)).fail(c.reject))},popupUrl:"https://plus.google.com/share?url={url}",popupWidth:700,popupHeight:500},pinterest:{counterUrl:n+"//api.pinterest.com/v1/urls/count.json?url={url}&callback=?",convertNumber:function(a){return a.count},popupUrl:n+"//pinterest.com/pin/create/button/?url={url}&description={title}",popupWidth:630,popupHeight:270}},p={promises:{},fetch:function(b,c,d){p.promises[b]||(p.promises[b]={});var e=p.promises[b];if(!d.forceUpdate&&e[c])return e[c];var g=a.extend({},o[b],d),h=a.Deferred(),i=g.counterUrl&&f(g.counterUrl,{url:c});return i&&a.isFunction(g.counter)?g.counter(i,h):g.counterUrl?a.getJSON(i).done(function(b){try{var c=b;a.isFunction(g.convertNumber)&&(c=g.convertNumber(b)),h.resolve©}catch(d){h.reject()}}).fail(h.reject):h.reject(),e[c]=h.promise(),e[c]}};a.fn.socialLikes=function(b){return this.each(function(){var d=a(this),f=d.data(k);f?a.isPlainObject(b)&&f.update(b)
f=new c(d,a.extend({},a.fn.socialLikes.defaults,b,e(d))),d.data(k,f))})},a.fn.socialLikes.defaults={url:window.location.href.replace(window.location.hash,""),title:document.title,counters:!0,zeroes:!1,wait:500,popupCheckInterval:500,singleTitle:"Share"},c.prototype={init:function(){this.container.addClass(k),this.single=this.container.hasClass(k+"_single"),this.initUserButtons(),this.number=0,this.container.on("counter."+k,a.proxy(this.updateCounter,this));var b=this.container.children();this.countersLeft=b.length,this.makeSingleButton(),this.buttons=[],b.each(a.proxy(function(b,c){this.buttons.push(new d(a©,this.options))},this)),this.options.counters?this.timer=setTimeout(a.proxy(this.appear,this),this.options.wait):this.appear()},initUserButtons:function(){!this.userButtonInited&&window.socialLikesButtons&&a.extend(!0,o,socialLikesButtons),this.userButtonInited=!0},makeSingleButton:function(){if(this.single){var b=this.container;b.addClass(k+"_vertical"),b.wrap(a("<div>",{"class":k+"_single-w"})),b.wrapInner(a("<div>",{"class":k+"__single-container"}));var c=b.parent(),d=a("<div>",{"class":h("widget","single")}),e=a(g('<div class="{buttonCls}"><span class="{iconCls}"></span>{title}</div>',{buttonCls:h("button","single"),iconCls:h("icon","single"),title:this.options.singleTitle}));d.append(e),c.append(d),d.click(function(){var a=k+"__widget_active";return d.toggleClass(a),d.hasClass(a)?(b.css({left:-(b.width()-d.width())/2,top:-b.height()}),j(b),i(b,function(){d.removeClass(a)})):b.removeClass(m),!1}),this.widget=d}},update:function(b){if(b.forceUpdate||b.url!==this.options.url){this.number=0,this.countersLeft=this.buttons.length,this.widget&&this.widget.find("."+k+"__counter").remove(),a.extend(this.options,b);for(var c=0;c<this.buttons.length;c++)this.buttons[c].update(b)}},updateCounter:function(a,b,c){c&&(this.number+=c,this.single&&this.getCounterElem().text(this.number)),this.countersLeft--,0===this.countersLeft&&(this.appear(),this.container.addClass(k+"_ready"),this.container.trigger("ready."+k,this.number))},appear:function(){this.container.addClass(k+"_visible")},getCounterElem:function(){var b=this.widget.find("."+l+"counter_single");return b.length||(b=a("<span>",{"class":h("counter","single")}),this.widget.append(b)),b}},d.prototype={init:function(){this.detectParams(),this.initHtml(),this.initCounter()},update:function(b){a.extend(this.options,{forceUpdate:!1},b),this.widget.find("."+k+"__counter").remove(),this.initCounter()},detectService:function(){var b=this.widget.data("service");if(!b){for(var c=this.widget[0],d=c.classList||c.className.split(" "),e=0;e<d.length;e++){var f=d[e];if(o[f]){b=f;break}}if(!b)return}this.service=b,a.extend(this.options,o[b])},detectParams:function(){var a=this.widget.data();if(a.counter){var b=parseInt(a.counter,10);isNaN(b)?this.options.counterUrl=a.counter:this.options.counterNumber=b}a.title&&(this.options.title=a.title),a.url&&(this.options.url=a.url)},initHtml:function(){var b=this.options,c=this.widget,d=c.find("a");d.length&&this.cloneDataAttrs(d,c);var e=a("<span>",{"class":this.getElementClassNames("button"),text:c.text()});if(b.clickUrl){var g=f(b.clickUrl,{url:b.url,title:b.title}),h=a("<a>",{href:g});this.cloneDataAttrs(c,h),c.replaceWith(h),this.widget=c=h}else c.click(a.proxy(this.click,this));c.removeClass(this.service),c.addClass(this.getElementClassNames("widget")),e.prepend(a("<span>",{"class":this.getElementClassNames("icon")})),c.empty().append(e),this.button=e},initCounter:function(){if(this.options.counters)if(this.options.counterNumber)this.updateCounter(this.options.counterNumber);else{var b={counterUrl:this.options.counterUrl,forceUpdate:this.options.forceUpdate};p.fetch(this.service,this.options.url,b).always(a.proxy(this.updateCounter,this))}},cloneDataAttrs:function(a,b){var c=a.data();for(var d in c)c.hasOwnProperty(d)&&b.data(d,c[d])},getElementClassNames:function(a){return h(a,this.service)},updateCounter:function(b){b=parseInt(b,10)||0;var c={"class":this.getElementClassNames("counter"),text:b};b||this.options.zeroes||(c["class"]+=" "+k+"__counter_empty",c.text="");var d=a("<span>",c);this.widget.append(d),this.widget.trigger("counter."+k,[this.service,b])},click:function(b){var c=this.options,d=!0;if(a.isFunction(c.click)&&(d=c.click.call(this,b)),d){var e=f(c.popupUrl,{url:c.url,title:c.title});e=this.addAdditionalParamsToUrl(e),this.openPopup(e,{width:c.popupWidth,height:c.popupHeight})}return!1},addAdditionalParamsToUrl:function(b){var c=a.param(a.extend(this.widget.data(),this.options.data));if(a.isEmptyObject©)return b;var d=-1===b.indexOf("?")?"?":"&";return b+d+c},openPopup:function(b,c){var d=Math.round(screen.width/2-c.width/2),e=0;screen.height>c.height&&(e=Math.round(screen.height/3-c.height/2));var f=window.open(b,"sl_"+this.service,"left="+d+",top="+e+",width="+c.width+",height="+c.height+",personalbar=0,toolbar=0,scrollbars=1,resizable=1");if(f){f.focus(),this.widget.trigger("popup_opened."+k,[this.service,f]);var g=setInterval(a.proxy(function(){f.closed&&(clearInterval(g),this.widget.trigger("popup_closed."+k,this.service))},this),this.options.popupCheckInterval)}else location.href=b}},a(function(){a("."+k).socialLikes()})});;(function($){var plugin={};var defaults={mode:'horizontal',slideSelector:'',infiniteLoop:true,hideControlOnEnd:false,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:false,captions:false,ticker:false,tickerHover:false,adaptiveHeight:false,adaptiveHeightSpeed:500,video:false,useCSS:true,preloadImages:'visible',responsive:true,slideZIndex:50,wrapperClass:'bx-wrapper',touchEnabled:true,swipeThreshold:50,oneToOneTouch:true,preventDefaultSwipeX:true,preventDefaultSwipeY:false,pager:true,pagerType:'full',pagerShortSeparator:' / ',pagerSelector:null,buildPager:null,pagerCustom:null,controls:true,nextText:'Next',prevText:'Prev',nextSelector:null,prevSelector:null,autoControls:false,startText:'Start',stopText:'Stop',autoControlsCombine:false,autoControlsSelector:null,auto:false,pause:4000,autoStart:true,autoDirection:'next',autoHover:false,autoDelay:0,autoSlideForOnePage:false,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}}
$.fn.bxSlider=function(options){if(this.length==0)return this;if(this.length>1){this.each(function(){$(this).bxSlider(options)});return this;}
var slider={};var el=this;plugin.el=this;var windowWidth=$(window).width();var windowHeight=$(window).height();var init=function(){slider.settings=$.extend({},defaults,options);slider.settings.slideWidth=parseInt(slider.settings.slideWidth);slider.children=el.children(slider.settings.slideSelector);if(slider.children.length<slider.settings.minSlides)slider.settings.minSlides=slider.children.length;if(slider.children.length<slider.settings.maxSlides)slider.settings.maxSlides=slider.children.length;if(slider.settings.randomStart)slider.settings.startSlide=Math.floor(Math.random()*slider.children.length);slider.active={index
lider.settings.startSlide}
slider.carousel=slider.settings.minSlides>1||slider.settings.maxSlides>1;if(slider.carousel)slider.settings.preloadImages='all';slider.minThreshold=(slider.settings.minSlides*slider.settings.slideWidth)+((slider.settings.minSlides-1)*slider.settings.slideMargin);slider.maxThreshold=(slider.settings.maxSlides*slider.settings.slideWidth)+((slider.settings.maxSlides-1)*slider.settings.slideMargin);slider.working=false;slider.controls={};slider.interval=null;slider.animProp=slider.settings.mode=='vertical'?'top':'left';slider.usingCSS=slider.settings.useCSS&&slider.settings.mode!='fade'&&(function(){var div=document.createElement('div');var props=['WebkitPerspective','MozPerspective','OPerspective','msPerspective'];for(var i in props){if(div.style[props[i]]!==undefined){slider.cssPrefix=props[i].replace('Perspective','').toLowerCase();slider.animProp='-'+slider.cssPrefix+'-transform';return true;}}
return false;}());if(slider.settings.mode=='vertical')slider.settings.maxSlides=slider.settings.minSlides;el.data("origStyle",el.attr("style"));el.children(slider.settings.slideSelec...