require(['jquery','waypoints'],function(jQuery){(function($){$.fn.appear=function(fn,options){var settings=$.extend({data:undefined,one:true,accX:0,accY:0},options);return this.each(function(){var t=$(this);t.appeared=false;if(!fn){t.trigger('appear',settings.data);return;}
var w=$(window);var check=function(){if(!t.is(':visible')){t.appeared=false;return;}
var a=w.scrollLeft();var b=w.scrollTop();var o=t.offset();var x=o.left;var y=o.top;var ax=settings.accX;var ay=settings.accY;var th=t.height();var wh=w.height();var tw=t.width();var ww=w.width();if(y+th+ay>=b&&y<=b+wh+ay&&x+tw+ax>=a&&x<=a+ww+ax){if(!t.appeared)t.trigger('appear',settings.data);}else{t.appeared=false;}};var modifiedFn=function(){t.appeared=true;if(settings.one){w.unbind('scroll',check);var i=$.inArray(check,$.fn.appear.checks);if(i>=0)$.fn.appear.checks.splice(i,1);}
fn.apply(this,arguments);};if(settings.one)t.one('appear',settings.data,modifiedFn);else t.bind('appear',settings.data,modifiedFn);w.scroll(check);$.fn.appear.checks.push(check);(check)();});};$.extend($.fn.appear,{checks:[],timeout:null,checkAll:function(){var length=$.fn.appear.checks.length;if(length>0)while(length--)($.fn.appear.checks[length])();},run:function(){if($.fn.appear.timeout)clearTimeout($.fn.appear.timeout);$.fn.appear.timeout=setTimeout($.fn.appear.checkAll,20);}});$.each(['append','prepend','after','before','attr','removeAttr','addClass','removeClass','toggleClass','remove','css','show','hide'],function(i,n){var old=$.fn[n];if(old){$.fn[n]=function(){var r=old.apply(this,arguments);$.fn.appear.run();return r;}}});$(document).ready(function(){$("[data-appear-animation]").each(function(){$(this).addClass("appear-animation");if($(window).width()>767){$(this).appear(function(){var delay=($(this).attr("data-appear-animation-delay")?$(this).attr("data-appear-animation-delay"):1);if(delay>1)$(this).css("animation-delay",delay+"ms");$(this).addClass($(this).attr("data-appear-animation"));$(this).addClass("animated");setTimeout(function(){$(this).addClass("appear-animation-visible");},delay);},{accX:0,accY:-150});}else{$(this).addClass("appear-animation-visible");}});$('.nav-main-menu li.mega-menu-fullwidth.menu-2columns').hover(function(){if($(window).width()>1199){var position=$(this).position();var widthMenu=$("#mainMenu").width()-position.left;if(widthMenu>500){widthMenu=500;}
$(this).find('ul.dropdown-menu').width(widthMenu);}});$('.nav-main-menu .static-menu li > .toggle-menu a').click(function(){$(this).toggleClass('active');$(this).parent().parent().find('> ul').slideToggle();});$('.action.nav-toggle').click(function(){if($('html').hasClass('nav-open')){$('html').removeClass('nav-open');setTimeout(function(){$('html').removeClass('nav-before-open');},300);}else{$('html').addClass('nav-before-open');setTimeout(function(){$('html').addClass('nav-open');},42);}});$('.close-nav-button').click(function(){$('html').removeClass('nav-open');setTimeout(function(){$('html').removeClass('nav-before-open');},300);});$(document).on("click","#close-filter",function(e){$('.block.filter .filter-title .title').click();});$(document).on("click","#close-minicart",function(e){$('.table-icon-menu .minicart-wrapper .action.showcart').click();});$('.checkout-extra > .block > .title').click(function(){$('.checkout-extra > .block > .title').removeClass('active');$('.checkout-extra > .block > .content').removeClass('active');$(this).addClass('active');$(this).parent().find('> .content').addClass('active');});$(document).on("click",".products-grid .product-item-info .product-top > a",function(e){if($(window).width()<992&&!$('.products-grid .product-item-info').hasClass('disable_hover_effect')){if(!$(this).hasClass('active')){$('.products-grid .product-item-info .product-top > a.active').removeClass('active');$(this).addClass('active');}}});});})(jQuery);});require(['jquery','mgs_quickview'],function(jQuery){(function($){$(document).ready(function(){$('.btn-loadmore').click(function(){var el=$(this);el.addClass('loading');url=$(this).attr('href');$.ajax({url:url,success:function(data,textStatus,jqXHR){el.removeClass('loading');var result=$.parseJSON(data);if(result.content!=''){$('#'+result.element_id).append(result.content);$('.mgs-quickview').bind('click',function(){var prodUrl=$(this).attr('data-quickview-url');if(prodUrl.length){reInitQuickview($,prodUrl);}});}
if(result.url){el.attr('href',result.url);}else{el.remove();}}});return false;});if($(".products-grid .product-item-info .actions-link > li").hasClass('quickview-mobile')){$(".products-grid .product-item-info").each(function(){if($(window).width()<768){$(this).find(".quickview-mobile > .mgs-quickview").appendTo($(this).find(".action-mobile"));}else{$(this).find(".action-mobile > .mgs-quickview").appendTo($(this).find(".quickview-mobile"));}});}});if($(".products-grid .product-item-info .actions-link > li").hasClass('quickview-mobile')){$(window).resize(function(){$(".products-grid .product-item-info").each(function(){if($(window).width()<768){$(this).find(".quickview-mobile > .mgs-quickview").appendTo($(this).find(".action-mobile"));}else{$(this).find(".action-mobile > .mgs-quickview").appendTo($(this).find(".quickview-mobile"));}});});}})(jQuery);});function reInitQuickview($,prodUrl){if(!prodUrl.length){return false;}
var url=QUICKVIEW_BASE_URL+'mgs_quickview/index/updatecart';$.magnificPopup.open({items:{src:prodUrl},type:'iframe',removalDelay:300,mainClass:'mfp-fade',closeOnBgClick:true,preloader:true,tLoading:'',callbacks:{open:function(){$('.mfp-preloader').css('display','block');},beforeClose:function(){$('[data-block="minicart"]').trigger('contentLoading');$.ajax({url:url,method:"POST"});},close:function(){$('.mfp-preloader').css('display','none');}}});}
function setLocation(url){require(['jquery'],function(jQuery){(function(){window.location.href=url;})(jQuery);});}
require(['jquery'],function($){$(document).ready(function(){function changeNumber(el,classEl){if($(".change-product-per-row a").hasClass('active')){$(".change-product-per-row a").removeClass('active')}
el.addClass('active');if($(window).width()>=992){$('.product-list-masonry-change-product .product-item-masonry').removeClass(function(index,css){return(css.match(/\bcol-lg\S+/g)||[]).join(' ');});$('.product-list-masonry-change-product .product-item-masonry').removeClass(function(index,css){return(css.match(/\bcol-md\S+/g)||[]).join(' ');});}
$('.product-list-masonry-change-product .product-item-masonry').addClass(classEl);}
if($(window).width()>=992){$(".change-product-per-row .one").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-12 col-md-12');});$(".change-product-per-row .two").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-6 col-md-6');});$(".change-product-per-row .three").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-4 col-md-4');});$(".change-product-per-row .four").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-3 col-md-3');});$(".change-product-per-row .five").click(function(e){e.preventDefault();changeNumber($(this),'col-md-custom-5');});$(".change-product-per-row .six").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-2 col-md-2');});$(".change-product-per-row .seven").click(function(e){e.preventDefault();changeNumber($(this),'col-md-custom-7');});$(".change-product-per-row .eight").click(function(e){e.preventDefault();changeNumber($(this),'col-md-custom-8');});}});$(document).ajaxComplete(function(){function changeNumber(el,classEl){if($(".change-product-per-row a").hasClass('active')){$(".change-product-per-row a").removeClass('active')}
el.addClass('active');if($(window).width()>=992){$('.product-list-masonry-change-product .product-item-masonry').removeClass(function(index,css){return(css.match(/\bcol-lg\S+/g)||[]).join(' ');});$('.product-list-masonry-change-product .product-item-masonry').removeClass(function(index,css){return(css.match(/\bcol-md\S+/g)||[]).join(' ');});}
$('.product-list-masonry-change-product .product-item-masonry').addClass(classEl);}
if($(window).width()>=992){$(".change-product-per-row .one").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-12 col-md-12');});$(".change-product-per-row .two").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-6 col-md-6');});$(".change-product-per-row .three").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-4 col-md-4');});$(".change-product-per-row .four").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-3 col-md-3');});$(".change-product-per-row .five").click(function(e){e.preventDefault();changeNumber($(this),'col-md-custom-5');});$(".change-product-per-row .six").click(function(e){e.preventDefault();changeNumber($(this),'col-lg-2 col-md-2');});$(".change-product-per-row .seven").click(function(e){e.preventDefault();changeNumber($(this),'col-md-custom-7');});$(".change-product-per-row .eight").click(function(e){e.preventDefault();changeNumber($(this),'col-md-custom-8');});}});});