!function(){if("function"!=typeof window.CustomEvent){window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var a=document.createEvent("CustomEvent");return a.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),a}}function e(){var e,t=this.parentNode,a=arguments.length;if(t)for(a||t.removeChild(this);a--;)"object"!=typeof(e=arguments[a])?e=this.ownerDocument.createTextNode(e):e.parentNode&&e.parentNode.removeChild(e),a?t.insertBefore(e,this.nextSibling):t.replaceChild(e,this)}Element.prototype.replaceWith||(Element.prototype.replaceWith=e),CharacterData.prototype.replaceWith||(CharacterData.prototype.replaceWith=e),DocumentType.prototype.replaceWith||(DocumentType.prototype.replaceWith=e),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){var a,o=this.length;for(t=t||window,a=0;a<o;a++)e.call(t,this[a],a,this)})}(),advads={supports_localstorage:function(){"use strict";try{return!(!window||void 0===window.localStorage)&&(window.localStorage.setItem("x","x"),window.localStorage.removeItem("x"),!0)}catch(e){return!1}},max_per_session:function(e,t){var a=1;if(void 0!==t&&0!==parseInt(t)||(t=1),this.cookie_exists(e)){if(this.get_cookie(e)>=t)return!0;a+=parseInt(this.get_cookie(e))}return this.set_cookie(e,a),!1},count_up:function(e,t){var a=1;this.cookie_exists(e)&&(a+=parseInt(this.get_cookie(e))),this.set_cookie(e,a)},set_cookie_exists:function(e){return!!get_cookie(e)||(set_cookie(e,"",0),!1)},get_cookie:function(e){var t,a,o,n=document.cookie.split(";");for(t=0;t<n.length;t++)if(a=n[t].substr(0,n[t].indexOf("=")),o=n[t].substr(n[t].indexOf("=")+1),(a=a.replace(/^\s+|\s+$/g,""))===e)return unescape(o)},set_cookie:function(e,t,a,o,n,i){var r=null==a?null:24*a*60*60;this.set_cookie_sec(e,t,r,o,n,i)},set_cookie_sec:function(e,t,a,o,n,i){var r=new Date;r.setSeconds(r.getSeconds()+parseInt(a)),document.cookie=e+"="+escape(t)+(null==a?"":"; expires="+r.toUTCString())+(null==o?"; path=/":"; path="+o)+(null==n?"":"; domain="+n)+(null==i?"":"; secure")},cookie_exists:function(e){var t=this.get_cookie(e);return null!==t&&""!==t&&void 0!==t},move:function(e,t,a){var o=jQuery(e);if(void 0===a&&(a={}),void 0===a.css&&(a.css={}),void 0===a.method&&(a.method="prependTo"),""===t&&void 0!==a.target)switch(a.target){case"wrapper":var n="left";void 0!==a.offset&&(n=a.offset),t=this.find_wrapper(e,n)}switch((t=void 0===a.moveintohidden?jQuery(t).filter(":visible"):jQuery(t)).length>1&&t.length,a.method){case"insertBefore":o.insertBefore(t);break;case"insertAfter":o.insertAfter(t);break;case"appendTo":o.appendTo(t);break;case"prependTo":o.prependTo(t);break;default:o.prependTo(t)}},set_parent_relative:function(e,t){t=void 0!==t?t:{};var a=jQuery(e).parent();t.use_grandparent&&(a=a.parent()),"static"!==a.css("position")&&""!==a.css("position")||a.css("position","relative")},fix_element:function(e,t){t=void 0!==t?t:{};var a=jQuery(e);t.use_grandparent?this.set_parent_relative(a.parent()):this.set_parent_relative(a),t.is_invisible&&a.show();var o=parseInt(a.offset().top),n=parseInt(a.offset().left);if(t.is_invisible&&a.hide(),"left"===t.offset){var i=jQuery(window).width()-n-a.outerWidth();a.css("position","fixed").css("top",o+"px").css("right",i+"px").css("left","")}else a.css("position","fixed").css("top",o+"px").css("left",n+"px").css("right","")},find_wrapper:function(e,t){var a;return jQuery("body").children().each((function(o,n){if(n.id!==e.substring(1)){var i=jQuery(n);if("right"===t&&i.offset().left+jQuery(i).width()<jQuery(window).width()||"left"===t&&i.offset().left>0)return"static"!==i.css("position")&&""!==i.css("position")||i.css("position","relative"),a=n,!1}})),a},center_fixed_element:function(e){var t=jQuery(e),a=jQuery(window).width()/2-parseInt(t.css("width"))/2;t.css("left",a+"px")},center_vertically:function(e){var t=jQuery(e),a=jQuery(window).height()/2-parseInt(t.css("height"))/2;"fixed"!==t.css("position")&&(a-=topoffset=parseInt(t.offset().top)),t.css("top",a+"px")},close:function(e){jQuery(e).remove()},wait_for_images:function(e,t){var a=0,o=[];e.find('img[src][src!=""]').each((function(){o.push(this.src)})),0===o.length&&t.call(e),jQuery.each(o,(function(n,i){var r=new Image;r.src=i;var s="load error";jQuery(r).one(s,(function n(i){if(jQuery(this).off(s,n),++a==o.length)return t.call(e[0]),!1}))}))},privacy:{state:"unknown",state_executed:!1,get_state:function(){if("unknown"!==window.advads_options.privacy.state)return advads.privacy.state_executed||(advads.privacy.state_executed=!0,advads.privacy.dispatch_event(window.advads_options.privacy.state,!1)),advads.privacy.state;if("custom"===window.advads_options.privacy["consent-method"]){var e=new RegExp(window.advads_options.privacy["custom-cookie-name"]+"=.*?"+window.advads_options.privacy["custom-cookie-value"]+"[^;]*");advads.privacy.state_executed||(advads.privacy.state_executed=!0,advads.privacy.dispatch_event(null!==document.cookie.match(e)?"accepted":"unknown",!0))}advads.privacy.state_executed=!0;var t=0,a=setInterval((function(){switch(600==++t&&clearInterval(a),window.advads_options.privacy["consent-method"]){case"custom":null!==document.cookie.match(e)&&(clearInterval(a),"accepted"!==advads.privacy.state&&advads.privacy.dispatch_event("accepted",!0));break;case"iab_tcf_20":if(void 0===window.__tcfapi)return;clearInterval(a),window.__tcfapi("addEventListener",2,(function(e,t){if(t&&("tcloaded"===e.eventStatus||"useractioncomplete"===e.eventStatus||null===e.eventStatus&&void 0!==window.googlefc&&(void 0!==e.purpose||!e.gdprApplies))){var a="useractioncomplete"===e.eventStatus;if(!e.gdprApplies)return void("not_needed"!==advads.privacy.state&&advads.privacy.dispatch_event("not_needed",a));if(e.purpose.consents[1])return void("accepted"!==advads.privacy.state&&advads.privacy.dispatch_event("accepted",a));"rejected"!==advads.privacy.state&&advads.privacy.dispatch_event("rejected",a)}}))}}),100);return advads.privacy.state},is_adsense_npa_enabled:function(){return!window.advads_options||!window.advads_options.privacy||!(!window.advads_options.privacy["show-non-personalized-adsense"]||"custom"!==window.advads_options.privacy["consent-method"])},dispatch_event:function(e,t){var a=advads.privacy.state,o=function(){document.dispatchEvent(new CustomEvent("advanced_ads_privacy",{detail:{state:e,previousState:a,userAction:t}}))};if(advads.privacy.state=e,"loading"!==document.readyState)return o();document.addEventListener("readystatechange",o,{once:!0})},is_ad_decoded:function(e){return null===document.querySelector('script[data-tcf="waiting-for-consent"][data-id="'+e+'"]')},decode_ad:function(e,t){t="boolean"!=typeof t||t;var a=decodeURIComponent(Array.prototype.map.call(atob(e.textContent),(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));if(!t)return a;e.replaceWith(document.createRange().createContextualFragment(a))}}},(window.advanced_ads_ready||jQuery(document).ready).call(null,(function(){advads.privacy.get_state()})),document.addEventListener("advanced_ads_privacy",(function(e){"accepted"!==e.detail.state&&"not_needed"!==e.detail.state||e.detail.userAction||"loading"===document.readyState||document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"]').forEach(advads.privacy.decode_ad)})),jQuery(document).ready((function(){if(!(!advads.supports_localstorage()||!localStorage.getItem("advads_frontend_picker")||window.advads_options.blog_id&&localStorage.getItem("advads_frontend_blog_id")&&window.advads_options.blog_id!==localStorage.getItem("advads_frontend_blog_id")||localStorage.getItem("advads_frontend_starttime")&&parseInt(localStorage.getItem("advads_frontend_starttime"),10)<(new Date).getTime()-27e5&&(localStorage.removeItem("advads_frontend_action"),localStorage.removeItem("advads_frontend_element"),localStorage.removeItem("advads_frontend_picker"),localStorage.removeItem("advads_prev_url"),localStorage.removeItem("advads_frontend_pathtype"),localStorage.removeItem("advads_frontend_boundary"),localStorage.removeItem("advads_frontend_blog_id"),localStorage.removeItem("advads_frontend_starttime"),advads.set_cookie("advads_frontend_picker","",-1),1))){var e,t=jQuery("<div id='advads-picker-overlay'>"),a=[document.body,document.documentElement,document];if(t.css({position:"absolute",border:"solid 2px #428bca",backgroundColor:"rgba(66,139,202,0.5)",boxSizing:"border-box",zIndex:1e6,pointerEvents:"none"}).prependTo("body"),"true"===localStorage.getItem("advads_frontend_boundary")&&jQuery("body").css("cursor","not-allowed"),window.advads.is_boundary_reached=function(e){if("true"!==localStorage.getItem("advads_frontend_boundary"))return!1;$advads_picker_cur=jQuery(e);var t=jQuery(".advads-frontend-picker-boundary-helper");return $boundaries=t.parent(),$boundaries.css("cursor","pointer"),$advads_picker_cur.is($boundaries)||!$advads_picker_cur.closest($boundaries).length},"xpath"===localStorage.getItem("advads_frontend_pathtype"))var o="getXPath";else o="getPath";jQuery(document).mousemove((function(n){if(n.target!==e){if(~a.indexOf(n.target))return e=null,void t.hide();var i=jQuery(n.target),r=i.offset(),s=i.outerWidth(),d=i.outerHeight();e=n.target;var c=jQuery(e)[o]();c&&t.css({top:r.top,left:r.left,width:s,height:d}).show()}})),jQuery(document).click((function(t){var a=jQuery(e)[o]();advads.is_boundary_reached(e)||(localStorage.setItem("advads_frontend_element",a),window.location=localStorage.getItem("advads_prev_url"))}))}})),jQuery.fn.extend({getPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("html"))return"html > "+e;if(3===t)return e;var a=this.get(0).nodeName.toLowerCase(),o=this.attr("id"),n=this.attr("class");return t+=1,void 0===o||/\d/.test(o)?void 0!==n&&(n=n.split(/[\s\n]+/),(n=jQuery.grep(n,(function(e,t){return!/\d/.test(e)}))).length&&(a+="."+n.slice(0,2).join("."))):a+="#"+o,this.siblings(a).length&&(a+=":eq("+this.siblings(a).addBack().not("#advads-picker-overlay").index(this)+")"),""===e?this.parent().getPath(a,t):this.parent().getPath(a+" > "+e,t)},getXPath:function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=0),this.is("body")||3===t)return e;if(advads.is_boundary_reached(this))return e;var a=this.get(0).nodeName.toLowerCase(),o=a,n=this.attr("id"),i=this.attr("class"),r=[];if(void 0!==n&&!/\d/.test(n))return o+'[@id and id="'+n+'"]/'+e;if(void 0!==i&&(i=i.split(/[\s\n]+/),(i=jQuery.grep(i,(function(e,t){return!/\d/.test(e)}))).length)){t+=1;r=i.slice(0,2);for(var s=[],d=0;d<r.length;d++)s.push('(@class and contains(concat(" ", normalize-space(@class), " "), " '+r[d]+' "))');o+="["+s.join(" and ")+"]"}if(r.length)var c=this.siblings(a+"."+r.join("."));else c=this.siblings(a);c.length&&(o+="["+c.addBack().not("#advads-picker-overlay").index(this)+"]");return""===e?this.parent().getXPath(o,t):this.parent().getXPath(o+"/"+e,t)}});
;(function($){
var cname='advads_procfp';
var cname_vc='advanced_ads_ad_clicks';
var PATH=null;
var DOMAIN=null;
function jsonDecode(str){
try {
var res=JSON.parse(str);
return res;
} catch(Ex){
return null;
}}
$(document).on('advads-passive-cb-conditions', function(e, cbs){
cbs.conditions['ad_clicks']='check_ad_clicks';
cbs['check_ad_clicks']=function(options, ad){
if(advads.cookie_exists(cname_vc + '_' + ad.id)){
var C_vc=advads.get_cookie(cname_vc + '_' + ad.id);
C_vc=jsonDecode(C_vc);
}
if(C_vc){
var now=parseInt(new Date().getTime() / 1000);
for(var i in C_vc){
if('_' + options.expiration==i){
if(C_vc[i]['ttl'] >=now&&C_vc[i]['count'] >=parseInt(options.limit)){
return false;
}}
}}
return true;
};});
var cfpTracker=function(){
this.$elements={};
this.currentIFrame=false;
this.focusLost=false;
this.init();
}
cfpTracker.prototype={
constructor: cfpTracker,
init: function(){
var that=this;
$(document).on('click', 'a[data-cfpa]', function(){
that.onClick(parseInt($(this).attr('data-cfpa')));
});
$(window).on('blur', function(){
if(false!==that.currentIFrame){
that.onClick(that.currentIFrame);
that.currentIFrame=false;
that.focusLost=true;
}});
$(document).on('mouseenter', 'div[data-cfpa]', function(){
var id=parseInt($(this).attr('data-cfpa'));
that.addElement(id);
});
},
addElement: function($el){
if(false===$el instanceof jQuery){
$el=$('[data-cfpa="' + $el + '"]');
}
var hasIframe=$el.find('iframe').length ? true:false;
if(!hasIframe){
if(!$el.find('a').length){
return;
}}
var adID=parseInt($el.attr('data-cfpa'));
this.$elements[adID]=$el;
$el.removeAttr('data-cfpa');
if(hasIframe){
$el.find('iframe').first().attr({
'data-cfpa': adID,
})
if($el.attr('data-cfph')){
$el.find('iframe').first().attr({
'data-cfph': $el.attr('data-cfph'),
})
}}else{
$el.find('a').not('.advads-edit-button').first().attr({
'data-cfpa': adID,
})
if($el.attr('data-cfph')){
$el.find('a').not('.advads-edit-button').first().attr({
'data-cfph': $el.attr('data-cfph'),
})
}}
$el.removeAttr('data-cfph');
if(advads.cookie_exists(cname_vc + '_' + adID)){
var C_vc=advads.get_cookie(cname_vc + '_' + adID);
C_vc=jsonDecode(C_vc);
if(C_vc){
var now=parseInt(new Date().getTime() / 1000), cookie_modified=false;
for(var i in C_vc){
if(!C_vc.hasOwnProperty(i)) continue;
if('exp'==i) continue;
if(C_vc[i]['ttl'] < now){
var period=parseFloat(i.substr(1));
var newTTL=C_vc[i]['ttl'];
while(newTTL < now){
newTTL +=period * 60 * 60;
}
C_vc[i]['ttl']=newTTL;
C_vc[i]['count']=0;
cookie_modified=true;
}}
if(cookie_modified){
var expTime=new Date(C_vc['exp']);
advads.set_cookie_sec(cname_vc + '_' + adID, JSON.stringify(C_vc, 'false', false), parseInt(expTime.getTime() / 1000), PATH, DOMAIN);
}}
}},
onClick: function(ID){
var C=false, C_vc=false;
if($('[data-cfpa="' + ID + '"]').attr('data-cfph')){
if(advads.cookie_exists(cname_vc + '_' + ID)){
C_vc=advads.get_cookie(cname_vc + '_' + ID);
C_vc=jsonDecode(C_vc);
}
if(C_vc){
for(var h in C_vc){
if(!C_vc.hasOwnProperty(h)) continue;
if('exp'==h) continue;
var count=parseInt(C_vc[h]['count']);
C_vc[h]['count']=count + 1;
}
var now=new Date();
var expiry=new Date(C_vc.exp);
var expirySecs=parseInt(( expiry.getTime() - now.getTime()) / 1000);
advads.set_cookie_sec(cname_vc + '_' + ID, JSON.stringify(C_vc, 'false', false), expirySecs, PATH, DOMAIN);
}else{
var H=$('[data-cfpa="' + ID + '"]').attr('data-cfph').split('_');
var cval={}, maxHValue=0;
var d=new Date();
var now=new Date();
for(var h in H){
if(parseFloat(H[h]) > maxHValue){
maxHValue=parseFloat(H[h]);
}
cval['_' + H[h]]={
count: 1,
ttl: parseInt(((now.getTime() / 1000) +(parseFloat(H[h]) * 3600))),
};}
d.setTime(d.getTime() +(maxHValue * 60 * 60 * 1000));
var expires="expires="+ d.toUTCString();
var expirySecs=parseInt(( d.getTime() - now.getTime()) / 1000);
cval['exp']=expires;
advads.set_cookie_sec(cname_vc + '_' + ID, JSON.stringify(cval, 'false', false), expirySecs, PATH, DOMAIN);
}}
if(advads.cookie_exists(cname + '_' + ID)){
C=advads.get_cookie(cname + '_' + ID);
C=jsonDecode(C);
}
if(C){
var count=parseInt(C.count);
C.count=count +1;
var now=new Date();
var expiry=new Date(C.exp);
var expirySecs=(expiry.getTime() - now.getTime()) / 1000;
advads.set_cookie_sec(cname + '_' + ID, JSON.stringify(C, 'false', false), expirySecs, PATH, DOMAIN);
if(advadsCfpClickLimit <=C.count&&'undefined'!=typeof advadsCfpBan){
var d=new Date();
d.setTime(d.getTime() +(advadsCfpBan*24*60*60*1000));
var ban=(d.getTime() - now.getTime()) / 1000;
advads.set_cookie_sec('advads_pro_cfp_ban', 1, ban, PATH, DOMAIN);
jQuery('[data-cfptl]').remove();
}}else{
var d=new Date();
var now=new Date();
d.setTime(d.getTime() +(advadsCfpExpHours*60*60*1000));
var expires="expires="+ d.toUTCString();
var expirySecs=(d.getTime() - now.getTime()) / 1000;
advads.set_cookie_sec(cname + '_' + ID, '{"count":1,"exp":"' + expires + '"}', expirySecs, PATH, DOMAIN);
}},
}
$(function(){
window.advadsProCfp=new cfpTracker();
$(document).on('mouseenter', 'iframe[data-cfpa]', function(){
var ID=parseInt($(this).attr('data-cfpa'));
advadsProCfp.currentIFrame=ID;
}).on('mouseleave', '[data-cfpa]', function(){
advadsProCfp.currentIFrame=false;
if(advadsProCfp.focusLost){
advadsProCfp.focusLost=false;
$(window).focus();
}});
for(var i in advadsCfpQueue){
if(advadsCfpQueue.hasOwnProperty(i)){
advadsProCfp.addElement(advadsCfpQueue[i]);
}}
advadsCfpQueue=[];
if('undefined'==typeof window.advadsCfpPath) return;
if(''!=advadsCfpPath){
PATH=advadsCfpPath;
}
if(''!=advadsCfpDomain){
DOMAIN=advadsCfpDomain;
}});
})(window.jQuery);