var predicta=this.predicta||{};if(!predicta.PClick){(function(a,b){predicta.PClick=(function(){var o="PC-000004-A",p=30*1000;var m=true,k=b,c=3,j=("false"=="true")&&k,r=a.location.protocol+"//capture.pclicks.com:80/";function n(w){return Object.prototype.toString.call(w)=="[object Array]"}function t(w){return !!(w===""||(w&&w.charCodeAt&&w.substr))}var h=(function(){var y=(function(){function z(B,A){this.label=B;this.isAvailable=A.isAvailable;this.getUserBuckets=A.getUserBuckets}z.prototype.getBucketKey=function(A){return this.label+":"+A};z.prototype.toString=function(){return this.label};z.prototype.process=function(A){if(!this.isAvailable()){return}if(j){q("Source "+this.label+" available")}var C=this.getUserBuckets();if(!n(C)){w(this.label)}for(var B=0;B<C.length;B++){var D=C[B];if(!t(D)){w(this.label)}A.push(this.getBucketKey(D))}};return z})();function w(z){throw new Error("Invalid Source#getUserBuckets for source: "+z)}function x(){var B=new y("btbuckets",{isAvailable:function(){return window.$BTB&&window.$BTB.getAllUserBuckets},getUserBuckets:function(){return window.$BTB.getAllUserBuckets()}});var z=[B],C=[];if(j){q("Segmentation sources: "+z)}for(var A=0;A<z.length;A++){z[A].process(C)}if(j){q("Buckets extracted: "+(C.length>0?C:"[ ]"))}return{buckets:C}}return{process:x}})();var v=(function(M){M=(M||{});var w="eaagerdomcontentloaded",J=true,L=5*1000;var F=M.strategy||w,D=M.hideDocument||J,y=[];function C(N){N.className=N.className?N.className+" __pclicks_changed":"__pclicks_changed"}var E=(function(){function N(O){this._type=O}N.prototype.execute=function(){this.afterDOMReady()};return N})();var I=(function(){function P(Q){if(!Q.from||!Q.to){throw new Error("Invalid action args. Ignoring it")}this._args=Q;this.executed=false;if(j){q(this.toString())}}function O(T){var S=a.getElementsByTagName("A");for(var R=0;R<S.length;R++){var Q=S[R];if(Q.innerHTML.toLowerCase()===T.toLowerCase()){return Q}}}function N(R,Q){R.innerHTML=Q;C(R)}P.prototype=new E("LinkChangeAction");P.prototype.constructor=P;P.prototype.toString=function(){return this._type+" [ from: "+this._args.from+", to: "+this._args.to+" ]"};P.prototype.afterDOMReady=function(){if(j){q("Executing: "+this.toString())}var Q=O(this._args.from);if(Q){N(Q,this._args.to)}this.executed=true};P.prototype.elementReady=function(){return !!O(this._args.from)};return P})();var B=(function(){var O=function(){for(var U=0;U<y.length;U++){var T=y[U];if(T.executed){continue}y[U].execute()}if(D){A()}};var R=function(){var T=window.onload;window.onload=function(){if(T){T()}O()}};var S=function(U){if(a.addEventListener){a.addEventListener("DOMContentLoaded",function(){U()},false);return}a.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");var T=a.getElementById("__ie_onload");T.onreadystatechange=function(){if(this.readyState=="complete"){U()}}};var N=function(){S(O)};var P=function(){var V=function(){clearInterval(T);O()};var U=0;var T=setInterval(function(){for(var X=0;X<y.length;X++){var W=y[X];if(W.elementReady()){U++}}if(U==y.length){V()}});S(function(){if(j){q("DOM Loaded, cleaning eager load interval")}clearInterval(T);V()})};var Q=function(){var T=setInterval(function(){for(var U=0;U<y.length;U++){var V=y[U];if(V.elementReady()){V.execute()}}},10)};return{onload:R,domcontentloaded:N,eaagerdomcontentloaded:P}})();var H=function(R){for(var Q=0;Q<R.length;Q++){var T=R[Q];var O=T.type;var N=T.args;if(!O){continue}if(j){q("Registering a new DOMAction of type: "+O)}try{var S=new v.types[O](N);z(S)}catch(P){if(j){q(P,"WARNING")}}}};var x=function(){return window.__pclicks_actions&&n(__pclicks_actions)};var z=function(N){y.push(N)};var K=function(){a.write("<style>body { visibility: hidden; }</style>");setTimeout(function(){A()},L)};var A=function(){a.body.style.visibility="visible"};var G=function(){if(j){q("Processing actions execution queue with strategy: "+F+", hideDocument: "+D)}if(D){K()}B[F].call()};return{types:{LinkChangeAction:I},parse:H,hasActions:x,processExecutionQueue:G}})();if(v.hasActions()){v.parse(window.__pclicks_actions);v.processExecutionQueue()}else{if(j){q("No actions to execute")}}function q(w,x){if(!x){x="DEBUG"}k.log(x+": "+w)}function s(w,x){var y=[{name:"h",value:w.href},{name:"n",value:x.innerHTML},{name:"ti",value:w.title},{name:"nc",value:new Date().getTime()}];if(x.nodeName=="IMG"||x.nodeName=="img"){y.push({name:"i",value:x.src})}return y}function d(){setTimeout(function(){m=false;if(j){q("User is now inactive")}},p)}function e(w){if(m){return}m=true;u();d();if(j){q("User became active")}}function u(){new Image().src=r+"/keep?ts="+new Date().getTime()}function i(B,w){var z=r+o;for(var x=0;x<B.length;x++){var A=B[x];var y=encodeURIComponent(A.value);z=z+(!(x)?"?":"&")+A.name+"="+y}if(j){q("New request: "+z)}new Image().src=z}function g(D){var E;if(D==undefined){D=window.event;E=D.button;element=D.srcElement}else{E=D.which;element=null}if(E==0){if(j){q("No button pressed")}return}var z=l(D),A=!!z.length;var J=D.clientX,G=D.clientY,K=_documentBody.clientWidth!=undefined?_documentBody.clientWidth:window.innerWidth,C=_documentBody.clientHeight!=undefined?_documentBody.clientHeight:window.innerHeight,I=window.pageXOffset==undefined?_documentBody.scrollLeft:window.pageXOffset,F=window.pageYOffset==undefined?_documentBody.scrollTop:window.pageYOffset;if(J>K||G>C){if(j){q("Clicked out of the document")}return}if(j){q("Position | x: "+(J+I)+", y:"+(G+F)+", w:"+K+", h:"+C)}z.push({name:"x",value:(J+I)});z.push({name:"y",value:(G+F)});z.push({name:"he",value:C});z.push({name:"w",value:K});var H=h.process();var B=H.buckets;if(B.length>0){z.push({name:"b",value:B.toString()})}i(z,A)}function l(y){try{var x=originalTarget=y.target||y.srcElement;if(typeof x=="undefined"){return}if(j){q("Clicked on a tag: "+x.tagName)}for(var w=0;w<c;w++){if(typeof x.tagName!="undefined"&&x.tagName.toLowerCase()=="a"){if(j){q("New click on link")}return s(x,originalTarget)}if(typeof(x=x.parentNode)=="undefined"){break}}}catch(y){if(j){q(y.message,"ERROR")}}return[]}function f(){if(a.addEventListener){a.addEventListener("mousedown",g,false);a.addEventListener("mousemove",e,false);a.addEventListener("keydown",e,false);return}if(a.attachEvent){a.attachEvent("onmousedown",g);a.attachEvent("onmousemove",e);a.attachEvent("onkeydown",e)}}this.start=function(){if(j){q("Initializing PClicks Listeners")}var w=setInterval(function(){_documentBody=(a.documentElement!=undefined&&a.documentElement.clientHeight!=0)?a.documentElement:a.body;if(!_documentBody){return}f();clearInterval(w);if(j){q("Document Loaded: "+_documentBody)}},10);d()}});predicta.PClick.VERSION="1.3"})(document,window.console)};

