
var _logger;function logError(type,details){if(_logger==undefined){_logger=new Logger();}
_logger.log(type,details);}
var Logger=function(){return this;};Logger.prototype={_url:'/ajax/logJavaError/',log:function(type,details){details=this._checkDetails(details);debug(details);ajax({url:this._url,method:'POST',dataType:'json',contentType:'application/json',data:{agent:navigator.userAgent,type:type,details:details},});},_checkDetails:function(details){if(typeof details==='object'){details.senderUrl=location.href;}
return details;}};function googledatalayer_handleEvents(){googledatalayer_handleProductDetail();googledatalayer_handleProductImpressions();googledatalayer_handleCheckout();googledatalayer_handlePurchase();googledatalayer_handlePromotions();googledatalayer_handleProductAdd();}
function googledatalayer_handleCheckout(){if(typeof datalayerCheckoutProducts!=='undefined'&&typeof datalayerCheckoutStep!=='undefined'){googledatalayer_send_ecommerce_checkout(datalayerCheckoutProducts,datalayerCheckoutStep);}}
function googledatalayer_handleProductAdd(){if(typeof datalayerProductAdd!=='undefined'&&typeof datalayerProductAdd!=='undefined'){googledatalayer_send_ecommerce_add_multiple(datalayerProductAdd);}}
function googledatalayer_handlePromotions(){if(typeof datalayerPromotions!=='undefined'){googledatalayer_send_ecommerce_promotions(datalayerPromotions);}}
function googledatalayer_handlePurchase(){if(typeof datalayerCheckoutProducts!=='undefined'&&typeof datalayerPurchaseTransactions!=='undefined'){googledatalayer_send_ecommerce_purchase(datalayerCheckoutProducts,datalayerPurchaseTransactions);}}
function googledatalayer_handleProductDetail(){if(typeof datalayerProductDetail!=='undefined'){googledatalayer_send_ecommerce_detail(datalayerProductDetail);}}
function googledatalayer_handleProductImpressions(){if(typeof datalayerProductImpressions!=='undefined'){googledatalayer_send_ecommerce_impressions(datalayerProductImpressions);}}
function googledatalayer_parse_price(price,eurPrice){if(eurPrice==undefined){eurPrice=false;}
if(eurPrice){price=price.replace('.','').replace(',','.');}
if(price.indexOf('.-')>-1){price=price.replace('.-','.00');}
return price;}
function googledatalayer_handle_ecommerce_product_click(event,element,id,price,title,brand,cat1,cat2,list,eurPrice,position){if(event.button>1){return true;}
if(list==undefined){list='';}
price=googledatalayer_parse_price(price,eurPrice);var product={'id':id,'name':title,'brand':brand,'category':cat1+'/'+cat2,'price':price,'list':list,'position':parseInt(position,10)+1};var url=element.getAttribute('href');var callback=null;if(url!=undefined&&(lastClick==null||lastClick=='left')){callback=function(){document.location=url;};}
var pushed=googledatalayer_send_ecommerce_product_click(product,callback);return true;}
function googledatalayer_handle_ecommerce_product_click_no_callback(id,price,title,brand,cat1,cat2,list,eurPrice,position){var product={'id':id,'name':title,'brand':brand,'category':cat1+'/'+cat2,'price':googledatalayer_parse_price(price,eurPrice),'list':list,'position':parseInt(position,10)+1};googledatalayer_send_ecommerce_product_click(product,null);}
function googledatalayer_handle_ecommerce_promotion_click(id,name,creative,position){if(position==undefined){position=1;}
var promotion={'id':id,'name':name,'creative':creative,'position':parseInt(position,10)};googledatalayer_send_ecommerce_promotion_click(promotion);}
function googledatalayer_handle_ecommerce_add(id,price,title,brand,cat1,cat2,eurPrice,quantity,position){if(quantity==undefined){quantity=1;}
price=googledatalayer_parse_price(price,eurPrice);var product={'id':id,'name':title,'brand':brand,'category':cat1+'/'+cat2,'price':price,'quantity':quantity,'position':parseInt(position,10)+1};googledatalayer_send_ecommerce_add(product);}
function googledatalayer_handle_ecommerce_remove(id,price,title,brand,cat1,cat2,eurPrice,quantity){if(quantity==undefined){quantity=1;}
price=googledatalayer_parse_price(price,eurPrice);var product={'id':id,'name':title,'brand':brand,'category':cat1+'/'+cat2,'price':price,'quantity':quantity};googledatalayer_send_ecommerce_remove(product);}
function googledatalayer_handle_ecommerce_update(id,price,title,brand,cat1,cat2,eurPrice,quantityBefore,quantityAfter){var amount,quantity;amount=quantityBefore-quantityAfter;quantity=Math.abs(amount);price=googledatalayer_parse_price(price,eurPrice);var product={'id':id,'name':title,'brand':brand,'category':cat1+'/'+cat2,'price':price,'quantity':quantity};if(amount>0){googledatalayer_send_ecommerce_remove(product);}
if(amount<0){googledatalayer_send_ecommerce_add(product);}}
function googledatalayer_send_ecommerce_promotions(promotions){if(typeof promotions!=='undefined'&&typeof dataLayer!=='undefined'){if(promotions[0]!==undefined){dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'currencyCode':'EUR','promoView':{'promotions':promotions}}});}}}
function googledatalayer_send_ecommerce_checkout(products,step){if(typeof products!=='undefined'&&typeof dataLayer!=='undefined'){if(typeof products[0]!=='undefined'){dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'currencyCode':'EUR','checkout':{'actionField':{'step':step},'products':products}}});}}}
function googledatalayer_send_ecommerce_shoppingcart(products){if(typeof products!=='undefined'&&typeof dataLayer!=='undefined'){if(typeof products[0]!=='undefined'){var cleanProducts=[];for(var i=0;i<products.length;i++){cleanProducts.push({id:products[i].id,name:products[i].description,category:products[i].category,price:products[i].price,quantity:products[i].amount});}
dataLayer.push({'event':'updateShoppingCart','ecommerce':{'currencyCode':'EUR','checkout':{'products':cleanProducts}}});}}}
function googledatalayer_send_ecommerce_purchase(products,transaction){if(typeof products!=='undefined'&&typeof dataLayer!=='undefined'){if(typeof products[0]!=='undefined'){dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'currencyCode':'EUR','purchase':{'actionField':{'id':transaction.id,'affiliation':'ACES Direct','revenue':transaction.revenue,'tax':transaction.tax,'shipping':transaction.shipping,'source':transaction.source,'source_id':transaction.source_id},'products':products}}});}}}
function googledatalayer_send_ecommerce_remove(product){if(typeof product.quantity=='undefined'){product.quantity=1;}
if(typeof product!='undefined'&&typeof dataLayer!=='undefined'){dataLayer.push({'event':'removeFromCart','ecommerce':{'currencyCode':'EUR','remove':{'products':[{'id':product.id,'name':product.name,'brand':product.brand,'category':product.category,'price':googledatalayer_parse_price(product.price,false),'quantity':product.quantity}]}}});}}
function googledatalayer_send_ecommerce_product_click(product,callback){if(typeof product!=='undefined'&&typeof dataLayer!=='undefined'){dataLayer.push({'event':'productClick','ecommerce':{'currencyCode':'EUR','click':{'actionField':{'list':product.list},'products':[{'id':product.id,'name':product.name,'brand':product.brand,'category':product.category,'price':googledatalayer_parse_price(product.price,false),'list':product.list,'position':product.position}]}},'eventCallback':callback});dataLayer.push({event:'searchClickedProducts',eventCategory:'searchClickedProducts',eventAction:window.location.href,eventLabel:product.id});if(typeof search_username!=='undefined'){dataLayer.push({event:'personalisedSearch',eventCategory:'personalisedSearch',eventAction:'Groep '+get_user_group(search_username),eventLabel:'Positie '+product.position});}
return true;}
return false;}
function googledatalayer_send_ecommerce_promotion_click(promotion){if(typeof promotion!=='undefined'&&typeof dataLayer!=='undefined'){dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'promoClick':{'promotions':[{'id':promotion.id,'name':promotion.name,'creative':promotion.creative,'position':promotion.position}]}}});}}
function googledatalayer_send_ecommerce_detail(product){if(typeof product!=='undefined'&&typeof dataLayer!=='undefined'){dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'detail':{'products':[{'id':product.id,'name':product.name,'brand':product.brand,'category':product.category,'price':googledatalayer_parse_price(product.price,false)}]}}});}}
function googledatalayer_send_ecommerce_add_multiple(products){if(typeof products!=='undefined'&&typeof dataLayer!=='undefined'){if(typeof products[0]!=='undefined'){dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'currencyCode':'EUR','add':{'products':products}}});}}}
function googledatalayer_send_ecommerce_add(product){if(typeof product.quantity=='undefined'){product.quantity=1;}
if(typeof product!=='undefined'&&typeof dataLayer!=='undefined'){dataLayer.push({'event':'addToCart','ecommerce':{'currencyCode':'EUR','add':{'products':[{'id':product.id,'name':product.name,'brand':product.brand,'category':product.category,'price':googledatalayer_parse_price(product.price,false),'quantity':product.quantity,'position':product.position}]}}});}}
function googledatalayer_send_ecommerce_impressions(products){if(typeof products!=='undefined'&&typeof dataLayer!=='undefined'){if(typeof products[0]!=='undefined'){var impressions=[];for(var i=0;i<products.length;i++){impressions.push({'id':products[i].id,'name':products[i].name,'brand':products[i].brand,'category':products[i].category,'price':googledatalayer_parse_price(products[i].price,false),'list':products[i].list,'position':i+1})}
dataLayer.push({'event':'EnhancedEcommerce','ecommerce':{'currencyCode':'EUR','impressions':impressions}});}}}
var GTM={productPageToCart:function(){if(typeof datalayerProductDetail===undefined){return;}
let productDetail=JQ.extend(true,{},datalayerProductDetail);let $productAmount=JQ('input[name="productamount"]');if($productAmount.length==1){let quantity=parseInt($productAmount.val());if(quantity!==null){productDetail.quantity=quantity;}}
googledatalayer_send_ecommerce_add(productDetail);}};jQuery.fn.selectToUISlider=function(settings){return new UI_Slider(this,settings);};var UI_Slider=function(object,settings){this.selects=jQuery(object);this.initialise(settings);return this;};UI_Slider.prototype={selects:null,options:null,handleIds:[],selectOptions:[],groups:[],values:[],sliderComponent:null,initialise:function(settings){this.options=jQuery.extend({labels:3,tooltip:true,tooltipSrc:'value',labelSrc:'value',sliderOptions:null},settings);this._loadObjects();var sliderOptions={step:1,min:0,showScale:true,orientation:'horizontal',max:this.selectOptions.length-1,range:this.selects.length>1,slide:this.slide.bind(this),start:this.start.bind(this),values:this.values,};this.options.sliderOptions=(settings)?jQuery.extend(sliderOptions,settings.sliderOptions):sliderOptions;this.selects.bind('change keyup click',function(){var thisIndex=jQuery(this).get(0).selectedIndex,thisHandle=jQuery('#handle_'+jQuery(this).attr('id')),handleIndex=thisHandle.data('handleNum');thisHandle.parents('.ui-slider:eq(0)').slider("values",handleIndex,thisIndex);});this.sliderComponent=jQuery('<div></div>');this._createHandles();this._createTics();this._styleObjects();setTimeout(function(){this.updateBarWidth();this.sliderComponent.find('.ui-slider-label').each(function(){jQuery(this).css('margin-left',jQuery(this).width()/-2);});}.bind(this),10);jQuery(window).resize(this.updateBarWidth);return this;},start:function(e,ui){},slide:function(e,ui){var thisHandle=jQuery(ui.handle),textVal=this._ttText(ui.value),currSelect=jQuery('#'+thisHandle.attr('id').split('handle_')[1]),slider=currSelect.closest('.searchFilters__slider');if(slider.data('keep-difference')==true){if((ui.values[1]-ui.values[0])<1){e.preventDefault();return false;}}
if(slider.data('disable-value')>0){e.preventDefault();return false;}
if(currSelect.find('option').length-1<=ui.values[0]){e.preventDefault();return false;}
thisHandle.attr('aria-valuetext',textVal).attr('aria-valuenow',ui.value).find('.ui-slider-tooltip .ttContent').text(textVal);currSelect.find('option').eq(ui.value).attr('selected','selected');},updateBarWidth:function(){if(this.sliderComponent==null){return;}
var barWidth=(this.sliderComponent.outerWidth(true)/(this.selectOptions.length-1))-2;this.sliderComponent.find('.ui-slider-bar').css('width',barWidth);},_createHandles:function(){this.selects.each(function(key,object){var hidett=this.options.tooltip==false?' style="display: none;"':'',thisLabel=jQuery('label[for='+jQuery(object).attr('id')+']'),valueNr=this.options.sliderOptions.values[key],selectedIndex=jQuery(this).get(0).selectedIndex,labelText=this._ttText(valueNr),thisLabelId=thisLabel.attr('id')||thisLabel.attr('id','label_'+this.handleIds[key]).attr('id'),sliderClass=key==0?'ui-slider-left':'ui-slider-right';jQuery('<a href="#" tabindex="0" id="'+this.handleIds[key]+'" class="ui-slider-handle '+sliderClass+'" '
+'role="slider" aria-labelledby="'+thisLabelId+'" '
+'aria-valuemin="'+this.options.sliderOptions.min+'" aria-valuemax="'+this.options.sliderOptions.max+'" '
+'aria-valuenow="'+valueNr+'" aria-valuetext="'+labelText+'" '
+'data-previous-value="'+selectedIndex+'" >'
+'<span class="ui-slider-tooltip ui-widget-content ui-corner-all"'+hidett+'>'
+'<span class="ttContent"></span>'
+'<span class="ui-tooltip-pointer-down ui-widget-content">'
+'<span class="ui-tooltip-pointer-down-inner"></span>'
+'</span>'
+'</span></a>').data('handleNum',key).appendTo(this.sliderComponent).click(function(e){e.preventDefault();});}.bind(this));},_createTics:function(){if(this.options.sliderOptions.showScale){if(this.groups.length>0){var inc=0;var scale=this.sliderComponent.append('<dl class="ui-slider-scale ui-helper-reset" role="presentation"></dl>').find('.ui-slider-scale:eq(0)');jQuery(this.groups).each(function(h,object){scale.append('<dt style="width: '+(100/this.groups.length).toFixed(2)+'%'+'; left:'+(h/(this.groups.length-1)*100).toFixed(2)+'%'+'"><span>'+object.label+'</span></dt>');var groupOpts=this.options;jQuery(this.options).each(function(i,object2){var style=(inc==this.selectOptions.length-1||inc==0)?'style="display: none;"':'';var labelText=(this.options.labelSrc=='text')?groupOpts[i].text:groupOpts[i].value;scale.append('<dd style="left:'+this._leftVal(inc)+'"><span class="ui-slider-label">'+labelText+'</span><span class="ui-slider-tic ui-widget-content"'+style+'></span></dd>');inc++;}.bind(this));}.bind(this));}
else{var scale=this.sliderComponent.append('<ol class="ui-slider-scale ui-helper-reset" role="presentation"></ol>').find('.ui-slider-scale:eq(0)');jQuery(this.selectOptions).each(function(key,object){var style=(key==this.selectOptions.length-1||key==0)?'style="display: none;"':'',barStyle='style="height: '+(object.height*24)+'px;"';scale.append('<li style="left:'+this._leftVal(key)+'">'
+'<span class="ui-slider-label">'+object.value+'</span>'
+'<span class="ui-slider-tic ui-widget-content" '+style+'></span>'
+'<span class="ui-slider-bar" '+barStyle+'></span>'
+'</li>');}.bind(this));}}},_styleObjects:function(){if(this.options.labels>1){this.sliderComponent.find('.ui-slider-scale li:last span.ui-slider-label, .ui-slider-scale dd:last span.ui-slider-label').addClass('ui-slider-label-show');}
var increm=Math.max(1,Math.round(this.selectOptions.length/this.options.labels));for(var j=0;j<this.selectOptions.length;j+=increm){if((this.selectOptions.length-j)>increm){this.sliderComponent.find('.ui-slider-scale li:eq('+j+') span.ui-slider-label, .ui-slider-scale dd:eq('+j+') span.ui-slider-label').addClass('ui-slider-label-show');}}
this.sliderComponent.find('.ui-slider-scale dt').each(function(key,object){jQuery(object).css({'left':((100/this.groups.length)*key).toFixed(2)+'%'});}.bind(this));this.sliderComponent.insertAfter(this.selects.eq(this.selects.length-1)).slider(this.options.sliderOptions).attr('role','application');this.sliderComponent.find('.ui-tooltip-pointer-down-inner').each(function(){var bWidth=jQuery('.ui-tooltip-pointer-down-inner').css('borderTopWidth');var bColor=jQuery(this).parents('.ui-slider-tooltip').css('backgroundColor')
jQuery(this).css('border-top',bWidth+' solid '+bColor);});var values=this.sliderComponent.slider('values');if(this._isArray(values)){jQuery(values).each(function(key,object){this.sliderComponent.find('.ui-slider-tooltip .ttContent').eq(key).text(this._ttText(object));}.bind(this));}
else{this.sliderComponent.find('.ui-slider-tooltip .ttContent').eq(0).text(this._ttText(values));}},_loadObjects:function(){this.handleIds=[];this.selects.each(function(key,object){this.handleIds.push('handle_'+jQuery(object).attr('id'));}.bind(this));this.selectOptions=[];this.selects.eq(0).find('option').each(function(key,object){this.selectOptions.push({value:jQuery(object).attr('value'),text:jQuery(object).text(),height:jQuery(object).data('height')});}.bind(this));this.groups=[];if(this.selects.eq(0).find('optgroup').size()>0){this.selects.eq(0).find('optgroup').each(function(key,object){this.groups[key]={};this.groups[key].label=jQuery(object).attr('label');this.groups[key].options=[];jQuery(object).find('option').each(function(key2,object2){this.groups[key].options.push({text:jQuery(object2).text(),value:jQuery(object2).attr('value')});}.bind(this));}.bind(this));}
this.values=[];this.selects.each(function(key,object){this.values.push(jQuery(object).get(0).selectedIndex);}.bind(this));},_isArray:function(obj){return obj.constructor==Array;},_ttText:function(optIndex){return(this.options.tooltipSrc=='text')?this.selectOptions[optIndex].text:this.selectOptions[optIndex].value;},_leftVal:function(i){return(i/(this.selectOptions.length-1)*100).toFixed(2)+'%';}};jQuery.fn.simpleSlider=function(settings){return new Simple_Slider(this,settings);};var Simple_Slider=function(object,settings){this.container=jQuery(object);this.initialise(settings);return this;};Simple_Slider.prototype={container:null,options:null,handleIds:[],selectOptions:[],groups:[],values:[],sliderComponent:null,hasInput:false,inputLeft:null,inputRight:null,_minValue:null,_maxValue:null,_minSelected:null,_maxSelected:null,initialise:function(settings){this.options=jQuery.extend({tooltip:true,sliderOptions:null},settings);this._loadObjects();var sliderOptions={min:Math.floor(this._minValue),max:Math.ceil(this._maxValue),values:[Math.floor(this._minSelected),Math.ceil(this._maxSelected)],orientation:'horizontal',range:true,slide:this.slide.bind(this),};if(sliderOptions.min==sliderOptions.max){sliderOptions.disabled=true;}
this.options.sliderOptions=(settings)?jQuery.extend(sliderOptions,settings.sliderOptions):sliderOptions;this.container.slider(this.options.sliderOptions);this._createHandles();setTimeout(function(){this._updateHandles(null,null);}.bind(this),10);return this;},start:function(e,ui){},slide:function(e,ui){var thisHandle=jQuery(ui.handle),textVal=ui.value,currSelect=jQuery('#'+thisHandle.attr('id').split('handle_')[1]),slider=currSelect.closest('.searchFilters__slider');if(slider.data('keep-difference')==true){if((ui.values[1]-ui.values[0])<1){e.preventDefault();return false;}}
if(slider.data('disable-value')>0){e.preventDefault();return false;}
if(ui.values[0]==ui.values[1]&&(ui.values[0]<this._minValue||ui.values[1]>this._maxValue)){e.preventDefault();return false;}
thisHandle.attr('aria-valuetext',textVal).attr('aria-valuenow',ui.value).find('.ui-slider-tooltip .ttContent').text(textVal);setTimeout(function(){this._updateHandles(thisHandle.attr('id'),textVal);}.bind(this),10);},updateBarWidth:function(){if(this.sliderComponent==null){return;}
var barWidth=(this.sliderComponent.outerWidth(true)/(this.selectOptions.length-1))-2;this.sliderComponent.find('.ui-slider-bar').css('width',barWidth);},_updateInputField:function(){this.container.slider("values",[this.inputLeft.val(),this.inputRight.val()]);},_updateInputFieldByKey:function(e){if(e.keyCode==13)
{this._updateInputField();}},_createHandles:function(){var input=this.container.siblings('.searchFilters__sliderInput');if(input.length>0){this.hasInput=true;this.inputLeft=input.find(".sliderInput_min");this.inputRight=input.find(".sliderInput_max");this.inputSubmit=input.find(".sliderInput_submit");this.inputLeft.keyup("input",this._updateInputFieldByKey.bind(this));this.inputRight.keyup("input",this._updateInputFieldByKey.bind(this));this.inputSubmit.click("input",this._updateInputField.bind(this));}
var handles=this.container.find('.ui-slider-handle');handles.each(function(key,object){var $handle=JQ(object),value=key==0?Math.floor(this._minSelected):Math.ceil(this._maxSelected);if(!this.hasInput){$handle.append(JQ('<span class="screenReaderContext" textValue="'+value+'">'+value+'</span>'));}
$handle.attr('id',this.handleIds[key]);}.bind(this));},_loadObjects:function(){var name=this.container.closest('.searchFilters__filter').data('id');this.handleIds=[name+'_min',name+'_max',];this._minValue=this.container.data('min-value');this._maxValue=this.container.data('max-value');this._minSelected=this.container.data('min-selected');this._maxSelected=this.container.data('max-selected');},_updateHandles:function(handle,value){if(this.hasInput){if(handle==this.handleIds[0]){this.inputLeft.val(value);}
else if(handle==this.handleIds[1]){this.inputRight.val(value);}}else{var handle1=jQuery('#'+this.handleIds[0]),handle2=jQuery('#'+this.handleIds[1]),reader1=handle1.find('.screenReaderContext'),reader2=handle2.find('.screenReaderContext');if(handle1.attr('id')==handle){reader1.attr('textValue',value);}
else if(handle2.attr('id')==handle){reader2.attr('textValue',value);}
if(reader1.attr('textValue')==reader2.attr('textValue')){handle1.addClass('ui-state-equal');handle2.addClass('ui-state-equal');}
else{handle1.removeClass('ui-state-equal');handle2.removeClass('ui-state-equal');}
if(this._minValue==this._maxValue){handle1.css('left','50%');handle2.css('left','50%');}
if((diff=this._combineHandles(handle1,handle2))!==false){var combined=reader1.attr('textValue')+' - '+reader2.attr('textValue');if(reader1.attr('textValue')==reader2.attr('textValue')){combined=reader1.attr('textValue');}
reader1.css({'width':120,'margin-left':(-60+(diff/2)),});reader1.text(combined);if(handle!==null){reader1.addClass('screenReaderContext--combined');}
else{reader1.removeClass('screenReaderContext--combined');}
reader2.hide();}
else{reader1.css('width','');reader1.removeClass('screenReaderContext--combined');reader1.text(reader1.attr('textValue'));this._repositionHandle(reader1,'left');reader2.text(reader2.attr('textValue'));reader2.show();this._repositionHandle(reader2,'right');}}},_repositionHandle:function(handle,position){var $parent=handle.closest('.ui-slider-handle'),$container=handle.closest('.searchFilters__filter'),pPos=$parent.position(),sPos=handle.closest('.ui-slider').position(),sbPos=handle.closest('.searchFilters__slider').position(),cPos=$container.position(),hWidth=handle.width(),baseLeft=pPos.left+sPos.left+sbPos.left+cPos.left;if(position=='left'){handle.css({'margin-left':Math.max(-baseLeft,hWidth/-2),});}
else{var offsetLeft=pPos.left+(hWidth/2)>$container.outerWidth(true)?($parent.outerWidth(true)-hWidth):(hWidth/-2);handle.css({'margin-left':offsetLeft,});}},_combineHandles:function(handle1,handle2){var pos1=handle1.offset(),pos2=handle2.offset();if(pos1==null||pos2==null){return false;}
var diff=Math.abs(pos1.left-pos2.left);if(diff<50){return diff;}
return false;}};var Handlebars=(function(){var __module4__=(function(){"use strict";var __exports__;function SafeString(string){this.string=string;}
SafeString.prototype.toString=function(){return""+this.string;};__exports__=SafeString;return __exports__;})();var __module3__=(function(__dependency1__){"use strict";var __exports__={};var SafeString=__dependency1__;var escape={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var badChars=/[&<>"'`]/g;var possible=/[&<>"'`]/;function escapeChar(chr){return escape[chr]||"&amp;";}
function extend(obj,value){for(var key in value){if(Object.prototype.hasOwnProperty.call(value,key)){obj[key]=value[key];}}}
__exports__.extend=extend;var toString=Object.prototype.toString;__exports__.toString=toString;var isFunction=function(value){return typeof value==='function';};if(isFunction(/x/)){isFunction=function(value){return typeof value==='function'&&toString.call(value)==='[object Function]';};}
var isFunction;__exports__.isFunction=isFunction;var isArray=Array.isArray||function(value){return(value&&typeof value==='object')?toString.call(value)==='[object Array]':false;};__exports__.isArray=isArray;function escapeExpression(string){if(string instanceof SafeString){return string.toString();}else if(!string&&string!==0){return"";}
string=""+string;if(!possible.test(string)){return string;}
return string.replace(badChars,escapeChar);}
__exports__.escapeExpression=escapeExpression;function isEmpty(value){if(!value&&value!==0){return true;}else if(isArray(value)&&value.length===0){return true;}else{return false;}}
__exports__.isEmpty=isEmpty;return __exports__;})(__module4__);var __module5__=(function(){"use strict";var __exports__;var errorProps=['description','fileName','lineNumber','message','name','number','stack'];function Exception(){var tmp=Error.prototype.constructor.apply(this,arguments);for(var idx=0;idx<errorProps.length;idx++){this[errorProps[idx]]=tmp[errorProps[idx]];}}
Exception.prototype=new Error();__exports__=Exception;return __exports__;})();var __module2__=(function(__dependency1__,__dependency2__){"use strict";var __exports__={};var Utils=__dependency1__;var Exception=__dependency2__;var VERSION="1.2.0";__exports__.VERSION=VERSION;var COMPILER_REVISION=4;__exports__.COMPILER_REVISION=COMPILER_REVISION;var REVISION_CHANGES={1:'<= 1.0.rc.2',2:'== 1.0.0-rc.3',3:'== 1.0.0-rc.4',4:'>= 1.0.0'};__exports__.REVISION_CHANGES=REVISION_CHANGES;var isArray=Utils.isArray,isFunction=Utils.isFunction,toString=Utils.toString,objectType='[object Object]';function HandlebarsEnvironment(helpers,partials){this.helpers=helpers||{};this.partials=partials||{};registerDefaultHelpers(this);}
__exports__.HandlebarsEnvironment=HandlebarsEnvironment;HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:logger,log:log,registerHelper:function(name,fn,inverse){if(toString.call(name)===objectType){if(inverse||fn){throw new Exception('Arg not supported with multiple helpers');}
Utils.extend(this.helpers,name);}else{if(inverse){fn.not=inverse;}
this.helpers[name]=fn;}},registerPartial:function(name,str){if(toString.call(name)===objectType){Utils.extend(this.partials,name);}else{this.partials[name]=str;}}};function registerDefaultHelpers(instance){instance.registerHelper('helperMissing',function(arg){if(arguments.length===2){return undefined;}else{throw new Error("Missing helper: '"+arg+"'");}});instance.registerHelper('blockHelperMissing',function(context,options){var inverse=options.inverse||function(){},fn=options.fn;if(isFunction(context)){context=context.call(this);}
if(context===true){return fn(this);}else if(context===false||context==null){return inverse(this);}else if(isArray(context)){if(context.length>0){return instance.helpers.each(context,options);}else{return inverse(this);}}else{return fn(context);}});instance.registerHelper('each',function(context,options){var fn=options.fn,inverse=options.inverse;var i=0,ret="",data;if(isFunction(context)){context=context.call(this);}
if(options.data){data=createFrame(options.data);}
if(context&&typeof context==='object'){if(isArray(context)){for(var j=context.length;i<j;i++){if(data){data.index=i;data.first=(i===0);data.last=(i===(context.length-1));}
ret=ret+fn(context[i],{data:data});}}else{for(var key in context){if(context.hasOwnProperty(key)){if(data){data.key=key;data.index=i;data.first=(i===0);}
ret=ret+fn(context[key],{data:data});i++;}}}}
if(i===0){ret=inverse(this);}
return ret;});instance.registerHelper('if',function(conditional,options){if(isFunction(conditional)){conditional=conditional.call(this);}
if((!options.hash.includeZero&&!conditional)||Utils.isEmpty(conditional)){return options.inverse(this);}else{return options.fn(this);}});instance.registerHelper('unless',function(conditional,options){return instance.helpers['if'].call(this,conditional,{fn:options.inverse,inverse:options.fn,hash:options.hash});});instance.registerHelper('with',function(context,options){if(isFunction(context)){context=context.call(this);}
if(!Utils.isEmpty(context))return options.fn(context);});instance.registerHelper('log',function(context,options){var level=options.data&&options.data.level!=null?parseInt(options.data.level,10):1;instance.log(level,context);});}
var logger={methodMap:{0:'debug',1:'info',2:'warn',3:'error'},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(level,obj){if(logger.level<=level){var method=logger.methodMap[level];if(typeof console!=='undefined'&&console[method]){console[method].call(console,obj);}}}};__exports__.logger=logger;function log(level,obj){logger.log(level,obj);}
__exports__.log=log;var createFrame=function(object){var obj={};Utils.extend(obj,object);return obj;};__exports__.createFrame=createFrame;return __exports__;})(__module3__,__module5__);var __module6__=(function(__dependency1__,__dependency2__,__dependency3__){"use strict";var __exports__={};var Utils=__dependency1__;var Exception=__dependency2__;var COMPILER_REVISION=__dependency3__.COMPILER_REVISION;var REVISION_CHANGES=__dependency3__.REVISION_CHANGES;function checkRevision(compilerInfo){var compilerRevision=compilerInfo&&compilerInfo[0]||1,currentRevision=COMPILER_REVISION;if(compilerRevision!==currentRevision){if(compilerRevision<currentRevision){var runtimeVersions=REVISION_CHANGES[currentRevision],compilerVersions=REVISION_CHANGES[compilerRevision];throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. "+"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");}else{throw new Error("Template was precompiled with a newer version of Handlebars than the current runtime. "+"Please update your runtime to a newer version ("+compilerInfo[1]+").");}}}
__exports__.checkRevision=checkRevision;function template(templateSpec,env){if(!env){throw new Error("No environment passed to template");}
var invokePartialWrapper=function(partial,name,context,helpers,partials,data){var result=env.VM.invokePartial.apply(this,arguments);if(result!=null){return result;}
if(env.compile){var options={helpers:helpers,partials:partials,data:data};partials[name]=env.compile(partial,{data:data!==undefined},env);return partials[name](context,options);}else{throw new Exception("The partial "+name+" could not be compiled when running in runtime-only mode");}};var container={escapeExpression:Utils.escapeExpression,invokePartial:invokePartialWrapper,programs:[],program:function(i,fn,data){var programWrapper=this.programs[i];if(data){programWrapper=program(i,fn,data);}else if(!programWrapper){programWrapper=this.programs[i]=program(i,fn);}
return programWrapper;},merge:function(param,common){var ret=param||common;if(param&&common&&(param!==common)){ret={};Utils.extend(ret,common);Utils.extend(ret,param);}
return ret;},programWithDepth:env.VM.programWithDepth,noop:env.VM.noop,compilerInfo:null};return function(context,options){options=options||{};var namespace=options.partial?options:env,helpers,partials;if(!options.partial){helpers=options.helpers;partials=options.partials;}
var result=templateSpec.call(container,namespace,context,helpers,partials,options.data);if(!options.partial){env.VM.checkRevision(container.compilerInfo);}
return result;};}
__exports__.template=template;function programWithDepth(i,fn,data){var args=Array.prototype.slice.call(arguments,3);var prog=function(context,options){options=options||{};return fn.apply(this,[context,options.data||data].concat(args));};prog.program=i;prog.depth=args.length;return prog;}
__exports__.programWithDepth=programWithDepth;function program(i,fn,data){var prog=function(context,options){options=options||{};return fn(context,options.data||data);};prog.program=i;prog.depth=0;return prog;}
__exports__.program=program;function invokePartial(partial,name,context,helpers,partials,data){var options={partial:true,helpers:helpers,partials:partials,data:data};if(partial===undefined){throw new Exception("The partial "+name+" could not be found");}else if(partial instanceof Function){return partial(context,options);}}
__exports__.invokePartial=invokePartial;function noop(){return"";}
__exports__.noop=noop;return __exports__;})(__module3__,__module5__,__module2__);var __module1__=(function(__dependency1__,__dependency2__,__dependency3__,__dependency4__,__dependency5__){"use strict";var __exports__;var base=__dependency1__;var SafeString=__dependency2__;var Exception=__dependency3__;var Utils=__dependency4__;var runtime=__dependency5__;var create=function(){var hb=new base.HandlebarsEnvironment();Utils.extend(hb,base);hb.SafeString=SafeString;hb.Exception=Exception;hb.Utils=Utils;hb.VM=runtime;hb.template=function(spec){return runtime.template(spec,hb);};return hb;};var Handlebars=create();Handlebars.create=create;__exports__=Handlebars;return __exports__;})(__module2__,__module4__,__module5__,__module3__,__module6__);var __module7__=(function(__dependency1__){"use strict";var __exports__;var Exception=__dependency1__;var AST={ProgramNode:function(statements,inverseStrip,inverse){this.type="program";this.statements=statements;this.strip={};if(inverse){this.inverse=new AST.ProgramNode(inverse,inverseStrip);this.strip.right=inverseStrip.left;}else if(inverseStrip){this.strip.left=inverseStrip.right;}},MustacheNode:function(rawParams,hash,open,strip){this.type="mustache";this.hash=hash;this.strip=strip;if(open!=null&&open.charAt){var escapeFlag=open.charAt(3)||open.charAt(2);this.escaped=escapeFlag!=='{'&&escapeFlag!=='&';}else{this.escaped=!!open;}
var id=this.id=rawParams[0];var params=this.params=rawParams.slice(1);var eligibleHelper=this.eligibleHelper=id.isSimple;this.isHelper=eligibleHelper&&(params.length||hash);},PartialNode:function(partialName,context,strip){this.type="partial";this.partialName=partialName;this.context=context;this.strip=strip;},BlockNode:function(mustache,program,inverse,close){if(mustache.id.original!==close.path.original){throw new Exception(mustache.id.original+" doesn't match "+close.path.original);}
this.type="block";this.mustache=mustache;this.program=program;this.inverse=inverse;this.strip={left:mustache.strip.left,right:close.strip.right};(program||inverse).strip.left=mustache.strip.right;(inverse||program).strip.right=close.strip.left;if(inverse&&!program){this.isInverse=true;}},ContentNode:function(string){this.type="content";this.string=string;},HashNode:function(pairs){this.type="hash";this.pairs=pairs;},IdNode:function(parts){this.type="ID";var original="",dig=[],depth=0;for(var i=0,l=parts.length;i<l;i++){var part=parts[i].part;original+=(parts[i].separator||'')+part;if(part===".."||part==="."||part==="this"){if(dig.length>0){throw new Exception("Invalid path: "+original);}
else if(part===".."){depth++;}
else{this.isScoped=true;}}
else{dig.push(part);}}
this.original=original;this.parts=dig;this.string=dig.join('.');this.depth=depth;this.isSimple=parts.length===1&&!this.isScoped&&depth===0;this.stringModeValue=this.string;},PartialNameNode:function(name){this.type="PARTIAL_NAME";this.name=name.original;},DataNode:function(id){this.type="DATA";this.id=id;},StringNode:function(string){this.type="STRING";this.original=this.string=this.stringModeValue=string;},IntegerNode:function(integer){this.type="INTEGER";this.original=this.integer=integer;this.stringModeValue=Number(integer);},BooleanNode:function(bool){this.type="BOOLEAN";this.bool=bool;this.stringModeValue=bool==="true";},CommentNode:function(comment){this.type="comment";this.comment=comment;}};__exports__=AST;return __exports__;})(__module5__);var __module9__=(function(){"use strict";var __exports__;var handlebars=(function(){var parser={trace:function trace(){},yy:{},symbols_:{"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[35,1],[37,3],[26,1],[26,1],[26,1],[30,2],[21,1],[41,3],[41,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[36,1],[36,2]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return new yy.ProgramNode($$[$0-1]);break;case 2:return new yy.ProgramNode([]);break;case 3:this.$=new yy.ProgramNode([],$$[$0-1],$$[$0]);break;case 4:this.$=new yy.ProgramNode($$[$0-2],$$[$0-1],$$[$0]);break;case 5:this.$=new yy.ProgramNode($$[$0-1],$$[$0],[]);break;case 6:this.$=new yy.ProgramNode($$[$0]);break;case 7:this.$=new yy.ProgramNode([]);break;case 8:this.$=new yy.ProgramNode([]);break;case 9:this.$=[$$[$0]];break;case 10:$$[$0-1].push($$[$0]);this.$=$$[$0-1];break;case 11:this.$=new yy.BlockNode($$[$0-2],$$[$0-1].inverse,$$[$0-1],$$[$0]);break;case 12:this.$=new yy.BlockNode($$[$0-2],$$[$0-1],$$[$0-1].inverse,$$[$0]);break;case 13:this.$=$$[$0];break;case 14:this.$=$$[$0];break;case 15:this.$=new yy.ContentNode($$[$0]);break;case 16:this.$=new yy.CommentNode($$[$0]);break;case 17:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],$$[$0-2],stripFlags($$[$0-2],$$[$0]));break;case 18:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],$$[$0-2],stripFlags($$[$0-2],$$[$0]));break;case 19:this.$={path:$$[$0-1],strip:stripFlags($$[$0-2],$$[$0])};break;case 20:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],$$[$0-2],stripFlags($$[$0-2],$$[$0]));break;case 21:this.$=new yy.MustacheNode($$[$0-1][0],$$[$0-1][1],$$[$0-2],stripFlags($$[$0-2],$$[$0]));break;case 22:this.$=new yy.PartialNode($$[$0-2],$$[$0-1],stripFlags($$[$0-3],$$[$0]));break;case 23:this.$=stripFlags($$[$0-1],$$[$0]);break;case 24:this.$=[[$$[$0-2]].concat($$[$0-1]),$$[$0]];break;case 25:this.$=[[$$[$0]],null];break;case 26:this.$=$$[$0];break;case 27:this.$=new yy.StringNode($$[$0]);break;case 28:this.$=new yy.IntegerNode($$[$0]);break;case 29:this.$=new yy.BooleanNode($$[$0]);break;case 30:this.$=$$[$0];break;case 31:this.$=new yy.HashNode($$[$0]);break;case 32:this.$=[$$[$0-2],$$[$0]];break;case 33:this.$=new yy.PartialNameNode($$[$0]);break;case 34:this.$=new yy.PartialNameNode(new yy.StringNode($$[$0]));break;case 35:this.$=new yy.PartialNameNode(new yy.IntegerNode($$[$0]));break;case 36:this.$=new yy.DataNode($$[$0]);break;case 37:this.$=new yy.IdNode($$[$0]);break;case 38:$$[$0-2].push({part:$$[$0],separator:$$[$0-1]});this.$=$$[$0-2];break;case 39:this.$=[{part:$$[$0]}];break;case 42:this.$=[];break;case 43:$$[$0-1].push($$[$0]);break;case 46:this.$=[$$[$0]];break;case 47:$$[$0-1].push($$[$0]);break;}},table:[{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:29,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:30,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:31,21:24,30:25,38:[1,28],40:[1,27],41:26},{21:33,26:32,32:[1,34],33:[1,35],38:[1,28],41:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,38:[1,28],40:[1,27],41:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,42],24:[2,42],28:43,32:[2,42],33:[2,42],34:[2,42],38:[2,42],40:[2,42]},{18:[2,25],24:[2,25]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],38:[2,37],40:[2,37],42:[1,44]},{21:45,38:[1,28],41:26},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],40:[2,39],42:[2,39]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,40],21:50,27:49,38:[1,28],41:26},{18:[2,33],38:[2,33]},{18:[2,34],38:[2,34]},{18:[2,35],38:[2,35]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,38:[1,28],41:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,44],21:56,24:[2,44],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:55,36:61,37:62,38:[1,63],40:[1,27],41:26},{38:[1,64]},{18:[2,36],24:[2,36],32:[2,36],33:[2,36],34:[2,36],38:[2,36],40:[2,36]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,65]},{18:[2,41]},{18:[1,66]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24]},{18:[2,43],24:[2,43],32:[2,43],33:[2,43],34:[2,43],38:[2,43],40:[2,43]},{18:[2,45],24:[2,45]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],38:[2,26],40:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],38:[2,27],40:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],38:[2,28],40:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],38:[2,29],40:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],38:[2,30],40:[2,30]},{18:[2,31],24:[2,31],37:67,38:[1,68]},{18:[2,46],24:[2,46],38:[2,46]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],39:[1,69],40:[2,39],42:[2,39]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],38:[2,38],40:[2,38],42:[2,38]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{18:[2,47],24:[2,47],38:[2,47]},{39:[1,69]},{21:56,30:60,31:70,32:[1,57],33:[1,58],34:[1,59],38:[1,28],40:[1,27],41:26},{18:[2,32],24:[2,32],38:[2,32]}],defaultActions:{3:[2,2],16:[2,1],50:[2,41]},parseError:function parseError(str,hash){throw new Error(str);},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")
this.lexer.yylloc={};var yyloc=this.lexer.yylloc;lstack.push(yyloc);var ranges=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")
this.parseError=this.yy.parseError;function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n;}
function lex(){var token;token=self.lexer.lex()||1;if(typeof token!=="number"){token=self.symbols_[token]||token;}
return token;}
var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state];}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex();}
action=table[state]&&table[state][symbol];}
if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";if(!recovering){expected=[];for(p in table[state])
if(this.terminals_[p]&&p>2){expected.push("'"+this.terminals_[p]+"'");}
if(this.lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'";}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==1?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'");}
this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected});}}
if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);}
switch(action[0]){case 1:stack.push(symbol);vstack.push(this.lexer.yytext);lstack.push(this.lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=this.lexer.yyleng;yytext=this.lexer.yytext;yylineno=this.lexer.yylineno;yyloc=this.lexer.yylloc;if(recovering>0)
recovering--;}else{symbol=preErrorSymbol;preErrorSymbol=null;}
break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]];}
r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack);if(typeof r!=="undefined"){return r;}
if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len);}
stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true;}}
return true;}};function stripFlags(open,close){return{left:open.charAt(2)==='~',right:close.charAt(0)==='~'||close.charAt(1)==='~'};}
var lexer=(function(){var lexer=({EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash);}else{throw new Error(str);}},setInput:function(input){this._input=input;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match='';this.conditionStack=['INITIAL'];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this;},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++;}else{this.yylloc.last_column++;}
if(this.options.ranges)this.yylloc.range[1]++;this._input=this._input.slice(1);return ch;},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len-1);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1)this.yylineno-=lines.length-1;var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len];}
return this;},more:function(){this._more=true;return this;},less:function(n){this.unput(this.match.slice(n));},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?'...':'')+past.substr(-20).replace(/\n/g,"");},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length);}
return(next.substr(0,20)+(next.length>20?'...':'')).replace(/\n/g,"");},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^";},next:function(){if(this.done){return this.EOF;}
if(!this._input)this.done=true;var token,match,tempMatch,index,col,lines;if(!this._more){this.yytext='';this.match='';}
var rules=this._currentRules();for(var i=0;i<rules.length;i++){tempMatch=this._input.match(this.rules[rules[i]]);if(tempMatch&&(!match||tempMatch[0].length>match[0].length)){match=tempMatch;index=i;if(!this.options.flex)break;}}
if(match){lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines)this.yylineno+=lines.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng];}
this._more=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,rules[index],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(token)return token;else return;}
if(this._input===""){return this.EOF;}else{return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),{text:"",token:null,line:this.yylineno});}},lex:function lex(){var r=this.next();if(typeof r!=='undefined'){return r;}else{return this.lex();}},begin:function begin(condition){this.conditionStack.push(condition);},popState:function popState(){return this.conditionStack.pop();},_currentRules:function _currentRules(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;},topState:function(){return this.conditionStack[this.conditionStack.length-2];},pushState:function begin(condition){this.begin(condition);}});lexer.options={};lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){function strip(start,end){return yy_.yytext=yy_.yytext.substr(start,yy_.yyleng-end);}
var YYSTATE=YY_START
switch($avoiding_name_collisions){case 0:if(yy_.yytext.slice(-2)==="\\\\"){strip(0,1);this.begin("mu");}else if(yy_.yytext.slice(-1)==="\\"){strip(0,1);this.begin("emu");}else{this.begin("mu");}
if(yy_.yytext)return 14;break;case 1:return 14;break;case 2:this.popState();return 14;break;case 3:strip(0,4);this.popState();return 15;break;case 4:return 25;break;case 5:return 16;break;case 6:return 20;break;case 7:return 19;break;case 8:return 19;break;case 9:return 23;break;case 10:return 22;break;case 11:this.popState();this.begin('com');break;case 12:strip(3,5);this.popState();return 15;break;case 13:return 22;break;case 14:return 39;break;case 15:return 38;break;case 16:return 38;break;case 17:return 42;break;case 18:break;case 19:this.popState();return 24;break;case 20:this.popState();return 18;break;case 21:yy_.yytext=strip(1,2).replace(/\\"/g,'"');return 32;break;case 22:yy_.yytext=strip(1,2).replace(/\\'/g,"'");return 32;break;case 23:return 40;break;case 24:return 34;break;case 25:return 34;break;case 26:return 33;break;case 27:return 38;break;case 28:yy_.yytext=strip(1,2);return 38;break;case 29:return'INVALID';break;case 30:return 5;break;}};lexer.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];lexer.conditions={"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}};return lexer;})()
parser.lexer=lexer;function Parser(){this.yy={};}Parser.prototype=parser;parser.Parser=Parser;return new Parser;})();__exports__=handlebars;return __exports__;})();var __module8__=(function(__dependency1__,__dependency2__){"use strict";var __exports__={};var parser=__dependency1__;var AST=__dependency2__;__exports__.parser=parser;function parse(input){if(input.constructor===AST.ProgramNode){return input;}
parser.yy=AST;return parser.parse(input);}
__exports__.parse=parse;return __exports__;})(__module9__,__module7__);var __module11__=(function(__dependency1__){"use strict";var __exports__;var COMPILER_REVISION=__dependency1__.COMPILER_REVISION;var REVISION_CHANGES=__dependency1__.REVISION_CHANGES;var log=__dependency1__.log;function Literal(value){this.value=value;}
function JavaScriptCompiler(){}
JavaScriptCompiler.prototype={nameLookup:function(parent,name){var wrap,ret;if(parent.indexOf('depth')===0){wrap=true;}
if(/^[0-9]+$/.test(name)){ret=parent+"["+name+"]";}else if(JavaScriptCompiler.isValidJavaScriptVariableName(name)){ret=parent+"."+name;}
else{ret=parent+"['"+name+"']";}
if(wrap){return'('+parent+' && '+ret+')';}else{return ret;}},compilerInfo:function(){var revision=COMPILER_REVISION,versions=REVISION_CHANGES[revision];return"this.compilerInfo = ["+revision+",'"+versions+"'];\n";},appendToBuffer:function(string){if(this.environment.isSimple){return"return "+string+";";}else{return{appendToBuffer:true,content:string,toString:function(){return"buffer += "+string+";";}};}},initializeBuffer:function(){return this.quotedString("");},namespace:"Handlebars",compile:function(environment,options,context,asObject){this.environment=environment;this.options=options||{};log('debug',this.environment.disassemble()+"\n\n");this.name=this.environment.name;this.isChild=!!context;this.context=context||{programs:[],environments:[],aliases:{}};this.preamble();this.stackSlot=0;this.stackVars=[];this.registers={list:[]};this.compileStack=[];this.inlineStack=[];this.compileChildren(environment,options);var opcodes=environment.opcodes,opcode;this.i=0;for(var l=opcodes.length;this.i<l;this.i++){opcode=opcodes[this.i];if(opcode.opcode==='DECLARE'){this[opcode.name]=opcode.value;}else{this[opcode.opcode].apply(this,opcode.args);}
if(opcode.opcode!==this.stripNext){this.stripNext=false;}}
this.pushSource('');return this.createFunctionContext(asObject);},preamble:function(){var out=[];if(!this.isChild){var namespace=this.namespace;var copies="helpers = this.merge(helpers, "+namespace+".helpers);";if(this.environment.usePartial){copies=copies+" partials = this.merge(partials, "+namespace+".partials);";}
if(this.options.data){copies=copies+" data = data || {};";}
out.push(copies);}else{out.push('');}
if(!this.environment.isSimple){out.push(", buffer = "+this.initializeBuffer());}else{out.push("");}
this.lastContext=0;this.source=out;},createFunctionContext:function(asObject){var locals=this.stackVars.concat(this.registers.list);if(locals.length>0){this.source[1]=this.source[1]+", "+locals.join(", ");}
if(!this.isChild){for(var alias in this.context.aliases){if(this.context.aliases.hasOwnProperty(alias)){this.source[1]=this.source[1]+', '+alias+'='+this.context.aliases[alias];}}}
if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";";}
if(!this.isChild){this.source[1]+='\n'+this.context.programs.join('\n')+'\n';}
if(!this.environment.isSimple){this.pushSource("return buffer;");}
var params=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var i=0,l=this.environment.depths.list.length;i<l;i++){params.push("depth"+this.environment.depths.list[i]);}
var source=this.mergeSource();if(!this.isChild){source=this.compilerInfo()+source;}
if(asObject){params.push(source);return Function.apply(this,params);}else{var functionSource='function '+(this.name||'')+'('+params.join(',')+') {\n  '+source+'}';log('debug',functionSource+"\n\n");return functionSource;}},mergeSource:function(){var source='',buffer;for(var i=0,len=this.source.length;i<len;i++){var line=this.source[i];if(line.appendToBuffer){if(buffer){buffer=buffer+'\n    + '+line.content;}else{buffer=line.content;}}else{if(buffer){source+='buffer += '+buffer+';\n  ';buffer=undefined;}
source+=line+'\n  ';}}
return source;},blockValue:function(){this.context.aliases.blockHelperMissing='helpers.blockHelperMissing';var params=["depth0"];this.setupParams(0,params);this.replaceStack(function(current){params.splice(1,0,current);return"blockHelperMissing.call("+params.join(", ")+")";});},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing='helpers.blockHelperMissing';var params=["depth0"];this.setupParams(0,params);var current=this.topStack();params.splice(1,0,current);params[params.length-1]='options';this.pushSource("if (!"+this.lastHelper+") { "+current+" = blockHelperMissing.call("+params.join(", ")+"); }");},appendContent:function(content){if(this.pendingContent){content=this.pendingContent+content;}
if(this.stripNext){content=content.replace(/^\s+/,'');}
this.pendingContent=content;},strip:function(){if(this.pendingContent){this.pendingContent=this.pendingContent.replace(/\s+$/,'');}
this.stripNext='strip';},append:function(){this.flushInline();var local=this.popStack();this.pushSource("if("+local+" || "+local+" === 0) { "+this.appendToBuffer(local)+" }");if(this.environment.isSimple){this.pushSource("else { "+this.appendToBuffer("''")+" }");}},appendEscaped:function(){this.context.aliases.escapeExpression='this.escapeExpression';this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"));},getContext:function(depth){if(this.lastContext!==depth){this.lastContext=depth;}},lookupOnContext:function(name){this.push(this.nameLookup('depth'+this.lastContext,name,'context'));},pushContext:function(){this.pushStackLiteral('depth'+this.lastContext);},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"';this.replaceStack(function(current){return"typeof "+current+" === functionType ? "+current+".apply(depth0) : "+current;});},lookup:function(name){this.replaceStack(function(current){return current+" == null || "+current+" === false ? "+current+" : "+this.nameLookup(current,name,'context');});},lookupData:function(){this.push('data');},pushStringParam:function(string,type){this.pushStackLiteral('depth'+this.lastContext);this.pushString(type);if(typeof string==='string'){this.pushString(string);}else{this.pushStackLiteral(string);}},emptyHash:function(){this.pushStackLiteral('{}');if(this.options.stringParams){this.register('hashTypes','{}');this.register('hashContexts','{}');}},pushHash:function(){this.hash={values:[],types:[],contexts:[]};},popHash:function(){var hash=this.hash;this.hash=undefined;if(this.options.stringParams){this.register('hashContexts','{'+hash.contexts.join(',')+'}');this.register('hashTypes','{'+hash.types.join(',')+'}');}
this.push('{\n    '+hash.values.join(',\n    ')+'\n  }');},pushString:function(string){this.pushStackLiteral(this.quotedString(string));},push:function(expr){this.inlineStack.push(expr);return expr;},pushLiteral:function(value){this.pushStackLiteral(value);},pushProgram:function(guid){if(guid!=null){this.pushStackLiteral(this.programExpression(guid));}else{this.pushStackLiteral(null);}},invokeHelper:function(paramSize,name){this.context.aliases.helperMissing='helpers.helperMissing';var helper=this.lastHelper=this.setupHelper(paramSize,name,true);var nonHelper=this.nameLookup('depth'+this.lastContext,name,'context');this.push(helper.name+' || '+nonHelper);this.replaceStack(function(name){return name+' ? '+name+'.call('+
helper.callParams+") "+": helperMissing.call("+
helper.helperMissingParams+")";});},invokeKnownHelper:function(paramSize,name){var helper=this.setupHelper(paramSize,name);this.push(helper.name+".call("+helper.callParams+")");},invokeAmbiguous:function(name,helperCall){this.context.aliases.functionType='"function"';this.pushStackLiteral('{}');var helper=this.setupHelper(0,name,helperCall);var helperName=this.lastHelper=this.nameLookup('helpers',name,'helper');var nonHelper=this.nameLookup('depth'+this.lastContext,name,'context');var nextStack=this.nextStack();this.pushSource('if ('+nextStack+' = '+helperName+') { '+nextStack+' = '+nextStack+'.call('+helper.callParams+'); }');this.pushSource('else { '+nextStack+' = '+nonHelper+'; '+nextStack+' = typeof '+nextStack+' === functionType ? '+nextStack+'.call('+helper.callParams+') : '+nextStack+'; }');},invokePartial:function(name){var params=[this.nameLookup('partials',name,'partial'),"'"+name+"'",this.popStack(),"helpers","partials"];if(this.options.data){params.push("data");}
this.context.aliases.self="this";this.push("self.invokePartial("+params.join(", ")+")");},assignToHash:function(key){var value=this.popStack(),context,type;if(this.options.stringParams){type=this.popStack();context=this.popStack();}
var hash=this.hash;if(context){hash.contexts.push("'"+key+"': "+context);}
if(type){hash.types.push("'"+key+"': "+type);}
hash.values.push("'"+key+"': ("+value+")");},compiler:JavaScriptCompiler,compileChildren:function(environment,options){var children=environment.children,child,compiler;for(var i=0,l=children.length;i<l;i++){child=children[i];compiler=new this.compiler();var index=this.matchExistingProgram(child);if(index==null){this.context.programs.push('');index=this.context.programs.length;child.index=index;child.name='program'+index;this.context.programs[index]=compiler.compile(child,options,this.context);this.context.environments[index]=child;}else{child.index=index;child.name='program'+index;}}},matchExistingProgram:function(child){for(var i=0,len=this.context.environments.length;i<len;i++){var environment=this.context.environments[i];if(environment&&environment.equals(child)){return i;}}},programExpression:function(guid){this.context.aliases.self="this";if(guid==null){return"self.noop";}
var child=this.environment.children[guid],depths=child.depths.list,depth;var programParams=[child.index,child.name,"data"];for(var i=0,l=depths.length;i<l;i++){depth=depths[i];if(depth===1){programParams.push("depth0");}
else{programParams.push("depth"+(depth-1));}}
return(depths.length===0?"self.program(":"self.programWithDepth(")+programParams.join(", ")+")";},register:function(name,val){this.useRegister(name);this.pushSource(name+" = "+val+";");},useRegister:function(name){if(!this.registers[name]){this.registers[name]=true;this.registers.list.push(name);}},pushStackLiteral:function(item){return this.push(new Literal(item));},pushSource:function(source){if(this.pendingContent){this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));this.pendingContent=undefined;}
if(source){this.source.push(source);}},pushStack:function(item){this.flushInline();var stack=this.incrStack();if(item){this.pushSource(stack+" = "+item+";");}
this.compileStack.push(stack);return stack;},replaceStack:function(callback){var prefix='',inline=this.isInline(),stack;if(inline){var top=this.popStack(true);if(top instanceof Literal){stack=top.value;}else{var name=this.stackSlot?this.topStackName():this.incrStack();prefix='('+this.push(name)+' = '+top+'),';stack=this.topStack();}}else{stack=this.topStack();}
var item=callback.call(this,stack);if(inline){if(this.inlineStack.length||this.compileStack.length){this.popStack();}
this.push('('+prefix+item+')');}else{if(!/^stack/.test(stack)){stack=this.nextStack();}
this.pushSource(stack+" = ("+prefix+item+");");}
return stack;},nextStack:function(){return this.pushStack();},incrStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot);}
return this.topStackName();},topStackName:function(){return"stack"+this.stackSlot;},flushInline:function(){var inlineStack=this.inlineStack;if(inlineStack.length){this.inlineStack=[];for(var i=0,len=inlineStack.length;i<len;i++){var entry=inlineStack[i];if(entry instanceof Literal){this.compileStack.push(entry);}else{this.pushStack(entry);}}}},isInline:function(){return this.inlineStack.length;},popStack:function(wrapped){var inline=this.isInline(),item=(inline?this.inlineStack:this.compileStack).pop();if(!wrapped&&(item instanceof Literal)){return item.value;}else{if(!inline){this.stackSlot--;}
return item;}},topStack:function(wrapped){var stack=(this.isInline()?this.inlineStack:this.compileStack),item=stack[stack.length-1];if(!wrapped&&(item instanceof Literal)){return item.value;}else{return item;}},quotedString:function(str){return'"'+str.replace(/\\/g,'\\\\').replace(/"/g,'\\"').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/\u2028/g,'\\u2028').replace(/\u2029/g,'\\u2029')+'"';},setupHelper:function(paramSize,name,missingParams){var params=[];this.setupParams(paramSize,params,missingParams);var foundHelper=this.nameLookup('helpers',name,'helper');return{params:params,name:foundHelper,callParams:["depth0"].concat(params).join(", "),helperMissingParams:missingParams&&["depth0",this.quotedString(name)].concat(params).join(", ")};},setupParams:function(paramSize,params,useRegister){var options=[],contexts=[],types=[],param,inverse,program;options.push("hash:"+this.popStack());inverse=this.popStack();program=this.popStack();if(program||inverse){if(!program){this.context.aliases.self="this";program="self.noop";}
if(!inverse){this.context.aliases.self="this";inverse="self.noop";}
options.push("inverse:"+inverse);options.push("fn:"+program);}
for(var i=0;i<paramSize;i++){param=this.popStack();params.push(param);if(this.options.stringParams){types.push(this.popStack());contexts.push(this.popStack());}}
if(this.options.stringParams){options.push("contexts:["+contexts.join(",")+"]");options.push("types:["+types.join(",")+"]");options.push("hashContexts:hashContexts");options.push("hashTypes:hashTypes");}
if(this.options.data){options.push("data:data");}
options="{"+options.join(",")+"}";if(useRegister){this.register('options',options);params.push('options');}else{params.push(options);}
return params.join(", ");}};var reservedWords=("break else new var"+" case finally return void"+" catch for switch while"+" continue function this with"+" default if throw"+" delete in try"+" do instanceof typeof"+" abstract enum int short"+" boolean export interface static"+" byte extends long super"+" char final native synchronized"+" class float package throws"+" const goto private transient"+" debugger implements protected volatile"+" double import public let yield").split(" ");var compilerWords=JavaScriptCompiler.RESERVED_WORDS={};for(var i=0,l=reservedWords.length;i<l;i++){compilerWords[reservedWords[i]]=true;}
JavaScriptCompiler.isValidJavaScriptVariableName=function(name){if(!JavaScriptCompiler.RESERVED_WORDS[name]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)){return true;}
return false;};__exports__=JavaScriptCompiler;return __exports__;})(__module2__);var __module10__=(function(__dependency1__,__dependency2__,__dependency3__,__dependency4__){"use strict";var __exports__={};var Exception=__dependency1__;var parse=__dependency2__.parse;var JavaScriptCompiler=__dependency3__;var AST=__dependency4__;function Compiler(){}
__exports__.Compiler=Compiler;Compiler.prototype={compiler:Compiler,disassemble:function(){var opcodes=this.opcodes,opcode,out=[],params,param;for(var i=0,l=opcodes.length;i<l;i++){opcode=opcodes[i];if(opcode.opcode==='DECLARE'){out.push("DECLARE "+opcode.name+"="+opcode.value);}else{params=[];for(var j=0;j<opcode.args.length;j++){param=opcode.args[j];if(typeof param==="string"){param="\""+param.replace("\n","\\n")+"\"";}
params.push(param);}
out.push(opcode.opcode+" "+params.join(" "));}}
return out.join("\n");},equals:function(other){var len=this.opcodes.length;if(other.opcodes.length!==len){return false;}
for(var i=0;i<len;i++){var opcode=this.opcodes[i],otherOpcode=other.opcodes[i];if(opcode.opcode!==otherOpcode.opcode||opcode.args.length!==otherOpcode.args.length){return false;}
for(var j=0;j<opcode.args.length;j++){if(opcode.args[j]!==otherOpcode.args[j]){return false;}}}
len=this.children.length;if(other.children.length!==len){return false;}
for(i=0;i<len;i++){if(!this.children[i].equals(other.children[i])){return false;}}
return true;},guid:0,compile:function(program,options){this.opcodes=[];this.children=[];this.depths={list:[]};this.options=options;var knownHelpers=this.options.knownHelpers;this.options.knownHelpers={'helperMissing':true,'blockHelperMissing':true,'each':true,'if':true,'unless':true,'with':true,'log':true};if(knownHelpers){for(var name in knownHelpers){this.options.knownHelpers[name]=knownHelpers[name];}}
return this.accept(program);},accept:function(node){var strip=node.strip||{},ret;if(strip.left){this.opcode('strip');}
ret=this[node.type](node);if(strip.right){this.opcode('strip');}
return ret;},program:function(program){var statements=program.statements;for(var i=0,l=statements.length;i<l;i++){this.accept(statements[i]);}
this.isSimple=l===1;this.depths.list=this.depths.list.sort(function(a,b){return a-b;});return this;},compileProgram:function(program){var result=new this.compiler().compile(program,this.options);var guid=this.guid++,depth;this.usePartial=this.usePartial||result.usePartial;this.children[guid]=result;for(var i=0,l=result.depths.list.length;i<l;i++){depth=result.depths.list[i];if(depth<2){continue;}
else{this.addDepth(depth-1);}}
return guid;},block:function(block){var mustache=block.mustache,program=block.program,inverse=block.inverse;if(program){program=this.compileProgram(program);}
if(inverse){inverse=this.compileProgram(inverse);}
var type=this.classifyMustache(mustache);if(type==="helper"){this.helperMustache(mustache,program,inverse);}else if(type==="simple"){this.simpleMustache(mustache);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('emptyHash');this.opcode('blockValue');}else{this.ambiguousMustache(mustache,program,inverse);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('emptyHash');this.opcode('ambiguousBlockValue');}
this.opcode('append');},hash:function(hash){var pairs=hash.pairs,pair,val;this.opcode('pushHash');for(var i=0,l=pairs.length;i<l;i++){pair=pairs[i];val=pair[1];if(this.options.stringParams){if(val.depth){this.addDepth(val.depth);}
this.opcode('getContext',val.depth||0);this.opcode('pushStringParam',val.stringModeValue,val.type);}else{this.accept(val);}
this.opcode('assignToHash',pair[0]);}
this.opcode('popHash');},partial:function(partial){var partialName=partial.partialName;this.usePartial=true;if(partial.context){this.ID(partial.context);}else{this.opcode('push','depth0');}
this.opcode('invokePartial',partialName.name);this.opcode('append');},content:function(content){this.opcode('appendContent',content.string);},mustache:function(mustache){var options=this.options;var type=this.classifyMustache(mustache);if(type==="simple"){this.simpleMustache(mustache);}else if(type==="helper"){this.helperMustache(mustache);}else{this.ambiguousMustache(mustache);}
if(mustache.escaped&&!options.noEscape){this.opcode('appendEscaped');}else{this.opcode('append');}},ambiguousMustache:function(mustache,program,inverse){var id=mustache.id,name=id.parts[0],isBlock=program!=null||inverse!=null;this.opcode('getContext',id.depth);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);this.opcode('invokeAmbiguous',name,isBlock);},simpleMustache:function(mustache){var id=mustache.id;if(id.type==='DATA'){this.DATA(id);}else if(id.parts.length){this.ID(id);}else{this.addDepth(id.depth);this.opcode('getContext',id.depth);this.opcode('pushContext');}
this.opcode('resolvePossibleLambda');},helperMustache:function(mustache,program,inverse){var params=this.setupFullMustacheParams(mustache,program,inverse),name=mustache.id.parts[0];if(this.options.knownHelpers[name]){this.opcode('invokeKnownHelper',params.length,name);}else if(this.options.knownHelpersOnly){throw new Error("You specified knownHelpersOnly, but used the unknown helper "+name);}else{this.opcode('invokeHelper',params.length,name);}},ID:function(id){this.addDepth(id.depth);this.opcode('getContext',id.depth);var name=id.parts[0];if(!name){this.opcode('pushContext');}else{this.opcode('lookupOnContext',id.parts[0]);}
for(var i=1,l=id.parts.length;i<l;i++){this.opcode('lookup',id.parts[i]);}},DATA:function(data){this.options.data=true;if(data.id.isScoped||data.id.depth){throw new Exception('Scoped data references are not supported: '+data.original);}
this.opcode('lookupData');var parts=data.id.parts;for(var i=0,l=parts.length;i<l;i++){this.opcode('lookup',parts[i]);}},STRING:function(string){this.opcode('pushString',string.string);},INTEGER:function(integer){this.opcode('pushLiteral',integer.integer);},BOOLEAN:function(bool){this.opcode('pushLiteral',bool.bool);},comment:function(){},opcode:function(name){this.opcodes.push({opcode:name,args:[].slice.call(arguments,1)});},declare:function(name,value){this.opcodes.push({opcode:'DECLARE',name:name,value:value});},addDepth:function(depth){if(isNaN(depth)){throw new Error("EWOT");}
if(depth===0){return;}
if(!this.depths[depth]){this.depths[depth]=true;this.depths.list.push(depth);}},classifyMustache:function(mustache){var isHelper=mustache.isHelper;var isEligible=mustache.eligibleHelper;var options=this.options;if(isEligible&&!isHelper){var name=mustache.id.parts[0];if(options.knownHelpers[name]){isHelper=true;}else if(options.knownHelpersOnly){isEligible=false;}}
if(isHelper){return"helper";}
else if(isEligible){return"ambiguous";}
else{return"simple";}},pushParams:function(params){var i=params.length,param;while(i--){param=params[i];if(this.options.stringParams){if(param.depth){this.addDepth(param.depth);}
this.opcode('getContext',param.depth||0);this.opcode('pushStringParam',param.stringModeValue,param.type);}else{this[param.type](param);}}},setupMustacheParams:function(mustache){var params=mustache.params;this.pushParams(params);if(mustache.hash){this.hash(mustache.hash);}else{this.opcode('emptyHash');}
return params;},setupFullMustacheParams:function(mustache,program,inverse){var params=mustache.params;this.pushParams(params);this.opcode('pushProgram',program);this.opcode('pushProgram',inverse);if(mustache.hash){this.hash(mustache.hash);}else{this.opcode('emptyHash');}
return params;}};function precompile(input,options){if(input==null||(typeof input!=='string'&&input.constructor!==AST.ProgramNode)){throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+input);}
options=options||{};if(!('data'in options)){options.data=true;}
var ast=parse(input);var environment=new Compiler().compile(ast,options);return new JavaScriptCompiler().compile(environment,options);}
__exports__.precompile=precompile;function compile(input,options,env){if(input==null||(typeof input!=='string'&&input.constructor!==AST.ProgramNode)){throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+input);}
options=options||{};if(!('data'in options)){options.data=true;}
var compiled;function compileInput(){var ast=parse(input);var environment=new Compiler().compile(ast,options);var templateSpec=new JavaScriptCompiler().compile(environment,options,undefined,true);return env.template(templateSpec);}
return function(context,options){if(!compiled){compiled=compileInput();}
return compiled.call(this,context,options);};}
__exports__.compile=compile;return __exports__;})(__module5__,__module8__,__module11__,__module7__);var __module0__=(function(__dependency1__,__dependency2__,__dependency3__,__dependency4__,__dependency5__){"use strict";var __exports__;var Handlebars=__dependency1__;var AST=__dependency2__;var Parser=__dependency3__.parser;var parse=__dependency3__.parse;var Compiler=__dependency4__.Compiler;var compile=__dependency4__.compile;var precompile=__dependency4__.precompile;var JavaScriptCompiler=__dependency5__;var _create=Handlebars.create;var create=function(){var hb=_create();hb.compile=function(input,options){return compile(input,options,hb);};hb.precompile=precompile;hb.AST=AST;hb.Compiler=Compiler;hb.JavaScriptCompiler=JavaScriptCompiler;hb.Parser=Parser;hb.parse=parse;return hb;};Handlebars=create();Handlebars.create=create;__exports__=Handlebars;return __exports__;})(__module1__,__module7__,__module8__,__module10__,__module11__);return __module0__;})();Handlebars.registerHelper('ifequal',function(lvalue,rvalue,options){if(arguments.length<3)
throw new Error("Handlebars Helper equal needs 2 parameters");if(lvalue!=rvalue){return options.inverse(this);}else{return options.fn(this);}});Handlebars.registerHelper('ifnotequal',function(lvalue,rvalue,options){if(arguments.length<3)
throw new Error("Handlebars Helper equal needs 2 parameters");if(lvalue==rvalue){return options.inverse(this);}else{return options.fn(this);}});Handlebars.registerHelper('lower',function(value){if(value==undefined){return'';}
value=value.toString();try{value=decodeURIComponent(escape(value));}catch(err){}
return value.toLowerCase();});Handlebars.registerHelper("sum",function(lvalue,rvalue){lvalue=parseFloat(lvalue);rvalue=parseFloat(rvalue);return(lvalue+rvalue);});Handlebars.registerHelper('times',function(n,block){var accum='';for(var i=0;i<n;++i)
accum+=block.fn(i,{data:{index:i}});return accum;});Handlebars.registerHelper("setVar",function(varName,varValue,options){if(typeof options.data.root==='undefined'){options.data.root={};}
options.data.root[varName]=varValue;});Handlebars.registerHelper("setArrayVar",function(varName,varArray,arrayIndex,options){var varValue=null;if(typeof varArray[arrayIndex]!=='undefined'){varValue=varArray[arrayIndex];}
if(typeof options.data.root==='undefined'){options.data.root={};}
options.data.root[varName]=varValue;});Handlebars.registerHelper("math",function(lvalue,operator,rvalue,options){lvalue=parseFloat(lvalue);rvalue=parseFloat(rvalue);return{"+":lvalue+rvalue,"-":lvalue-rvalue,"*":lvalue*rvalue,"/":lvalue/rvalue,"%":lvalue%rvalue}[operator];});var searchControl=null;JQ(window).ready(function(){searchControl=new Search_Controller();searchControl.search();});var Search_Controller=function(){return new Tweakwise_Controller();};var Tweakwise_Controller=function(){this._initialise();return this;};Tweakwise_Controller.prototype={tabs:[],activeTab:null,suggestResponse:null,spellCheck:{active:false},orPass:{active:false},_connector:null,_view:null,_errorLog:null,_errorPage:null,_GTM:null,_hashManuallyChanged:0,_requests:0,_searchRedirected:false,_redirectTo:null,search:function(){if(this._isUrlRequest()){return this.searchUrl();}
if(this._isCategoryRequest()||this._hasSearchContainer()){return this.searchCategory();}
debug('No search request found');},searchUrl:function(){var request=new Search_Request(false);try{request.fromUrl(window.location.hash);request.isInitial=true;this.activeTab=request.activeTab;if(request.q!=''){this._rememberSearch(request.q);this._view.setSearchString(request.q);}
this.tabs=[];this._searchProduct(request);}
catch(errorMessage){var error=new Search_Error(errorMessage);error.setRequest(request);this.showError(null,error);}},searchCategory:function(){var request=new Search_Request(false);try{if(window.location.hash!=''){request.fromUrl(window.location.hash);}
this.activeTab=request.activeTab;this.tabs=[];this._searchProduct(request);}
catch(errorMessage){var error=new Search_Error(errorMessage);error.setRequest(request);this.showError(null,error);}},searchBox:function(event){try{event.preventDefault();var searchString=this._view.getSearchString();if(searchString==''||searchString==this._view.getSearchStringPlaceholder()){this._view.focusSearch();return;}
this._rememberSearch(searchString);this._view.clear();var request=new Search_Request(true);request.setSearchString(searchString);if(window.location.pathname.substr(0,5)!=='/zoek'){window.location.href=base_url+'zoek/'+request.getUrl();}
else{hideSaytBox(true);this.tabs=[];this.activeTab=null;this._searchProduct(request);}}
catch(errorMessage){var error=new Search_Error(errorMessage);error.setRequest(request);this.showError(null,error);}
return false;},searchString:function(string){var request=new Search_Request(false);try{request.setSearchString(string);this._view.setSearchString(request.q);this._rememberSearch(request.q);this.tabs=[];this.activeTab=null;this._searchProduct(request);}
catch(errorMessage){var error=new Search_Error(errorMessage);error.setRequest(request);this.showError(null,error);}},handleSearchResult:function(request,result){this._requests--;debug(result);try{if(this._requests<0){throw'Too many search result calls';}
if(result.hasOwnProperty('error')){if(this._requests>0){return;}
throw result.error[0];}
if(!this._searchRedirected){this._view.setTitle(request);}
this._searchRedirected=false;if(this._handleRedirect(request,result)){this._doneLoading();return;}
if(request.getSetting('searchProduct')){this._loadProductTab(request,result);}
else if(request.getSetting('searchContent')){this._loadContentTab(request,result);}
else{throw'Neither product nor content search';}
this._updateTabsOrder();if(request.q!=''&&request.q!=null){this._handleResultType(request,result);}
this._view.show();this._view.setHandlers();this._setActiveTab();}
catch(errorMessage){var error=new Search_Error(errorMessage);error.setRequest(request);this.showError(null,error);}},openTab:function(event){var $li=JQ(event.target).closest('.search__handle'),id=$li.data('tab_id');for(var i=0;i<this.tabs.length;i++){if(this.tabs[i].id==id){this.tabs[i].show(false);this._view.toggleTabs(false);}}},addTab:function(tab){this._view.addTab(tab);},showTab:function(tab,showLoader){this._view.activateTab(tab);this._view.setLoading(tab.id,showLoader);this.activeTab=tab.id;},loadTab:function(request,handleResult,tab){this.showTab(tab,true);this._connector.search(request,handleResult,tab);},setTabContent:function(tab,content){this._view.setLoading(tab.id,false);this._view.setTabContent(tab,content);},timeout:function(){this._view.showLoadingDelay();},getBaseUrl:function(){var baseUrl=window.location.pathname;if(baseUrl.indexOf('pagina_')!=-1){baseUrl=baseUrl.substring(0,baseUrl.indexOf('pagina_'));}
return baseUrl;},prepareUrl:function(url){var preparedUrl=url.replace(/(http|https):\/\/.*\.nl\//,http_or_https);if(preparedUrl.substr(0,4)!=='http'){if(preparedUrl.substr(0,1)=='/'){preparedUrl=preparedUrl.substr(1);}
preparedUrl=base_url+preparedUrl;}
return preparedUrl;},getActiveTab:function(){for(var i=0;i<this.tabs.length;i++){if(this.tabs[i].id==this.activeTab){return this.tabs[i];}}
return null;},scrollToTop:function(){JQ('html, body').stop().animate({scrollTop:JQ('.search__handleContainer').offset().top-JQ('.siteHeader__top').height()},250);},openPopup:function(popup){this._view.openPopup(popup);},closePopup:function(animate){this._view.closePopup(animate);},isPopupActive:function(){return this._view.isPopupActive();},showError:function(tab,error){if(typeof error!='object'){error=new Search_Error(error);}
this._view.showError(tab,error);this.scrollToTop();},getSearchHistory:function(){var history=getCookie("search__history");if(typeof history==='undefined'||history===null){return[];}
try{return JSON.parse(history);}
catch(e){return[];}},manuallyChangeHash:function(){this._hashManuallyChanged++;},redirect:function(newUrl){this._redirectTo=this.prepareUrl(newUrl);},_searchProduct:function(request){this.tabs=[];var productRequest=jQuery.extend(true,{},request);productRequest.setSetting('searchProduct',true);if(this.activeTab!='product'&&this.activeTab!=null){productRequest.setCurrentPage(1);}
this._searchRequest(productRequest);},_searchContent:function(request){var contentRequest=jQuery.extend(true,{},request);contentRequest.setSetting('searchProduct',false);contentRequest.setSetting('searchContent',true);if(this.activeTab!='content'&&this.activeTab!=null){contentRequest.setCurrentPage(1);}
this._searchRequest(contentRequest);},_searchRequest:function(request){if(request.isValid()){this._requests++;this._connector.search(request,this.handleSearchResult,this);}},_setActiveTab:function(){if(this._requests>0){return;}
if(this.tabs.length==0){throw"No tabs found";}
var tab=this._getTabById(this.activeTab);if(tab==null){tab=this.tabs[0];}
tab.show(false);},_updateTabsOrder:function(){if(this.tabs.length<2){return;}
this.tabs.sort(this._compareTabs);},_compareTabs:function(a,b){if(a.id=='product'){return-1;}
if(b.id=='product'){return 1;}
return 0;},_rememberSearch:function(searchString){var searchHistory=this.getSearchHistory(),stringIndex=searchHistory.indexOf(searchString);if(stringIndex>-1){searchHistory.splice(stringIndex,1);}
searchHistory.unshift(searchString);this._saveSearchHistory(searchHistory);},_saveSearchHistory:function(searchHistory){var history=JSON.stringify(searchHistory);setCookie("search__history",history,7,"/");},_handleRedirect:function(request,result){if(result.hasOwnProperty('redirects')&&result.redirects.length>0){let url=this.prepareUrl(decodeURI(result.redirects[0]));if(this._isUrlRequest()&&url.startsWith(base_url+'zoek/')){this._searchRedirected=true;}
else{JQ('.search__message').text('U wordt doorgestuurd naar de volgende pagina');}
this.redirect(decodeURI(result.redirects[0]));return true;}
if(result.hasOwnProperty('searchpass')&&result.searchpass=='local'&&result.items.length==1){this.redirect(decodeURI(result.items[0].product.link));return true;}
return false;},_handleResultType:function(request,result){var resultType=null;this._view.clearMessage();if(!result.hasOwnProperty('searchpass')){return;}
switch(result.searchpass.toUpperCase()){case'SPELL CHECK':var spellCheck={original:result.queryAlternatives[0].original,replacement:result.queryAlternatives[0].value};this._view.setMessage('spell_check',spellCheck);resultType='Fuzzy';break;case'OR':var orPass={original:result.queryAlternatives[0].original,replacements:[]};for(var i=0;i<result.queryAlternatives.length;i++){var alternative=result.queryAlternatives[i];orPass.replacements.push({value:alternative.value,amount:alternative.estimatedResults});}
this._view.setMessage('or_pass',orPass);resultType='Fuzzy';break;case'EXACT':case'PRECISE':case'CONTENT':case'ID':case'FAB_ID_SINGLE':case'FAB_ID_MULTI':case'FAB_ID_PHRASE':resultType='Exact';break;case'LOCAL':resultType='Local';break;default:if(request.getSetting('modificationApplied')){resultType='Modified result';}
else if(this.activeTab!='product'){resultType='Text';}
else{resultType='Exact';}
break;}
this._GTM.resultType(document.URL,resultType);},_handleHashChange:function(event){if(this._hashManuallyChanged>0){this._hashManuallyChanged--;return;}
var request=new Search_Request(this._isUrlRequest());request.fromUrl(window.location.hash);this._view.setSearchString(request.q);if(request.activeTab!=''){this.activeTab=request.activeTab;var tab=this._getTabById(this.activeTab);if(tab===null){this._searchProduct(request);}
else{tab.setRequest(request);tab.show();}}
else{this.searchUrl();}},_getTabById:function(id){for(var i=0;i<this.tabs.length;i++){if(this.tabs[i].id.toLowerCase()==id){return this.tabs[i];}}
return null;},_loadProductTab:function(request,result){if(result.totalItems>0){var tab=new Search_Product_Tab({value:'product',count:result.totalItems},request);tab.setController(this);this.tabs.push(tab);this.addTab(tab);tab._firstSearch=true;tab.handleResult(request,result);}
if(this._isUrlRequest()){this._searchContent(request);}
else{this._doneLoading();}},_loadContentTab:function(request,result){if(result.totalItems==0){this._doneLoading();return;}
var tab=new Search_Content_Tab({value:'content',displayValue:'Informatie',count:result.totalItems},request);tab.setController(this);this.tabs.push(tab);this.addTab(tab);tab._firstSearch=true;tab.handleResult(request,result);this._doneLoading();},_hasSearchContainer:function(){return JQ('.search__container').length>0;},_isCategoryRequest:function(){return(cat1id!=''&&cat2id!='')||cat3title!='';},_isUrlRequest:function(){return window.location.pathname.substr(0,5)==='/zoek';},_doneLoading:function(){if(this._redirectTo!=null){let totalResultCount=0;for(var i in this.tabs){totalResultCount+=this.tabs[i].count;}
if(totalResultCount<=1){this._GTM.resultType(this._redirectTo,'Redirect');window.location.href=this._redirectTo;}}
this._redirectTo=null;},_initialise:function(){this._connector=new Search_Connector(searchType);this._connector.setController(this);this._connector.initialise();this._view=new Search_View();this._view.setController(this);this._view.initialise();this._GTM=new Search_GTM();if(JQ('#search_template_product').length>0){window.addEventListener("hashchange",this._handleHashChange.bind(this),false);this._view.checkFooterVisible();}}};var Search_View=function(){return this;};Search_View.prototype={_controller:null,_searchForm:null,_button:null,_footerVisible:true,initialise:function(){this._registerSearchForm();this._setupTabs();this._loadHandleBars();this._registerHandlers();},clear:function(){JQ('.search__handle, .search__tab').remove();},getSearchString:function(){return this._searchForm.find(":text").val();},getSearchStringPlaceholder:function(){return this._searchForm.find(":text").data('inputplaceholder');},focusSearch:function(){this._searchForm.find(":text").focus();},setSearchString:function(search){this._searchForm.find(":text").val(search);this._searchForm.find('.siteHeader__searchContainer').addClass('siteHeader__searchContainer--filled');},setTitle:function(request){if(!request.getSetting('isCategory')){JQ('.search__container > h1').text(request.getTitle(true));}},clearMessage:function(){JQ('.search__message').html('');},setMessage:function(type,data){this._showFooter();var $container=JQ('.search__message');var html='';switch(type){case'spell_check':html='<p>Er zijn geen resultaten gevonden voor "<span class="search__spellCheck search__spellCheck--original">'+data.original+'</span>". '+'Hieronder ziet u resultaten voor "<span data-value="'+data.replacement+'" class="search__spellCheck search__spellCheck--new">'+data.replacement+'</span>".</p>';break;case'or_pass':var replacements=[];for(var i=0;i<data.replacements.length;i++){replacements.push('"<a data-value="'+data.replacements[i].value+'" class="search__orPass search__orPass--new">'+
data.replacements[i].value+'</a> ('+data.replacements[i].amount+')"');}
var last=replacements.pop(),replacement=(replacements.length>0?replacements.join(', ')+' en ':'')+last;html='<p>Er zijn geen resultaten gevonden voor '+'"<span class="search__orPass search__orPass--original">'+data.original+'</span>". '+'Hieronder ziet u de gecombineerde resultaten voor '+
replacement+'. '+'U kunt op &eacute;&eacute;n van deze resultaten klikken om uw zoekopdracht te verfijnen.</p>';break;}
$container.html(html);bLazy.revalidate();},show:function(){var $ul=JQ('.search__handles');$ul.html('');for(var i=0;i<this._controller.tabs.length;i++){var tab=this._controller.tabs[i],$li=JQ('<li></li>').addClass('search__handle').attr('data-tab_id',tab.id).data('tab_id',tab.id).html(tab.displayName).append('<span class="search__handleCounter">'+tab.count+'</span>');$ul.append($li);}
if(this._controller.tabs.length>2){$ul.append(JQ('<li></li>').addClass('search__handle').addClass('search__handle--mobile').html('<span>Informatie</span> &raquo;'));}},toggleTabs:function(event){this.closePopup(false);var $handles=JQ('.search__handles'),$mobile=$handles.find('.search__handle--mobile');if(typeof event==='boolean'){if(event){$handles.addClass('search__handles--opened');}
else{$handles.removeClass('search__handles--opened');}}
else{$handles.toggleClass('search__handles--opened');}
if($handles.hasClass('search__handles--opened')){$mobile.html('&laquo; <span>Informatie</span>');}
else{$mobile.html('<span>Informatie</span> &raquo;');}},setHandlers:function(){JQ('body').off('click','.search__handle').on('click','.search__handle',this._controller.openTab.bind(this._controller));JQ('body').off('click','.search__handle--mobile').on('click','.search__handle--mobile',this.toggleTabs.bind(this));JQ('body').off('click','.search__orPass--new, .search__spellCheck--new').on('click','.search__orPass--new, .search__spellCheck--new',function(event){this._controller.searchString(JQ(event.target).data('value'));}.bind(this));},setLoading:function(tabId,loading){var $tab=JQ('.search__tab[data-tab_id="'+tabId+'"]');if($tab.length!==0){if(loading){$tab.addClass('search__tab--loading');}
else{$tab.removeClass('search__tab--loading');JQ('.search__loader').removeClass('search__loader--delay');}}},showLoadingDelay:function(){if(JQ('.search__delay').length==0){JQ('.search__loader').append('<span class="search__delay">'
+'Het laden duurt langer dan verwacht, excuses voor het ongemak!'
+'</span>');}
JQ('.search__loader').addClass('search__loader--delay');},addTab:function(tab){var $content=JQ('.search__tab[data-tab_id="'+tab.id+'"]');if($content.length==0){JQ('.search__tab--preload').remove();$content=JQ('<div class="search__tab"></div>').attr('data-tab_id',tab.id).data('tab_id',tab.id).addClass('search__tab--empty').addClass('search__tab--'+tab.tab_type);$content.insertBefore(JQ('.search__loader'));}
return $content;},activateTab:function(tab){JQ('.search__handle--active').removeClass('search__handle--active');JQ('.search__handle[data-tab_id="'+tab.id+'"]').addClass('search__handle--active');JQ('.search__tab--active').removeClass('search__tab--active');var $content=this.addTab(tab);$content.addClass('search__tab--active');bLazy.revalidate();},_setupTabs:function(){JQ('.search__tab').remove();var $emptyTab=JQ('<div class="search__tab search__tab--empty search__tab--preload"></div>');$emptyTab.insertBefore(JQ('.search__loader'));},setTabContent:function(tab,content){this._showFooter();var $tab=JQ('.search__tab[data-tab_id="'+tab.id+'"]');if($tab.length==0){throw"Tab "+tab.id+" does not exist";}
$tab.removeClass('search__tab--empty');$tab.html(content);JQ('.search__handle[data-tab_id="'+tab.id+'"] .search__handleCounter').html(tab.count);bLazy.revalidate();},openPopup:function(popup){this._showFooter();if(this._searchPopup==null){this._searchPopup=new Search_Popup();}
this._searchPopup.open(popup);},closePopup:function(animate){if(this._searchPopup!=null){this._searchPopup.close(animate);}},isPopupActive:function(){return this._searchPopup!=null&&this._searchPopup.isActive();},showError:function(tab,error){var errorTab={id:'error',tab_type:'error',};this.activateTab(errorTab);this.setTabContent(errorTab,error.getView());var $error=JQ('.searchError');$error.find('.searchError__back').click(function(){history.back();});$error.find('.searchError__retry').click();debug(tab);if(tab!==null){JQ('.search__handle[data-tab_id="'+tab.id+'"] .search__handleCounter').html(tab.count);this.setLoading(tab.id,false);}},setController:function(controller){this._controller=controller;},handleViewSizeChange:function(){var tab=this._controller.getActiveTab();if(tab!==null){tab.handleViewSizeChange();}},handleViewPortChange:function(){var tab=this._controller.getActiveTab();if(tab!==null){tab.handleViewPortChange();}},checkFooterVisible:function(){if(JQ(window).scrollTop()>0){JQ('#footer, .product__lastViewed').css('visibility','hidden');this._footerVisible=false;}},_loadHandleBars:function(){Handlebars.registerHelper('mpnclean',function(s){var str=jQuery('<textarea />').html(s).text();return new Handlebars.SafeString(str);});},_registerSearchForm:function(){this._searchForm=JQ('.siteHeader__search > form');this._searchForm.on('submit',this._controller.searchBox.bind(this._controller));this._registerSayt();},_registerSayt:function(){var cx='013937295068413492318:3wnwrixf28m',key='AIzaSyBiFnqdqvdXCqMdrjV6Poh9EcOz9017_As',sayt_params={sayt_description_config:'detailed description(text)',country:'nl',extra_params:{safe:false,crowdBy:'brand:4'},sayt_price_config:null,sayt_max_description_len:32,sayt_max_title_len:32,sayt_max_results:30,sayt_thumb_size:35,sayt_include_attributes:['brand(text)'],sayt_connector:searchType};sayt=saytInitialize(cx,key,sayt_params,'.siteHeader__searchInput');},_registerHandlers:function(){JQ(window).on('viewport_changed',this.handleViewPortChange.bind(this));JQ(window).resize(this.handleViewSizeChange.bind(this));},_showFooter:function(){if(!this._footerVisible){JQ('#footer, .product__lastViewed').css('visibility','visible');this._footerVisible=true;}}};var Search_Popup=function(){this.initialize();return this;};Search_Popup.prototype={active:false,_overlayTemplate:'<div class="searchPopup__overlay"></div>',_slideOptions:{direction:'right'},_slideSpeed:200,initialize:function(){this.unbind_events();this.register_events();JQ('body').append(this._overlayTemplate);},register_events:function(){JQ('body').on('click touchstart','.searchPopup__close, .searchPopup__button, .searchPopup__overlay',function(){this.close(true);}.bind(this));JQ(window).on('viewport_changed',this.reset.bind(this));},unbind_events:function(){JQ('body').off('click','.searchPopup__close');JQ('body').off('click','.searchPopup__overlay');JQ('body').off('click','.searchPopup__button');},open:function(popup){popup.addClass('searchPopup searchPopup--open').show('slide',this._slideOptions,this._slideSpeed);JQ('.searchPopup__overlay').show();JQ('body').addClass('hide_overflow');this.active=true;if(typeof ADLiveChat!=="undefined"){ADLiveChat.hide();}},close:function(animate){if(animate){JQ('.searchPopup').hide('slide',this._slideOptions,this._slideSpeed,function(){JQ(this).removeClass('searchPopup--open');});}
else{JQ('.searchPopup').removeAttr('style').removeClass('searchPopup--open');}
JQ('.searchPopup__overlay').remove();JQ('body').removeClass('hide_overflow');this.active=false;if(typeof ADLiveChat!=="undefined"){ADLiveChat.show();}},reset:function(event,newView){if(newView!=='smartphone'){this.close(false);}},isActive:function(){return this.active==true;}};var Search_Request=function(clean){return new Tweakwise_Request(clean);};var Tweakwise_Request=function(clean){this.initialise(clean);return this;}
Tweakwise_Request.prototype={q:null,activeTab:null,sorting:null,isInitial:false,_type:'default',_settings:{},_filters:{},_hiddenFilters:{},_searchInSearch:[],_paging:{resultsPerPage:null,currentPage:null,},_cat:{},_restrict:{},_fhMap:{'category_level_one_title':false,'category_level_two_title':'category','manufacturer':'categorylevelthreetitle','type':false,'mpn':'manufacturerid'},initialise:function(clean){this.q=null;this.activeTab=null;this.sorting=null;this._settings={searchProduct:false,searchContent:false,rawSearch:false,fullResult:false,modificationApplied:false,isBrand:false,isCategory:false,isShopinshop:false,};this._filters={};this._hiddenFilters={};this._paging={resultsPerPage:this._loadResultsPerPage(),currentPage:1,};if(!clean){this.fromObject({cat:{cat1:{id:cat1id,title:cat1title,},cat2:{id:cat2id,title:cat2title,},cat3:{title:cat3title,},cat4:{title:cat4title,},subcat:{title:catsubtitle,},subsubcat:{title:catsubsubtitle,},},shopinshop:is_shopinshop,category:is_category,brand:is_brand,filter:searchfilter,startPage:searchPage,restrict:{categories:restrict_categories,brands:restrict_brands,products:restrict_products,},});}},getSource:function(){return'tweakwise';},setSearchString:function(search){this.q=search;},fromUrl:function(hash){var urlData=this._parseHash(hash);if(urlData.q!=undefined){this.q=decodeURIComponent(urlData.q);}
if(urlData.category!=undefined){if(!this._cat.hasOwnProperty('cat2')){this._cat.cat2={};}
this._cat.cat2.id=urlData.category;}
if(urlData.restrictBy!=undefined){this._loadFilters(urlData.restrictBy);}
if(urlData.hidden!=undefined){this._loadHiddenFilters(urlData.hidden);}
if(urlData.rankBy!=undefined){this.sorting=urlData.rankBy;}
if(urlData.maxResults!=undefined){this.setResultsPerPage(urlData.maxResults);if(urlData.startIndex!=undefined){this.setCurrentPage(urlData.startIndex);}}
if(urlData.hasOwnProperty('search')&&urlData.search=='content'){this.activeTab='content';this.setSetting('searchContent',true);}
else{this.activeTab='product';this.setSetting('searchProduct',true);}},fromObject:function(object){if(object.hasOwnProperty('cat')){this._cat=object.cat;}
if(object.hasOwnProperty('shopinshop')&&object.shopinshop){this.setSetting('isShopinshop',object.shopinshop);}
if(object.hasOwnProperty('category')&&object.category){this.setSetting('isCategory',object.category);}
if(object.hasOwnProperty('brand')&&object.brand){this.setSetting('isBrand',object.brand);}
if(object.hasOwnProperty('restrict')){this._restrict=object.restrict;}
if(object.hasOwnProperty('startPage')&&object.startPage){this.setCurrentPage(object.startPage);}
if(object.hasOwnProperty('filter')&&object.filter!=''){this.fromUrl(object.filter);}},getTitle:function(complete){if(this._cat.hasOwnProperty('cat4')&&this._cat.cat4.title!=''){return this._cat.cat4.title;}
if(this._cat.hasOwnProperty('cat3')&&this._cat.cat3.title!=''){return this._cat.cat3.title;}
if(this._cat.hasOwnProperty('subsubcat')&&this._cat.subsubcat.title!=''){return this._cat.subsubcat.title;}
if(this._cat.hasOwnProperty('subcat')&&this._cat.subcat.title!=''){return this._cat.subcat.title;}
if(this._cat.hasOwnProperty('cat2')&&this._cat.cat2.title!=''){return this._cat.cat2.title;}
if(this.q!=null){return(complete?'Zoekresultaten voor: ':'')+this.q;}
return'Onbekend';},toString:function(){var base=this._base(),filter=this._filter(),request='?'
+this._text()
+filter
+base.maxResults
+base.startIndex
+(this.sorting!=null?'&rankBy='+this.sorting:'')
+'&userprices='+search_pricingAgreements
+base.customerSegment
+base.time;return request;},getUrl:function(){var base=this._base(),filter=this._encodeSpecialChar(this._filter()),hash='#'
+this._text()
+filter
+base.maxResults
+base.startIndex
+(this.sorting!=null?'&rankBy='+this.sorting:'');return hash.replace(/%5C%2C/g,';');},setUrl:function(){if(this.isInitial){this.isInitial=false;return;}
var newUrl=this.getUrl();if(window.location.hash!=newUrl){searchControl.manuallyChangeHash();window.location.hash=this.getUrl();}},isProductRequest:function(){return!this.getSetting('searchContent');},setFilter:function(name,type,value,invert){if(name=='categorie'){this._cat=JQ.extend(true,this._cat,{cat2:{id:value.toString()}});}
else if(value==null||value==false){delete this._filters[name];}
else{this._filters[name]={value:(typeof value=='string'?value.toLowerCase():value.toString()),invert:invert};}
this.setCurrentPage(1);},getFilter:function(name){if(this._filters.hasOwnProperty(name)){return this._filters[name];}
return null;},clearFilters:function(){this._filters={};},isBaseFilter:function(filter){for(var prop in this._filters){if(prop==filter||(prop=='categorylevelonetitle'&&this._cat.hasOwnProperty('cat1')&&this._cat.cat1.id==this._filters[prop].value)||(prop=='categoryleveltwotitle'&&this._cat.hasOwnProperty('cat2')&&this._cat.cat2.id==this._filters[prop].value)){continue;}
return false;}
return true;},setResultsPerPage:function(resultsPerPage){this._paging.resultsPerPage=resultsPerPage;this._saveResultsPerPage(resultsPerPage);},getResultsPerPage:function(){return this._paging.resultsPerPage;},setCurrentPage:function(page){this._paging.currentPage=Math.max(1,page);},getCurrentPage:function(){return parseInt(this._paging.currentPage);},getSearchInSearch:function(){return this.q;},setSearchInSearch:function(value){this.q=value;},setSetting:function(setting,value){this.getSetting(setting);this._settings[setting]=value;},getSetting:function(setting){if(!this._settings.hasOwnProperty(setting)){throw'Setting '+setting+' does not exist';}
return this._settings[setting];},hasRestriction:function(type){if(type=='cat'){return this._restrict.hasOwnProperty('categories')&&this._restrict.categories!='';}
if(type=='brand'){return this._restrict.hasOwnProperty('brands')&&this._restrict.brands!='';}},prepareUrl:function(url){return url.replace(/(http|https):\/\/.*\.nl\//,http_or_https);},define:function(){var list='search';if(this._cat.hasOwnProperty('cat1')&&this._cat.cat1.title!=''){list=this._cat.cat1.title;if(this._cat.hasOwnProperty('cat2')&&this._cat.cat2.title!=''){list=list+' - '+this._cat.cat2.title;if(this._cat.hasOwnProperty('cat3')&&this._cat.cat3.title!=''){list=list+' - '+this._cat.cat3.title;if(this._cat.hasOwnProperty('cat4')&&this._cat.cat4.title!=''){list=list+' - '+this._cat.cat4.title;}}
if(this._cat.hasOwnProperty('subcat')&&this._cat.subcat.title!=''){list=list+' - '+this._cat.subcat.title;if(this._cat.hasOwnProperty('subsubcat')&&this._cat.subsubcat.title!=''){list=list+' - '+this._cat.subsubcat.title;}}}}
else if(this._cat.hasOwnProperty('cat3')&&this._cat.cat3.title!=''){list=this._cat.cat3.title;}
return list;},isValid:function(){if(this.isProductRequest()){return true;}
return this.q!==null&&this.q!=='';},_loadFilters:function(restrictBy){this._filters={};for(var i=0;i<restrictBy.length;i++){var restrict_parts=restrictBy[i].split('=');if(restrict_parts.length>=2){var name_parts=restrict_parts[0].split('('),name=name_parts[0].replace(/\./,'_dot_'),value=restrict_parts[1],lastNamePart=name_parts[name_parts.length-1];if(lastNamePart.charAt(lastNamePart.length-1)==='!'){lastNamePart=lastNamePart.substr(0,lastNamePart.length-1);}
if(typeof name_parts[1]==='undefined'){name=lastNamePart;}
name=this._convertFHName(name);value=this._convertFHValue(value);if(name==false){continue;}
if(name=='category'){this._cat.cat2.id=value;continue;}
this.setFilter(name,'',value,false);}}},_loadHiddenFilters:function(restrictBy){this._hiddenFilters={};for(var i=0;i<restrictBy.length;i++){var restrict_parts=restrictBy[i].split('=');if(restrict_parts.length>=2){var name_parts=restrict_parts[0].split('('),name=name_parts[0].replace(/\./,'_dot_'),value=restrict_parts[1],lastNamePart=name_parts[name_parts.length-1];if(lastNamePart.charAt(lastNamePart.length-1)==='!'){lastNamePart=lastNamePart.substr(0,lastNamePart.length-1);}
if(typeof name_parts[1]==='undefined'){name=lastNamePart;}
this._hiddenFilters[name]={value:(typeof value=='string'?value.toLowerCase():value.toString())};}}
debug(this._hiddenFilters);},_convertFHName:function(name){if(this._fhMap.hasOwnProperty(name)){return this._fhMap[name];}
return name;},_convertFHValue:function(value){return value.replace(/\[([0-9.]+)\,([0-9.]+)\)/i,"$1-$2");},_base:function(){var time='',maxResults='&maxResults='+this._paging.resultsPerPage,startIndex='&startIndex='+this._paging.currentPage;var customerSegment="";if(getCookie("cs")!=undefined){var cs=parseInt(getCookie("cs"));if(!isNaN(cs)){customerSegment="&cs="+cs;}}
return{time:time,maxResults:maxResults,startIndex:startIndex,customerSegment:customerSegment};},_text:function(){var type='product',search=this.q;if(search==null){search='';}
if(this.getSetting('searchContent')){type='content';}
return'q='
+encodeURIComponent(search).replace('%2F','/')
+'&search='+type;},_filter:function(){var filters=[],hiddenFilters=[],category=null;JQ.each(this._filters,function(name,data){name=name.replace(/_dot_/,'.');var filter_string=name
+(data.invert==true?'!=':'=')+this._filterValue(data.value);filters.push(filter_string);}.bind(this));JQ.each(this._hiddenFilters,function(name,data){name=name.replace(/_dot_/,'.');var filter_string=name
+(data.invert==true?'!=':'=')+this._filterValue(data.value);hiddenFilters.push(filter_string);}.bind(this));if(this._cat.hasOwnProperty('cat2')&&this._cat.cat2.id!=''){category=this._cat.cat2.id;}
if(this._restrict.hasOwnProperty('categories')&&this._restrict.categories!=''&&category==null){category=this._restrict.categories;}
var cat_filter=this._catFilter(filters);for(var i=0;i<cat_filter.length;i++){filters.push(cat_filter[i]);}
var restrict_filter=this._restrictFilter(filters);for(var i=0;i<restrict_filter.length;i++){filters.push(restrict_filter[i]);}
var filter_string=filters.join(',');if(filter_string!=''){filter_string='&restrictBy='+filter_string;}
if(category!==null){category=category.replace(/\|/g,'-');filter_string='&category='+category+filter_string;}
if(hiddenFilters.length>0){filter_string=filter_string+'&hidden='+hiddenFilters.join(',');}
return filter_string;},_filterValue:function(value){if(value.substr(0,1)=='['&&value.substr(value.length-1)==')'){return value;}
return this._escapeString(value);},_catFilter:function(currentFilters){var filters=[];if(this._cat.hasOwnProperty('cat3')&&this._cat.cat3.title!=''&&!this._hasFilter(currentFilters,'categorylevelthreetitle')){filters.push('categorylevelthreetitle='+this._escapeString(this._cat.cat3.title));}
if(this._cat.hasOwnProperty('cat4')&&this._cat.cat4.title!=''&&!this._hasFilter(currentFilters,'categorylevelfourtitle')){filters.push('categorylevelfourtitle='+this._escapeString(this._cat.cat4.title));}
return filters;},_restrictFilter:function(currentFilters){var filters=[];if(this._restrict.hasOwnProperty('brands')&&this._restrict.brands!=''&&!this._hasFilter(currentFilters,'categorylevelthreetitle')){filters.push('categorylevelthreetitle='+this._escapeString(this._restrict.brands));}
if(this._restrict.hasOwnProperty('products')&&this._restrict.products!=''&&!this._hasFilter(currentFilters,'manufacturerid')){filters.push('manufacturerid='+this._escapeString(this._restrict.products));}
return filters;},_hasFilter:function(filters,name){for(var i=0;i<filters.length;i++){if(filters[i].indexOf(name)>-1){return true;}}
return false;},_parseHash:function(hash){var hashParts=hash.substr(1).split('&'),data={};for(var i=0;i<hashParts.length;i++){var dataParts=hashParts[i].split('=');this._decodeParts(dataParts);if(dataParts.length==2){data[dataParts[0]]=dataParts[1];}
else if(dataParts.length>2){var restrictByString=this._encodeRangeKomma(hashParts[i].substr(dataParts[0].length+1)),restrictByParts=restrictByString.split(',');this._decodeParts(restrictByParts);this._decodeRangeKomma(restrictByParts);data[dataParts[0]]=restrictByParts;}}
return data;},_encodeRangeKomma:function(string){for(var i=0;i<string.length;i++){if(string.charAt(i)===','){if(string.charAt(i+1)!==''){if(string.charAt(i+1)==='*'||!isNaN(parseFloat(string.charAt(i+1)))){string=string.substr(0,i)+'_COMMA_'+string.substr(i+1);}}}}
return string;},_decodeRangeKomma:function(dataParts){dataParts.forEach(function(v,i){dataParts[i]=v.replace(/_COMMA_/,',');}.bind(this));},_decodeParts:function(dataParts){dataParts.forEach(function(v,i){dataParts[i]=decodeURIComponent(this._decodeSpecialChar(v));}.bind(this));},_decodeSpecialChar:function(hash){return hash.replace(/_AMP_/g,'&').replace(/_FSLASH_/g,'/').replace(/_BRO_/g,'(').replace(/_BRC_/g,')').replace('%3D','=').replace(/%5c%2c/g,',').replace(/%2c/g,',');},_escapeString:function(string){var parts=string.split('|');for(var i=0;i<parts.length;i++){var word=parts[i].replace(/&amp;/g,'&').replace(/\\/g,'\\\\').replace(/\=/g,'\\=').replace(/,/g,'\\,');parts[i]=encodeURIComponent(word);}
return parts.join('|');},_encodeSpecialChar:function(string){return string.replace(/%26/g,'_AMP_').replace(/%5C\//g,'_FSLASH_').replace(/%5C%28/g,'_BRO_').replace(/%5C%29/g,'_BRC_');},_loadResultsPerPage:function(){var resultsPerPage=getCookie("search__ResultsPerPage");if(resultsPerPage==undefined){resultsPerPage='30';}
return parseInt(resultsPerPage);},_saveResultsPerPage:function(resultsPerPage){debug(resultsPerPage);setCookie("search__ResultsPerPage",resultsPerPage,7,"/");}};var Search_Connector=function(type){this.type=(type=='tweakwise'?type:'fredhopper');return this;};Search_Connector.prototype={search_url:{product:null,content:null},search_username:null,search_signature:null,timer:null,timeout:{timer:3000,error:20000,},type:null,_controller:null,initialise:function(){this.search_url.product=search_url_product;this.search_url.content=search_url_content;if(search_username!=undefined&&search_username!=''){this.search_username=search_username;this.search_signature=search_signature;}},search:function(request,handleResult,invoker){request.setUrl();var search_url=request.isProductRequest()?this.search_url.product:this.search_url.content,url=search_url+request.toString();if(this.search_username!=null){url=url
+'&From='+encodeURIComponent(this.search_username)
+'&Authorization='+encodeURIComponent(this.search_signature);}
if(this.type=='tweakwise'){url=url+'&connector=tweakwise';}
this.timer=setTimeout(this._controller.timeout.bind(this._controller),this.timeout.timer);debug(url);JQ.ajax({type:'GET',url:url,async:true,cache:true,contentType:"application/json",dataType:'jsonp',beforeSend:this._setHeader.bind(this),success:function(result){clearTimeout(this.timer);handleResult.apply(invoker,[request,result.result]);}.bind(this),timeout:this.timeout.error,error:function(errorMessage){clearTimeout(this.timer);debug(errorMessage);var error=new Search_Error('request failed');this._controller.showError(error);}.bind(this)});},setController:function(controller){this._controller=controller;},_setHeader:function(request){if("setRequestHeader"in request){request.setRequestHeader("Accept-Encoding","gzip, deflate");if(this.search_username!=undefined){request.setRequestHeader("From",this.search_username);request.setRequestHeader("Authorization",this.search_signature);}}
return request;}};var Search_GTM=function(){return this;};Search_GTM.prototype={resultType:function(action,label){this._pushAction('ResultType','ResultType',action,label);},send:function(data){this._push(data);},sendAction:function(event,action,label){this._pushAction(event,event,action,label);},sendProductClick:function(product,list){var callback=null;if(lastClick==null||lastClick=='left'){callback=function(){document.location=url;};}
var data={currencyCode:'EUR',click:{actionField:{list:list},products:[{id:product.id,name:product.title,brand:product.brand,category:product.cat2,price:this._parsePrice(product.price,false),list:list,position:product.index}]}};this._pushEE(data,callback,'productClick');},sendProductAdd:function(product,amount){var data={currencyCode:'EUR',add:{products:[{id:product.id,name:product.title,brand:product.brand,category:product.cat2,price:this._parsePrice(product.price,false),quantity:amount,position:product.index}]}};this._pushEE(data,null,'addToCart');},sendProductRemove:function(product,amount){var data={currencyCode:'EUR',remove:{products:[{id:product.id,name:product.title,brand:product.brand,category:product.cat2,price:this._parsePrice(product.price,false),quantity:amount,position:product.index}]}};this._pushEE(data,null,'removeFromCart');},personalizedSearch:function(){if(typeof search_username!=='undefined'){this.sendAction('personalisedSearch','Search','Groep '+get_user_group(search_username));}},_pushAction:function(event,category,action,label){this._push({event:event,eventCategory:category,eventAction:action,eventLabel:label});},_pushEE:function(ecommerce,callback,event){var data={event:event,ecommerce:ecommerce};if(callback!=null){data['eventCallback']=callback;}
this._push(data);},_push:function(data){if(typeof dataLayer!=="undefined"){dataLayer.push(data);}},_parsePrice:function(price,eurPrice){if(eurPrice==undefined){eurPrice=false;}
if(eurPrice){price=price.replace('.','').replace(',','.');}
if(price.indexOf('.-')>-1){price=price.replace('.-','.00');}
return price;}};var Search_Error=function(error){this.initialise(error);return this;};Search_Error.prototype={type:'error',reason:null,_template:null,initialise:function(error){this._setError(error);},getView:function(){this._setView();var html=this._template(this);return html;},setRequest:function(request){var search=request.define(),searchInSearch=null;if(request.q!=''&&request.q!=null){search=request.q;}
if(search=='search'){search="Alle producten";}
if(request._searchInSearch.length>0){searchInSearch=request._searchInSearch.join(', ');}
this.setReason(search,searchInSearch);},setReason:function(search,searchInSearch){this.reason='"<span class="searchError__highlight">'+search+'</span>"';if(searchInSearch!=null){this.reason='"<span class="searchError__highlight">'+searchInSearch+'</span>" binnen '+this.reason;}},_setError:function(error){if(error=='No items were found'||error=='No tabs found'){this.type='zero_results';}
else if(error=='request failed'){logError('SearchEngine',{error:'Request failed',errorMessage:error,url:window.location.pathname});}
else if(error=='user_input'){this.type='user_input';}
else{var errorMessage=(error!=undefined?error.toString():error);logError('SearchEngine',{error:'Script error',errorMessage:errorMessage,search:window.location.pathname});}},_setView:function(){if(JQ('#search_template_error').length==0){throw"Can't find content template";}
var templateString=JQ('#search_template_error').html();this._template=Handlebars.compile(templateString);},};var Search_Product_Tab=function(info,request){this.initialise(info,request);return this;};Search_Product_Tab.prototype={id:null,displayName:'IT-producten',count:null,products:[],sort:'relevancy:descending',sorting_options:[{'id':'relevancy:descending','name':'Relevantie'},{'id':'price:ascending','name':'Prijs laag-hoog'},{'id':'price:descending','name':'Prijs hoog-laag'},{'id':'stock:descending','name':'Voorraad'},{'id':'brand:ascending','name':'Merk'},{'id':'ordercount:descending','name':'Meest verkocht'},],resultsPerPage_options:[15,30,60,120,210],displayMode:null,tab_type:'product',_loaded:false,_loading:false,_redirected:false,_request:null,_controller:null,_filters:null,_template:null,_GTM:null,_firstSearch:false,_filterPosition:null,_facetPosition:null,_baseUrl:null,_favorites:[],initialise:function(info,request){this.id=info.value;this.count=info.count;this.setRequest(request);this._setView();this.displayMode=this._loadDisplayMode();this._GTM=new Search_GTM();this._favorites=favorite_products.split('|');debug(this);},show:function(firstSearch){if(!this._loaded&&!this._loading){if(firstSearch){this._firstSearch=true;}
this._load();}
else if(!this._redirected){this._request.setUrl();this._controller.showTab(this,false);this._updateView();}},getFilters:function(){return this._filters.getActiveFacets();},hasFilters:function(){return this._filters.getActiveFacets().length>Search_Filters.prototype.maxExtended;},getSearchInSearch:function(){if(searchType=='tweakwise'&&!this._request.getSetting('isCategory')&&!this._request.getSetting('isBrand')){return[];}
return this._filters.getSearchInSearch();},getQuickFilters:function(){return this._filters.getQuickFilters();},hasQuickFilters:function(){var filters=this.getQuickFilters();return filters.length>0;},getPaging:function(){var currentPage=this._request.getCurrentPage(),maxPages=this._maxPages();var paging=[],middlePoint;if(currentPage-2>1){paging.push({title:1,link:true,active:false});middlePoint=Math.ceil((currentPage-3)/2)+1;if(middlePoint>2){paging.push({title:'..',link:false,active:false});}
if(middlePoint<currentPage-2){paging.push({title:middlePoint,link:true,active:false});if(middlePoint<currentPage-3){paging.push({title:'..',link:false,active:false});}}}
if(currentPage-2>0){paging.push({title:currentPage-2,link:true,active:false});}
if(currentPage-1>0){paging.push({title:currentPage-1,link:true,active:false});}
paging.push({title:currentPage,link:true,active:true});if(currentPage+1<=maxPages){paging.push({title:currentPage+1,link:true,active:false});}
if(currentPage+2<=maxPages){paging.push({title:currentPage+2,link:true,active:false});}
if(currentPage+2<maxPages){middlePoint=Math.floor((maxPages-(currentPage+2))/2)+currentPage+2;if(middlePoint>currentPage+2){if(middlePoint>currentPage+3){paging.push({title:'..',link:false,active:false});}
paging.push({title:middlePoint,link:true,active:false});}
if(middlePoint<maxPages-1){paging.push({title:'..',link:false,active:false});}
paging.push({title:maxPages,link:true,active:false});}
for(var i=0;i<paging.length;i++){paging[i].baseUrl=this._baseUrl;}
return paging;},hasPreviousPage:function(){return this.previousPage()>0;},previousPage:function(){return this._request.getCurrentPage()-1;},hasNextPage:function(){return this.nextPage()<=this._maxPages();},nextPage:function(){return this._request.getCurrentPage()+1;},handleProductOrder:function(productId,add){var product=this._getProduct(productId);if(typeof product.id!=='undefined'){if(add===false){subtractProductFromShoppingCart(product.id,true);this._GTM.sendProductRemove(product,1);}
else{productInshoppingcart(product.id,false,product.price,true);this._GTM.sendProductAdd(product,1);}}},updateProductAmounts:function(){for(var i=0;i<this.products.length;i++){if((productInfo=headerCart.getProduct(this.products[i].id))==null){productInfo={amount:0};}
var product=this.products[i],$product=JQ('.search__tab[data-tab_id="'+this.id+'"] .searchProducts__product[data-product="'+product.id+'"]');$product.find('.searchProducts__buyCounter').val(productInfo.amount);if(productInfo.amount>0){this._showProductAmount($product,product.id);}
else{$product.removeClass('searchProducts__product--added');}}},handleBuyButton:function(event){event.preventDefault();var productId=JQ(event.target).closest('.searchProducts__buyButton').attr('data-id'),$product=JQ(event.target).closest('.searchProducts__product');this._showProductAmount($product,productId);this.handleProductOrder(productId,1);},handleProductClick:function(event){var $product=JQ(event.target).closest('.searchProducts__product');this._sendProductClick($product.data('product'));},handleProductMouseEnter:function(event){var $product=JQ(event.target).closest('.searchProducts__product'),$link=JQ(event.target).closest('.searchProducts__figure');this._createProxyLink($link,$product.data('product'));},handleSorting:function(event){var sorting=JQ(event.target).closest('.searchDisplay__sorting').val(),found=false;for(var i in this.sorting_options){if(this.sorting_options[i].id==sorting){found=true;}}
if(!found){sorting=this.sorting_options[0].id;}
this._request.sorting=sorting;this._controller.loadTab(this._request,this.handleResult,this);},handleMobileSorting:function(event){var sorting=JQ(event.target).closest('.formInput').find('input').val(),found=false;for(var i in this.sorting_options){if(this.sorting_options[i].id==sorting){found=true;}}
if(!found){sorting=this.sorting_options[0].id;}
this._request.sorting=sorting;this._controller.loadTab(this._request,this.handleResult,this);this._controller.closePopup(true);},handleResultsPerPage:function(event){var resultsPerPage=JQ(event.target).closest('.searchDisplay__resultsPerPage select').val();if(!JQ.inArray(resultsPerPage,this.resultsPerPage_options)){resultsPerPage=this.resultsPerPage_options[0];}
this._request.setResultsPerPage(resultsPerPage);var maxPages=Math.ceil(this.count/resultsPerPage);if(this._request.getCurrentPage()>maxPages){this._request.setCurrentPage(maxPages);}
this._controller.loadTab(this._request,this.handleResult,this);},handleViewOption:function(event){event.preventDefault();var mode=JQ(event.target).closest('.searchDisplay__viewOption').hasClass('searchDisplay__viewOption--tiles')?1:0;this.handleViewClick(mode);JQ('.searchProducts').removeClass('searchProducts--tiles').removeClass('searchProducts--lines').addClass('searchProducts--'+(mode==1?'tiles':'lines'));this._updateView();},handlePageClick:function(event){event.preventDefault();var page=JQ(event.target).attr('data-page');if(page<=0||page>this._maxPages()){page=1;}
this._request.setCurrentPage(page);this._controller.loadTab(this._request,this.handleResult,this);this._controller.scrollToTop();},handleViewClick:function(mode){this._saveDisplayMode(mode);this.displayMode=mode;},handleMobilePopup:function(){this._controller.openPopup(JQ('.searchDisplay__mobileSorting'));},handleViewSizeChange:function(){this._updateProductTiles();},handleViewPortChange:function(){this._updateProductTiles();this._updateUSPS();},handleResult:function(request,result){debug(result);this._loading=false;this._loaded=true;this._request=request;try{this.count=0;if(result.hasOwnProperty('error')){throw result.error[0];}
else{this._handleRedirect(result);this._handleResultModifications(result);this.count=result.totalItems;this._setProducts(result.items);this._setFilters(result.facets);if(result.hasOwnProperty('sorting')){this._setSorting(result.sorting);}
this.sort=this._request.sorting!==null?this._request.sorting:'relevancy:descending';this.resultsPerPage=this._request.getResultsPerPage();this._sendGTM();}
this._show();this.updateProductAmounts();}
catch(error){this._displayError(error);}},toString:function(){return this.displayName+' ('+this.count+')';},setController:function(controller){this._controller=controller;this._baseUrl=this._controller.getBaseUrl();},setRequest:function(request){this._loaded=false;this._request=JQ.extend(true,{},request);},setFilter:function(name,type,value,invert){if(!invert&&this._checkFilterRedirect(name,value)){return this._controller.showTab(this,true);}
this._request.setFilter(name,type,value,invert);this._storeFacetPosition(name);if(name=='categorie'){this._filters=null;}
this._controller.loadTab(this._request,this.handleResult,this);},clearFilters:function(){this._request.clearFilters();this._controller.loadTab(this._request,this.handleResult,this);},getRequest:function(){return this._request;},getRequestValue:function(name){return this._request.getFilter(name);},updateSearchInSearch:function(value){this._request.setSearchInSearch(value);this._controller.loadTab(this._request,this.handleResult,this);},openPopup:function(popup){this._controller.openPopup(popup);},closePopup:function(animate){this._controller.closePopup(animate);},isPopupActive:function(){return this._controller.isPopupActive();},isFavoriteProduct:function(productId){return this._favorites.indexOf(""+productId)>=0;},_show:function(){var html=this._template(this);this._storeFilterPosition();this._controller.setTabContent(this,html);this._setHandlers();this._filters.setHandlers();this._updateView();this._setFilterPosition();},_setHandlers:function(){this._registerHandlers();JQ(window).trigger('compare:init');},_updateView:function(){this._updateProductTiles();this._updateUSPS();this._checkAutoScroll();this._filters._setupSliders();},_updateProductTiles:function(){var checks=['.searchProducts__title','.searchProducts__features','.searchProducts__mpn','.searchProducts__text--stock'];JQ(checks.join(', ')).css('height','auto');if(!JQ('.searchProducts').hasClass('searchProducts--tiles')||breakpoint.isMobile()){return false;}
var maxHeights={},items={},itemsInRow=breakpoint.isTablet()?2:3,itemsCount=1,arrayCount=0,products=JQ('.searchProducts__product'),amountProducts=products.length;for(var i in checks){maxHeights[checks[i]]=[];items[checks[i]]=[];}
products.each(function(index,element){for(var i in checks){var className=checks[i],$item=JQ(this).find(className),itemHeight=$item.outerHeight();maxHeights[className]=Math.max(itemHeight,maxHeights[className]);items[className][arrayCount]=$item;}
if(itemsCount>=itemsInRow||index==amountProducts-1){for(var i in checks){var className=checks[i];JQ.each(items[className],function(key,$object){$object.css({'height':maxHeights[className]});});maxHeights[className]=[];items[className]=[];}
itemsCount=0;arrayCount=-1;}
itemsCount++;arrayCount++;});},_updateUSPS:function(){JQ('.searchProducts__usps--clone').remove();var treshold=(JQ('.searchProducts').hasClass('searchProducts--tiles')&&!breakpoint.isMobile())?(breakpoint.isTablet()?4:6):3;products=JQ('.searchProducts__product'),$uspTemplate=JQ('.searchProducts__usps');if(products.length>=treshold){products.each(function(index,element){if((index+1)%treshold==0){this._addUSPLine(JQ(element).closest('li'));}}.bind(this));}
else{this._addUSPLine(JQ(products[products.length-1]).closest('li'));}},_addUSPLine:function($li){var $uspClone=$uspTemplate.clone(true).addClass('searchProducts__usps--clone');$uspClone.insertAfter($li);},_checkAutoScroll:function(){if(breakpoint.isMobile()||JQ('.searchProducts__list > li:not(.searchProducts__usps)').length==0){return;}
var $lastItem=JQ('.searchProducts__list > li:last'),lastPosition=$lastItem.offset().top+$lastItem.outerHeight(true),$firstItem=JQ('.searchProducts__list > li:nth-child(2)'),firstPosition=$firstItem.offset().top,scrollPosition=JQ(window).scrollTop(),scrollBottom=scrollPosition+JQ(window).height();if(lastPosition<scrollPosition){this._createScrollNotification();}},_createScrollNotification:function(){var amountProducts=this.products.length,products=amountProducts>1?('zijn <strong>'+amountProducts+'</strong> producten'):('is <strong>'+amountProducts+'</strong> product'),$notification=JQ('<div class="searchProducts__scroll">'+'<span>Er '+products+' gevonden.</span>'+'</div>'),$message=JQ('<a class="cta__button">Naar boven scrollen</a>');$notification.append($message);JQ('body').append($notification);JQ('.searchProducts__scroll').css({top:(JQ('.siteHeader__top').height()+20),left:(JQ('.searchFilters').offset().left+JQ('.searchFilters').width()+15)});JQ('.searchProducts__scroll').fadeIn(500);$message.click(function(event){event.preventDefault();this._removeScrollNotification.bind(this);this._controller.scrollToTop();}.bind(this));setTimeout(function(){JQ(window).one('scroll',this._removeScrollNotification.bind(this));}.bind(this),100);},_removeScrollNotification:function(){JQ('.searchProducts__scroll').fadeOut(500,function(){JQ('.searchProducts__scroll').remove();});},_registerHandlers:function(){var $tab=JQ('.search__tab[data-tab_id="'+this.id+'"]');JQ('.searchProducts__buy .searchProducts__buyButton').click(this.handleBuyButton.bind(this));JQ('.searchProducts__title, .searchProducts__figure').click(this.handleProductClick.bind(this));JQ('.searchProducts__figure').mouseenter(this.handleProductMouseEnter.bind(this));$tab.find('.searchDisplay__sorting').change(this.handleSorting.bind(this));$tab.find('.searchDisplay__mobileSorting input').click(this.handleMobileSorting.bind(this));$tab.find('.searchDisplay__resultsPerPage').change(this.handleResultsPerPage.bind(this));$tab.find('.searchDisplay__viewOption').click(this.handleViewOption.bind(this));$tab.find('.searchDisplay__pageOption *').click(this.handlePageClick.bind(this));$tab.find('.searchDisplay__button.searchMobile__button').click(this.handleMobilePopup.bind(this));JQ(window).off('cart_updated').on('cart_updated',this.updateProductAmounts.bind(this));},_showProductAmount:function($product,productId){$product.addClass('searchProducts__product--added');$product.find('.searchProducts__buyAmount').off('click').click(function(event){var add=JQ(event.target).closest('.searchProducts__buyAmount').hasClass('searchProducts__buyAmount--add'),$counter=$product.find('.searchProducts__buyCounter'),amount=parseInt($counter.val()),newAmount=(add?(amount+1):(amount-1));if(newAmount==0){$product.removeClass('searchProducts__product--added');$product.find('.searchProducts__buyAmount').unbind('click');}
else{$counter.val(newAmount);}
this.handleProductOrder(productId,add);}.bind(this));},_maxPages:function(){return Math.ceil(this.count/this.resultsPerPage);},_getProduct:function(productId){for(var i in this.products){if(this.products[i].id==productId){return this.products[i];}}
return{};},_setProducts:function(items){if(items.length==0){throw'No items were found';}
this.products=[];for(var i=0;i<items.length;i++){var product=new Search_Product(items[i].product,this);product.index=((this._request.getCurrentPage()-1)*this._request.getResultsPerPage())+i+1;this.products.push(product);}},_setFilters:function(facets){if(this._filters==null){this._filters=new Search_Filters(facets,this);}
else{this._filters.updateFacets(facets);}},_setSorting:function(sorting){this.sorting_options=[];for(var i=0;i<sorting.length;i++){var option=sorting[i];this.sorting_options.push({id:option.title,name:option.displayTitle});}},_handleRedirect:function(result){if(result.hasOwnProperty('redirects')&&result.redirects.length>0){this._controller.redirect(decodeURI(result.redirects[0]));return;}
if(result.totalItems>1||!this._firstSearch||this._request.q==null||this._request.q==""){return;}
if(result.hasOwnProperty('searchpass')){switch(result.searchpass.toUpperCase()){case'EXACT':case'ID':case'FAB_ID_SINGLE':case'FAB_ID_PHRASE':case'LOCAL':break;default:return;break;}}
this._controller.redirect(decodeURI(result.items[0].product.link));},_handleResultModifications:function(result){if(!result.hasOwnProperty('modifications')||result.modifications.modificationapplied!=true||!result.modifications.hasOwnProperty('modified_parts')){return;}
var parts=result.modifications.modified_parts;for(var key in parts){if(!parts.hasOwnProperty(key)){continue;}
var part=parts[key];if(part.gcs_case=='range'){part.gcs_case='float';part.parts=['['+part.parts[0]+','+part.parts[1]+')'];}
this._request.setFilter(key,part.gcs_case,part.parts.join('|'));}
this._request.setSetting('modificationApplied',true);this._request.q=result.modifications.text.replace(/\\u0020/g,' ').replace(/\\u002d/g,'-');},_setView:function(){if(JQ('#search_template_product').length==0){throw"Can't find product template";}
var templateString=JQ('#search_template_product').html();this._template=Handlebars.compile(templateString);},_load:function(){debug('Start loading tab '+this.displayName);this._loading=true;this._filters=null;this._request.activeTab=this.id;this._controller.loadTab(this._request,this.handleResult,this);this._removeScrollNotification();},_loadDisplayMode:function(){var mode=getCookie("search__DisplayMode");if(typeof mode==='undefined'||mode==null){mode=default_display_mode;this._saveDisplayMode(mode);}
return mode;},_saveDisplayMode:function(mode){debug(mode);setCookie("search__DisplayMode",mode,7,"/");},_displayError:function(errorMessage){var error=new Search_Error(errorMessage);if(error.type=='zero_results'){error.setRequest(this._request);}
this._controller.showError(this,error);},_createProxyLink:function($link,productId){var product=this._getProduct(productId);$link.attr('href',product.link);},_sendProductClick:function(productId){var product=this._getProduct(productId);this._GTM.sendProductClick(product,this._request.define(),'click');this._GTM.sendAction('searchClickedProducts','click',product.id);this._GTM.personalizedSearch();},_sendGTM:function(){if(!this._firstSearch){return;}
this._firstSearch=false;this._GTM.personalizedSearch();var search=(this._request.q+' '+this._request._searchInSearch.join(' ')).trim().toLowerCase(),productIds=[],productInfo=[],type='search';if(search==''||search==null||search=='null'){type='category';search=this._request.define().toLowerCase();}
for(var i=0;i<Math.min(this.products.length,10);i++){productIds.push(this.products[i].id);productInfo.push({name:this.products[i].title,id:this.products[i].id,price:this.products[i].price,brand:this.products[i].brand,list:((type=='search')?'Search Results: ':'')+search,position:i+1});}
this._GTM.send({event:'SearchResult',search_result:{type:type,name:search,products:productIds}});this._GTM.send({event:'EnhancedEcommerce',ecommerce:{currencyCode:'EUR',impressions:productInfo}});if(type=='category'){return;}
var cats=[],keywords=search.split(' ');for(var i=0;i<Math.min(this.products.length,3);i++){cats.push(this.products[i].cat2);}
this._GTM.sendAction('searchQuery',cats.join(', '),search);for(var i=0;i<keywords.length;i++){this._GTM.sendAction('searchKeywords',cats.join(', '),keywords[i]);}},_checkFilterRedirect:function(name,value){if((name!='manufacturer'&&name!='categorylevelthreetitle')||!this._request.isBaseFilter(name)){return false;}
if(sub_brand_links.hasOwnProperty(value)){window.location.href=sub_brand_links[value];return true;}
if(base_category_page!=''&&value==false){window.location.href=base_category_page;return true;}},_storeFilterPosition:function(){if(!breakpoint.isMobile()){return;}
var $tab=JQ('.search__tab[data-tab_id="'+this.id+'"]');this._filterPosition=$tab.find('.searchFilters__list').scrollTop();},_storeFacetPosition:function(name){var $facet=this._getFacetObject(name),offsetViewport=$facet.offset().top-JQ('html, body').scrollTop();this._facetPosition={top:offsetViewport,name:name};},_getFacetObject:function(name){var $tab=JQ('.search__tab[data-tab_id="'+this.id+'"]'),$facet=$tab.find('.searchFilters__filter[data-id="'+name+'"]');return $facet;},_setFilterPosition:function(){if(!breakpoint.isMobile()){if(this._facetPosition===null){return;}
var $facet=this._getFacetObject(this._facetPosition.name),scrollTop=0;if($facet.length>0){scrollTop=$facet.offset().top-this._facetPosition.top;}
JQ('html, body').scrollTop(scrollTop);this._facetPosition=null;}
else{if(this._filterPosition===null){return;}
var $tab=JQ('.search__tab[data-tab_id="'+this.id+'"]');$tab.find('.searchFilters__list').scrollTop(this._filterPosition);this._filterPosition=null;}}};var Search_Product=function(info,parent){this.initialise(info,parent);return this;};Search_Product.prototype={id:null,fabId:null,title:null,link:null,stock:null,on_stock:null,stock_date:null,cat2:null,brand:null,image:null,accessory:false,price:null,index:0,_settings:[],_display_features:[],_parent:null,initialise:function(info,parent){this._parent=parent;this.id=info.aoprodid;this.fabId=info.mpn;this.title=info.icecattitle;this.link=this._parent._request.prepareUrl(info.link);this.stock=info.stock;this.on_stock=info.on_stock;this.stock_date=info.stock_date;this.price=info.price;this.cat2=info['category level two title'];this.brand=info.brand;this.image=info.image;this.accessory=info.isaccessory==1;this._display_features=[];for(var i=0;i<4;i++){if(info.hasOwnProperty('display icecat feature'+(i+1))&&info['display icecat feature'+(i+1)]!=''){this._display_features.push(info['display icecat feature'+(i+1)]);}}
this._loadSettings(info);},getPrice:function(){return this._formatPrice(this.price);},hasSticker:function(){return this.getSticker()!=false;},getSticker:function(){if(this._parent.isFavoriteProduct(this.id)){return'favorite';}
var stickerOrder=['preorder','action','refurb','esd','new','clearance',];for(var i=0;i<stickerOrder.length;i++){if(this._settings.hasOwnProperty(stickerOrder[i])){return stickerOrder[i];}}
return false;},getDisplayFeatures:function(){var features=[];for(var i=0;i<this._display_features.length;i++){features.push(this._enhanceFeature(this._display_features[i]));}
return features;},hasStock:function(){return this.stock>0;},stockText:function(){if(!this.hasStock()){return'Verwachte leverdatum:<br />'+(this.stock_date!=null?this.stock_date:'Onbekend');}
return'Voorraad: '+this.stock+' stuks';},toString:function(){return this.id+' '+this.fabId+' '+this.title;},_loadSettings:function(info){this._settings={};var settingMapping={'is action product':'action','is new':'new','isclearance':'clearance','isesd':'esd','preorder':'preorder',};for(var key in settingMapping){if(info[key]==1||info[key]=='Ja'){this._settings[settingMapping[key]]=true;}}
if(info['isrenew']=='Refurbished'){this._settings['refurb']=true;}
if(info.hasOwnProperty('sticker')&&info.sticker!=''){this._settings[info.sticker]=true;}},_enhanceFeature:function(string){var parts=string.split(':'),type=parts[0].trim(),valueParts=parts.slice(1),value=valueParts.join(':').trim(),featureMapping={'ja':'Wel','nee':'Geen',};if(typeof value==='string'){var lowerValue=value.toLowerCase();if(featureMapping.hasOwnProperty(lowerValue)){value=featureMapping[lowerValue];}}
return'<span>'+value+'</span> '+type;},_formatPrice:function(price){price=Math.round(price*100)/100;var prices=String(price).split('.'),price_front=prices[0],price_end=(prices[1]==undefined||parseInt(prices[1])==0)?'-':((prices[1].length==1)?prices[1]+'0':prices[1]),rgx=/(\d+)(\d{3})/;while(rgx.test(price_front)){price_front=price_front.replace(rgx,'$1'+'.'+'$2');}
return price_front+','+price_end;}};var Search_Content_Tab=function(info,request){this.initialise(info,request);return this;};Search_Content_Tab.prototype={id:null,displayName:null,count:null,type:null,content:[],resultsPerPage_options:[15,30,60,120,210],tab_type:'content',_loaded:false,_loading:false,_request:null,_controller:null,_filters:null,_template:null,_GTM:null,_firstSearch:false,_baseUrl:null,initialise:function(info,request){this.id=info.value;this.displayName=info.displayValue;this.count=info.count;this.setRequest(request);this.type=this._request._escapeString(info.value.toLowerCase());this._setView();this._GTM=new Search_GTM();debug(this);},show:function(firstSearch){if(!this._loaded&&!this._loading){if(firstSearch){this._firstSearch=true;}
this._load();}
else{this._request.setUrl();this._controller.showTab(this,false);}},handleResult:function(request,result){this._loading=false;this._loaded=true;this._request=request;try{if(result.hasOwnProperty('error')){throw result.error[0];}
else{this._handleRedirect(result.items);this._setContent(result.items);this._setFilters();this.count=result.totalItems;this.sort=this._request.sorting;this.resultsPerPage=this._request.getResultsPerPage();this._sendGTM();}
this._show();}
catch(error){this._displayError(error);}},handleResultsPerPage:function(event){var resultsPerPage=JQ(event.target).closest('.searchDisplay__resultsPerPage select').val();if(!JQ.inArray(resultsPerPage,this.resultsPerPage_options)){resultsPerPage=this.resultsPerPage_options[0];}
this._request.setResultsPerPage(resultsPerPage);var maxPages=Math.ceil(this.count/resultsPerPage);if(this._request.getCurrentPage()>maxPages){this._request.setCurrentPage(maxPages);}
this._controller.loadTab(this._request,this.handleResult,this);},handlePageClick:function(event){event.preventDefault();var page=JQ(event.target).attr('data-page');if(page<=0||page>this._maxPages()){page=1;}
this._request.setCurrentPage(page);this._controller.loadTab(this._request,this.handleResult,this);},handleViewSizeChange:function(){},handleViewPortChange:function(){},getPaging:function(){var currentPage=this._request.getCurrentPage(),maxPages=this._maxPages();var paging=[];if(currentPage-2>1){paging.push({title:1,link:true,active:false});if(currentPage-2>2){paging.push({title:'..',link:false,active:false});}}
if(currentPage-2>0){paging.push({title:currentPage-2,link:true,active:false});}
if(currentPage-1>0){paging.push({title:currentPage-1,link:true,active:false});}
paging.push({title:currentPage,link:true,active:true});if(currentPage+1<=maxPages){paging.push({title:currentPage+1,link:true,active:false});}
if(currentPage+2<=maxPages){paging.push({title:currentPage+2,link:true,active:false});}
if(currentPage+2<maxPages){if(currentPage+2<maxPages-1){paging.push({title:'..',link:false,active:false});}
paging.push({title:maxPages,link:true,active:false});}
return paging;},hasPreviousPage:function(){return this.previousPage()>0;},previousPage:function(){return this._request.getCurrentPage()-1;},hasNextPage:function(){return this.nextPage()<=this._maxPages();},nextPage:function(){return this._request.getCurrentPage()+1;},toString:function(){return this.displayName+' ('+this.count+')';},setController:function(controller){this._controller=controller;this._baseUrl=this._controller.getBaseUrl();},setRequest:function(request){this._loaded=false;this._request=JQ.extend(true,{},request);this._request.setSetting('rawSearch',true);this._request.clearFilters();},getFilters:function(){return[];},hasFilters:function(){return false;},getSearchInSearch:function(){if(searchType=='tweakwise'){return[];}
return this._filters.getSearchInSearch();},getRequest:function(){return this._request;},updateSearchInSearch:function(values){this._request.setSearchInSearch(values);this._controller.loadTab(this._request,this.handleResult,this);},openPopup:function(popup){this._controller.openPopup(popup);},closePopup:function(animate){this._controller.closePopup(animate);},isPopupActive:function(){return this._controller.isPopupActive();},_show:function(){var html=this._template(this);this._controller.setTabContent(this,html);this._setHandlers();if(this._filters!==null){this._filters.setHandlers();}},_setHandlers:function(){var $tab=JQ('.search__tab[data-tab_id="'+this.id+'"]');$tab.find('.searchDisplay__resultsPerPage').change(this.handleResultsPerPage.bind(this));$tab.find('.searchDisplay__pageOption span').click(this.handlePageClick.bind(this));},_handleRedirect:function(items){if(items.length>1||!this._firstSearch||this._request.q==null||this._request.q==""){return;}
this._controller.redirect(decodeURI(items[0].product.link));},_setContent:function(items){this.content=[];for(var i=0;i<items.length;i++){var content=new Search_Content(items[i].product,this);this.content.push(content);}},_setView:function(){if(JQ('#search_template_content').length==0){throw"Can't find content template";}
var templateString=JQ('#search_template_content').html();this._template=Handlebars.compile(templateString);},_setFilters:function(facets){if(searchType=='tweakwise'){return;}
if(this._filters==null){this._filters=new Search_Filters([],this);}
else{this._filters.updateFacets([]);}},_maxPages:function(){return Math.ceil(this.count/this.resultsPerPage);},_load:function(){debug('Start loading tab '+this.displayName);this._loading=true;this._filters=null;this._request.activeTab=this.id;this._controller.loadTab(this._request,this.handleResult,this);},_displayError:function(errorMessage){var error=new Search_Error(errorMessage);if(error.type=='zero_results'){error.setRequest(this._request);}
this._controller.showError(this,error);},_sendGTM:function(){if(!this._firstSearch){return;}
this._firstSearch=false;if(typeof search_username!=='undefined'){this._GTM.personalizedSearch();}}};var Search_Content=function(info,parent){this.initialise(info,parent);return this;};Search_Content.prototype={title:null,titleRaw:null,description:null,link:null,type:null,image:null,_highlight:null,_parent:null,initialise:function(info,parent){this._parent=parent;this._highlight=this._parent._request.q;this.titleRaw=info.contenttitle;this.title=this._highlightWords(info.content_type+' > '+info.contenttitle);this.name=info.contenttitle;if(info.hasOwnProperty('highlights')){this.description=info.highlights.join(' ... ');}
else{this.description=this._highlightWords(this._shortenText(info.contentdescription,500));}
this.link=this._parent._request.prepareUrl(info.contentlink);if(info.hasOwnProperty('contentimage')){this.image=info.contentimage;}
this.type=info.type.toLowerCase();},_shortenText:function(text,maxLength){var newText='',textFound=false,parts=text.match(/[^\.!\?]+[\.!\?]+/g);if(parts==undefined){parts=[text];}
for(var i=0;i<parts.length;i++){if((newText+parts[i]).length<maxLength){if(textFound||parts[i].toLowerCase().indexOf(this._highlight)!=-1){newText+=parts[i];textFound=true;}}
else{break;}}
if(!textFound){for(var i=0;i<parts.length;i++){if((newText+parts[i]).length<maxLength||newText.length==0){newText+=parts[i];}
else{break;}}}
return newText;},_highlightWords:function(text){if(text!=undefined&&text.trim()!=''){var regex=new RegExp('('+this._highlight+')','gi');text=text.replace(regex,'<span class="searchContent__highlight">$1</span>');}
return text;}};var Search_Filters=function(facets,parent){this.initialise(facets,parent);return this;};Search_Filters.prototype={maxBuckets:5,maxExtended:8,tresholdClosed:4,extended:false,openExtended:false,_facets:[],_searchInSearch:null,_parent:null,_GTM:null,_excludeInvert:['stockflag','isrenew'],initialise:function(facets,parent){this._parent=parent;this._GTM=new Search_GTM();this._loadExtended();this._setupSearchInSearch();this._createFacets(facets);this.updateFacets(facets);},updateFacets:function(facets){for(var i=0;i<this._facets.length;i++){this._facets[i].updated=false;}
for(var i=0;i<facets.length;i++){var facet=this._getFacetByName(facets[i].name);if(facet==null){this._storeFacet(facets[i]);facet=this._getFacetByName(facets[i].name);}
if(facet!==null){facet.update(facets[i]);}}
var count=0;for(var i=0;i<this._facets.length;i++){var extend=true;if(this._facets[i].isActive()){count++;extend=(count>this.maxExtended&&!this._facets[i].hasValue());}
this._facets[i].extend=extend;this._facets[i].opened=(!extend||this._facets.length<=(this.maxExtended+this.tresholdClosed));}
this.openExtended=count<=(this.maxExtended+this.tresholdClosed);for(var i=0;i<this._facets.length;i++){this._facets[i].opened=this.openExtended||!this._facets[i].extend;}},getActiveFacets:function(){var facets=[];for(var i=0;i<this._facets.length;i++){if(this._facets[i].isActive()){facets.push(this._facets[i]);}}
return facets;},getQuickFilters:function(){var filters=[];for(var i=0;i<this._facets.length;i++){if(this._facets[i].isActive()){var values=this._facets[i].getActiveBuckets();for(var j=0;j<values.length;j++){filters.push(values[j]);}}}
return filters;},handleFilterChange:function(event){if(JQ(event.target).closest('.searchFilters__option').hasClass('searchFilters__option--noresult')){return;}
var $option=JQ(event.target).closest('.searchFilters__option').find('input'),id=$option.closest('.searchFilters__filter').data('id'),facet=this._getFacetById(id);if(facet!==null){facet.handleChange($option);}},handleInvertChange:function(event){var $filter=JQ(event.target).closest('.searchFilters__filter'),$invert=$filter.find('.searchFilters__invert'),$input=$invert.find('input'),id=$filter.data('id'),facet=this._getFacetById(id),checked=$input.is(':checked');if(facet!==null){facet.invert(checked,true);if(checked){$invert.addClass('searchFilters__invert--active');}
else{$invert.removeClass('searchFilters__invert--active');}}},handleSliderChange:function(event,ui){var $filter=JQ(ui.handle).closest('.searchFilters__filter'),minValue=ui.values[0],maxValue=ui.values[1],facet=this._getFacetById($filter.data('id'));if(facet!==null){facet.handleChange(minValue,maxValue);}
return false;},handleBucketSliderChange:function(event,ui){var $filter=JQ(ui.handle).closest('.searchFilters__filter'),minValue=$filter.find('.searchFilters__sliderSelect--left option:selected').val(),maxValue=$filter.find('.searchFilters__sliderSelect--right option:selected').val(),facet=this._getFacetById($filter.data('id'));if(facet!==null){facet.handleChange(minValue,maxValue);}
return false;},handleFilterOpen:function(event){if(JQ(event.target).hasClass('searchFilters__tooltip')||JQ(event.target).closest('.searchFilters__filter').hasClass('searchFilters__filter--searchinsearch')){return;}
var $filter=JQ(event.target).closest('.searchFilters__filter'),facet=this._getFacetById($filter.data('id')),className='searchFilters__filter--closed',isClosed=$filter.hasClass(className);if(breakpoint.isMobile()){className='searchFilters__filter--mobileClosed';isClosed=$filter.hasClass(className);if(facet!==null){facet.mobileOpened=isClosed;}}
else{if(facet!==null){facet.opened=isClosed;}}
if(isClosed){$filter.removeClass(className);}
else{$filter.addClass(className);}
this._setupSliders();},handleOpenAll:function(event){var $open=JQ(event.target).closest('.searchFilters__open'),open=!$open.hasClass('searchFilters__open--opened'),$tab=JQ('.search__tab[data-tab_id="'+this._parent.id+'"]');for(var i=0;i<this._facets.length;i++){if(open){this._facets[i].opened=true;}
else{this._facets[i].opened=!this._facets[i].extend||this._facets[i].getActiveBuckets().length>0;}
var $facet=$tab.find('.searchFilters__filter[data-id="'+this._facets[i].id+'"]');if(this._facets[i].opened){$facet.removeClass('searchFilters__filter--closed');}
else{$facet.addClass('searchFilters__filter--closed');}}
if(open){$open.addClass('searchFilters__open--opened');}
else{$open.removeClass('searchFilters__open--opened');}
this._setupSliders();},handleFilterExpand:function(event){var $filter=JQ(event.target).closest('.searchFilters__filter'),expand=JQ(event.target).hasClass('searchFilters__expand--implode'),facet=this._getFacetById($filter.data('id'));if(facet!==null){facet.expanded=expand;}
if(expand){$filter.removeClass('searchFilters__filter--imploded').addClass('searchFilters__filter--expanded');}
else{$filter.removeClass('searchFilters__filter--expanded').addClass('searchFilters__filter--imploded');}
this._sortFilter($filter);},handleFilterExtend:function(event){var $tab=JQ('.search__tab[data-tab_id="'+this._parent.id+'"]');this._setExtended(JQ(event.target).is(':checked'),true);$tab.find('.searchFilters__extend input').prop('checked',this.extended);if(this.extended){$tab.find('.searchFilters__list').addClass('searchFilters__list--extended');}
else{$tab.find('.searchFilters__list').removeClass('searchFilters__list--extended');}
this._setupSliders();},handleSearchInSearchKey:function(event){if(event.which==13){this.handleSearchInSearch(event);}
else if(event.which==27){JQ(event.target).val('');}},handleSearchInSearch:function(event){var $search=JQ(event.target).closest('.searchFilters__search'),$input=$search.find('input'),value=$input.val();try{this._searchInSearch.setValue(value);}
catch(errorMessage){this._parent._displayError(errorMessage);}},handleQuickChange:function(event){var $filter=JQ(event.target).closest('.searchQuick__filter'),facet=this._getFacetById($filter.data('id'));if(facet!=null){facet.removeValue($filter.data('value'));}
$filter.fadeOut();},handleQuickAllChange:function(event){this._parent.clearFilters();},handleMobilePopup:function(event){this._resetFilterView();this._parent.openPopup(JQ('.searchFilters__list'));this._setupSliders();},setFilter:function(name,type,value,invert){this._parent.setFilter(name,type,value,invert);},getRequest:function(){return this._parent.getRequest();},getRequestValue:function(name){return this._parent.getRequestValue(name);},getSearchInSearch:function(){if(searchControl._isUrlRequest()){return[];}
return[this._searchInSearch];},updateSearchInSearch:function(value){this._parent.updateSearchInSearch(value);},setHandlers:function(){this._registerFilterHandlers();this._setupSliders();this._setupTooltips();this._updateFilterView();},_registerFilterHandlers:function(){var $tab=JQ('.search__tab[data-tab_id="'+this._parent.id+'"]');$tab.find('.searchFilters__option input').click(this.handleFilterChange.bind(this));$tab.find('.searchFilters__invert input').click(this.handleInvertChange.bind(this));$tab.find('.searchFilters__title').click(this.handleFilterOpen.bind(this));$tab.find('.searchFilters__expand').click(this.handleFilterExpand.bind(this));$tab.find('.searchQuick__filter .searchQuick__close').click(this.handleQuickChange.bind(this));$tab.find('.searchQuick__filter--removeall').click(this.handleQuickAllChange.bind(this));$tab.find('.searchFilters__extend input').click(this.handleFilterExtend.bind(this));$tab.find('.searchFilters__search input').keyup(this.handleSearchInSearchKey.bind(this));$tab.find('.searchFilters__search button').click(this.handleSearchInSearch.bind(this));$tab.find('.searchFilters__mobile').click(this.handleMobilePopup.bind(this));$tab.find('.searchFilters__open').click(this.handleOpenAll.bind(this));},_setupSliders:function(){var $tab=JQ('.search__tab[data-tab_id="'+this._parent.id+'"]');$tab.find('.searchFilters__slider--simple').each(this._setupSlider.bind(this));$tab.find('.searchFilters__slider--bucket').each(this._setupBucketSlider.bind(this));},_setupSlider:function(position,slider){var $slider=JQ(slider),$filter=$slider.closest('.searchFilters__filter'),sliderObject=$slider.data('slider');if(sliderObject!==undefined){sliderObject._updateHandles(null,null);return;}
if($filter.hasClass('searchFilters__filter--closed')&&$filter.hasClass('searchFilters__filter--mobileClosed')||(!breakpoint.isMobile()&&$filter.hasClass('searchFilters__filter--extend')&&!$filter.closest('.searchFilters__list').hasClass('searchFilters__list--extended'))){return;}
var newObject=$slider.simpleSlider({sliderOptions:{change:this.handleSliderChange.bind(this)},});$slider.data('slider',newObject);},_setupBucketSlider:function(position,slider){var $slider=JQ(slider),$filter=$slider.closest('.searchFilters__filter'),sliderObject=$slider.data('slider');if(sliderObject!==undefined){if(!$filter.hasClass('searchFilters__filter--closed')&&(!$filter.hasClass('searchFilters__filter--extend')||$filter.closest('.searchFilters__list').hasClass('searchFilters__list--extended'))){sliderObject.updateBarWidth();}
return;}
if($filter.hasClass('searchFilters__filter--closed')||(breakpoint.isMobile()&&$filter.hasClass('searchFilters__filter--mobileClosed'))||(!breakpoint.isMobile()&&$filter.hasClass('searchFilters__filter--extend')&&!$filter.closest('.searchFilters__list').hasClass('searchFilters__list--extended'))){return;}
var disabled=false,newObject=$slider.find('.searchFilters__sliderSelect').selectToUISlider({labels:6,tooltip:false,myname:name,sliderOptions:{showScale:!disabled,change:this.handleBucketSliderChange.bind(this)},});$slider.data('slider',newObject);},_setupTooltips:function(){var $toolTips=JQ('.searchFilters__tooltip'),settings={background_color:'#FFFFFF',color:'#303030',position:'right',max_width:200,animation_speed:10,animation_offset:10,hide_delay:50,opacity:1,};new JQ.Zebra_Tooltips($toolTips,settings);},_updateFilterView:function(tab){var $tab=JQ('.search__tab[data-tab_id="'+this._parent.id+'"]');$tab.find('.searchFilters__filter').each(function(index,object){var $filter=JQ(object),limit=$filter.data('limit');this._sortFilter($filter);$filter.find('.searchFilters__option').each(function(index,object){if(index>=limit){JQ(object).addClass('searchFilters__option--overflow');}}.bind(this));}.bind(this));var $extend=$tab.find('.searchFilters__extend'),$extendClone=$extend.clone(true,true);$tab.find('.searchFilters__list').append($extendClone);},_sortFilter:function($filter){var items=[];$filter.find('.searchFilters__option').each(function(){items.push(JQ(this));});if($filter.hasClass('searchFilters__filter--expanded')){items.sort(this._sortFilterAlphabetical);}
else{items.sort(this._sortFilterPosition);}
items.reverse();var $title=$filter.find('.searchFilters__title');for(var i=0;i<items.length;i++){$title.after(items[i]);}},_sortFilterAlphabetical:function(a,b){var noResult=a.hasClass('searchFilters__option--noresult')==b.hasClass('searchFilters__option--noresult'),aValue=a.data('value'),bValue=b.data('value');if(noResult){if(!isNaN(aValue)&&!isNaN(bValue)){return aValue-bValue;}
return(aValue+'').localeCompare(bValue+'');}
return b.hasClass('searchFilters__option--noresult')?-1:1;},_sortFilterPosition:function(a,b){var checked=a.hasClass('searchFilters__option--checked')==b.hasClass('searchFilters__option--checked'),noResult=a.hasClass('searchFilters__option--noresult')==b.hasClass('searchFilters__option--noresult');if(checked&&noResult){return parseInt(a.data('sort'))-parseInt(b.data('sort'));}
if(!checked){return a.hasClass('searchFilters__option--checked')?-1:1;}
if(noResult){return parseInt(a.data('sort'))-parseInt(b.data('sort'));}
return b.hasClass('searchFilters__option--noresult')?-1:1;},_getFacetById:function(id){for(var i=0;i<this._facets.length;i++){if(this._facets[i].id==id){return this._facets[i];}}
return null;},_getFacetByName:function(name){for(var i=0;i<this._facets.length;i++){if(this._facets[i].name==name){return this._facets[i];}}
return null;},_createFacets:function(facets){this._facets=[];for(var i=0;i<facets.length;i++){this._storeFacet(facets[i]);}},_storeFacet:function(info){var facet=this._createFacet(info);if(facet!==false){this._facets.push(facet);}
else{debug('No filter created for '+facets[i].name);debug(facets[i]);}},_createFacet:function(info){var facet=false;if(info.hasOwnProperty('displayType')){var displayType=info.displayType.toLowerCase();if(displayType=='singleselect'||displayType=='exclusiveselect'||(displayType=='multiselect'&&(info.type=='int'||info.type=='float'))||displayType=='select'){facet=new Search_Filter_Radio(info,this);}
else if(displayType=='multiselect'){facet=new Search_Filter_Checkbox(info,this);}
else if(displayType=='slider'){if(info.hasOwnProperty('filter_buckets')){facet=new Search_Filter_Bucket_Slider(info,this);}
else{facet=new Search_Filter_Slider(info,this);}}}
else if(info.type.toLowerCase()=='list'&&info.name.toLowerCase()!='type'){facet=new Search_Filter_Checkbox(info,this);}
if(facet!==false){if((facet.id=='category_level_two_title'||facet.id=='categoryleveltwotitle')&&(this._parent._request.hasRestriction('cat')||this._parent._request.getSetting('isCategory'))){facet.visible=false;}
if((facet.id=='manufacturer'||facet.id=='categorylevelthreetitle')&&(this._parent._request.getSetting('isBrand')||this._parent._request.hasRestriction('brand'))){facet.visible=false;}}
return facet;},_setupSearchInSearch:function(){if(this._searchInSearch==null){this._searchInSearch=new Search_Filter_SearchInSearch(this);}},_setExtended:function(extended,save){this.extended=extended;if(save){this._saveExtended();}},_loadExtended:function(){var extendedValue=getCookie("search__FilterExtended"),extended=(extendedValue=='yes');this._setExtended(extended,false);},_saveExtended:function(){setCookie("search__FilterExtended",this.extended?'yes':'no',7,"/");},_resetFilterView:function(){for(var i=0;i<this._facets.length;i++){this._facets[i].mobileOpened=this._facets[i].hasValue();var $facet=JQ('.searchFilters__filter[data-id="'+this._facets[i].id+'"]');if(this._facets[i].mobileOpened){$facet.removeClass('searchFilters__filter--mobileClosed');}
else{$facet.addClass('searchFilters__filter--mobileClosed');}}}};var Search_Filter_Radio=function(info,parent){this.initialise(info,parent);return this;};Search_Filter_Radio.prototype={id:null,name:null,title:null,buckets:[],type:'radio',facet_type:null,visible:true,expanded:false,opened:true,mobileOpened:false,extend:false,inverted:false,canInvert:false,updated:false,_parent:null,initialise:function(info,parent){this._parent=parent;this.name=info.name;this.id=info.name.replace(/ /g,'_');this.title=info.displayName;this.facet_type=info.type;if(info.hasOwnProperty('hidden')&&info.hidden=="Yes"){this.visible=false;}
this._setBuckets(info.buckets);},update:function(info){for(var i=0;i<this.buckets.length;i++){this.buckets[i].active=false;this.buckets[i].count=0;}
for(var i=0;i<info.buckets.length;i++){var bucket=this._getBucketByValue(info.buckets[i].value);if(bucket!==null){bucket.count=info.buckets[i].count;}
else{this._addBucket(info.buckets[i]);}}
this._setSelectedValue();this.updated=true;},isActive:function(){return this.visible&&(this.buckets.length>1||this.buckets[0].displayValue!="0")&&(this.updated||this.hasValue());},hasValue:function(){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active==true){return true;}}
return false;},handleChange:function($option){var value=$option.val(),bucket=this._getBucketByValue(value);if(bucket===null){throw"Filter value not possible";}
if(bucket.active===true){return;}
for(var i=0;i<this.buckets.length;i++){this.buckets[i].active=false;}
bucket.active=true;this._logBucket(bucket);return this._filterUpdated();},removeValue:function(value){var bucket=this._getBucketByValue(value);bucket.active=false;this._logBucket(bucket);return this._filterUpdated();},hasLimit:function(){return this.buckets.length>this.getLimit();},getLimit:function(){return this._parent.maxBuckets;},getActiveBuckets:function(){if(!this.isActive()){return[];}
var bucket=null;for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active==true){bucket=this.buckets[i];}}
if(bucket!=null){var value=bucket.displayValue,displayValue=(this.inverted?'geen ':'')+value,checkValue=(typeof value==='string'?value.toLowerCase():value.toString());if(checkValue=='ja'||checkValue=='nee'||!isNaN(bucket.displayValue)){displayValue=this.title+': '+displayValue;}
return[{id:this.id,value:bucket.value,title:displayValue,}];}
return[];},invert:function(invert,pushChange){this.inverted=invert;if(pushChange){this._filterUpdated();}},_setSelectedValue:function(){var selection=this._parent.getRequestValue(this.id);if(selection===null){return;}
var selectedValue=(typeof selection.value==='string'?selection.value.toLowerCase():selection.value.toString());for(var i=0;i<this.buckets.length;i++){var value=this.buckets[i].value,checkValue=(typeof value==='string'?value.toLowerCase():value.toString());if(checkValue==selectedValue){this.buckets[i].active=true;}}
this.invert(selection.invert,false);},_getBucketByValue:function(value){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].value==value){return this.buckets[i];}}
return null;},_filterUpdated:function(){var value=null;for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active==true){if(this.buckets[i].hasOwnProperty('attributeId')&&this.buckets[i].attributeId>0){value=this.buckets[i].attributeId;}
else{value=this.buckets[i].value;}}}
this._parent.setFilter(this.id,this.facet_type,value,this.inverted);},_setBuckets:function(buckets){this.buckets=[];for(var i=0;i<buckets.length;i++){this._addBucket(buckets[i]);}},_addBucket:function(newBucket){var bucket=JQ.extend(true,{},newBucket);bucket.active=false;this.buckets.push(bucket);},_logBucket:function(bucket){let value=bucket.value+' ('+(bucket.active?'1':'0')+')';this._parent._GTM.sendAction('restrictBy',value,this.name);}};var Search_Filter_Checkbox=function(info,parent){this.initialise(info,parent);return this;};Search_Filter_Checkbox.prototype={id:null,name:null,title:null,buckets:[],type:'checkbox',facet_type:null,description:false,visible:true,expanded:false,opened:true,mobileOpened:false,extend:false,inverted:false,canInvert:false,updated:false,_parent:null,initialise:function(info,parent){this._parent=parent;this.name=info.name;this.id=info.name.replace(/ /g,'_');this.title=info.displayName;this.facet_type=info.type;if(info.hasOwnProperty('description')&&info.description.trim()!=''){this.description=info.description;}
if(info.hasOwnProperty('hidden')&&info.hidden=="Yes"){this.visible=false;}
this._setBuckets(info.buckets);},update:function(info){for(var i=0;i<this.buckets.length;i++){if(!this.buckets[i].active||!this.inverted){this.buckets[i].count=0;}
this.buckets[i].active=false;}
for(var i=0;i<info.buckets.length;i++){var bucket=this._getBucketByValue(info.buckets[i].value);if(bucket!==null){bucket.count=info.buckets[i].count;}
else{this._addBucket(info.buckets[i]);}}
this._setSelectedValue();this.updated=true;},isActive:function(){return this.visible&&this.buckets.length>0&&(this.updated||this.hasValue());},hasValue:function(){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active==true){return true;}}
return false;},handleChange:function($option){var value=$option.val(),bucket=this._getBucketByValue(value);if(bucket===null){throw"Filter value not possible";}
bucket.active=!bucket.active;this._logBucket(bucket);return this._filterUpdated();},removeValue:function(value){var bucket=this._getBucketByValue(value);bucket.active=false;this._logBucket(bucket);return this._filterUpdated();},hasLimit:function(){return this.buckets.length>this.getLimit();},getLimit:function(){return this._parent.maxBuckets;},getActiveBuckets:function(){var selectedBuckets=[];for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active==true){selectedBuckets.push({id:this.id,value:this.buckets[i].value,title:(this.inverted?'geen ':'')+this.buckets[i].displayValue,});}}
return selectedBuckets;},invert:function(invert,pushChange){this.inverted=invert;if(pushChange){this._filterUpdated();}},_setSelectedValue:function(){var selection=this._parent.getRequestValue(this.id);if(selection===null){return;}
var lowerValue=(typeof selection.value==='string'?selection.value.toLowerCase():selection.value.toString()),selectedValues=lowerValue.toString().split('|');for(var i=0;i<this.buckets.length;i++){var checkValue=(typeof this.buckets[i].value==='string'?this.buckets[i].value.toLowerCase():this.buckets[i].value.toString());if(JQ.inArray(checkValue,selectedValues)>-1){this.buckets[i].active=true;}}
this.invert(selection.invert,false);},_getBucketByValue:function(value){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].value==value){return this.buckets[i];}}
return null;},_filterUpdated:function(){var selectedValues=[];for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active==true){var value=this.buckets[i].value;selectedValues.push(typeof value==='string'?value.toLowerCase():value.toString());}}
var value=false;if(selectedValues.length>0){value=selectedValues.join('|');}
this._parent.setFilter(this.id,this.facet_type,value,this.inverted);},_setBuckets:function(buckets){this.buckets=[];for(var i=0;i<buckets.length;i++){this._addBucket(buckets[i]);}},_addBucket:function(newBucket){var bucket=JQ.extend(true,{},newBucket);bucket.active=false;this.buckets.push(bucket);},_logBucket:function(bucket){let value=bucket.value+' ('+(bucket.active?'1':'0')+')';this._parent._GTM.sendAction('restrictBy',value,this.name);}};var Search_Filter_Slider=function(info,parent){this.initialise(info,parent);return this;};Search_Filter_Slider.prototype={id:null,name:null,title:null,type:'slider',facet_type:null,min_value:null,max_value:null,min_selected:null,max_selected:null,visible:true,expanded:false,opened:true,mobileOpened:false,extend:false,keep_difference:false,canInvert:false,updated:false,_parent:null,initialise:function(info,parent){this._parent=parent;this.name=info.name;this.id=info.name.replace(/ /g,'_');this.title=info.displayName;this.facet_type=info.type;this.keep_difference=(info.name=='price');if(info.hasOwnProperty('hidden')&&info.hidden=="Yes"){this.visible=false;}
this._setBuckets(info.buckets);},update:function(info){if(!this.hasValue()){this._setBuckets(info.buckets);}
this.updated=true;},handleChange:function(min,max){this.min_selected=min;this.max_selected=max;this._filterUpdated();},isActive:function(){return this.visible&&(this.updated||this.hasValue());},hasValue:function(){return this.min_selected>this.min_value||this.max_selected<this.max_value;},getLimit:function(){return this._parent.maxBuckets;},getMinValue:function(){return this.min_value;},getMaxValue:function(){return this.max_value;},removeValue:function(value){if(this.min_selected==value){this.min_selected=this.min_value;}
if(this.max_selected==value){this.max_selected=this.max_value;}
return this._filterUpdated();},getActiveBuckets:function(){var selection=this._parent.getRequestValue(this.id);if(selection===null){return[];}
var selectedValue=selection.value,selectedValues=selectedValue.split('-'),min=selectedValues[0],max=selectedValues[1];var buckets=[];if(min>0&&min>this.min_value){buckets.push({id:this.id,value:min,title:this.title+' min. '+min,});}
if(max!='*'&&max<this.max_value){buckets.push({id:this.id,value:max,title:this.title+' max. '+max,});}
return buckets;},invert:function(invert,pushChange){},_filterUpdated:function(){if(!this.hasValue()){this._parent.setFilter(this.id,this.facet_type,false);return;}
var min=this.min_selected,max=this.max_selected,value=min+'-'+max;this._logBucket(value,min+'-'+max);this._parent.setFilter(this.id,this.facet_type,value,false);},_setBuckets:function(buckets){if(buckets.length<2){throw'Expected at least 2 buckets';}
this.min_value=this.max_value=this.min_selected=this.max_selected=null;for(var i=0;i<buckets.length;i++){var bucketValue=parseFloat(buckets[i].value);if(this.min_value==null||bucketValue<this.min_value){this.min_value=bucketValue;}
if(this.max_value==null||bucketValue>this.max_value){this.max_value=bucketValue;}
if(buckets[i].selected==true){if(this.min_selected==null||bucketValue<this.min_selected){this.min_selected=bucketValue;}
if(this.max_selected==null||bucketValue>this.max_selected){this.max_selected=bucketValue;}}}
if(this.min_selected==null){this.min_selected=Math.floor(this.min_value);}
if(this.max_selected==null){this.max_selected=Math.ceil(this.max_value);}},_logBucket:function(active,bucketValue){let value=bucketValue+' ('+(active!==null?'1':'0')+')';this._parent._GTM.sendAction('restrictBy',value,this.name);}};var Search_Filter_Bucket_Slider=function(info,parent){this.initialise(info,parent);return this;};Search_Filter_Bucket_Slider.prototype={id:null,name:null,title:null,type:'bucket_slider',facet_type:null,visible:true,expanded:false,opened:true,mobileOpened:false,extend:false,keep_difference:false,canInvert:false,updated:false,_parent:null,initialise:function(info,parent){this._parent=parent;this.name=info.name;this.id=info.name.replace(/ /g,'_');this.title=info.displayName;this.facet_type=info.type;this.keep_difference=(info.name=='price');if(info.hasOwnProperty('hidden')&&info.hidden=="Yes"){this.visible=false;}
this._setBuckets(info.filter_buckets);this._setBucketHeights();},update:function(info){if(!this.hasValue()){this._setBuckets(info.filter_buckets);}
else{for(var i=0;i<this.buckets.length;i++){this.buckets[i].active_min=false;this.buckets[i].active_max=false;this.buckets[i].count=0;}}
for(var i=0;i<info.filter_buckets.length;i++){var bucket=this._getBucketByValue(info.filter_buckets[i].value);if(bucket!==null){bucket.count=info.filter_buckets[i].count;}}
this._setBucketHeights();this._setSelectedValue();this.updated=true;},handleChange:function(min,max){for(var i=0;i<this.buckets.length;i++){this.buckets[i].active_min=this.buckets[i].title==min;this.buckets[i].active_max=this.buckets[i].title==max;}
this._filterUpdated();},isActive:function(){return this.visible&&(this.updated||this.hasValue());},hasValue:function(){return this.buckets[0].active_min==false||this.buckets[this.buckets.length-1].active_max==false;},getLimit:function(){return this._parent.maxBuckets;},getMinValue:function(){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active_min){return this.buckets[i].value;}}
return null;},getMaxValue:function(){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active_max){return this.buckets[i].value;}}
return null;},removeValue:function(value){var bucket=this._getBucketByValue(value);if(bucket.active_min){bucket.active_min=false;this.buckets[0].active_min=true;}
else{bucket.active_max=false;this.buckets[this.buckets.length-1].active_max=true;}
return this._filterUpdated();},getActiveBuckets:function(){var selection=this._parent.getRequestValue(this.id);if(selection===null){return[];}
var selectedValue=selection.value,selectedValues=selectedValue.split('-'),min=selectedValues[0],max=selectedValues[1];var buckets=[];if(min>0){buckets.push({id:this.id,value:min,title:this.title+' min. '+min,});}
if(max!=this.buckets[this.buckets.length-1].value){buckets.push({id:this.id,value:max,title:this.title+' max. '+max,});}
return buckets;},invert:function(invert,pushChange){},_setSelectedValue:function(){var selection=this._parent.getRequestValue(this.id);if(selection===null){this.buckets[0].active_min=true;this.buckets[this.buckets.length-1].active_max=true;return;}
var selectedValue=selection.value,selectedValues=selectedValue.split('-'),min=selectedValues[0],max=selectedValues[1],maxSet=false;for(var i=0;i<this.buckets.length;i++){this.buckets[i].active_min=(this.buckets[i].value==min);this.buckets[i].active_max=(this.buckets[i].value==max);maxSet=maxSet||this.buckets[i].active_max;}
if(!maxSet){this.buckets[this.buckets.length-1].active_max=true;}
this.invert(selection.invert,false);},_setBucketHeights:function(){let highestValue=0;for(let i=0;i<this.buckets.length;i++){highestValue=Math.max(highestValue,this.buckets[i].count);this.buckets[i].height=this.buckets[i].count/100;}
for(let i=0;i<this.buckets.length;i++){this.buckets[i].height=this.buckets[i].count/highestValue;}},_filterUpdated:function(){var min=null,max=null,isFirst=false,isLast=false;for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].active_min==true){min=this.buckets[i].value;isFirst=(i==0);}
if(this.buckets[i].active_max==true){max=this.buckets[i].value;isLast=(i==(this.buckets.length-1));}}
var value=null;if(!isFirst||!isLast){value=min+'-'+max;}
this._logBucket(value,min+'-'+max);this._parent.setFilter(this.id,this.facet_type,value,false);},_setBuckets:function(buckets){this.buckets=[];for(var i=0;i<buckets.length;i++){if(this.id=='price'&&i==0&&buckets[i].min!=0&&false){this._addBucket({min:0,});}
this._addBucket(buckets[i]);}
this._sortBuckets();},_getBucketByValue:function(value){for(var i=0;i<this.buckets.length;i++){if(this.buckets[i].value==value){return this.buckets[i];}}
return null;},_addBucket:function(newBucket){this.buckets.push({min:newBucket.value,value:newBucket.value,title:newBucket.displayValue,active_min:false,active_max:false,count:newBucket.count,height:newBucket.count/100});},_sortBuckets:function(){this.buckets.sort(this._sort);},_sort:function(a,b){return parseFloat(a.min)-parseFloat(b.min);},_logBucket:function(active,bucketValue){let value=bucketValue+' ('+(active?'1':'0')+')';this._parent._GTM.sendAction('restrictBy',value,this.name);}};var Search_Filter_SearchInSearch=function(parent){this.initialise(parent);return this;};Search_Filter_SearchInSearch.prototype={value:null,title:null,_parent:null,initialise:function(parent){this._parent=parent;this.value=null;var request=this._parent.getRequest();this.title='Zoeken binnen '+request.getTitle(false);this.value=this._parent.getRequest().getSearchInSearch();},setValue:function(value){if(/[^a-zA-Z0-9_\"\'\/ -]/.test(value)){throw"user_input";}
value=(typeof value==='string'?value.toLowerCase():value.toString());if(this.value!=value){this.value=value;this._logValue(value);}
this._filterUpdated();},_filterUpdated:function(){this._parent.updateSearchInSearch(this.value);},_logValue:function(logValue){this._parent._GTM.sendAction('restrictBy',logValue,'searchInSearch');}};var responsiveMenu=null;JQ(function(){responsiveMenu=new ResponsiveMenu();JQ(window).on('viewport_changed',responsiveMenu.update.bind(responsiveMenu));});var ResponsiveMenu=function(){this.init();return this;};ResponsiveMenu.prototype={menus:{},active:null,init:function(){var desktop=new DesktopMenu();this._registerMenu('desktop',desktop);this._registerMenu('tablet',desktop);this._registerMenu('smartphone',new MobileMenu());},update:function(event,newView){this.active=newView;this.menus[this.active].clear();this.menus[this.active].registerEvents();this.hideAllMenus();this.hideAllSubMenus();},closeMenu:function(menuId){this.menus[this.active].closeMenu(menuId);},hideAllMenus:function(){for(var view in this.menus){this.menus[view].hideAllMenus();}},closeSubMenu:function(menuId){this.menus[this.active].closeSubMenu(menuId);},hideAllSubMenus:function(){for(var view in this.menus){this.menus[view].hideAllSubMenus();}},_registerMenu:function(view,menu){this.menus[view]=menu;}};var MobileMenu=function(){this.init();return this;};MobileMenu.prototype={mobileMenuActiveClass:'siteMenu--open',showClass:'siteMenu__dropdown--active',showSubClass:'siteMenu__dropdownExpand--active',expandClass:'expanded',menu:null,nav:null,level:0,animateSpeed:300,init:function(){this.menu=JQ('.siteMenu');this.nav=this.menu.find('.siteMenu__ul');},clear:function(){setTimeout(this.closeMobileMenu.bind(this),100);},registerEvents:function(){JQ('.siteHeader__hamburger, .siteMenu__close').off('click').click(this.handleMenuClick.bind(this));JQ('.siteMenu__list > .siteMenu__dropdownItem--back .siteMenu__dropdownLink, '+'.siteMenu__dropdown > .siteMenu__dropdownItem--back .siteMenu__dropdownLink').off('click').click(this.closeMenu.bind(this));JQ('.siteMenu__dropdownExpand > .siteMenu__dropdownItem--back .siteMenu__dropdownLink').off('click').click(this.closeSubMenu.bind(this));JQ('.siteMenu__link').off('click').click(this.clickOpenMenu.bind(this));JQ('.siteMenu__dropdownItem--expand > .siteMenu__dropdownLink').off('click').click(this.clickOpenSubMenu.bind(this));},handleMenuClick:function(event){event.preventDefault();if(this.menu.hasClass(this.mobileMenuActiveClass)){this.closeMobileMenu();}
else{this.openMobileMenu();}
return false;},openMobileMenu:function(){this.menu.addClass(this.mobileMenuActiveClass);this.setMenuContainer();},closeMobileMenu:function(){this.unsetMenuContainer();this.menu.removeClass(this.mobileMenuActiveClass);this.slideTo(0);responsiveMenu.hideAllSubMenus();responsiveMenu.hideAllMenus();JQ('#menu .scroll_list').removeClass(this.expandClass);},setMenuContainer:function(){JQ('body').css('overflow','hidden');},unsetMenuContainer:function(){JQ('body').css('overflow','');},openMenu:function(menuId){responsiveMenu.hideAllMenus();JQ('#'+menuId).addClass(this.showClass).scrollTop(0);this.slideTo(1);},clickOpenMenu:function(event){var $item=JQ(event.target).closest('.siteMenu__item');if(!$item.hasClass('siteMenu__item--dropdown')){return true;}
event.preventDefault();this.openMenu('sub_'+$item.data('pageid'));return false;},closeMenu:function(menuId){this.slideTo(0);},hideAllMenus:function(){JQ('.siteMenu__dropdown').removeClass(this.showClass);},openSubMenu:function(subMenuId){responsiveMenu.hideAllSubMenus();JQ('#'+subMenuId).addClass(this.showSubClass).scrollTop(0);this.slideTo(2);},clickOpenSubMenu:function(event){event.preventDefault();var $item=JQ(event.target).closest('.siteMenu__dropdownItem');this.openSubMenu($item.data('submenu'));return false;},closeSubMenu:function(){this.slideTo(1);},hideAllSubMenus:function(){JQ('.siteMenu__dropdownExpand').removeClass(this.showSubClass);},slideTo:function(level){var back=this.level>level;this.level=level;this.menu.attr('level',level);this.nav.animate({left:(level==0?0:(-100*level)+'%')},this.animateSpeed,function(){if(back){if(level==1){responsiveMenu.hideAllSubMenus();}
else if(level==0){responsiveMenu.hideAllMenus();}}}.bind(this));}};var DesktopMenu=function(){this.init();return this;};DesktopMenu.prototype={menuTimer:null,subMenuTimer:null,showClass:'siteMenu__dropdown--active',showSubClass:'siteMenu__dropdownExpand--active',init:function(){},clear:function(){JQ('.siteMenu__item[data-pageid], .siteMenu__dropdown, .siteMenu__dropdown ul.category_menu li').off('mouseover mouseout');},registerEvents:function(){JQ('.siteMenu__item--dropdown[data-pageid]').off('hover').hover(function(event){this.openMenu('sub_'+JQ(event.target).closest('.siteMenu__item').data('pageid'));}.bind(this),function(event){this.closeMenu('sub_'+JQ(event.target).closest('.siteMenu__item').data('pageid'));}.bind(this));JQ('.siteMenu__dropdown--submenu').off('hover').hover(function(){this.clearMenuTimer();}.bind(this),function(event){this.closeMenu('sub_'+JQ(event.target).closest('.siteMenu__dropdown').data('pageid'));}.bind(this));JQ('.siteMenu__list .siteMenu__dropdownItem--expand').off('hover').hover(function(event){this.openSubMenu(JQ(event.target).closest('.siteMenu__dropdownItem').data('submenu'));}.bind(this),function(){this.closeSubMenu();}.bind(this));JQ('.siteMenu__dropdownExpand').off('hover').hover(function(){this.clearMenuTimer();this.clearSubMenuTimer();}.bind(this));JQ('.siteMenu__link').off('click').click(this.clickOpenMenu.bind(this));JQ('.siteMenu__dropdownItem--expand > .siteMenu__dropdownLink').off('click').click(this.clickOpenSubMenu.bind(this));},openMenu:function(menuId){this.clearMenuTimer();this.clearSubMenuTimer();if(!JQ('#'+menuId).hasClass(this.showClass)){this.menuTimer=setTimeout(function(){this.showMenu(menuId);}.bind(this),300);}},clickOpenMenu:function(event){var $item=JQ(event.target).closest('.siteMenu__item');if(!$item.hasClass('siteMenu__item--dropdown')){return true;}
event.preventDefault();this.clearMenuTimer();this.showMenu('sub_'+$item.data('pageid'));return false;},closeMenu:function(menuId){this.clearMenuTimer();this.menuTimer=setTimeout(function(){responsiveMenu.hideAllMenus();},500);},clearMenuTimer:function(){this.clearTimer(this.menuTimer);},clearSubMenuTimer:function(){this.clearTimer(this.subMenuTimer);},clearTimer:function(timer){if(typeof timer!='undefined'){clearTimeout(timer);}},showMenu:function(menuId){responsiveMenu.hideAllMenus();JQ('#'+menuId).addClass(this.showClass);},hideAllMenus:function(){JQ('.siteMenu__dropdown').removeClass(this.showClass);},openSubMenu:function(subMenuId){this.clearMenuTimer();this.clearSubMenuTimer();if(subMenuId!==undefined&&!JQ('#'+subMenuId).hasClass(this.showClass)){this.subMenuTimer=setTimeout(function(){this.showSubMenu(subMenuId);}.bind(this),300);}},clickOpenSubMenu:function(event){event.preventDefault();var $item=JQ(event.target).closest('.siteMenu__dropdownItem');this.clearSubMenuTimer();this.showSubMenu($item.data('submenu'));return false;},closeSubMenu:function(){this.clearSubMenuTimer();this.subMenuTimer=setTimeout(function(){responsiveMenu.hideAllSubMenus();},500);},showSubMenu:function(subMenuId){responsiveMenu.hideAllSubMenus();var $activeMenu=JQ('.'+this.showClass),$list=$activeMenu.find('.siteMenu__list'),parentMenuPosition=$activeMenu.closest('.siteMenu__item').position(),maxWidth=JQ('.siteHeader__top > .content_container').width(),marginLeft=parseInt($activeMenu.css('margin-left')),newWidth=maxWidth-(parentMenuPosition.left+marginLeft+$list.width()),$subMenu=JQ('#'+subMenuId);$subMenu.css({'width':newWidth}).addClass(this.showSubClass);var height=$subMenu.height();$list.css({'min-height':height});},hideAllSubMenus:function(){JQ('.siteMenu__dropdown, .siteMenu__list').removeAttr('style');JQ('.'+this.showSubClass).removeClass(this.showSubClass);}};var HeaderMenu=function(){};HeaderMenu.prototype={activeMenu:false,dropdownTimeout:null,delay:300,dropdown:{},opened:false,clearTimeout:function(){clearTimeout(this.dropdownTimeout);},setTimeout:function(execute){this.clearTimeout();this.dropdownTimeout=setTimeout(execute,this.delay);},setActive:function(activeMenu){this.closeAllDropdowns(activeMenu);this.activeMenu=activeMenu;},removeActive:function(activeMenu){if(this.activeMenu!=activeMenu){this.closeAllDropdowns();}
this.activeMenu=false;},canOpenDirectly:function(menu){return this.activeMenu===false||this.activeMenu===menu;},closeAllDropdowns:function(activeMenu){for(var name in this.dropdown){if(name!=activeMenu){this.dropdown[name].close.call(this.dropdown[name].element);}}
this.activeMenu=false;},registerDropdown:function(name,element,open,close){this.dropdown[name]={element:element,open:open,close:close};},toggle:function(name){if(breakpoint.isMobile()){return true;}
if(this.activeMenu==name){this.close(name);}
else{this.open(name);}
return false;},open:function(name){this.opened=true;this.setActive(name);this.dropdown[name].open.call(this.dropdown[name].element);JQ(document).on("click",this.clickOutsideModal);},clickOutsideModal:function(event){if(JQ(event.target).closest('.topModal').length==0){headerMenu.closeAllDropdowns(null);}},close:function(name){this.opened=false;this.removeActive(name);this.dropdown[name].close.call(this.dropdown[name].element);JQ(document).off("click",this.clickOutsideModal);}};JQ(function(){JQ('input[data-inputplaceholder]').each(function(){if(JQ(this).val()===''){JQ(this).val(JQ(this).data('inputplaceholder'));}}).focus(function(){var $this=JQ(this);if($this.val()==$this.data('inputplaceholder')){$this.val('');}}).blur(function(){var $this=JQ(this);if($this.val()==''){$this.val($this.data('inputplaceholder'));}});});(function(JQ){var AcesLogin=function(element){this.init(element);return this;};AcesLogin.prototype={container:null,hooverDiv:null,button:null,init:function(element){this.container=JQ(element);this.button=this.container.find('> a');this.dropdown=this.container.find('.topLogin__click');JQ('.siteHeader__portalItem--login > a').click(function(){return headerMenu.toggle('AcesLogin');});headerMenu.registerDropdown('AcesLogin',this,this.openDropDown.bind(this),this.closeDropDown.bind(this));},openDropDown:function(){if(!breakpoint.isMobile()){this.container.addClass('siteHeader__portalItem--active');this.dropdown.show();}},closeDropDown:function(){this.container.removeClass('siteHeader__portalItem--active');this.dropdown.hide();}};JQ.fn.acesLogin=function(){return this.each(function(key,value){var element=JQ(this);if(element.data('acesLogin'))return element.data('acesLogin');var acesLogin=new AcesLogin(this);element.data('acesLogin',acesLogin);});};})(jQuery);var headerCart=null;(function(JQ){var AcesCart=function(element){this.init(element);return this;};AcesCart.prototype={container:null,button:null,link:null,footer:null,content:null,cart:null,lineCount:0,products:[],addDropdownButton:function(){this.cart=JQ('<div class="topCart__click topModal">'+'<div class="topCart__scroll">'+'<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>'+'<div class="topCart__viewport"><div class="topCart__content"></div></div>'+'</div>'+'<div class="topCart__footer"></div>'+'</div>');this.cart.hide();this.container.append(this.cart);this.footer=JQ('.topCart__footer');this.content=JQ('.topCart__content');this.loading=JQ('<div class="topCart__loading">Product wordt toegevoegd!</div>');JQ('.topCart__click').append(this.loading);this.amount=JQ('<span class="siteHeader__portalAmount"></span>');this.button.append(this.amount);},init:function(element){this.container=JQ(element);this.button=this.container.find('> a');this.link=this.button.attr('href');this.addDropdownButton();this.updateShoppingcartJSON(shoppingCartJSONContent,false);},update:function(openAfter,cartChanged){var AC=this;ajax({url:'/winkelwagen/inhoud/json/',method:'GET',dataType:'json',contentType:'application/json',success:function(response){AC.updateShoppingcartJSON(response,openAfter,cartChanged);}});},updateShoppingcartJSON:function(data,openAfter,cartChanged){this.stopLoading(false);var productCount=0;this.footer.html('');this.content.html('');this.products=[];if(data!=0){var lines=[];JQ.each(data.bestellijst,function(key,product){product.amount=parseInt(product.amount);productCount+=product.amount;this.products.push(product);htmlProductImage='<figure class="topCart__lineImage"><img src="'+product.image+'" /></figure>';htmlAantal='<div class="topCart__lineAmount" >'+product.amount+'</div>';if(product.hasOwnProperty('url')){htmlProductDescribe='<div class="topCart__lineDescription"><a href="'+product.url+'">'+product.description+'</a></div>';}
else{htmlProductDescribe='<div class="topCart__lineDescription">'+product.description+'</div>';}
htmlProductPrice='<div class="topCart__linePrice">'+product.price_ex+'</div>';htmlLine=htmlProductImage+htmlAantal+htmlProductPrice+htmlProductDescribe;lines.push('<div class="topCart__line" id="'+key+'">'+htmlLine+'</div>');}.bind(this));var htmlLines=lines.join('');this.content.append(htmlLines);this.lineCount=lines.length;this.footer.append('<div class="topCart__footerPrice">'+'<span class="topCart__footerPriceTotal">Totaal</span>'+'<span class="topCart__footerPriceValue">'+data.totalpriceexcl+'</span>'+'<span class="topCart__footerPriceBTW">excl. BTW</span>'+'</div>'
+'<div class="topCart__footerDelivery">gratis bezorging</div>'
+'<div class="topCart__footerButton"><a href="'+this.link+'" class="buttonAces buttonAces--shoppingcart-new">Ga naar winkelwagen</a></div>');if(data.loadedFromCookie){openAfter=true;}}
else{this.lineCount=0;this.footer.append('<div class="topCart__footerLine">U heeft nog geen producten in uw winkelwagen geplaatst.</div>');}
this.updateCartAmount(productCount);this.resizeView();this.addListeners();JQ(window).trigger('cart_updated');if(openAfter){this.open();}
if(cartChanged){googledatalayer_send_ecommerce_shoppingcart(this.products);}},updateCartAmount:function(amount){this.amount.html(amount>9?'9<small>+</small>':amount);if(amount>0){this.amount.addClass('siteHeader__portalAmount--active');}
else{this.amount.removeClass('siteHeader__portalAmount--active');}},resizeView:function(){if(this.lineCount>4){JQ('.topCart__viewport').css('height','');JQ('.topCart__scroll').tinyscrollbar();JQ('.thumb').show();}
else{JQ('.topCart__viewport').css({height:this.lineCount*60});JQ('.thumb').hide();}},addListeners:function(){if(this.listenersAdded){return;}
this.listenersAdded=true;this.button.hover(function(){return headerMenu.toggle('AcesCart');});this.cart.mouseenter(function(){headerMenu.open('AcesCart');});this.cart.mouseleave(function(){headerMenu.close('AcesCart');});headerMenu.registerDropdown('AcesCart',this,this.openDropDown.bind(this),this.closeDropDown.bind(this));},openDropDown:function(){if(!breakpoint.isMobile()){this.cart.show();this.resizeView();this.container.addClass('siteHeader__portalItem--active');if(this.autoClose!=undefined){clearTimeout(this.autoClose);this.autoClose=null;}}},closeDropDown:function(){if(this.autoClose!=undefined){clearTimeout(this.autoClose);}
this.cart.hide();this.container.removeClass('siteHeader__portalItem--active');},open:function(){headerMenu.clearTimeout();headerMenu.setActive('AcesCart');this.openDropDown();this.autoClose=setTimeout(function(){headerMenu.close('AcesCart');},5000);},startLoading:function(){headerMenu.clearTimeout();headerMenu.setActive('AcesCart');this.openDropDown();this.loading.show();},stopLoading:function(hide){this.loading.hide();if(hide){this.closeDropDown();}},getProduct:function(id){for(var i=0;i<this.products.length;i++){if(this.products[i].id==id){return this.products[i];}}
return null;}};JQ.fn.acesCart=function(){var acesCart;this.each(function(key,value){var element=JQ(this);if(element.data('acesCart')){acesCart=element.data('acesCart');return;}
acesCart=new AcesCart(this);element.data('acesCart',acesCart);});return acesCart;};})(jQuery);(function(JQ){var AcesMyAccount=function(element){this.init(element);return this;};AcesMyAccount.prototype={container:null,button:null,dropdown:null,menuHeightChanged:false,scrolling:false,init:function(element){this.container=JQ(element);this.button=this.container.find('> a');this.dropdown=this.container.find('.topAccount__click');headerMenu.registerDropdown('AcesMyAccount',this,this.openDropDown.bind(this),this.closeDropDown.bind(this));JQ('.siteHeader__portalItem--account > a').click(function(){return headerMenu.toggle('AcesMyAccount');});JQ(window).resize(function(){this.menuHeight();this.setAutoScroll();}.bind(this));},openDropDown:function(){if(!breakpoint.isMobile()){this.container.addClass('siteHeader__portalItem--active');this.dropdown.show();}},closeDropDown:function(){this.container.removeClass('siteHeader__portalItem--active');this.dropdown.hide();},menuHeight:function(){var $ul=this.dropdown.find('ul'),windowHeight=JQ(window).outerHeight(),headerHeight=JQ('#header').outerHeight();$ul.removeAttr('style');this.menuHeightChanged=false;if((this.dropdown.outerHeight()+headerHeight)>windowHeight){var newHeight=windowHeight-headerHeight-20;$ul.css({height:newHeight});this.menuHeightChanged=true;}},setAutoScroll:function(){var $ul=this.dropdown.find('ul');$ul.unbind('mousemove');if(!breakpoint.isMobile()&&this.menuHeightChanged){$ul.mousemove(function(e){var liHeight=$ul.find('li:first-child').outerHeight(),fullHeight=liHeight*$ul.find('li').length,y=(e.pageY-($ul.offset().top+liHeight));$ul.scrollTop((y*Math.round(fullHeight/$ul.outerHeight())));});}},};JQ.fn.acesMyAccount=function(){return this.each(function(key,value){var element=JQ(this);if(element.data('acesMyAccount'))return element.data('acesMyAccount');var acesMyAccount=new AcesMyAccount(this);element.data('acesMyAccount',acesMyAccount);});};})(jQuery);JQ(document).ready(function(){setupPortalProducts();setupIntersections();setupTopMenu();setupContactForm();});function setupPortalProducts(){resizePortalProducts();JQ(window).resize(resizePortalProducts);}
function setupContactForm(){if(JQ('.wp-block-acesdirect-contactform').length>0){JQ('.wp-block-acesdirect-contactform').contactForm();}}
function setupIntersections(){resizePortalIntersection();JQ(window).resize(resizePortalIntersection);JQ(window).load(resizePortalIntersection);}
function setupTopMenu(){if(JQ('.portal_top_menu').length==1){JQ('.portal_top_menu').portalTopMenu();}}
function resizePortalProducts(){if(JQ('.portal_product').length>0){JQ('.portal_product').portalProduct().resize();}}
function resizePortalIntersection(){if(JQ('.page_column_left .portal_intersection').length>0){JQ.each(JQ('.page_column_left .portal_intersection').portalIntersection(),function(key,object){object.resize();});}}
var PortalProduct=function(element){this.element=JQ(element);this.init();return this;};PortalProduct.prototype={link:null,init:function(){this.setLink();this.element.find('[data-clickable]').click(this.openLink.bind(this));},openLink:function(){window.location.href=this.link;},setLink:function(){var $link=this.element.find('.portal_product_title');this.link=$link.attr('href');},resize:function(){var hideTop=false;if(breakpoint.value=='smartphone'){if((this.element.prev().length==1&&this.element.prev().hasClass('portal_product'))||(this.element.prev().length==0&&this.element.parent().is('[class*=portal_col-]')&&this.element.parent().prev().length==1&&this.element.parent().prev().is('[class*=portal_col-]')&&this.element.parent().prev().find('.portal_product'))||(this.element.prev().length==0&&this.element.parent().prev().length==0&&this.element.parent().parent().hasClass('portal_row')&&this.element.parent().parent().prev().length==1&&this.element.parent().parent().prev().hasClass('portal_row')&&this.element.parent().parent().prev().find('.portal_product'))){hideTop=true;}}
if(hideTop){this.element.addClass('portal_product_hide_top');}
else{this.element.removeClass('portal_product_hide_top');}}};JQ.fn.portalProduct=function(){var portalProduct;this.each(function(key,value){var element=JQ(this);if(element.data('portalProduct')){portalProduct=element.data('portalProduct');return;}
portalProduct=new PortalProduct(this);element.data('portalProduct',portalProduct);});return portalProduct;};var PortalIntersection=function(element){this.element=JQ(element);this.init();return this;};PortalIntersection.prototype={element:null,stub:null,stubClass:'portal_intersection_stub',init:function(){this.addStub();},addStub:function(){this.stub=JQ('<div></div>').addClass(this.stubClass);this.element.after(this.stub);},setStubHeight:function(){var height=this.element.outerHeight(true);this.stub.css({height:height});},resize:function(){var windowWidth=JQ(window).width(),mainWidth=JQ('#main').width(),offsetLeft=(windowWidth-mainWidth)/2;this.element.css({position:'absolute',width:windowWidth,left:-offsetLeft,zIndex:2,});this.setStubHeight();}};JQ.fn.portalIntersection=function(){var objects=[];this.each(function(key,value){var element=JQ(this),portalIntersection;if(element.data('portalIntersection')){portalIntersection=element.data('portalIntersection');}
else{portalIntersection=new PortalIntersection(this);element.data('portalIntersection',portalIntersection);}
objects.push(portalIntersection);});return objects;};var PortalTopMenu=function(element){this.element=JQ(element);this.init();return this;};PortalTopMenu.prototype={element:null,init:function(){var column=this.element.closest('.page_column_left'),container=column.closest('#content_page'),elements=this.element.prevAll();if(elements.length>1){elements.reverse();}
container.prepend(this.element);elements.each(function(){container.prepend(this);});},};JQ.fn.portalTopMenu=function(){var portalTopMenu;this.each(function(key,value){var element=JQ(this);if(element.data('portalTopMenu')){portalIntersection=element.data('portalTopMenu');return;}
portalTopMenu=new PortalTopMenu(this);element.data('portalTopMenu',portalTopMenu);});return portalTopMenu;};var ContactForm=function(element){this.element=JQ(element);this.init();return this;};ContactForm.prototype={element:null,emailaddress:null,button:null,form:null,id:null,popup:null,init:function(){this.emailaddress=this.element.find('#email_address').html();this.button=this.element.find('button');this.button.attr('lb-class','contactformPopup popup__no-padding');this.button.attr('lb-close','.popup__close');this.button.attr('lb-noclick','true');this.button.on('click',this.openForm.bind(this));var date=new Date();this.id='contactform'+date.getTime();},openForm:function(){var handle=new LightBoxHandle(this.button,'lbOn');this.popup=LBPage.showLightBox(handle);ajax({url:'/ajax/contactformulier/',method:'POST',dataType:'json',data:{title:'Test',send_to:this.emailaddress,},success:function(data){this.createOrFillVacancyForm(data.view);}.bind(this)});},createOrFillVacancyForm:function(view){this.popup.clear();this.popup.processInfo(view);}};function processContactJson(json){JQ('.wp-block-acesdirect-contactform').contactForm().createOrFillVacancyForm(json.view);}
JQ.fn.contactForm=function(){var contactForm;this.each(function(key,value){var element=JQ(this);if(element.data('contactForm')){contactForm=element.data('contactForm');return;}
contactForm=new ContactForm(this);element.data('contactForm',contactForm);});return contactForm;};var wordSuggest=true,suggestWordSelected=-1,lastTypedSearchKeyWord='',wordSuggestionCount=0,productSuggestionCount=0,lastKeyEntered=null,saytInputField=null,backgroundStatus=false,backgroundTimeout=null,suggestPlaceHolder=null,suggestPlaceHolderSmall='Zoeken naar...',lastSaytRequest=null;var saytInitialize=function(cx,apiKey,opt_saytParams,textField){this.INPUTFIELD=saytInputField=textField;suggestPlaceHolder=JQ(saytInputField).data('inputplaceholder');var DEF_THUMB_SIZE_=80;var DEF_MAX_RESULTS_=5;var DEF_MAX_TITLE_LEN_=45;var DEF_MAX_DESCRIPTION_LEN_=100;var PROMOTION_STANDARD_='standard';var PROMOTION_PRODUCT_='product';var connector=opt_saytParams.sayt_connector;var thumbSize=DEF_THUMB_SIZE_;var maxResults=DEF_MAX_RESULTS_;var maxTitleLen=DEF_MAX_TITLE_LEN_;var maxDescriptionLen=DEF_MAX_DESCRIPTION_LEN_;createSaytBox(opt_saytParams);var titleConfig=undefined;var descriptionConfig=undefined;var priceConfig=undefined;var extraAttributes=[];var thumbnailAsData=true;var formatSayt;var formatPromotion;var formatProduct;var formatEntry;var getValueOrNull=function(object){for(var i=1;object!=null&&i<arguments.length;++i){object=object[arguments[i]];}
return object;};var formatEntryDef=function(title,url,description,thumb,price,isPromotion,query){if(title){try{title=decodeURIComponent(escape(title));}
catch(e){}
title=decodeHtml(title);title=escapeHtml(shortenTitle(stripTags(title),maxTitleLen));}
url=escapeUrl(url);url=url.replace(/https+:\/\/.*\.nl\//,http_or_https);url=addTrailingSlash(url);url+='#q='+query;if(description){try{description=decodeURIComponent(escape(description));}
catch(e){}
description=decodeHtml(description);description=escapeHtml(shortenTitle(stripTags(description),maxDescriptionLen));}
var result=JQ('<div></div>');var link=JQ('<a class="suggest__link" title="'+title+'"'+' href="'+url+'"></a>');result.append(link);if(thumb){link.append('<span class="suggest__image"><img src="'+thumb+'" border="0"></span>');}
if(title){link.append(JQ('<span></span>').html(title));}
if(description){link.append('<span class="cse-sayt-descr">'+description+'</span>');}
if(price){link.append('<span class="cse-sayt-price">'+price+'</span>');}
return result.html();};var addTrailingSlash=function(url){if(url.indexOf('?')==-1&&url.indexOf('#')==-1&&url.substr(-1)!='/'&&url.substr(-5)!='.html'){url=url+'/';}
return url;};var formatProductDef=function(product){var defaultPrice=formatPrice(product['inventories'][0]['price'],product['inventories'][0]['currency']);var price=findAttributeByName(product,priceConfig,defaultPrice);var title=findAttributeByName(product,titleConfig,product['title']);var description=findAttributeByName(product,descriptionConfig,product['description']);var thumb=null;var first_thumb=getValueOrNull(product,'images',0,'thumbnails',0);if(first_thumb){if(thumbnailAsData&&first_thumb['content']){thumb='data:image/jpeg;base64,'+first_thumb['content'];}else{thumb=first_thumb['link'];}}
return formatEntry(title,product['link'],description,thumb,price,false);};var formatPromotionDef=function(promotion){if(promotion['type']==PROMOTION_STANDARD_){var title=titleConfig===null?undefined:promotion['name'];var description=descriptionConfig===null?undefined:promotion['description'];return formatEntry(title,promotion['destLink'],description,promotion['imageLink']?escapeUrl(promotion['imageLink']):'','',true);}else if(promotion['type']==PROMOTION_PRODUCT_){var product=promotion['product'];var title=findAttributeByName(product,titleConfig,product['title']);var description=findAttributeByName(product,descriptionConfig,product['description']);var defaultPrice=formatPrice(product['inventories'][0]['price'],product['inventories'][0]['currency']);var price=findAttributeByName(product,priceConfig,defaultPrice);var thumb=getValueOrNull(product,'images',0,'thumbnails',0,'link');thumb=thumb?escapeUrl(thumb):'';return formatEntry(title,product['link'],description,thumb,price,true);}else{return undefined;}};var formatSaytDef=function(response){var numResults=0;var sayt=[];return sayt.join('');};var formatSuggestTitle=function(title){return'<div class="suggest__title">'+title+'</div>';};var formatCategoryBox=function(response){if(response.categories.length==0){return'';}
var html=JQ('<div></div>');html.append(formatSuggestTitle('Categoriesuggesties'));var ul=JQ('<ul></ul>');html.append(ul);for(i=0;i<response.categories.length;i++){var catName=response.categories[i].mlValue;var catId=response.categories[i].fhLocation.replace('//catalog01/nl_NL/categorylevelthreetitle>','').replace('//catalog01/nl_NL/categoryleveltwotitle>','').replace('//catalog01/nl_NL/categorylevelonetitle>','').replace('{','').replace('}','');var url='/categorie/'+catId+'/';if(response.categories[i].fhLocation.indexOf('categorylevelonetitle')!=-1){catName=catName.replace(/\s/g,'_').toLowerCase();url='/categorie/#'+catName;}
ul.append('<li>'+'<a href="'+url+'" class="suggest__link">'+'<span>'+response.categories[i].mlValue+'</span>'+'</a>'+'</li>');}
return html.html();};var formatBrandsBox=function(response){if(response.brands.length==0){return'';}
var html=JQ('<div></div>');html.append(formatSuggestTitle('Merksuggesties'));var ul=JQ('<ul></ul>');html.append(ul);for(i=0;i<response.brands.length;i++){var catName=response.brands[i].mlValue,catUrl=catName.replace(/ /g,"_").toLowerCase();ul.append('<li>'+'<a href="'+catUrl+'/" class="suggest__link">'+'<span>'+catName+'</span>'+'</a>'+'</li>');}
return html.html();};var formatPopularBox=function(response,query){if(response.length==0){return'';}
var html=JQ('<div></div>');html.append(formatSuggestTitle('Populaire zoekresultaten'));var ul=JQ('<ul></ul>');for(i=0;i<Math.min(4,response.length);i++){var item=response[i];ul.append('<li>'+formatEntryDef(item.product.title,item.product.link,item.product.description,item.product.images[0].link,null,false,query)+'</li>');}
html.append(ul);return html.html();};var formatSearchUnknown=function(query){var html=JQ('<div></div>');html.append('<a href="/zoek/#q='+encodeURIComponent(query)+'" class="suggest__link searchCompleteTerm" onclick="hideSaytBox(true);">Zoeken naar <span>'+query+'</span></a>');return html.html();};var formatSuggestBox=function(response){if(response.completeTerms.length==0){return'';}
var html=JQ('<div></div>');html.append(formatSuggestTitle('Zoeksuggesties'));var ul=JQ('<ul></ul>');for(i=0;i<response.completeTerms.length;i++){var word=decodeURIComponent(response.completeTerms[i].searchterm.toLowerCase());ul.append('<li><a href="/zoek/#q='+encodeURIComponent(word)+'" class="suggest__link searchCompleteTerm" onclick="hideSaytBox(true);"><span>'+capitalizeFirstLetter(word)+'</span></a></li>');}
html.append(ul);return html.html();};var formatContentBox=function(response,title,addTypeToTitle){if(response.length==0){return'';}
var html=JQ('<div></div>');var ul=JQ('<ul></ul>');html.append(ul);for(i=0;i<response.length;i++){var url=parseADUrl(response[i].item.link),name=response[i].item.title;if(addTypeToTitle){name=response[i].item.type+' > '+name;}
name=formatTitle(name);ul.append('<li>'+'<a class="suggest__link" href="'+url+'">'+'<span>'+name+'</span>'+'</a>'+'</li>');}
html.prepend(formatSuggestTitle(title));return html.html();};var formatTitle=function(title){try{title=decodeURIComponent(escape(title));}
catch(err){}
return title;};var parseADUrl=function(url){url=url.replace('http://www.acesdirect.nl','');url=url.replace('https://www.acesdirect.nl','');return url;};var findAttributeByName=function(opt_product,opt_attrName,opt_defaultValue){if(opt_attrName===null){return null;}
if(opt_attrName){opt_attrName=opt_attrName.split('(')[0];}
if(opt_product&&opt_attrName&&opt_product['attributes']){var attributes=opt_product['attributes'];for(var i=0;i<attributes.length;++i){if(attributes[i]['name']==opt_attrName){return attributes[i]['value'];}}}
return opt_defaultValue;};var stripTags=function(s){if(s){s=String(s);return s.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/ig,'');}else{return'';}};var formatPrice=function(priceValue,currency){if(currency=='AUD'){return'$'+priceValue.toFixed(2);}else if(currency=='CNY'){return'\u00A5'+priceValue.toFixed(2);}else if(currency=='EUR'){return'\u20ac'+priceValue.toFixed(2);}else if(currency=='GBP'){return'\u00A3'+priceValue.toFixed(2);}else if(currency=='JPY'){return'\u00A5'+priceValue.toFixed(0);}else if(currency=='USD'){return'$'+priceValue.toFixed(2);}else{return priceValue.toFixed(2)+' '+currency;}};var escapeHtml=function(html){var s=''+html;return s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');};var decodeHtml=function(html){var txt=document.createElement("textarea");txt.innerHTML=html;return txt.value;};var escapeUrl=function(url){return url.replace(/</g,'%3C').replace(/>/g,'%3E').replace(/"/g,'%22');};var resultsCallback=null;var resultsRequestor=null;var saytParams=opt_saytParams||{};var country=saytParams['country']?saytParams['country'].toLowerCase():'us';country=country=='uk'?'gb':country;var language=saytParams['language'];var useCase=saytParams['use_case']||'CommerceSearchUseCase';var currency=saytParams['currency'];var app=saytParams['from_preview']?'pfe_preview:sayt':'sayt';thumbSize=saytParams['sayt_thumb_size']||DEF_THUMB_SIZE_;maxResults=saytParams['sayt_max_results']||DEF_MAX_RESULTS_;maxTitleLen=saytParams['sayt_max_title_len']||DEF_MAX_TITLE_LEN_;maxDescriptionLen=saytParams['sayt_max_description_len']||DEF_MAX_DESCRIPTION_LEN_;formatSayt=saytParams['sayt_format']||formatSaytDef;if(typeof saytParams['sayt_thumbnail_contents']!='undefined'){thumbnailAsData=saytParams['sayt_thumbnail_contents'];}else{thumbnailAsData=true;}
formatProduct=saytParams['sayt_format_product']||formatProductDef;formatPromotion=saytParams['sayt_format_promotion']||formatPromotionDef;formatEntry=saytParams['sayt_format_entry']||formatEntryDef;titleConfig=saytParams['sayt_title_config'];priceConfig=saytParams['sayt_price_config'];descriptionConfig=saytParams['sayt_description_config'];var includedAttributes=[];if(titleConfig){includedAttributes.push(titleConfig);}
if(priceConfig){includedAttributes.push(priceConfig);}
if(descriptionConfig){includedAttributes.push(descriptionConfig);}
var saytIncludeAttributes=saytParams['sayt_include_attributes']||[];for(var i=0;i<saytIncludeAttributes.length&&i<3;++i){includedAttributes.push(saytIncludeAttributes[i]);}
var attributeFilter=includedAttributes.join(',');if(thumbnailAsData){var myNavigator=saytParams['navigator']||navigator;var ua=myNavigator['userAgent'];var ieName='MSIE';var ie=ua.indexOf(ieName);if(ie>=0){var version=parseFloat(ua.substring(ie+ieName.length+1));thumbnailAsData=version>=8.0;}}
var handleSaytShoppingApiResponse=function(query,response,rawResponse){if((response['items']||response['promotions'])){response['items']=response['items']||[];wordSuggestionCount=response.completeTerms.length;productSuggestionCount=response['items'].length;showSaytBox();if(!hasResults(response)){JQ('.suggest__results--suggest').html(formatSearchUnknown(query));}
else{if(breakpoint.isMobile()){if(response.completeTerms.length>0){response.news=[];response.items=[];}
else if(response.news.length==0&&response.items.length==0){hideSaytBox(true);return;}
response.solutions=[];response.services=[];response.info=[];response.categories=[];response.brands=[];response.actions=[];}
JQ('.suggest__results--suggest').html(formatSuggestBox(response));JQ('.suggest__results--news').html(formatContentBox(response.news,'Nieuws',false));JQ('.suggest__results--info').html(formatContentBox(response.content,'Informatie',true));JQ('.suggest__results--popular').html(formatPopularBox(response.items,query));JQ('.suggest__results--actions').html(formatContentBox(response.actions,'Acties',false));if(response.items.length>0&&response.completeTerms.length==0&&response.news.length==0&&response.content.length==0&&response.actions.length==0){JQ('.suggest__column--left').html('').append(JQ('.suggest__results--popular'));}}}};var hasResults=function(response){for(var name in response){if(response.hasOwnProperty(name)){if(response[name].length>0){return true;}}}
return false;};var saytSubmit=function($input,query,callback,requestor){var queryString=query.replace(/#/g,'%23');if(window['gapi']&&gapi.client){saytSubmit_gapi($input,queryString,callback,requestor);}else if(window['shopping']){saytSubmit_googleapis(query,callback,requestor);}};var saytSubmit_gapi=function($input,queryString,callback,requestor){if(showSuggest==false||$input.val().trim()==''||$input.val().toString().length<2){hideSaytBox(false);showHistory();return;}
resultsCallback=callback;resultsRequestor=requestor;var params={'rankBy':'relevancy','startIndex':1,'maxResults':maxResults,'q':queryString,'country':country,'spelling.enabled':false,'promotions.enabled':true,'promotions.useGcsConfig':true,'thumbnails':''+thumbSize+':'+thumbSize,'facets.enabled':false,'facets.useGcsConfig':false,'redirects.enabled':false,'sayt.enabled':thumbnailAsData,'sayt.useGcsConfig':thumbnailAsData,'useCase':useCase,'attributeFilter':attributeFilter,'app':app,'productFields':'title,description,link,inventories,images'};if(language){params['language']=language;}
if(currency){params['currency']=currency;}
var fullparams={};if(saytParams['extra_params']){for(var name in saytParams['extra_params']){fullparams[name]=saytParams['extra_params'][name];}}
for(var name in params){fullparams[name]=params[name];}
var requestUrl='https://suggest.acesdirect.nl/?query='+encodeURIComponent(queryString);if(lastSaytRequest!==null){debug('abort previous sayt request');lastSaytRequest.abort();}
lastSaytRequest=JQ.ajax({url:requestUrl,data:{format:"json"},dataType:"json",success:function(response){lastSaytRequest=null;var parsedResponse=tweakwiseToGoogleResponse(response);searchControl.suggestResponse=parsedResponse;handleSaytShoppingApiResponse(queryString,parsedResponse,response);},error:function(e){if(e.statusText!='abort'){logError('Suggest',{error:'Request failed',errorMessage:e.responseText,status:e.status,url:requestUrl});}}});};var saytSubmit_googleapis=function(queryString,callback,requestor){resultsCallback=callback;resultsRequestor=requestor;var params={'rankBy':'relevancy','startIndex':1,'maxResults':maxResults,'q':queryString,'source':'cx:'+cx,'country':country,'spellingCorrection':{'enabled':false},'promotions':{'enabled':true,'useGcsConfig':true},'thumbnails':''+thumbSize+':'+thumbSize,'facets':{'enabled':false,'useGcsConfig':false},'redirects':{'enabled':false,'useGcsConfig':false},'sayt':{'enabled':thumbnailAsData,'useGcsConfig':thumbnailAsData},'useCase':useCase,'attributeFilter':attributeFilter,'app':'sayt','productFields':'title,description,link,inventories,images'};if(language){params['language']=language;}
if(currency){params['currency']=currency;}
var fullparams={};if(saytParams['extra_params']){for(var name in saytParams['extra_params']){fullparams[name]=saytParams['extra_params'][name];}}
for(var name in params){fullparams[name]=params[name];}};var shortenTitle=function(s,maxLen){try{if(s.length<=maxLen){return s;}
var words=s.split(/\s+/);if(words.length<=1){return s;}else if(words[0].length>=maxLen){return words[0].substr(0,maxLen);}
var len=0;for(var i=0;i<words.length;i++){if(len+words[i].length>=maxLen){words.splice(i,words.length);var last=words[words.length-1];if(last.length==1&&!last.match(/\w/)){words.splice(i-1,words.length);}
return words.join(' ');}
len+=words[i].length;if(i>0)len++;}
return words.join(' ');}catch(err){return s.trim(0,maxLen);}};registerKeyEvents();registerClickEvents();registerWindowEvents();return{'saytSubmit':saytSubmit,'formatPrice':formatPrice,'shortenTitle':shortenTitle,'stripTags':stripTags,'findAttributeByName':findAttributeByName,'format':formatSaytDef,'formatPromotion':formatPromotionDef,'formatProduct':formatProductDef,'formatEntry':formatEntryDef,'thumbnailsSupported':thumbnailAsData};};function tweakwiseToGoogleResponse(response)
{var gResponse={items:[],completeTerms:[],categories:[],brands:[],actions:[],info:[],services:[],solutions:[],news:[],};if(response.suggestions!=undefined){gResponse.completeTerms=response.suggestions;}
if(response.items!=undefined){gResponse.items=tweakwiseToGoogleItems(response.items);}
if(response.content!=undefined){gResponse.content=tweakwiseToGoogleContent(response.content);}
if(response.news!=undefined){gResponse.news=tweakwiseToGoogleContent(response.news);}
if(response.actions!=undefined){gResponse.actions=tweakwiseToGoogleContent(response.actions);}
gResponse.currentItemCount=gResponse.items.length;return gResponse;}
function tweakwiseToGoogleItems(items)
{for(i=0;i<items.length;i++){items[i]=tweakwiseItemToGoogleItem(items[i]);}
return items;}
function tweakwiseItemToGoogleItem(item)
{var gItem={};gItem.kind="shopping#product";gItem.selfLink=item.link;gItem.product={};gItem.product.title=item.title;gItem.product.attributes=[{"displayName":"brand","name":"brand","type":"text","value":item.brand}];gItem.product.link=item.link;gItem.product.inventories=[{"channel":"online","availability":"inStock","price":parseFloat(item.price),"currency":"EUR"}];gItem.product.images=[{"link":item.image,"status":"available","thumbnails":[{"width":35,"height":35,"link":item.image}]}];return gItem;}
function tweakwiseToGoogleContent(items){for(i=0;i<items.length;i++){items[i]=tweakwiseItemToGoogleContent(items[i]);}
return items;}
function tweakwiseItemToGoogleContent(item)
{var gItem={};gItem.selfLink=item.link;gItem.item={};gItem.item.title=item.title;gItem.item.type=item.content_type;gItem.item.link=item.link;return gItem;}
function createSaytBox(opt_saytParams)
{JQ('.siteHeader__search').append(JQ('<div></div>').addClass('suggestBackground'));var box='<div class="suggest">'+'<div class="suggest__arrow"></div>'+'<div class="suggest__column suggest__column--left"></div>'+'<div class="suggest__verticalBar"></div>'+'<div class="suggest__column suggest__column--right"></div>'+'</div>';JQ('.siteHeader__search').append(box);JQ(window).resize(function(){hideSaytBox(true);});JQ(document).mouseup(function(e)
{var container=JQ('.suggest');if(!container.is(e.target)&&container.has(e.target).length===0&&!JQ(this.INPUTFIELD).is(e.target))
{hideSaytBox(false);}});}
function triggerSearch($input,isWordSuggest){var searchValue=$input.val();wordSuggest=isWordSuggest;if(wordSuggest){lastTypedSearchKeyWord=searchValue;}
JQ(this.INPUTFIELD).not($input).val(searchValue);if(searchValue!=''){JQ(this.INPUTFIELD).closest('.siteHeader__searchContainer').addClass('siteHeader__searchContainer--filled');}
else{JQ(this.INPUTFIELD).closest('.siteHeader__searchContainer').removeClass('siteHeader__searchContainer--filled');}
sayt.saytSubmit($input,searchValue,function(){},this);}
function showSaytBox(){if(wordSuggest){var searchSuggestBox=JQ('<div class="suggest__results suggest__results--suggest"></div>');var searchNewsBox=JQ('<div class="suggest__results suggest__results--news"></div>');var searchSolutionsBox=JQ('<div class="suggest__results suggest__results--solutions"></div>');var searchServicesBox=JQ('<div class="suggest__results suggest__results--services"></div>');var searchInfoBox=JQ('<div class="suggest__results suggest__results--info"></div>');var searchCategoryBox=JQ('<div class="suggest__results suggest__results--category"></div>');var searchBrandBox=JQ('<div class="suggest__results suggest__results--brand"></div>');var searchPopularBox=JQ('<div class="suggest__results suggest__results--popular"></div>');var searchActionsBox=JQ('<div class="suggest__results suggest__results--actions"></div>');JQ('.suggest__column--left').html('');JQ('.suggest__column--right').html('');JQ('.suggest__column--left').append(searchSuggestBox);JQ('.suggest__column--left').append(searchNewsBox);JQ('.suggest__column--left').append(searchSolutionsBox);JQ('.suggest__column--left').append(searchServicesBox);JQ('.suggest__column--left').append(searchInfoBox);JQ('.suggest__column--right').append(searchCategoryBox);JQ('.suggest__column--right').append(searchBrandBox);JQ('.suggest__column--right').append(searchPopularBox);JQ('.suggest__column--right').append(searchActionsBox);}
if(lastKeyEntered!=13){hideHistory(false);JQ('.suggest').show();showBackground();}}
function capitalizeFirstLetter(string){return string.charAt(0).toUpperCase()+string.slice(1);}
function hideSaytBox(hide){suggestWordSelected=-1;JQ('.suggest').hide();if(hide){hideBackground();}}
function showHistory(){var searchHistory=getHistoryLines();var $history=getHistoryObject(),$ul=JQ('<ul></ul>');$history.html('');if(searchHistory.length==0){var string=JQ(saytInputField).val();if(string==JQ(saytInputField).data('inputplaceholder')||string==''){showBackground();return hideHistory();}
var $li=JQ('<li></li>'),$a=JQ('<a></a>').attr('href','/zoek/#q='+string).attr('onclick','hideHistory(true);').text('Zoeken naar '+string);$li.append($a);$ul.append($li);}
for(var i=0;i<searchHistory.length;i++){var $li=JQ('<li></li>'),$a=JQ('<a></a>').attr('href','/zoek/#q='+searchHistory[i]).attr('onclick','hideHistory(true);').text(searchHistory[i]);$li.append($a);$ul.append($li);}
$history.append($ul);showBackground();}
function getHistoryLines(){var searchHistory=searchControl.getSearchHistory(),history=[],searchString=JQ(saytInputField).val();if(searchString.trim()===''||searchString===JQ(saytInputField).data('inputplaceholder')){return searchHistory.slice(0,5);}
for(var i=0;i<searchHistory.length;i++){var line=searchHistory[i];if(line.indexOf(searchString)!==0){continue;}
history.push(line);}
return history.slice(0,5);}
function getHistoryObject(){var $history=JQ('.searchHistory');if($history.length==0){$history=JQ('<div></div>').addClass('searchHistory');JQ('.siteHeader__searchContainer').append($history);$history=JQ('.searchHistory');}
$history.show();return $history;}
function hideHistory(hide){JQ('.searchHistory').hide();if(hide){hideBackground();}}
function showBackground(){if(backgroundTimeout!=null){clearTimeout(backgroundTimeout);}
backgroundStatus=true;backgroundTimeout=setTimeout(setBackgroundStatus,100);}
function hideBackground(){if(backgroundTimeout!=null){clearTimeout(backgroundTimeout);}
backgroundStatus=false;backgroundTimeout=setTimeout(setBackgroundStatus,100);}
function setBackgroundStatus(){if(backgroundStatus&&!JQ('.suggestBackground').is(':visible')){JQ('.suggestBackground').stop().fadeIn(200);}
else if(!backgroundStatus&&JQ('.suggestBackground').is(':visible')){JQ('.suggestBackground').stop().fadeOut(200);}}
function registerKeyEvents()
{JQ(this.INPUTFIELD).keydown(function(event){if(event.keyCode==27){JQ(this.INPUTFIELD).val(lastTypedSearchKeyWord);hideSaytBox(true);}else if(event.keyCode==9){autoCompleteFirstWord();return false;}else if(event.keyCode==38){selectPrevSearchTerm();return false;}else if(event.keyCode==40){selectNextSearchTerm();}
return true;});JQ(this.INPUTFIELD).keyup(function(event){var $input=JQ(this);lastKeyEntered=event.keyCode;if(event.keyCode==27){JQ(this.INPUTFIELD).val(lastTypedSearchKeyWord);hideSaytBox(true);hideHistory(true);}else if(event.keyCode==38){}else if(event.keyCode==40){}else if(event.keyCode==13){hideSaytBox(true);hideHistory(true);}else{triggerSearch($input,true);}});JQ(this.INPUTFIELD).on('focus',function(){JQ(this).closest('.siteHeader__search').removeClass('show_off');showHistory();});JQ(this.INPUTFIELD).on('blur',function(){setTimeout(function(){hideHistory(true);},100);});JQ('body').on('mousedown','.searchHistory',function(event){event.preventDefault();});}
function registerClickEvents(){JQ('body').on('click','.siteHeader__searchClear',function(){JQ(this.INPUTFIELD).val('');JQ(this.INPUTFIELD).closest('.siteHeader__searchContainer').removeClass('siteHeader__searchContainer--filled');JQ(this.INPUTFIELD).focus();}.bind(this));}
function registerWindowEvents(){JQ(window).resize(JQ.throttle(250,updateSuggestPlaceHolder.bind(this)));updateSuggestPlaceHolder();}
function updateSuggestPlaceHolder(){var $input=JQ(saytInputField);if($input.val()==$input.data('inputplaceholder')){if($input.textFits(suggestPlaceHolder)){$input.data('inputplaceholder',suggestPlaceHolder);if($input.val()!=suggestPlaceHolder){$input.val(suggestPlaceHolder);}}
else{$input.data('inputplaceholder',suggestPlaceHolderSmall);if($input.val()!=suggestPlaceHolderSmall){$input.val(suggestPlaceHolderSmall);}}}}
function autoCompleteFirstWord()
{if(wordSuggestionCount==0){return false;}
if(!JQ('.suggest').is(':visible')){return;}
var word=JQ('.searchCompleteTerm').eq(0).text();JQ(this.INPUTFIELD).val(word);}
function selectSearchTerm(direction)
{if(wordSuggestionCount==0){return false;}
if(!JQ('.suggest').is(':visible')){triggerSearch(true);return;}
JQ('.searchCompleteTerm').removeClass('sayt_selected');if(direction>0){suggestWordSelected++;if(suggestWordSelected>=JQ('.searchCompleteTerm').length){suggestWordSelected=0;}}
else{suggestWordSelected--;if(suggestWordSelected<0){suggestWordSelected=JQ('.searchCompleteTerm').length-1;}}
var word=JQ('.searchCompleteTerm').eq(suggestWordSelected).addClass('sayt_selected').text();JQ(this.INPUTFIELD).val(word);triggerSearch(false);}
function selectNextSearchTerm(){selectSearchTerm(1);}
function selectPrevSearchTerm(){selectSearchTerm(-1);}var LightBoxPage=function(){this.initialise();return this;};LightBoxPage.prototype={handles:[],boxes:[],isMobile:false,_listenersLoaded:false,_container:null,_overlay:null,initialise:function(){this._loadHandles();this._registerListeners();},showLightBox:function(handle){this._createContainer();var box=new LightBox();box.setParent(this);box.loadFromHandle(handle);box.id=this._newBoxId();this.boxes.push(box);this._container.append(box.box);box.reposition();this._repositionBackground();return box;},showMessage:function(message){var button=JQ('<button></button>').addClass('fake_button');lbHandle=new LightBoxHandle(button,'lbOn'),popup=LBPage.showLightBox(lbHandle);popup.processInfo(message);},closeLightBox:function(box){for(var i=0;i<this.boxes.length;i++){if(this.boxes[i].id==box.id){box.close();this.boxes.splice(i,1);break;}}
this._repositionBackground();if(this.boxes.length==0){this._removeContainer();}},closeTopLightBox:function(){if(this.boxes.length==0){alert('Geen lightbox meer om te sluiten!');return;}
var box=this.boxes.pop();box.close();this._repositionBackground();if(this.boxes.length==0){this._removeContainer();}},closeAllBoxes:function(){if(this.boxes.length==0){return;}
for(var i=0;i<this.boxes.length;i++){this.boxes[i].close();}
this.boxes=[];this._removeContainer();},_loadHandles:function(){JQ('.lbOn').each(function(index,element){var handle=new LightBoxHandle(element,'lbOn');handle.setParent(this);this.handles.push(handle);}.bind(this));},_registerListeners:function(){if(this._listenersLoaded==true){return;}
JQ(window).unbind('keyup').on('keyup',function(e){if(e.keyCode===27){this.closeAllBoxes();}}.bind(this));JQ(window).on('viewport_changed',function(event,newView){this._checkMobileDevice(newView);}.bind(this));this._checkMobileDevice(breakpoint.value);},_checkMobileDevice:function(device){switch(device){case'smartphone':case'tablet':this.isMobile=true;break;default:this.isMobile=false;break;}},_createContainer:function(){if(this._container!=null){return;}
this._container=JQ('<div></div>').attr('id','lightbox_container');JQ('body').append(this._container);this._overlay=JQ('<div></div>').attr('id','overlay');this._container.append(this._overlay);this._overlay.click(this.closeTopLightBox.bind(this));if(this.isMobile){this._container.effect('slide','right');}
else{this._container.fadeIn(500);}
this._lockScrolling();this._reposition();JQ(window).resize(this._reposition.bind(this));},_removeContainer:function(){if(this._container==null){return;}
this._container.fadeOut(500);setTimeout(function(){this._overlay.remove();this._overlay=null;this._container.remove();this._container=null;}.bind(this),500);this._unlockScrolling();JQ(window).off('resize',this._reposition.bind(this));},_reposition:function(){for(var i=0;i<this.boxes.length;i++){this.boxes[i].reposition();}},_repositionBackground:function(){if(this.boxes.length==0){return;}
var lastBox=this.boxes[this.boxes.length-1];lastBox.box.before(this._overlay);},_lockScrolling:function(){JQ('body').css('overflow','hidden');},_unlockScrolling:function(){JQ('body').css('overflow','auto');},_newBoxId:function(){if(this.boxes.length==0){return 1;}
var box=this.boxes[this.boxes.length-1];return box.id+1;}};var LightBox=function(){this.initialise();return this;};LightBox.prototype={id:null,box:null,closeButton:'#closelightbox',_parent:null,initialise:function(){this._createBox();},loadFromHandle:function(handle){if(handle.elem.attr('lb-class')!=undefined){this.box.addClass(handle.elem.attr('lb-class'));}
if(handle.elem.attr('lbclass')!=undefined){this.box.addClass(handle.elem.attr('lbclass'));}
if(handle.elem.attr('lb-close')!=undefined){this.box.find(this.closeButton).remove();this.closeButton=handle.elem.attr('lb-close');}
this.box.on('click',this.closeButton,this.deactivate.bind(this));var href=handle.elem.attr('href'),parameters='',method='POST';if(handle.elem.attr("lb-href")!=undefined){href=handle.elem.attr("lb-href");}
if(handle.elem.attr('lb-param')!=undefined){parameters=JQ.parseJSON(handle.elem.attr('lb-param'));}
if(handle.elem.attr('lb-method')!=undefined){method=handle.elem.attr('lb-method');}
if(href==undefined){if(handle.elem.attr('lb-source')!=undefined){let source=handle.elem.attr('lb-source');this.processInfo(JQ(source).html());}
return;}
ajax({url:href,method:method,data:parameters,success:this.processInfo.bind(this)});},clear:function(){this.box.find('#lbContent').remove();},processInfo:function(response){var info=JQ('<div></div>').attr('id','lbContent');info.html(this._parseResponse(response));this.box.find('#lbLoadMessage').remove();this.box.removeClass('loading').addClass('done');this.box.append(info);this.reposition();this._parent.initialise();},close:function(){this.box.remove();},deactivate:function(){this._parent.closeLightBox(this);},reposition:function(){var lbHeight=this.box.outerHeight(),lbWidth=this.box.width(),containerHeight=this._parent._container.height(),offset=100;if(this._parent.isMobile){this.box.css({position:'absolute',top:'0',left:'0',margin:'0'});this._parent._overlay.css({right:0});}else{var marginTop=Math.min(lbHeight/2,(containerHeight/2)-offset);this.box.css({position:'absolute',top:'50%',left:'50%',margin:'-'+marginTop+'px 0 '+offset+'px -'+(lbWidth/2)+'px'});this._parent._overlay.css({right:0});}},setParent:function(parent){this._parent=parent;},_createBox:function(){this.box=JQ('<div></div>').attr('id','lightbox').addClass('loading').html('<div id="closelightbox" title="Sluit venster."></div><div id="lbLoadMessage">'+'<img style="position:absolute;top:50%;left:50%; margin-top:-16px;margin-left:-16px;" src="https://content1.acesdirect.nl//site_images/template/loading.gif" />'+'</div>');},_parseResponse:function(response){var startTag='<!-- start content  -->',start=response.indexOf(startTag)+startTag.length,end=response.indexOf('<!-- end content -->'),content=response;if(end!=-1&&start!=-1){content=response.substring(start,end);}
return content;}};var LightBoxHandle=function(elem,className){this.initialise(elem,className);return this;};LightBoxHandle.prototype={elem:null,active:true,_parent:null,initialise:function(elem,className){this.elem=JQ(elem);this.elem.removeClass(className).addClass('lb_active');this._registerListeners();this.elem.data('lightbox',this);},activate:function(event){event.preventDefault();if(this.active){this._parent.showLightBox(this);}},enable:function(){this.active=true;},disable:function(){this.active=false;},setParent:function(parent){this._parent=parent;if(this.elem.attr('LbAutoTrigger')=='true'){this._parent.showLightBox(this);}},_registerListeners:function(){if(this.elem.attr('lb-noclick')===undefined){this.elem.click(this.activate.bind(this));}}};var LBPage=null;function lightboxinitialize(){LBPage.initialise();}
JQ(function(){LBPage=new LightBoxPage();});(function(e){e.Zebra_Tooltips=function(k,p){var q={animation_speed:250,animation_offset:20,background_color:"#000",close_on_click:!0,color:"#FFF",content:!1,default_position:"above",hide_delay:100,keep_visible:!0,max_width:250,opacity:".95",position:"center",prerender:!1,show_delay:100,vertical_offset:0,onBeforeHide:null,onHide:null,onBeforeShow:null,onShow:null},b=this,l,u,h,r;b.settings={};b.hide=function(b,a){b.each(function(){var b=e(this),c=b.data("Zebra_Tooltip");c&&(c.sticky=!1,a&&(c.destroy=!0),b.data("Zebra_Tooltip",c),m(b))})};b.show=function(b,a){b.each(function(){var b=e(this),c=b.data("Zebra_Tooltip");c&&(c.sticky=!0,c.muted=!1,a&&(c.destroy=!0),b.data("Zebra_Tooltip",c),s(b))})};var n=function(c){var a=c.data("Zebra_Tooltip");if(!a.tooltip){var d=jQuery("<div>",{"class":"Zebra_Tooltip",css:{opacity:0,display:"block"}}),g=jQuery("<div>",{"class":"Zebra_Tooltip_Message",css:{"max-width":b.settings.max_width,"background-color":b.settings.background_color,color:b.settings.color}}).html(b.settings.content?b.settings.content:a.content).appendTo(d),a=jQuery("<div>",{"class":"Zebra_Tooltip_Arrow"}).appendTo(d),t=jQuery("<div>").appendTo(a);b.settings.keep_visible&&(d.bind("mouseleave"+(b.settings.close_on_click?" click":""),function(){m(c)}),d.bind("mouseenter",function(){s(c)}));d.appendTo("body");var k=d.outerWidth(),n=d.outerHeight(),p=t.outerWidth(),v=t.outerHeight(),f=g.outerWidth(),q=g.outerHeight(),a={tooltip:d,tooltip_width:k,tooltip_height:n+v/2,message:g,arrow_container:a,arrow_width:p,arrow_height:v,arrow:t};d.css({width:a.tooltip_width,height:a.tooltip_height});a.tooltip_width+=g.outerWidth()-f;a.tooltip_height+=g.outerHeight()-q;d.css({width:a.tooltip_width,height:a.tooltip_height,display:"none"});a=e.extend(c.data("Zebra_Tooltip"),a);c.data("Zebra_Tooltip",a)}a.sticky&&!a.close&&(jQuery("<a>",{"class":"Zebra_Tooltip_Close",href:"javascript:void(0)"}).html("x").bind("click",function(a){a.preventDefault();a=c.data("Zebra_Tooltip");a.sticky=!1;c.data("Zebra_Tooltip",a);m(c)}).appendTo(a.message),a.close=!0,a=e.extend(c.data("Zebra_Tooltip"),a),c.data("Zebra_Tooltip",a));if(a.window_resized||a.window_scrolled)d=e(window),a.window_resized&&(l=d.width(),u=d.height(),g=c.offset(),e.extend(a,{element_left:g.left,element_top:g.top,element_width:c.outerWidth(),element_height:c.outerHeight()})),r=d.scrollTop(),h=d.scrollLeft(),d="left"==b.settings.position?a.element_left-a.tooltip_width+a.arrow_width:"right"==b.settings.position?a.element_left+a.element_width-a.arrow_width:a.element_left+(a.element_width-a.tooltip_width)/2,g=a.element_top-a.tooltip_height,f="left"==b.settings.position?a.tooltip_width-a.arrow_width-a.arrow_width/2:"right"==b.settings.position?a.arrow_width/2:(a.tooltip_width-a.arrow_width)/2,d+a.tooltip_width>l+h&&(f-=l+h-(d+a.tooltip_width)-6,d=l+h-a.tooltip_width-6,f+a.arrow_width>a.tooltip_width-6&&(f=a.tooltip_width-6-a.arrow_width),d+f+a.arrow_width/2<a.element_left&&(f=-1E4)),d<h&&(f-=h-d,d=h+2,0>f&&(f=a.arrow_width/2),d+f+a.arrow_width/2>a.element_left+a.element_width&&(f=-1E4)),a.arrow_container.removeClass("Zebra_Tooltip_Arrow_Top"),a.arrow_container.addClass("Zebra_Tooltip_Arrow_Bottom"),a.message.css("margin-top",""),a.arrow.css("borderColor",b.settings.background_color+" transparent transparent"),g<r||"below"==b.settings.default_position&&a.element_top+a.element_height+b.settings.vertical_offset+a.tooltip_height+a.animation_offset<u+r?(g=a.element_top+a.element_height-b.settings.vertical_offset,a.animation_offset=Math.abs(a.animation_offset),a.message.css("margin-top",a.arrow_height/2),a.arrow_container.removeClass("Zebra_Tooltip_Arrow_Bottom"),a.arrow_container.addClass("Zebra_Tooltip_Arrow_Top"),a.arrow.css("borderColor","transparent transparent "+b.settings.background_color)):(a.animation_offset=-Math.abs(a.animation_offset),g+=b.settings.vertical_offset),a.arrow_container.css("left",f),a.tooltip.css({left:d,top:g}),e.extend(a,{tooltip_left:d,tooltip_top:g,arrow_left:f}),a.window_resized=!1,a.window_scrolled=!1,a=e.extend(c.data("Zebra_Tooltip"),a),c.data("Zebra_Tooltip",a);return a},m=function(c){var a=c.data("Zebra_Tooltip");clearTimeout(a.hide_timeout);a.sticky||(clearTimeout(a.show_timeout),a.hide_timeout=setTimeout(function(){if(a.tooltip){if(b.settings.onBeforeHide&&"function"==typeof b.settings.onBeforeHide)b.settings.onBeforeHide(c,a.tooltip);a.close=!1;a.destroy&&(a.muted=!0);c.data("Zebra_Tooltip",a);e("a.Zebra_Tooltip_Close",a.tooltip).remove();a.tooltip.stop();a.tooltip.animate({opacity:0,top:a.tooltip_top+a.animation_offset},b.settings.animation_speed,function(){e(this).css("display","none");if(b.settings.onHide&&"function"==typeof b.settings.onHide)b.settings.onHide(c,a.tooltip)})}},b.settings.hide_delay))},s=function(c){var a=c.data("Zebra_Tooltip");clearTimeout(a.show_timeout);a.muted||(clearTimeout(a.hide_timeout),a.show_timeout=setTimeout(function(){a=n(c);if(b.settings.onBeforeShow&&"function"==typeof b.settings.onBeforeShow)b.settings.onBeforeShow(c,a.tooltip);"block"!=a.tooltip.css("display")&&a.tooltip.css({top:a.tooltip_top+a.animation_offset});a.tooltip.css("display","block");a.tooltip.stop();a.tooltip.animate({top:a.tooltip_top,opacity:b.settings.opacity},b.settings.animation_speed,function(){if(b.settings.onShow&&"function"==typeof b.settings.onShow)b.settings.onShow(c,a.tooltip)})},b.settings.show_delay))};(function(){b.settings=e.extend({},q,p);k.each(function(){var c=e(this),a=c.attr("title"),d=c.data("zebra-tooltip");if(a&&""!==a||d&&""!==d||void 0!==b.settings.content)c.bind({mouseenter:function(){s(c)},mouseleave:function(){m(c)}}),c.data("Zebra_Tooltip",{tooltip:null,content:d||a||"",window_resized:!0,window_scrolled:!0,show_timeout:null,hide_timeout:null,animation_offset:b.settings.animation_offset,sticky:!1,destroy:!1,muted:!1}),c.attr("title",""),b.settings.prerender&&n(c)});e(window).bind("scroll resize",function(b){k.each(function(){var a=e(this).data("Zebra_Tooltip");a&&("scroll"==b.type?a.window_scrolled=!0:a.window_resized=!0,e(this).data("Zebra_Tooltip",a))})})})()}})(jQuery);var ProductCompare=function(){this.init();return this;};ProductCompare.prototype={selector:'[data-compare="true"]',minProducts:2,maxProducts:3,compareUrl:'/vergelijk/?products=',imageUrl:'https://cd.acesdirect.nl/image/product/',imageSize:100,selectedProducts:[],selectedProductsCategory:'',cookieSelectedProducts:'compareSelectedCookie',cookieCategory:'compareProductCatCookie',cookieExpires:7,element:{widgetId:'product_compare',labelId:'labelProduct',compareProductId:'compareProduct'},template:{compareText:'Toevoegen aan vergelijking',compare:'<label class="product_compare_label">'+'   <input type="checkbox" value="1" name="productCompare[]" class="productcheckbox">'+'   *compareText*'+'</label>',product:'<li>'+'   <div class="product_compare_remove">X</div>'+'   <a href="#" target="_blank">'+'       <div class="product_compare_productimg">'+'           <img src="" alt="">'+'       </div>'+'       <div class="product_compare_productdesc">'+'       </div>'+'   </a>'+'</li>',widget:'<div>'+'   <div class="product_compare_title">'+'       <strong>Producten vergelijken</strong>'+'       <div class="product_compare_toggle"></div>'+'       <div class="product_compare_close">X</div>'+'   </div>'+'   <div class="product_compare_content clear_after">'+'       <ul>'+'       </ul>'+'   </div>'+'   <div class="product_compare_button">'+'       <button class="aces_block_button">Vergelijk producten</button>'+'   </div>'+'</div>'},widgetVisible:false,initialised:false,trigger:false,notifications:null,init:function(){this.registerHandlers();this.registerTriggers();this.addCompareButton();this.initialised=true;if(!this.trigger){this.loadCookieData();}},initTrigger:function(){this.trigger=true;this.init();},registerHandlers:function(){if(!this.initialised){JQ(document).on('change','.productcheckbox',this.changeCheckbox.bind(this));JQ(document).on('click','.product_compare_remove, .remove_from_selection',this.clickRemoveProduct.bind(this));JQ(document).on('click','.product_compare_toggle',this.toggleWidget.bind(this));JQ(document).on('click','.product_compare_close',this.closeWidget.bind(this));JQ(document).on('click','.product_compare_button button',this.startCompare.bind(this));JQ(document).on('click','.start_new_compare',this.startNewCompare.bind(this));JQ(document).on('click','.product_compare_title > strong',this.toggleWidget.bind(this));JQ(window).on('viewport_changed',this.closeWidgetViewport.bind(this));}},registerTriggers:function(){if(!this.initialised){JQ(window).on('compare:init',this.initTrigger.bind(this));JQ(window).on('compare:product',this.addProductTrigger.bind(this));}},addCompareButton:function(){JQ(this.selector).each(function(key,object){var $object=JQ(object),labelId=this.element.labelId+$object.data('product'),compareHtml=this.getCompareHtml($object.data('compare-text')),$compareObject=JQ(compareHtml).attr('id',labelId);if(typeof $object.data('compare-class')!=='undefined'){$compareObject.addClass($object.data('compare-class'));}
if($object.find('#'+labelId).length===0){if(typeof $object.data('compare-append')!=='undefined'){JQ($object.data('compare-append'),$object).append($compareObject);}else{$object.prepend($compareObject);}}}.bind(this));this.setChecked();},getCompareHtml:function(compareText){if(compareText==undefined){compareText=this.template.compareText;}
return this.template.compare.replace('*compareText*',compareText);},setChecked:function(){if(this.selectedProducts.length>0){var labelId=this.element.labelId;JQ(this.selectedProducts).each(function(key,value){JQ('#'+labelId+value.id).find('input[type=checkbox]').attr('checked','checked');});}},changeCheckbox:function(event){var $object=JQ(event.target),$product=$object.closest(this.selector),productId=$product.data('product'),category=$product.data('category'),changeCheckbox=true;if($object.is(':checked')){var $link=$product.find($product.data('compare-title')),productTitle=$link.html(),productLink=$link.attr('href');if(typeof $link.attr('href')==='undefined'){productLink=window.location.href;}
changeCheckbox=this.addProduct(productId,productTitle,productLink,category);if(!changeCheckbox){$object.removeAttr('checked');}}else{this.removeProduct(productId);}},clickRemoveProduct:function(event){event.preventDefault();var productId=JQ(event.target).data('product'),id=this.element.labelId+productId,$checkbox=JQ('#'+id).find('input[type=checkbox]');if($checkbox.length>0){$checkbox.trigger('click');}else{this.removeProduct(productId);}},startNewCompare:function(event){event.preventDefault();var self=this,$element=JQ(event.target),productId=$element.data('product'),$object=JQ('#'+this.element.labelId+productId),$product=$object.closest(this.selector),category=$product.data('category'),$link=$product.find($product.data('compare-title')),productTitle=$link.html(),productLink=$link.attr('href');JQ.each(this.selectedProducts,function(key,value){self.removeProduct(value.id);});setTimeout(function(){self.addProduct(productId,productTitle,productLink,category);self.setChecked();$element.notificationClose();},250);},addProduct:function(productId,productTitle,productLink,category){this.loadCookieData();if(this.selectedProducts.length==this.maxProducts){this.showMessage('#'+this.element.labelId+productId,'maxProducts');return false;}
var changeSelectedCategory=true;if(this.selectedProductsCategory!==''&&this.selectedProductsCategory!=category){this.showMessage('#'+this.element.labelId+productId,'differentCategory');changeSelectedCategory=false;}
this.selectedProducts.push({id:productId,url:productLink,title:productTitle,});if(changeSelectedCategory&&(this.selectedProductsCategory===''||this.selectedProductsCategoryId!=category)){this.selectedProductsCategory=category;this.setCookie(this.cookieCategory,this.selectedProductsCategory,this.cookieExpires);}
this.updateCookie();this.createWidget();if(!this.getWidgetIsVisible()){this.toggleWidget();}
return true;},addProductTrigger:function(event,productId,productTitle,productLink,category){this.addProduct(productId,productTitle,productLink,category);this.setChecked();},removeProduct:function(productId){var self=this;this.selectedProducts=this.selectedProducts.filter(function(el){return el.id!=productId;});this.updateCookie();JQ('#'+this.element.compareProductId+productId).remove();self.updateWidget();},updateCookie:function(){this.setCookie(this.cookieSelectedProducts,this.selectedProducts,this.cookieExpires);},startCompare:function(event){event.preventDefault();if(this.selectedProducts.length<this.minProducts){this.showMessage('.product_compare_button','minProducts');return false;}
var products='';JQ.each(this.selectedProducts,function(key,value){products+=value.id+',';});document.location=window.location.origin+this.compareUrl+products;},createWidget:function(){if(!this.widgetVisible){var $widget=JQ(this.template.widget).attr('id',this.element.widgetId);JQ('body').append($widget);this.element.widget=JQ('#'+this.element.widgetId);this.element.title=JQ('.product_compare_title');this.element.toggleButton=JQ('.product_compare_toggle');this.element.widget.fadeIn();this.widgetVisible=true;}
this.updateWidget();},updateWidget:function(){if(this.selectedProducts.length===0){this.closeWidget();}else{var $compareList=JQ('.product_compare_content ul'),compareProductId=this.element.compareProductId;JQ.each(this.selectedProducts,function(key,value){var compareId=compareProductId+value.id,$content=JQ(this.template.product).attr('id',compareId);$content.find('a').attr('href',value.url);$content.find('.product_compare_productimg img').attr('src',this.imageUrl+value.id+'/'+this.imageSize);$content.find('.product_compare_productdesc').html(value.title);$content.find('.product_compare_remove').attr('data-product',value.id);$compareList.append($content);JQ('#'+compareId).fadeIn();}.bind(this));}},toggleWidget:function(animate){if(this.getWidgetIsVisible()){this.hideWidget(animate);}else{this.showWidget(animate);}},getWidgetIsVisible:function(){return(this.element.widget.data('hidden')===undefined||this.element.widget.data('hidden')==false);},showWidget:function(){this.element.widget.animate({bottom:'0'});this.element.widget.addClass('product_compare--open');this.element.widget.data('hidden',false);},hideWidget:function(animate){var bottom=(this.element.widget.outerHeight()-this.element.title.outerHeight())*-1;if(animate){this.element.widget.animate({bottom:bottom+'px'});}else{this.element.widget.css({bottom:bottom+'px'});}
this.element.widget.removeClass('product_compare--open');this.element.widget.data('hidden',true);},closeWidget:function(){if(this.widgetVisible){if(this.selectedProducts.length>0){var labelId=this.element.labelId;JQ.each(this.selectedProducts,function(key,value){JQ('#'+labelId+value.id).find('input[type=checkbox]').trigger('click');});}
this.element.widget.fadeOut(200,function(){JQ(this).remove();});this.clear();}},closeWidgetViewport:function(){if(breakpoint.value=='smartphone'){this.closeWidget();}},clear:function(){this.selectedProducts=[];this.widgetVisible=false;this.selectedProductsCategory='';this.deleteCookie(this.cookieSelectedProducts);},showMessage:function(element,type){var $element=JQ(element),title='',message='',options={};switch(type){case'maxProducts':title='Maximaal aantal producten';message='U kunt maximaal '+this.maxProducts+' producten met elkaar vergelijken.';break;case'minProducts':title='Minimaal aantal producten';message='U heeft minimaal '+this.minProducts+' producten nodig om een vergelijking te maken.';options.position='top';break;case'differentCategory':var $product=$element.closest(this.selector);title=$product.data('category')+' vergelijken?';message=this.selectedProductsCategory+' hebben andere eigenschappen dan '+$product.data('category')+'. Weet u zeker dat u deze producten wilt vergelijken? U kunt ook een nieuwe vergelijking starten met '+$product.data('category')+'.'+'<a href="#" class="aces_block_button start_new_compare" data-product="'+$product.data('product')+'">Nieuwe vergelijking starten</a>';options.timeout=555000;break;}
$element.notification(title,message,options);},setCookie:function(name,value,days){var expires='';if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toUTCString();}
document.cookie=name+"="+JSON.stringify(value)+expires+"; path=/";},getCookie:function(name){var nameEQ=name+"=",ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)==0){try{return JSON.parse(c.substring(nameEQ.length,c.length));}
catch(error){return[];}}}
return null;},deleteCookie:function(name){this.setCookie(name,'','');},loadCookieData:function(){var selectedCookieData=this.getCookie(this.cookieSelectedProducts),selectedProductsCategory=this.getCookie(this.cookieCategory);if(selectedCookieData!==null&&selectedCookieData.length>0){this.widgetVisible=false;this.selectedProducts=selectedCookieData;this.selectedProductsCategory=selectedProductsCategory;if(window.location.pathname!=='/'&&window.location.pathname!=='/vergelijk/'){this.createWidget();this.setChecked();this.toggleWidget(false);}}}};var productCompareLoaded=false;JQ(function(){if(!productCompareLoaded){var productCompare=new ProductCompare();productCompareLoaded=true;}});(function(JQ){var notification=null;var Notifications=function(){return this;};Notifications.prototype={defaultOptions:{title:'',message:'',position:'bottom',timeout:7000,fadeDuration:300},template:{popup:'<div class="notification_popup"></div>',close:'<span class="close">X</span>',title:'<span class="title"></span>'},element:null,options:{},popup:null,timer:null,registerHandlers:function(){JQ(document).on('click','.notification_popup .close',function(){this.close();}.bind(this));JQ(window).scroll(function(){this.setPosition();}.bind(this));},removeHandlers:function(){JQ(document).off('click','.notification_popup .close');JQ(window).unbind('scroll');},show:function(title,message,options){if(this.popup!==null){JQ('.notification_popup').remove();}
this.defaultOptions.title=title;this.defaultOptions.message=message;this.setOptions(options);this.create();this.setPosition();this.setTimer();this.registerHandlers();this.popup.stop().fadeIn(this.options.fadeDuration);},setOptions:function(options){this.options=JQ.extend({},this.defaultOptions,options||{});},create:function(){var $close=JQ(this.template.close),$title=JQ(this.template.title).html(this.options.title);this.popup=JQ(this.template.popup).addClass('notification_popup_'+this.options.position);this.popup.append($close);this.popup.append($title);this.popup.append(this.options.message);JQ('body').append(this.popup);},setPosition:function(){var elementPos=this.element.offset();var top=elementPos.top+30;if(this.options.position==='top'){top=elementPos.top-this.popup.outerHeight();}
this.popup.css({left:elementPos.left+(this.element.width()/2),top:top});},close:function(){this.popup.stop().fadeOut(this.options.fadeDuration,function(){this.popup.remove();this.removeHandlers();this.clearTimer();}.bind(this));},setTimer:function(){this.clearTimer();this.timer=setTimeout(function(){this.close();}.bind(this),this.options.timeout);},clearTimer:function(){clearTimeout(this.timer);}};JQ.fn.notification=function(title,message,options){if(notification===null){notification=new Notifications();}
return this.each(function(key,value){notification.element=JQ(this);notification.show(title,message,options);});};JQ.fn.notificationClose=function(){if(notification===null){notification=new Notifications();}
notification.close();};}(jQuery));window.Trengo=window.Trengo||{};JQ('.siteFooter__contactMedia--Chat').click(function(){window.Trengo.Api.Widget.open('chat');});window.Trengo.on_status_offline=function(){JQ(".siteFooter__contactElement--chat").hide();};function AccountNotifications(){this.init();}
AccountNotifications.prototype={counters:[],list:null,box:null,isLoading:false,reachedEnd:false,init:function(){this.registerElements();this.registerEvents();},registerElements:function(){this.list=JQ('.notifications__list');this.box=JQ('.notifications__box');this.counters.push(JQ('#header .notifications__number'));var menuCounter=JQ('.notifications__amount');if(menuCounter.length>0){this.counters.push(menuCounter);}
var dashboardCounter=JQ('.notifications .notifications__number');if(dashboardCounter.length>0){this.counters.push(dashboardCounter);}},registerEvents:function(){if(this.box.length>0){JQ('.notifications__button, .notifications__close').click(this.toggleBox.bind(this));JQ('.notifications__action--read').click(this.readAll.bind(this));JQ('.notifications__action--remove').click(this.removeAll.bind(this));this.list.on('click','.notifications__remove',this.removeNotification.bind(this));this.list.on('click','.notifications__item',this.readNotification.bind(this));this.list.scroll(this.scrollList.bind(this));if(this.box.hasClass('notifications__box--active')){JQ('body').click(this.handleSurroundingClick.bind(this));}}},scrollList:function(){if(!this.isLoading&&!this.reachedEnd){var lastItem=this.list.find('.notifications__item:last'),lastPosition=lastItem.position(),loadPosition=lastPosition.top-this.list.innerHeight();if(loadPosition<50){this.loadNotifications();}}},loadNotifications:function(){this.setLoader(true);var lastItem=this.list.find('.notifications__item:last'),notification=lastItem.data('notification');ajax({url:'/account/meldingen/laden/',method:'POST',dataType:'json',data:{notification:notification},success:function(result){if(result.success!==false){this.updateCounter(result.unread);this.setLoader(false);this.addNotifications(result.success);}}.bind(this)});},addNotifications:function(notifications){for(var i=0;i<notifications.length;i++){var notification=notifications[i],element=JQ('<li class="notifications__item" data-notification="'+notification.id+'"></li>'),remove=JQ('<span class="notifications__remove">x</span>'),log_extra='{"type":"'+notification.object_type+'", "id":"'+notification.object_id+'"}';element.data('notification',notification.id);element.attr('data-wlog','click');element.attr('data-wlog-element_id','-1');element.attr('data-wlog-type','notification');element.attr('data-wlog-action','read');element.attr('data-wlog-extra',log_extra);if(notification.is_read){element.addClass('notifications__item--read');}
if(notification.link){element.append(JQ('<a href="'+notification.link+'" target="'+notification.target+'"></a>').html(notification.notification));}
else{element.html(notification.notification);}
element.append('<span class="notifications__date" title="'+notification.real_date_time+'">'
+notification.date_time+'</span>');remove.attr('data-wlog','click');remove.attr('data-wlog-element_id','-1');remove.attr('data-wlog-type','notification');remove.attr('data-wlog-action','remove');remove.attr('data-wlog-extra',log_extra);element.append(remove);element.insertBefore(this.list.find('.notifications__loader'));}
if(notifications.length<10){this.reachedEnd=true;this.list.unbind('scroll');}},setLoader:function(active){this.isLoading=active;if(active){this.list.find('.notifications__loader').addClass('notifications__loader--active');}
else{this.list.find('.notifications__loader').removeClass('notifications__loader--active');}},handleSurroundingClick:function(event){var element=JQ(event.target);if(element.hasClass('notifications')||element.closest('.notifications').length==1){return;}
this.toggleBox();},toggleBox:function(){var active='notifications__box--active';if(this.box.hasClass(active)){JQ('body').off('click');this.box.removeClass(active);this.list.css('height','');this.lockScrolling(false);}
else{this.box.addClass(active);JQ('body').click(this.handleSurroundingClick.bind(this));if(breakpoint.isMobile()){this.resizeList();}}},lockScrolling:function(lock){JQ('body').css('overflow',lock?'hidden':'auto');},resizeList:function(){var listPosition=this.list.position();this.list.css('height',this.box.height()-listPosition.top);this.lockScrolling(true);},readAll:function(){ajax({url:'/account/meldingen/leesAlles/',method:'POST',dataType:'json',success:function(result){if(result.success!==false){this.updateCounter(0);this.setRead('all');}}.bind(this)});},readNotification:function(event){var element=JQ(event.target);if(element.hasClass('notifications__remove')){return;}
if(!element.hasClass('notifications__item')){element=element.closest('.notifications__item');}
if(element.hasClass('notifications__item--read')){return;}
var notification=element.data('notification');ajax({url:'/account/meldingen/lees/',method:'POST',dataType:'json',data:{notification:notification},success:function(result){if(result.success!==false){this.updateCounter(result.unread);this.setRead(notification);}}.bind(this)});},removeAll:function(){if(confirm('Weet u zeker dat u alle updates wilt verwijderen?')){ajax({url:'/account/meldingen/verwijderAlles/',method:'POST',dataType:'json',success:function(result){if(result.success!==false){this.updateCounter(0);this.remove('all');}}.bind(this)});}},removeNotification:function(event){var element=JQ(event.target);if(element.hasClass('notifications__remove')){var notification=element.closest('.notifications__item').data('notification');ajax({url:'/account/meldingen/verwijder/',method:'POST',dataType:'json',data:{notification:notification},success:function(result){if(result.success!==false){this.updateCounter(result.unread);this.remove(notification);}}.bind(this)});}},updateCounter:function(amount){var display=amount>9?'9<small>+</small>':amount;for(var i=0;i<this.counters.length;i++){var counter=this.counters[i];counter.html(display);if(amount>0){counter.addClass('notifications__number--active');}
else{counter.removeClass('notifications__number--active');}}
if(amount>0){JQ('.notifications__action--read').show();}
else{JQ('.notifications__action--read').hide();}},updateActions:function(){if(this.list.find('.notifications__item').length==0){JQ('.notifications__actions').hide();}},setRead:function(element){if(element=='all'){this.list.find('.notifications__item').addClass('notifications__item--read');}
else{this.list.find('.notifications__item[data-notification="'+element+'"]').addClass('notifications__item--read');}},remove:function(element){if(element=='all'){this.list.find('.notifications__item').remove();}
else{this.list.find('.notifications__item[data-notification="'+element+'"]').remove();}
this.updateActions();this.scrollList();}};var accountNotfications;JQ(function(){accountNotfications=new AccountNotifications();});JQ(document).ready(function(){JQ('.formBuilder').formBuilder();});function sendFormBuilder(element,event){var form=JQ(element).closest('.formBuilder').formBuilder();return form.send(event);}
var FormBuilder=function(form){this.form=form;this.init();return this;};FormBuilder.prototype={url:'',class:{messages:'formBuilder__message',messagesError:'formBuilder__message--error',messagesSuccess:'formBuilder__message--success',form:'formBuilder__form',submit:'formBuilder__button--submit',error:'formBuilder__input--error'},responseStatus:{VALID:1,ERROR:2,INVALID_REQUEST:90,INVALID_REQUEST_METHOD:91,INVALID_REQUEST_ARGUMENTS:92},init:function(){this.url=this.form.attr('action');this.clearForm();this.showForm();},send:function(event){event.preventDefault();var formData=new FormData(this.form[0]);formData.append('callajax',true);var ajaxOptions={url:this.url,type:'POST',cache:false,contentType:false,processData:false,data:formData,success:this.handleResponse.bind(this)};JQ.ajax(ajaxOptions);return false;},handleResponse:function(response){var data=JQ.parseJSON(response);if(typeof data!=='object'){alert('Er is een fout opgetreden tijdens het versturen van het formulier, probeer het nogmaals of neem telefonisch contact op.')}else{if(data.status===this.responseStatus.VALID){this.clearForm();JQ('.'+this.class.messages).addClass(this.class.messagesSuccess).html(data.message);this.hideForm();}else if(data.status<this.responseStatus.INVALID_REQUEST){this.clearForm();JQ.each(data.message,function(field,error){this.setFieldError(field);this.addMessage(error);}.bind(this));JQ('.'+this.class.messages).addClass(this.class.messagesError);}else{this.clearForm();this.addMessage(data.message);JQ('.'+this.class.messages).addClass(this.class.messagesError);}}},hideForm:function(){JQ('.'+this.class.form).hide();},showForm:function(){JQ('.'+this.class.form).show();},clearForm:function(){JQ('.'+this.class.messages).html('');JQ('.'+this.class.error).removeClass(this.class.error);JQ('.'+this.class.messagesError).removeClass(this.class.messagesError);},addMessage:function(message){if(JQ('.'+this.class.messages+':contains("'+message+'")').length===0){JQ('<p>'+message+'</p>').appendTo(JQ('.'+this.class.messages));}},setFieldError:function(field){var $field=JQ('[name='+field+']');if($field.length===0){JQ('[name^='+field+']').first().addClass(''+this.class.error);}else{$field.first().addClass(''+this.class.error);}}};JQ.fn.formBuilder=function(){var formBuilder='';this.each(function(key,value){var form=JQ(this);if(form.data('formBuilder')){formBuilder=form.data('formBuilder');return;}
formBuilder=new FormBuilder(form);formBuilder=form.data('formBuilder',formBuilder);});return formBuilder;};var headerMenu,hash,bLazy;JQ(document).ready(function(){var doc=document.documentElement;doc.setAttribute('data-useragent',navigator.userAgent);googledatalayer_handleEvents();bLazy=new Blazy({});JQ(window).on('resize',JQ.throttle(100,bLazy.revalidate));headerMenu=new HeaderMenu();JQ('.siteHeader__portalItem--login').acesLogin();JQ('.siteHeader__portalItem--account').acesMyAccount();headerCart=JQ('.siteHeader__portalItem--cart').acesCart();JQ('#footerNewsLetterInput').click(function(){var $inputNewsForm=JQ('#footerNewsLetterInput');if($inputNewsForm.val()===$inputNewsForm.data('placeholder')){$inputNewsForm.val('');}
$inputNewsForm.addClass('siteFooter__subscribeInput--active');});JQ('#footerNewsLetterInput').blur(function(){var $inputNewsForm=JQ('#footerNewsLetterInput');if($inputNewsForm.val()===""){$inputNewsForm.removeClass('siteFooter__subscribeInput--active').val($inputNewsForm.data('placeholder'));}});hash=window.location.hash;if(window.location.pathname!=='/'){if(hash!=undefined){var url=window.location.href
var urlArray=url.split("/");var tabSwap=false;for(var i=0;i<urlArray.length;i++){if(isNumber(urlArray[i])){var tabSwap=true;var prodid=urlArray[i];}}}
registerMenuFold();JQ("img, area, map").focus(function(event){event.stopPropagation();});JQ('.subsubtoggle').click(function(){var target='#subsub'+JQ(this).data('target');JQ(target).toggle();JQ(this).toggleClass('open');return false;});}
JQ('.seo_snapshot_images').attr('src','');window.addEventListener('scroll',JQ.throttle(250,scrollHeader),supportsPassive?{passive:true}:false);window.addEventListener('wheel',JQ.throttle(250,scrollHeader),supportsPassive?{passive:true}:false);window.addEventListener('touchmove',JQ.throttle(250,scrollHeader),supportsPassive?{passive:true}:false);JQ(window).resize(JQ.throttle(250,scrollHeader));JQ('body').on('click','.scroll_to_top',function(event){event.preventDefault();JQ('body, html').animate({scrollTop:0,},500);});JQ('iframe').each(function(){var url=JQ(this).attr('src');if(isYoutubeUrl(url)){addChar=url.indexOf('?')==-1?'?':'&';JQ(this).attr('src',url+addChar+'wmode=transparent');}});JQ('body').on('click','a[href*=#]:not([href=#])',function(){if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){var target=JQ(this.hash);target=target.length?target:JQ('[name='+this.hash.slice(1)+']');if(target.length){window.location.hash=this.hash.slice(1);var newPos=target.offset().top;newPos-=JQ('.siteHeader__top').height();JQ('html,body').scrollTop(newPos);return false;}}});JQ('.init_slider').contentSlider();JQ(document).mousedown(function(e){switch(e.which){case 1:lastClick='left';break;case 2:lastClick='middle';break;case 3:lastClick='right';break;}
return true;});var productCompare=new Product_Compare();productCompare.register_eventhandlers();});function isNumber(n){return!isNaN(parseFloat(n))&&isFinite(n);}
(function(JQ){JQ.textWidth=function(text){var $span=JQ('<span></span>').html(text);JQ('body').append($span);var textWidth=$span.width();$span.remove();return textWidth;}
JQ.fn.textFits=function(text){var textWidth=JQ.textWidth(text),checked=0,fits=true;this.each(function(){var element=JQ(this);if(!element.is('input[type="text"]')||!element.is(':visible')){return;}
var inputWidth=element.width();if(inputWidth<textWidth){fits=false;}
checked++;});return checked>0&&fits;};JQ.fn.extend({disable:function(state){return this.each(function(){this.disabled=state;});}});})(JQ);var actionsOverruled;JQ(function(){actionsOverruled=new Actions();});var Actions=function(){this.init();return this;};Actions.prototype={rules:null,init:function(){this.rules=actionsOverrule;this.process();},process:function(){JQ.each(this.rules,function(action,rules){var start=rules.start,end=rules.end,currentDate=new Date().toJSON().slice(0,10).replace(/-/g,'/');if(currentDate>=start&&currentDate<=end){this.handleReplaceSticker(rules.sticker);if(rules.hasOwnProperty('replace')){this.handleReplace(rules.replace);}}}.bind(this));},handleReplaceSticker:function(sticker){this.replaceSticker(sticker);JQ(document).ajaxStop(function(){this.replaceSticker(sticker);}.bind(this));},replaceSticker:function(sticker){JQ(sticker.current).addClass(sticker.replace);},handleReplace:function(rules){this.replace(rules);JQ(document).ajaxStop(function(){this.replace(rules);}.bind(this));},replace:function(rules){JQ.each(rules,function(item,replacements){var $element=JQ(item);JQ.each(replacements,function(action,value){switch(action){case'html':$element.html(value);break;case'class':$element.addClass(value);break;default:$element.attr(action,value);break;}});});}};function showOptions(element,type,id){var $element=JQ(element),$td=$element.next('div.shoppingcart_row'),active=$element.hasClass('active');JQ('.shoppingcart').find('.active').removeClass('active');if(!active){$element.addClass('active');$td.addClass('active');JQ('.options_tr[row-type="'+type+'"][product-id="'+id+'"]').addClass('active');}}
function setupCoupons(){JQ('.coupon__item').coupon();}
JQ(function(){if(JQ('.shoppingcart_accessory_btn--expand').length===1){JQ('.shoppingcart_accessory_btn--expand').trigger('click');}
JQ(document).on('click','.coupon__open',function(){JQ('.coupon__form').slideToggle();return false;});JQ.fn.coupon=function(){var coupon;this.each(function(){var element=JQ(this);if(element.data('coupon')){coupon=element.data('coupon');return;}
coupon=new coupon(element);element.data('coupon',coupon);});return coupon;};setupCoupons();});var Coupon=function(element){this.init(element);return this;};Coupon.prototype={element:null,id:null,init:function(element){this.element=element;this.id=this.element.data('id');this.element.find('.coupon__remove').click(this.remove.bind(this));},remove:function(){ajax({url:'/winkelwagen/coupon/verwijder/',method:'POST',data:{coupon:this.id,},success:setShoppingCartData});}};var breakpoint={value:null,refreshValue:function(){var oldValue=this.value;this.value=window.getComputedStyle(document.querySelector('body'),':before').getPropertyValue('content').replace(/\"/g,'');if(oldValue!=this.value){JQ(window).trigger('viewport_changed',[this.value,oldValue]);}},isMobile:function(){return this.value=='smartphone';},isTablet:function(){return this.value=='tablet';},isDesktop:function(){return this.value=='desktop';}};JQ(function(){breakpoint.refreshValue();JQ(window).resize(function(){breakpoint.refreshValue();}).resize();});var WebsiteLog=function(){this.init();return this;};WebsiteLog.prototype={selector:{logger:'wlog',source:'wlog-source',elementId:'wlog-element_id',type:'wlog-type',action:'wlog-action',extra:'wlog-extra',finished:'wlog-finished',async:'wlog-async'},init:function(){this.registerHandlers();this.registerTriggers();this.load();},registerHandlers:function(){JQ(document).on('click','[data-'+this.selector.logger+'="click"], [data-'+this.selector.logger+'="click"] *',this.logClick.bind(this));},registerTriggers:function(){JQ(document).ajaxSuccess(this.logTrigger.bind(this));},load:function(){JQ('[data-'+this.selector.logger+'="load"]').each(function(index,item){this.log(JQ(item),true);}.bind(this));this.logTrigger();},log:function($element,async){var source=$element.data(this.selector.source),elementId=$element.data(this.selector.elementId),type=$element.data(this.selector.type),action=$element.data(this.selector.action),extra=$element.data(this.selector.extra);if(typeof source==='undefined'){source='';}
if(typeof extra==='undefined'){extra='';}
var returnValue=false;if(typeof elementId!=='undefined'&&typeof type!=='undefined'&&typeof action!=='undefined'){ajax({async:async,url:'/log/opslaan/',method:'POST',data:{source:source,elementId:elementId,type:type,action:action,extra:encodeURIComponent(JSON.stringify(extra))},success:function(){returnValue=true;}.bind(this)});}
return returnValue;},logClick:function(event){event.stopImmediatePropagation();var $element=JQ(event.target),ajaxAsync=false;if(typeof $element.data(this.selector.logger)==='undefined'){$element=$element.closest('[data-'+this.selector.logger+']');}
if($element.data(this.selector.async)===true){ajaxAsync=true;}
var returnValue=this.log($element,ajaxAsync);if(ajaxAsync){return true;}
return returnValue;},logTrigger:function(){JQ('[data-'+this.selector.logger+'="trigger"]').not('[data-'+this.selector.finished+']').each(function(index,item){var $item=JQ(item);this.log($item,true);$item.attr('data-'+this.selector.finished,'true');}.bind(this));}};var websiteLog=null;JQ(function(){if(websiteLog===null){websiteLog=new WebsiteLog();}});