Tagging = function(context) {
  this.site = 'wellnesscafe-wp';
  this.zone = 'default';
  this.protocol = window.location.protocol;
  this.autodetect_url = this.protocol + '//cts.p24.hu/service/detect/';
  this.context = context;
  this.positions = {};
  this.positions_weighted = {};

  this.positions['head'] = '[{\"service_name\": \"Sanoma\", \"weight\": null, \"source\": \"<script src=\\"//stat.p24.hu/mobile_detect/mobile_detect.js\\"></script>\"}, {\"service_name\": \"Gemius Traffic\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\">    var properGemId = (\'${gemius_trackid}\' != \'\' ? \'${gemius_trackid}\' : \'AqJFz2ur.R7._Y_i0bNGSvU23_MFksbr0KAvYwPbjuz.y7\');        if(typeof _ceDeviceDetect.getDeviceType() !== \'undefined\' && _ceDeviceDetect.getDeviceType() != \'desktop\' && \'zIs7WzRM_O.psgOAcLtwEJbynF8IDZitvuDw633FgCP.J7\' != \'\') {        properGemId = \'zIs7WzRM_O.psgOAcLtwEJbynF8IDZitvuDw633FgCP.J7\';    }       var pp_gemius_identifier = properGemId;    function gemius_pending(i) { window[i] = window[i] || function() {var x = window[i+\'_pdata\'] = window[i+\'_pdata\'] || []; x[x.length]=arguments;};};    gemius_pending(\'gemius_hit\'); gemius_pending(\'gemius_event\'); gemius_pending(\'pp_gemius_hit\'); gemius_pending(\'pp_gemius_event\');    (function(d,t) {try {var gt=d.createElement(t),s=d.getElementsByTagName(t)[0],l=\'http\'+((location.protocol==\'https:\')?\'s\':\'\'); gt.setAttribute(\'async\',\'async\');    gt.setAttribute(\'defer\',\'defer\'); gt.src=l+\'://gahu.hit.gemius.pl/xgemius.js\'; s.parentNode.insertBefore(gt,s);} catch (e) {}})(document,\'script\');</script>\"}, {\"service_name\": \"Sanoma\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\" src=\\"//ad-blacklist.p24.hu/adx_blacklist.js\\"></script><script type=\\"text/javascript\\" src=\\"//ad-blacklist.p24.hu/rubicon_blacklist.js\\"></script><script type=\\"text/javascript\\">    (function(){        var blacklistsToCheck = [\'ADX\', \'RUBICON\'];        for (var i=0; i<blacklistsToCheck.length; i++) {            var typeName = blacklistsToCheck[i].charAt(0) + blacklistsToCheck[i].substr(1).toLowerCase();            window[\'no\' + blacklistsToCheck[i]] = false;            if (                typeof window[\'blck\' + typeName] != \'undefined\' &&                typeof window[\'blck\' + typeName][window.location.hostname] != \'undefined\' &&                window[\'blck\' + typeName][window.location.hostname].indexOf(location.pathname) >= 0            ) {                window[\'no\' + blacklistsToCheck[i]] = true;            }        }    })();</script>\"}, {\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<script>function ip2latlong(data) {    centralGeoTarget.ip2latlong(data);}var centralGeoTarget = {    referrer: document.referrer,    geoLocInfo: \\"geoLocInfo\\",    onPositionUpdate: function (position) {        var latitude = position.coords.latitude,            longitude = position.coords.longitude;        centralGeoTarget.buildUpMetaTag(latitude, longitude);        var geoLocationInfoSting = \'latitude=\' + latitude + \'|longitude=\' + longitude;        centralGeoTarget.createCookie(centralGeoTarget.geoLocInfo, geoLocationInfoSting, 168);    },    ip2latlong: function (data) {        var latitude = data.latitude,            longitude = data.longitude;        centralGeoTarget.buildUpMetaTag(latitude, longitude);        if (centralGeoTarget.readCookie(centralGeoTarget.geoLocInfo) == \\"\\") {            var geoLocationInfoSting = \'latitude=\' + latitude + \'|longitude=\' + longitude;            centralGeoTarget.createCookie(centralGeoTarget.geoLocInfo, geoLocationInfoSting, 168);        }    },    ipGeoLocation: function () {        script = document.createElement(\'script\');        script.type = \'text/javascript\';        script.src = \'//geoip.p24.hu/latlong.js\';        document.head.appendChild(script);    },    getLocationFromCookie: function () {        var coordinates = centralGeoTarget.readCookie(centralGeoTarget.geoLocInfo);        var coordinateVals = (function () {            var pairs = coordinates.split(\'|\');            var coo = {};            for (var i = 0; i < pairs.length; i++) {                var temp = pairs[i].split(\'=\');                coo[temp[0]] = temp[1];            }            return coo;        })();        if ((typeof coordinateVals.latitude == \'undefined\') || (typeof coordinateVals.longitude == \'undefined\')) {            return null;        }        var latitudeVal = parseFloat(coordinateVals.latitude),            longitudeVal = parseFloat(coordinateVals.longitude);        if (isNaN(latitudeVal) || isNaN(longitudeVal)) {            return null;        }        return {            latitude: latitudeVal,            longitude: longitudeVal        }    },    onPositionUpdateError: function (e) {        if (centralGeoTarget.readCookie(centralGeoTarget.geoLocInfo) == \\"\\") {            centralGeoTarget.ipGeoLocation();        } else {            var savedData = centralGeoTarget.getLocationFromCookie();            if (savedData != null) {                centralGeoTarget.buildUpMetaTag(savedData.latitude, savedData.longitude);            }        }    },    createCookie: function (cname, cvalue, expiry) {        var d = new Date();        d.setHours(d.getHours() + expiry);        var expires = \\"expires=\\" + d.toUTCString();        document.cookie = cname + \'=\' + cvalue + \';\' + expires + \';domain=.\' + document.domain + \';path=/\';    },    readCookie: function (cname) {        var name = cname + \\"=\\";        var ca = document.cookie.split(\';\');        for (var i = 0; i < ca.length; i++) {            var c = ca[i].trim();            if (c.indexOf(name) == 0) return c.substring(name.length, c.length);        }        return \\"\\";    },    buildUpMetaTag: function (latitude, longitude) {        var userdb_id = 65;        var createMetaElement = true;        var metaElements = document.querySelectorAll(\\"[name=\'customtarget\']\\");        if (metaElements != undefined) {            if (metaElements.length != undefined) {                if (metaElements.length > 0) {                    createMetaElement = false;                }            }        }        if (createMetaElement) {            var adverticumMeta = document.createElement(\'meta\');            adverticumMeta.name = \'customtarget\';            adverticumMeta.content = window.btoa(unescape(encodeURIComponent(\'userdb_id=\' + userdb_id + \'&latitude=\' + latitude + \'&longitude=\' + longitude)));            document.getElementsByTagName(\'head\')[0].appendChild(adverticumMeta);        } else {            var defaultMetaVal = metaElements[0].getAttribute(\\"content\\");            var newMetaVal = window.atob(unescape(defaultMetaVal)) + \'&userdb_id=\' + userdb_id + \'&latitude=\' + latitude + \'&longitude=\' + longitude;            metaElements[0].setAttribute(\\"content\\", window.btoa(unescape(encodeURIComponent(newMetaVal))));        }    },    init: function () {        if (typeof _ceDeviceDetect.getDeviceType() != \'undefined\') {            if (_ceDeviceDetect.getDeviceType() != \\"desktop\\") {                var savedData = centralGeoTarget.getLocationFromCookie();                if (centralGeoTarget.referrer.indexOf(\\"facebook\\") == -1) {                    if (savedData != null) {                        centralGeoTarget.buildUpMetaTag(savedData.latitude, savedData.longitude);                    } else {                        navigator.geolocation.getCurrentPosition(centralGeoTarget.onPositionUpdate, centralGeoTarget.onPositionUpdateError);                        if(centralGeoTarget.getLocationFromCookie() == null){                            centralGeoTarget.ipGeoLocation();                        }                    }                } else {                    if (savedData != null) {                        centralGeoTarget.buildUpMetaTag(savedData.latitude, savedData.longitude);                    } else {                        centralGeoTarget.ipGeoLocation();                    }                }            }        }    }};centralGeoTarget.init();</script>\"}, {\"service_name\": \"Sanoma\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\" src=\\"//segment.p24.hu/cerment.min.js\\" async></script>\"}, {\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<script>if (typeof _ceDeviceDetect != \'undefined\' && typeof _ceDeviceDetect.getDeviceType == \'function\') {    var _ceDisplayData = _ceDisplayData || {};    _ceDisplayData.gpt = _ceDisplayData.gpt || { items: [], defContName: \'div-gpt-ad\' };        (function(){        var scriptInserter = document.createElement(\'script\');        scriptInserter.src = \'https://www.googletagservices.com/tag/js/gpt.js\';        scriptInserter.async = true;        /*document.head.appendChild(scriptInserter);*/        document.head.insertBefore(scriptInserter, document.head.firstChild);    })();        var googletag = googletag || {};    googletag.cmd = googletag.cmd || [];    googletag.cmd.push(function() {        googletag.pubads().enableSingleRequest();        googletag.pubads().collapseEmptyDivs();        googletag.enableServices();    });}</script>\"}, {\"service_name\": \"Criteo\", \"weight\": null, \"source\": \"<script async=\\"async\\" type=\\"text/javascript\\" src=\\"https://static.criteo.net/js/ld/publishertag.js\\"></script><script>    window.Criteo = window.Criteo || {};    window.Criteo.events = window.Criteo.events || [];</script>\"}]';
  this.positions_weighted['head'] = false;
  
  this.positions['body-start'] = '[{\"service_name\": \"Google Tag Manager\", \"weight\": null, \"source\": \"<noscript><iframe src=\\"//www.googletagmanager.com/ns.html?id=GTM-FN24\\"height=\\"0\\" width=\\"0\\" style=\\"display:none;visibility:hidden\\"></iframe></noscript><script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({\'gtm.start\':new Date().getTime(),event:\'gtm.js\'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!=\'dataLayer\'?\'&l=\'+l:\'\';j.async=true;j.src=\'//www.googletagmanager.com/gtm.js?id=\'+i+dl;f.parentNode.insertBefore(j,f);})(window,document,\'script\',\'dataLayer\',\'GTM-FN24\');</script>\"}]';
  this.positions_weighted['body-start'] = false;
  
  this.positions['body-end'] = '[{\"service_name\": \"Sanoma/WellnessCafe\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\" src=\\"//stat.p24.hu/CTS/measuring-codes/wellnesscafe/measuringCode.min.js\\"></script>\"}, {\"service_name\": \"Strossle\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\">\t(function(){\t\tif (typeof document.querySelectorAll != \'undefined\' && document.querySelectorAll(\'[id^=strossle-widget-]\').length > 0) {\t\t\t\tvar head = document.getElementsByTagName(\'head\')[0];\t\t\t\tvar stScript = document.createElement(\'script\');\t\t\t\tstScript.src = \'//widgets.sprinklecontent.com/v2/sprinkle.js\';\t\t\t\tstScript.setAttribute(\'async\', \'\');\t\t\t\thead.appendChild(stScript);\t\t}\t})();</script>\"}, {\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\" src=\\"//stat.p24.hu/CTS/helper-scripts/waterfall_empty/closer.min.js\\"></script>\"}, {\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\" src=\\"//ad.adverticum.net/g3.js\\"></script>\"}, {\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<script src=\\"//stat.p24.hu/ng_test/rubicon_test.js\\" type=\\"text/javascript\\"></script>\"}, {\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\">    (function(){        var googleCPLink = (\\"http://centralmediacsoport.hu/Company/Adatkezelesi-tajekoztato\\" != \\"\\") ? \\"http://centralmediacsoport.hu/Company/Adatkezelesi-tajekoztato\\" : \\"http://centralmediacsoport.hu/Company/Central-Digitalis-Media-Adatkezelesi-tajekoztato\\";        var googleCPRename = (\\"${google_cookie_policy_rename}\\" != \\"\\") ? \\"${google_cookie_policy_rename}\\" : 1;            window.cookieconsent_options = {            \\"message\\"   : \\"A weboldalon cookie-kat haszn&#xE1;lunk, hogy biztons&#xE1;gos b&#xF6;ng&#xE9;sz&#xE9;s mellett a legjobb felhaszn&#xE1;l&#xF3;i &#xE9;lm&#xE9;nyt ny&#xFA;jthassunk.\\",            \\"dismiss\\"   : \\"Rendben!\\",            \\"learnMore\\" : \\"R&#xE9;szletes le&#xED;r&#xE1;s\\",            \\"link\\"      : googleCPLink,            \\"theme\\"     : \\"//stat.p24.hu/CTS/helper-scripts/cookieconsent/styles/custom.css\\",            \\"expiryDays\\": 1095,            \\"renamed\\"   : googleCPRename        };    })();</script><script type=\\"text/javascript\\" src=\\"//stat.p24.hu/CTS/helper-scripts/cookieconsent/cookieconsent.min.js\\"></script>\"}]';
  this.positions_weighted['body-end'] = false;
  
  this.positions['body-end-adv'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'33119\';                    break;                case \'mobile\':                    zoneForDevice = \'${adv_zone_id_for_mobile}\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['body-end-adv'] = false;
  
  this.positions['top'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum a8a263be\\" data-adsv-name=\\"\\"></div><script>var insertedElement = document.getElementById(\'ctstemp\');var zoneForDevice = \'\';var dataAdsvName = \'\';if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            zoneForDevice = \'36456\';            dataAdsvName = \'top\';            break;        case \'mobile\':            zoneForDevice = \'4236471\';            dataAdsvName = \'${adverticum_name_mobile}\';            break;        case \'tablet\':            zoneForDevice = \'36456\';            dataAdsvName = \'${adverticum_name_tablet}\';            if(dataAdsvName == \\"\\"){                dataAdsvName = \'top\';            }            break;    }}if (zoneForDevice == \'\') {    insertedElement.parentNode.removeChild(insertedElement);} else {    insertedElement.setAttribute(\'data-adsv-name\', dataAdsvName);    insertedElement.id = \'zone\' + zoneForDevice;}</script>\"}, {\"service_name\": \"Criteo\", \"weight\": null, \"source\": \"<div id=\\"criteoTPL\\"     style=\\"width:0px;height:0px;margin:0 auto;overflow:hidden;${custom_css}\\"></div><script type=\\"text/javascript\\">    (function () {        var zoneid = 1385751,            height = 90,            width = 970,            criteoEl = document.getElementById(\\"criteoTPL\\"),            domReady = \\"${criteo_dom_ready}\\",            mutationTimeout = 5000,            mutationConf = {attributes: true, childList: true, subtree: true};        var insertCriteoBanner = function () {            criteoEl.id += Math.floor(Math.random() * 1000000);            var observer = new MutationObserver(function (mutations) {                mutations.forEach(function () {                    criteoEl.style.width = width + \\"px\\";                    criteoEl.style.height = height + \\"px\\";                    criteoEl.style.marginTop = \\"10px\\";                    criteoEl.style.marginBottom = \\"10px\\";                    observer.disconnect();                });            });            observer.observe(criteoEl, mutationConf);            setTimeout(function(){ observer.disconnect(); }, mutationTimeout);            Criteo.events.push(function () {                Criteo.DisplayAcceptableAdIfAdblocked({                    \\"zoneid\\": zoneid,                    \\"containerid\\": criteoEl.id,                    \\"overrideZoneFloor\\": true                });            });        };        if (domReady != undefined && domReady != \'\' && domReady) {            if (typeof document.addEventListener !== \'undefined\') {                document.addEventListener(\\"DOMContentLoaded\\", insertCriteoBanner);            } else {                window.attachEvent(\\"onload\\", insertCriteoBanner);            }        } else {            insertCriteoBanner();        }    })();</script>\"}]';
  this.positions_weighted['top'] = false;
  
  this.positions['content-top'] = '[]';
  this.positions_weighted['content-top'] = false;
  
  this.positions['right010'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum a8a263be\\" data-adsv-name=\\"\\"></div><script>var insertedElement = document.getElementById(\'ctstemp\');var zoneForDevice = \'\';var dataAdsvName = \'\';if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            zoneForDevice = \'56455\';            dataAdsvName = \'box1\';            break;        case \'mobile\':            zoneForDevice = \'${adv_zone_id_for_mobile}\';            dataAdsvName = \'${adverticum_name_mobile}\';            break;        case \'tablet\':            zoneForDevice = \'56455\';            dataAdsvName = \'${adverticum_name_tablet}\';            if(dataAdsvName == \\"\\"){                dataAdsvName = \'box1\';            }            break;    }}if (zoneForDevice == \'\') {    insertedElement.parentNode.removeChild(insertedElement);} else {    insertedElement.setAttribute(\'data-adsv-name\', dataAdsvName);    insertedElement.id = \'zone\' + zoneForDevice;}</script>\"}, {\"service_name\": \"Criteo\", \"weight\": null, \"source\": \"<div id=\\"criteoTPL\\"     style=\\"width:0px;height:0px;margin:0 auto;overflow:hidden;${custom_css}\\"></div><script type=\\"text/javascript\\">    (function () {        var zoneid = 1385748,            height = 600,            width = 300,            criteoEl = document.getElementById(\\"criteoTPL\\"),            domReady = \\"${criteo_dom_ready}\\",            mutationTimeout = 5000,            mutationConf = {attributes: true, childList: true, subtree: true};        var insertCriteoBanner = function () {            criteoEl.id += Math.floor(Math.random() * 1000000);            var observer = new MutationObserver(function (mutations) {                mutations.forEach(function () {                    criteoEl.style.width = width + \\"px\\";                    criteoEl.style.height = height + \\"px\\";                    criteoEl.style.marginTop = \\"10px\\";                    criteoEl.style.marginBottom = \\"10px\\";                    observer.disconnect();                });            });            observer.observe(criteoEl, mutationConf);            setTimeout(function(){ observer.disconnect(); }, mutationTimeout);            Criteo.events.push(function () {                Criteo.DisplayAcceptableAdIfAdblocked({                    \\"zoneid\\": zoneid,                    \\"containerid\\": criteoEl.id,                    \\"overrideZoneFloor\\": true                });            });        };        if (domReady != undefined && domReady != \'\' && domReady) {            if (typeof document.addEventListener !== \'undefined\') {                document.addEventListener(\\"DOMContentLoaded\\", insertCriteoBanner);            } else {                window.attachEvent(\\"onload\\", insertCriteoBanner);            }        } else {            insertCriteoBanner();        }    })();</script>\"}]';
  this.positions_weighted['right010'] = false;
  
  this.positions['right030'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'1681079\';                    break;                case \'mobile\':                    zoneForDevice = \'${adv_zone_id_for_mobile}\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['right030'] = false;
  
  this.positions['right020'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum a8a263be\\" data-adsv-name=\\"\\"></div><script>var insertedElement = document.getElementById(\'ctstemp\');var zoneForDevice = \'\';var dataAdsvName = \'\';if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            zoneForDevice = \'5265755\';            dataAdsvName = \'${adverticum_name}\';            break;        case \'mobile\':            zoneForDevice = \'3617867\';            dataAdsvName = \'mobil_waterfall2\';            break;        case \'tablet\':            zoneForDevice = \'${adv_zone_id_for_tablet}\';            dataAdsvName = \'${adverticum_name_tablet}\';            if(dataAdsvName == \\"\\"){                dataAdsvName = \'${adverticum_name}\';            }            break;    }}if (zoneForDevice == \'\') {    insertedElement.parentNode.removeChild(insertedElement);} else {    insertedElement.setAttribute(\'data-adsv-name\', dataAdsvName);    insertedElement.id = \'zone\' + zoneForDevice;}</script>\"}, {\"service_name\": \"Sanoma/WellnessCafe\", \"weight\": null, \"source\": \"<script>    var defADXw = 600;    var elemWcheck = \'\';    if (document.getElementsByClassName(\'inner-container\').length > 0) {        elemWcheck = properADXw = document.getElementsByClassName(\'inner-container\')[0];    } else if (document.getElementsByClassName(\'article-lister\').length > 0) {        elemWcheck = document.getElementsByClassName(\'article-lister\')[0];    }    if (typeof elemWcheck === \'object\' && defADXw > elemWcheck.offsetWidth > 0) {        var ADXBannerWidth = elemWcheck.offsetWidth;    }    elemWcheck = undefined;    defADXw = undefined;</script>\"}, {\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div id=\\"ctsGadxTemp\\" class=\\"ctsGadx\\" style=\\"display:table;margin:0 auto; margin-bottom: 20px;\\"></div><script type=\\"text/javascript\\">    var slotForDevice = \'\';    var gadxErr = false;    var dimensionForDevice = {        width: parseInt(300),        height: parseInt(125)    };    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {            case \'desktop\':                slotForDevice = \'5472801266\';                break;            case \'mobile\':                slotForDevice = \'${google_adx_slot_default_for_mobile}\';                dimensionForDevice.width = 300;                dimensionForDevice.height = 250;                break;            case \'tablet\':                if (\'${google_adx_slot_default_for_tablet}\' != \'\') {                    slotForDevice = \'${google_adx_slot_default_for_tablet}\';                } else {                    slotForDevice = \'5472801266\';                }                break;        }        try {        } catch(err) {            gadxErr = true;        }    }    if ((typeof noADX == \'undefined\' || noADX === false) && slotForDevice != \'\') {        var advParts = {};        var gadxDiv = document.getElementById(\'ctsGadxTemp\');        advParts.initScript = document.createElement(\'script\');        advParts.initScript.src = \'//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\';        advParts.initScript.async = \'true\';        advParts.body = document.createElement(\'ins\');        advParts.body.className = \'adsbygoogle\';        advParts.body.style.display = \'table\';        advParts.body.style.margin = \'0 auto\';        advParts.body.style.width = dimensionForDevice.width + \'px\';        advParts.body.style.height = dimensionForDevice.height + \'px\';        advParts.body.setAttribute(\'data-ad-client\',\'ca-pub-8962558862962174\');        advParts.body.setAttribute(\'data-ad-slot\', slotForDevice);        advParts.body.setAttribute(\'data-max-num-ads\', parseInt(1));        if (typeof \'${google_ad_page_url}\' !== \'undefined\' && \'${google_ad_page_url}\' != \'\') {            advParts.body.setAttribute(\'data-page-url\', \'${google_ad_page_url}\');        }        gadxDiv.appendChild(advParts.initScript);        gadxDiv.appendChild(advParts.body);        (adsbygoogle = window.adsbygoogle || []).push({});        gadxDiv.removeAttribute(\'id\');    } else {        var adxElement = document.getElementById(\'ctsGadxTemp\');        adxElement.parentNode.removeChild(adxElement);    }</script>\"}]';
  this.positions_weighted['right020'] = false;
  
  this.positions['right040'] = '[{\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div id=\\"ctsGadxTemp\\" class=\\"ctsGadx\\" style=\\"display:table;margin:0 auto;\\"></div><script type=\\"text/javascript\\">    var slotForDevice = \'\';    var gadxErr = false;    var dimensionForDevice = {        width: parseInt(300),        height: parseInt(250)    };    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {            case \'desktop\':                slotForDevice = \'5392076063\';                break;            case \'mobile\':                slotForDevice = \'${google_adx_slot_default_for_mobile}\';                dimensionForDevice.width = 300;                dimensionForDevice.height = 250;                break;            case \'tablet\':                if (\'${google_adx_slot_default_for_tablet}\' != \'\') {                    slotForDevice = \'${google_adx_slot_default_for_tablet}\';                } else {                    slotForDevice = \'5392076063\';                }                break;        }        try {        } catch(err) {            gadxErr = true;        }    }    if ((typeof noADX == \'undefined\' || noADX === false) && slotForDevice != \'\') {        var advParts = {};        var gadxDiv = document.getElementById(\'ctsGadxTemp\');        advParts.initScript = document.createElement(\'script\');        advParts.initScript.src = \'//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\';        advParts.initScript.async = \'true\';        advParts.body = document.createElement(\'ins\');        advParts.body.className = \'adsbygoogle\';        advParts.body.style.display = \'table\';        advParts.body.style.margin = \'0 auto\';        advParts.body.style.width = dimensionForDevice.width + \'px\';        advParts.body.style.height = dimensionForDevice.height + \'px\';        advParts.body.setAttribute(\'data-ad-client\',\'ca-pub-8962558862962174\');        advParts.body.setAttribute(\'data-ad-slot\', slotForDevice);        advParts.body.setAttribute(\'data-max-num-ads\', parseInt(1));        if (typeof \'${google_ad_page_url}\' !== \'undefined\' && \'${google_ad_page_url}\' != \'\') {            advParts.body.setAttribute(\'data-page-url\', \'${google_ad_page_url}\');        }        gadxDiv.appendChild(advParts.initScript);        gadxDiv.appendChild(advParts.body);        (adsbygoogle = window.adsbygoogle || []).push({});        gadxDiv.removeAttribute(\'id\');    } else {        var adxElement = document.getElementById(\'ctsGadxTemp\');        adxElement.parentNode.removeChild(adxElement);    }</script>\"}]';
  this.positions_weighted['right040'] = false;
  
  this.positions['right050'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'1697846\';                    break;                case \'mobile\':                    zoneForDevice = \'${adv_zone_id_for_mobile}\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['right050'] = false;
  
  this.positions['right060'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'30731\';                    break;                case \'mobile\':                    zoneForDevice = \'${adv_zone_id_for_mobile}\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['right060'] = false;
  
  this.positions['right070'] = '[]';
  this.positions_weighted['right070'] = false;
  
  this.positions['right080'] = '[]';
  this.positions_weighted['right080'] = false;
  
  this.positions['right090'] = '[]';
  this.positions_weighted['right090'] = false;
  
  this.positions['toothbrush-handle'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'30737\';                    break;                case \'mobile\':                    zoneForDevice = \'${adv_zone_id_for_mobile}\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['toothbrush-handle'] = false;
  
  this.positions['toothbrush-head'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'30738\';                    break;                case \'mobile\':                    zoneForDevice = \'${adv_zone_id_for_mobile}\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['toothbrush-head'] = false;
  
  this.positions['content010'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum a8a263be\\" data-adsv-name=\\"\\"></div><script>var insertedElement = document.getElementById(\'ctstemp\');var zoneForDevice = \'\';var dataAdsvName = \'\';if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            zoneForDevice = \'25773\';            dataAdsvName = \'roadblock\';            break;        case \'mobile\':            zoneForDevice = \'${adv_zone_id_for_mobile}\';            dataAdsvName = \'${adverticum_name_mobile}\';            break;        case \'tablet\':            zoneForDevice = \'25773\';            dataAdsvName = \'${adverticum_name_tablet}\';            if(dataAdsvName == \\"\\"){                dataAdsvName = \'roadblock\';            }            break;    }}if (zoneForDevice == \'\') {    insertedElement.parentNode.removeChild(insertedElement);} else {    insertedElement.setAttribute(\'data-adsv-name\', dataAdsvName);    insertedElement.id = \'zone\' + zoneForDevice;}</script>\"}, {\"service_name\": \"Criteo\", \"weight\": null, \"source\": \"<div id=\\"criteoTPL\\"     style=\\"width:0px;height:0px;margin:0 auto;overflow:hidden;${custom_css}\\"></div><script type=\\"text/javascript\\">    (function () {        var zoneid = 1168295,            height = 250,            width = 300,            criteoEl = document.getElementById(\\"criteoTPL\\"),            domReady = \\"${criteo_dom_ready}\\",            mutationTimeout = 5000,            mutationConf = {attributes: true, childList: true, subtree: true};        var insertCriteoBanner = function () {            criteoEl.id += Math.floor(Math.random() * 1000000);            var observer = new MutationObserver(function (mutations) {                mutations.forEach(function () {                    criteoEl.style.width = width + \\"px\\";                    criteoEl.style.height = height + \\"px\\";                    criteoEl.style.marginTop = \\"10px\\";                    criteoEl.style.marginBottom = \\"10px\\";                    observer.disconnect();                });            });            observer.observe(criteoEl, mutationConf);            setTimeout(function(){ observer.disconnect(); }, mutationTimeout);            Criteo.events.push(function () {                Criteo.DisplayAcceptableAdIfAdblocked({                    \\"zoneid\\": zoneid,                    \\"containerid\\": criteoEl.id,                    \\"overrideZoneFloor\\": true                });            });        };        if (domReady != undefined && domReady != \'\' && domReady) {            if (typeof document.addEventListener !== \'undefined\') {                document.addEventListener(\\"DOMContentLoaded\\", insertCriteoBanner);            } else {                window.attachEvent(\\"onload\\", insertCriteoBanner);            }        } else {            insertCriteoBanner();        }    })();</script>\"}]';
  this.positions_weighted['content010'] = false;
  
  this.positions['content020'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum a8a263be\\" data-adsv-name=\\"\\"></div><script>var insertedElement = document.getElementById(\'ctstemp\');var zoneForDevice = \'\';var dataAdsvName = \'\';if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            zoneForDevice = \'${adv_zone_id_for_desktop}\';            dataAdsvName = \'${adverticum_name}\';            break;        case \'mobile\':            zoneForDevice = \'3617868\';            dataAdsvName = \'mobil_waterfall1\';            break;        case \'tablet\':            zoneForDevice = \'${adv_zone_id_for_tablet}\';            dataAdsvName = \'${adverticum_name_tablet}\';            if(dataAdsvName == \\"\\"){                dataAdsvName = \'${adverticum_name}\';            }            break;    }}if (zoneForDevice == \'\') {    insertedElement.parentNode.removeChild(insertedElement);} else {    insertedElement.setAttribute(\'data-adsv-name\', dataAdsvName);    insertedElement.id = \'zone\' + zoneForDevice;}</script>\"}]';
  this.positions_weighted['content020'] = false;
  
  this.positions['content030'] = '[{\"service_name\": \"Criteo\", \"weight\": null, \"source\": \"<div id=\\"criteoTPL\\"     style=\\"width:0px;height:0px;margin:0 auto;overflow:hidden;${custom_css}\\"></div><script type=\\"text/javascript\\">    (function () {        var zoneid = 1385752,            height = 360,            width = 640,            criteoEl = document.getElementById(\\"criteoTPL\\"),            domReady = \\"${criteo_dom_ready}\\",            mutationTimeout = 5000,            mutationConf = {attributes: true, childList: true, subtree: true};        var insertCriteoBanner = function () {            criteoEl.id += Math.floor(Math.random() * 1000000);            var observer = new MutationObserver(function (mutations) {                mutations.forEach(function () {                    criteoEl.style.width = width + \\"px\\";                    criteoEl.style.height = height + \\"px\\";                    criteoEl.style.marginTop = \\"10px\\";                    criteoEl.style.marginBottom = \\"10px\\";                    observer.disconnect();                });            });            observer.observe(criteoEl, mutationConf);            setTimeout(function(){ observer.disconnect(); }, mutationTimeout);            Criteo.events.push(function () {                Criteo.DisplayAcceptableAdIfAdblocked({                    \\"zoneid\\": zoneid,                    \\"containerid\\": criteoEl.id,                    \\"overrideZoneFloor\\": true                });            });        };        if (domReady != undefined && domReady != \'\' && domReady) {            if (typeof document.addEventListener !== \'undefined\') {                document.addEventListener(\\"DOMContentLoaded\\", insertCriteoBanner);            } else {                window.attachEvent(\\"onload\\", insertCriteoBanner);            }        } else {            insertCriteoBanner();        }    })();</script>\"}]';
  this.positions_weighted['content030'] = false;
  
  this.positions['content040'] = '[]';
  this.positions_weighted['content040'] = false;
  
  this.positions['content050'] = '[{\"service_name\": \"Rubicon\", \"weight\": null, \"source\": \"<div id=\\"RubiconAdTemp\\" class=\\"rubAd\\" style=\\"width: 100%;text-align: center;${custom_css}\\"><script language=\\"JavaScript\\" type=\\"text/javascript\\">        var rubiconZoneSize = \'\';        var rubiconSite = \'65952\';        var rubiconSiteMobile = \'90784\';        var rubiconAdType = \'${rubicon_ad_type}\';        var tplElement = document.getElementById(\\"RubiconAdTemp\\");        var advParts = {};        var insertedGoogle = false;        if(rubiconAdType == \'\'){            rubiconAdType = \'js\';        }        if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {            switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    rubiconZoneSize = \'613292-198\';                    break;                case \'mobile\':                    rubiconZoneSize = \'773080-15\';                    rubiconZoneSize = rubiconZoneSize.split(\'-\')[0]+\'-15\';                    break;                case \'tablet\':                    rubiconZoneSize = \'${rubicon_ad_zone_tablet}\';                    if(rubiconZoneSize == \'\'){                        rubiconZoneSize = \'613292-198\';                    }                    break;            }            if(_ceDeviceDetect.getDeviceType() != \'desktop\' && rubiconSiteMobile != undefined && rubiconSiteMobile != \'\' && rubiconSiteMobile != \'undefined\'){                rubiconSite = rubiconSiteMobile;            }            if(navigator.userAgent.toLowerCase().indexOf(\\"ipad\\") !== -1 && navigator.userAgent.toLowerCase().indexOf(\\"iphone\\") === -1){                insertedGoogle = true;                advParts.initScript = document.createElement(\'script\');                advParts.initScript.src = \'//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\';                advParts.initScript.async = \'true\';                advParts.body = document.createElement(\'ins\');                advParts.body.className = \'adsbygoogle\';                advParts.body.style = \\"display:inline-block;min-width:320px;max-width:1200px;width:100%;height:200px\\";                advParts.body.setAttribute(\'data-ad-client\',\'ca-pub-8962558862962174\');                advParts.body.setAttribute(\'data-ad-slot\', \'5920657040\');                tplElement.appendChild(advParts.initScript);                tplElement.appendChild(advParts.body);                (adsbygoogle = window.adsbygoogle || []).push({});                tplElement.removeAttribute(\'id\');            }        }        if(!insertedGoogle){            if ((typeof noRUBICON == \'undefined\' || noRUBICON === false) && rubiconZoneSize.split(\'-\')[0] != \'\') {                rp_account   = \'13818\';                rp_site      = rubiconSite;                rp_zonesize  = rubiconZoneSize;                rp_adtype    = rubiconAdType;                tplElement.removeAttribute(\'id\');            }else{                tplElement.remove();            }        }    </script><script type=\\"text/javascript\\" src=\\"//ads.rubiconproject.com/ad/13818.js\\"></script></div>\"}, {\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div id=\\"cts_content_recomm\\" class=\\"ctsGadx\\"     style=\\"display:block;margin-top:30px;margin-bottom:30px;${custom_css}\\"></div><script type=\\"text/javascript\\">(function () {    var slotForDevice = {            desktop: \'1408272869\',            mobile: \'2497685038\',            tablet: \'2497685038\'        },        recommDiv = document.getElementById(\'cts_content_recomm\'),        slot = \'\',        parameter = \'\',        googleUniqueParameters = {            desktop: \'{\\"style\\":\\"display:block;width:620px;\\"}\',            mobile: \'{\\"data-matched-content-rows-num\\": \\"12,6\\", \\"data-matched-content-columns-num\\": \\"1,2\\", \\"data-matched-content-ui-type\\": \\"image_sidebyside,image_sidebyside\\"}\',            tablet: \'{\\"data-matched-content-rows-num\\": \\"12,6\\", \\"data-matched-content-columns-num\\": \\"1,2\\", \\"data-matched-content-ui-type\\": \\"image_sidebyside,image_sidebyside\\"}\'        };        if(typeof localStorage.A42A6Cblck != \'undefined\' && JSON.parse(localStorage.A42A6Cblck).bl == 1){            recommDiv.parentNode.removeChild(recommDiv);        }else{            if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {                switch (_ceDeviceDetect.getDeviceType()) {                    case \'desktop\':                        slot = slotForDevice.desktop;                        parameter = googleUniqueParameters.desktop;                        break;                    case \'mobile\':                        slot = slotForDevice.mobile;                        parameter = googleUniqueParameters.mobile;                        if(slot == \'\'){                            slot = slotForDevice.desktop;                        }                        break;                    case \'tablet\':                        slot = slotForDevice.mobile;                        parameter = googleUniqueParameters.mobile;                        if(slot == \'\'){                            slot = slotForDevice.desktop;                        }                        break;                }            }            if ((typeof noADX == \'undefined\' || noADX === false) && slot != \'\') {                var advParts = {};                advParts.initScript = document.createElement(\'script\');                advParts.initScript.src = \'//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\';                advParts.initScript.async = \'true\';                advParts.body = document.createElement(\'ins\');                advParts.body.className = \'adsbygoogle\';                advParts.body.style.display = \'block\';                advParts.body.setAttribute(\'data-ad-format\', \'autorelaxed\');                advParts.body.setAttribute(\'data-ad-client\', \'ca-pub-8962558862962174\');                advParts.body.setAttribute(\'data-ad-slot\', slot);                try{                    parameter = JSON.parse(parameter);                    for (var key in parameter) {                        if (parameter.hasOwnProperty(key)) {                            advParts.body.setAttribute(key, parameter[key]);                        }                    }                }catch (e){                }                recommDiv.appendChild(advParts.initScript);                recommDiv.appendChild(advParts.body);                (adsbygoogle = window.adsbygoogle || []).push({});                recommDiv.removeAttribute(\'id\');            } else {                recommDiv.parentNode.removeChild(recommDiv);            }        }})();</script>\"}, {\"service_name\": \"Strossle\", \"weight\": null, \"source\": \"<div id=\\"strossle-widget-widget-5a968fd46367a\\" class=\\"wpb_widget _ce_measure_widget\\" data-ce-measure-widget=\\"Strossle\\"></div><script type=\\"text/javascript\\">var strossle_element = document.getElementById(\\"strossle-widget-widget-5a968fd46367a\\");var strossle_exceptions = \'${strossle_widget_exceptions}\';strossle_exceptions = strossle_exceptions.replace(\\" \\", \\"\\");strossle_exceptions = strossle_exceptions.split(\\",\\");var strossle_enabled = true;if(strossle_exceptions != \\"\\") {    for (var i = 0; i < strossle_exceptions.length; i++) {        if (window.location.search.indexOf(strossle_exceptions[i]) != -1) {            strossle_enabled = false;            strossle_element.remove();        }    }}if(strossle_enabled && (typeof localStorage.A42A6Cblck != \'undefined\' && JSON.parse(localStorage.A42A6Cblck).bl == 1)){    strossle_element.setAttribute(\\"data-spklw-widget\\", \\"widget-5a968fd46367a\\");    strossle_element.setAttribute(\\"style\\", \\"${strossle_style}\\");}else{    strossle_element.remove();}</script>\"}]';
  this.positions_weighted['content050'] = false;
  
  this.positions['content060'] = '[{\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div id=\\"ctsGadxTemp\\" class=\\"ctsGadx\\" style=\\"width:100%;text-align: center;margin-top:15px;display:inline-block;${custom_css}\\"></div><script>var slotForDevice = \'\';var gadxErr = false;var dimensionForDevice = {    width: parseInt(600),    mobileWidth: parseInt(360),    minWidth: parseInt(${google_ad_min_width}),    height: parseInt(200),    mobileHeight: parseInt(266)};if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            slotForDevice = \'9674834069\';            break;        case \'mobile\':            slotForDevice = \'5645056738\';            dimensionForDevice.width = 300;            dimensionForDevice.minWidth = 300;            dimensionForDevice.height = 250;            if (!isNaN(dimensionForDevice.mobileWidth)) {                dimensionForDevice.width = dimensionForDevice.mobileWidth;            }            if (!isNaN(dimensionForDevice.mobileHeight)) {                dimensionForDevice.height = dimensionForDevice.mobileHeight;            }            break;        case \'tablet\':            if (\'${google_adx_slot_default_for_tablet}\' != \'\') {                slotForDevice = \'${google_adx_slot_default_for_tablet}\';            } else {                slotForDevice = \'9674834069\';            }            break;    }}if ((typeof noADX == \'undefined\' || noADX === false) && slotForDevice != \'\') {    var advParts = {};    var gadxDiv = document.getElementById(\'ctsGadxTemp\');    advParts.initScript = document.createElement(\'script\');    advParts.initScript.src = \'//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\';    advParts.initScript.async = \'true\';    advParts.body = document.createElement(\'ins\');    advParts.body.className = \'adsbygoogle\';    advParts.body.style.display = \'inline-block\';        advParts.body.style.height = dimensionForDevice.height + \'px\';        if(!isNaN(dimensionForDevice.minWidth) && !isNaN(dimensionForDevice.width)){        advParts.body.style.maxWidth = dimensionForDevice.width + \'px\';        advParts.body.style.minWidth = dimensionForDevice.minWidth + \'px\';        advParts.body.style.width = \'100%\';    }else{        advParts.body.style.width = dimensionForDevice.width + \'px\';    }        advParts.body.setAttribute(\'data-ad-client\', \'ca-pub-8962558862962174\');    advParts.body.setAttribute(\'data-ad-slot\', slotForDevice);    advParts.body.setAttribute(\'data-max-num-ads\', parseInt(1));    if (typeof \'${google_ad_page_url}\' !== \'undefined\' && \'${google_ad_page_url}\' != \'\') {        advParts.body.setAttribute(\'data-page-url\', \'${google_ad_page_url}\');    }    gadxDiv.appendChild(advParts.initScript);    gadxDiv.appendChild(advParts.body);    (adsbygoogle = window.adsbygoogle || []).push({});    gadxDiv.removeAttribute(\'id\');} else {    var adxElement = document.getElementById(\'ctsGadxTemp\');    adxElement.parentNode.removeChild(adxElement);}</script>\"}, {\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum a8a263be\\" data-adsv-name=\\"\\"></div><script>var insertedElement = document.getElementById(\'ctstemp\');var zoneForDevice = \'\';var dataAdsvName = \'\';if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {    switch (_ceDeviceDetect.getDeviceType()) {        case \'desktop\':            zoneForDevice = \'${adv_zone_id_for_desktop}\';            dataAdsvName = \'${adverticum_name}\';            break;        case \'mobile\':            zoneForDevice = \'3617869\';            dataAdsvName = \'mobil_waterfall2\';            break;        case \'tablet\':            zoneForDevice = \'${adv_zone_id_for_tablet}\';            dataAdsvName = \'${adverticum_name_tablet}\';            if(dataAdsvName == \\"\\"){                dataAdsvName = \'${adverticum_name}\';            }            break;    }}if (zoneForDevice == \'\') {    insertedElement.parentNode.removeChild(insertedElement);} else {    insertedElement.setAttribute(\'data-adsv-name\', dataAdsvName);    insertedElement.id = \'zone\' + zoneForDevice;}</script>\"}]';
  this.positions_weighted['content060'] = false;
  
  this.positions['right100'] = '[]';
  this.positions_weighted['right100'] = false;
  
  this.positions['page-end010'] = '[{\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div id=\\"ctsGadxTemp\\" class=\\"ctsGadx\\" style=\\"display:table;margin:0 auto;\\"></div><script type=\\"text/javascript\\">    var slotForDevice = \'\';    var gadxErr = false;    var dimensionForDevice = {        width: parseInt(300),        height: parseInt(250)    };    if (typeof ADXBannerWidth !== \'undefined\') {        dimensionForDevice.width = ADXBannerWidth;    }    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {            case \'desktop\':                slotForDevice = \'${google_adx_slot_default_for_desktop}\';                break;            case \'mobile\':                slotForDevice = \'6305136864\';                dimensionForDevice.width = 300;                dimensionForDevice.height = 250;                break;            case \'tablet\':                if (\'${google_adx_slot_default_for_tablet}\' != \'\') {                    slotForDevice = \'${google_adx_slot_default_for_tablet}\';                } else {                    slotForDevice = \'${google_adx_slot_default_for_desktop}\';                }                break;        }    }    if ((typeof noADX == \'undefined\' || noADX === false) && slotForDevice != \'\') {        var advParts = {};        var gadxDiv = document.getElementById(\'ctsGadxTemp\');        advParts.initScript = document.createElement(\'script\');        advParts.initScript.src = \'//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\';        advParts.initScript.async = \'true\';        advParts.body = document.createElement(\'ins\');        advParts.body.className = \'adsbygoogle\';        advParts.body.style.display = \'table\';        advParts.body.style.margin = \'0 auto\';        advParts.body.style.width = dimensionForDevice.width + \'px\';        advParts.body.style.height = dimensionForDevice.height + \'px\';        advParts.body.setAttribute(\'data-ad-client\',\'ca-pub-8962558862962174\');        advParts.body.setAttribute(\'data-ad-slot\', slotForDevice);        advParts.body.setAttribute(\'data-max-num-ads\', parseInt(1));        if (typeof \'${google_ad_page_url}\' !== \'undefined\' && \'${google_ad_page_url}\' != \'\') {            advParts.body.setAttribute(\'data-page-url\', \'${google_ad_page_url}\');        }        gadxDiv.appendChild(advParts.initScript);        gadxDiv.appendChild(advParts.body);        (adsbygoogle = window.adsbygoogle || []).push({});        gadxDiv.removeAttribute(\'id\');    } else {        var adxElement = document.getElementById(\'ctsGadxTemp\');        adxElement.parentNode.removeChild(adxElement);    }</script>\"}]';
  this.positions_weighted['page-end010'] = false;
  
  this.positions['list-content010'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<div id=\\"ctstemp\\" class=\\"goAdverticum\\"></div><script>    var insertedElement = document.getElementById(\'ctstemp\');    var zoneForDevice = \'\';    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {                case \'desktop\':                    zoneForDevice = \'${adv_zone_id_for_desktop}\';                    break;                case \'mobile\':                    zoneForDevice = \'3617865\';                    break;                case \'tablet\':                    zoneForDevice = \'${adv_zone_id_for_tablet}\';                    break;        }    }    if (zoneForDevice == \'\') {\tinsertedElement.parentNode.removeChild(insertedElement);    } else {        insertedElement.id = \'zone\' + zoneForDevice;    }</script>\"}]';
  this.positions_weighted['list-content010'] = false;
  
  this.positions['right015'] = '[]';
  this.positions_weighted['right015'] = false;
}

Tagging.prototype.get_json = function(text) {
  return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, '')))
         && eval('(' + text + ')');
}

Tagging.prototype.random_tag = function(position) {
  var tags = [];
  var weighted_tags = [];

  for (index in position) {
    tag = position[index];
    tags[index] = tag.source;

    for (var i = 0; i < tag.weight; i++) {
      weighted_tags.push(index);
    }
  }

  // Pick a random tag from array based on weight
  var random_index = weighted_tags[Math.floor((Math.random() * weighted_tags.length))];
  return tags[random_index];
}

Tagging.prototype.all_tags = function(position) {
  var tags = [], index, tag;
  for (index in position) {
    tag = position[index];
    tags[index] = tag.source;
  }
  return tags.join("\n");
}

Tagging.prototype.render = function(slug, context) {
    document.write(this.get_source(slug, context));
}

Tagging.prototype.get_source = function(slug, context) {
  if (typeof this.positions[slug] == 'undefined') {
    // This position doesn't exist, call the autodetect
    this._detect(slug);
  } else {
    var position = this.get_json(this.positions[slug]);
    var tag_source = "";

    if (this.positions_weighted[slug]) {
      tag_source = this.random_tag(position)
    } else {
      tag_source = this.all_tags(position);
    }

    // Replace variables
    var variables = {};
    for (variable in this.context) {
      variables[variable] = this.context[variable];
    }
    for (variable in context) {
      variables[variable] = context[variable];
    }
    tag_source = this._replace_variables(tag_source, variables);

    // Remove unset variables and return result
    return tag_source.replace(/\$\w+/g, "").replace(/\${\w+}/g, "");
  }
  return '';
}

Tagging.prototype.log = function(err) {
  //this._load(error_endpoint);
}

Tagging.prototype._load = function(url) {
  var head = document.getElementsByTagName('head')[0] || document.documentElement,
      script = document.createElement('script');

  script.type = 'text/javascript';
  script.src = url;
  head.appendChild(script);
}

Tagging.prototype._detect = function(position) {
  this._load(this.autodetect_url + this.site +'/'+ this.zone +'/' + position + '/');
}

Tagging.prototype._replace_variables = function(content, variables) {
  var RE_VALID_IDENT = /^[a-zA-Z_]\w*$/;
  for (variable in variables) {
    if (RE_VALID_IDENT.test(variable)) {
      var regexes = [new RegExp('\\$' + variable, 'g'), new RegExp('\\${' + variable + '}', 'g')];

      for (re in regexes) {
        content = content.replace(regexes[re], variables[variable]);
      }
    } else {
      throw "'" + variable + "' is not a valid identifier.";
    }
  }
  return content;
}



