var IndexStatHandler={js_version:"3.0",device:null,caller_pool:[],need_ident:!1,ident_code:null,ident_tries:0,max_ident_tries:10,ident_timeout:null,has_ident_by_default:!0,getRawCookie:function(e){var t,n,i,d=document.cookie.split(";");for(t=0;t<d.length;t++)if(n=d[t].substr(0,d[t].indexOf("=")),i=d[t].substr(d[t].indexOf("=")+1),(n=n.replace(/^\s+|\s+$/g,""))==e)return decodeURI(i);return null},setCookie:function(e,t,n){var i="",d=window.location.host.split(".");d.length>2&&d.shift();var a="; domain=."+d.join(".");if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),i="; expires="+l.toUTCString()}document.cookie=e+"="+t+a+i+"; path=/"},saveIdent:function(e){IndexStatHandler.setCookie("ident",e,14),IndexStatHandler.ident_code=e,IndexStatHandler.processQueueForIdent()},getIdent:function(){if(IndexStatHandler.need_ident&&null==IndexStatHandler.ident_code){if(IndexStatHandler.has_ident_by_default){if(IndexStatHandler.ident_tries<=IndexStatHandler.max_ident_tries){var e=IndexStatHandler.getRawCookie("ident");e?(IndexStatHandler.ident_code=e,IndexStatHandler.processQueueForIdent()):(IndexStatHandler.ident_tries++,IndexStatHandler.ident_timeout=setTimeout(function(){IndexStatHandler.getIdent()},2e3))}}else if(IndexStatHandler.ident_tries<=1){IndexStatHandler.ident_tries++;var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=document.location.protocol+"//management.ident.indapass.hu/management/getcookie?jsonp=IndexStatHandler.saveIdent";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)}}},getDevice:function(){!IndexStatHandler.device&&("undefined"!=typeof IndexStatConfig&&void 0!==IndexStatConfig.device&&("js"==IndexStatConfig.device&&"function"==typeof IndexStatConfig.device_callback?IndexStatHandler.device=IndexStatConfig.device_callback():IndexStatHandler.device=IndexStatConfig.device),IndexStatHandler.device||(IndexStatHandler.device="none"))},processQueueForIdent:function(){IndexStatHandler.need_ident&&null===IndexStatHandler.ident_code&&IndexStatHandler.getIdent();for(var e=0;e<IndexStatHandler.caller_pool.length;e++)IndexStatHandler.caller_pool[e].waitForIdent&&IndexStatHandler.caller_pool[e].start()},_init:function(){IndexStatHandler.need_ident="undefined"==typeof IndexStatConfig||void 0===IndexStatConfig.need_ident||!0===IndexStatConfig.need_ident,IndexStatHandler.need_ident&&("undefined"!=typeof IndexStatConfig&&!1===IndexStatConfig.has_ident_by_default&&(IndexStatHandler.has_ident_by_default=!1),"undefined"!=typeof IndexStatConfig&&void 0!==IndexStatConfig.forceIdent?IndexStatHandler.ident_code=IndexStatConfig.forceIdent:IndexStatHandler.ident_code=IndexStatHandler.getRawCookie("ident")),"object"==typeof window._indexstat&&window._indexstat.length&&IndexStatHandler.caller_pool.push(new IndexStatCaller(window._indexstat)),"undefined"!=typeof IndexStatConfig&&"object"==typeof IndexStatConfig.pixels&&IndexStatConfig.pixels.length&&IndexStatHandler.caller_pool.push(new IndexStatCaller(IndexStatConfig.pixels)),window._indexstat=this},push:function(e){IndexStatHandler.caller_pool.push(new IndexStatCaller(e))}};function IndexStatCaller(e){this.sent=!1,this.pixel_pool=[],this.deviceCalced=!1,this.waitForIdent=!1,this.calcDevicePixels=function(){if(!this.deviceCalced){if(IndexStatHandler.getDevice(),"none"!=IndexStatHandler.device){for(var e=[],t=0;t<this.pixel_pool.length;t++){var n=this.pixel_pool[t].getPixelByDevice();!1!=n&&e.push(n)}this.pixel_pool=this.pixel_pool.concat(e)}this.deviceCalced=!0}},this.push=function(e){if("object"==typeof e&&e.length){e[0].length&&void 0!==e[0][0].id&&(e=e[0]);for(var t=0;t<e.length;t++)void 0!==e[t].id&&void 0!==e[t].type&&this.pixel_pool.push(new IndexStatPixel(e[t].id,e[t].type))}},this.start=function(){this.pixel_pool.length&&(this.calcDevicePixels(),IndexStatHandler.need_ident&&null==IndexStatHandler.ident_code?(this.waitForIdent=!0,IndexStatHandler.getIdent()):(this.waitForIdent=!1,this.send()))},this.send=function(){if(!this.sent&&this.pixel_pool&&this.pixel_pool.length){var e=[];IndexStatHandler.need_ident&&null!==IndexStatHandler.ident_code?e.push("ident="+IndexStatHandler.ident_code):e.push("ident=0");for(var t=0;t<this.pixel_pool.length;t++){var n="pixels[]="+this.pixel_pool[t].id+"_"+this.pixel_pool[t].type;-1===e.indexOf(n)&&e.push(n)}var i="https://cimlap.blog.hu/"==document.location.href?"https://index.hu/i2":document.location.href;e.push("ui="+Math.floor(1e5*Math.random()+1)),e.push("url="+encodeURIComponent(i)),e.push("v="+IndexStatHandler.js_version);var d=document.createElement("img");d.height=1,d.width=1,d.src=document.location.protocol+"//indexstat.index.hu/pixel.php?"+e.join("&"),d.style.position="absolute",d.alt="pixel",document.body&&document.body.insertBefore(d,document.body.childNodes[0]),this.sent=!0}},this.push(e),this.start()}function IndexStatPixel(e,t){this.id=e,this.type=t,this.device_shift_value=50,this.desktop_shift=1,this.mobile_shift=2,this.tablet_shift=3,this.app_shift=4,this.getPixelByDevice=function(){var e;return e="mobile"==IndexStatHandler.device?this.type+this.device_shift_value*this.mobile_shift:"tablet"==IndexStatHandler.device?this.type+this.device_shift_value*this.tablet_shift:"app"==IndexStatHandler.device?this.type+this.device_shift_value*this.app_shift:this.type+this.device_shift_value*this.desktop_shift,new IndexStatPixel(this.id,e)}}IndexStatHandler._init();