Tagging=function(a){this.site='sanomamedia-nl';this.zone='home';this.source_consent_cookie='site_consent';this.source_default_tracking=true;this.allowed_categories='atinternet,stats,stir';this.cookie_barviewcount='consentBarViewCount';this.protocol=window.location.protocol;this.autodetect_url=this.protocol+'//cts.snmmd.nl/service/detect/';this.context=a;this.positions={};this.positions_weighted={};this.is_site_without_cookiebar=false;this.positions.head='[{\"service_name\": \"Sanoma cookie opt-in\", \"source_non_tracking\": \"<script type=\\"text/javascript\\">    (function() {        function get_domain() {            var host = window.location.host;            var port = host.indexOf(\':\');            var domain = port>0?host.substr(0,port):host;            var parts = domain.split(\'.\');            return parts[parts.length-2]+\'.\'+parts[parts.length-1];        }        var url = window.location.protocol+\'//privacy.\'+get_domain()+\'/script/consent.js\';        var script = \'<scr\'+\'ipt type=\\"text/javascript\\" src=\\"\'+url+\'\\"></scr\'+\'ipt>\';        document.write(script);    })();</script>\", \"weight\": null, \"service_kind\": \"functional\", \"source_tracking\": \"<script type=\\"text/javascript\\">    (function() {        function get_domain() {            var host = window.location.host;            var port = host.indexOf(\':\');            var domain = port>0?host.substr(0,port):host;            var parts = domain.split(\'.\');            return parts[parts.length-2]+\'.\'+parts[parts.length-1];        }        var url = window.location.protocol+\'//privacy.\'+get_domain()+\'/script/consent.js\';        var script = \'<scr\'+\'ipt type=\\"text/javascript\\" src=\\"\'+url+\'\\"></scr\'+\'ipt>\';        document.write(script);    })();</script>\"}, {\"service_name\": \"Krux Digital\", \"source_non_tracking\": \"<script type=\\"text/javascript\\">var Krux = function () {};Krux.user = \'\';Krux.segments = \'\';</script>\", \"weight\": null, \"service_kind\": \"interests\", \"source_tracking\": \"<script type=\\"text/javascript\\">window.Krux||((Krux=function(){Krux.q.push(arguments);}).q=[]);(function(){  function retrieve(n){    var m, k=\'kx\'+n;    if (window.localStorage) {        return window.localStorage[k] || \\"\\";    } else if (navigator.cookieEnabled) {        m = document.cookie.match(k+\'=([^;]*)\');        return (m && unescape(m[1])) || \\"\\";    } else {        return \'\';    }  }  var kvs = [];  Krux.user = retrieve(\'user\');  if (Krux.user) {    kvs.push(\'u=\' + Krux.user);  }  Krux.segments = retrieve(\'segs\') && retrieve(\'segs\').split(\',\') || [];  for (var i = 0; i < Krux.segments.length; i++ ) {    kvs.push(\'ksgmnt=\' + Krux.segments[i]);  }  Krux.dartKeyValues = kvs.length ? kvs.join(\';\') + \';\': \'\';  if (window.wlrcmd && Krux.dartKeyValues) {     window.wlrcmd = window.wlrcmd + \';\' + Krux.dartKeyValues;   }})();</script><script class=\\"kxct\\" data-id=\\"Hhv9mzWj\\" data-timing=\\"async\\" data-version=\\"1.9\\" type=\\"text/javascript\\">  window.Krux||((Krux=function(){Krux.q.push(arguments)}).q=[]);  (function(){    var k=document.createElement(\'script\');k.type=\'text/javascript\';k.async=true;    var m,src=(m=location.href.match(\'(?:[?&]+)kxsrc=([^&]+)\'))&&decodeURIComponent(m[1]);    k.src = new RegExp(\'^https?://((?:[a-z0-9_.]|-)+[.])?krxd[.]net(:[0-9]{1,5})?/\', \'i\').test(src) ? src : src === \\"disable\\" ? \\"\\" :    (location.protocol===\\"https:\\"?\\"https:\\":\\"http:\\")+\\"//cdn.krxd.net/controltag?confid=Hhv9mzWj\\";    var s=document.getElementsByTagName(\'script\')[0];s.parentNode.insertBefore(k,s);  }());  </script>\"}, {\"service_name\": \"mOcean mobile\", \"source_non_tracking\": \"\", \"weight\": null, \"service_kind\": \"ads\", \"source_tracking\": \"<script type=\\"text/javascript\\">document.write(\'<sc\'+\'ript type=\\"text/javascript\\" src=\\"http://img.ads.sanomamobileads.nl/js/mobile.js\\"></scr\'+\'ipt>\');</script>\"}]';this.positions_weighted.head=false;this.positions.footer='[{\"service_name\": \"Mouseflow\", \"source_non_tracking\": \"\", \"weight\": null, \"service_kind\": \"stats\", \"source_tracking\": \"<script type=\\"text/javascript\\">   var _mfq = _mfq || [];   (function() {       var mf = document.createElement(\\"script\\"); mf.type = \\"text/javascript\\"; mf.async = true;       mf.src = \\"//cdn.mouseflow.com/projects/8a73ad4f-fd09-4f3f-ba1e-291649cb756e.js\\";       document.getElementsByTagName(\\"head\\")[0].appendChild(mf);   })();</script>\"}]';this.positions_weighted.footer=false;this.positions.toc='[]';this.positions_weighted.toc=false;};Tagging.prototype._has_optin=function(a){var b,c,d=this;if(this.is_site_without_cookiebar)return true;b=f(this.source_consent_cookie);if(b.length==0){var e=d._get_cookie(d.cookie_barviewcount);if(e>=1&&this.source_default_tracking==true)return true;b=d.allowed_categories.split(",");}for(c=0;c<b.length;c++)if(b[c]==a)return true;return false;function f(a){var b=d._get_cookie(a).split(":");if(b&&typeof b[3]!="undefined")return b[3].split(",");else return [];}};Tagging.prototype._get_cookie=function(a){if(document.cookie&&document.cookie!=""){var b=document.cookie.split(";");for(var c=0;c<b.length;c++){var d=e(b[c]);if(d.substring(0,a.length+1)==(a+"="))return decodeURIComponent(d.substring(a.length+1));}}return "";function e(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"");}};Tagging.prototype._get_tag_source=function(a){if(this._has_optin(a.service_kind))return a.source_tracking;else return a.source_non_tracking;};Tagging.prototype.get_json=function(a){return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(a.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+a+')');};Tagging.prototype.random_tag=function(a){var b=[];var c=[];for(index in a){tag=a[index];b[index]=this._get_tag_source(tag);for(var d=0;d<tag.weight;d++)c.push(index);}var e=c[Math.floor((Math.random()*c.length))];return b[e];};Tagging.prototype.all_tags=function(a){var b=[],c,d;for(c in a)if(a.hasOwnProperty(c)){d=a[c];b[c]=this._get_tag_source(d);}return b.join("\n");};Tagging.prototype.render=function(a,b){document.write(this.get_source(a,b));};Tagging.prototype.get_source=function(a,b){if(typeof this.positions[a]=='undefined')this._detect(a);else{var c=this.get_json(this.positions[a]);var d="";if(this.positions_weighted[a])d=this.random_tag(c);else d=this.all_tags(c);var e={};for(variable in this.context)e[variable]=this.context[variable];for(variable in b)e[variable]=b[variable];d=this._replace_variables(d,e);return d.replace(/\$\w+/g,"").replace(/\${\w+}/g,"");}return '';};Tagging.prototype.log=function(a){};Tagging.prototype._load=function(a){var b=document.getElementsByTagName('head')[0]||document.documentElement,c=document.createElement('script');c.type='text/javascript';c.src=a;b.appendChild(c);};Tagging.prototype._detect=function(a){this._load(this.autodetect_url+this.site+'/'+this.zone+'/'+a+'/');};Tagging.prototype._replace_variables=function(a,b){var c=/^[a-zA-Z_]\w*$/;for(variable in b)if(c.test(variable)){var d=[new RegExp('\\$'+variable,'g'),new RegExp('\\${'+variable+'}','g')];for(re in d)a=a.replace(d[re],b[variable]);}else throw "'"+variable+"' is not a valid identifier.";return a;};