// Run when the page ready (before images and other resource)
jQuery(function($) {MultiCurrencies.init();ActiveOrderPopup.init();WishList.init();});var MultiCurrencies = function() {var that = {nameSpace: 'multi-currencies',isActive: false,isChangedCurrency: false};that.init = function() {$(document).on('s123.page.ready.multi_currencies', function( event ) {that.settings = tryParseJSON($('.s123-multi-currencies').val());if ( !that.settings ) return;if ( !that.settings.active ) return;that.activeCurrency = tryParseJSON($.cookie($(websiteID).val()+'-'+that.nameSpace));that.defaultCurrency = that.settings.defaultCurrency;that.currencies = that.settings.currencies;that.setActiveCurrency(that.activeCurrency.currency);that.$menuIcon = $('[data-toggle="multiCurrenciesPopup"]');that.isActive = true;$(document).off('build_popup.open.multi_currencies').on('build_popup.open.multi_currencies', function( event ) {handleMenuIcon($('#popupFloatDivMenu [data-toggle="multiCurrenciesPopup"]'),true);});handleMenuIcon(that.$menuIcon,false);that.priceOnlyType.backup();$(document).off('pageLoaded.multi_currencies').on('pageLoaded.multi_currencies', function( event ) {if ( $.isNumeric(S123.QueryString.clientZone) ) {$('.client-zone-orders-table [data-rel="multiCurrency"]').removeAttr('data-rel');}
if ( isDefaultCurrency() && that.isChangedCurrency ) {that.reset();} else if ( isDefaultCurrency() && !that.isChangedCurrency ) {$('[data-rel="multiCurrency"]').css({visibility: 'visible'});} else {updateAllPrices();}});if ( $.isNumeric(S123.QueryString.clientZone) ) return;$(document).off('s123.pjax.complete.multi_currencies').on('s123.pjax.complete.multi_currencies', function() {that.$menuIcon = $('[data-toggle="multiCurrenciesPopup"]');handleMenuIcon(that.$menuIcon,false);that.priceOnlyType.backup();$(document).trigger('pageLoaded.multi_currencies');});$(document).off('multi_currencies_price_update').on('multi_currencies_price_update', function( event, settings ) {$.each(settings, function( index, setting ) {if ( !isDefaultCurrency() ) {updatePrice(setting.el,setting.newPrice,true);} else {setting.el.find('[data-rel="multiCurrency"]').css({visibility: 'visible'});}});});$(document).trigger('pageLoaded.multi_currencies');modulesExtraActions();$(document).off('multi_currency_update').on('multi_currency_update', function() {buildPopup_CloseAction('popupFloatDivMenu');});});};that.setActiveCurrency = function( currency ) {that.activeCurrency = that.currencies[currency];if ( !that.activeCurrency ) {that.activeCurrency = that.defaultCurrency;}
$.cookie($(websiteID).val()+'-'+that.nameSpace,JSON.stringify(that.activeCurrency),{ expires: 365, path: '/' });};that.reset = function( ) {if ( !that.isActive ) return;if ( getOrderScreen() > 1 ) return;$('[data-rel="multiCurrency"]').each(function( index, el ) {var originalPrice = $(this).find('[data-type="price"]').data(that.nameSpace + '-price');var $price = $(showPrice(that.defaultCurrency.data,originalPrice));$(this).replaceWith($price);$price.css({visibility: 'visible'});backUpPrice($price.find('[data-type="price"]'),$price.find('[data-type="price"]').html(),false);});$('[data-multi-currency-symbol-only="true"]').html(that.defaultCurrency.data.symbol);that.priceOnlyType.update();that.isChangedCurrency = false;};that.geConvertedPrice = function( price ) {if ( !that.isActive ) return price;if ( !$.isNumeric(price) ) return price;if ( isDefaultCurrency() ) return price;if ( getOrderScreen() > 1 ) return price;var result = parseFloat(price) * parseFloat(that.activeCurrency.rate);return result > 0 ? result.toFixed(2) : result;};that.getMobileIconHtml = function() {var $clone = that.$menuIcon.clone();$clone.attr('data-is-mobile',true);return $clone.prop('outerHTML');};function handleMenuIcon( $menuIcon, isMobileMenu ) {setMenuIconCurrency($menuIcon);var html = '';var maxHeight = 160;html += '
';$html = $(html);setActiveCurrencyListItem($html);$html.find('.currency-list').on('click.multi_currencies', 'a', function( event ) {event.preventDefault();if ( !isDefaultCurrency() ) {that.isChangedCurrency = true;} else {that.isChangedCurrency = false;}
that.setActiveCurrency($(this).parent().data('value'));$(document).trigger('pageLoaded.multi_currencies');modulesExtraActions();setMenuIconCurrency($menuIcon);$menuIcon.popover('hide');setActiveCurrencyListItem($html);$(document).trigger('multi_currency_update',[that.activeCurrency]);});S123.popOver.init({$el: $menuIcon,elSelector: '.multi-currencies-controller',namespace: 'multi_currency_menu_icon',oneTimeUsage: false,popOverSettings: {selector: 'multi-currency',content: $html,html: true,trigger: 'manual',template: '',placementCallBack: function() {if ( isMobileMenu ) return 'top';if ( getWebsiteMenuPosition() === 'top' || getWebsiteMenuPosition() === 'bottom' ) {if ( ($('nav#mainNav').offset().top - $(window).scrollTop()) > maxHeight ) {return 'top';} else {return 'bottom';}} else {if ( $('html').attr('dir') === 'rtl' ) {return 'left';} else {return 'right';}}}}});$(document).on('s123_pop_over_wrapper.show.multi_currency_menu_icon', function() {$menuIcon.addClass('active');})
.on('s123_pop_over_wrapper.hide.multi_currency_menu_icon', function() {$menuIcon.removeClass('active');});$menuIcon.off('click.multi_currencies').on('click.multi_currencies', function() {if ( $(this).hasClass('active') ) {$(this).popover('hide');} else {$(this).popover('show');}});}
function setActiveCurrencyListItem( $currencyList ) {$currencyList.find('.currency-list-item').removeClass('active');$currencyList.find('.currency-list-item[data-value="'+that.activeCurrency.currency+'"]').addClass('active');}
function setMenuIconCurrency( $menuIcon ) {var html = '';if ( $menuIcon.data('is-mobile') ) {html += '' + that.activeCurrency.currency + '';} else {html += '' + that.activeCurrency.currency + '';html += '' + that.activeCurrency.data.symbol + '';if ( getWebsiteMenuPosition() === 'top' || getWebsiteMenuPosition() === 'bottom' ) {html += S123.s123IconToSvg.getHtml('caret-down','mc-icon','');} else {if ( $('html').attr('dir') === 'rtl' ) {html += S123.s123IconToSvg.getHtml('caret-left','mc-icon','');} else {html += S123.s123IconToSvg.getHtml('caret-right','mc-icon','');}}}
$menuIcon.html(html);}
function updateAllPrices() {if ( isDefaultCurrency() && that.isChangedCurrency ) {that.reset();} else if ( isDefaultCurrency() && !that.isChangedCurrency ) {$('[data-rel="multiCurrency"]').css({visibility: 'visible'});} else {$('[data-rel="multiCurrency"]').each(function( index, el ) {updatePrice($(this),$(this).find('[data-type="price"]').html(),false);});}
$('[data-multi-currency-symbol-only="true"]').html(that.activeCurrency.data.symbol);that.priceOnlyType.update();}
function updatePrice( $el, newPrice, force ) {backUpPrice($el.find('[data-type="price"]'),newPrice,force);if ( isReplaceDisabled() ) {$el.css({visibility: 'visible'});} else {var $price = $el.find('[data-type="price"]');var priceAsString = $price.data(that.nameSpace + '-price');var price = parseFloat(priceAsString);var $newEl = $(showPrice(that.activeCurrency.data,(price * parseFloat(that.activeCurrency.rate)).toFixed(2)));backUpPrice($newEl.find('[data-type="price"]'),priceAsString,false);$price.parent().replaceWith($newEl);$newEl.css({visibility: 'visible'});}}
function backUpPrice( $el, newPrice, force ) {if ( !that.isActive ) return;if ( !$el.data(that.nameSpace + '-price') || force ) {$el.data(that.nameSpace + '-price',newPrice);}}
function modulesExtraActions() {$(document).off('donate_price_update.multi_currencies').on('donate_price_update.multi_currencies', function( event, $el ) {if ( isDefaultCurrency() ) return;var price = $el.val();price = parseFloat(price) * parseFloat(that.activeCurrency.rate);$el.val(price.toFixed(2));});}
function isDefaultCurrency() {return that.defaultCurrency.currency === that.activeCurrency.currency;}
function isReplaceDisabled() {if ( getOrderScreen() > 1 ) {return true;} else {return false;}
return false;}
function getOrderScreen() {var path = window.location.pathname.split("/");var orderScreen = path[path.length - 2];if ( orderScreen == '-order1' ) return 1;if ( orderScreen == '-order2' ) return 2;if ( orderScreen == '-order3' ) return 3;return 0;}
that.priceOnlyType = {backup: function() {$('[data-multi-currency-price-only="true"]').each(function( index, el ) {$(this).data(that.nameSpace + '-price',$(this).html());});},update: function() {$('[data-multi-currency-price-only="true"]').each(function( index, el ) {var originalPrice = $(this).data(that.nameSpace + '-price');var newPrice = parseFloat(originalPrice) * parseFloat(that.activeCurrency.rate)
$(this).html(newPrice.toFixed(2));});}};return that;}();var ActiveOrderPopup = function() {AO = {};AO.init = function() {$( document ).on( 's123.page.ready.activeOrderPopup', function( event ) {AO.initializeAddToCart();AO.productCallToAction.init();AO.initializeShowCart();});};AO.initializeAddToCart = function() {$('.orderButtonPopup').off('click').on('click', function( event ) {var $this = $(this);if ( $this.data('disable-atc-validator') != '1' ) {if ( !AO.atcValidator() ) return;}
$this.attr('disabled','');S123.ButtonLoading.start($this);var multiProducts = $this.data('multi-products') ? $this.data('multi-products') : JSON.stringify([$this.data('unique-page')]);var formData = new FormData();formData.append('w',$('#w').val());formData.append('websiteID',$('#websiteID').val());formData.append('moduleID',$this.data('module'));if ( $this.data('product-page') ) {if ( $('#productOptions').prop('type') == 'textarea' ) {formData.append('productOptions',$('#productOptions').length !== 0 ? $('#productOptions').html() : '');} else {formData.append('productOptions',$('#productOptions').length !== 0 ? $('#productOptions').val() : '');}
formData.append('customText',$('#customText').length !== 0 ? $('#customText').html() : '');}
formData.append('amount',$this.data('quantity-amount') ? $this.data('quantity-amount') : '1');formData.append('multiProducts',multiProducts);$('input[type="file"]').each(function( index, upload ) {if ( upload.files.length > 0 ) {formData.append(upload.id,upload.files[0]);}});$.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/orders/front/addToCart.php",data: formData,cache: false,contentType: false,processData: false,success: function( response ) {response = tryParseJSON(response);showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&tranW='+websiteLanguageCountryFullCode+'&moduleID='+$this.data('module'),true);CartCounter.updateCartIcon();S123.ButtonLoading.stop($this);$this.removeAttr('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});});};AO.initializeShowCart = function() {$('.orderOpenCart').off('click').on('click',function( event ) {AO.showCart();});};AO.showCart = function() {showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&moduleTypeNUM=37&tranW='+websiteLanguageCountryFullCode+'&cartButton=1',true);};AO.atcValidator = function() {var $ct = $("#product-custom-text");var $po = $('.product-options');if ( $ct.length !== 0 && $ct.data('mandatory') ) {var $ct_fieldTitle = $('#ct_fieldTitle');if ( $ct_fieldTitle.val().length === 0 ) {$ct_fieldTitle.popover({container: 'body',content: translations.productvalidatorPopover,trigger: 'manual',template: '',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : ($('html').attr('dir') === 'rtl' ? 'left' : 'right');}});$ct_fieldTitle.popover('show').one('input', function(e) {$(this).popover('hide');});$ct_fieldTitle.focus();return false;}}
if ( $po.length !== 0 ) {var $options = $po.find('.p-o-container[data-mandatory="1"]');var addToCart = true;var $popoverContainer;var $firstErrorOption;var $errorsOptionsList = [];$.each($options, function( index, option ) {var $option = $(option);var addErrorMsg = false;switch( $option.data('type') ) {case 'color':case 'radio':case 'checkbox':case 'size':case 'list':if ( $option.find('[id*=poi].selected').length === 0 ) {addToCart = false;addErrorMsg = true;}
$popoverContainer = $(option);break;default:if ( $option.find('.fake-input').length > 0 ) {var id = $option.find('.fake-input').data('related-id');if ( $option.find('[data-id="'+id+'"]').val().length === 0 ) {addToCart = false;addErrorMsg = true;$popoverContainer = $(option).parent();}} else {if ( $option.find('.form-control').val().length === 0 ) {addToCart = false;addErrorMsg = true;$popoverContainer = $(option).parent();}}}
if ( addErrorMsg ) {$errorsOptionsList.push($option);var $popover = $option.find('.p-o-popover-box');if ( $popover.length === 0 ) $popover = $option;$popover.popover({container: 'body',content: translations.productvalidatorPopover,trigger: 'manual',template: '',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : ($('html').attr('dir') === 'rtl' ? 'right' : 'left');}});}});if ( $errorsOptionsList.length !== 0 ) {var offset = $('#mainNav').outerHeight();if ( !$.isNumeric(offset) ) offset = 0;if ( !elementInViewport($errorsOptionsList[0].get(0)) ) {$('html, body').scrollTop($errorsOptionsList[0].offset().top - offset);}
$.each($errorsOptionsList, function( index, $option ) {var $popover = $option.find('.p-o-popover-box');if ( $popover.length === 0 ) $popover = $option;$popover.popover('show');});$po.off('po.update').on('po.update', function( event ) {$('.product-validator-popover').popover('hide');});}
return addToCart;}
return true;};AO.productCallToAction = function() {var _ = {};_.init = function( settings ) {_.$controllers = $('.orderButtonPopup[data-p-c-t-a]');if ( _.$controllers.length == 0 ) return;_.$controllers.each(function() {var $this = $(this);var callToAction = $this.data('p-c-t-a');if ( callToAction.type == 'externalLink' && callToAction.externalLink.length > 0 ) {$this.off('click').on('click', function( event ) {window.open(callToAction.externalLink,'_blank');});} else if ( callToAction.type == 'contactUs' ) {$this.off('click').on('click', function( event ) {buildPopup('popupFloatDivSearch','',generateContactForm(callToAction),'',true,true,true,'right','')
S123.globalContactEmail.submitHandler();fillDescription(callToAction);});}});};function generateContactForm( callToAction ) {var html = '';html += '';return html;}
function fillDescription( callToAction ) {var pageURL = window.location.protocol+'//'+domain+callToAction.pageURL;
var html = '';html += '
';html += ''+translations.productCallToAction.productName+' ';html += ''+callToAction.title+'';$('#popupFloatDivSearch [name="emailForm_description"]').val(html);}
return _;}();return AO;}();var WishList = function() {var WL = {};WL.init = function( settings ) {$( document ).on( 's123.page.ready.wish_list', function( event ) {WL.websiteID = $('#websiteID').val();WL.$menuButton = $('.wishListActionButton');if ( WL.$menuButton.length === 0 ) return;WL.eventRecurring();WL.initilizeMenuButton();WL.initializeLayoutButtons();WL.initializeDataPageButtons();});};WL.markUnMarkIcons = function() {var $container = $('.s123-module-eCommerce');var $items = $container.find('.product-data-obj');var $icons = $items.find('.wish-list-btn');WL.items = tryParseJSON($.cookie(WL.websiteID+'-wishList'));if ( !WL.items || $container.length === 0 ) return;$icons.removeClass('wl-active');$.each(WL.items, function( index, item ) {$items.filter('.product-data-obj[data-unique-id="'+item.uniqueID+'"]').find('.wish-list-btn').addClass('wl-active');});if ( $container.hasClass('s123-page-data-eCommerce') ) {WL.setToolTip($container);}};WL.setToolTip = function( $container ) {var $wishListBtn = $container.find('.wish-list-btn');$wishListBtn.attr('data-original-title',$wishListBtn.data('add-tooltip'));$wishListBtn.filter('.wl-active').attr('data-original-title',$wishListBtn.data('remove-tooltip'));$wishListBtn.tooltip({container: 'body',placement: 'auto'});};WL.eventRecurring = function() {WL.markUnMarkIcons();WL.updateCounterIcon();};WL.refresh = function() {WL.eventRecurring();};WL.initilizeMenuButton = function() {if ( WL.$menuButton.length === 0 ) return;WL.$menuButton.off('click').on('click',function( event ) {var $this = $(this);showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&moduleTypeNUM=112&tranW='+websiteLanguageCountryFullCode+'&cartButton=1&wishList=true',true);});};WL.initializeLayoutButtons = function() {var $container = $('.s123-module-eCommerce:not(.s123-page-data-eCommerce)');if ( $container.length === 0 ) return;$container.find('.wish-list-btn').off('click.wishList').on('click.wishList',function( event ) {event.stopPropagation();var $this = $(this);var $wishListItem = $this.closest('.product-data-obj');if ( $this.hasClass('disabled') ) return false;if ( $this.hasClass('wl-active') ) {WL.removeItem($this,$wishListItem.data('module'),$wishListItem.data('module-type-num'),$wishListItem.data('unique-id'));} else {WL.addItem($this,$wishListItem.data('module'),$wishListItem.data('unique-id'));}});};WL.initializeDataPageButtons = function() {var $container = $('.s123-module-eCommerce.s123-page-data-eCommerce');if ( $container.length === 0 ) return;$container.find('.wish-list-btn').off('click.wishList').on('click.wishList', function( event ) {var $this = $(this);var $wishListItem = $this.closest('.product-data-obj');if ( $this.hasClass('disabled') ) return false;if ( $this.hasClass('wl-active') ) {WL.removeItem($this,$wishListItem.data('module'),$wishListItem.data('module-type-num'),$wishListItem.data('unique-id'));} else {WL.addItem($this,$wishListItem.data('module'),$wishListItem.data('unique-id'));}});};WL.addItem = function( $item , moduleID, uniqueID ) {$item.addClass('disabled');$.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/orders/front/addToCart.php",data: {w: $('#w').val(),websiteID: WL.websiteID,moduleID: moduleID,wishList: true,multiProducts: JSON.stringify(Array(uniqueID)),},success: function( response ) {response = tryParseJSON(response);showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&tranW='+websiteLanguageCountryFullCode+'&moduleID='+moduleID+'&wishList=true',true);WishList.eventRecurring();$item.removeClass('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});};WL.removeItem = function( $item, moduleID, moduleTypeNUM, uniqueID ) {$item.addClass('disabled');$.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/orders/front/removeCartItem.php",data: {w: $('#w').val(),websiteID: WL.websiteID,moduleID: moduleID,id: WL.items[uniqueID].id,uniqueID: uniqueID,wishList: true,cartType: moduleTypeNUM,tranW: websiteLanguageCountryFullCode},success: function( response ) {var response = JSON.parse(response);if ( !response.success ) return;WishList.eventRecurring();$item.removeClass('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});};WL.updateCounterIcon = function() {var $headerWishListWrapper = $('.header-wish-list');if ( $headerWishListWrapper.length === 0 ) return;var itemsNumber = WL.items ? Object.keys(WL.items).length : 0 ;if ( parseInt(itemsNumber) === 0 ) {if ( !$headerWishListWrapper.hasClass('show-static') ) {$headerWishListWrapper.hide();ResetMoreButton();}
$headerWishListWrapper.find('.count').hide();} else {if ( !$headerWishListWrapper.hasClass('show-static') ) {$headerWishListWrapper.show();ResetMoreButton();}
$headerWishListWrapper.find('.count').html(itemsNumber).css({ display: 'flex' });}};return WL;}();function showCart_GetContent( url, bsp ) {var window_object = S123.isWebsiteInSlidingWindow ? parent : window;var b_s_p = window_object.buildSmallPopup;$.ajax({type: "GET",url: url,success: function( response ) {if ( bsp ) {b_s_p('popupCart',translations.cart,response,'',true,false,true,'');} else {$('#popupCart .content').html(response);}
showCart(window_object);}});}
function showCart( current_window ) {var $cartOrderPage = current_window.$('#popupCart').find('.content');init();function init() {eventRecurring();if ( $.isArray(topWindow.eCommerce_cart_lastAdded) ) {$.each(topWindow.eCommerce_cart_lastAdded, function( index, cart_id ) {$cartOrderPage.find('[data-cart-id="'+cart_id+'"]').addClass('last-added-highlight');});topWindow.eCommerce_cart_lastAdded = false;}}
function eventRecurring() {current_window.CartCounter.updateCartIcon();var aop_settings = tryParseJSON($cartOrderPage.find('#aopSettings').val());$cartOrderPage.height('auto');$cartOrderPage.find('.quickCart').height($cartOrderPage.height());$cartOrderPage.find('.empty-cart-btn').off('click').on('click','a.empty-cart', function() {$.ajax({type: "GET",url: $(this).data('href')+'&wishList='+aop_settings.wishList,success: function( data ) {$cartOrderPage.closest('#popupCart .content').html(data);eventRecurring();showCart_UpdateCartWasChanged();}});});$cartOrderPage.find('.change-cart').on('click', function() {$.ajax({type: "GET",url: $(this).data('href'),success: function( data ) {$cartOrderPage.closest('#popupCart .content').html(data);eventRecurring();}});});$cartOrderPage.find('.continue-shopping-btn, .closeIcon').click(function() {current_window.buildSmallPopup_CloseAction('popupCart');});$cartOrderPage.find('.edit-quantity').on('click',function() {var $this = $(this);$cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'').toggle();});$cartOrderPage.find('.edit-quantity-minus').on('click',function() {var $this = $(this);var $box = $cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'');$box.find('.quantity_field').val(parseInt($box.find('.quantity_field').val())-1).trigger('input');updateAutomaticCouponMsg();});$cartOrderPage.find('.edit-quantity-plus').on('click',function() {var $this = $(this);var $box = $cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'');$box.find('.quantity_field').val(parseInt($box.find('.quantity_field').val())+1).trigger('input');updateAutomaticCouponMsg();});function updateAutomaticCouponMsg() {$.ajax({type: 'POST',url: '/versions/' + $('#versionNUM').val() + '/wizard/orders/front/getAutomaticCouponMsg.php',data: {w: $('#w').val(),websiteID: $(websiteID).val(),total: $('#cartTotalPrice span[data-type="price"]').html(),cartType: $('.cartBottom').data('cart-type'),couponApplyTo: 'cartOrder',},success: function( response ) {$('.cart-automatic-coupon-container').html('').append(response);showCart_FixCartContentHeight();}});}
$cartOrderPage.find('.quantity_field').on('input', function() {var $input = $(this);if ( $input.val().length === 0 ) $input.val(1);if ( !$.isNumeric($input.val()) ) $input.val($input.val().replace(/[^0-9]/g,''));if ( $input.val() <= 0 ) $input.val(1);if ( parseInt($input.val()) > parseInt($input.data('inventory-limit')) ) {$input.val($input.data('inventory-limit'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimit.replace('{{units_limitation}}',$input.data('inventory-limit')));} else if ( parseInt($input.val()) > parseInt($input.data('maximum-purchase')) ) {$input.val($input.data('maximum-purchase'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimit.replace('{{units_limitation}}',$input.data('maximum-purchase')));} else if ( parseInt($input.val()) < parseInt($input.data('minimum-purchase')) ) {$input.val($input.data('minimum-purchase'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimitMin.replace('{{units_limitation}}',$input.data('minimum-purchase')));}
showCart_UpdateQuantityTotalPrice();clearTimeout(window.quantityInputFinished);window.quantityInputFinished = setTimeout( function() {$cartOrderPage.find('#q_u_loading_'+$input.data('product-id')).show();$.ajax({type: 'POST',url: '/versions/' + aop_settings.versionNUM + '/wizard/orders/front/quantityUpdate.php',data: {w: aop_settings.w,websiteID: aop_settings.websiteID,tranW: aop_settings.tranW,moduleID: aop_settings.moduleID,cartType: aop_settings.cartType,id: $input.data('product-id'),newQuantity: $input.val()},success: function( response ) {var response = JSON.parse(response);if ( response.success ) {$cartOrderPage.find('#q_u_loading_'+$input.data('product-id')).hide();current_window.CartCounter.updateCartIcon();showCart_UpdateCartWasChanged();}}});},300);});$cartOrderPage.find('.remove-product-btn').off('click').on('click', function() {var $this = $(this);$this.parent().children().hide();$this.parent().append(''+S123.s123IconToSvg.getHtml('spinner','fa-spin','')+'
');$.ajax({type: 'POST',url: '/versions/' + aop_settings.versionNUM + '/wizard/orders/front/removeCartItem.php',data: {id: $this.data('product-id'),uniqueID: $this.closest('.item').get(0).id,w: aop_settings.w,websiteID: aop_settings.websiteID,tranW: aop_settings.tranW,moduleID: aop_settings.moduleID,cartType: aop_settings.cartType,wishList: aop_settings.wishList},success: function( response ) {var response = tryParseJSON(response);if ( response.success ) {if ( $this.closest('.item').siblings().not('.mix-modules-products-buttons').length == 0 ) {$cartOrderPage.find('.cart-list-container').hide();$cartOrderPage.find('.empty-cart-container').show();}
$this.closest('.item').fadeOut(300,function() {$this.closest('.item').remove();showCart_UpdateQuantityTotalPrice();if ( aop_settings.wishList ) {WishList.markUnMarkIcons();WishList.updateCounterIcon();}
showCart_UpdateCartWasChanged();updateAutomaticCouponMsg();});} else {$cartOrderPage.find('.r-p-loading').remove();$this.show();showCart_UpdateQuantityTotalPrice();}
current_window.CartCounter.updateCartIcon();},error: function(data) {$cartOrderPage.find('.r-p-loading').remove();$this.show();}});});$cartOrderPage.find('#couponWebsite').validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: ":hidden",highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();},errorPlacement: function (error, element) {if( element.is('input[type=checkbox]') || element.is('input[type=radio]') ) {var controls = element.closest('div[class*="col-"]');if( controls.find(':checkbox,:radio').length > 1 ) controls.append(error);else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));}
else if( element.is('.select2') ) {error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));}
else if( element.is('.chosen-select') ) {error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));}
else {error.appendTo(element.closest('.form-group'));}},submitHandler: function( form ) {$(form).find('button:submit').prop('disabled', true);return true;}});if ( aop_settings.foodDeliveryCart ) {foodDeliveryEditProductEvent($cartOrderPage);}
if ( isMobileDevice.any() ) {adaptCartHeightOnMobile(aop_settings.wishList);}
if ( $('html.onlyContent123').length > 0 ) {window.parent.$(window.parent.document).trigger('pageLoaded');} else {$(document).trigger('pageLoaded');}
if ( window.location.pathname == '/-order1/' ) {$(document).off('order1.reload').on('order1.reload', function(){if ( typeof window.isCartWasChanged != 'undefined' ) {delete window.isCartWasChanged;window.location.reload();}});}
showCart_FixCartContentHeight();}
function adaptCartHeightOnMobile( isWishList ) {var offset = isWishList ? '65px' : '280px';$(window).off('resize.touch_device_scrolling').on('resize.touch_device_scrolling',function() {$cartOrderPage.find('.cartList').attr('style','height: calc('+window.innerHeight+'px - '+offset+');');})
.trigger('resize.touch_device_scrolling');$cartOrderPage.find('.continue-shopping-btn, .closeIcon').click(function() {$(window).off('resize.touch_device_scrolling');});}
function showCart_QuantityPopover( $input, message ) {$input.popover({container: $cartOrderPage,content: message,trigger: 'manual',template: '',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : 'bottom';}});$input.popover('show');clearTimeout($input.data('q-p-timeout'));$input.data('q-p-timeout',setTimeout(function(){$input.popover('destroy');},3000));}
function showCart_UpdateQuantityTotalPrice() {var cartTotal = 0.00;$cartOrderPage.find('.quantity_field').each(function() {var $quantityInput = $(this);var $info = $quantityInput.closest('.cart-product-info');var $priceBox = $info.find('.cart-product-price');var $price = $info.find('.cart-product-price [data-type="price"]');var $quantityPrice = $info.find('.quantity-total-price');var $fullPrice = $info.find('.cart-product-full-price [data-type="price"]');var $quantityFullPrice = $info.find('.quantity-total-full-price');var total = (parseFloat($price.closest('[data-price]').data('price')) * parseInt($quantityInput.val()));var totalFullPrice = (parseFloat($fullPrice.closest('[data-price]').data('price')) * parseInt($quantityInput.val()));cartTotal += parseFloat(total);$quantityPrice.find('.main_price [data-type="price"]').html(total.toFixed(2));$quantityFullPrice.find('.main_price [data-type="price"]').html(totalFullPrice.toFixed(2));if (parseInt($quantityInput.val()) > 1) {$quantityPrice.show();$priceBox.hide();} else {$quantityPrice.hide();$priceBox.show();}
$info.find('.cart-product-quantity .qty_count').html($quantityInput.val());$(document).trigger('multi_currencies_price_update',[[{el: $quantityPrice.find('.main_price'),newPrice: total.toFixed(2)}]]);});$cartOrderPage.find('#cartTotalPrice [data-type="price"]').html(cartTotal.toFixed(2));$(document).trigger('multi_currencies_price_update',[[{el: $cartOrderPage.find('#cartTotalPrice'),newPrice: cartTotal.toFixed(2)}]]);}
function showCart_FixCartContentHeight() {var space = $cartOrderPage.find('.quickCart .header').outerHeight() + $cartOrderPage.find('.quickCart .cartBottom').outerHeight();$cartOrderPage.find('.quickCart .cartList').css('height','calc(100vh - '+space+'px)');}
function showCart_UpdateCartWasChanged() {window.isCartWasChanged = window.location.pathname == '/-order1/';}}function Comments_Initialize( settings ) {var that = this;var $s123CommentsContainer = $('#'+settings.id);var $commentsForm = $s123CommentsContainer.find('.commentsForm');var $commentsContainer;var Rating = {};var submitMessage = {};var hasRating = false;that.onLoad = settings.onLoad;that.onFormSubmit = settings.onFormSubmit;that.customLabels = settings.customLabels ? settings.customLabels : {};switch( settings.type ) {case 0:$commentsContainer = $s123CommentsContainer.find('#commentsContainer');submitMessage.title = translations.sent;submitMessage.message = translations.blogReviewMessage;break;case 1:$commentsContainer = $s123CommentsContainer.find('#commentsContainer');hasRating = true;break;default:return;break;}
that.init = function() {that.loadComments(false);};that.showSubcomments = function ( subComments, $commentsContainer ) {$.each(subComments,function( index, comment ) {var $parentComments = $commentsContainer.find('.commentBox');$.each($parentComments,function( index, parentComment ) {if ($(this).data('comment-id') == comment.parentID ) {$(parentComment).find('.sub-comments-div').append(that.comment_HTML(comment.title,comment.time,comment.message));}});});};that.comment_HTML = function ( title, time, message ) {var html ='';html += '';return html;};that.submitHandler = function ( $form ) {var forms_GoogleRecaptcha = new Forms_GoogleRecaptcha();forms_GoogleRecaptcha.init($form);$form.validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: "",highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();}});$form.off('submit.commentsForm').off('submit.commentsForm').on('submit.commentsForm', function( event ) {event.preventDefault();if ( hasRating ) {var formValid = $form.valid();var ratingValid = Rating.valid();if ( !formValid || !ratingValid ) return;} else {if ( !$form.valid() ) return;}
if ( forms_GoogleRecaptcha.isActive && !forms_GoogleRecaptcha.isGotToken ) {forms_GoogleRecaptcha.getToken();return false;}
$form.find('.blogSubmitButton').prop('disabled', true);$form.find('.blogSubmitButton').html(S123.s123IconToSvg.getHtml('spinner','fa-spin',''));$.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/comments/addShowComments.php",data: $form.serialize(),success: function( data ) {var dataObj = tryParseJSON(data);if ( dataObj.blockComment == '1' ) {that.showManagerApproveMessage();}
that.loadComments(data.commentsHtml);$form.trigger('reset');forms_GoogleRecaptcha.reset();$form.find('.blogSubmitButton').prop('disabled', false);$form.find('.blogSubmitButton').html($form.find('.blogSubmitButton').data('text'));WizardNotificationUpdate();if ( that.onFormSubmit ) that.onFormSubmit.call(this,dataObj.newCommentID,dataObj.blockComment);}});return false;});};that.showManagerApproveMessage = function () {if ( !submitMessage.message ) return;bootbox.alert({title: submitMessage.title,message: submitMessage.message,className: 'contactUsConfirm',buttons: {ok: {label: translations.Ok}},backdrop: true});};that.showReplyModal = function (t,childForm) {var x = '';x += '';childForm.html(x);that.submitHandler(childForm.find('form'));};Rating = new function() {var R = this;R.init = function( settings ) {if ( !settings.hasRating ) return;R.$form = settings.$form;R.$input = settings.$input;R.$json = settings.$json;if ( R.$form.length === 0 ) return;R.$raty = R.$form.find('.rating-plugin');R.$raty.raty({starType: 'i',cancel: false,number: 5,hints: R.getHints(),starHalf: (IsIE11() ? 'fa fa-star-half star-half' : 'star-half svg-m'),starOff: (IsIE11() ? 'fa fa-star-o star-o' : 'star-o svg-m'),starOn: (IsIE11() ? 'fa fa-star star' : 'star svg-m'),click: function( rating ,event ) {R.$input.val(rating);R.valid();}});};R.getHints = function() {var json = tryParseJSON(R.$json.val());if ( !json ) {return hints = [translations.reviewBad,translations.reviewPoor,translations.reviewRegular,translations.reviewGood,translations.reviewGorgeous];} else {return hints = json.hints;}};R.valid = function() {var valid = $.isNumeric(R.$input.val()) && parseInt(R.$input.val()) > 0;var $parent = R.$raty.closest('.form-group');$parent.removeClass('.has-error');$parent.find('#ratingError').remove();if ( !valid ) {$parent.addClass('has-error');$parent.append(''+R.$raty.data('msg-required')+'
');}
return valid;};};that.loadComments = function( commentsHtml ) {if ( !commentsHtml ) {loadCommentsByAjax();} else {addCommentsToPage(commentsHtml);}
$commentsForm.find('.blogCommentsBox #comment_message').focus(function() {$commentsForm.find('.blogCommentsBox').addClass('active');});that.submitHandler($commentsForm);Rating.init({$form: $commentsForm,$input: $commentsForm.find('.rating'),$json: $commentsForm.find('.rating-plugin-data'),hasRating: hasRating});};function loadCommentsByAjax() {$.ajax({type: "POST",url: '/versions/'+$('#versionNUM').val()+'/wizard/comments/addShowComments.php',data: {w: $('#w').val(),websiteID: $('#websiteID').val(),disableCssFiles: 1,moduleID: $commentsContainer.data('module-id'),moduleTypeNUM: $commentsContainer.data('module-type-num'),uniquePageID: $commentsContainer.data('unique-page-id'),tranW: $commentsContainer.data('tran-w'),act: $commentsContainer.data('action')},success: function( data ) {data = tryParseJSON(data);if ( !data ) return;addCommentsToPage(data.commentsHtml);}});}
function addCommentsToPage( commentsHtml ) {$commentsContainer.html(commentsHtml);$commentsContainer.find('.blog-reply-to').each(function( index, replyLink ) {$(replyLink).off('click').on('click',function() {$childForm = $(this).closest('.commentBox').find('.blogReplyForm');if ($childForm.hasClass('hidden')) {that.showReplyModal($(this),$childForm);$('.blogReplyForm').addClass('hidden');$('.blog-reply-to').html($(this).data('text-reply'));$(this).html($(this).data('text-hide'));$childForm.removeClass('hidden');} else {$childForm.addClass('hidden');$(this).html($(this).data('text-reply'));}
$childForm.find('.comment_message').select();});});var subComments = tryParseJSON($commentsContainer.find('.sub-comments').html());that.showSubcomments(subComments,$commentsContainer);if ( hasRating) {if ( that.onLoad ) that.onLoad.call(this,$commentsContainer.find('.commentBox').length,$commentsContainer.find('#reviewAvg').val(),false);}}
that.init();}!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof module&&module.exports?module.exports=t():e.matchesSelector=t()}(window,function(){"use strict";var e=function(){var e=window.Element.prototype;if(e.matches)return"matches";if(e.matchesSelector)return"matchesSelector";for(var t=["webkit","moz","ms","o"],o=0;o=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},r.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},r.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},t});
!function(t,e){"function"==typeof define&&define.amd?define(["./core","fizzy-ui-utils/utils"],function(i,o){return e(t,i,o)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){var o=e.prototype;return e.defaults.scrollThreshold=400,e.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);var t=this.options.scrollThreshold,e=t||0===t;e&&this.enableScrollWatch()},e.destroy.scrollWatch=function(){this.disableScrollWatch()},o.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},o.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},o.bindScrollWatchEvents=function(e){var i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.pageScrollHandler),t[i]("resize",this.resizeHandler)},o.onPageScroll=e.throttle(function(){var t=this.getBottomDistance();t<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")}),o.getBottomDistance=function(){return this.options.elementScroll?this.getElementBottomDistance():this.getWindowBottomDistance()},o.getWindowBottomDistance=function(){var e=this.top+this.element.clientHeight,i=t.pageYOffset+this.windowHeight;return e-i},o.getElementBottomDistance=function(){var t=this.scroller.scrollHeight,e=this.scroller.scrollTop+this.scroller.clientHeight;return t-e},o.onResize=function(){this.updateMeasurements()},i.debounceMethod(e,"onResize",150),e});
!function(t,e){"function"==typeof define&&define.amd?define(["./core","fizzy-ui-utils/utils"],function(o,i){return e(t,o,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,o){var i=e.prototype;e.defaults.history="replace";var s=document.createElement("a");return e.create.history=function(){if(this.options.history){s.href=this.getAbsolutePath();var t=s.origin||s.protocol+"//"+s.host,e=t==location.origin;return e?void(this.options.append?this.createHistoryAppend():this.createHistoryPageLoad()):void console.error("[InfiniteScroll] cannot set history with different origin: "+s.origin+" on "+location.origin+" . History behavior disabled.")}},i.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPageIndex=0,this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},i.bindHistoryAppendEvents=function(e){var o=e?"addEventListener":"removeEventListener";this.scroller[o]("scroll",this.scrollHistoryHandler),t[o]("unload",this.unloadHandler)},i.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},e.destroy.history=i.destroyHistory=function(){var t=this.options.history&&this.options.append;t&&this.bindHistoryAppendEvents(!1)},i.onAppendHistory=function(t,e,o){if(o&&o.length){var i=o[0],n=this.getElementScrollY(i);s.href=e,this.scrollPages.push({top:n,path:s.href,title:t.title})}},i.getElementScrollY=function(t){return this.options.elementScroll?this.getElementElementScrollY(t):this.getElementWindowScrollY(t)},i.getElementWindowScrollY=function(e){var o=e.getBoundingClientRect();return o.top+t.pageYOffset},i.getElementElementScrollY=function(t){return t.offsetTop-this.top},i.onScrollHistory=function(){for(var t,e,o=this.getScrollViewY(),i=0;i=o)break;t=i,e=s}t!=this.scrollPageIndex&&(this.scrollPageIndex=t,this.setHistory(e.title,e.path))},o.debounceMethod(e,"onScrollHistory",150),i.getScrollViewY=function(){return this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:t.pageYOffset+this.windowHeight/2},i.setHistory=function(t,e){var o=this.options.history,i=o&&history[o+"State"];i&&(history[o+"State"](null,t,e),this.options.historyTitle&&(document.title=t),this.dispatchEvent("history",null,[t,e]))},i.onUnload=function(){var e=this.scrollPageIndex;if(0!==e){var o=this.scrollPages[e],i=t.pageYOffset-o.top+this.top;this.destroyHistory(),scrollTo(0,i)}},i.onPageLoadHistory=function(t,e){this.setHistory(t.title,e)},e});
!function(t,s){"function"==typeof define&&define.amd?define(["./core","fizzy-ui-utils/utils"],function(e,i){return s(t,e,i)}):"object"==typeof module&&module.exports?module.exports=s(t,require("./core"),require("fizzy-ui-utils")):s(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,s,e){function i(t){o(t,"none")}function n(t){o(t,"block")}function o(t,s){t&&(t.style.display=s)}var u=s.prototype;return s.create.status=function(){var t=e.getQueryElement(this.options.status);t&&(this.statusElement=t,this.statusEventElements={request:t.querySelector(".infinite-scroll-request"),error:t.querySelector(".infinite-scroll-error"),last:t.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},u.bindHideStatus=function(t){var s=this.options.append?"append":"load";this[t](s,this.hideAllStatus)},u.showRequestStatus=function(){this.showStatus("request")},u.showErrorStatus=function(){this.showStatus("error")},u.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},u.showStatus=function(t){n(this.statusElement),this.hideStatusEventElements();var s=this.statusEventElements[t];n(s)},u.hideAllStatus=function(){i(this.statusElement),this.hideStatusEventElements()},u.hideStatusEventElements=function(){for(var t in this.statusEventElements){var s=this.statusEventElements[t];i(s)}},s});
!function(t,e){"function"==typeof define&&define.amd?define(["./core","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./core"),require("fizzy-ui-utils")):e(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,function(t,e,i){function n(t,e){this.element=t,this.infScroll=e,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),e.on("request",this.disable.bind(this)),e.on("load",this.enable.bind(this)),e.on("error",this.hide.bind(this)),e.on("last",this.hide.bind(this))}return e.create.button=function(){var t=i.getQueryElement(this.options.button);if(t)return void(this.button=new n(t,this))},e.destroy.button=function(){this.button&&this.button.destroy()},n.prototype.onClick=function(t){t.preventDefault(),this.infScroll.loadNextPage()},n.prototype.enable=function(){this.element.removeAttribute("disabled")},n.prototype.disable=function(){this.element.disabled="disabled"},n.prototype.hide=function(){this.element.style.display="none"},n.prototype.destroy=function(){this.element.removeEventListener("click",this.clickHandler)},e.Button=n,e});
!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e1&&o+t>this.cols;o=e?0:o;var h=i.size.outerWidth&&i.size.outerHeight;return this.horizontalColIndex=h?o+t:this.horizontalColIndex,{col:o,y:this._getColGroupY(o,t)}},e._manageStamp=function(t){var o=i(t),e=this._getElementOffset(t),h=this._getOption("originLeft"),n=h?e.left:e.right,s=n+o.outerWidth,r=Math.floor(n/this.columnWidth);r=Math.max(0,r);var a=Math.floor(s/this.columnWidth);a-=s%this.columnWidth?0:1,a=Math.min(this.cols-1,a);for(var u=this._getOption("originTop"),l=(u?e.top:e.bottom)+o.outerHeight,c=r;c<=a;c++)this.colYs[c]=Math.max(l,this.colYs[c])},e._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},e._getContainerFitWidth=function(){for(var t=0,i=this.cols;--i&&0===this.colYs[i];)t++;return(this.cols-t)*this.columnWidth-this.gutter},e.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},o});
!function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){"use strict";function i(t,e){for(var i in e)t[i]=e[i];return t}function o(t){if(Array.isArray(t))return t;var e="object"==typeof t&&"number"==typeof t.length;return e?d.call(t):[t]}function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);var s=t;return"string"==typeof t&&(s=document.querySelectorAll(t)),s?(this.elements=o(s),this.options=i({},this.options),"function"==typeof e?n=e:i(this.options,e),n&&this.on("always",n),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||t))}function n(t){this.img=t}function s(t,e){this.url=t,this.element=e,this.img=new Image}var h=t.jQuery,a=t.console,d=Array.prototype.slice;r.prototype=Object.create(e.prototype),r.prototype.options={},r.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},r.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&m[e]){for(var i=t.querySelectorAll("img"),o=0;o License'),i.textContent="",o.parentNode.insertBefore(n,o.nextSibling);for(var l=[],a=e.querySelectorAll("[data-license-property]"),c=0,s=a.length;c1?"s":"")+" loaded"})};
InfiniteScrollDocs["masonry-small"]=function(e){var t=e.querySelector(".scroller__content"),r=new Masonry(t,{itemSelector:".image-grid__item",columnWidth:".image-grid__col-sizer",gutter:".image-grid__gutter-sizer",percentPosition:!0,stagger:30,visibleStyle:{transform:"translateY(0)",opacity:1},hiddenStyle:{transform:"translateY(100px)",opacity:0}});imagesLoaded(t,function(){r.layout()}),new InfiniteScroll(t,{path:"demo/masonry/page{{#}}.html",append:".image-grid__item",checkLastPage:".pagination__next",outlayer:r,history:!1,elementScroll:e,status:e.querySelector(".scroller-status")})};
InfiniteScrollDocs["page-index"]=function(e){var t=e.querySelector(".scroller"),l=e.querySelector(".scroller__content"),o=e.querySelector(".demo-status"),n=new InfiniteScroll(l,{path:"demo/element-scroll/page{{#}}.html",append:".scroller-item",checkLastPage:".pagination__next",elementScroll:t,status:e.querySelector(".scroller-status"),history:!1});n.on("load",function(){o.textContent="Loaded page: "+this.pageIndex})};
InfiniteScrollDocs.prefill=function(e){function l(){new InfiniteScroll(r,{path:"demo/element-scroll/page{{#}}.html",append:".scroller-item",checkLastPage:".pagination__next",elementScroll:t,prefill:!0,status:e.querySelector(".scroller-status"),history:!1}),c.disabled="disabled",c.removeEventListener("click",l)}var t=e.querySelector(".scroller"),r=e.querySelector(".scroller__content"),c=e.querySelector(".button");c.addEventListener("click",l)};
InfiniteScrollDocs["scroll-2"]=function(e){function l(){1==n.loadCount&&(n.options.loadOnScroll=!1,t.style.display="inline-block",n.off(l))}var o=e.querySelector(".scroller__content"),t=e.querySelector(".view-more-button"),n=new InfiniteScroll(o,{path:"demo/element-scroll/page{{#}}.html",append:".scroller-item",checkLastPage:".pagination__next",elementScroll:e,button:t,status:e.querySelector(".scroller-status"),history:!1});n.on("load",l)};
InfiniteScrollDocs["scroll-threshold-option"]=function(e){var l=e.querySelector(".scroller__content");new InfiniteScroll(l,{path:"demo/element-scroll/page{{#}}.html",append:".scroller-item",checkLastPage:".pagination__next",elementScroll:e,status:e.querySelector(".scroller-status"),scrollThreshold:100,history:!1})};
InfiniteScrollDocs.status=function(e){var l=e.querySelector(".scroller__content");new InfiniteScroll(l,{path:"demo/element-scroll/page{{#}}.html",append:".scroller-item",checkLastPage:".pagination__next",elementScroll:e,status:e.querySelector(".scroller-status"),scrollThreshold:50,history:!1})};
InfiniteScrollDocs["image-grid"]=function(e){var i=new Masonry(e,{itemSelector:"none",columnWidth:".image-grid__col-sizer",gutter:".image-grid__gutter-sizer",percentPosition:!0,stagger:30,visibleStyle:{transform:"translateY(0)",opacity:1},hiddenStyle:{transform:"translateY(100px)",opacity:0}});imagesLoaded(e,function(){e.classList.remove("are-images-unloaded"),i.options.itemSelector=".image-grid__item";var t=e.querySelectorAll(".image-grid__item");i.appended(t)}),new InfiniteScroll(e,{path:".pagination__next",hideNav:".pagination",append:".image-grid__item",outlayer:i,status:".scroller-status",debug:!0})};
!function(){var t;InfiniteScrollDocs["page-nav"]=function(e){var i=e.querySelector(".page-nav__list"),n=getComputedStyle(e,":after").content,a=n.match("sticky");if(t&&a)return void(e.style.display="none");t=e;var c=i.clientHeight<=window.innerHeight;c&&a&&e.classList.add("is-sticky")}}();
InfiniteScrollDocs["site-scroll"]=function(n){function e(){i=new InfiniteScroll(".main .container",{path:function(){var n=c+this.loadCount,e=a[n];return e&&e+".html"},append:".main__page"}),i.on("append",t),i.loadNextPage(),o.style.display="none",o.removeEventListener("click",e)}function t(n,e,t){for(var i=0;i 0)) {node.state.expanded = true;}
else {node.state.expanded = false;}}
if (!node.state.hasOwnProperty('selected')) {node.state.selected = false;}
_this.nodes.push(node);if (node.nodes) {_this.setInitialStates(node, level);}});};Tree.prototype.clickHandler = function (event) {if (!this.options.enableLinks) event.preventDefault();var target = $(event.target);var node = this.findNode(target);if (!node || node.state.disabled) return;var classList = target.attr('class') ? target.attr('class').split(' ') : [];if ((classList.indexOf('expand-icon') !== -1)) {this.toggleExpandedState(node, _default.options);this.render();}
else if ((classList.indexOf('check-icon') !== -1)) {this.toggleCheckedState(node, _default.options);this.render();}
else {if (node.selectable) {this.toggleSelectedState(node, _default.options);} else {this.toggleExpandedState(node, _default.options);}
this.render();}};Tree.prototype.findNode = function (target) {var nodeId = target.closest('li.list-group-item').attr('data-nodeid');var node = this.nodes[nodeId];if (!node) {console.log('Error: node does not exist');}
return node;};Tree.prototype.toggleExpandedState = function (node, options) {if (!node) return;this.setExpandedState(node, !node.state.expanded, options);};Tree.prototype.setExpandedState = function (node, state, options) {if (state === node.state.expanded) return;if (state && node.nodes) {node.state.expanded = true;if (!options.silent) {this.$element.trigger('nodeExpanded', $.extend(true, {}, node));}}
else if (!state) {node.state.expanded = false;if (!options.silent) {this.$element.trigger('nodeCollapsed', $.extend(true, {}, node));}
if (node.nodes && !options.ignoreChildren) {$.each(node.nodes, $.proxy(function (index, node) {this.setExpandedState(node, false, options);}, this));}}};Tree.prototype.toggleSelectedState = function (node, options) {if (!node) return;this.setSelectedState(node, !node.state.selected, options);};Tree.prototype.setSelectedState = function (node, state, options) {if (state === node.state.selected) return;if (state) {if (!this.options.multiSelect) {$.each(this.findNodes('true', 'g', 'state.selected'), $.proxy(function (index, node) {this.setSelectedState(node, false, options);}, this));}
node.state.selected = true;if (!options.silent) {this.$element.trigger('nodeSelected', $.extend(true, {}, node));}}
else {node.state.selected = false;if (!options.silent) {this.$element.trigger('nodeUnselected', $.extend(true, {}, node));}}};Tree.prototype.toggleCheckedState = function (node, options) {if (!node) return;this.setCheckedState(node, !node.state.checked, options);};Tree.prototype.setCheckedState = function (node, state, options) {if (state === node.state.checked) return;if (state) {node.state.checked = true;if (!options.silent) {this.$element.trigger('nodeChecked', $.extend(true, {}, node));}}
else {node.state.checked = false;if (!options.silent) {this.$element.trigger('nodeUnchecked', $.extend(true, {}, node));}}};Tree.prototype.setDisabledState = function (node, state, options) {if (state === node.state.disabled) return;if (state) {node.state.disabled = true;this.setExpandedState(node, false, options);this.setSelectedState(node, false, options);this.setCheckedState(node, false, options);if (!options.silent) {this.$element.trigger('nodeDisabled', $.extend(true, {}, node));}}
else {node.state.disabled = false;if (!options.silent) {this.$element.trigger('nodeEnabled', $.extend(true, {}, node));}}};Tree.prototype.render = function () {if (!this.initialized) {this.$element.addClass(pluginName);this.$wrapper = $(this.template.list);this.injectStyle();this.initialized = true;}
this.$element.empty().append(this.$wrapper.empty());this.buildTree(this.tree, 0);};Tree.prototype.buildTree = function (nodes, level) {if (!nodes) return;level += 1;var _this = this;$.each(nodes, function addNodes(id, node) {var treeItem = $(_this.template.item)
.addClass('node-' + _this.elementId)
.addClass(node.state.checked ? 'node-checked' : '')
.addClass(node.state.disabled ? 'node-disabled': '')
.addClass(node.state.selected ? 'node-selected' : '')
.addClass(node.searchResult ? 'search-result' : '')
.attr('data-nodeid', node.nodeId)
.attr('style', _this.buildStyleOverride(node));for (var i = 0; i < (level - 1); i++) {treeItem.append(_this.template.indent);}
var classList = [];if (node.nodes) {classList.push('expand-icon');if (node.state.expanded) {classList.push(_this.options.collapseIcon);}
else {classList.push(_this.options.expandIcon);}}
else {classList.push(_this.options.emptyIcon);}
treeItem
.append($(_this.template.icon)
.addClass(classList.join(' ')));if (_this.options.showIcon) {var classList = ['node-icon'];classList.push(node.icon || _this.options.nodeIcon);if (node.state.selected) {classList.pop();classList.push(node.selectedIcon || _this.options.selectedIcon ||node.icon || _this.options.nodeIcon);}
treeItem
.append($(_this.template.icon)
.addClass(classList.join(' ')));}
if (_this.options.showCheckbox) {var classList = ['check-icon'];if (node.state.checked) {classList.push(_this.options.checkedIcon);}
else {classList.push(_this.options.uncheckedIcon);}
treeItem
.append($(_this.template.icon)
.addClass(classList.join(' ')));}
if (_this.options.enableLinks) {treeItem
.append($(_this.template.link)
.attr('href', node.href)
.append(node.text));}
else {treeItem
.append(node.text);}
if (_this.options.showTags && node.tags) {$.each(node.tags, function addTag(id, tag) {treeItem
.append($(_this.template.badge)
.append(tag));});}
_this.$wrapper.append(treeItem);if (node.nodes && node.state.expanded && !node.state.disabled) {return _this.buildTree(node.nodes, level);}});};Tree.prototype.buildStyleOverride = function (node) {if (node.state.disabled) return '';var color = node.color;var backColor = node.backColor;if (this.options.highlightSelected && node.state.selected) {if (this.options.selectedColor) {color = this.options.selectedColor;}
if (this.options.selectedBackColor) {backColor = this.options.selectedBackColor;}}
if (this.options.highlightSearchResults && node.searchResult && !node.state.disabled) {if (this.options.searchResultColor) {color = this.options.searchResultColor;}
if (this.options.searchResultBackColor) {backColor = this.options.searchResultBackColor;}}
return 'color:' + color +';background-color:' + backColor + ';';};Tree.prototype.injectStyle = function () {if (this.options.injectStyle && !document.getElementById(this.styleId)) {$('').appendTo('head');}};Tree.prototype.buildStyle = function () {var style = '.node-' + this.elementId + '{';if (this.options.color) {style += 'color:' + this.options.color + ';';}
if (this.options.backColor) {style += 'background-color:' + this.options.backColor + ';';}
if (!this.options.showBorder) {style += 'border:none;';}
else if (this.options.borderColor) {style += 'border:1px solid ' + this.options.borderColor + ';';}
style += '}';if (this.options.onhoverColor) {style += '.node-' + this.elementId + ':not(.node-disabled):hover{' +'background-color:' + this.options.onhoverColor + ';' +'}';}
return this.css + style;};Tree.prototype.template = {list: '',item: '',indent: '',icon: '',link: '',badge: ''};Tree.prototype.css = '.treeview .list-group-item{cursor:pointer}.treeview span.indent{margin-left:10px;margin-right:10px}.treeview span.icon{width:12px;margin-right:5px}.treeview .node-disabled{color:silver;cursor:not-allowed}'
Tree.prototype.getNode = function (nodeId) {return this.nodes[nodeId];};Tree.prototype.getParent = function (identifier) {var node = this.identifyNode(identifier);return this.nodes[node.parentId];};Tree.prototype.getSiblings = function (identifier) {var node = this.identifyNode(identifier);var parent = this.getParent(node);var nodes = parent ? parent.nodes : this.tree;return nodes.filter(function (obj) {return obj.nodeId !== node.nodeId;});};Tree.prototype.getSelected = function () {return this.findNodes('true', 'g', 'state.selected');};Tree.prototype.getUnselected = function () {return this.findNodes('false', 'g', 'state.selected');};Tree.prototype.getExpanded = function () {return this.findNodes('true', 'g', 'state.expanded');};Tree.prototype.getCollapsed = function () {return this.findNodes('false', 'g', 'state.expanded');};Tree.prototype.getChecked = function () {return this.findNodes('true', 'g', 'state.checked');};Tree.prototype.getUnchecked = function () {return this.findNodes('false', 'g', 'state.checked');};Tree.prototype.getDisabled = function () {return this.findNodes('true', 'g', 'state.disabled');};Tree.prototype.getEnabled = function () {return this.findNodes('false', 'g', 'state.disabled');};Tree.prototype.selectNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setSelectedState(node, true, options);}, this));this.render();};Tree.prototype.unselectNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setSelectedState(node, false, options);}, this));this.render();};Tree.prototype.toggleNodeSelected = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.toggleSelectedState(node, options);}, this));this.render();};Tree.prototype.collapseAll = function (options) {var identifiers = this.findNodes('true', 'g', 'state.expanded');this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setExpandedState(node, false, options);}, this));this.render();};Tree.prototype.collapseNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setExpandedState(node, false, options);}, this));this.render();};Tree.prototype.expandAll = function (options) {options = $.extend({}, _default.options, options);if (options && options.levels) {this.expandLevels(this.tree, options.levels, options);}
else {var identifiers = this.findNodes('false', 'g', 'state.expanded');this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setExpandedState(node, true, options);}, this));}
this.render();};Tree.prototype.expandNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setExpandedState(node, true, options);if (node.nodes && (options && options.levels)) {this.expandLevels(node.nodes, options.levels-1, options);}}, this));this.render();};Tree.prototype.expandLevels = function (nodes, level, options) {options = $.extend({}, _default.options, options);$.each(nodes, $.proxy(function (index, node) {this.setExpandedState(node, (level > 0) ? true : false, options);if (node.nodes) {this.expandLevels(node.nodes, level-1, options);}}, this));};Tree.prototype.revealNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {var parentNode = this.getParent(node);while (parentNode) {this.setExpandedState(parentNode, true, options);parentNode = this.getParent(parentNode);};}, this));this.render();};Tree.prototype.toggleNodeExpanded = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.toggleExpandedState(node, options);}, this));this.render();};Tree.prototype.checkAll = function (options) {var identifiers = this.findNodes('false', 'g', 'state.checked');this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setCheckedState(node, true, options);}, this));this.render();};Tree.prototype.checkNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setCheckedState(node, true, options);}, this));this.render();};Tree.prototype.uncheckAll = function (options) {var identifiers = this.findNodes('true', 'g', 'state.checked');this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setCheckedState(node, false, options);}, this));this.render();};Tree.prototype.uncheckNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setCheckedState(node, false, options);}, this));this.render();};Tree.prototype.toggleNodeChecked = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.toggleCheckedState(node, options);}, this));this.render();};Tree.prototype.disableAll = function (options) {var identifiers = this.findNodes('false', 'g', 'state.disabled');this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setDisabledState(node, true, options);}, this));this.render();};Tree.prototype.disableNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setDisabledState(node, true, options);}, this));this.render();};Tree.prototype.enableAll = function (options) {var identifiers = this.findNodes('true', 'g', 'state.disabled');this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setDisabledState(node, false, options);}, this));this.render();};Tree.prototype.enableNode = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setDisabledState(node, false, options);}, this));this.render();};Tree.prototype.toggleNodeDisabled = function (identifiers, options) {this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) {this.setDisabledState(node, !node.state.disabled, options);}, this));this.render();};Tree.prototype.forEachIdentifier = function (identifiers, options, callback) {options = $.extend({}, _default.options, options);if (!(identifiers instanceof Array)) {identifiers = [identifiers];}
$.each(identifiers, $.proxy(function (index, identifier) {callback(this.identifyNode(identifier), options);}, this));};Tree.prototype.identifyNode = function (identifier) {return ((typeof identifier) === 'number') ?this.nodes[identifier] :identifier;};Tree.prototype.search = function (pattern, options) {options = $.extend({}, _default.searchOptions, options);this.clearSearch({ render: false });var results = [];if (pattern && pattern.length > 0) {if (options.exactMatch) {pattern = '^' + pattern + '$';}
var modifier = 'g';if (options.ignoreCase) {modifier += 'i';}
results = this.findNodes(pattern, modifier);$.each(results, function (index, node) {node.searchResult = true;})}
if (options.revealResults) {this.revealNode(results);}
else {this.render();}
this.$element.trigger('searchComplete', $.extend(true, {}, results));return results;};Tree.prototype.clearSearch = function (options) {options = $.extend({}, { render: true }, options);var results = $.each(this.findNodes('true', 'g', 'searchResult'), function (index, node) {node.searchResult = false;});if (options.render) {this.render();}
this.$element.trigger('searchCleared', $.extend(true, {}, results));};Tree.prototype.findNodes = function (pattern, modifier, attribute) {modifier = modifier || 'g';attribute = attribute || 'text';var _this = this;return $.grep(this.nodes, function (node) {var val = _this.getNodeValue(node, attribute);if (typeof val === 'string') {return val.match(new RegExp(pattern, modifier));}});};Tree.prototype.getNodeValue = function (obj, attr) {var index = attr.indexOf('.');if (index > 0) {var _obj = obj[attr.substring(0, index)];var _attr = attr.substring(index + 1, attr.length);return this.getNodeValue(_obj, _attr);}
else {if (obj.hasOwnProperty(attr)) {return obj[attr].toString();}
else {return undefined;}}};var logError = function (message) {if (window.console) {window.console.error(message);}};$.fn[pluginName] = function (options, args) {var result;this.each(function () {var _this = $.data(this, pluginName);if (typeof options === 'string') {if (!_this) {logError('Not initialized, can not call method : ' + options);}
else if (!$.isFunction(_this[options]) || options.charAt(0) === '_') {logError('No such method : ' + options);}
else {if (!(args instanceof Array)) {args = [ args ];}
result = _this[options].apply(_this, args);}}
else if (typeof options === 'boolean') {result = _this;}
else {$.data(this, pluginName, new Tree(this, $.extend(true, {}, options)));}});return result || this;};})(jQuery, window, document);var eCommerceFilterTool = new function() {var filter = this;this.init = function ( settings ) {if ( !settings ) return;$('.e-commerce-filter-container').empty();filter.productsContainerSelector = '.products-container';filter.container = $('.e-commerce-filter-container');filter.$scrollTo = $('.s123-module-eCommerce');filter.isActive = settings.isActive;filter.products = settings.products;filter.currency = settings.currency;filter.filteredProducts = false;filter.translations = settings.translations;filter.deviceType = findBootstrapEnvironment() === 'xs' ? 'mobile' : 'pc';filter.w = settings.w;filter.websiteID = settings.websiteID;filter.type = settings.type;filter.uniquePageID = settings.uniquePageID;filter.filterCombinations = {};filter.eCommerceSearch = settings.eCommerceSearch;if ( !filter.isActive || !filter.container ) return;filter.brands = settings.brands;filter.price = settings.price;filter.pOptions = settings.pOptions;filter.pAttributes = settings.pAttributes;filter.ribbons = settings.ribbons;filter.addFilterTool();if ( filter.deviceType == 'pc' ) {filter.container.css({'display': 'flex', 'flex-direction': 'column'});var $allFilterBoxes = filter.container.find('.filter-options');$.each($allFilterBoxes, function( index, box ) {var $box = $(box);if ( $box.data('def-state') === 'opened') {$box.find('filter-option-content').addClass('expanded');filter.closeOpenBox($box.find('.expand-filter'),0);}});}
filter.addShowFilterMobileBtn();filter.mobileFilterBtnResponsiveHandler();filter.initialized = true;};this.mobileFilterBtnResponsiveHandler = function() {$(window).one('resize.eCommerceFilterToolMobileFilter', function( event ) {filter.adaptToScreenSize();setTimeout( function() {filter.mobileFilterBtnResponsiveHandler();},500);});}
this.adaptToScreenSize = function() {if ( $(window).width() > 767 ) {filter.container.css({display: 'flex',flexDirection: 'column'});if ( filter.containerParent ) filter.containerParent.append(filter.container);$('#ecommerceFilterMenuPopup').remove();} else {if ( filter.containerParent ) return;filter.container.css({display: 'none',flexDirection: ''});}};this.getBoxStateFromCookie = function( id ) {var eCommerceFilterBoxState = tryParseJSON($.cookie(filter.websiteID+'_eCommerceFilterBoxState'));if ( !eCommerceFilterBoxState ) return false;if ( !eCommerceFilterBoxState[id] ) return false;return eCommerceFilterBoxState[id].state;};this.saveBoxesStateToCookie = function() {var eCommerceFilterBoxState = {};var $allFilterBoxes = filter.container.find('.filter-options');$.each($allFilterBoxes, function( index, box ) {var $box = $(box);eCommerceFilterBoxState[$box.data('id')] = {state: $box.find('.filter-option-content.expanded').length ? 'opened' : 'closed'}});$.cookie(filter.websiteID+'_eCommerceFilterBoxState',JSON.stringify(eCommerceFilterBoxState),{ expires: 1, path: '/' });};this.addShowFilterMobileBtn = function() {var $mobileBtnContainer = $('');$mobileBtnContainer.insertBefore(filter.container);filter.$mobileBtn = $mobileBtnContainer.find('.mobile-filter-btn');filter.$mobileBtn.on('click', function() {var $customCover = $('');var $ecommerceFilterMenuPopup = $('#ecommerceFilterMenuPopup');if ( $ecommerceFilterMenuPopup.length == 0 ) {filter.containerParent = filter.container.parent();buildPopup('ecommerceFilterMenuPopup','','','',true,true,true,'');$ecommerceFilterMenuPopup = $('#ecommerceFilterMenuPopup');$ecommerceFilterMenuPopup.find('.page').append(filter.container);$ecommerceFilterMenuPopup.append($customCover);filter.container.css({'display': 'flex', 'flex-direction': 'column'});$ecommerceFilterMenuPopup.find('.popupCloseButton').off('click').on('click', function() {$ecommerceFilterMenuPopup.removeClass('open');});$customCover.on('click', function() {$ecommerceFilterMenuPopup.removeClass('open');});$ecommerceFilterMenuPopup.find('.cover').off('click').on('click', function() {$ecommerceFilterMenuPopup.removeClass('open');});} else {$ecommerceFilterMenuPopup.addClass('open');}});};this.addFilterTool = function() {filter.addTagsContainer();filter.addPriceFilter();filter.addBrandsFilter();filter.addProductOptionsFilter();filter.addProductAttributesFilter();filter.addRibbonsFilter();filter.resetProductsCounter();filter.addExpandBoxEvent();};this.addTagsContainer = function() {var html = '';html = '';filter.container.append(html);filter.$tags = filter.container.find('.filter-tags-container .tags');};this.floorCeilPrice = function( number ) {var ceil = (Math.ceil(number / 10) * 10);var complete = ceil - number;if ( complete > 5 ) {number = Math.floor(number / 10) * 10;} else if ( complete < 5 ) {number = Math.ceil(number / 10) * 10;} else {number = number;}
return number;};this.addPriceFilter = function() {if ( !filter.price.active ) return;var rangeIncrease = filter.price.rangeIncrease;var range = filter.floorCeilPrice((parseFloat(filter.price.min) + rangeIncrease));var template = filter.getFilterBoxTemplate();var defState = filter.getBoxStateFromCookie('price');var html = '';filter.price.max = (Math.ceil(filter.price.max / 10) * 10);if ( rangeIncrease > 0 ) {template = template.replace('{{place}}',filter.price.place);template = template.replace('{{title}}',filter.translations.priceTitle);template = template.replace('{{class}}','filter-type-price');template = template.replace('{{type}}','price');template = template.replace('{{id}}','price');template = template.replace('{{defState}}',(defState ? defState : filter.price.filterBoxState));html += '';for ( var i = 1; i <= (filter.price.ranges-2); i++, range += rangeIncrease ) {range = filter.floorCeilPrice(range);html += '';}
range = filter.floorCeilPrice(range);html += '';html += '';template = template.replace('{{content}}',html);filter.container.append(template);filter.addPriceEvent();}};this.addBrandsFilter = function() {if ( !filter.brands.active ) return;var template = filter.getFilterBoxTemplate();var defState = filter.getBoxStateFromCookie('brands-system-id');var html = '';template = template.replace('{{place}}',(parseInt(filter.brands.place)));template = template.replace('{{title}}',filter.translations.brandsTitle);template = template.replace('{{class}}','filter-type-brands');template = template.replace('{{type}}','brand');template = template.replace('{{id}}','brands-system-id');template = template.replace('{{defState}}',(defState ? defState : filter.brands.filterBoxState));$.each(filter.brands.values, function( index, brand ) {brand.allSettings = JSON.parse(brand.allSettings);var obj = {title : brand.allSettings.title,value : index,dataAttr: 'data-type="brand" data-unique-id="' + escapeHtml(index) + '" data-parent-unique-id="brands-system-id"'}
html += filter.generateCheckBox(obj);html = html.replace('{{placeStyle}}','style="order:' + escapeHtml(brand.place) + '";');});template = template.replace('{{content}}',html);filter.container.append(template);filter.addCheckBoxEvent();};this.addProductOptionsFilter = function() {if ( !filter.pOptions.active ) return;$.each(filter.pOptions.options, function( index, po ) {var template = filter.getFilterBoxTemplate();var defState = filter.getBoxStateFromCookie(po.id);var html = '';template = template.replace('{{place}}',(parseInt(po.place)));template = template.replace('{{title}}',po.title);template = template.replace('{{class}}','filter-type-options');template = template.replace('{{type}}',po.type);template = template.replace('{{id}}',escapeHtml(po.id));template = template.replace('{{defState}}',(defState ? defState : po.filterBoxState));$.each(po.items, function( index, item ) {if ( po.type == 'color' ) {var obj = {title : item.title,value : item.color,dataAttr: 'data-type="' + escapeHtml(po.type) + '" data-unique-id="' + escapeHtml(item.color) + '" data-parent-unique-id="' + escapeHtml(po.id) + '"'}
html += filter.generateColor(obj);} else {var obj = {title : item.title,value : item.id,dataAttr: 'data-type="' + escapeHtml(po.type) + '" data-unique-id="' + escapeHtml(item.id) + '" data-parent-unique-id="' + escapeHtml(po.id) + '"'}
html += filter.generateCheckBox(obj);html = html.replace('{{placeStyle}}','');}});template = template.replace('{{content}}',html);filter.container.append(template);});filter.container.find('.color').tooltip({container: '.e-commerce-filter-container',placement: 'top'});filter.addCheckBoxEvent();filter.addColorBoxEvent();};this.addProductAttributesFilter = function() {if ( !filter.pAttributes.active ) return;$.each(filter.pAttributes.attributes, function( index, attr ) {var template = filter.getFilterBoxTemplate();var defState = filter.getBoxStateFromCookie(attr.id);var html = '';template = template.replace('{{place}}',(parseInt(attr.place)));template = template.replace('{{title}}',attr.title);template = template.replace('{{class}}','filter-type-attributes');template = template.replace('{{type}}','attribute');template = template.replace('{{id}}',escapeHtml(attr.id));template = template.replace('{{defState}}',(defState ? defState : attr.filterBoxState));$.each(attr.values, function( index, value ) {var obj = {title : value.title,value : value.id,dataAttr: 'data-type="' + escapeHtml(attr.type) + '" data-unique-id="' + escapeHtml(value.id) + '" data-parent-unique-id="' + escapeHtml(attr.id) + '"'}
html += filter.generateCheckBox(obj);html = html.replace('{{placeStyle}}','');});template = template.replace('{{content}}',html);filter.container.append(template);});filter.addCheckBoxEvent();};this.addRibbonsFilter = function() {if ( !filter.ribbons.active ) return;var template = filter.getFilterBoxTemplate();var defState = filter.getBoxStateFromCookie('ribbonsObj-system-id');var html = '';template = template.replace('{{place}}',filter.ribbons.place);template = template.replace('{{title}}',filter.translations.ribbonsTitle);template = template.replace('{{class}}','filter-type-ribbons');template = template.replace('{{type}}','ribbon');template = template.replace('{{id}}','ribbonsObj-system-id');template = template.replace('{{defState}}',(defState ? defState : filter.ribbons.filterBoxState));$.each(filter.ribbons.values, function( index, ribbon ) {var obj = {title : ribbon.title,value : ribbon.id,dataAttr: 'data-type="ribbon" data-unique-id="' + escapeHtml(ribbon.id) + '" data-parent-unique-id="ribbonsObj-system-id"'}
html += filter.generateCheckBox(obj);html = html.replace('{{placeStyle}}','');});template = template.replace('{{content}}',html);filter.container.append(template);filter.addCheckBoxEvent();};this.resetProductsCounter = function() {var $counters = filter.container.find('.products-in-filter');var $filterOptions = filter.container.find('.filter-options');var products = filter.filteredProducts ? filter.filteredProducts : filter.products;$.each($counters, function( index, counter ) {var $this = $(this);$this.empty();var $parent = $(this).parent();switch( $parent.data('type') ) {case 'brand':var obj = {};obj.val = $parent.data('unique-id');break;case 'ribbon':var obj = {};obj.val = $parent.data('unique-id');break;case 'price':var obj = {};obj.min = $parent.data('min');obj.max = $parent.data('max');break;case 'color':var obj = {};obj.parentUniqueID = $this.data('parent-unique-id');obj.val = $this.data('unique-id');break;default :var obj = {};obj.parentUniqueID = $this.data('parent-unique-id');obj.val = $parent.data('unique-id');break;}
var result = filter.getProductByFilterType($parent.data('type'),obj,Array(),products);if ( $parent.data('type') === 'color' ) {var $color = $parent.find('.color');$color.attr('data-original-title', $color.data('title') + ' ('+result.length+')');filter.hideShowFilterOption($parent,$this,result.length);} else {filter.hideShowFilterOption($parent.parent(),$this,result.length);}});$.each($filterOptions, function( index, option ) {var $this = $(this);var $counters = $this.find('.products-in-filter');var $hiddenCounters = $counters.filter('[data-products-in-filter="0"]');if ( $counters.length === $hiddenCounters.length ) {$this.hide();} else {$this.show();}});filter.hideShowFilterSiblings();};this.hideShowFilterSiblings = function() {if ( filter.$tags.children('.tag').length === 0 ) {filter.container.siblings(':not(.m-f-b-container)').fadeIn(200);} else {filter.container.siblings(':not(.m-f-b-container)').fadeOut(200);}};this.hideShowFilterOption = function( $option, $counter, productsCounter ) {if ( productsCounter == 0 ) {$option.hide();$counter.append(' (' + productsCounter + ')');$counter.attr('data-products-in-filter',productsCounter);} else {$option.show();$counter.append(' (' + productsCounter + ')');$counter.attr('data-products-in-filter',productsCounter);}};this.generateColor = function( obj ) {var html = '';html += '';return html;};this.addPriceEvent = function() {var $rangeOptions = filter.container.find('.range-filter');var $filterByPriceBtn = filter.container.find('.filter-by-price-btn');var $minPrice = filter.container.find('.minPrice');var $maxPrice = filter.container.find('.maxPrice');$rangeOptions.on('click', function() {var $this = $(this);$minPrice.val($this.data('min'));$maxPrice.val($this.data('max'));$rangeOptions.removeClass('selected-filter');$this.addClass('selected-filter');$filterByPriceBtn.trigger('click');});$filterByPriceBtn.on('click', function() {filter.container.find('.filter-tags-container .tags .tag[data-type="price"]').remove();var dataAttr = 'data-type="price" data-min="' + $minPrice.val() + '" data-max="' + $maxPrice.val() + '"';var customTagText = $rangeOptions.filter('.selected-filter').data('custom-tag-text');if ( customTagText ) {filter.addFilterTag(customTagText,dataAttr);} else {filter.addFilterTag($minPrice.val()+'-'+$maxPrice.val(),dataAttr);}});};this.generateCheckBox = function( obj ) {var html = '';html += '';html += '';html += '
';return html;};this.addFilterTag = function( title, dataAttr ) {var html = '';html += '';html += '' + title + ' ';html += '';html += '';var $html = $(html);if ( $html.data('type') === 'price' ) {filter.multiCurrencyConvertion($html);$(document).off('multi_currency_update.eCommerce_filter').on('multi_currency_update.eCommerce_filter', function() {filter.multiCurrencyConvertion($html);});}
filter.container.find('.filter-tags-container .tags').append($html);filter.refreshTagsEvent();filter.filterProducts();};this.multiCurrencyConvertion = function( $html ) {var text = $html.find('.filter-tag-title').html();var min = MultiCurrencies.geConvertedPrice($html.data('min'));var max = MultiCurrencies.geConvertedPrice($html.data('max'));if ( text.indexOf('Above') != -1 ) {$html.find('.filter-tag-title').html(min + ' ' + filter.translations.priceAbove);} else {$html.find('.filter-tag-title').html(min + '-' + max);}};this.addCheckBoxEvent = function() {var $checkBoxes = filter.container.find('.checkboxInput');$checkBoxes.off('change').on('change', function() {var $this = $(this);if ( $this.is(':checked') ) {filter.checkBoxCheckedEvent($this);} else {filter.checkBoxUnCheckedEvent($this);}});}
this.addColorBoxEvent = function() {var $colors = filter.container.find('.color');$colors.off('click').on('click', function( event ) {var $this = $(this);if ( $this.hasClass('checked') ) {$this.removeClass('checked');var dataAttr = '.tag[data-unique-id="' + escapeHtml($this.data('unique-id')) + '"][data-type="color"][data-parent-unique-id="' + escapeHtml($this.data('parent-unique-id')) + '"]';filter.container.find(dataAttr).remove();filter.filterProducts();} else {$this.addClass('checked');if ( filter.container.find('.filter-tags-container .tags .tag[data-unique-id="' + escapeHtml($this.data('unique-id')) + '"] ').length > 0 ) return;;var dataAttr = 'data-unique-id="' + $this.data('unique-id') + '" data-type="color" data-parent-unique-id="' + escapeHtml($this.data('parent-unique-id')) + '"';filter.addFilterTag($this.data('title'),dataAttr);}});}
this.refreshTagsEvent = function() {filter.container.find('.filter-tags-container .tags .close').off('click').on('click' ,function() {var $tag = $(this).parent();if ($tag.data('type') == 'color' ) {filter.container.find('.color[data-unique-id="' + escapeHtml($tag.data('unique-id')) + '"]').removeClass('checked');} else {filter.container.find('.checkboxInput[value="' + escapeHtml($tag.data('unique-id')) + '"]').prop('checked',false);}
$tag.remove();filter.filterProducts();});};this.checkBoxCheckedEvent = function( $checkbox ) {if ( filter.container.find('.filter-tags-container .tags .tag[data-unique-id="' + escapeHtml($checkbox.val()) + '"] ').length > 0 ) return;var dataAttr = '';dataAttr += 'data-unique-id="' + escapeHtml($checkbox.val()) + '" data-type="' + escapeHtml($checkbox.data('type')) + '" data-parent-unique-id="' + escapeHtml($checkbox.data('parent-unique-id')) + '"';filter.addFilterTag($checkbox.data('title'),dataAttr);};this.checkBoxUnCheckedEvent = function( $this ) {var dataAttr = '';dataAttr += '.tag[data-unique-id="' + escapeHtml($this.val()) + '"][data-type="' + escapeHtml($this.data('type')) + '"]';filter.container.find(dataAttr).remove();filter.refreshTagsEvent();filter.filterProducts();};this.filterProducts = function() {var $tags = filter.container.find('.filter-tags-container .tag');if ( $tags.length == 0 ) filter.filteredProducts = false;var dataAttr = '';var products = Array();filter.filterCombinations = {};products = filter.filteredProducts;if ( $tags.length > 0 ) {$.each($tags, function( index, tag ) {var $this = $(this);switch ( $this.data('type') ) {case 'price':var obj = {};obj.min = $this.data('min');obj.max = $this.data('max');filter.filterCombinations.price = {min: obj.min,max: obj.max};break;default:var obj = {};obj.parentUniqueID = $this.data('parent-unique-id');obj.val = $this.data('unique-id');if ( filter.filterCombinations[$this.data('type')] && filter.filterCombinations[$this.data('type')].boxes ) {if ( filter.filterCombinations[$this.data('type')].boxes[obj.parentUniqueID] && filter.filterCombinations[$this.data('type')].boxes[obj.parentUniqueID].values ) {filter.filterCombinations[$this.data('type')].boxes[obj.parentUniqueID].values.push(obj.val);} else {filter.filterCombinations[$this.data('type')].boxes[obj.parentUniqueID] = {values: [obj.val]};}} else {var boxes = {};boxes[obj.parentUniqueID] = {values: [obj.val]}
filter.filterCombinations[$this.data('type')] = {boxes: boxes};}
break;}
var searchIn = Array();if ( $this.is(':first-child') ) {searchIn = filter.products;} else {searchIn = products;products = false;}
var tmp = filter.getProductByFilterType($this.data('type'),obj,Array(),searchIn);if ( products ) {Array.prototype.push.apply(products,tmp);} else {products = tmp;}});filter.filteredProducts = products;}
filter.resetProductsCounter();filter.getProductsByAjax();};this.getProductsByAjax = function() {var $productsContainer = $(filter.productsContainerSelector);var $loader = $productsContainer.parent().find('.s123-loader-ellips');$loader.parent().show();$loader.show();$productsContainer.fadeOut(200);if ( $productsContainer.data('infiniteScroll') ) $productsContainer.infiniteScroll('destroy');$.ajax({type: "GET",url: '/versions/2/wizard/modules/eCommerceCollections/front/eCommerceFilterProducts.php',data: {w: filter.w,websiteID: filter.websiteID,filterCombinations: JSON.stringify(filter.filterCombinations),pageNumber: 1,type: filter.type,uniquePageID: filter.uniquePageID,eCommerceSearch: filter.eCommerceSearch,sortBy: $('#productsSorting').val(),pageHasSideMenu: true},success: function( data ) {data = tryParseJSON(data);if ( !data ) return;$productsContainer.empty();$productsContainer.append(data.productsHtml);eCommerceProductrBoxesEvents();$loader.parent().hide();$loader.hide();$productsContainer.fadeIn(200, function() {window.myLazyLoad.update();$('html').stop().animate({scrollTop: filter.$scrollTo.offset().top},600,function() {if ( data.productsLeft > 0 ) {InfiniteScroll_init(filter.type,filter.uniquePageID,JSON.stringify(filter.filterCombinations),true);}});});}});};this.getProductByFilterType = function( type, obj, products, searchIn ) {$.each(searchIn, function( key, product ) {var as = product.as;var productOptions = tryParseJSON(as.pop);var productAttributes = tryParseJSON(as.pa);if ( productOptions.active && ['color','list','checkbox','radio','size'].indexOf(type) != -1 ) {$.each(productOptions.options, function( key, po ) {if ( po.ty == type && type == 'color' ) {$.each(po.items, function( key, item ) {if ( obj.val == item.c && obj.parentUniqueID === po.id ) {if ( !containsObject(product,products) ) {products.push(product);}}});} else if ( po.ty == type ) {$.each(po.items, function( key, item ) {if ( obj.val == item.id && obj.parentUniqueID === po.id ) {if ( !containsObject(product,products) ) {products.push(product);}}});}});}
if ( productAttributes.active && type == 'attribute' ) {$.each(productAttributes.attributes, function( key, attr ) {$.each(attr.values, function( key, value ) {if ( obj.val == value.id && obj.parentUniqueID === attr.id ) {if ( !containsObject(product,products) ) {products.push(product);}}});});}
if ( type == 'brand' ) {var brand = as[type];if ( obj.val == brand ) {if ( !containsObject(product,products) ) {products.push(product);}}}
if ( type == 'ribbon' ) {var ribbon = as[type];if ( obj.val == ribbon ) {if ( !containsObject(product,products) ) {products.push(product);}}}
if ( type == 'price' ) {var price = parseFloat(as.price);if ( as.onSale === 'on' && $.isNumeric(as.salePrice) ) {price = parseFloat(as.salePrice);}
if ( price >= obj.min && price <= obj.max ) {if ( !containsObject(product,products) ) {products.push(product);}}}});return products;};this.getFilterBoxTemplate = function() {var html = '';html = '';return html;};this.addExpandBoxEvent = function() {filter.container.find('.filter-type-title').on('click', function() {filter.closeOpenBox($(this).find('.expand-filter'),200);});};this.closeOpenBox = function( $expandIcon, animationTime ) {var $box = $expandIcon.closest('.filter-options');var $content = $box.find('.filter-option-content');if ( $content.hasClass('expanded') ) {$box.removeClass('is-open');$content.slideUp(animationTime,function() {$content.removeClass('expanded');filter.saveBoxesStateToCookie();});} else {$box.addClass('is-open');$content.slideDown(animationTime,function() {$content.addClass('expanded');filter.saveBoxesStateToCookie();});}};this.getFilterCombinations = function() {if ( !filter.initialized ) return {};return filter.filterCombinations;};function containsObject( obj, list ) {var x;for (x in list) {if (list.hasOwnProperty(x) && list[x] === obj) {return true;}}
return false;}
function tryParseJSON( str ) {try {var Obj = JSON.parse(str);if ( Obj && typeof Obj === "object" ) {return Obj;}} catch (e) {}
return false;}
function escapeHtml(text) {if (!text) return text;var map = {'&': '&','<': '<','>': '>','"': '"',"'": ''',};return text.toString().replace(/[&<>"']/g, function(m) {return map[m];});}};$( document ).on( "s123.page.ready", function( event ) {var rtl = $('html[dir=rtl]').length === 1;eCommerceProductBoxCarousel_init();eCommerceFilterTool.init(tryParseJSON($('.filter-object-data').val()));productsSorting.init({w: $('#w').val(),isRtl: rtl,websiteID: $('#websiteID').val(),uniquePageID: $('.products-container').data('unique-page-id'),type: $('.products-container').data('type'),pageHasSideMenu: $('.products-container').data('has-side-menu'),productsContainerSelector: '.products-container',$container: $('.e-commerce-sort-container'),$mobileContainer: $('.side-menu'),$scrollTo: $('.s123-module-eCommerce')});InfiniteScroll_init($('[data-s123-pagination="true"]').data('type'),$('[data-s123-pagination="true"]').data('unique-page-id'),'',$('[data-s123-pagination="true"]').data('has-side-menu'));(function() {function getCategoriesTree( $collections, parentState ) {var obj = {parent: {state: parentState},nodes: []}
$.each($collections, function( index, collection ) {var $collection = $(collection);if ( $collection.data('active') == '1' ) {obj.parent.state.expanded = true;obj.parent.state.selected = false;}
var collectionObj = {text: $collection.data('title'),href: $collection.data('href'),state: {selected: $collection.data('active') == '1',expanded: $collection.data('active') == '1'},nodes: []}
var $children = $collection.children().filter('.sub-collections').find('ul').first().children();if ( $children.length > 0 ) {var tree = getCategoriesTree($children,collectionObj.state);collectionObj.nodes = tree.nodes;collectionObj.state = tree.parent.state;if ( tree.parent.state.expanded ) obj.parent.state.expanded = true;} else {delete collectionObj.nodes;}
obj.nodes.push(collectionObj);});return obj;}
var tree = [];var defState = {selected: false,expanded: false}
$('.collections-container.nav').hide();$('.collection-tree-view').remove();var $collectionTreeView = $('');$collectionTreeView.insertAfter($('.collections-container.nav'));var categoriesNodes = getCategoriesTree($('.collections-container.nav .sub-collections ul').first().children(),defState).nodes;$.each(categoriesNodes, function( index, collection ) {tree.push(collection);});$collectionTreeView.on('mousedown', function() {setTimeout(function() {treeview_AddPajaxSupport();},200);});$collectionTreeView.treeview({data: tree,levels: 3,expandIcon: 'fa fa-plus',collapseIcon: 'fa fa-minus',showBorder: false,backColor: '#428bca00',color: '#428bca',selectedColor: '#428bca',selectedBackColor: '#428bca00',highlightSelected: true,enableLinks: true})
.show();treeview_AddPajaxSupport();function treeview_AddPajaxSupport() {$collectionTreeView.find('ul li a').addClass('s123-fast-page-load');S123.Pjax.refresh();}})();homepageSectionsCarouselInit(rtl);$(window).off('resize.homepageSectionsCarouselInit').on('resize.homepageSectionsCarouselInit', function( event ) {setTimeout( function() {homepageSectionsCarouselInit(rtl);},50);});$('.search-result-page-e-commerce #eCommerceSearch').keydown( function( event ) {if ( event.which === 13 && $(this).val().length === 0 ) event.preventDefault();});loadCollectionsCounters();});function eCommerceProductrBoxesEvents() {$(document).trigger('s123.page.ready.data-model');$(document).trigger('s123.page.ready.activeOrderPopup');$(document).trigger('s123.page.ready.wish_list');$(document).trigger('s123.page.ready.wizard_preview_manage_helpers');eCommerceProductBoxCarousel_init();$(document).trigger('pageLoaded');}
function InfiniteScroll_init( type, uniquePageID, filterCombinations, pageHasSideMenu ) {var $container = $('[data-s123-pagination="true"]');var $loadingIcon = $container.parent().children('.s123-page-load-status');var paginationProductsLeft = $container.data('pagination-products-left');if ( $container.length === 0 ) return;if ( $loadingIcon.length === 0 ) {$container.parent().append('');}
if ( parseInt(paginationProductsLeft) === 0 ) return;$container.infiniteScroll({append: false,responseType: 'text',scrollThreshold: 400,loadOnScroll: true,history: false,status: '.s123-page-load-status',path: function() {if ( this.loadCount < 2 ) this.loadCount = 2;var path = '/versions/2/wizard/modules/eCommerceCollections/front/eCommerceFilterProducts.php?w='+encodeURIComponent(w.value)+'&websiteID='+encodeURIComponent(websiteID.value)+'&pageNumber='+encodeURIComponent(this.loadCount)+'&filterCombinations='+encodeURIComponent(filterCombinations)+'&type='+encodeURIComponent(type)+'&uniquePageID='+encodeURIComponent(uniquePageID) + '&sortBy='+encodeURIComponent($('#productsSorting').val())+'&pageHasSideMenu='+encodeURIComponent(pageHasSideMenu);if ( $('#eCommerceSearch').length > 0 ) path += '&eCommerceSearch='+encodeURIComponent($('#eCommerceSearch').val());return path;}})
.off('load.infiniteScroll').on('load.infiniteScroll', function( event, response ) {response = tryParseJSON(response);$container.infiniteScroll('appendItems',$(response.productsHtml));eCommerceProductrBoxesEvents();window.myLazyLoad.update();if ( response.productsLeft == 0 ) $container.infiniteScroll('destroy');});}
function eCommerceProductBoxCarousel_init() {var rtl = $('html[dir=rtl]').length === 1;$('.s123-module-eCommerce').each(function() {$(this).find('.product-box-carousel').each(function() {var $product_box_carousel = $(this);$product_box_carousel.owlCarousel({items: 1,center: true,nav: true,slideTransition: 'ease',dots: false,navSpeed: 500,mouseDrag: false,loop: true,rtl :rtl,navText: [S123.s123IconToSvg.getHtml('angle-'+(rtl ? 'right' : 'left'),'fa-2x',''),S123.s123IconToSvg.getHtml('angle-'+(rtl ? 'left' : 'right'),'fa-2x','')],});$product_box_carousel.find('.owl-nav')
.off('click.owl_nav')
.on('click.owl_nav', function( event ) {var $this = $(this);var $target = $(event.target);if ( $target.is($this) ) {$product_box_carousel.find('.owl-item.active .product-image').get(0).click();}})
.css({ cursor: 'pointer' });});});}
var productsSorting = function() {var that = {};that.init = function( settings ) {if ( !settings ) return;if ( settings.$container.length == 0 ) return;that.$container = settings.$container;that.$mobileContainer = settings.$mobileContainer;that.$scrollTo = settings.$scrollTo;that.w = settings.w;that.isRtl = settings.isRtl;that.websiteID = settings.websiteID;that.uniquePageID = settings.uniquePageID;that.type = settings.type;that.pageHasSideMenu = settings.pageHasSideMenu;that.productsContainerSelector = settings.productsContainerSelector;that.$el = $(generateHtml());that.$container.html(that.$el);that.$productsSorting = that.$el.find('#productsSorting');that.$mobileIcon = that.$el.find('.mobile-icon');that.$productsSorting.on('change.sort_products', function() {sortChange();});mobileResponsiveHandler();adaptToScreenSize();};function sortChange() {var $productsContainer = $(that.productsContainerSelector);var $loader = $productsContainer.parent().find('.s123-loader-ellips');$loader.parent().show();$loader.show();$productsContainer.fadeOut(200);if ( $productsContainer.data('infiniteScroll') ) $productsContainer.infiniteScroll('destroy');$.ajax({type: "GET",url: '/versions/2/wizard/modules/eCommerceCollections/front/eCommerceFilterProducts.php',data: {w: that.w,websiteID: that.websiteID,filterCombinations: JSON.stringify(eCommerceFilterTool.getFilterCombinations()),pageNumber: 1,type: that.type,uniquePageID: that.uniquePageID,eCommerceSearch: $('#eCommerceSearch').length > 0 ? $('#eCommerceSearch').val() : '',sortBy: that.$productsSorting.val(),pageHasSideMenu: that.pageHasSideMenu},success: function( data ) {data = tryParseJSON(data);if ( !data ) return;$productsContainer.empty();$productsContainer.append(data.productsHtml);eCommerceProductrBoxesEvents();$loader.parent().hide();$loader.hide();$productsContainer.fadeIn(200, function() {window.myLazyLoad.update();$('html').stop().animate({scrollTop: that.$scrollTo.offset().top},600,function() {if ( data.productsLeft > 0 ) {InfiniteScroll_init(that.type,that.uniquePageID,JSON.stringify(eCommerceFilterTool.getFilterCombinations()),that.pageHasSideMenu);}});});}});}
function generateHtml() {var html = '';html += '';html += '';html += S123.s123IconToSvg.getHtml('sort-amount-asc','','');html += '';html += '';html += '
';return html;}
function mobileResponsiveHandler() {$(window).one('resize.eCommerceSortByMobileFilter', function( event ) {adaptToScreenSize();setTimeout( function() {mobileResponsiveHandler();},500);});}
function adaptToScreenSize() {if ( $(window).width() > 767 ) {that.$container.append(that.$el);that.$el.css({display: ''});that.$el.find('select').css({opacity: '',position: '',left: '',right: ''});that.$mobileIcon.hide();} else {that.$mobileContainer.append(that.$el);that.$el.css({display: 'inline-flex'});that.$el.find('select').css({opacity: 0,position: 'absolute'});if ( that.isRtl ) {that.$el.find('select').css({right: 0});} else {that.$el.find('select').css({left: 0});}
that.$mobileIcon.show();}};return that;}();function loadCollectionsCounters() {var $counters = $('.collection-container.e-commerce-items .count');if ( $counters.length > 0 ) {var colelctionBoxes = [];var uniqueIDS = [];var moduleTypeNUM = $('.s123-module-eCommerce').data('module-type-num');if ( moduleTypeNUM == 112 || IsEcommerceHighlight(moduleTypeNUM) ) moduleTypeNUM = 113;$counters.each(function(index, coutner) {var $coutner = $(coutner);var $colelctionBox = $coutner.closest('.e-c-box');var uniqueID = $colelctionBox.data('unique-id');if ( $.isNumeric(uniqueID) ) {uniqueID = uniqueID.toString();}
colelctionBoxes.push($colelctionBox);if ( uniqueIDS.indexOf(uniqueID) == -1 ) {uniqueIDS.push(uniqueID);}});$.ajax({type: "POST",url: '/versions/'+$(versionNUM).val()+'/wizard/modules/eCommerceCollections/front/getRelatedProductsAmount.php',data: {w: $('#w').val(),websiteID: $('#websiteID').val(),uniqueIDS: JSON.stringify(uniqueIDS),uniquePageID: $('#section-112 .collection-container').data('unique-page-id'),moduleTypeNUM: moduleTypeNUM},success: function( data ) {data = tryParseJSON(data);if ( !data ) return;if ( !data.success ) return;$.each(colelctionBoxes, function(index, $colelctionBox) {var uniqueID = $colelctionBox.data('unique-id');$colelctionBox.find('.count-amount').text(data.items[uniqueID]);$colelctionBox.addClass('show-counter');});}});}}
function homepageSectionsCarouselInit( rtl ) {var $homepageSections = $('.s123-module-eCommerce .homepage-section');$.each($homepageSections, function( index, section ) {var $section = $(section);var $sectionItemsContainer = $section.find('.e-commerce-items');var sectionData = tryParseJSON($section.find('.section-data').val());var sectionID = sectionData.id;var sectionStyle = sectionData.style;if ( sectionStyle == 2 ) carousel_init();if ( $section.hasClass('highlight-carousel') ) {sectionID = $section.closest('.s123-module-eCommerce').get(0).id;carousel_init();}
function carousel_init() {if ( $sectionItemsContainer.hasClass('slick-initialized') ) {$sectionItemsContainer.css('visibility','none');$sectionItemsContainer.slick('unslick');$sectionItemsContainer.parent().find('.custom-arrow-container').remove();}
var $prevArrow = $('');var $nextArrow = $('');$sectionItemsContainer.css({ display: 'flex' });var slidesToShow = findBootstrapColPerRow($sectionItemsContainer.children());if ( $sectionItemsContainer.children().length <= slidesToShow ) return;$sectionItemsContainer.parent().prepend($prevArrow);$sectionItemsContainer.parent().append($nextArrow);$sectionItemsContainer.parent().addClass('homepage-section-container');$sectionItemsContainer.slick({dots: false,infinite: true,vertical: false,verticalSwiping: false,slidesToShow: slidesToShow,slidesToScroll: 1,adaptiveHeight: true,swipeToSlide: true,rtl: rtl,prevArrow: '.related-p-c-s-p[data-section-id="'+sectionID+'"]',nextArrow: '.related-p-c-s-n[data-section-id="'+sectionID+'"]'});$sectionItemsContainer.on('init', function(event) {$sectionItemsContainer.css('visibility','');});}});}jQuery(function($) {headersModuleInitialize_Layout();});function headersModuleInitialize_Layout() {$( document ).on( "s123.page.ready", function( event ) {var $sections = $('section.s123-module-headers:is(.layout-6,.layout-7,.layout-8,.layout-9,.layout-18,.layout-20,.layout-22,.layout-23,.layout-24,.layout-25,.layout-26,.layout-27,.layout-29,.layout-30,.layout-35,.layout-39,.layout-40)');$sections.each(function( index ) {var $s = $(this);var $carousel = $s.find('[data-ride="carousel"]');var sliderSpeed = $s.data('slider-speed');if ( sliderSpeed == '' || parseInt(sliderSpeed) < 1 || parseInt(sliderSpeed) > 21 ) {sliderSpeed = 5000;} else {sliderSpeed = parseInt(sliderSpeed) * 1000;}
if( $s.hasClass('layout-20') ) {var $firstImage = $s.find('.headers-image').first();if ( $firstImage.length > 0 ) {var img = new Image();img.src = $firstImage.data('bg');img.onload = function() {var aspectRatio = this.width / this.height;$s.find('.headers-image').css('aspect-ratio',String(aspectRatio));if( $s.find('.headers-container').hasClass('circle-under-image') && aspectRatio < 1 ) {$s.addClass('corner-circle');}};}}
if( $s.hasClass('layout-22') || $s.hasClass('layout-29') ) {var $headersDescription = $s.find('.headers-description');var $headersimage = $s.find('.headers-image');if ( $headersimage.length > 0 && $headersDescription.length > 0 ) {if ( ($headersDescription.get(0).offsetHeight - 60) > $headersimage.get(0).offsetHeight ) {$s.get(0).style.setProperty('--headers-description-height',$headersDescription.get(0).offsetHeight+'px');}}}
$carousel.carousel({interval: sliderSpeed});});});}jQuery(function($) {HeadersModuleInitialize_Layout5();});function HeadersModuleInitialize_Layout5() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-headers.layout-5');$section.each(function( index ) {var $sectionThis = $(this);var $flickityContainer = $sectionThis.find('.carousel');var originalFirstImageSize = {};if ( $flickityContainer.length === 0 ) return;$flickityContainer.flickity({imagesLoaded: true,lazyLoad: 2,pageDots: false,wrapAround: true,percentPosition: false});});});}jQuery(function($) {HeadersModuleInitialize_Layout30();});function HeadersModuleInitialize_Layout30() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-headers.layout-30');$section.each(function( index ) {var $sectionThis = $(this);$sectionThis.find('.contactUsForm').each( function( index ) {var $form = $(this);var customFormMultiSteps = new CustomFormMultiSteps();customFormMultiSteps.init({$form: $form,$nextButton: $form.find('.next-form-btn'),$submitButton: $form.find('.submit-form-btn'),$previousButton: $form.find('.previous-form-btn'),totalSteps: $form.find('.custom-form-steps').data('total-steps')});var forms_GoogleRecaptcha = new Forms_GoogleRecaptcha();forms_GoogleRecaptcha.init($form);$form.validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: ':hidden:not(.custom-form-step:visible input[name^="datePicker-"])',highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();},errorPlacement: function (error, element) {if( element.is('input[type=checkbox]') || element.is('input[type=radio]') ) {var controls = element.closest('div[class*="col-"]');if( controls.find(':checkbox,:radio').length > 0 ) element.closest('.form-group').append(error);else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));}
else if( element.is('.select2') ) {error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));}
else if( element.is('.chosen-select') ) {error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));}
else {error.appendTo(element.closest('.form-group'));}},submitHandler: function( form ) {var $form = $(form);var clickAction = $form.data('click-action');$form.append($(''));var $convCodeContainer = $form.find('.conv-code-container');var thankYouMessage = translations.ThankYouAfterSubmmit;if ( $form.data('thanks-msg') ) {thankYouMessage = $form.data('thanks-msg');}
$form.find('button:submit').prop('disabled', true);S123.ButtonLoading.start($form.find('button:submit'));var url = "/versions/"+$('#versionNUM').val()+"/include/contactO.php";if ( $form.hasClass('custom-form') || $form.hasClass('horizontal-custom-form') ) {if ( !CustomForm_IsLastStep( $form ) ) {$form.find('.next-form-btn:visible').trigger('click');S123.ButtonLoading.stop($form.find('button:submit'));$form.find('button:submit').prop('disabled', false);return false;}
if ( !CustomForm_IsFillOutAtLeastOneField($form) ) {bootbox.alert(translations.fillOutAtLeastOneField);S123.ButtonLoading.stop($form.find('button:submit'));$form.find('button:submit').prop('disabled', false);return false;}
url = "/versions/"+$('#versionNUM').val()+"/include/customFormO.php";}
if ( forms_GoogleRecaptcha.isActive && !forms_GoogleRecaptcha.isGotToken ) {forms_GoogleRecaptcha.getToken();return false;}
$.ajax({type: "POST",url: url,data: $form.serialize(),success: function( data ) {var dataObj = jQuery.parseJSON(data);$form.trigger("reset");if ( clickAction == 'thankYouMessage' || clickAction == '' ) {bootbox.alert({title: translations.sent,message: thankYouMessage+'',className: 'contactUsConfirm',buttons: {ok: {label: translations.Ok}},backdrop: true});} else {if ( dataObj.conv_code.length > 0 ) {var $convCode = $('' + dataObj.conv_code + '
');$convCodeContainer.html($convCode.text());}
if( top.$('#websitePreviewIframe').length ) {bootbox.alert({title: translations.previewExternalLinkTitle,message: translations.previewExternalLinkMsg.replace('{{externalLink}}',''+dataObj.action.url+''),className: 'externalAlert'});} else {window.open(dataObj.action.url,'_self');}}
customFormMultiSteps.reset();forms_GoogleRecaptcha.reset();S123.ButtonLoading.stop($form.find('button:submit'));$form.find('button:submit').prop('disabled', false);WizardNotificationUpdate();}});return false;}});$form.find('.f-b-date-timePicker').each( function() {var $option = $(this);var $datePicker = $option.find('.fake-input.date-time-picker');var $hiddenInput = $option.find('[data-id="'+$datePicker.data('related-id')+'"]');var $datePickerIcon = $option.find('.f-b-date-timePicker-icon');var formBuilderCalendar = new calendar_handler();$datePicker.data('date-format',$form.data('date-format'));formBuilderCalendar.init({$fakeInput: $datePicker,$hiddenInput: $hiddenInput,$fakeInputIcon: $datePickerIcon,type: 'datePicker',title: translations.chooseDate,calendarSettings: {format: $datePicker.data('date-format'),weekStart: 0,todayBtn: "linked",clearBtn: false,language: languageCode,todayHighlight: true},onSubmit: function( selectedDate ) {$datePicker.html(selectedDate);$hiddenInput.val(selectedDate);}});});CustomForm_DisableTwoColumns($form);});});});}
'+title+'
';html += ''+time+'';html += ' ';html += '