PageSourceSearch

https://www.bornem.be/js/minified/site.min.js?v=gCRkzAxcifC85cwWcdC0Rti7pKXhz8fJHJOFf_FFba8

js bornem.be collected 2026-10-02 11:00:37 UTC 137,079 bytes, 4,698 lines download raw bytes

vendor: 6,021 bytes, lines 1-11
1
2/*! SmoothScroll v16.1.4 | (c) 2020 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
3!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).SmoothScroll=t()}(this,(function(){"use strict";window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;--t>=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(),
4/**
5	 * requestAnimationFrame() polyfill
6	 * By Erik Möller. Fixes from Paul Irish and Tino Zijdel.
7	 * @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/
8	 * @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
9	 * @license MIT
10	 */
11function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var o=(new Date).getTime(),i=Math.max(0,16-(o-e)),a=window.setTimeout((function(){t(o+i)}),i);return e=o+i,a}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}();var e={ignore:"[data-scroll-ignore]",header:null,topOnEmptyHash:!0,speed:500,speedAsDuration:!1,durationMax:null,durationMin:null,clip:!0,offset:0,easing:"easeInOutCubic",customEasing:null,updateURL:!0,popstate:!0,emitEvents:!0},t=function(){var e={};return Array.prototype.forEach.call(arguments,(function(t){for(var n in t){if(!t.hasOwnProperty(n))return;e[n]=t[n]}})),e},n=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,i=-1,a="",r=n.charCodeAt(0);++i<o;){if(0===(t=n.charCodeAt(i)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");t>=1&&t<=31||127==t||0===i&&t>=48&&t<=57||1===i&&t>=48&&t<=57&&45===r?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(i):"\\"+n.charAt(i)}return"#"+a},o=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},i=function(e){return e?(t=e,parseInt(window.getComputedStyle(t).height,10)+e.offsetTop):0;var t},a=function(e,t,n){0===e&&document.body.focus(),n||(e.focus(),document.activeElement!==e&&(e.setAttribute("tabindex","-1"),e.focus(),e.style.outline="none"),window.scrollTo(0,t))},r=function(e,t,n,o){if(t.emitEvents&&"function"==typeof window.CustomEvent){var i=new CustomEvent(e,{bubbles:!0,detail:{anchor:n,toggle:o}});document.dispatchEvent(i)}};return function(c,u){var s,l,d,m,f={};f.cancelScroll=function(e){cancelAnimationFrame(m),m=null,e||r("scrollCancel",s)},f.animateScroll=function(n,c,u){f.cancelScroll();var l=t(s||e,u||{}),w="[object Number]"===Object.prototype.toString.call(n),h=w||!n.tagName?null:n;if(w||h){var p=window.pageYOffset;l.header&&!d&&(d=document.querySelector(l.header));var g,y,v,S=i(d),E=w?n:function(e,t,n,i){var a=0;if(e.offsetParent)do{a+=e.offsetTop,e=e.offsetParent}while(e);return a=Math.max(a-t-n,0),i&&(a=Math.min(a,o()-window.innerHeight)),a}(h,S,parseInt("function"==typeof l.offset?l.offset(n,c):l.offset,10),l.clip),b=E-p,A=o(),O=0,C=function(e,t){var n=t.speedAsDuration?t.speed:Math.abs(e/1e3*t.speed);return t.durationMax&&n>t.durationMax?t.durationMax:t.durationMin&&n<t.durationMin?t.durationMin:parseInt(n,10)}(b,l),M=function(e){g||(g=e),O+=e-g,v=p+b*function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.customEasing&&(n=e.customEasing(t)),n||t}(l,y=(y=0===C?0:O/C)>1?1:y),window.scrollTo(0,Math.floor(v)),function(e,t){var o=window.pageYOffset;if(e==t||o==t||(p<t&&window.innerHeight+o)>=A)return f.cancelScroll(!0),a(n,t,w),r("scrollStop",l,n,c),g=null,m=null,!0}(v,E)||(m=window.requestAnimationFrame(M),g=e)};0===window.pageYOffset&&window.scrollTo(0,0),function(e,t,n){t||history.pushState&&n.updateURL&&history.pushState({smoothScroll:JSON.stringify(n),anchor:e.id},document.title,e===document.documentElement?"#top":"#"+e.id)}(n,w,l),"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches?a(n,Math.floor(E),!1):(r("scrollStart",l,n,c),f.cancelScroll(!0),window.requestAnimationFrame(M))}};var w=function(e){if(!e.defaultPrevented&&!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey)&&"closest"in e.target&&(l=e.target.closest(c))&&"a"===l.tagName.toLowerCase()&&!e.target.closest(s.ignore)&&l.hostname===window.location.hostname&&l.pathname===window.location.pathname&&/#/.test(l.href)){var t,o;try{t=n(decodeURIComponent(l.hash))}catch(e){t=n(l.hash)}if("#"===t){if(!s.topOnEmptyHash)return;o=document.documentElement}else o=document.querySelector(t);(o=o||"#top"!==t?o:document.documentElement)&&(e.preventDefault(),function(e){if(history.replaceState&&e.updateURL&&!history.state){var t=window.location.hash;t=t||"",history.replaceState({smoothScroll:JSON.stringify(e),anch
11or:t||window.pageYOffset},document.title,t||window.location.href)}}(s),f.animateScroll(o,l))}},h=function(){if(null!==history.state&&history.state.smoothScroll&&history.state.smoothScroll===JSON.stringify(s)){var e=history.state.anchor;"string"==typeof e&&e&&!(e=document.querySelector(n(history.state.anchor)))||f.animateScroll(e,null,{updateURL:!1})}};f.destroy=function(){s&&(document.removeEventListener("click",w,!1),window.removeEventListener("popstate",h,!1),f.cancelScroll(),s=null,l=null,d=null,m=null)};return function(){if(!("querySelector"in document&&"addEventListener"in window&&"requestAnimationFrame"in window&&"closest"in window.Element.prototype))throw"Smooth Scroll: This browser does not support the required JavaScript methods and browser APIs.";f.destroy(),s=t(e,u||{}),d=s.header?document.querySelector(s.header):null,document.addEventListener("click",w,!1),s.updateURL&&s.popstate&&window.addEventListener("popstate",h,!1)}(),f}}));
12
13/**
14* jquery-match-height master by @liabru
15* http://brm.io/jquery-match-height/
16* License: MIT
17*/
18
19;(function(factory) { // eslint-disable-line no-extra-semi
20    'use strict';
21    if (typeof define === 'function' && define.amd) {
22        // AMD
23        define(['jquery'], factory);
24    } else if (typeof module !== 'undefined' && module.exports) {
25        // CommonJS
26        module.exports = factory(require('jquery'));
27    } else {
28        // Global
29        factory(jQuery);
30    }
31})(function($) {
32    /*
33    *  internal
34    */
35
36    var _previousResizeWidth = -1,
37        _updateTimeout = -1;
38
39    /*
40    *  _parse
41    *  value parse utility function
42    */
43
44    var _parse = function(value) {
45        // parse value and convert NaN to 0
46        return parseFloat(value) || 0;
47    };
48
49    /*
50    *  _rows
51    *  utility function returns array of jQuery selections representing each row
52    *  (as displayed after float wrapping applied by browser)
53    */
54
55    var _rows = function(elements) {
56        var tolerance = 1,
57            $elements = $(elements),
58            lastTop = null,
59            rows = [];
60
61        // group elements by their top position
62        $elements.each(function(){
63            var $that = $(this),
64                top = $that.offset().top - _parse($that.css('margin-top')),
65                lastRow = rows.length > 0 ? rows[rows.length - 1] : null;
66
67            if (lastRow === null) {
68                // first item on the row, so just push it
69                rows.push($that);
70            } else {
71                // if the row top is the same, add to the row group
72                if (Math.floor(Math.abs(lastTop - top)) <= tolerance) {
73                    rows[rows.length - 1] = lastRow.add($that);
74                } else {
75                    // otherwise start a new row group
76                    rows.push($that);
77                }
78            }
79
80            // keep track of the last row top
81            lastTop = top;
82        });
83
84        return rows;
85    };
86
87    /*
88    *  _parseOptions
89    *  handle plugin options
90    */
91
92    var _parseOptions = function(options) {
93        var opts = {
94            byRow: true,
95            property: 'height',
96            target: null,
97            remove: false
98        };
99
100        if (typeof options === 'object') {
101            return $.extend(opts, options);
102        }
103
104        if (typeof options === 'boolean') {
105            opts.byRow = options;
106        } else if (options === 'remove') {
107            opts.remove = true;
108        }
109
110        return opts;
111    };
112
113    /*
114    *  matchHeight
115    *  plugin definition
116    */
117
118    var matchHeight = $.fn.matchHeight = function(options) {
119        var opts = _parseOptions(options);
120
121        // handle remove
122        if (opts.remove) {
123            var that = this;
124
125            // remove fixed height from all selected elements
126            this.css(opts.property, '');
127
128            // remove selected elements from all groups
129            $.each(matchHeight._groups, function(key, group) {
130                group.elements = group.elements.not(that);
131            });
132
133            // TODO: cleanup empty groups
134
135            return this;
136        }
137
138        if (this.length <= 1 && !opts.target) {
139            return this;
140        }
141
142        // keep track of this group so we can re-apply later on load and resize events
143        matchHeight._groups.push({
144            elements: this,
145            options: opts
146        });
147
148        // match each element's height to the tallest element in the selection
149        matchHeight._apply(this, opts);
150
151        return this;
152    };
153
154    /*
155    *  plugin global options
156    */
157
158    matchHeight.version = 'master';
159    matchHeight._groups = [];
160    matchHeight._throttle = 80;
161    matchHeight._maintainScroll = false;
162    matchHeight._beforeUpdate = null;
163    matchHeight._afterUpdate = null;
164    matchHeight._rows = _rows;
165    matchHeight._parse = _parse;
166    matchHeight._parseOptions = _parseOptions;
167
168    /*
169    *  matchHeight._apply
170    *  apply matchHeight to given elements
171    */
172
173    matchHeight._apply = function(elements, options) {
174        var opts = _parseOptions(options),
175            $elements = $(elements),
176            rows = [$elements];
177
178        // take note of scroll position
179        var scrollTop = $(window).scrollTop(),
180            htmlHeight = $('html').outerHeight(true);
181
182        // get hidden parents
183        var $hiddenParents = $elements.parents().filter(':hidden');
184
185        // cache the original inline style
186        $hiddenParents.each(function() {
187            var $that = $(this);
188            $that.data('style-cache', $that.attr('style'));
189        });
190
191        // temporarily must force hidden parents visible
192        $hiddenParents.css('display', 'block');
193
194        // get rows if using byRow, otherwise assume one row
195        if (opts.byRow && !opts.target) {
196
197            // must first force an arbitrary equal height so floating elements break evenly
198            $elements.each(function() {
199                var $that = $(this),
200                    display = $that.css('display');
201
202                // temporarily force a usable display value
203                if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
204                    display = 'block';
205                }
206
207                // cache the original inline style
208                $that.data('style-cache', $that.attr('style'));
209
210                $that.css({
211                    'display': display,
212                    'padding-top': '0',
213                    'padding-bottom': '0',
214                    'margin-top': '0',
215                    'margin-bottom': '0',
216                    'border-top-width': '0',
217                    'border-bottom-width': '0',
218                    'height': '100px',
219                    'overflow': 'hidden'
220                });
221            });
222
223            // get the array of rows (based on element top position)
224            rows = _rows($elements);
225
226            // revert original inline styles
227            $elements.each(function() {
228                var $that = $(this);
229                $that.attr('style', $that.data('style-cache') || '');
230            });
231        }
232
233        $.each(rows, function(key, row) {
234            var $row = $(row),
235                targetHeight = 0;
236
237            if (!opts.target) {
238                // skip apply to rows with only one item
239                if (opts.byRow && $row.length <= 1) {
240                    $row.css(opts.property, '');
241                    return;
242                }
243
244                // iterate the row and find the max height
245                $row.each(function(){
246                    var $that = $(this),
247                        style = $that.attr('style'),
248                        display = $that.css('display');
249
250                    // temporarily force a usable display value
251                    if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
252                        display = 'block';
253                    }
254
255                    // ensure we get the correct actual height (and not a previously set height value)
256                    var css = { 'display': display };
257                    css[opts.property] = '';
258                    $that.css(css);
259
260                    // find the max height (including padding, but not margin)
261                    if ($that.outerHeight(false) > targetHeight) {
262                        targetHeight = $that.outerHeight(false);
263                    }
264
265                    // revert styles
266                    if (style) {
267                        $that.attr('style', style);
268                    } else {
269                        $that.css('display', '');
270                    }
271                });
272            } else {
273                // if target set, use the height of the target element
274                targetHeight = opts.target.outerHeight(false);
275            }
276
277            // iterate the row and apply the height to all elements
278            $row.each(function(){
279                var $that = $(this),
280                    verticalPadding = 0;
281
282                // don't apply to a target
283                if (opts.target && $that.is(opts.target)) {
284                    return;
285                }
286
287                // handle padding and border correctly (required when not using border-box)
288                if ($that.css('box-sizing') !== 'border-box') {
289                    verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width'));
290                    verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom'));
291                }
292
293                // set the height (accounting for padding and border)
294                $that.css(opts.property, (targetHeight - verticalPadding) + 'px');
295            });
296        });
297
298        // revert hidden parents
299        $hiddenParents.each(function() {
300            var $that = $(this);
301            $that.attr('style', $that.data('style-cache') || null);
302        });
303
304        // restore scroll position if enabled
305        if (matchHeight._maintainScroll) {
306            $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
307        }
308
309        return this;
310    };
311
312    /*
313    *  matchHeight._applyDataApi
314    *  applies matchHeight to all elements with a data-match-height attribute
315    */
316
317    matchHeight._applyDataApi = function() {
318        var groups = {};
319
320        // generate groups by their groupId set by elements using data-match-height
321        $('[data-match-height], [data-mh]').each(function() {
322            var $this = $(this),
323                groupId = $this.attr('data-mh') || $this.attr('data-match-height');
324
325            if (groupId in groups) {
326                groups[groupId] = groups[groupId].add($this);
327            } else {
328                groups[groupId] = $this;
329            }
330        });
331
332        // apply matchHeight to each group
333        $.each(groups, function() {
334            this.matchHeight(true);
335        });
336    };
337
338    /*
339    *  matchHeight._update
340    *  updates matchHeight on all current groups with their correct options
341    */
342
343    var _update = function(event) {
344        if (matchHeight._beforeUpdate) {
345            matchHeight._beforeUpdate(event, matchHeight._groups);
346        }
347
348        $.each(matchHeight._groups, function() {
349            matchHeight._apply(this.elements, this.options);
350        });
351
352        if (matchHeight._afterUpdate) {
353            matchHeight._afterUpdate(event, matchHeight._groups);
354        }
355    };
356
357    matchHeight._update = function(throttle, event) {
358        // prevent update if fired from a resize event
359        // where the viewport width hasn't actually changed
360        // fixes an event looping bug in IE8
361        if (event && event.type === 'resize') {
362            var windowWidth = $(window).width();
363            if (windowWidth === _previousResizeWidth) {
364                return;
365            }
366            _previousResizeWidth = windowWidth;
367        }
368
369        // throttle updates
370        if (!throttle) {
371            _update(event);
372        } else if (_updateTimeout === -1) {
373            _updateTimeout = setTimeout(function() {
374                _update(event);
375                _updateTimeout = -1;
376            }, matchHeight._throttle);
377        }
378    };
379
380    /*
381    *  bind events
382    */
383
384    // apply on DOM ready event
385    $(matchHeight._applyDataApi);
386
387    // use on or bind where supported
388    var on = $.fn.on ? 'on' : 'bind';
389
390    // update heights on load and resize events
391    $(window)[on]('load', function(event) {
392        matchHeight._update(false, event);
393    });
394
395    // throttled update heights on resize events
396    $(window)[on]('resize orientationchange', function(event) {
397        matchHeight._update(true, event);
398    });
399
400});
401
402// Generated by CoffeeScript 1.12.3
403
404/**
405@license Sticky-kit v1.1.4 | MIT | Leaf Corcoran 2015 | http://leafo.net
406 */
407
408(function() {
409  var $, doc, win;
410
411  $ = window.jQuery;
412
413  win = $(window);
414  doc = $(document);
415
416  $.fn.stick_in_parent = function(opts) {
417    var doc_height, elm, enable_bottoming, fn, i, inner_scrolling, len, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, ref, sticky_class, win_height;
418    if (opts == null) {
419      opts = {};
420    }
421    sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming;
422    win_height = win.height();
423    doc_height = doc.height();
424    if (offset_top == null) {
425      offset_top = 0;
426    }
427    if (parent_selector == null) {
428      parent_selector = void 0;
429    }
430    if (inner_scrolling == null) {
431      inner_scrolling = true;
432    }
433    if (sticky_class == null) {
434      sticky_class = "is_stuck";
435    }
436    if (enable_bottoming == null) {
437      enable_bottoming = true;
438    }
439    outer_width = function(el) {
440      var _el, computed, w;
441      if (window.getComputedStyle) {
442        _el = el[0];
443        computed = window.getComputedStyle(el[0]);
444        w = parseFloat(computed.getPropertyValue("width")) + parseFloat(computed.getPropertyValue("margin-left")) + parseFloat(computed.getPropertyValue("margin-right"));
445        if (computed.getPropertyValue("box-sizing") !== "border-box") {
446          w += parseFloat(computed.getPropertyValue("border-left-width")) + parseFloat(computed.getPropertyValue("border-right-width")) + parseFloat(computed.getPropertyValue("padding-left")) + parseFloat(computed.getPropertyValue("padding-right"));
447        }
448        return w;
449      } else {
450        return el.outerWidth(true);
451      }
452    };
453    ref = this;
454    fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) {
455      var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick;
456      if (elm.data("sticky_kit")) {
457        return;
458      }
459      elm.data("sticky_kit", true);
460      last_scroll_height = doc_height;
461      parent = elm.parent();
462      if (parent_selector != null) {
463        parent = parent.closest(parent_selector);
464      }
465      if (!parent.length) {
466        throw "failed to find stick parent";
467      }
468      fixed = false;
vendor: 6,252 bytes, lines 469-672
469      bottomed = false;
470      spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />");
471      if (spacer) {
472        spacer.css('position', elm.css('position'));
473      }
474      recalc = function() {
475        var border_top, padding_top, restore;
476        if (detached) {
477          return;
478        }
479        win_height = win.height();
480        doc_height = doc.height();
481        last_scroll_height = doc_height;
482        border_top = parseInt(parent.css("border-top-width"), 10);
483        padding_top = parseInt(parent.css("padding-top"), 10);
484        padding_bottom = parseInt(parent.css("padding-bottom"), 10);
485        parent_top = parent.offset().top + border_top + padding_top;
486        parent_height = parent.height();
487        if (fixed) {
488          fixed = false;
489          bottomed = false;
490          if (manual_spacer == null) {
491            elm.insertAfter(spacer);
492            spacer.detach();
493          }
494          elm.css({
495            position: "",
496            top: "",
497            width: "",
498            bottom: ""
499          }).removeClass(sticky_class);
500          restore = true;
501        }
502        top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top;
503        height = elm.outerHeight(true);
504        el_float = elm.css("float");
505        if (spacer) {
506          spacer.css({
507            width: outer_width(elm),
508            height: height,
509            display: elm.css("display"),
510            "vertical-align": elm.css("vertical-align"),
511            "float": el_float
512          });
513        }
514        if (restore) {
515          return tick();
516        }
517      };
518      recalc();
519      if (height === parent_height) {
520        return;
521      }
522      last_pos = void 0;
523      offset = offset_top;
524      recalc_counter = recalc_every;
525      tick = function() {
526        var css, delta, recalced, scroll, will_bottom;
527        if (detached) {
528          return;
529        }
530        recalced = false;
531        if (recalc_counter != null) {
532          recalc_counter -= 1;
533          if (recalc_counter <= 0) {
534            recalc_counter = recalc_every;
535            recalc();
536            recalced = true;
537          }
538        }
539        if (!recalced && doc_height !== last_scroll_height) {
540          recalc();
541          recalced = true;
542        }
543        scroll = win.scrollTop();
544        if (last_pos != null) {
545          delta = scroll - last_pos;
546        }
547        last_pos = scroll;
548        if (fixed) {
549          if (enable_bottoming) {
550            will_bottom = scroll + height + offset > parent_height + parent_top;
551            if (bottomed && !will_bottom) {
552              bottomed = false;
553              elm.css({
554                position: "fixed",
555                bottom: "",
556                top: offset
557              }).trigger("sticky_kit:unbottom");
558            }
559          }
560          if (scroll < top) {
561            fixed = false;
562            offset = offset_top;
563            if (manual_spacer == null) {
564              if (el_float === "left" || el_float === "right") {
565                elm.insertAfter(spacer);
566              }
567              spacer.detach();
568            }
569            css = {
570              position: "",
571              width: "",
572              top: ""
573            };
574            elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick");
575          }
576          if (inner_scrolling) {
577            if (height + offset_top > win_height) {
578              if (!bottomed) {
579                offset -= delta;
580                offset = Math.max(win_height - height, offset);
581                offset = Math.min(offset_top, offset);
582                if (fixed) {
583                  elm.css({
584                    top: offset + "px"
585                  });
586                }
587              }
588            }
589          }
590        } else {
591          if (scroll > top) {
592            fixed = true;
593            css = {
594              position: "fixed",
595              top: offset
596            };
597            css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px";
598            elm.css(css).addClass(sticky_class);
599            if (manual_spacer == null) {
600              elm.after(spacer);
601              if (el_float === "left" || el_float === "right") {
602                spacer.append(elm);
603              }
604            }
605            elm.trigger("sticky_kit:stick");
606          }
607        }
608        if (fixed && enable_bottoming) {
609          if (will_bottom == null) {
610            will_bottom = scroll + height + offset > parent_height + parent_top;
611          }
612          if (!bottomed && will_bottom) {
613            bottomed = true;
614            if (parent.css("position") === "static") {
615              parent.css({
616                position: "relative"
617              });
618            }
619            return elm.css({
620              position: "absolute",
621              bottom: padding_bottom,
622              top: "auto"
623            }).trigger("sticky_kit:bottom");
624          }
625        }
626      };
627      recalc_and_tick = function() {
628        recalc();
629        return tick();
630      };
631      detach = function() {
632        detached = true;
633        win.off("touchmove", tick);
634        win.off("scroll", tick);
635        win.off("resize", recalc_and_tick);
636        $(document.body).off("sticky_kit:recalc", recalc_and_tick);
637        elm.off("sticky_kit:detach", detach);
638        elm.removeData("sticky_kit");
639        elm.css({
640          position: "",
641          bottom: "",
642          top: "",
643          width: ""
644        });
645        parent.position("position", "");
646        if (fixed) {
647          if (manual_spacer == null) {
648            if (el_float === "left" || el_float === "right") {
649              elm.insertAfter(spacer);
650            }
651            spacer.remove();
652          }
653          return elm.removeClass(sticky_class);
654        }
655      };
656      win.on("touchmove", tick);
657      win.on("scroll", tick);
658      win.on("resize", recalc_and_tick);
659      $(document.body).on("sticky_kit:recalc", recalc_and_tick);
660      elm.on("sticky_kit:detach", detach);
661      return setTimeout(tick, 0);
662    };
663    for (i = 0, len = ref.length; i < len; i++) {
664      elm = ref[i];
665      fn($(elm));
666    }
667    return this;
668  };
669
670}).call(this);
671
672/*! Magnific Popup - v1.1.0 - 2016-02-20
vendor: 37,682 bytes, lines 673-2364
673* http://dimsemenov.com/plugins/magnific-popup/
674* Copyright (c) 2016 Dmitry Semenov; */
675;(function (factory) { 
676if (typeof define === 'function' && define.amd) { 
677 // AMD. Register as an anonymous module. 
678 define(['jquery'], factory); 
679 } else if (typeof exports === 'object') { 
680 // Node/CommonJS 
681 factory(require('jquery')); 
682 } else { 
683 // Browser globals 
684 factory(window.jQuery || window.Zepto); 
685 } 
686 }(function($) { 
687
688/*>>core*/
689/**
690 * 
691 * Magnific Popup Core JS file
692 * 
693 */
694
695
696/**
697 * Private static constants
698 */
699var CLOSE_EVENT = 'Close',
700	BEFORE_CLOSE_EVENT = 'BeforeClose',
701	AFTER_CLOSE_EVENT = 'AfterClose',
702	BEFORE_APPEND_EVENT = 'BeforeAppend',
703	MARKUP_PARSE_EVENT = 'MarkupParse',
704	OPEN_EVENT = 'Open',
705	CHANGE_EVENT = 'Change',
706	NS = 'mfp',
707	EVENT_NS = '.' + NS,
708	READY_CLASS = 'mfp-ready',
709	REMOVING_CLASS = 'mfp-removing',
710	PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
711
712
713/**
714 * Private vars 
715 */
716/*jshint -W079 */
717var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
718	MagnificPopup = function(){},
719	_isJQ = !!(window.jQuery),
720	_prevStatus,
721	_window = $(window),
722	_document,
723	_prevContentType,
724	_wrapClasses,
725	_currPopupType;
726
727
728/**
729 * Private functions
730 */
731var _mfpOn = function(name, f) {
732		mfp.ev.on(NS + name + EVENT_NS, f);
733	},
734	_getEl = function(className, appendTo, html, raw) {
735		var el = document.createElement('div');
736		el.className = 'mfp-'+className;
737		if(html) {
738			el.innerHTML = html;
739		}
740		if(!raw) {
741			el = $(el);
742			if(appendTo) {
743				el.appendTo(appendTo);
744			}
745		} else if(appendTo) {
746			appendTo.appendChild(el);
747		}
748		return el;
749	},
750	_mfpTrigger = function(e, data) {
751		mfp.ev.triggerHandler(NS + e, data);
752
753		if(mfp.st.callbacks) {
754			// converts "mfpEventName" to "eventName" callback and triggers it if it's present
755			e = e.charAt(0).toLowerCase() + e.slice(1);
756			if(mfp.st.callbacks[e]) {
757				mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
758			}
759		}
760	},
761	_getCloseBtn = function(type) {
762		if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
763			mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
764			_currPopupType = type;
765		}
766		return mfp.currTemplate.closeBtn;
767	},
768	// Initialize Magnific Popup only when called at least once
769	_checkInstance = function() {
770		if(!$.magnificPopup.instance) {
771			/*jshint -W020 */
772			mfp = new MagnificPopup();
773			mfp.init();
774			$.magnificPopup.instance = mfp;
775		}
776	},
777	// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
778	supportsTransitions = function() {
779		var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
780			v = ['ms','O','Moz','Webkit']; // 'v' for vendor
781
782		if( s['transition'] !== undefined ) {
783			return true; 
784		}
785			
786		while( v.length ) {
787			if( v.pop() + 'Transition' in s ) {
788				return true;
789			}
790		}
791				
792		return false;
793	};
794
795
796
797/**
798 * Public functions
799 */
800MagnificPopup.prototype = {
801
802	constructor: MagnificPopup,
803
804	/**
805	 * Initializes Magnific Popup plugin. 
806	 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
807	 */
808	init: function() {
809		var appVersion = navigator.appVersion;
810		mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener;
811		mfp.isAndroid = (/android/gi).test(appVersion);
812		mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
813		mfp.supportsTransition = supportsTransitions();
814
815		// We disable fixed positioned lightbox on devices that don't handle it nicely.
816		// If you know a better way of detecting this - let me know.
817		mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
818		_document = $(document);
819
820		mfp.popupsCache = {};
821	},
822
823	/**
824	 * Opens popup
825	 * @param  data [description]
826	 */
827	open: function(data) {
828
829		var i;
830
831		if(data.isObj === false) { 
832			// convert jQuery collection to array to avoid conflicts later
833			mfp.items = data.items.toArray();
834
835			mfp.index = 0;
836			var items = data.items,
837				item;
838			for(i = 0; i < items.length; i++) {
839				item = items[i];
840				if(item.parsed) {
841					item = item.el[0];
842				}
843				if(item === data.el[0]) {
844					mfp.index = i;
845					break;
846				}
847			}
848		} else {
849			mfp.items = $.isArray(data.items) ? data.items : [data.items];
850			mfp.index = data.index || 0;
851		}
852
853		// if popup is already opened - we just update the content
854		if(mfp.isOpen) {
855			mfp.updateItemHTML();
856			return;
857		}
858		
859		mfp.types = []; 
860		_wrapClasses = '';
861		if(data.mainEl && data.mainEl.length) {
862			mfp.ev = data.mainEl.eq(0);
863		} else {
864			mfp.ev = _document;
865		}
866
867		if(data.key) {
868			if(!mfp.popupsCache[data.key]) {
869				mfp.popupsCache[data.key] = {};
870			}
871			mfp.currTemplate = mfp.popupsCache[data.key];
872		} else {
873			mfp.currTemplate = {};
874		}
875
876
877
878		mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 
879		mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
880
881		if(mfp.st.modal) {
882			mfp.st.closeOnContentClick = false;
883			mfp.st.closeOnBgClick = false;
884			mfp.st.showCloseBtn = false;
885			mfp.st.enableEscapeKey = false;
886		}
887		
888
889		// Building markup
890		// main containers are created only once
891		if(!mfp.bgOverlay) {
892
893			// Dark overlay
894			mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
895				mfp.close();
896			});
897
898			mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
899				if(mfp._checkIfClose(e.target)) {
900					mfp.close();
901				}
902			});
903
904			mfp.container = _getEl('container', mfp.wrap);
905		}
906
907		mfp.contentContainer = _getEl('content');
908		if(mfp.st.preloader) {
909			mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
910		}
911
912
913		// Initializing modules
914		var modules = $.magnificPopup.modules;
915		for(i = 0; i < modules.length; i++) {
916			var n = modules[i];
917			n = n.charAt(0).toUpperCase() + n.slice(1);
918			mfp['init'+n].call(mfp);
919		}
920		_mfpTrigger('BeforeOpen');
921
922
923		if(mfp.st.showCloseBtn) {
924			// Close button
925			if(!mfp.st.closeBtnInside) {
926				mfp.wrap.append( _getCloseBtn() );
927			} else {
928				_mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
929					values.close_replaceWith = _getCloseBtn(item.type);
930				});
931				_wrapClasses += ' mfp-close-btn-in';
932			}
933		}
934
935		if(mfp.st.alignTop) {
936			_wrapClasses += ' mfp-align-top';
937		}
938
939	
940
941		if(mfp.fixedContentPos) {
942			mfp.wrap.css({
943				overflow: mfp.st.overflowY,
944				overflowX: 'hidden',
945				overflowY: mfp.st.overflowY
946			});
947		} else {
948			mfp.wrap.css({ 
949				top: _window.scrollTop(),
950				position: 'absolute'
951			});
952		}
953		if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
954			mfp.bgOverlay.css({
955				height: _document.height(),
956				position: 'absolute'
957			});
958		}
959
960		
961
962		if(mfp.st.enableEscapeKey) {
963			// Close on ESC key
964			_document.on('keyup' + EVENT_NS, function(e) {
965				if(e.keyCode === 27) {
966					mfp.close();
967				}
968			});
969		}
970
971		_window.on('resize' + EVENT_NS, function() {
972			mfp.updateSize();
973		});
974
975
976		if(!mfp.st.closeOnContentClick) {
977			_wrapClasses += ' mfp-auto-cursor';
978		}
979		
980		if(_wrapClasses)
981			mfp.wrap.addClass(_wrapClasses);
982
983
984		// this triggers recalculation of layout, so we get it once to not to trigger twice
985		var windowHeight = mfp.wH = _window.height();
986
987		
988		var windowStyles = {};
989
990		if( mfp.fixedContentPos ) {
991            if(mfp._hasScrollBar(windowHeight)){
992                var s = mfp._getScrollbarSize();
993                if(s) {
994                    windowStyles.marginRight = s;
995                }
996            }
997        }
998
999		if(mfp.fixedContentPos) {
1000			if(!mfp.isIE7) {
1001				windowStyles.overflow = 'hidden';
1002			} else {
1003				// ie7 double-scroll bug
1004				$('body, html').css('overflow', 'hidden');
1005			}
1006		}
1007
1008		
1009		
1010		var classesToadd = mfp.st.mainClass;
1011		if(mfp.isIE7) {
1012			classesToadd += ' mfp-ie7';
1013		}
1014		if(classesToadd) {
1015			mfp._addClassToMFP( classesToadd );
1016		}
1017
1018		// add content
1019		mfp.updateItemHTML();
1020
1021		_mfpTrigger('BuildControls');
1022
1023		// remove scrollbar, add margin e.t.c
1024		$('html').css(windowStyles);
1025		
1026		// add everything to DOM
1027		mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) );
1028
1029		// Save last focused element
1030		mfp._lastFocusedEl = document.activeElement;
1031		
1032		// Wait for next cycle to allow CSS transition
1033		setTimeout(function() {
1034			
1035			if(mfp.content) {
1036				mfp._addClassToMFP(READY_CLASS);
1037				mfp._setFocus();
1038			} else {
1039				// if content is not defined (not loaded e.t.c) we add class only for BG
1040				mfp.bgOverlay.addClass(READY_CLASS);
1041			}
1042			
1043			// Trap the focus in popup
1044			_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
1045
1046		}, 16);
1047
1048		mfp.isOpen = true;
1049		mfp.updateSize(windowHeight);
1050		_mfpTrigger(OPEN_EVENT);
1051
1052		return data;
1053	},
1054
1055	/**
1056	 * Closes the popup
1057	 */
1058	close: function() {
1059		if(!mfp.isOpen) return;
1060		_mfpTrigger(BEFORE_CLOSE_EVENT);
1061
1062		mfp.isOpen = false;
1063		// for CSS3 animation
1064		if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition )  {
1065			mfp._addClassToMFP(REMOVING_CLASS);
1066			setTimeout(function() {
1067				mfp._close();
1068			}, mfp.st.removalDelay);
1069		} else {
1070			mfp._close();
1071		}
1072	},
1073
1074	/**
1075	 * Helper for close() function
1076	 */
1077	_close: function() {
1078		_mfpTrigger(CLOSE_EVENT);
1079
1080		var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
1081
1082		mfp.bgOverlay.detach();
1083		mfp.wrap.detach();
1084		mfp.container.empty();
1085
1086		if(mfp.st.mainClass) {
1087			classesToRemove += mfp.st.mainClass + ' ';
1088		}
1089
1090		mfp._removeClassFromMFP(classesToRemove);
1091
1092		if(mfp.fixedContentPos) {
1093			var windowStyles = {marginRight: ''};
1094			if(mfp.isIE7) {
1095				$('body, html').css('overflow', '');
1096			} else {
1097				windowStyles.overflow = '';
1098			}
1099			$('html').css(windowStyles);
1100		}
1101		
1102		_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
1103		mfp.ev.off(EVENT_NS);
1104
1105		// clean up DOM elements that aren't removed
1106		mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
1107		mfp.bgOverlay.attr('class', 'mfp-bg');
1108		mfp.container.attr('class', 'mfp-container');
1109
1110		// remove close button from target element
1111		if(mfp.st.showCloseBtn &&
1112		(!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
1113			if(mfp.currTemplate.closeBtn)
1114				mfp.currTemplate.closeBtn.detach();
1115		}
1116
1117
1118		if(mfp.st.autoFocusLast && mfp._lastFocusedEl) {
1119			$(mfp._lastFocusedEl).focus(); // put tab focus back
1120		}
1121		mfp.currItem = null;	
1122		mfp.content = null;
1123		mfp.currTemplate = null;
1124		mfp.prevHeight = 0;
1125
1126		_mfpTrigger(AFTER_CLOSE_EVENT);
1127	},
1128	
1129	updateSize: function(winHeight) {
1130
1131		if(mfp.isIOS) {
1132			// fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
1133			var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
1134			var height = window.innerHeight * zoomLevel;
1135			mfp.wrap.css('height', height);
1136			mfp.wH = height;
1137		} else {
1138			mfp.wH = winHeight || _window.height();
1139		}
1140		// Fixes #84: popup incorrectly positioned with position:relative on body
1141		if(!mfp.fixedContentPos) {
1142			mfp.wrap.css('height', mfp.wH);
1143		}
1144
1145		_mfpTrigger('Resize');
1146
1147	},
1148
1149	/**
1150	 * Set content of popup based on current index
1151	 */
1152	updateItemHTML: function() {
1153		var item = mfp.items[mfp.index];
1154
1155		// Detach and perform modifications
1156		mfp.contentContainer.detach();
1157
1158		if(mfp.content)
1159			mfp.content.detach();
1160
1161		if(!item.parsed) {
1162			item = mfp.parseEl( mfp.index );
1163		}
1164
1165		var type = item.type;
1166
1167		_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
1168		// BeforeChange event works like so:
1169		// _mfpOn('BeforeChange', function(e, prevType, newType) { });
1170
1171		mfp.currItem = item;
1172
1173		if(!mfp.currTemplate[type]) {
1174			var markup = mfp.st[type] ? mfp.st[type].markup : false;
1175
1176			// allows to modify markup
1177			_mfpTrigger('FirstMarkupParse', markup);
1178
1179			if(markup) {
1180				mfp.currTemplate[type] = $(markup);
1181			} else {
1182				// if there is no markup found we just define that template is parsed
1183				mfp.currTemplate[type] = true;
1184			}
1185		}
1186
1187		if(_prevContentType && _prevContentType !== item.type) {
1188			mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
1189		}
1190
1191		var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
1192		mfp.appendContent(newContent, type);
1193
1194		item.preloaded = true;
1195
1196		_mfpTrigger(CHANGE_EVENT, item);
1197		_prevContentType = item.type;
1198
1199		// Append container back after its content changed
1200		mfp.container.prepend(mfp.contentContainer);
1201
1202		_mfpTrigger('AfterChange');
1203	},
1204
1205
1206	/**
1207	 * Set HTML content of popup
1208	 */
1209	appendContent: function(newContent, type) {
1210		mfp.content = newContent;
1211
1212		if(newContent) {
1213			if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
1214				mfp.currTemplate[type] === true) {
1215				// if there is no markup, we just append close button element inside
1216				if(!mfp.content.find('.mfp-close').length) {
1217					mfp.content.append(_getCloseBtn());
1218				}
1219			} else {
1220				mfp.content = newContent;
1221			}
1222		} else {
1223			mfp.content = '';
1224		}
1225
1226		_mfpTrigger(BEFORE_APPEND_EVENT);
1227		mfp.container.addClass('mfp-'+type+'-holder');
1228
1229		mfp.contentContainer.append(mfp.content);
1230	},
1231
1232
1233	/**
1234	 * Creates Magnific Popup data object based on given data
1235	 * @param  {int} index Index of item to parse
1236	 */
1237	parseEl: function(index) {
1238		var item = mfp.items[index],
1239			type;
1240
1241		if(item.tagName) {
1242			item = { el: $(item) };
1243		} else {
1244			type = item.type;
1245			item = { data: item, src: item.src };
1246		}
1247
1248		if(item.el) {
1249			var types = mfp.types;
1250
1251			// check for 'mfp-TYPE' class
1252			for(var i = 0; i < types.length; i++) {
1253				if( item.el.hasClass('mfp-'+types[i]) ) {
1254					type = types[i];
1255					break;
1256				}
1257			}
1258
1259			item.src = item.el.attr('data-mfp-src');
1260			if(!item.src) {
1261				item.src = item.el.attr('href');
1262			}
1263		}
1264
1265		item.type = type || mfp.st.type || 'inline';
1266		item.index = index;
1267		item.parsed = true;
1268		mfp.items[index] = item;
1269		_mfpTrigger('ElementParse', item);
1270
1271		return mfp.items[index];
1272	},
1273
1274
1275	/**
1276	 * Initializes single popup or a group of popups
1277	 */
1278	addGroup: function(el, options) {
1279		var eHandler = function(e) {
1280			e.mfpEl = this;
1281			mfp._openClick(e, el, options);
1282		};
1283
1284		if(!options) {
1285			options = {};
1286		}
1287
1288		var eName = 'click.magnificPopup';
1289		options.mainEl = el;
1290
1291		if(options.items) {
1292			options.isObj = true;
1293			el.off(eName).on(eName, eHandler);
1294		} else {
1295			options.isObj = false;
1296			if(options.delegate) {
1297				el.off(eName).on(eName, options.delegate , eHandler);
1298			} else {
1299				options.items = el;
1300				el.off(eName).on(eName, eHandler);
1301			}
1302		}
1303	},
1304	_openClick: function(e, el, options) {
1305		var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
1306
1307
1308		if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) {
1309			return;
1310		}
1311
1312		var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
1313
1314		if(disableOn) {
1315			if($.isFunction(disableOn)) {
1316				if( !disableOn.call(mfp) ) {
1317					return true;
1318				}
1319			} else { // else it's number
1320				if( _window.width() < disableOn ) {
1321					return true;
1322				}
1323			}
1324		}
1325
1326		if(e.type) {
1327			e.preventDefault();
1328
1329			// This will prevent popup from closing if element is inside and popup is already opened
1330			if(mfp.isOpen) {
1331				e.stopPropagation();
1332			}
1333		}
1334
1335		options.el = $(e.mfpEl);
1336		if(options.delegate) {
1337			options.items = el.find(options.delegate);
1338		}
1339		mfp.open(options);
1340	},
1341
1342
1343	/**
1344	 * Updates text on preloader
1345	 */
1346	updateStatus: function(status, text) {
1347
1348		if(mfp.preloader) {
1349			if(_prevStatus !== status) {
1350				mfp.container.removeClass('mfp-s-'+_prevStatus);
1351			}
1352
1353			if(!text && status === 'loading') {
1354				text = mfp.st.tLoading;
1355			}
1356
1357			var data = {
1358				status: status,
1359				text: text
1360			};
1361			// allows to modify status
1362			_mfpTrigger('UpdateStatus', data);
1363
1364			status = data.status;
1365			text = data.text;
1366
1367			mfp.preloader.html(text);
1368
1369			mfp.preloader.find('a').on('click', function(e) {
1370				e.stopImmediatePropagation();
1371			});
1372
1373			mfp.container.addClass('mfp-s-'+status);
1374			_prevStatus = status;
1375		}
1376	},
1377
1378
1379	/*
1380		"Private" helpers that aren't private at all
1381	 */
1382	// Check to close popup or not
1383	// "target" is an element that was clicked
1384	_checkIfClose: function(target) {
1385
1386		if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
1387			return;
1388		}
1389
1390		var closeOnContent = mfp.st.closeOnContentClick;
1391		var closeOnBg = mfp.st.closeOnBgClick;
1392
1393		if(closeOnContent && closeOnBg) {
1394			return true;
1395		} else {
1396
1397			// We close the popup if click is on close button or on preloader. Or if there is no content.
1398			if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
1399				return true;
1400			}
1401
1402			// if click is outside the content
1403			if(  (target !== mfp.content[0] && !$.contains(mfp.content[0], target))  ) {
1404				if(closeOnBg) {
1405					// last check, if the clicked element is in DOM, (in case it's removed onclick)
1406					if( $.contains(document, target) ) {
1407						return true;
1408					}
1409				}
1410			} else if(closeOnContent) {
1411				return true;
1412			}
1413
1414		}
1415		return false;
1416	},
1417	_addClassToMFP: function(cName) {
1418		mfp.bgOverlay.addClass(cName);
1419		mfp.wrap.addClass(cName);
1420	},
1421	_removeClassFromMFP: function(cName) {
1422		this.bgOverlay.removeClass(cName);
1423		mfp.wrap.removeClass(cName);
1424	},
1425	_hasScrollBar: function(winHeight) {
1426		return (  (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
1427	},
1428	_setFocus: function() {
1429		(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
1430	},
1431	_onFocusIn: function(e) {
1432		if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
1433			mfp._setFocus();
1434			return false;
1435		}
1436	},
1437	_parseMarkup: function(template, values, item) {
1438		var arr;
1439		if(item.data) {
1440			values = $.extend(item.data, values);
1441		}
1442		_mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
1443
1444		$.each(values, function(key, value) {
1445			if(value === undefined || value === false) {
1446				return true;
1447			}
1448			arr = key.split('_');
1449			if(arr.length > 1) {
1450				var el = template.find(EVENT_NS + '-'+arr[0]);
1451
1452				if(el.length > 0) {
1453					var attr = arr[1];
1454					if(attr === 'replaceWith') {
1455						if(el[0] !== value[0]) {
1456							el.replaceWith(value);
1457						}
1458					} else if(attr === 'img') {
1459						if(el.is('img')) {
1460							el.attr('src', value);
1461						} else {
1462							el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) );
1463						}
1464					} else {
1465						el.attr(arr[1], value);
1466					}
1467				}
1468
1469			} else {
1470				template.find(EVENT_NS + '-'+key).html(value);
1471			}
1472		});
1473	},
1474
1475	_getScrollbarSize: function() {
1476		// thx David
1477		if(mfp.scrollbarSize === undefined) {
1478			var scrollDiv = document.createElement("div");
1479			scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
1480			document.body.appendChild(scrollDiv);
1481			mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
1482			document.body.removeChild(scrollDiv);
1483		}
1484		return mfp.scrollbarSize;
1485	}
1486
1487}; /* MagnificPopup core prototype end */
1488
1489
1490
1491
1492/**
1493 * Public static functions
1494 */
1495$.magnificPopup = {
1496	instance: null,
1497	proto: MagnificPopup.prototype,
1498	modules: [],
1499
1500	open: function(options, index) {
1501		_checkInstance();
1502
1503		if(!options) {
1504			options = {};
1505		} else {
1506			options = $.extend(true, {}, options);
1507		}
1508
1509		options.isObj = true;
1510		options.index = index || 0;
1511		return this.instance.open(options);
1512	},
1513
1514	close: function() {
1515		return $.magnificPopup.instance && $.magnificPopup.instance.close();
1516	},
1517
1518	registerModule: function(name, module) {
1519		if(module.options) {
1520			$.magnificPopup.defaults[name] = module.options;
1521		}
1522		$.extend(this.proto, module.proto);
1523		this.modules.push(name);
1524	},
1525
1526	defaults: {
1527
1528		// Info about options is in docs:
1529		// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
1530
1531		disableOn: 0,
1532
1533		key: null,
1534
1535		midClick: false,
1536
1537		mainClass: '',
1538
1539		preloader: true,
1540
1541		focus: '', // CSS selector of input to focus after popup is opened
1542
1543		closeOnContentClick: false,
1544
1545		closeOnBgClick: true,
1546
1547		closeBtnInside: true,
1548
1549		showCloseBtn: true,
1550
1551		enableEscapeKey: true,
1552
1553		modal: false,
1554
1555		alignTop: false,
1556
1557		removalDelay: 0,
1558
1559		prependTo: null,
1560
1561		fixedContentPos: 'auto',
1562
1563		fixedBgPos: 'auto',
1564
1565		overflowY: 'auto',
1566
1567		closeMarkup: '<button title="%title%" type="button" class="mfp-close">&#215;</button>',
1568
1569		tClose: 'Close (Esc)',
1570
1571		tLoading: 'Loading...',
1572
1573		autoFocusLast: true
1574
1575	}
1576};
1577
1578
1579
1580$.fn.magnificPopup = function(options) {
1581	_checkInstance();
1582
1583	var jqEl = $(this);
1584
1585	// We call some API method of first param is a string
1586	if (typeof options === "string" ) {
1587
1588		if(options === 'open') {
1589			var items,
1590				itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
1591				index = parseInt(arguments[1], 10) || 0;
1592
1593			if(itemOpts.items) {
1594				items = itemOpts.items[index];
1595			} else {
1596				items = jqEl;
1597				if(itemOpts.delegate) {
1598					items = items.find(itemOpts.delegate);
1599				}
1600				items = items.eq( index );
1601			}
1602			mfp._openClick({mfpEl:items}, jqEl, itemOpts);
1603		} else {
1604			if(mfp.isOpen)
1605				mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
1606		}
1607
1608	} else {
1609		// clone options obj
1610		options = $.extend(true, {}, options);
1611
1612		/*
1613		 * As Zepto doesn't support .data() method for objects
1614		 * and it works only in normal browsers
1615		 * we assign "options" object directly to the DOM element. FTW!
1616		 */
1617		if(_isJQ) {
1618			jqEl.data('magnificPopup', options);
1619		} else {
1620			jqEl[0].magnificPopup = options;
1621		}
1622
1623		mfp.addGroup(jqEl, options);
1624
1625	}
1626	return jqEl;
1627};
1628
1629/*>>core*/
1630
1631/*>>inline*/
1632
1633var INLINE_NS = 'inline',
1634	_hiddenClass,
1635	_inlinePlaceholder,
1636	_lastInlineElement,
1637	_putInlineElementsBack = function() {
1638		if(_lastInlineElement) {
1639			_inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
1640			_lastInlineElement = null;
1641		}
1642	};
1643
1644$.magnificPopup.registerModule(INLINE_NS, {
1645	options: {
1646		hiddenClass: 'hide', // will be appended with `mfp-` prefix
1647		markup: '',
1648		tNotFound: 'Content not found'
1649	},
1650	proto: {
1651
1652		initInline: function() {
1653			mfp.types.push(INLINE_NS);
1654
1655			_mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
1656				_putInlineElementsBack();
1657			});
1658		},
1659
1660		getInline: function(item, template) {
1661
1662			_putInlineElementsBack();
1663
1664			if(item.src) {
1665				var inlineSt = mfp.st.inline,
1666					el = $(item.src);
1667
1668				if(el.length) {
1669
1670					// If target element has parent - we replace it with placeholder and put it back after popup is closed
1671					var parent = el[0].parentNode;
1672					if(parent && parent.tagName) {
1673						if(!_inlinePlaceholder) {
1674							_hiddenClass = inlineSt.hiddenClass;
1675							_inlinePlaceholder = _getEl(_hiddenClass);
1676							_hiddenClass = 'mfp-'+_hiddenClass;
1677						}
1678						// replace target inline element with placeholder
1679						_lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
1680					}
1681
1682					mfp.updateStatus('ready');
1683				} else {
1684					mfp.updateStatus('error', inlineSt.tNotFound);
1685					el = $('<div>');
1686				}
1687
1688				item.inlineElement = el;
1689				return el;
1690			}
1691
1692			mfp.updateStatus('ready');
1693			mfp._parseMarkup(template, {}, item);
1694			return template;
1695		}
1696	}
1697});
1698
1699/*>>inline*/
1700
1701/*>>ajax*/
1702var AJAX_NS = 'ajax',
1703	_ajaxCur,
1704	_removeAjaxCursor = function() {
1705		if(_ajaxCur) {
1706			$(document.body).removeClass(_ajaxCur);
1707		}
1708	},
1709	_destroyAjaxRequest = function() {
1710		_removeAjaxCursor();
1711		if(mfp.req) {
1712			mfp.req.abort();
1713		}
1714	};
1715
1716$.magnificPopup.registerModule(AJAX_NS, {
1717
1718	options: {
1719		settings: null,
1720		cursor: 'mfp-ajax-cur',
1721		tError: '<a href="%url%">The content</a> could not be loaded.'
1722	},
1723
1724	proto: {
1725		initAjax: function() {
1726			mfp.types.push(AJAX_NS);
1727			_ajaxCur = mfp.st.ajax.cursor;
1728
1729			_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
1730			_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
1731		},
1732		getAjax: function(item) {
1733
1734			if(_ajaxCur) {
1735				$(document.body).addClass(_ajaxCur);
1736			}
1737
1738			mfp.updateStatus('loading');
1739
1740			var opts = $.extend({
1741				url: item.src,
1742				success: function(data, textStatus, jqXHR) {
1743					var temp = {
1744						data:data,
1745						xhr:jqXHR
1746					};
1747
1748					_mfpTrigger('ParseAjax', temp);
1749
1750					mfp.appendContent( $(temp.data), AJAX_NS );
1751
1752					item.finished = true;
1753
1754					_removeAjaxCursor();
1755
1756					mfp._setFocus();
1757
1758					setTimeout(function() {
1759						mfp.wrap.addClass(READY_CLASS);
1760					}, 16);
1761
1762					mfp.updateStatus('ready');
1763
1764					_mfpTrigger('AjaxContentAdded');
1765				},
1766				error: function() {
1767					_removeAjaxCursor();
1768					item.finished = item.loadError = true;
1769					mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
1770				}
1771			}, mfp.st.ajax.settings);
1772
1773			mfp.req = $.ajax(opts);
1774
1775			return '';
1776		}
1777	}
1778});
1779
1780/*>>ajax*/
1781
1782/*>>image*/
1783var _imgInterval,
1784	_getTitle = function(item) {
1785		if(item.data && item.data.title !== undefined)
1786			return item.data.title;
1787
1788		var src = mfp.st.image.titleSrc;
1789
1790		if(src) {
1791			if($.isFunction(src)) {
1792				return src.call(mfp, item);
1793			} else if(item.el) {
1794				return item.el.attr(src) || '';
1795			}
1796		}
1797		return '';
1798	};
1799
1800$.magnificPopup.registerModule('image', {
1801
1802	options: {
1803		markup: '<div class="mfp-figure">'+
1804					'<div class="mfp-close"></div>'+
1805					'<figure>'+
1806						'<div class="mfp-img"></div>'+
1807						'<figcaption>'+
1808							'<div class="mfp-bottom-bar">'+
1809								'<div class="mfp-title"></div>'+
1810								'<div class="mfp-counter"></div>'+
1811							'</div>'+
1812						'</figcaption>'+
1813					'</figure>'+
1814				'</div>',
1815		cursor: 'mfp-zoom-out-cur',
1816		titleSrc: 'title',
1817		verticalFit: true,
1818		tError: '<a href="%url%">The image</a> could not be loaded.'
1819	},
1820
1821	proto: {
1822		initImage: function() {
1823			var imgSt = mfp.st.image,
1824				ns = '.image';
1825
1826			mfp.types.push('image');
1827
1828			_mfpOn(OPEN_EVENT+ns, function() {
1829				if(mfp.currItem.type === 'image' && imgSt.cursor) {
1830					$(document.body).addClass(imgSt.cursor);
1831				}
1832			});
1833
1834			_mfpOn(CLOSE_EVENT+ns, function() {
1835				if(imgSt.cursor) {
1836					$(document.body).removeClass(imgSt.cursor);
1837				}
1838				_window.off('resize' + EVENT_NS);
1839			});
1840
1841			_mfpOn('Resize'+ns, mfp.resizeImage);
1842			if(mfp.isLowIE) {
1843				_mfpOn('AfterChange', mfp.resizeImage);
1844			}
1845		},
1846		resizeImage: function() {
1847			var item = mfp.currItem;
1848			if(!item || !item.img) return;
1849
1850			if(mfp.st.image.verticalFit) {
1851				var decr = 0;
1852				// fix box-sizing in ie7/8
1853				if(mfp.isLowIE) {
1854					decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
1855				}
1856				item.img.css('max-height', mfp.wH-decr);
1857			}
1858		},
1859		_onImageHasSize: function(item) {
1860			if(item.img) {
1861
1862				item.hasSize = true;
1863
1864				if(_imgInterval) {
1865					clearInterval(_imgInterval);
1866				}
1867
1868				item.isCheckingImgSize = false;
1869
1870				_mfpTrigger('ImageHasSize', item);
1871
1872				if(item.imgHidden) {
1873					if(mfp.content)
1874						mfp.content.removeClass('mfp-loading');
1875
1876					item.imgHidden = false;
1877				}
1878
1879			}
1880		},
1881
1882		/**
1883		 * Function that loops until the image has size to display elements that rely on it asap
1884		 */
1885		findImageSize: function(item) {
1886
1887			var counter = 0,
1888				img = item.img[0],
1889				mfpSetInterval = function(delay) {
1890
1891					if(_imgInterval) {
1892						clearInterval(_imgInterval);
1893					}
1894					// decelerating interval that checks for size of an image
1895					_imgInterval = setInterval(function() {
1896						if(img.naturalWidth > 0) {
1897							mfp._onImageHasSize(item);
1898							return;
1899						}
1900
1901						if(counter > 200) {
1902							clearInterval(_imgInterval);
1903						}
1904
1905						counter++;
1906						if(counter === 3) {
1907							mfpSetInterval(10);
1908						} else if(counter === 40) {
1909							mfpSetInterval(50);
1910						} else if(counter === 100) {
1911							mfpSetInterval(500);
1912						}
1913					}, delay);
1914				};
1915
1916			mfpSetInterval(1);
1917		},
1918
1919		getImage: function(item, template) {
1920
1921			var guard = 0,
1922
1923				// image load complete handler
1924				onLoadComplete = function() {
1925					if(item) {
1926						if (item.img[0].complete) {
1927							item.img.off('.mfploader');
1928
1929							if(item === mfp.currItem){
1930								mfp._onImageHasSize(item);
1931
1932								mfp.updateStatus('ready');
1933							}
1934
1935							item.hasSize = true;
1936							item.loaded = true;
1937
1938							_mfpTrigger('ImageLoadComplete');
1939
1940						}
1941						else {
1942							// if image complete check fails 200 times (20 sec), we assume that there was an error.
1943							guard++;
1944							if(guard < 200) {
1945								setTimeout(onLoadComplete,100);
1946							} else {
1947								onLoadError();
1948							}
1949						}
1950					}
1951				},
1952
1953				// image error handler
1954				onLoadError = function() {
1955					if(item) {
1956						item.img.off('.mfploader');
1957						if(item === mfp.currItem){
1958							mfp._onImageHasSize(item);
1959							mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
1960						}
1961
1962						item.hasSize = true;
1963						item.loaded = true;
1964						item.loadError = true;
1965					}
1966				},
1967				imgSt = mfp.st.image;
1968
1969
1970			var el = template.find('.mfp-img');
1971			if(el.length) {
1972				var img = document.createElement('img');
1973				img.className = 'mfp-img';
1974				if(item.el && item.el.find('img').length) {
1975					img.alt = item.el.find('img').attr('alt');
1976				}
1977				item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
1978				img.src = item.src;
1979
1980				// without clone() "error" event is not firing when IMG is replaced by new IMG
1981				// TODO: find a way to avoid such cloning
1982				if(el.is('img')) {
1983					item.img = item.img.clone();
1984				}
1985
1986				img = item.img[0];
1987				if(img.naturalWidth > 0) {
1988					item.hasSize = true;
1989				} else if(!img.width) {
1990					item.hasSize = false;
1991				}
1992			}
1993
1994			mfp._parseMarkup(template, {
1995				title: _getTitle(item),
1996				img_replaceWith: item.img
1997			}, item);
1998
1999			mfp.resizeImage();
2000
2001			if(item.hasSize) {
2002				if(_imgInterval) clearInterval(_imgInterval);
2003
2004				if(item.loadError) {
2005					template.addClass('mfp-loading');
2006					mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
2007				} else {
2008					template.removeClass('mfp-loading');
2009					mfp.updateStatus('ready');
2010				}
2011				return template;
2012			}
2013
2014			mfp.updateStatus('loading');
2015			item.loading = true;
2016
2017			if(!item.hasSize) {
2018				item.imgHidden = true;
2019				template.addClass('mfp-loading');
2020				mfp.findImageSize(item);
2021			}
2022
2023			return template;
2024		}
2025	}
2026});
2027
2028/*>>image*/
2029
2030/*>>zoom*/
2031var hasMozTransform,
2032	getHasMozTransform = function() {
2033		if(hasMozTransform === undefined) {
2034			hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
2035		}
2036		return hasMozTransform;
2037	};
2038
2039$.magnificPopup.registerModule('zoom', {
2040
2041	options: {
2042		enabled: false,
2043		easing: 'ease-in-out',
2044		duration: 300,
2045		opener: function(element) {
2046			return element.is('img') ? element : element.find('img');
2047		}
2048	},
2049
2050	proto: {
2051
2052		initZoom: function() {
2053			var zoomSt = mfp.st.zoom,
2054				ns = '.zoom',
2055				image;
2056
2057			if(!zoomSt.enabled || !mfp.supportsTransition) {
2058				return;
2059			}
2060
2061			var duration = zoomSt.duration,
2062				getElToAnimate = function(image) {
2063					var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
2064						transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
2065						cssObj = {
2066							position: 'fixed',
2067							zIndex: 9999,
2068							left: 0,
2069							top: 0,
2070							'-webkit-backface-visibility': 'hidden'
2071						},
2072						t = 'transition';
2073
2074					cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
2075
2076					newImg.css(cssObj);
2077					return newImg;
2078				},
2079				showMainContent = function() {
2080					mfp.content.css('visibility', 'visible');
2081				},
2082				openTimeout,
2083				animatedImg;
2084
2085			_mfpOn('BuildControls'+ns, function() {
2086				if(mfp._allowZoom()) {
2087
2088					clearTimeout(openTimeout);
2089					mfp.content.css('visibility', 'hidden');
2090
2091					// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
2092
2093					image = mfp._getItemToZoom();
2094
2095					if(!image) {
2096						showMainContent();
2097						return;
2098					}
2099
2100					animatedImg = getElToAnimate(image);
2101
2102					animatedImg.css( mfp._getOffset() );
2103
2104					mfp.wrap.append(animatedImg);
2105
2106					openTimeout = setTimeout(function() {
2107						animatedImg.css( mfp._getOffset( true ) );
2108						openTimeout = setTimeout(function() {
2109
2110							showMainContent();
2111
2112							setTimeout(function() {
2113								animatedImg.remove();
2114								image = animatedImg = null;
2115								_mfpTrigger('ZoomAnimationEnded');
2116							}, 16); // avoid blink when switching images
2117
2118						}, duration); // this timeout equals animation duration
2119
2120					}, 16); // by adding this timeout we avoid short glitch at the beginning of animation
2121
2122
2123					// Lots of timeouts...
2124				}
2125			});
2126			_mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
2127				if(mfp._allowZoom()) {
2128
2129					clearTimeout(openTimeout);
2130
2131					mfp.st.removalDelay = duration;
2132
2133					if(!image) {
2134						image = mfp._getItemToZoom();
2135						if(!image) {
2136							return;
2137						}
2138						animatedImg = getElToAnimate(image);
2139					}
2140
2141					animatedImg.css( mfp._getOffset(true) );
2142					mfp.wrap.append(animatedImg);
2143					mfp.content.css('visibility', 'hidden');
2144
2145					setTimeout(function() {
2146						animatedImg.css( mfp._getOffset() );
2147					}, 16);
2148				}
2149
2150			});
2151
2152			_mfpOn(CLOSE_EVENT+ns, function() {
2153				if(mfp._allowZoom()) {
2154					showMainContent();
2155					if(animatedImg) {
2156						animatedImg.remove();
2157					}
2158					image = null;
2159				}
2160			});
2161		},
2162
2163		_allowZoom: function() {
2164			return mfp.currItem.type === 'image';
2165		},
2166
2167		_getItemToZoom: function() {
2168			if(mfp.currItem.hasSize) {
2169				return mfp.currItem.img;
2170			} else {
2171				return false;
2172			}
2173		},
2174
2175		// Get element postion relative to viewport
2176		_getOffset: function(isLarge) {
2177			var el;
2178			if(isLarge) {
2179				el = mfp.currItem.img;
2180			} else {
2181				el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
2182			}
2183
2184			var offset = el.offset();
2185			var paddingTop = parseInt(el.css('padding-top'),10);
2186			var paddingBottom = parseInt(el.css('padding-bottom'),10);
2187			offset.top -= ( $(window).scrollTop() - paddingTop );
2188
2189
2190			/*
2191
2192			Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
2193
2194			 */
2195			var obj = {
2196				width: el.width(),
2197				// fix Zepto height+padding issue
2198				height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
2199			};
2200
2201			// I hate to do this, but there is no another option
2202			if( getHasMozTransform() ) {
2203				obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
2204			} else {
2205				obj.left = offset.left;
2206				obj.top = offset.top;
2207			}
2208			return obj;
2209		}
2210
2211	}
2212});
2213
2214
2215
2216/*>>zoom*/
2217
2218/*>>iframe*/
2219
2220var IFRAME_NS = 'iframe',
2221	_emptyPage = '//about:blank',
2222
2223	_fixIframeBugs = function(isShowing) {
2224		if(mfp.currTemplate[IFRAME_NS]) {
2225			var el = mfp.currTemplate[IFRAME_NS].find('iframe');
2226			if(el.length) {
2227				// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
2228				if(!isShowing) {
2229					el[0].src = _emptyPage;
2230				}
2231
2232				// IE8 black screen bug fix
2233				if(mfp.isIE8) {
2234					el.css('display', isShowing ? 'block' : 'none');
2235				}
2236			}
2237		}
2238	};
2239
2240$.magnificPopup.registerModule(IFRAME_NS, {
2241
2242	options: {
2243		markup: '<div class="mfp-iframe-scaler">'+
2244					'<div class="mfp-close"></div>'+
2245					'<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
2246				'</div>',
2247
2248		srcAction: 'iframe_src',
2249
2250		// we don't care and support only one default type of URL by default
2251		patterns: {
2252			youtube: {
2253				index: 'youtube.com',
2254				id: 'v=',
2255				src: '//www.youtube.com/embed/%id%?autoplay=1'
2256			},
2257			vimeo: {
2258				index: 'vimeo.com/',
2259				id: '/',
2260				src: '//player.vimeo.com/video/%id%?autoplay=1'
2261			},
2262			gmaps: {
2263				index: '//maps.google.',
2264				src: '%id%&output=embed'
2265			}
2266		}
2267	},
2268
2269	proto: {
2270		initIframe: function() {
2271			mfp.types.push(IFRAME_NS);
2272
2273			_mfpOn('BeforeChange', function(e, prevType, newType) {
2274				if(prevType !== newType) {
2275					if(prevType === IFRAME_NS) {
2276						_fixIframeBugs(); // iframe if removed
2277					} else if(newType === IFRAME_NS) {
2278						_fixIframeBugs(true); // iframe is showing
2279					}
2280				}// else {
2281					// iframe source is switched, don't do anything
2282				//}
2283			});
2284
2285			_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
2286				_fixIframeBugs();
2287			});
2288		},
2289
2290		getIframe: function(item, template) {
2291			var embedSrc = item.src;
2292			var iframeSt = mfp.st.iframe;
2293
2294			$.each(iframeSt.patterns, function() {
2295				if(embedSrc.indexOf( this.index ) > -1) {
2296					if(this.id) {
2297						if(typeof this.id === 'string') {
2298							embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
2299						} else {
2300							embedSrc = this.id.call( this, embedSrc );
2301						}
2302					}
2303					embedSrc = this.src.replace('%id%', embedSrc );
2304					return false; // break;
2305				}
2306			});
2307
2308			var dataObj = {};
2309			if(iframeSt.srcAction) {
2310				dataObj[iframeSt.srcAction] = embedSrc;
2311			}
2312			mfp._parseMarkup(template, dataObj, item);
2313
2314			mfp.updateStatus('ready');
2315
2316			return template;
2317		}
2318	}
2319});
2320
2321
2322
2323/*>>iframe*/
2324
2325/*>>gallery*/
2326/**
2327 * Get looped index depending on number of slides
2328 */
2329var _getLoopedId = function(index) {
2330		var numSlides = mfp.items.length;
2331		if(index > numSlides - 1) {
2332			return index - numSlides;
2333		} else  if(index < 0) {
2334			return numSlides + index;
2335		}
2336		return index;
2337	},
2338	_replaceCurrTotal = function(text, curr, total) {
2339		return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
2340	};
2341
2342$.magnificPopup.registerModule('gallery', {
2343
2344	options: {
2345		enabled: false,
2346		arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
2347		preload: [0,2],
2348		navigateByImgClick: true,
2349		arrows: true,
2350
2351		tPrev: 'Previous (Left arrow key)',
2352		tNext: 'Next (Right arrow key)',
2353		tCounter: '%curr% of %total%'
2354	},
2355
2356	proto: {
2357		initGallery: function() {
2358
2359			var gSt = mfp.st.gallery,
2360				ns = '.mfp-gallery';
2361
2362			mfp.direction = true; // true - next, false - prev
2363
2364			if(!gSt || !gSt.enabled ) return false;
2365
2366			_wrapClasses += ' mfp-gallery';
2367
2368			_mfpOn(OPEN_EVENT+ns, function() {
2369
2370				if(gSt.navigateByImgClick) {
2371					mfp.wrap.on('click'+ns, '.mfp-img', function() {
2372						if(mfp.items.length > 1) {
2373							mfp.next();
2374							return false;
2375						}
2376					});
2377				}
2378
2379				_document.on('keydown'+ns, function(e) {
2380					if (e.keyCode === 37) {
2381						mfp.prev();
2382					} else if (e.keyCode === 39) {
2383						mfp.next();
2384					}
2385				});
2386			});
2387
2388			_mfpOn('UpdateStatus'+ns, function(e, data) {
2389				if(data.text) {
2390					data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
2391				}
2392			});
2393
2394			_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
2395				var l = mfp.items.length;
2396				values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
2397			});
2398
2399			_mfpOn('BuildControls' + ns, function() {
2400				if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
2401					var markup = gSt.arrowMarkup,
2402						arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
2403						arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
2404
2405					arrowLeft.click(function() {
2406						mfp.prev();
2407					});
2408					arrowRight.click(function() {
2409						mfp.next();
2410					});
2411
2412					mfp.container.append(arrowLeft.add(arrowRight));
2413				}
2414			});
2415
2416			_mfpOn(CHANGE_EVENT+ns, function() {
2417				if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
2418
2419				mfp._preloadTimeout = setTimeout(function() {
2420					mfp.preloadNearbyImages();
2421					mfp._preloadTimeout = null;
2422				}, 16);
2423			});
2424
2425
2426			_mfpOn(CLOSE_EVENT+ns, function() {
2427				_document.off(ns);
2428				mfp.wrap.off('click'+ns);
2429				mfp.arrowRight = mfp.arrowLeft = null;
2430			});
2431
2432		},
2433		next: function() {
2434			mfp.direction = true;
2435			mfp.index = _getLoopedId(mfp.index + 1);
2436			mfp.updateItemHTML();
2437		},
2438		prev: function() {
2439			mfp.direction = false;
2440			mfp.index = _getLoopedId(mfp.index - 1);
2441			mfp.updateItemHTML();
2442		},
2443		goTo: function(newIndex) {
2444			mfp.direction = (newIndex >= mfp.index);
2445			mfp.index = newIndex;
2446			mfp.updateItemHTML();
2447		},
2448		preloadNearbyImages: function() {
2449			var p = mfp.st.gallery.preload,
2450				preloadBefore = Math.min(p[0], mfp.items.length),
2451				preloadAfter = Math.min(p[1], mfp.items.length),
2452				i;
2453
2454			for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
2455				mfp._preloadItem(mfp.index+i);
2456			}
2457			for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
2458				mfp._preloadItem(mfp.index-i);
2459			}
2460		},
2461		_preloadItem: function(index) {
2462			index = _getLoopedId(index);
2463
2464			if(mfp.items[index].preloaded) {
2465				return;
2466			}
2467
2468			var item = mfp.items[index];
2469			if(!item.parsed) {
2470				item = mfp.parseEl( index );
2471			}
2472
2473			_mfpTrigger('LazyLoad', item);
2474
2475			if(item.type === 'image') {
2476				item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
2477					item.hasSize = true;
2478				}).on('error.mfploader', function() {
2479					item.hasSize = true;
2480					item.loadError = true;
2481					_mfpTrigger('LazyLoadError', item);
2482				}).attr('src', item.src);
2483			}
2484
2485
2486			item.preloaded = true;
2487		}
2488	}
2489});
2490
2491/*>>gallery*/
2492
2493/*>>retina*/
2494
2495var RETINA_NS = 'retina';
2496
2497$.magnificPopup.registerModule(RETINA_NS, {
2498	options: {
2499		replaceSrc: function(item) {
2500			return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
2501		},
2502		ratio: 1 // Function or number.  Set to 1 to disable.
2503	},
2504	proto: {
2505		initRetina: function() {
2506			if(window.devicePixelRatio > 1) {
2507
2508				var st = mfp.st.retina,
2509					ratio = st.ratio;
2510
2511				ratio = !isNaN(ratio) ? ratio : ratio();
2512
2513				if(ratio > 1) {
2514					_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
2515						item.img.css({
2516							'max-width': item.img[0].naturalWidth / ratio,
2517							'width': '100%'
2518						});
2519					});
2520					_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
2521						item.src = st.replaceSrc(item, ratio);
2522					});
2523				}
2524			}
2525
2526		}
2527	}
2528});
2529
2530/*>>retina*/
2531 _checkInstance(); }));
2532//global functions helpers for frontend
2533if (!Element.prototype.matches) {
2534	Element.prototype.matches = 
2535	Element.prototype.matchesSelector || 
2536	Element.prototype.mozMatchesSelector ||
2537	Element.prototype.msMatchesSelector ||
2538	Element.prototype.oMatchesSelector ||
2539	Element.prototype.webkitMatchesSelector ||
2540	function (s) {
2541		var matches = (this.document || this.ownerDocument).querySelectorAll(s),
2542			i = matches.length;
2543		while (--i >= 0 && matches.item(i) !== this) { }
2544		return i > -1;
2545	};
2546}
2547if (!String.prototype.endsWith) {
2548	String.prototype.endsWith = function (search, this_len) {
2549		if (this_len === undefined || this_len > this.length) {
2550			this_len = this.length;
2551		}
2552		return this.substring(this_len - search.length, this_len) === search;
2553	};
2554}
2555
2556
2557
2558(function ($) {
2559	$.fn.isBrowserEdge = function () {
2560		var $this = $(this);
2561		return typeof CSS !== 'undefined' && CSS.supports("(-ms-ime-align:auto)");
2562	};
2563})(jQuery);
2564
2565function setDataUserAgent() {
2566	var b = document.documentElement;
2567	b.className = b.className.replace('no-js', 'js');
2568	b.setAttribute("data-useragent", navigator.userAgent);
2569	b.setAttribute("data-platform", navigator.platform);
2570}
2571
2572$.fn.isInViewport = function () {
2573	var elementTop = $(this).offset().top;
2574	var elementBottom = elementTop + $(this).outerHeight();
2575	var viewportTop = $(window).scrollTop();
2576	var viewportBottom = viewportTop + $(window).height();
2577	return elementBottom > viewportTop && elementTop < viewportBottom;
2578};
2579
2580//-- Check overflow horizontal en vertical
2581(function ($) {
2582	$.fn.hasOverflow = function () {
2583		var $this = $(this);
2584		return $this[0].scrollHeight > Math.round($this.outerHeight()) ||
2585			$this[0].scrollWidth > Math.round($this.outerWidth());
2586	};
2587})(jQuery);
2588
2589//--check hasScrollVertical
2590(function ($) {
2591	$.fn.hasScrollVertical = function () {
2592		var $this = $(this);
2593		return $this[0].scrollHeight > Math.round($this.outerHeight());
2594	};
2595})(jQuery);
2596
2597//--check hasScrollHorizontal
2598(function ($) {
2599	$.fn.hasScrollHorizontal = function () {
2600		var $this = $(this);
2601		return Math.round($this[0].scrollWidth) > Math.round($this.outerWidth());
2602	};
2603})(jQuery);
2604
2605//-- Verwijder alle klasses met bepaald voorvoegsel
2606$.fn.removeClassLike = function (name) {
2607	return this.removeClass(function (index, css) {
2608		return (css.match(new RegExp('\\b(' + name + '\\S*)\\b', 'g')) || []).join(' ');
2609	});
2610};
2611
2612//-- check items op verschillende rijen op basis van matchHeight plugin js/jquery-match-height-master/jquery.matchHeight.js
2613function checkRow(container, items) {
2614	var el = $(container),
2615		rowCount = 0,
2616		classPrefix = 'row-';
2617
2618	$(window).on('load resize', function (e) {
2619		var elItems = el.find(items);
2620		//clear
2621		el.removeClass('has-rows');
2622		elItems.removeClass('new-row end-row even odd').removeClassLike(classPrefix);
2623
2624		var rows = $.fn.matchHeight._rows(elItems);
2625		// console.log(rows);
2626
2627		//clear
2628		rowCount = 0;
2629
2630		if (rows.length > 1) {
2631			el.addClass('has-rows');
2632			rows = $.fn.matchHeight._rows(elItems);
2633		} else {
2634			el.removeClass('has-rows');
2635			elItems.removeClassLike(classPrefix);
2636		}
2637
2638		$.each(rows, function (i, row) {
2639			rowCount++;
2640			if (i % 2 === 0) {
2641				/* we are even */
2642				row.addClass('odd');
2643
2644			} else {
2645				/* we are odd */
2646				row.addClass('even');
2647			}
2648			row.addClass(classPrefix + rowCount);
2649			row.first().addClass('new-row');
2650			row.last().addClass('end-row');
2651		});
2652	});
2653}
2654
2655//--Check floatcollapse
2656function checkFloats(container, items, screenWidth) {
2657	var $this = $(container),
2658		currentRowStart = 0,
2659		topPosition = 0,
2660		currentItems = $this.find(items);
2661	// console.log(currentItems.length);
2662
2663	if (screenWidth === undefined || screenWidth === null) {
2664		screenWidth = gridFloatBreakpoint; //grid float breakpoints: 320, 544, //--480px, 768px, 992px, 1200px
2665	}
2666	if (currentItems.length >= 1) {
2667		$('#inner-wrap, .navbar-default').removeClass('has-hamburger');
2668
2669		currentItems.each(function (teller) {
2670			currentElement = $(this);
2671			topPostion = Math.ceil(currentElement.position().top);
2672			// if ($(document).width() >= screenWidth) {
2673			if (currentRowStart !== topPostion) {
2674				$('#inner-wrap, .navbar-default').addClass('has-hamburger');
2675			}
2676			// }
2677		});
2678	}
2679}
2680
2681//-- accessibility tabben enkel in modal open
2682disableTabModalShown = function (el) {
2683	var modal = el,
2684		focusableChildren = modal.find('a[href], a[data-dismiss], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]').not(':hidden'),
2685		numElements = focusableChildren.length,
2686		currentIndex;
2687
2688	currentIndex = -1;
2689	// $(document.activeElement).blur();
2690	// if (modal.hasClass('header-search')) {
2691	// 	currentIndex = 1;
2692	// }
2693	// } else {
2694	// 	$(document.activeElement).blur();
2695	// }
2696	// if ( $('#search').hasClass('selected')) {
2697	// 	currentIndex = focusableChildren[currentIndex];
2698	// } else {
2699	// 	currentIndex = -1;
2700	// }
2701	// console.log(modal);
2702	// console.log(focusableChildren,numElements);
2703
2704	var focus = function () {
2705		var focusableElement = focusableChildren[currentIndex];
2706		if (focusableElement)
2707			focusableElement.focus();
2708	};
2709
2710	var focusPrevious = function () {
2711		currentIndex--;
2712		if (currentIndex < 0)
2713			currentIndex = numElements - 1;
2714
2715		focus();
2716		return false;
2717	};
2718
2719	var focusNext = function () {
2720		currentIndex++;
2721		if (currentIndex >= numElements)
2722			currentIndex = 0;
2723
2724		focus();
2725		return false;
2726	};
2727
2728	$(document).on('keydown', function (e) {
2729		if (e.keyCode === 9 && e.shiftKey) {
2730			e.preventDefault();
2731			focusPrevious();
2732		}
2733		else if (e.keyCode === 9) {
2734			e.preventDefault();
2735			focusNext();
2736		}
2737	});
2738}
2739
2740//easing geplukt van jquery easing gebruikt voor de scrollto functie
2741$.easing.elasout = function (x, t, b, c, d) {
2742	var s = 1.70158; var p = 0; var a = c;
2743	if (t === 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
2744	if (a < Math.abs(c)) { a = c; var s = p / 4; }
2745	else var s = p / (2 * Math.PI) * Math.asin(c / a);
2746	return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
2747};
2748
2749//-- Functions
2750//-- Check als het een nummer is
2751function isNumeric(n) {
2752	return !isNaN(parseFloat(n)) && isFinite(n);
2753}
2754
2755
2756//probeersel focus-within
2757// function checkFocuswithin() {
2758// 	var $focus = $('.check-focus-within');
2759// 	if ($focus.length > 0) {
2760// 		$focus.find('a, button').focus(function() {
2761// 			$(this).parents('.check-focus-within').removeClass('focus-within')
2762// 			var className = $(this).attr('class').match(/\S*__link\b/i);
2763// 			console.log(className);
2764// 			if (!className) {
2765// 				$(this).parents('.check-focus-within').addClass('focus-within');
2766// 			} else {
2767// 				$(this).parents('.check-focus-within').removeClass('focus-within')
2768// 			}
2769// 		});
2770// 	}	
2771// }
2772
2773
2774
2775var Scroller = {
2776    scrollers: null,
2777    timer: null,
2778    init: function () {
2779        var that = this;
2780        that.scrollers = $("[data-scroller]");
2781        if (that.scrollers.length > 0 && that.scrollers.children().length > 2) {
2782            that.checkHorizontalScroll();
2783            $(window).on('resize', function (e) {
2784                if (that.timer != null) {
2785                    clearTimeout(that.timer);
2786                }
2787                that.timer = setTimeout(function () { that.checkHorizontalScroll(); }, 300);
2788            });
2789            $(document).on('click', 'button[data-scroll]', function (e) {
2790                e.preventDefault();
2791                var btn = $(this);
2792                that.goTo(btn);
2793            });
2794        }
2795    },
2796    checkHorizontalScroll: function () {
2797        var that = this;
2798        that.scrollers.each(function (i) {
2799            var scrollZone = $(this),
2800                elFade = scrollZone.parents('.' + that.scrollers.attr('data-scroller'));
2801            
2802            // console.log(scrollZone, scrollZone.hasScrollHorizontal());
2803            
2804            if (scrollZone.hasScrollHorizontal()) {
2805				// console.log("hasscrollbar overflow");
2806				var scrollLeftPos = scrollZone.scrollLeft();
2807
2808				if (scrollLeftPos > 0) {
2809					elFade
2810						.addClass('fade-left')
2811						.find('.btn-scroll.prev')
2812						.removeClass('hidden');
2813				} else {
2814					elFade
2815						.removeClass('fade-left')
2816						.find('.btn-scroll.prev')
2817						.addClass('hidden');
2818				}
2819
2820				if (
2821					scrollLeftPos + scrollZone.width() ===
2822					scrollZone[0].scrollWidth
2823				) {
2824					elFade
2825						.removeClass('fade-right')
2826						.find('.btn-scroll.next')
2827						.addClass('hidden');
2828				} else {
2829					elFade
2830						.addClass(' fade-right')
2831						.find('.btn-scroll.next')
2832						.removeClass('hidden');
2833				}
2834			} else {
2835				// console.log("NO scrollbar overflow");
2836                elFade.removeClass('fade-left fade-right').find('.btn-scroll').addClass('hidden');
2837			}
2838        });
2839    },
2840    goTo: function (btn) {
2841        var that = this;
2842        var scrollzone = btn.parent().find('[data-scroller]');
2843        var currentScrollPos = scrollzone.scrollLeft();
2844        var width = scrollzone.innerWidth() / 2 ;
2845        var scroll = btn.hasClass('prev') ? width : - width; 
2846  
2847        scrollzone.stop().animate({
2848            scrollLeft: currentScrollPos - scroll
2849        }, {
2850            duration: 250,
2851            complete: function () { Scroller.checkHorizontalScroll(); }
2852        });
2853    }  
2854}
2855
2856Scroller.init();
2857
2858
2859var Cookie = {
2860    set: function (cookiename, noOfDays, value) {
2861
2862        var c_value = escape(value) + ";Path=/;samesite=lax;";
2863
2864        if (noOfDays !== null) {
2865
2866            var exdate = new Date();
2867            exdate.setDate(exdate.getDate() + parseInt(noOfDays));
2868            c_value += " expires=" + exdate.toUTCString();
2869        }
2870        if (window.location.protocol.indexOf('https') > -1) {
2871            c_value += ";secure"
2872        }
2873
2874    document.cookie = cookiename + "=" + c_value;
2875    },
2876    get: function (cookiename) {
2877        var name = cookiename + "=";
2878        var decodedCookie = decodeURIComponent(document.cookie);
2879        var ca = decodedCookie.split(';');
2880        for (var i = 0; i < ca.length; i++) {
2881            var c = ca[i];
2882            while (c.charAt(0) === ' ') {
2883                c = c.substring(1);
2884            }
2885            if (c.indexOf(name) === 0) {
2886                return c.substring(name.length, c.length);
2887            }
2888        }
2889        return "";
2890    },
2891    remove: function (cookiename) {
2892        document.cookie = cookiename + "=;Path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";
2893    }
2894};
2895var listAnchorsItems = null;
2896var isScrolling = false;
2897var scrollTimer = null;
2898var scrollTimerClick = null;
2899
2900function scrollto() {
2901    /*
2902    //:: oldskool deprecated: niet werken op ie, edge :: animate scrolltop geeft een jump met offset
2903    $(document).on('click', '[data-scrollto]', function (e) {
2904        e.preventDefault();
2905        var el = $(this),
2906            elGoto = $(el.attr('href')),
2907            top = elGoto.offset().top; //-- base not sticky header
2908
2909        // if (el.data('scrollto') === "totop") { }
2910        if (el.data('scrollto') === "az") {
2911            top = elGoto.offset().top - stickySpacing;
2912        }
2913
2914        $("body, html").scrollTop(top);
2915    });
2916    */
2917
2918    //check totop bij het laden
2919    checkTopposition();
2920
2921    // Show or hide the sticky footer button
2922    $window.on('scroll', checkTopposition);
2923
2924    $(document).on("scroll", onScroll).on('click', 'a[data-scrollto]', function () {
2925        isScrolling = true;
2926        // console.log('click', isScrolling);
2927        var li = $(this).parent();
2928        $('.side-bar .box__block .list li, .list-anchors li, .side-bar .box__block .nav-az li').not(li).removeClass('active');
2929
2930        li.addClass('active');
2931
2932        if (scrollTimerClick !== null)
2933            clearInterval(scrollTimerClick);
2934
2935        scrollTimerClick = setTimeout(function () { isScrolling = false; }, 500);
2936    });
2937
2938    listAnchorsItems = $('.page-content h2[id]');
2939    CheckActiveAnchors();  
2940
2941    //documentation zie: https://github.com/cferdinandi/smooth-scroll
2942    var scroll = new SmoothScroll('[data-scrollto], a[href*="#"]', {
2943        emitEvents: true, 
2944        speed: 500,
2945        speedAsDuration: true,
2946        updateURL: false, // Update the URL on scroll = e.preventdefault
2947        // Easing
2948        easing: 'EaseIn', // Easing pattern to use
2949        // header: '[data-scroll-header]',
2950        offset: function (anchor, toggle) {
2951            // Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels
2952            // This example is a function, but you could do something as simple as `offset: 25`
2953            // console.log(anchor, toggle);
2954            // console.log(toggle.getAttribute('data-scrollto'));
2955
2956            if ( toggle.getAttribute('data-scrollto') === 'az' || toggle.getAttribute('data-scrollto') === 'filter' || toggle.getAttribute('href').startsWith('#') ) {
2957                return stickySpacing;
2958            } else {
2959                return 0;
2960            }
2961        },
2962    });
2963
2964    // Listen for scroll events
2965    document.addEventListener('scrollStop', logScrollEvent, false);
2966    document.addEventListener('scrollStart', logScrollEvent, false);
2967    // document.addEventListener('scrollCancel', logScrollEvent, false);
2968}
2969
2970function onScroll(event) {
2971    checkTopposition();
2972    // console.log(isScrolling);
2973    //-- scrollspy check
2974    if (isScrolling === false) {
2975        if (scrollTimer !== null)
2976            clearTimeout(scrollTimer);
2977        scrollTimer = setTimeout(function () { CheckActiveAnchors(); }, 100);
2978    }
2979}
2980
2981// Log scroll events
2982var logScrollEvent = function (event) {
2983    // console.log(event.detail.anchor.classList);
2984
2985    if (event.type === 'scrollStop') {
2986		event.detail.anchor.removeAttribute('style');
2987		event.detail.anchor.removeAttribute('tabindex');
2988		// console.log(event.detail.anchor.classList);
2989		// console.log('toggle:', event.detail.toggle);
2990		// console.log('anchor:', event.detail.anchor);
2991        if (event.detail.anchor.getAttribute('ID') === 'content-main' && $('section.atoz').length > 0) {
2992			$(event.detail.anchor)
2993				.find('.page-content')
2994				.attr('tabindex', -1)
2995				.trigger('focus')
2996				.removeAttr('tabindex');
2997		}
2998	} else if (event.type === 'scrollStart') {
2999        isScrolling = true;
3000        if (scrollTimerClick !== null)
3001            clearInterval(scrollTimerClick);
3002
3003        scrollTimerClick = setTimeout(function () { isScrolling = false; }, 600);
3004    }
3005};
3006
3007function CheckActiveAnchors() {
3008    if (listAnchorsItems.length > 0) {
3009        var fromTop = $(window).scrollTop();
3010
3011        listAnchorsItems.each(function () {
3012            var top = $(this).offset().top - 10;
3013            var li = $('.side-bar .box__block .list li a[href="#' + $(this).attr('id') + '"]').parent();
3014            if (fromTop >= top) {
3015
3016                $('.side-bar .box__block .list li').not(li).removeClass('active');
3017
3018                li.addClass('active');
3019
3020            } else {
3021                li.removeClass('active');
3022            }
3023        });
3024    }
3025}
3026//-- Check wanneer totop knop getoond mag worden
3027function checkTopposition() {
3028	var totop = $('#totop');
3029
3030	if (!$('html.no-scroll').length > 0) {
3031		checkScrollposition(totop);
3032	}
3033}
3034
3035//-- Functionaliteit wanneer totop knop getoond is
3036function checkScrollposition(elShowhide) {
3037	var elShowcheck = $('.brand').innerHeight(),
3038		elFooter = $('#footer');
3039		footerCheck = $(document).height() - elFooter.innerHeight(),
3040		totop = $('.toppos');
3041
3042	if ($(this).scrollTop() > elShowcheck) {
3043		elShowhide.fadeIn('fast');
3044		$('.scroll-down').addClass('hidden').hide();
3045		// icordisBtn.css({
3046		// 	'top': '-100%'
3047		// });
3048	} else {
3049		elShowhide.fadeOut('fast');
3050		//icordisBtn.removeAttr('style');
3051		if ($('body.home').length > 0) {
3052			$('.scroll-down').removeClass('hidden').show();
3053		}
3054	}
3055
3056	if (Math.round($(window).scrollTop()) + $(window).height() > footerCheck) {
3057		totop.addClass('animate');
3058		totop.css({
3059			bottom: Math.round($(window).scrollTop()) + $(window).height() - footerCheck + 15, // position boven de footer met spacing
3060			// bottom: elFooter.innerHeight() + 30 / 2, // position boven de footer met spacing
3061		});
3062	} else {
3063		totop.removeAttr('style').removeClass('animate');
3064	}
3065	
3066	// else {
3067	// if ($(document).width() >= gridFloatBreakpoint) {
3068	// 	totop.addClass('animate');
3069		
3070	// 		totop.removeAttr('style');
3071	// 	}
3072	// } else {
3073	// 	totop.removeAttr('style').removeClass('animate');;
3074	// }
3075};
3076
3077
3078
3079//Hoogte van de banner berekenen
3080function checkElVh(el, screenWidth) {
3081	if (el === undefined || el === null) {
3082		el = $('.header');
3083	}
3084	if (screenWidth === undefined || screenWidth === null) {
3085		screenWidth = gridFloatBreakpoint; //grid float breakpoints: 320, 544, //--480px, 768px, 992px, 1200px
3086	}
3087
3088	if ($('body.home').length > 0) {
3089		$(window).on("load resize", checkBannerheight);
3090	}
3091
3092	function checkBannerheight() {
3093		if ($(document).width() >= screenWidth) {
3094			el.css({
3095				'minHeight': $(window).height()
3096			});
3097			// $('.header-right').css({
3098			// 	'top': ( $(window).height() - $('.header-right').innerHeight() ) / 2
3099			// })
3100
3101		} else {
3102			el.removeAttr('style');
3103			// $('.header-right').removeAttr('style');
3104		}
3105	}
3106}
3107
3108
3109function setOffcanvasHeaderOffset() {
3110	var offcanvasHeaderOffset =
3111		$('.header-main').offset().top +
3112		$('.header-main').innerHeight() -
3113		Math.ceil($(window).scrollTop());
3114
3115	$('.header-nav-overlay, .header-nav').css({
3116		top: offcanvasHeaderOffset,
3117	});
3118}
3119var isFooterParallax = false;
3120
3121//-- Bij minder content footer onderaan de pagina houden
3122// ! let op isFooterParallax true of false
3123function footerFixedBottom(el) {
3124	var elFooter = $('#footer'),
3125		footerHeight = elFooter.outerHeight(),
3126		windowHeight = $(window).height(), 
3127		filterMoved = false;
3128
3129	// $('#inner-wrap').css({
3130
3131	if (!el) {
3132		if ($('#inner-wrap').height() < windowHeight) {
3133			$('#footer').css({
3134				'position': 'absolute',
3135				'bottom': 0,
3136				'width': '100%'
3137			});
3138
3139			if ($('div[data-filter="fixed"]').length > 0) {
3140				var elf = $('div[data-filter="fixed"]');
3141
3142				if (!filterMoved) {
3143					var elReadytomove = elf.detach();
3144					$('<div/>', {
3145						class: 'container',
3146						html: elReadytomove
3147					}).prependTo(elFooter);
3148				}
3149				filterMoved = true;
3150			}
3151
3152			$('#inner-wrap').css({
3153				'minHeight': windowHeight,
3154				'paddingBottom': footerHeight
3155			});
3156			$('.toppos').css({
3157				'bottom': footerHeight + 30
3158			});
3159		} else {
3160			$('#footer, #inner-wrap').removeAttr('style');
3161		}
3162	} else {
3163		// console.log(windowHeight + "--" + footerHeight);
3164		if (footerHeight < windowHeight) {
3165			$('#footer').css({
3166				'position': 'fixed',
3167				'bottom': 0,
3168				'left': 0,
3169				'width': '100%'
3170			});
3171			$('#inner-wrap').css({
3172				'marginBottom': footerHeight
3173			});
3174		} else {
3175			$('#footer, #inner-wrap').removeAttr('style');
3176		}
3177	}
3178}
3179
3180var Menu = {
3181	menuType: null,
3182	resizeTimer: null,
3183	dropdownNavMenuWith: 0,
3184	countNavMenuWidth: 0,
3185	navContainer: null,
3186	overlayActive: false,
3187	init: function () {
3188		var that = this;
3189		that.navContainer = $('.nav-main');
3190		that.menuType = $('body').attr('data-menu');
3191		if (that.menuType === 'dropdown') {
3192			that.calcMenuWidth();
3193			// that.doMenuMore();
3194			that.doDropdown();
3195			that.checkDropDownSubMenuPosition();
3196			that.doCheckDropdownOrHamburger();
3197
3198			$(window).on('resize', function (e) {
3199				Menu.dowindowResize();
3200			});
3201		}
3202		that.doHamburgerMenu();
3203		that.checkActiveState();
3204	},
3205
3206	calcMenuWidth: function () {
3207		var that = this;
3208		var items = that.navContainer.children('li');
3209		items.each(function () {
3210			var li = $(this);
3211			li.attr(
3212				'data-width',
3213				Math.ceil(
3214					li.width() -
3215						(li.find('a').width() - li.find('span').width())
3216				)
3217			);
3218			that.dropdownNavMenuWith += li.data('width');
3219		});
3220	},
3221
3222	doMenuMore: function () {
3223		var that = this;
3224		var t = 1;
3225		var count = 5;
3226		var items = that.navContainer.children('li');
3227
3228		var menuMainmore = $('<div/>') // creates a div element
3229			.addClass('nav-main nav-main--more dropdown'); // add a class
3230		var menuMainmoreLink = $('<a/>', {
3231			text: 'Meer',
3232			href: '#',
3233			class: 'nav__link',
3234		}).appendTo(menuMainmore);
3235
3236		var menuMainmoreSub = $('<ul/>').addClass('dropdown__menu');
3237
3238		items.each(function () {
3239			var li = $(this);
3240			if (t > 0 && t <= count) {
3241				li.attr(
3242					'data-width',
3243					Math.ceil(
3244						li.width() -
3245							(li.find('a').width() - li.find('span').width())
3246					)
3247				);
3248				that.countNavMenuWidth += li.data('width');
3249				// console.log('teller: ' + t + '= ' + that.countNavMenuWidth);
3250			}
3251			t++;
3252		});
3253
3254		if (items.length > count) {
3255			menuMainmore.insertAfter($('.nav-main'));
3256			menuMainmoreSub.insertAfter(menuMainmoreLink);
3257			$('.nav-main--more > .dropdown__menu').append(items.slice(count));
3258		}
3259	},
3260
3261	doCheckDropdownOrHamburger: function () {
3262		var that = this;
3263		var availablespace = $('.header__main div:first').width();
3264		if (that.dropdownNavMenuWith >= availablespace) {
3265			$('.navigation-main, .header').addClass('has-hamburger');
3266			$('.navigation__container-wrapper').addClass('container');
3267		} else {
3268			$('.navigation-main, .header').removeClass('has-hamburger');
3269			$('.navigation__container-wrapper').removeClass('container');
3270		}
3271	},
3272
3273	doDropdown: function () {
3274		var that = this;
3275		$(document)
3276			.on('mouseenter', 'nav li.dropdown', function () {
3277				var li = $(this);
3278				li.addClass('open');
3279
3280				var a = li.find('a');
3281				a.attr('aria-expanded', 'true');
3282			})
3283			.on('mouseleave', 'nav li.dropdown', function () {
3284				var li = $(this);
3285				li.removeClass('open');
3286
3287				var a = li.find('a');
3288				a.attr('aria-expanded', 'false');
3289			});
3290	},
3291	checkDropDownSubMenuPosition: function () {
3292		var windowWidth = $(window).width();
3293		var dropdownItems = $('nav .dropdown__menu');
3294		dropdownItems
3295			.removeClass('dropdown__menu--left')
3296			.removeClass('dropdown__menu--right')
3297			.removeClass('dropdown__menu--center');
3298		dropdownItems.each(function (e) {
3299			var dropdownMenu = $(this);
3300			var parentPosition = dropdownMenu.parent().offset().left;
3301			var dropDownMenuWidth = parentPosition + dropdownMenu.outerWidth();
3302			if (dropDownMenuWidth > windowWidth) {
3303				dropdownMenu.addClass(
3304					dropDownMenuWidth - dropdownMenu.outerWidth() < 0
3305						? 'dropdown__menu--center'
3306						: 'dropdown__menu--right'
3307				);
3308			} else {
3309				dropdownMenu.addClass('dropdown__menu--left');
3310			}
3311		});
3312	},
3313	doHamburgerMenu: function () {
3314		var that = this;
3315
3316		var positionElement = $('[data-menu-position]');
3317
3318		$(window).on('resize', function (e) {
3319			Menu.setHamburgerMenuPosition(positionElement);
3320			Menu.setOffcanvasMaxHeight(positionElement);
3321
3322		});
3323
3324		$(document).on('click', '[data-toggle="offcanvas"]', function () {
3325			that.setHamburgerMenuPosition(positionElement);
3326			var HamburgerTriggers = $('[data-toggle="offcanvas"]');
3327
3328			//active class op body wanneer menu openstaat.
3329			//$('body').toggleClass('active');
3330
3331			if (that.overlayActive === false) {
3332				that.overlayActive = true;
3333				HamburgerTriggers.not('[class*="-overlay"]')
3334					.attr('aria-expanded', 'true')
3335					.addClass('is-active');
3336
3337				$('.header__nav')
3338					.addClass('is-active')
3339					.attr('tabindex', -1)
3340					.focus();
3341
3342				$('html').addClass('no-scroll');
3343				disableTabModalShown($('.header__nav'));
3344				Scroller.checkHorizontalScroll();
3345				that.setOffcanvasMaxHeight(positionElement);
3346			} else {
3347				that.overlayActive = false;
3348				HamburgerTriggers.not('[class*="-overlay"]')
3349					.attr('aria-expanded', 'false')
3350					.removeClass('is-active');
3351
3352				$('.header__nav')
3353					.removeClass('is-active')
3354					.delay(800)
3355					.queue(function () {
3356						$(this).removeAttr('tabindex').dequeue();
3357						HamburgerTriggers.css('pointer-events', '');
3358						$('.nav__container-wrapper').removeAttr('style');
3359					});
3360
3361				$('html').removeClass('no-scroll');
3362				$(document).off('keydown');
3363			}
3364		});
3365	},
3366	setHamburgerMenuPosition: function (positionElement) {
3367		if (positionElement.length > 0) {
3368			var pos = positionElement.attr('data-menu-position');
3369			if (pos === 'under') {
3370				var root = document.documentElement;
3371				if  (!$('.is_stuck').length > 0) {
3372					var positionTop =
3373						positionElement.offset().top -
3374						window.scrollY +
3375						positionElement.outerHeight(true) - 60;
3376				}  else {
3377					var positionTop = $('.is_stuck').height();
3378				}
3379				document
3380					// .getElementsByTagName('header')[0]
3381					.querySelectorAll('header.header')[0]
3382					.style.setProperty(
3383						'--overlay-top-position',
3384						positionTop + 'px'
3385					);
3386			}
3387		}
3388	},
3389	dowindowResize: function () {
3390		var that = this;
3391		if (that.currentWidth !== $(window).width()) {
3392			that.currentWidth = $(window).width();
3393			if (that.resizeTimer != null) {
3394				clearTimeout(that.resizeTimer);
3395			}
3396			that.resizeTimer = setTimeout(function () {
3397				Menu.doCheckDropdownOrHamburger();
3398				Menu.checkDropDownSubMenuPosition();
3399				// Menu.setMenuPosition();
3400			}, 20);
3401		}
3402	},
3403	checkActiveState: function () {
3404		var that = this;
3405		if ($('.navigation-main li.active').length == 0) {
3406			var nav = $('.navigation-main');
3407			$(
3408				'.breadcrumb__container-wrapper.main > ol.nav-breadcrumb > li > a'
3409			).each(function () {
3410				var el = $(this);
3411				var url = el
3412					.attr('href')
3413					.replace(
3414						window.location.protocol +
3415							'//' +
3416							window.location.hostname,
3417						''
3418					)
3419					.toLowerCase();
3420
3421				var m = nav.find('a[href="' + url + '"]');
3422				// console.log(url,m);
3423				if (m.length > 0) {
3424					m.parent().addClass('active');
3425				}
3426			});
3427			var m = that.navContainer.find(
3428				'a[href="' + window.location.pathname.toLowerCase() + '"]'
3429			);
3430			if (m.length > 0) {
3431				m.parent().addClass('active');
3432				m.attr('aria-current', 'page');
3433			}
3434		}
3435	},
3436	setOffcanvasMaxHeight: function (positionElement) {
3437		if (positionElement.length > 0) {
3438			var pos = positionElement.attr('data-menu-position');
3439			if (pos === 'under') {
3440				var ncw = $('.nav__container-wrapper');
3441				if (ncw.length > 0) {
3442					var navWrapperTop =
3443						$(window).height() -
3444						Math.round(ncw.offset().top) +
3445						window.scrollY;
3446					$('.nav__container-wrapper').css({
3447						maxHeight: navWrapperTop,
3448					});
3449				}
3450			}
3451		}
3452	}
3453};
3454
3455
3456$(document).ready(function () {
3457    Menu.init();
3458});
3459
3460//-- needed html for suggestionsearch ==>  <ul id="suggestionsearch" class="list" style="display:none"></ul>
3461var searchCounter = 0;
3462var searchKeyPressTimer = null;
3463function suggestionsearch(c) {
3464    var keyword = $('#txtkeyword').val();
3465    var searchtype = '';
3466    var allwords = keyword.split(' ');
3467    var lastsearchterm = allwords[allwords.length - 1];
3468    if (keyword.length > 2 && lastsearchterm.length > 2) {
3469        var lang = $('html').attr('lang').split('-')[0];
3470        if (lang === 'nl') { lang = ''; } else {
3471            lang = '/' + lang;
3472        }
3473        $("#txtkeyword").addClass("is-loading");
3474        $('#suggestionsearch').hide().addClass('invisibility');
3475        $('#search').removeClass('selected').parents('.header__search').removeClass('focus-within');
3476        keyword = encodeURI(keyword);
3477        var dataPost = { q: keyword };
3478        $.ajax({
3479            async: true,
3480            data: dataPost,
3481            url: lang + '/zoeken/suggestie'
3482        }).done(function (partialView) {
3483            var scrollSearchselected = $('[data-scrolltop-suggestionsearch="True"]').length > 0;
3484            if (scrollSearchselected) {
3485                var searchTopPosition = $('[data-scrolltop-suggestionsearch="True"]').offset().top - 30;
3486            }
3487            if (c === searchCounter) {
3488                $("#suggestionsearch").html(partialView);
3489                // if (isOverlay) {
3490                if (partialView !== '') {
3491                    if ($("#txtkeyword").is(":focus")) {
3492                        $("#suggestionsearch").show().removeClass('hide').removeClass('invisibility');
3493                    }
3494                    $('#search')
3495						.addClass('selected')
3496						.parents('.header__search')
3497						.addClass('focus-within');
3498                    if (scrollSearchselected) {
3499                        // console.log('toppos: ' + searchTopPosition);
3500                        $('html,body').scrollTop(searchTopPosition);
3501                    }
3502                } else {
3503                    $("#suggestionsearch").hide().addClass('hide').addClass('invisibility');
3504                    $('#search')
3505						.removeClass('selected')
3506						.parents('.header__search')
3507						.removeClass('focus-within');
3508                }
3509                // disableTabModalShown($('.header-search'));
3510                // }
3511
3512                $("#txtkeyword").removeClass("is-loading");
3513            }
3514        });
3515    } else {
3516        $('#suggestionsearch').hide().addClass('hide').addClass('invisibility');
3517        $('#search')
3518			.removeClass('selected')
3519			.parents('.header__search')
3520			.removeClass('focus-within');
3521        $("#txtkeyword").removeClass("is-loading");
3522    }
3523};
3524function HideSearchSuggestions(e) {
3525    if ($(e.target).closest("#search").length == 0 && !$('#suggestionsearch').hasClass('hide')) {
3526        $('#suggestionsearch').hide().addClass('hide').addClass('invisibility');
3527        $('#search')
3528            .removeClass('selected')
3529            .parents('.header__search')
3530            .removeClass('focus-within');
3531    }
3532}
3533//-- Bindings voor suggestionsearch
3534function BindSearch() {
3535    $(document).on('click', function (e) {
3536        HideSearchSuggestions(e);
3537    }).on('keyup', function (e) {
3538        if (e.which == 9) {
3539            HideSearchSuggestions(e);
3540        }
3541    });
3542
3543    $('#txtkeyword').on('keypress', function (e) {
3544        if (e.which === 13) { e.preventDefault(); $('#btnSearch').trigger('click'); }
3545    })
3546        .on('keyup',function (e) {
3547            if (e.which !== 38 && e.which !== 40 && e.which !== 13 && e.which !== 32) {
3548
3549
3550                searchCounter++;
3551                if (searchKeyPressTimer !== null) {
3552                    clearTimeout(searchKeyPressTimer);
3553                }
3554
3555                searchKeyPressTimer = setTimeout(function () { suggestionsearch(searchCounter); }, 210);
3556
3557
3558            } else if (e.which == 40) {
3559                $('.search-suggestion__list .search-suggestion__item:first a').trigger('focus');
3560            }
3561        });
3562    //}
3563    $('#txtkeyword').on('focus', function () {
3564        $('.search__group').addClass('focus');
3565        if ($('.header__nav').hasClass('is-active')) {
3566            offcanvasClose($('[data-toggle="offcanvas"]'));
3567        }
3568    }).blur(function () {
3569        $('.search__group')
3570            .removeClass('focus')
3571    });
3572
3573}
3574
3575$("#txtkeyword").on('keydown', function (e) {
3576    var keyCode = e.keyCode || e.which;
3577    if (keyCode === 9) {
3578        if (e.shiftKey) {
3579            $('#suggestionsearch').hide().addClass('hide').addClass('invisibility');
3580        }
3581    }
3582});
3583
3584$(document).on('keydown', '#suggestionsearch .search__suggestion-btn', function (e) {
3585    var keyCode = e.keyCode || e.which;
3586    if (keyCode === 9) {
3587        if (!e.shiftKey) {
3588            $('#suggestionsearch').hide().addClass('hide').addClass('invisibility');
3589            setTimeout(function () { $('#btnSearch').trigger('focus'); }, 1);
3590        }
3591    }
3592});
3593
3594//-- Unbindings voor suggestionsearch
3595function UnBindSearch() {
3596    $("#search").off();
3597    $('#txtkeyword').off();
3598    $('#suggestionsearch').hide().addClass('hide').addClass('invisibility');
3599}
3600
3601BindSearch();
3602
3603//-- Classes toevoegen bij headersearch
3604function initSearchOverlay(el) {
3605    var headerSearch = $(el),
3606        elSearchfield = $(el).find('input.txt');
3607
3608    elSearchfield.on('keyup', function () {
3609        if ($(this).val().length > 1) {
3610            if (!headerSearch.hasClass('is-active')) {
3611                $('[data-toggle="searchbtn"]').addClass('is-active')
3612                    .attr('aria-expanded', 'true').show();
3613
3614                headerSearch.addClass('is-active');
3615                disableTabModalShown(headerSearch);
3616
3617                $('html').addClass('no-scroll');
3618                $('.scroll-down').hide();
3619                isOverlay = true;
3620            }
3621        }
3622    });
3623}
3624
3625$('[data-toggle="searchbtn"]').on('click', function () {
3626    var elSearchbtn = $('[data-toggle="searchbtn"]'),
3627        headerSearch = $('.header-search');
3628    elSearchbtn.toggleClass('is-active');
3629    headerSearch.toggleClass('is-active');
3630    if (elSearchbtn.hasClass('is-active')) {
3631        elSearchbtn.attr('aria-expanded', 'true').show();
3632        disableTabModalShown(headerSearch);
3633        $('html').addClass('no-scroll');
3634        $('.scroll-down').hide();
3635        isOverlay = true;
3636    } else {
3637        $('#suggestionsearch').hide().addClass('hide').addClass('invisibility');
3638        elSearchbtn.attr('aria-expanded', 'false').blur().hide();
3639        $('html').removeClass('no-scroll');
3640        $(document).off('keydown');
3641        $('.scroll-down').removeAttr('style');
3642        $("#txtkeyword").val('').removeClass("is-loading");
3643        isOverlay = false;
3644    }
3645});
3646
3647//-- Set Placeholder text on input field / text area field
3648function initPlaceholder() {
3649    setSearchPlaceholder();
3650    // $('input[data-toggle-placeholder="1"],textarea[data-toggle-placeholder="1"]').focus(function () {
3651    //     $(this).attr('placeholder', '');
3652    // }).blur(function () {
3653    //     $(this).attr('placeholder', $(this).attr('title'));
3654    // });
3655}
3656
3657//-- Placeholder tekst veranderen naar andere tekst bij kleinere schermen
3658function setSearchPlaceholder(screenWidthMax) {
3659    if (screenWidthMax === undefined || screenWidthMax === null) {
3660        screenWidthMax = gridFloatBreakpointMax; //grid float breakpoints: 480px, 768px, 992px, 1200px
3661    }
3662    var txt = $('#txtkeyword');
3663    if ($('#searchForm').length > 0) {
3664        if ($(document).width() <= screenWidthMax) {
3665            txt.attr('placeholder', txt.attr('data-placeholder-mobile'));
3666        } else {
3667            txt.attr('placeholder', txt.attr('title'));
3668        }
3669    }
3670}
3671
3672$(document).ready(function () {
3673
3674    initPlaceholder(); //www\wwwroot\js\website\shared\search.js
3675}).on(
3676	'keydown',
3677	'#suggestionsearch > .search-suggestion__list > .search-suggestion__item a',
3678	function (e) {
3679		if (e.which === 40 || e.which === 38) {
3680			e.stopPropagation();
3681			e.preventDefault();
3682
3683			var li = $(this).parent();
3684			var items = $(
3685				'#suggestionsearch > .search-suggestion__list > .search-suggestion__item'
3686			);
3687			var index = items.index(li);
3688
3689			if (e.which === 40) {
3690				index += 1;
3691			} else if (e.which === 38) {
3692				index -= 1;
3693			}
3694
3695			if (index < 0) {
3696				$('#txtkeyword').trigger('focus');
3697			} else if (index < items.length) {
3698				$(
3699					'#suggestionsearch > .search-suggestion__list > .search-suggestion__item:eq(' +
3700						index +
3701						') a'
3702				).trigger('focus');
3703			} else {
3704				$('.search__suggestion-btn').trigger('focus');
3705				// $('.list-suggestionsearch li:eq(0) a').focus();
3706			}
3707		}
3708	}
3709);
3710
3711var Ajaxify = {
3712    ajaxContainer: null,
3713    keyTimer: null,
3714    timer: null,
3715    refreshTime: null,
3716    lang: '',
3717    init: function () {
3718        var that = this;
3719
3720        var lang = $('html').attr('lang').split('-')[0];
3721        lang = lang === 'nl' ? '' : ('/' + lang);
3722        that.lang = lang;
3723
3724        that.ajaxContainer = $('#ajax-container');
3725        if (that.ajaxContainer.length > 0) {
3726            $('[data-hide-for-ajax="1"]').addClass('hidden');
3727            $(document).ready(function () {
3728                $(this).on('change', 'input[data-do-viewmode],select[data-do-ajax="1"]', function (e) {
3729                    e.stopPropagation();
3730                    e.stopImmediatePropagation();
3731                    e.preventDefault();
3732                    var rbtn = $(this);
3733                    Cookie.set(rbtn.attr('data-do-viewmode'), 30, rbtn.val());
3734                    that.doRequest(rbtn);
3735                })
3736                    .on('change', 'input[data-do-ajax="1"]', function (e) {
3737                        e.stopPropagation();
3738                        e.stopImmediatePropagation();
3739                        e.preventDefault();
3740                        var chk = $(this);
3741
3742                        var form = chk.closest('form');
3743                        if (form.attr('id') === 'activefilterform') {
3744
3745                            $('input[type="checkbox"][name="' + chk.attr('name') + '"][value="' + chk.attr('value') + '"]').prop('checked', false);
3746                            $('input[type="hidden"][name="' + chk.attr('name') + '"],input[type="text"][name="' + chk.attr('name') + '"]').val('');
3747                        }
3748                        that.doRequest(chk);
3749
3750                    }).on('click', '[data-hide-for-ajax="1"]', function (e) {
3751                        e.preventDefault();
3752                        that.doRequest($(this));
3753                    }).on('keyup', 'input[type="text"][data-do-ajax-blur="1"]', function (e) {
3754                        if (that.keyTimer !== null) {
3755                            clearTimeout(that.keyTimer);
3756                        }
3757                        var input = $(this);
3758
3759                        if (e.keyCode !== 13) {
3760
3761                            that.keyTimer = setTimeout(function () { that.doRequest(input); }, 350);
3762                        } else {
3763                            e.preventDefault();
3764                            that.doRequest(input);
3765                        }
3766
3767                    });
3768
3769                that.checkActiveFilters();
3770            }).on('click', 'button[data-remove-filter]', function (e) {
3771                e.preventDefault();
3772                var id = $(this).attr('data-remove-filter');
3773                var item = $('#' + id);
3774                if (item.attr('type') === 'text' || item.attr('type') === 'date') {
3775                    item.val('');
3776                } else if (item[0].localName === 'select') {
3777                    item.val('');
3778                    item.find("option:selected").prop("selected", false)
3779                } else {
3780                    var isChecked = item.prop('checked');
3781                    item.prop('checked', !isChecked);
3782                }
3783           
3784                that.doRequest(item);
3785            })
3786        }
3787
3788        if ($('button[data-load-more-ajax-url]').length > 0) {
3789            $(document).on('click', 'button[data-load-more-ajax-url]', function (e) {
3790                e.preventDefault();
3791                var btn = $(this);
3792                that.loadMoreAjax(btn);
3793            });
3794        }
3795        that.checkAZVisible();
3796        that.checkRefreshTime();
3797
3798    },
3799    loadMoreAjax: function (btn) {
3800        var ajaxContainer = $('#' + btn.attr('data-target'));
3801        var url = btn.attr('data-load-more-ajax-url') + "&offset=" + ajaxContainer.find('article').length;
3802        var noOfRecords = parseInt(btn.attr('data-total-records'));
3803        $.ajax({
3804            async: true,
3805            type: 'GET',
3806            url: url
3807        }).done(function (partialview) {
3808
3809            ajaxContainer.append(partialview);
3810
3811            if (noOfRecords === ajaxContainer.find('li,article').length) {
3812                btn.addClass('hidden');
3813            }
3814        });
3815    },
3816    doRequest: function (input) {
3817
3818        var that = this;
3819        that.setLoadingScreen();
3820        var url = window.location.pathname;
3821        var form = input.closest('form');
3822
3823        if (form.length === 0) { form = $('.side-bar form') };
3824
3825        var arr = form.serializeArray();
3826
3827        var q = '';
3828
3829        for (var i = 0; i < arr.length; i++) {
3830            var p = arr[i];
3831            if (p.value !== null && p.value !== '' && !p.name.endsWith('_submit') && p.value !== 'on') {
3832                if (q !== '') { q += '&'; }
3833                q += p.name + '=' + p.value;
3834            }
3835        }
3836        if (q !== '') { url += '?' + q; }
3837        window.history.replaceState(null, null, url);
3838
3839        url += (url.indexOf('?') === -1 ? '?' : '&') + 'ajax=1';
3840
3841        $.ajax({
3842            async: true,
3843            type: 'GET',
3844            url: url
3845        }).done(function (partialview) {
3846            clearTimeout(that.timer);
3847            that.ajaxContainer.hide();
3848            that.ajaxContainer.html(partialview);
3849            that.ajaxContainer.fadeIn();
3850            that.updateAZ();
3851            that.checkActiveFilters();
3852            var datael = document.querySelector('[data-mh]');
3853            if (datael !== null) {
3854                // $('.list > li').matchHeight();
3855                $(datael).matchHeight({ remove: true });
3856                $.fn.matchHeight._maintainScroll = true;
3857                $.fn.matchHeight._applyDataApi();
3858                //console.log("ajaxify update");
3859            }
3860
3861            if (typeof Website !== "undefined" && typeof Website.Streetmap !== "undefined" && $('.streetmap').length > 0) {
3862                if (!$('.streetmap').hasClass('leaflet-container')) {
3863                    Website.Streetmap.reset();
3864                }
3865
3866                if (Website.Streetmap.map !== null) {
3867
3868                    Website.Streetmap.addMarkersFromList(Website.Streetmap.map[0]);
3869                }
3870            }
3871            stickify('.alertbox-filter', 0, '.page-container', gridFloatBreakpoint);
3872            footerFixedBottom();
3873        }).fail(function () {
3874            that.ajaxContainer.html('<class="alertbox-error">error</div>');
3875        });
3876
3877        that.reloadFacet(form, arr, input);
3878
3879    },
3880    reloadFacet: function (form, arr, input) {
3881        var that = this;
3882        //  update facet navigation 
3883        var facets = $('.facet-navigation:not([data-facet="' + input.attr('data-facet') + '"]');
3884        if (facets.length > 0) {
3885
3886            var q = '';
3887            for (var i = 0; i < arr.length; i++) {
3888                var p = arr[i];
3889                if (p.value !== null && p.value !== '' && !p.name.endsWith('_submit') && p.value !== 'on') {
3890                    q += '&' + p.name + '=' + p.value;
3891                }
3892            }
3893
3894
3895            facets.each(function () {
3896                var fieldset = $(this);
3897
3898                var facetkey = fieldset.attr('data-facet');
3899
3900                $.ajax({
3901                    async: true,
3902                    type: 'GET',
3903                    url: fieldset.attr('data-facet-ajax-url') + '?fieldname=' + facetkey + q
3904                }).done(function (json) {
3905                    for (var i = 0; i < json.length; i++) {
3906                        var item = json[i];
3907                        var hasItems = item.noOfItems > 0;
3908                        var chk = $('.facet-search-item[data-facet="' + facetkey + '"][value="' + item.value + '"]');
3909                        chk.prop('disabled', !hasItems);
3910                        var li = chk.parent();
3911                        if (hasItems) {
3912                            li.removeClass('is-readonly');
3913                        } else {
3914                            li.addClass('is-readonly');
3915                        }
3916                        li.find(' span .search-count').html(item.noOfItems);
3917                    }
3918                });
3919
3920            });
3921
3922        }
3923    },
3924    setLoadingScreen: function () {
3925        var that = this;
3926        that.ajaxContainer.html('<span class="loading">...</span>');
3927        //that.timer = setTimeout(function () { that.ajaxContainer.html('<span class="loading">...</span>') }, 500);
3928    },
3929    updateAZ: function () {
3930        var that = this;
3931        var az = $('.nav-az');
3932        if (az.length > 0) {
3933
3934            var li = [];
3935            $('.alphabet-item .keywords').each(function () {
3936                var l = this.id;
3937                li.push('<li><a rel="nofollow" href="#' + l + '" data-scrollto="az">' + l.substring(2) + '</a></li>');
3938            });
3939            az.html(li.join(''));
3940        } else {
3941
3942        }
3943
3944        that.checkAZVisible();
3945    },
3946    checkAZVisible: function () {
3947        if ($('.alphabet__item').length > 0) {
3948            $('#az-filter').removeClass('hidden');
3949        } else {
3950            $('#az-filter').addClass('hidden');
3951        }
3952    },
3953    checkRefreshTime: function () {
3954        var that = this;
3955        var div = $('[data-refreshtime]');
3956        if (div.length == 0)
3957            return;
3958
3959        that.refreshTime = null;
3960        div.each(function () {
3961            var el = $(this);
3962            var rf = el.data('refreshtime');
3963
3964            if (that.refreshTime == null || that.refreshTime == 0 || rf < that.refreshTime) {
3965                that.refreshTime = rf;
3966            }
3967        });
3968        that.refreshContactStatusNeeded();
3969    },
3970    refreshContactStatus: function () {
3971        var that = this;
3972        var div = $('[data-refresh-open-status]');
3973
3974        if (div.length == 0)
3975            return;
3976
3977        that.refreshTime = 0;
3978        var noOfChecks = div.length;
3979        var updateDone = 0;
3980
3981        div.each(function () {
3982            var div = $(this);
3983            var statusSpan = div.find('span[data-hourid]');
3984            var hourID = statusSpan.attr('data-hourid');
3985            if (typeof (hourID) != 'undefined') {
3986                $.ajax({
3987                    async: true,
3988                    type: 'GET',
3989                    data: { hourID: hourID },
3990                    url: that.lang + '/contact/status'
3991                }).done(function (json) {
3992
3993                    statusSpan.attr('class', 'contact__hours-status-box ' + json.cssclass).html('<span>' + json.statusText + '</span>');
3994
3995                    div.find('.txt-hours').html(json.hoursToday);
3996                    $('[data-tomorrow-hourid="' + hourID + '"] .txt-hours').html(json.hoursTomorrow);
3997
3998                    if (that.refreshTime == 0 || json.nextRefresh < that.refreshTime) {
3999                        that.refreshTime = json.nextRefresh;
4000                    }
4001                    updateDone++;
4002                    if (noOfChecks == updateDone) {
4003                        that.refreshContactStatusNeeded();
4004                    }
4005                });
4006            }
4007        });
4008    },
4009    refreshContactStatusNeeded: function () {
4010        var that = this;
4011        if (that.refreshTime > 0) {
4012            setTimeout(function () { that.refreshContactStatus(); }, that.refreshTime);
4013        }
4014    },
4015    checkActiveFilters: function () {
4016        var templateTag = $('#header-filter-template');
4017        if (templateTag.length > 0) {
4018
4019            var items = $('input[data-do-ajax="1"]:checked:not([name="SorteerType"],[name="sort"],input[name="viewmode"]),input[type="text"],input[type="date"],select[data-do-ajax="1"] option:selected');
4020          
4021            var div = $('.header-filters');
4022            var ul = div.find('.list-filter');
4023            var hasItems = false;
4024            if (items !== undefined && items.length > 0) {
4025                div.removeClass('hidden');
4026                var html = '';
4027                var noOfFilters = 0;
4028                var template = templateTag.html();
4029            
4030                items.each(function () {
4031                    var i = $(this);                  
4032                    var title = '';
4033                    var id = '';
4034                    if (i.parent().hasClass('ddl-group')) {
4035
4036                        id = i.parent().attr('id');
4037                        if (i.parent().val() !== '') {
4038
4039                        title = i.text();
4040                        }
4041                    }
4042                    else if ( i.val() !== '') {
4043                         id = i.attr('id');
4044                         title = $('label[for="' + i.attr('id') + '"]').text();
4045                        if (i.attr('type') === 'date') {
4046                            var date = Date.parse(i.val());
4047                            title = Intl.DateTimeFormat().format(date);
4048                        } else if (i.attr('type') === 'text') {
4049                             title = i.val().replace(/(<([^>]+)>)/ig, "");
4050                        }                       
4051                    }
4052
4053
4054                    if (title !== '') {
4055
4056                        html += template.replace('{id}', id).replace("{title}", title);
4057                        hasItems = true;
4058                        noOfFilters++;
4059                    }
4060                });
4061                if (noOfFilters > 1) {
4062                    html += $('#header-filter-template-delete-all').html();
4063                }
4064
4065                ul.html(html);
4066            }
4067
4068            if (!hasItems) {
4069                div.addClass('hidden');
4070                ul.html('');
4071            }
4072        }
4073    }
4074};
4075
4076Ajaxify.init();
4077
4078
4079//-- Stickify functionality toevoeging met combinatie van de plugin js\sticky-kit
4080function stickify(el, posSpacing, parent, screenWidth, elPosition) {
4081	var container = $(el);
4082
4083	if (posSpacing === undefined || posSpacing === null) {
4084		posSpacing = 0;
4085	}
4086
4087	if (parent === undefined || parent === null) {
4088		parent = container.parent();
4089	}
4090
4091	if (screenWidth === undefined || screenWidth === null) {
4092		screenWidth = gridFloatBreakpoint; //grid float breakpoints: 480px, 768px, 992px, 1200px
4093	}
4094
4095	if (elPosition === undefined || elPosition === null) {
4096		elPosition = 'top';
4097	}
4098
4099	checkStickyposition(elPosition);
4100
4101	$(window).on('resize',function () {
4102		checkStickyposition(elPosition);
4103	});
4104
4105	function checkStickyposition(el) {
4106		if (el === 'top') {
4107			if ($(document).width() >= screenWidth) {
4108				if (!container.siblings('.box-filter').length) {
4109					container
4110						.stick_in_parent({
4111							offset_top: posSpacing,
4112							parent: parent,
4113							recalc_every: 1
4114						})
4115						.on('sticky_kit:stick', function(e) {
4116							if ($('.box-anchor-links').length > 0) {
4117								var el = container.find('.box__block'),
4118									scroll = $(window).scrollTop();
4119								el.css({
4120									maxHeight:
4121										$(window).height() -
4122										($(el).offset().top - scroll) -
4123										posSpacing,
4124									overflowY: 'auto' //eventueel in commentaar als je styled @pieter
4125								});
4126							}
4127						});
4128						// .on('sticky_kit:bottom ', function(e) {
4129						// 	console.log('bottom!', e.target);
4130						// });
4131				}
4132			} else {
4133				container.trigger("sticky_kit:detach");
4134			}
4135		} else {
4136			// container.on("sticky_kit:unstick ", function() {
4137			// }
4138		}
4139	};
4140}
4141
4142
4143/****************
4144* sticky header *
4145****************/
4146function stickyheader() {
4147	var elHeader = $('.header'),
4148		headerStickspacer = $('<div/>') // creates a div element
4149				.attr('id', 'header-stick-spacer') // adds the id
4150				.addClass('header-stick-spacer'); // add a class
4151	checkHeaderposition();
4152	$(window).on('resize scroll', checkHeaderposition);
4153
4154	function checkHeaderposition() {
4155		if ($('.widget-vlw-placeholder').length > 0 || $('.vlw').length > 0) {
4156			var stickyOffset = 43;
4157		} else {
4158			var stickyOffset = 0;
4159		}
4160		
4161		var headerOffset = Math.round(elHeader.offset().top - stickyOffset),
4162			headerCheck = elHeader.innerHeight(),
4163			scrollPos = Math.round($(window).scrollTop());
4164		
4165
4166		// console.log(scrollPos, headerCheck, headerTop);
4167		// console.log(headerTop, scrollPos);
4168
4169		if (scrollPos > 0 && scrollPos >= headerOffset) {
4170			elHeader
4171				.css({
4172					position: 'fixed',
4173					top: stickyOffset,
4174					left: 0,
4175					width: '100%',
4176				})
4177				.addClass('is_stuck');
4178			$('.search-top').addClass('in-header');
4179			if (!$('#header-stick-spacer').length > 0) {
4180				headerStickspacer.insertAfter(elHeader).css({
4181					height: headerCheck,
4182				});
4183			} else {
4184				$('#header-stick-spacer').css({
4185					height: headerCheck,
4186				});
4187			}
4188		} else {
4189			unstickHeader();
4190		}
4191
4192		if ($('#header-stick-spacer').length > 0) {
4193			var headerStickyspacer = $('#header-stick-spacer').offset().top;
4194			if (scrollPos <= headerStickyspacer) {
4195				unstickHeader();
4196			}
4197			// console.log('is sticky: ' + headerStickyspacer, scrollPos);
4198		}
4199	}
4200
4201	function unstickHeader() {
4202		elHeader.removeAttr('style').removeClass('is_stuck');
4203		$('#header-stick-spacer').remove();
4204		$('.search-top').removeClass('in-header');
4205	}
4206}
4207
4208var icordis = icordis || {};
4209icordis.Tabs = {
4210    init: function () {
4211        var that = this;
4212
4213        $('#tablist a').on('click',function (e) {
4214            e.preventDefault();
4215            var el = $(this);
4216            var id = el.attr('id');
4217            var tabPosition = id.indexOf('algemeen') == -1 ? '?tab=' + id : '';
4218            if (window.location.href.toLowerCase().indexOf('/aanpassen') == -1) {
4219                window.history.replaceState(null, null, window.location.pathname + tabPosition);
4220            }
4221            $('#tablist a').attr('aria-selected', 'false').attr('tabindex', -1).parent().removeClass('active');
4222            el.attr('aria-selected', 'true').attr('tabindex', 0).parent().addClass('active');
4223            
4224            $('.tab-item').addClass('hidden');
4225            $('#' + el.attr('aria-controls')).removeClass('hidden');
4226
4227            $('#current-active-tab').val(id);
4228            
4229            if (el.html().toLowerCase().indexOf('stratenplan') > -1 && typeof (Icordis.StreetmapControl) !== "undefined" && Icordis.StreetmapControl.map !== null) {
4230                Icordis.StreetmapControl.updateMap();
4231            }
4232        });
4233        
4234        if (window.location.hash.indexOf('tabs-')>-1) {
4235            $('a[href="' + window.location.hash + '"]').trigger('click');
4236        } else if (window.location.search.indexOf('tab') > -1) {
4237            var searchParams = new URLSearchParams(window.location.search);
4238            console.log($('a[href="' + searchParams.get('tab') + '"]'));
4239            $('#' + searchParams.get('tab')).click();
4240        }
4241    }
4242
4243
4244}
4245icordis.Tabs.init();
4246
4247
4248//-- Tab toegankelijkheid voor de share mogelijkheid 
4249function boxShareAccessible(el) {
4250	var elBtn = $(el),
4251		isClicked = false;
4252
4253		
4254	elBtn.on('click',function () {
4255		var $this = $(this);
4256		expandSharebox($this);
4257	});
4258
4259	function expandSharebox(el) {
4260		el.parent().toggleClass('is-active');
4261		if (!isClicked) {
4262			el.attr('aria-expanded', 'true')
4263				.next().removeClass('invisibility').find('.list-share > li:last() > a')
4264				.blur(function () {
4265					el.attr('aria-expanded', 'false')
4266						.parent().removeClass('is-active');
4267					isClicked = false;
4268				});
4269			isClicked = true;
4270		} else {
4271			el.attr('aria-expanded', 'false');
4272			isClicked = false;
4273		}
4274	}
4275} 
4276$(document).ready(function () {
4277	//-- maak box share toegankelijk
4278	boxShareAccessible('[data-toggle="socialsharebtn"]');
4279});
4280
4281//jQuery.fn.center = function () {
4282//    this.css("position", "absolute");
4283//    this.css("top", ($(window).height() - this.outerHeight()) / 2 + "px");
4284//    this.css("left", ($(window).width() - this.outerWidth()) / 2 + "px");
4285//    return this;
4286//};
4287
4288//// if ($('.popup-container').length > 0) {
4289//if ($('[data-popup=1]').length > 0) {
4290//    // disableTabModalShown($('.popup-container'));
4291//    disableTabModalShown($('.alertbanner'));
4292//    $('html').addClass('no-scroll');
4293//    $('#outer-wrap').attr('aria-hidden', 'true');
4294//    isOverlay = true;
4295//}
4296
4297// $('.popup-overlay, .popup-close,.popup-content a').on('click',function (e) {
4298$('[data-alertbanner=close], [data-alertbanner=close] a').on('click', function (e) {
4299	var el = $(this);
4300	// var container = $('.popup-container,.sticky-container');
4301	var container = $('.alertbanner');
4302	container.hide();
4303	var cookievalue = Cookie.get('Hidepopup');
4304	var id =
4305		(typeof cookievalue !== 'undefined' && cookievalue !== ''
4306			? cookievalue + ';'
4307			: '') + container.attr('data-id');
4308
4309	Cookie.set('Hidepopup', container.attr('data-snooze'), id);
4310//	$('html').removeClass('no-scroll');
4311//	$('#outer-wrap').removeAttr('aria-hidden');
4312//	$(document).off('keydown');
4313	// $('#inner-wrap').attr('tabindex', -1).focus();
4314//	$('body').children(':first-child').attr('tabindex', -1).trigger('focus');
4315//	isOverlay = false;
4316});
4317
4318/*****************
4319 * Magnific-Popup *
4320 *****************/
4321//readme: dimsemenov.com/plugins/magnific-popup/documentation.html
4322
4323//Magnific-Popup
4324
4325$('a[data-popup="imagelist"]').magnificPopup({
4326	type: 'image',
4327	gallery: {
4328		enabled: true,
4329}, image: {
4330// 	// options for image content type
4331titleSrc: function (item) {
4332	var title = item.el.next().find('.photo__title');
4333	var copyright = item.el.next().find('.copyright__name');
4334
4335	if (title.length==0 ) {
4336		title = item.el.find('span.title');
4337	}
4338
4339	var info='';
4340	if (title.length > 0) {
4341		info = '<span>' + title.text() + '</span>' ;
4342	}
4343	if (copyright.length > 0) {
4344		info +=  '<span>&copy; ' + copyright.text() + '</span>';
4345	}
4346
4347
4348
4349	return info;
4350}
4351}
4352});
4353
4354$(document).on('click','[data-popup="showall"]',function(e){
4355	e.preventDefault();
4356	$('a[data-popup="imagelist"]').magnificPopup('open');
4357});
4358
4359$('[data-popup="oneimage"]').magnificPopup({
4360    type: 'image',
4361    // disableOn: function () {
4362    //     var mobile = $('[data-popup="oneimage"] ~ .photo__info.find(.photo__showall').is(':visible');
4363    //     return !mobile;
4364    // },
4365    image: {
4366        // 	// options for image content type
4367        titleSrc: function (item) {
4368            var title = item.el.next().find('.photo__title');
4369            var copyright = item.el.next().find('.copyright__name');
4370
4371            if (title.length == 0) {
4372                title = item.el.find('span.title');
4373            }
4374            var info='';
4375            if (title.length > 0) {
4376                info = '<span>' + title.text() + '</span>' ;
4377            }
4378            if (copyright.length > 0) {
4379                info +=  '<span>&copy; ' + copyright.text() + '</span>';
4380            }
4381            return info;
4382        }
4383    }
4384    // other options
4385});
4386
4387$('[data-popup*="shadowbox"]').magnificPopup({
4388    type: 'iframe',
4389    iframe: {
4390        markup:
4391            '<div class="mfp-iframe-scaler">' +
4392            '<div class="mfp-close"></div>' +
4393            '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
4394            '</div>', // HTML markup of popup, `mfp-close` will be replaced by the close button
4395
4396        patterns: null,
4397        srcAction: 'iframe_src', // Templating object key. First part defines CSS selector, second attribute. "iframe_src" means: find "iframe" and set attribute "src".
4398    },
4399});
4400
4401var lang = $('html').attr('lang').split('-')[0];
4402if (lang === 'nl') {
4403    $.extend(true, $.magnificPopup.defaults, {
4404        tClose: 'Sluiten (Esc)', // Alt text on close button
4405        tLoading: 'Laden...', // Text that is displayed during loading. Can contain %curr% and %total% keys
4406        gallery: {
4407            tPrev: 'Vorige (Pijl toets links)', // Alt text on left arrow
4408            tNext: 'Next (Pijl toets rechts)', // Alt text on right arrow
4409            tCounter: '%curr% van %total%', // Markup for "1 of 7" counter
4410        },
4411    });
4412} else if (lang === 'fr') {
4413    $.extend(true, $.magnificPopup.defaults, {
4414        tClose: 'Fermez (Esc)', // Alt text on close button
4415        tLoading: 'Charge...', // Text that is displayed during loading. Can contain %curr% and %total% keys
4416        gallery: {
4417            tPrev: 'précédent (Touche fléchée gauche)', // Alt text on left arrow
4418            tNext: 'suivante (Touche fléchée droite)', // Alt text on right arrow
4419            tCounter: '%curr% de %total%', // Markup for "1 of 7" counter
4420        },
4421    });
4422} else if (lang === 'de') {
4423    $.extend(true, $.magnificPopup.defaults, {
4424        tClose: 'Schließen (Esc)', // Alt text on close button
4425        tLoading: 'Wird geladen...', // Text that is displayed during loading. Can contain %curr% and %total% keys
4426        gallery: {
4427            tPrev: 'Zurück (linke Pfeiltaste)', // Alt text on left arrow
4428            tNext: 'Weiter (rechte Pfeiltaste)', // Alt text on right arrow
4429            tCounter: '%curr% von %total%', // Markup for "1 of 7" counter
4430        },
4431    });
4432} else if (lang === 'en') {
4433    $.extend(true, $.magnificPopup.defaults, {
4434        tClose: 'Close (Esc)', // Alt text on close button
4435        tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys
4436        gallery: {
4437            tPrev: 'Previous (Left arrow key)', // Alt text on left arrow
4438            tNext: 'Next (Right arrow key)', // Alt text on right arrow
4439            tCounter: '%curr% of %total%', // Markup for "1 of 7" counter
4440        },
4441    });
4442}
4443
4444$(document).on('mouseover', '[data-popover]', function () {
4445    $(this).addClass('active');
4446})
4447    .on('mouseleave', '[data-popover]', function () {
4448        $(this).removeClass('active');
4449    }).on('click', '[data-popover]', function () {
4450      $(this).toggleClass('active');
4451    });
4452
4453
4454var SpeechRecognition = {
4455    recognition: null,
4456    init: function () {
4457        var that = this;
4458        var hasSpeechRecognition = false;
4459        if (window.hasOwnProperty('webkitSpeechRecognition')) {
4460            that.recognition = new webkitSpeechRecognition();
4461            hasSpeechRecognition = true;
4462
4463        }
4464        //else if (window.hasOwnProperty('SpeechRecognition')) {
4465        //    that.recognition = new speechRecognition();
4466        //    hasSpeechRecognition = true;
4467        //}
4468
4469
4470        if (hasSpeechRecognition) {
4471
4472            $('#btn-speech-recognition').removeClass('hidden');
4473            $(document).on('click', '#btn-speech-recognition', function () {
4474                var btn = $(this);
4475                that.listen(btn);
4476            });
4477        }
4478    },
4479    listen: function (btn) {
4480        var that = this;
4481        var txt = $('#txtkeyword');
4482        $('#speech-error-msg').addClass('hidden');
4483        $('#searchForm').removeClass('speech-error');
4484        txt.attr('placeholder', txt.attr('data-speak-text'));
4485        txt.val('');
4486        btn.prop('disabled', true);
4487    
4488
4489        that.recognition.continuous = false;
4490       that.recognition.interimResults = false;
4491        var lang = document.getElementsByTagName("html")[0].getAttribute("lang");
4492        that.recognition.lang = lang == 'nl' ? 'nl-BE' : lang == 'fr' ? 'fr-BE' : 'en-US';
4493        that.recognition.start();
4494        that.recognition.onstart  = function () {
4495            $('#searchForm').addClass('listening');
4496
4497        }
4498        that.recognition.onspeechstart = function () {
4499    
4500            var text = txt.attr('data-listening-text');
4501            txt.attr('placeholder', text);
4502        }
4503        that.recognition.onresult = function (e) {
4504           
4505            if (typeof (e.results) == 'undefined') {           
4506                that.clearSearch(btn,txt);
4507                return;
4508            }
4509
4510           var transcript = e.results[0][0].transcript.replace(/\./g, '')
4511
4512
4513            txt.val(transcript);
4514            that.clearSearch(btn,txt);
4515            $("#txtkeyword").trigger('focus');
4516            searchCounter = 0;
4517            suggestionsearch(0);
4518
4519
4520        };
4521
4522        that.recognition.onerror = function (e) {
4523            console.log(e);
4524            $('#searchForm').addClass('speech-error');
4525            $('#speech-error-msg').removeClass('hidden');
4526            that.recognition.stop();
4527            that.clearSearch(btn, txt);
4528        
4529         
4530        }
4531
4532    },
4533    clearSearch: function (btn,txt) {
4534        var that = this;
4535     
4536        $('#searchForm').removeClass('listening');
4537        var text = txt.attr('data-tooltip');
4538        txt.attr('placeholder', text);
4539        btn.prop('disabled', false);
4540    }
4541
4542}
4543SpeechRecognition.init();
4544//-- Variables
4545
4546var $window = $(window),
4547    gridFloatBreakpoint = 768 - getScrollbarWidth(), // grid float breakpoints: 320, 544, //--480px, 768px, 992px, 1200px
4548    gridFloatBreakpointMax = gridFloatBreakpoint - 1,
4549    isOverlay = false,
4550    stickySpacing = 0;
4551
4552//gebruikt om de scrollbar width te vinden toepasbaar om een  goeie gridfloatbreakpoint berekening in javascript zie startup
4553
4554function getScrollbarWidth() {
4555    return window.innerWidth - document.documentElement.clientWidth;
4556}
4557
4558$(document)
4559    .ready(function () {
4560
4561
4562
4563
4564        //get focus class when inside searchfield
4565        // $('#txtkeyword')
4566        //     .focus(function () {
4567        //         $('.search__group').addClass('focus')
4568        //     })
4569        //     .blur(function () {
4570        //         $('.search__group')
4571		// 			.removeClass('focus')
4572        //     });
4573
4574
4575        // grid check van iconen op home op bais van de helper functie checkRow() in js\website\helpers\frontend.js
4576        /*
4577        if ($('.spotlight').find('.list.icons-big').length > 0) {
4578            checkRow('.list.icons-big', 'li');
4579        }
4580        if ($('.spotlight').find('.list.icons-small').length > 0) {
4581            checkRow('.list.icons-small', 'li');
4582        }
4583        */
4584
4585
4586
4587    })
4588    .on('mouseover', '[data-tooltip]', function () {
4589        var btn = $(this);
4590        btn.attr('title', btn.attr('data-tooltip'));
4591    })
4592    .on('mouseleave', '[data-tooltip]', function () {
4593        var btn = $(this);
4594        btn.removeAttr('title');
4595    })
4596    .on('click', 'button[data-toggle-items="1"]', function (e) {
4597        e.preventDefault();
4598        var el = $(this);
4599        if (el.hasClass('active')) {
4600            el.attr('aria-expanded', 'false');
4601            el.parent().removeClass('active');
4602            $('#' + el.attr('data-id') + ' li.tohide').addClass('hidden');
4603            el.removeClass('active').find('span').html(el.attr('data-show'));
4604        } else {
4605            el.parent().addClass('active');
4606            $('#' + el.attr('data-id') + ' li.tohide').removeClass('hidden');
4607            el.addClass('active').find('span').html(el.attr('data-hide'));
4608            el.attr('aria-expanded', 'true');
4609        }
4610    })
4611    .on('click', '[data-toggle-panel]', function (e) {
4612        e.preventDefault();
4613        var btn = $(this);
4614        btn.toggleClass('active');
4615        var open = btn.hasClass('active');
4616        btn.attr('aria-expanded', open ? 'true' : 'false');
4617        var txt = btn.attr('data-toggle-panel' + (open ? 'hide' : 'show'));
4618        btn.attr('data-tooltip', txt);
4619        var panel = $('#' + btn.attr('data-toggle-panel'));
4620        panel.toggleClass('hidden');
4621        panel.closest('fieldset').toggleClass('open');
4622
4623    })
4624    .on('click', '#btn-toggle-contrast', function (e) {
4625        var el = $(this);
4626
4627        var css = $('#skin-stylesheet');
4628        if (el.hasClass('is-active')) {
4629            Cookie.remove(css.attr('data-css'));
4630        } else {
4631            Cookie.set(css.attr('data-css'), 1000, '1');
4632        }
4633        window.location.reload();
4634    })
4635    .on('click', '[data-toggle-accordion]', function (e) {
4636        var btn = $(this);
4637        var accordion = $('#' + btn.attr('aria-controls'));
4638        var expanded = btn.attr('aria-expanded') === 'true';
4639
4640        accordion.toggleClass('hidden');
4641        btn.attr('aria-expanded', expanded ? 'false' : 'true');
4642        if (btn.attr('data-icon-active') !== undefined) {
4643            if (expanded) {
4644
4645                btn.find('use').attr('href', btn.attr('data-icon-inactive'));
4646            } else {
4647                btn.find('use').attr('href', btn.attr('data-icon-active'));
4648            }
4649        }
4650        if (btn.attr('data-toggle-hide') !== undefined) {
4651            var txt = btn.attr('data-toggle-' + (expanded ? 'hide' : 'show'));
4652            btn.find('span').html(txt);
4653            btn.attr('data-tooltip', txt);
4654        }
4655    })
4656    .on('change', '.checkboxlist-item input[data-parentid]', function () {
4657        var chk = $(this);
4658        var id = chk.val();
4659        var checked = chk.is(':checked');
4660        var parentid = chk.attr('data-parentid');
4661        if (parentid == 0) {
4662            $('.checkboxlist-item input[data-parentid="' + id + '"]').prop(
4663                'checked',
4664                checked
4665            );
4666        } else if (checked == false) {
4667            $('.checkboxlist-item input[value="' + parentid + '"]').prop(
4668                'checked',
4669                false
4670            );
4671        }
4672    })
4673    .on('click', 'button.btn-chklist-toggle', function (e) {
4674        var btn = $(this);
4675        btn.toggleClass('active');
4676        var open = btn.hasClass('active');
4677        btn.attr('aria-expanded', open ? 'true' : 'false');
4678        var txt = btn.attr('data-toggle-' + (open ? 'hide' : 'show'));
4679        btn.find('span').html(txt);
4680        btn.attr('data-tooltip', txt);
4681        var control = btn.attr('aria-controls');
4682        var panel = $('#' + control);
4683        panel.toggleClass('hidden');
4684        panel.attr('aria-hidden', open ? 'false' : 'true');
4685    }).on('click', 'button[data-readmore]', function (e) {
4686        var btn = $(this);
4687        btn.toggleClass('active');
4688        var active = btn.hasClass('active');
4689        btn.find('span').html(btn.attr('data-' + (active ? 'close' :'open' )));
4690        $('#' + btn.attr('data-readmore')).attr('data-read-more', active ? 'false' : 'true');
4691    });
4692
4693$(window).on('resize', function (e) {
4694
4695    setSearchPlaceholder();
4696
4697
4698});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.