amissolutions.markzero.nl Open in urlscan Pro
185.105.205.71  Public Scan

URL: https://amissolutions.markzero.nl/
Submission: On April 12 via manual from NL — Scanned from NL

Form analysis 0 forms found in the DOM

Text Content

      _scoopi = {
        'preventFOUC': false,
        'onload': function() {
          this.ready(this.trkDocumentLoad);
        }
      };


;(function(w,d,n,scr,config) {

    var $ = window._scoopi = window._scoopi || {};

    if ($.init) return void console.error('SF: client object already exists!');

    
    Object.defineProperty(window, '_scoopi', {
      get: function() {
        return $;
      },
      set: function(val) {
        console.error('SF: overwriting the client object is not allowed!');
      }
    });


    
    $.init = function() {

      $.v = 3;
      $.startTime = new Date();

      if (['', 'webcache.googleusercontent.com'].indexOf(window.location.hostname) !== -1) return;
      if (/(crwebiossecurity|chromecheckurl|about:blank)/i.test(window.location.href)) return;

      $.secure = document.location.protocol === "https:";
      

      var sfenv = $.getCookie('sfenv');
      $.crmhost = ['crm-dev', 'crm-test', 'crmv2'].indexOf(sfenv) > -1 ? sfenv + '.salesfeed.com' : 'crmv2.salesfeed.com';

      $.setupPolyfills();



      Object.assign($, config);

      $.cookiedomain = $.detectCookiedomain();
      if (!$.cookiedomain) return;
      //if (!$.cookiesEnabled()) return;




      $.rp = [];
      $.bu = [];
      $.dl = [];


      $.getSid();
      $.iid = $.guid();

      $.getUserId();
      $.getUserAliases();


      if ($.preventFOUC) $.setupFOUCprevent();


      $.addEventListener(window, 'message', $.messageHandler);


      if (window.name.match(/^sfw\./)) {

        window.opener && window.opener.postMessage && $.ready(function() {
          try {
            window.opener.postMessage({v: 1, f: 'sf.ready', n: window.name, aid: $.aid}, 'https://' + $.crmhost);
            console.log('sf.ready sent');
          } catch(e) {}
        });

      } else {

        $.setupBeforeUnload();
        $.setupAdvHooks();
        //$.setupWindowLocationHooks();

        $.beam.init();

        if ('function' === typeof $.onload) {
          try {
            $.onload.call($, $);
          } catch (ex) {
            if (console) console.log('SF: error in onload handler', ex);
          }
        }

        if ($.csc && 'function' === typeof $.csc) $.csc.call($, $);


      }
    };


    $.trycatch = function(f, ctx) {
      return function() {
        try {
          return f.apply(ctx || this, arguments);
        } catch(e) {
          if ($.debug) console.log(e);
        }
      }
    };

    $.once = function(f, ctx) {
      var result;
      return function() {
        if (f) {
          try {
            result = f.apply(ctx || this, arguments);
          } catch(e) {
            if ($.debug) console.log(e);
          }
          f = null;
        }
        return result;
      }
    }


    $.dispatchEvent = function(scope, name, data, bubbles, cancelable) {
      var evt = document.createEvent('Event');
      evt.initEvent(name, bubbles || false, cancelable || false);
      if (data) Object.assign(evt, data);
      scope.dispatchEvent(evt);
    }


    $.parseURL = function(href) {
      var parser = document.createElement('a');
      parser.href = href;
      var s = parser.search.replace(/^\?/, '');
      var pairs = s.match(/[^&]+/g) || [];
      for (var querypairs = {}, i = 0; i < pairs.length; i++) {
        var pair = pairs[i].split('=');
        querypairs[pair[0]] = pair[1];
      }
      return {'href': href, 'protocol': parser.protocol, 'hostname': parser.hostname, 'port': parser.port, 'path': parser.pathname, 'query': parser.search, 'querypairs': querypairs, 'fragment': parser.hash, 'hash': parser.hash};
    };


    $.getCanonicalURL = function() {
      try {
        var t = document.getElementsByTagName('link');
        for (var i = 0; i < t.length; i++) {
          if (t[i].getAttribute('rel') === 'canonical' && t[i].hasAttribute('href')) {
            return t[i].href;
          }
        }
      } catch(e) {}


      try {
        var aup = $.getActiveURLParameters();
        var u = document.createElement('a');
        u.href = window.location.href;
        var pairs = u.search.replace(/^\?/, '').split('&');
        for (var r = [], i = 0; i < pairs.length; i++) {
          var pair = pairs[i].split('=');
          if (-1 !== aup.indexOf(decodeURIComponent(pair[0]))) {
            r.push(pairs[i]);
          }
        }
        u.search = r.length ? '?' + r.join('&') : '';
        u.hash = '';
        return u.href;
      } catch(e) {}

    };


    $.storage = {};
    $.storage.localStorage = {
      set: function(key, value, ttl) {
        if (!key) throw 'set needs key';
        ttl = ttl || 2*365*24*60*60;
        var now = new Date();
        return localStorage.setItem(key, JSON.stringify({v: value, exp: (now.getTime()) + (ttl*1000)}));
      },

      get: function(key) {

        try {
          var d1 = localStorage.getItem(key);
          var d2 = JSON.parse(d1);
          if (!('exp' in d2)) return d1;

          var now = new Date();
          if (now.getTime() < d2.exp) return d2.v || null;

          localStorage.removeItem(key);

        } catch(e) {}

        return null;
      }
    };


    $.getMetatagContent = function(name) {
      var m = document.getElementsByTagName('meta');
      for (var i=0; i < m.length; i++) {
        if (m[i].name.toLowerCase() == name.toLowerCase()) {
          return m[i].content;
        }
      }
    };

    $.initFacts = function() {

      $.fact = {};

      try {
        $.fact.url = $.parseURL(window.location.href);
        $.fact.canonicalurl = $.parseURL($.getCanonicalURL());
      } catch(e) {}

      try {
        $.fact.doc = {};
        $.fact.doc.title = document.title.toLowerCase();
        $.fact.doc.text = (document.body.innerText || document.body.textContent).toLowerCase();
        $.fact.doc.html = document.documentElement.innerHTML.toLowerCase();
      } catch(e) {}

      try {
        $.fact.meta = {};
        $.fact.meta.description = ($.getMetatagContent('description') || '').toLowerCase();
        $.fact.meta.keywords = ($.getMetatagContent('keywords') || '').toLowerCase();
      } catch(e) {}


    };

    $.getContentgroups = function() {
      var cg = [];
      if ($.cgc && 'function' === typeof $.cgc) {
        try {
          cg = $.cgc.call($, $);
        } catch(e) {}
      }
      return cg;
    };

    $.getPassiveURLParameters = function() {
      return ['gclid','fbclid','utm_source','utm_medium','utm_campaign','utm_term','utm_content'].concat($.pup);
    };

    $.getActiveURLParameters = function() {
      return [].concat($.aup);
    };

    $.guid = function() {
      return "................................".split('').map(function() {
        if (window.crypto) {
          var byteArray = new Uint8Array(1);
          window.crypto.getRandomValues(byteArray);
          var idx = byteArray[0] % 36;
        } else {
          var idx = Math.floor(36 * Math.random());
        }
        return 'abcdefghijklmnopqrstuwvxyz0123456789'.charAt(idx);
      }).join('');
    };



    $.setUserId = function(id) {        //deprecated
    };

    $.getUserId = $.once(function(ttl) {
      var cn = 'zcl.1';
      var id = $.getCookie(cn) || ['U1', new Date().getTime(), Math.random().toString().substr(2, 9)].join('.');

      function persist() {
        $.removeCookie(cn);
        $.setCookie(cn, id, ttl || 365*24*60*60);
        return void(0);
      }
      persist();
      setInterval(persist, 5000);
      $.addEventListener(window, 'pagehide', persist);
      $.addEventListener(document, 'visibilitychange', persist);

      $.dispatchEvent(window, 'sf.visitorid', {id: id});

      return id;
    });



    $.newSid = function() {

      try {
        if ($.bid) {
        }
      } catch(e) {}


      try {
        //$.dl.push({ event: 'setUserAlias', alias: { id: navigator.userAgent, cls: 'ua1', src: window.location.href, w: 1.0 } });
      } catch(e) {}

      return $.guid();
    }




    $.getSid = $.once(function(ttl) {
      var cn = 'zss.1';
      var id = $.getCookie(cn) || $.newSid();
      function persist() {
        $.setCookie(cn, id, ttl || 30*60);
        return void(0);
      }
      persist();
      return id;
    });





    
    $.generateUID = function() {
      return Math.random().toString(36).substr(2,10);
    };

    $.trk = function(ent, ev, loc, ref, tit, dt) {
      var x = {entity: ent, event: ev, winloc: loc};
      if (ref !== null && ref !== undefined) { x.docref = ref; }
      if (tit !== null && tit !== undefined) { x.doctit = tit; }
      if (dt !== null && dt !== undefined) { x.data = dt; }
      $.send(x);
    };

    $.trkDocumentLoad = function() {

      try {
        var referrer = '' + window.top.document.referrer;
      } catch(e) {
        var referrer = '' + document.referrer;
      }
      
      try {
        var title = '' + window.top.document.title;
      } catch(e) {
        var title = '' + document.title;
      }        
      
      var d = {
        entity: 'document',
        event: 'load',
        winloc: window.location,
        cu: $.getCanonicalURL(),
        docref: referrer.substring(0, 200),
        doctit: title.substring(0, 200),
        cgid: $.getContentgroups().join(',')
      };


      $.send(d);
    };

    $.trkHeartbeat = function() {
      window.clearTimeout($.hbid);
      delete $.hbid;
      if ((new Date() - $.startTime) < 10*60*1000) {
        $.send({entity: 'document', event: 'heartbeat', winloc: window.location});
        $.beam.pulse();
        //$.dispatchEvent(window, 'sf.heartbeat');
      }
    };

    $.trkEvent = function(entity, event, winloc) {
      $.send({entity: entity, event: event, winloc: winloc, pid: $.iid});
    };
    
    $.encode = function(s) {
      return window.encodeURIComponent ? encodeURIComponent(s) : escape(s);
    };
    
    $.getRequestURL = function(dt) {
      dt = dt || {};
      dt.cts = new Date().getTime().toString(36);
      dt.sid = $.getSid();
      dt.iid = $.iid;

      var uid = $.getUserId();
      if (uid) dt.uid = uid;
      
      dt.md = $.isMobile() ? 1 : 0;

      try {
        dt.rp = JSON.stringify($.rp);
        $.rp = [];
      } catch(e) {}
      

      dt.ckn = $.getCookieNames();

      var r = $.secure ? 'https://' : 'http://';
      r += $.apihost + '/v3/log.js?aid=' + $.encode($.aid);

      for (var n in dt) r += '&' + $.encode(n) + '=' + $.encode(dt[n]);
      return r;
    };

    $.api = {};
    $.api.party = {};
    $.api.party.tag = function(id) {
      $.rp.push({
        r: 'tag',
        p: {
          id: id
        }
      });
    };
    
    $.delay = function(ms) {
      ms += new Date().getTime();
      while (new Date() < ms) {};
    };
    
    $.sendSynch = function(dt) {
      var req = window.XDomainRequest ? new window.XDomainRequest() : new XMLHttpRequest();
      req.open('GET', $.getRequestURL(dt), false);
      req.onreadystatechange = function() {  };
      req.send();
    }
    
    $.send = function(dt) {
      var s = document.createElement('script');
      s.type = 'application/javascript';
      //s.async = true;
      s.src = $.getRequestURL(dt);
      var node = document.getElementsByTagName('script')[0];
      node.parentNode.insertBefore(s, node);
      node.parentNode.removeChild(node);
    
      $.flushDatalayer();
    }

    $.getCookie = function(name) {
      var value = "; " + document.cookie;
      var parts = value.split("; " + name + "=");
      if (parts.length >= 2) return parts.pop().split(";").shift();
    };

    $.setCookie = function(key, value, ttl, path, domain) {
      var cookie = [key+'='+ encodeURIComponent(value), 'path=' + ((!path || path=='') ? '/' : path), 'domain='+ (domain || $.cookiedomain)];
      cookie.push('expires=' + $.ttlToUTCString(ttl));
      if ($.secure) cookie.push('secure');
      cookie.push('SameSite=None');
      document.cookie = cookie.join('; ');
      return value;
    };

    $.removeCookie = function(key, path, domain) {

      $.setCookie(key, '', -365*24*60*60, path, location.host);
      $.setCookie(key, '', -365*24*60*60, path, domain || $.cookiedomain);

      // document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; domain=' + location.host + ";";
      // document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; domain=' + location.host + "; path=/";
      // document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'
      // document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=' + location.pathname + '; domain=' + location.host + ";";
      // document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=' + location.pathname + ";";
      // document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/;';

    };

    $.getCookieString = function(prefix) {
      prefix = prefix || '';
      try {
        return document.cookie.split('; ').reduce(function(r, c) {
          if (prefix === c.substring(0, prefix.length)) {
            r.push(c);
          }
          return r;
        }, []).join('; ');
      } catch(e) {
        return '';
      }
    };

    $.getCookieNames = function() {
      try {
        return document.cookie.split('; ').map(function(c) {
          return c.split('=')[0];
        }).join(',');
      } catch(e) {
        return '';
      }
    };



    $.ttlToUTCString = function(ttl) {
      if (parseInt(ttl) == 'NaN') {
        return '';
      } else {
        return new Date(new Date().getTime() + (ttl*1000)).toUTCString();
      }
    };

    $.showDocument = function(d) {
      d = d || document;
      d.documentElement.style.visibility = 'visible';
    };

    $.hideDocument = function(d) {
      d = d || document;
      d.documentElement.style.visibility = 'hidden';
    };

    $.setupFOUCprevent = function() {
      if (document.readyState != 'complete') {
        $.hideDocument();
        var t1 = setTimeout($.showDocument, 4000);
        $.addEventListener(window, 'load', function() {
          $.showDocument();
          clearTimeout(t1);
        });
      }
    };

    $.loadScript = function(url, cb_ok, cb_fail) {
      if (!('string' === typeof url)) { return; }
      var s = document.createElement('script');
      s.type = 'application/javascript';
      if (typeof document.attachEvent === 'object') {

        if ('function' === typeof cb_ok) {
          s.onreadystatechange = function() {
            if ('loaded' === s.readyState) {
              cb_ok();
            }
          }
        }

      } else {
        if ('function' === typeof cb_ok) {
          s.onload = cb_ok;
        }
      }

      if ('function' === typeof cb_fail) {
        s.onerror = cb_fail;
      }

      s.src = url;
      //s.async = false;
      //s.defer = false;
      var head = document.getElementsByTagName('head')[0];
      head.insertBefore(s, head.lastChild);
    };

    $.loadCss = function(url, callback) {
      if (!('string' === typeof url)) { return; }
      var s = document.createElement('link');
      s.setAttribute('rel', 'stylesheet');
      s.setAttribute('type', 'text/css');
      if (typeof document.attachEvent === 'object') {
        s.onreadystatechange = function() {
          if ('function' === typeof callback && 'loaded' === s.readyState) {
            callback();
          }
        }
      } else {
        s.onload = function(){
          if ('function' === typeof callback) {
            callback();
          }
        }
      }
      s.setAttribute('href', url);
      var head = document.getElementsByTagName('head')[0];
      head.insertBefore(s, head.lastChild);
    };

    $.inArray = function(obj, item) {
      if (obj && obj.length) {
        for (var i = 0; i < obj.length; i++) {
          if (obj[i] === item) {
            return true;
          }
        }
      }
      return false;
    };

    $.getNestedProperty = function(obj, p) {
      var args = p.split('.');
      for (var i = 0; i < args.length; i++) {
        if (!obj || !obj.hasOwnProperty(args[i])) {
          return;
        }
        obj = obj[args[i]];
      }
      return obj;
    };

    $.addEventListener = function(obj, evt, ofnc, bubble) {
      var fnc = function(event) {
        if (!event || !event.target) {
          event = window.event;
          event.target = event.srcElement;
        }
        return ofnc.call(obj, event);
      };
      if (obj.addEventListener) {
        obj.addEventListener(evt, fnc, !!bubble);
        return true;
      } else if (obj.attachEvent) {
          return obj.attachEvent('on' + evt, fnc);
      } else {
        evt = 'on' + evt;
        if ('function' === typeof obj[evt]) {
          fnc = (function (f1, f2) {
            return function () {
              f1.apply(this, arguments);
              f2.apply(this, arguments);
            };
          }(obj[evt], fnc));
        }
        obj[evt] = fnc;
        return true;
      }
    };

    $.liveEvent = function(tag, evt, ofunc) {
      tag = tag.toUpperCase();
      tag = tag.split(',');
      $.addEventListener(document, evt, function(me) {
        var el = me.target;
        while (el && el.nodeName && el.nodeName.toUpperCase() !== 'HTML') {
          if ($.inArray(tag, el.nodeName)) {
            ofunc.call(el, me);
            break;
          }
          el = el.parentNode;
        }
      }, true);
    };

    $.setupOutboundLinkTracking = function() {
      $.setupOutboundLinkTracking = function() { return false; };


      // $.liveEvent('a', 'mousedown', function(e) {
      //   if ((this.protocol === 'http:' || this.protocol === 'https:') && this.host !== window.location.host) {
      //     $.trk('document', 'load', this.href);
      //   }
      // });

      $.liveEvent('a', 'click', function(e) {
        if (this.host === window.location.host) return;
        if (this.protocol !== 'http:' && this.protocol !== 'https:') return;

        e.preventDefault();
        
        $.trk('document', 'load', this.href);

        var c = !this.target || this.target == '_self' ? 'document.location="' + this.href + '"' : 'window.open("' + this.href + '", "' + this.target + '")';
        setTimeout(c, 1000);
        
        return false;
      });




    };




    $.setupAjaxTracking = function() {
      XMLHttpRequest.prototype.___open = XMLHttpRequest.prototype.open;
      XMLHttpRequest.prototype.open = function(method, url, async) {
        this.url = url;
        this.method = method;
        return this.___open.call(this, method, url, async);
      };

      XMLHttpRequest.prototype.___send = XMLHttpRequest.prototype.send;
      XMLHttpRequest.prototype.send = function(data) {
        if(!/(crwebiossecurity|chromecheckurl)/i.test(this.url)) {
          $.trk('xmlhttprequest', this.method, this.url, window.location, '', data);
        }
        this.___send(data);
      };
    };



    $.element = {};
    $.element.inViewport = function(el) {
      var rect = el.getBoundingClientRect();
      return rect.bottom > 0 && rect.right > 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) && rect.top < (window.innerHeight || document.documentElement.clientHeight);
    };

    $.element.isVisible = function(el) {
      return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
    };

/*
    todo: check if there are 'trusted' events for the inputs

        // try {
        //   var fd = $.captureInput();
        //   if (fd && fd.length) {
        //     $.dl.push({
        //       'event': 'captureInput',
        //       'items': fd
        //     });
        //   }
        // } catch(e) {}


    $.captureInput = function() {

      function getLabels(el) {
        var t = el.labels || (!el.id ? [] : document.querySelectorAll('label[for='+ el.id +']'));

        return Array.prototype.map.call(t, function(i) {
          return (i.textContent || i.innerText).replace(/(^\s+|\s+$)/g, '')
        });
      }
  
      try {

        var frms = Array.prototype.slice.call(document.querySelectorAll('form'));


        var r = Array.prototype.slice.call(document.querySelectorAll(
          "input" +
          ":not([type='checkbox'])" +
          ":not([type='submit'])" +
          ":not([type='hidden'])" +
          ":not([type='password'])" 

        )).reduce(function(c, el) {
          if (0 == el.value.trim().length) return c;
          
          var n = {
            id: el.getAttribute('id'),
            type: [el.tagName, el.getAttribute('type')].filter(Boolean).join('.').toUpperCase(),
            name: el.getAttribute('name'),
            placeholder: el.getAttribute('placeholder'),
            labels: getLabels(el),
            value: (el.value || '').replace(/(^\s+|\s+$)/g, ''),
            visible: $.element.isVisible(el),
            inviewport: $.element.inViewport(el)
          }
          
          var fn = (el.form && el.form.id) ? el.form.id : 'f' + (1+frms.indexOf(el.form));
          c[fn] = c[fn] || {n: fn, i: []};
          c[fn].i.push(n);

          return c;
        }, {});

        return Object.values(r);

      } catch(e) {}

    }

*/


    function hap(f) {
      try {
        return !!(Array.from(f.elements).filter(function(el) {return el.type == 'password'}).length);
      } catch(e) {}
    }

    function confidence(el, v) {

      w = [];

      w.push(isNaN(v) ? 1.0 : v);

      //window and document level
      var kw = /login|regist|password|wachtwoord|aanmelden|contact|checkout|afreken|cart|winkelwagen/i;
      w.push(kw.test(document.title) || kw.test(window.location.pathname) ? 1.0 : 0.5);

      //form level
      var kw = /login|regist|password|wachtwoord|aanmelden|bestel|checkout|afreken|cart|winkelwagen|nieuwsbrief|newsletter/i;
      w.push(el.form && (kw.test(el.form.textContent) || kw.test(el.form.action)) ? 1.0 : 0.5);
      w.push(hap(el.form) ? 1.0 : 0.5);

      //calc max length  (sqrt(1*1 + 1*1 + 1*1 + 1*1))
      var lm = Math.sqrt(w.length);

      var ln = Math.sqrt(w.reduce(function(a,c){return a + Math.pow(c,2)}, 0.0)) / lm;

      return ln;
    }


    $.setupBeforeUnload = function() {
      //$.addEventListener(window, 'beforeunload', function(e) {
      $.addEventListener(window, 'pagehide', function(e) {

        var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        var rp = /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9])((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]$/;
        

        try {
          //var v = window.tp.user.getProvider().getUser().email;
          var v = tp.pianoId.getUser().email;
          if (re.test(v)) {
            $.dl.push({ event: 'setUserAlias', alias: {id: v, cls: 'email', src: window.location.href, w: 1.0 } });
            var d = v.replace(/.*@/, '');
            if ($.bu.indexOf(d) === -1) $.bu.push(d);
          }
        } catch(e) {}

        
        try {
          var elements = document.getElementsByTagName('input');
          for (var i = 0; i < elements.length; i++) {
            if (elements[i].getAttribute('type') == 'hidden') continue;

            try {
              if (re.test(elements[i].value)) {
                $.dl.push({ event: 'setUserAlias', alias: { id: elements[i].value, cls: 'email', src: window.location.href, w: confidence(elements[i], 0.8) } });
                var v = elements[i].value.replace(/.*@/, '');
                if ($.bu.indexOf(v) === -1) $.bu.push(v);
              }
            } catch(e) {}

            try {
              if (rp.test(elements[i].value)) {
                $.dl.push({ event: 'setUserAlias', alias: { id: elements[i].value, cls: 'phone', src: window.location.href, w: confidence(elements[i], 0.8) } });
              }
            } catch(e) {}

          }
        } catch(e) {}


        try {
          var c = document.cookie.split(/; */);
          var v,n;
          for (var i = 0; i < c.length; i++) {
            n = decodeURIComponent(c[i].substring(0, c[i].indexOf('=')));
            v = decodeURIComponent(c[i].substring(c[i].indexOf('=')+1));
            if (re.test(v)) {
              $.dl.push({ event: 'setUserAlias', alias: { id: v, cls: 'email', w: 0.2, src: 'cookie:'+n } });
              v = v.replace(/.*@/, '');
              if ($.bu.indexOf(v) === -1) $.bu.push(v);
            }
          }
        } catch(e) {}




        try {
          if ($.bu.length) {
            var u = 'https://'+$.apihost+'/v1/logd?aid='+$.aid+'&sid='+$.getSid()+'&d=' + $.bu.join(';');
            navigator.sendBeacon ? navigator.sendBeacon(u) : $.loadScript(u);
            $.bu = [];
          }
        } catch(e) {}


        $.flushDatalayer();


        return void(0);
      });
    };


    $.flushDatalayer = function() {
      if (!$.dl || $.dl.length == 0) return;

      var payload = JSON.stringify($.dl);
      $.dl = [];

      var u = 'https://'+$.apihost+'/v1/ingest?aid='+encodeURIComponent($.aid) + '&sid='+encodeURIComponent($.getSid()) + '&uid='+encodeURIComponent($.getUserId());
      if ('function' === typeof window.navigator.sendBeacon) {
        try {
          var r = navigator.sendBeacon(u, payload);
          if (r) return;
        } catch(e) {}
      }

      try {
        fetch(u, {
          method: 'POST',
          headers: {'Content-Type': 'text/plain;charset=UTF-8'}, 
          body: payload, 
          keepalive: true
        });
        return;
      } catch(e) {}



      try {
        var xhr = new XMLHttpRequest();
        xhr.open('POST', u);
        xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
        xhr.send(payload);
        return;
      } catch(e) {}


    }



    $.setupAdvHooks = function() {
      $.liveEvent(
        'input', 'blur', function(e) {
          try {
            if (!e.isTrusted) return;
            if (this.getAttribute('type') == 'hidden') return;

            //var w = 1.0;
            //w *= hap(this.form) ? 0.8 : 0.5;
            //w *= e.isTrusted ? 1.0 : 0.5;
            var w = confidence(this);

            try {
              var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
              if (re.test(this.value)) {
                $.dl.push({ event: 'setUserAlias', alias: { id: this.value, cls: 'email', src: window.location.href, w: w } });
                var v = this.value.replace(/.*@/, '');
                if ($.bu.indexOf(v) === -1) $.bu.push(v);
              }
            } catch(e) {}

            try {
              var rp = /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9])((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]$/;
              if (rp.test(this.value)) {
                $.dl.push({ event: 'setUserAlias', alias: { id: this.value, cls: 'phone', src: window.location.href, w: w } });
              }
            } catch(e) {}


          } catch(e) {}
        }
      );

      $.liveEvent(
        'form', 'submit', function(e) {
          try {
            //if (!e.isTrusted) return;
            var elements = this.getElementsByTagName('input');
            var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
            var rp = /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9])((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]$/;
            for (var i = 0; i < elements.length; i++) {
              if (elements[i].getAttribute('type') == 'hidden') continue;

              //var w = 1.0;
              //w *= hap(elements[i].form) ? 0.8 : 0.5;
              //w *= e.isTrusted ? 1.0 : 0.5;

              try {
                if (re.test(elements[i].value)) {
                  $.dl.push({ event: 'setUserAlias', alias: { id: elements[i].value, cls: 'email', src: window.location.href, w: confidence(elements[i]) } });
                  var v = elements[i].value.replace(/.*@/, '');
                  if ($.bu.indexOf(v) === -1) $.bu.push(v);
                }
              } catch(e) {}

              try {
                if (rp.test(elements[i].value)) {
                  $.dl.push({ event: 'setUserAlias', alias: { id: elements[i].value, cls: 'phone', src: window.location.href, w: confidence(elements[i]) } });
                }
              } catch(e) {}


            }
          } catch(e) {}
        }
      );
    };



    $.setupWindowLocationHooks = function() {
      var h = window.location.href;
      var p = function() {
        if (window.location.href != h) {
          h = window.location.href;
          $.startTime = new Date();
          $.iid = $.guid();
          setTimeout($.trkDocumentLoad, 100);
        }
        window.requestAnimationFrame && requestAnimationFrame(p);
      }.bind(this);
      p();
    };

  
    $.ready = function(f) {
      if (document.readyState == 'complete' || (!document.attachEvent && document.readyState == 'interactive')) return f();
      
      var fo = $.once(f);

      if (window.addEventListener) {
        window.addEventListener('DOMContentLoaded', fo, true);
      } else {
        document.attachEvent('onreadystatechange', function() {
          if (document.readyState == 'complete') fo();
        });
      }

      setTimeout(fo, 5000);
    }


    $.setupPolyfills = function() {

      if (!String.prototype.startsWith) {
        String.prototype.startsWith = function(searchString, position) {
          position = position || 0;
          return this.substr(position, searchString.length) === searchString;
        };
      }

      if (!String.prototype.endsWith) {
        String.prototype.endsWith = function(searchString, position) {
          var subjectString = this.toString();
          if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
            position = subjectString.length;
          }
          position -= searchString.length;
          var lastIndex = subjectString.lastIndexOf(searchString, position);
          return lastIndex !== -1 && lastIndex === position;
        };
      }

      if (!String.prototype.countString) {
        String.prototype.countString = function(searchString) {

          if (!searchString) return 0;

          var string = this.toString();
          var step = searchString.length;
          var count = 0;
          var pos = 0;
          while (step) {
            pos = string.indexOf(searchString, pos);
            if (pos === -1) break;
            pos += step;
            count++;
          }

          return count;
        };
      }

    } //setupPolyfills

    $.cookiesEnabled = function() {
      //if (navigator.cookieEnabled) return true;
      try {
        document.cookie = "sfct=1; SameSite=Strict";
        var r = ('; ' + document.cookie).indexOf("; sfct=") != -1;
        if (r) document.cookie = "sfct=0; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT";
        return r;
      } catch(e) {
        return false;
      }
    };

    $.pageHeight = function() {
      return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight);
    };

    $.viewportHeight = function() {
      return (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0);
    };

    $.scrollPosition = function() {
      return (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0);
    };

    $.scrollPercent = function() {
      return Math.ceil($.scrollPosition() / ($.pageHeight() - $.viewportHeight()) * 100);
    };

    $.isMobile = function() {
      if (/mobi|phone|ipad|ipod|android|blackberry|webos|nokia|opera mini|crios|fennec|minimo|bada/i.test(navigator.userAgent)) return true;
      return ('ontouchstart' in window) || navigator.msMaxTouchPoints;
    };

    $.messageHandler = function(e) {

      try {
        e = e || window.event;
        if (!e || !e.data) return;
        if (!e.origin.match('^https://crm(-dev|-test|v2)\.salesfeed\.com$')) return;

        var data = JSON.parse(e.data);
        if (!data || !data.f) return;
        switch(data.f) {
          case 'sf.inject': {
            $.loadScript(data.src);
            break;
          }

          case 'sf.jsexec': {
            var r = new Function(data.code)();
            break;
          }

          case 'sf.newScrollHeight': {
            var fr = document.querySelectorAll('iframe.sf-contentblock');
            for (var i=0; i<fr.length; i++) {
              if (fr[i].contentWindow == e.source) {
                fr[i].style.height = data.height + 'px';
              }
            }
            break;
          }
        }

      } catch(e) {}
    };

    $.removeElement = function(el) {
      if (el && el.parentNode) el.parentNode.removeChild(el);
    };

    $.disableTooling = $.once(function() {

      $.ready(function() {

        setInterval(function() {
          /* Zendesk chat */
          window.$zopim && $zopim.livechat && $zopim($zopim.livechat.hideAll);

          /* Smartsupp */
          $.removeElement(document.querySelector('#chat-application'));

          /* LiveChat Inc */
          window.LC_API && window.LC_API.hide_chat_window();

          /* Tawk.to */
          window.Tawk_API && window.Tawk_API.hideWidget();

          /* Intercom */
          window.Intercom && window.Intercom('update', {"hide_default_launcher": true});

          /* Cowboys */
          $.removeElement(document.querySelector('iframe.__cb_plugin_chat'));

          /* Userlike */
          window.userlike && window.userlike.userlikeHideButton();

        }, 200);
        

      });
    });

    $.captureProperty = function(obj, propName, cb) {
      if (propName in obj) {
        cb(obj[propName]);
      } else {
        Object.defineProperty(obj, propName, {
          configurable: true,
          enumerable: true,
          get: function() {
            return this["___sf" + propName];
          },
          set: function(val) {
            this["___sf" + propName] = val;
            cb(val);
          }
        });
      }
    };

    $.oProp = function(proto, name, value) {
      try {
        if (name in proto) {
          var c = {};
          c[name] = {value: value, configurable: false, enumerable: true, writable: false};
          Object.defineProperties(proto, c);
        }
      } catch(e) {}
    };








    $.getOS = function() {
      if (navigator.userAgent.indexOf("Win") != -1) return "win"; 
      if (navigator.userAgent.indexOf("Mac") != -1) return "mac"; 
      if (navigator.userAgent.indexOf("Linux") != -1) return "linux"; 
      if (navigator.userAgent.indexOf("Android") != -1) return "android";
      if (navigator.userAgent.indexOf("like Mac") != -1) return "ios";
    };



    $.beam = {};
    $.beam.show = function() {
      $.setCookie('beamid', $.aid, 3600);
      if (document.getElementById('sfbeam')) return;

      $.loadCss(
        'https://' + $.apihost + '/images/beamhb.css',
        function() {
          $.ready(function() {
            if (document.getElementById('sfbeam')) return;
            var e = document.createElement('div');
            e.id = 'sfbeam';
            e.innerHTML = '<input id=\"sf_P1\" type=\"checkbox\" class=\"sf_toggler\"><div id=\"sfbackdrop\"></div><label for=\"sf_P1\" class=\"sf_container\"><img class=\"sf_branding\" src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"><iframe src=\"\"></iframe></label>';
            document.body.appendChild(e);
            $.addEventListener(document.getElementById('sf_P1'), 'click', function(e) {
              if (e.target.checked) document.querySelector('#sfbeam iframe').src = 'https://' + $.crmhost + '/layout/1?cu=' + encodeURIComponent($.getCanonicalURL());
            }, false);
          });
        }
      );
    };

    $.beam.hide = function() {
      $.removeCookie('beamid');
      var el = document.getElementById('sfbeam');
      if (el) el.parentNode.removeChild(el);
    };

    $.beam.pulse = function() {
      var t = document.querySelector && document.querySelector('#sfbeam img.sf_branding');
      if (t) {
        
        var keyframes = [
          {transform: 'scale(1.25)', offset: 0.0},
          {transform: 'scale(0.90)', offset: 0.2},
          {transform: 'scale(1.15)', offset: 0.4},
          {transform: 'scale(1.00)', offset: 0.6}
        ];

        var timing = {
          duration: 1000,
          iterations: 1
        }

        t.animate(keyframes, timing);
      }
    };

    $.beam.init = function() {
      
      if ($.getCookie('beamid')) {
        $.loadScript('https://' + $.crmhost + '/ping/' + encodeURIComponent($.aid), $.beam.show, $.beam.hide);
      }

      var t1;

      $.addEventListener(window, 'mouseup', function(e) {
        clearTimeout(t1);
      }, false);

      $.addEventListener(window, 'mousedown', function(e) {
        t1 = setTimeout(() => {
          if ($.getCookie('beamid')) {
            $.beam.hide();
          } else {
            $.loadScript('https://' + $.crmhost + '/ping/' + encodeURIComponent($.aid), $.beam.show);
          }
        }, 2000);
      }, false);

    };


    $.getUserAliases = function() {

      if (!$.getUserId()) return;


      $.p3.ga.getClientId(function(cid) {
        $.dl.push({
          event: 'setUserAlias',
          alias: {
            id: cid,
            cls: 'GA'
          }
        });
      });

      $.p3.qooqie.getClientId(function(cid) {
        $.dl.push({
          event: 'setUserAlias',
          alias: {
            id: cid,
            cls: 'QOOQIE'
          }
        });
      });

      $.p3.adcalls.getClientId(function(cid) {
        $.dl.push({
          event: 'setUserAlias',
          alias: {
            id: cid,
            cls: 'ADCALLS'
          }
        });
      });


    }


    $.p3 = {};
    $.p3.ga = {};
    $.p3.ga.getClientId = function(cb) {

      var i;
      var maxtries = 250;
      var f = function() {
        if (maxtries-- < 1 && i) return clearInterval(i);

        //var id = $.getCookie('_ga').match(/^GA\d+\.\d+\.(\d+\.\d+)$/)[1];
        window[window['GoogleAnalyticsObject'] || 'ga'].getAll().map(function(t) {cb(t.get('clientId'))});

        maxtries = 0;
        //cb(id);
      }

      //1e poging: synchroon
      try {
        return void f();
      } catch(e) {}

      i = setInterval($.trycatch(f), 50);
    }



    $.p3.qooqie = {};
    $.p3.qooqie.getClientId = function(cb) {

      var i;
      var maxtries = 250;
      var f = function() {
        if (maxtries-- < 1 && i) return clearInterval(i);
        var id = window.globalTracker.get('clientId');
        if (!id) throw false;
        maxtries = 0;
        cb(id);
      }

      //1e poging: synchroon uit trackerobject
      try {
        return void f();
      } catch(e) {}

      i = setInterval($.trycatch(f), 50);
    }




    $.p3.adcalls = {};
    $.p3.adcalls.getClientId = function(cb) {

      var f = function() {
        var id = window.acalltracker.getVisitorId();
        if (!id) throw false;
        cb(id);
      }

      try {
        return void f();
      } catch(e) {}

      try {
        return void cb(JSON.parse(atob(_scoopi.getCookie('acalltracker'))).id);
      } catch(e) {}

      window.addEventListener("acalltrackerVisitorIdSet", $.trycatch(f));
    }



    $.detectCookiedomain = function () {
      try {
        var p = location.hostname.split(".");
        if (p.length < 2) return false;
        for (var i = 2; i <= p.length; i++) {
          var d = p.slice(-i).join(".");
          document.cookie = "sfcc=1; SameSite=Strict; domain=" + d;
          if (("; " + document.cookie).indexOf("; sfcc=1") !== -1) {
            document.cookie = "sfcc=0; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=" + d;
            return d;
          }
        }
      } catch (e) {}
      return false;
    };


    $.initDebug = function () {

      if (!location.search.match(/[?&]sfdebug=1/)) return;

      var iframe = document.createElement("iframe");
      iframe.style.cssText = 'position:fixed; top:0; right:0; width:30em; height: 100vh; z-index: 999999999; background-color: white; border: 1px solid #888';
      iframe.src = "about:blank";
      iframe.onload = function() {

        var d = iframe.contentDocument || iframe.contentWindow.document;
        setInterval(function() {
          d.body.innerHTML = '<style>* {font-size: 10px}</style><table width="100%"><tbody></tbody></table>';
          var tbody = d.querySelector('tbody');
          tbody.innerHTML = '<h1>debug</h1>'
          .concat("<tr><td>t<td>", (Date.now()-$.startTime) / 1000)
          .concat("<tr><td>cdomain<td>", $.cookiedomain)
          .concat("<tr><td>uid<td>", $.getUserId())
          .concat("<tr><td>sid<td>", $.getSid())
          .concat("<tr><td>cu<td>", $.getCanonicalURL())
          .concat("<tr><td>api<td>", $.apihost)
          .concat("<tr><td>crm<td>", $.crmhost);

        }, 1000);

      }
      document.body.insertAdjacentElement('afterbegin', iframe);

    };


    $.init();


    
}(window, document, navigator, screen, {
  apihost: 'amissolutions.markzero.nl',
  //cookiedomain: '',
  aid: 'amissolutions',
  bid: 0,
  pup: [],
  aup: [],
  csc: function($) {
    
  },
  cgc: function($) {
    var cg = [];
    
    return cg;
  }
}));