Tagging = function(context) {
  this.site = 'kiderul';
  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}\' : \'nFfqmACF40YIJ.iwoW8v0rbt.GNwfxfPIqKgjSfTg77.p7\');        if(typeof _ceDeviceDetect.getDeviceType() !== \'undefined\' && _ceDeviceDetect.getDeviceType() != \'desktop\' && \'nFfqmACF40YIJ.iwoW8v0rbt.GNwfxfPIqKgjSfTg77.p7\' != \'\') {        properGemId = \'nFfqmACF40YIJ.iwoW8v0rbt.GNwfxfPIqKgjSfTg77.p7\';    }       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\": \"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>\"}]';
  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-PKCJLC\\"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-PKCJLC\');</script>\"}]';
  this.positions_weighted['body-start'] = false;
  
  this.positions['body-end'] = '[{\"service_name\": \"Sanoma/Startlap Kiderul\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\" src=\\"//stat.p24.hu/CTS/measuring-codes/kiderul/measuringCode.min.js\\"></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\": \"Google Adverts\", \"weight\": null, \"source\": \"<script type=\\"text/javascript\\">    (function(){        var googleCPLink = (\\"${google_cookie_policy_link}\\" != \\"\\") ? \\"${google_cookie_policy_link}\\" : \\"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'] = '[]';
  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 = \'1655616\';            dataAdsvName = \'top\';            break;        case \'mobile\':            zoneForDevice = \'5127244\';            dataAdsvName = \'${adverticum_name_mobile}\';            break;        case \'tablet\':            zoneForDevice = \'1655616\';            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>\"}]';
  this.positions_weighted['top'] = 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 = \'3879424\';                    break;                case \'mobile\':                    zoneForDevice = \'5277895\';                    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['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 = \'2008450\';            dataAdsvName = \'box1\';            break;        case \'mobile\':            zoneForDevice = \'${adv_zone_id_for_mobile}\';            dataAdsvName = \'${adverticum_name_mobile}\';            break;        case \'tablet\':            zoneForDevice = \'2008450\';            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>\"}]';
  this.positions_weighted['right010'] = false;
  
  this.positions['right020'] = '[]';
  this.positions_weighted['right020'] = false;
  
  this.positions['right030'] = '[{\"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 = \'65956\';        var rubiconSiteMobile = \'81610\';        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 = \'1298526-10\';                    break;                case \'mobile\':                    rubiconZoneSize = \'${rubicon_ad_zone_mobile}\';                    rubiconZoneSize = rubiconZoneSize.split(\'-\')[0]+\'-15\';                    break;                case \'tablet\':                    rubiconZoneSize = \'${rubicon_ad_zone_tablet}\';                    if(rubiconZoneSize == \'\'){                        rubiconZoneSize = \'1298526-10\';                    }                    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>\"}]';
  this.positions_weighted['right030'] = false;
  
  this.positions['right040'] = '[]';
  this.positions_weighted['right040'] = false;
  
  this.positions['right050'] = '[]';
  this.positions_weighted['right050'] = false;
  
  this.positions['bottom'] = '[{\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div style=\\"text-align: right; font-size: 8px; color: #C6C6C6; margin: 0 auto;\\">HIRDET&#xC9;S</div><div id=\\"ctsGadxTemp\\" class=\\"ctsGadx\\" style=\\"${google_adx_style}\\"></div><script type=\\"text/javascript\\">    var slotForDevice = \'\';    var gadxErr = false;    var dimensionForDevice = {        width: parseInt(970) || 0,        height: parseInt(90) || 0    };    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {            case \'desktop\':                slotForDevice = \'5087302463\';                break;            case \'mobile\':                slotForDevice = \'${google_adx_slot_default_for_mobile}\';                dimensionForDevice.width = 300;                dimensionForDevice.height = 250;                if (\'${google_ad_width_mobile}\'.length > 0 && \'${google_ad_height_mobile}\'.length > 0) {                    dimensionForDevice.width = parseInt(${google_ad_width_mobile});                    dimensionForDevice.height = parseInt(${google_ad_height_mobile});                }                break;            case \'tablet\':                if (\'5087302463\' != \'\') {                    slotForDevice = \'5087302463\';                } else {                    slotForDevice = \'5087302463\';                }                break;        }        try {        } catch(err) {            gadxErr = true;        }    }    if ((typeof noADX == \'undefined\' || noADX === false) && slotForDevice != \'\' && dimensionForDevice.width > 0 && dimensionForDevice.height > 0) {        var advParts = {};        var gadxDiv = document.getElementById(\'ctsGadxTemp\');        gadxDiv.previousSibling.style.width = dimensionForDevice.width + \'px\';        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) || 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.previousSibling);        adxElement.parentNode.removeChild(adxElement);    }</script>\"}]';
  this.positions_weighted['bottom'] = false;
  
  this.positions['list-content030'] = '[{\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<script async src=\\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\\"></script><div><ins class=\\"adsbygoogle\\"         style=\\"display:block;margin:0 auto;display: table;;width:100%;height:290px;max-width:380px;min-width:250px;\\"         data-ad-client=\\"ca-pub-8962558862962174\\"         data-ad-slot=\\"3830895261\\"         data-max-num-ads =1></ins></div><script>    if (typeof noADX == \'undefined\' || noADX === false) {        (adsbygoogle = window.adsbygoogle || []).push({});    }</script>\"}]';
  this.positions_weighted['list-content030'] = false;
  
  this.positions['content-bottom'] = '[{\"service_name\": \"Rubicon\", \"weight\": null, \"source\": \"<div id=\\"RubiconAdTemp\\" class=\\"rubAd\\" style=\\"width: 100%;text-align: center;margin-top:10px;margin-bottom:10px;\\"><script language=\\"JavaScript\\" type=\\"text/javascript\\">        var rubiconZoneSize = \'\';        var rubiconSite = \'65956\';        var rubiconSiteMobile = \'81610\';        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 = \'${rubicon_ad_zone_desktop}\';                    break;                case \'mobile\':                    rubiconZoneSize = \'1303080-15\';                    rubiconZoneSize = rubiconZoneSize.split(\'-\')[0]+\'-15\';                    break;                case \'tablet\':                    rubiconZoneSize = \'${rubicon_ad_zone_tablet}\';                    if(rubiconZoneSize == \'\'){                        rubiconZoneSize = \'${rubicon_ad_zone_desktop}\';                    }                    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;margin-top:10px;margin-bottom:10px;\\"></div><script type=\\"text/javascript\\">    (function () {        var slotForDevice = {                desktop: \'9591304463\',                mobile: \'2344443305\',                tablet: \'2344443305\'            },            recommDiv = document.getElementById(\'cts_content_recomm\'),            slot = \'\',            parameter = \'\',            googleUniqueParameters = {                desktop: \'${google_recomm_unique_parameters}\',                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 _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\": \"Sanoma/Startlap Kiderul\", \"weight\": null, \"source\": \"<script>\tvar defADXw = 790;\tvar elemWcheck = null;\tvar ADXBannerWidth = null;\t\tif (document.getElementsByClassName(\'content\')[0] != undefined) {\t\telemWcheck = document.getElementsByClassName(\'content\')[0];\t}\tif (elemWcheck.offsetWidth <= defADXw) {\t\tADXBannerWidth = elemWcheck.offsetWidth;\t}else{\t\tADXBannerWidth = defADXw;\t}</script>\"}, {\"service_name\": \"Google Adverts\", \"weight\": null, \"source\": \"<div id=\\"ctsGadxTemp\\" class=\\"ctsGadx\\" style=\\"margin-top: 15px;\\"></div><script type=\\"text/javascript\\">    var slotForDevice = \'\';    var gadxErr = false;    var dimensionForDevice = {        width: parseInt(790),        height: parseInt(224)    };    if (typeof ADXBannerWidth !== \'undefined\') {        dimensionForDevice.width = ADXBannerWidth;    }    if (typeof _ceDeviceDetect.getDeviceType() !== \'undefined\') {        switch (_ceDeviceDetect.getDeviceType()) {            case \'desktop\':                slotForDevice = \'1333007660\';                break;            case \'mobile\':                slotForDevice = \'1333007660\';                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 = \'1333007660\';                }                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['content-bottom'] = false;
  
  this.positions['humanmet-box'] = '[{\"service_name\": \"Adverticum AdServer\", \"weight\": null, \"source\": \"<!-- Goa3: 4395907 --><div id=\\"zone4395907\\" class=\\"goAdverticum\\"></div>\"}]';
  this.positions_weighted['humanmet-box'] = 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;
}



