(function(a){window.GdprCheckbox=function(){var p=this,q=function(g,l){var f=a(g).data("formselector");if(f){var c=a(f);c.length||(c=a(g).parents("form"))}else c=a(g).parents("form");if(l&&!c.length&&f)try{window.self!==window.top&&(c=a(f,window.parent.document))}catch(t){}return c};this.dispatch=function(){"undefined"!==typeof gdprDynamicCheckboxArray&&(gdprDynamicCheckboxArray=JSON.parse(gdprDynamicCheckboxArray));if(a.isArray(gdprDynamicCheckboxArray)){var g=[],l=gdpr_livesite+"index.php?option=com_gdpr&task=user.getCheckbox&format=json";
a.each(gdprDynamicCheckboxArray,function(f,c){g[f]=a.Deferred(function(f){var d=a('*:contains("'+c+'"):last:not(script)',"body");if(d.length){var m={checkbox_placeholder:c,url:a(location).attr("href").replace("?tmpl=component",""),dynamicCheckbox:1};a.ajax({type:"POST",url:l,data:m,dataType:"json"}).done(function(b,e,m){if(b){var k=b.checked?" checked":"",r=b.checked?"":" checked",g=b.checked?" checked":"",n=gdprDynamicCheckboxControlsClass?' class="'+gdprDynamicCheckboxControlsClassList+'"':"";e=
parseInt(b.required)?"<span>&nbsp;*</span>":"";k=gdprPrivacyPolicyDynamicControl?'<input data-formselector="'+b.formselector+'" data-role="gdpr_dynamic_privacy_policy_checkbox" type="checkbox"'+k+' data-placeholder="'+c+'" value="1" data-required="'+b.required+'" aria-required="'+!!b.required+'"'+n+"/>":'<input style="margin:0;padding:0" type="radio" value="0"'+r+' id="'+c+'_noaccept" name="'+c+'" data-formselector="'+b.formselector+'" data-role="gdpr_dynamic_privacy_policy_checkbox" data-placeholder="'+
c+'" data-required="'+b.required+'" aria-required="'+!!b.required+'"'+n+'><label for="'+c+'_noaccept" style="margin:0 15px 0 5px;display:inline-block">'+COM_GDPR_DYNAMIC_PRIVACY_POLICY_NOACCEPT+'</label><input style="margin:0;padding:0" type="radio" value="1"'+g+' id="'+c+'_accept" name="'+c+'" data-formselector="'+b.formselector+'" data-role="gdpr_dynamic_privacy_policy_checkbox" data-placeholder="'+c+'" data-required="'+b.required+'" aria-required="'+!!b.required+'"'+n+'><label for="'+c+'_accept" style="margin:0 0 0 5px;display:inline-block">'+
COM_GDPR_DYNAMIC_PRIVACY_POLICY_ACCEPT+"</label>";gdprPrivacyPolicyDynamicCheckboxConsentDate&&b.consent_date&&(k+='<label class="gdpr_privacy_policy_consent_date">'+b.consent_date+"</label>");e=gdprPrivacyPolicyDynamicCheckboxLabelTemplate.replace("{label}",'<a data-role="gdpr_dynamic_privacy_policy_checkbox" data-placeholder="'+c+'" href="javascript:void(0);" target="_blank"><label>'+b.name+e+"</label></a>");k=gdprPrivacyPolicyDynamicCheckboxCheckboxTemplate.replace("{checkbox}",k);if("right"==
gdprDynamicCheckboxOrder)var h=e+k;else"left"==gdprDynamicCheckboxOrder&&(h=k+e);h=gdprPrivacyPolicyDynamicCheckboxContainerTemplate.replace("{field}",h);b.allowed||(h="");parseInt(b.published)||(h="");GdprCheckbox.disabledByLaw&&(h="");e=a(d).html();e=e.replace(c,h);a(d).html(e)}f.resolve(b,m.status)})}else f.resolve()}).promise()});a.when.apply(a,g).then(function(){a("a[data-role=gdpr_dynamic_privacy_policy_checkbox]").on("click",function(a){p.lastClickedDynamicCheckbox=jQuery(this).attr("data-placeholder")});
var f="ajax",c="format=raw";switch(gdprDynamicCheckboxPopupFormatTemplate){case "iframecomponent":f="iframe";c="tmpl=component";break;case "iframeraw":f="iframe",c="format=raw"}var g="undefined"!==typeof jQuery.gdprfancybox?"gdprfancybox":"fancybox";a("a[data-role=gdpr_dynamic_privacy_policy_checkbox]")[g]({type:f,iframe:{css:{width:gdprDynamicFancyboxWidth,height:gdprDynamicFancyboxHeight}},buttons:["close"],beforeLoad:function(a){"undefined"===typeof a.$lastFocus&&(a.$lastFocus=this.opts.$orig);
var d=a.$lastFocus.attr("data-placeholder");d||0!=jQuery("div.fancybox-content").length||(d=p.lastClickedDynamicCheckbox);if(!d||jQuery("div.fancybox-content").length)return a.close(),a.current.src=null,setTimeout(function(){jQuery("div.fancybox-loading").remove();jQuery("div.fancybox-is-closing").hide()},0),!1;a.current.src=gdpr_livesite+"index.php?option=com_gdpr&task=user.getCheckboxDescription&"+c+gdprCurrentSefLanguage+"&checkbox_placeholder="+d},afterLoad:function(d){d=a("div.fancybox-toolbar").clone(!0).end().remove();
a("div.fancybox-content").prepend(d);a("div.fancybox-slide--html div.fancybox-content").addClass("fancybox-50")},lang:"all",i18n:{all:{CLOSE:gdprDynamicFancyboxCloseText}}});a("input[data-role=gdpr_dynamic_privacy_policy_checkbox]").on("change",function(d){var c={url:a(location).attr("href").replace("?tmpl=component",""),formid:a(this).data("placeholder"),formfields:{},dynamicCheckbox:1};a(this).is(":checked")&&0<parseInt(a(this).val())?(d=q(this,!0),d.length&&(d=a("input[type=text]:not(:hidden), input[type=email], input[type=search], textarea",
d),d.length&&a.each(d,function(b,d){(b=a(d).attr("id"))||(b=a(d).attr("name"));b&&(b=b.replace(/[-_]/gi," "),b=b.replace(/[\[\]]/gi,""),b=b.replace("jform",""),b=b.trim(),d=a(d).val(),c.formfields[b]=d)})),a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.storeConsent&format=raw",data:c})):a.ajax({type:"POST",url:gdpr_livesite+"index.php?option=com_gdpr&task=user.deleteConsent&format=raw",data:c})});a("input[data-role=gdpr_dynamic_privacy_policy_checkbox][value=1]").each(function(d,
c){d=a(this).data("required");var b=a(this).data("placeholder"),e=q(this,!1);if(d&&e.length){if(gdprDynamicRemoveSubmitButtonEvents&&(d=a(gdprDynamicCheckboxCustomSubmissionMethodSelector,e),d.length)){var f=d.clone(!1);d.after(f);d.remove()}gdprDynamicCheckboxRemoveAttributes&&(a(gdprDynamicCheckboxCustomSubmissionMethodSelector,e).removeAttr("onclick"),a(e).removeAttr("onsubmit"),gdprDynamicForceSubmitButton&&!a("input[type=submit],button[type=submit]",e).length&&a("button[type=button],input[type=button]",
e).last().attr("type","submit"));"object"===typeof Onepage&&typeof Onepage.checkBinders===typeof Function&&a("input.buttonopc[id=confirmbtn],#vmMainPageOPC #confirmbtn_button").attr("id","opcconfirmbtn");"object"===typeof ProOPC&&typeof ProOPC.submitOrder===typeof Function&&(a("#ProOPC #gdpr_privacy_policy_checkbox").length||a("#ProOPC input[type=radio][name=gdpr_privacy_policy_checkbox]").length)&&a("#proopc-order-submit").off();var g=function(b){try{if(typeof ff_validate_submit===typeof Function){a(".bfErrorMessage").html("").css("display",
"none");var d=ff_validation(0);d?typeof bfShowErrors===typeof Function?bfShowErrors(d):alert(d):a(this).is(":checked")&&ff_validate_submit(this,"click");setTimeout(function(){a("#bfSubmitButton").removeAttr("data-loading").removeAttr("disabled")},100)}}catch(h){}try{if("object"===typeof Onepage&&typeof Onepage.validateFormOnePage===typeof Function&&a(this).is(":checked"))return a("#adminForm").attr("id","opcform"),Onepage.validateFormOnePage(jqEvent,a("#confirmbtn, #opcconfirmbtn").get(0),!0);if("object"===
typeof ProOPC&&typeof ProOPC.submitOrder===typeof Function&&a(this).is(":checked"))return ProOPC.submitOrder(jqEvent.target)}catch(h){}try{if(typeof submitacymailingform===typeof Function&&a(this).is(":checked")&&0==a("input[data-role=gdpr_dynamic_privacy_policy_checkbox][value=1]:not(:checked)").length){var c=a("div.acymailing_module form").attr("id");if(c==a(e).attr("id"))return submitacymailingform("optin",c)}if(typeof submitAcymForm===typeof Function&&a(this).is(":checked")&&0==a("input[data-role=gdpr_dynamic_privacy_policy_checkbox][value=1]:not(:checked)").length&&
(c=a("div.acym_module form").attr("id"),c==a(e).attr("id")))return submitAcymForm("subscribe",c)}catch(h){}try{if("object"===typeof crbc_checkout&&typeof crbc_checkout.submit_billing_information===typeof Function&&a(this).is(":checked"))return crbc_checkout.submit_billing_information()}catch(h){}if(a(this).is(":checked"))return a("a[data-role=gdpr_dynamic_privacy_policy_checkbox][data-placeholder='"+b+"']").removeAttr("style"),a("label.privacy_policy_required[data-placeholder='"+b+"']").remove(),
!0;a("label.privacy_policy_required[data-placeholder='"+b+"']").remove();(a(this).next("label").length?a(this).next("label"):a(this)).after('<label class="privacy_policy_required" data-placeholder="'+b+'" style="color:#F00;display:inline-block;margin-left:5px">'+gdprDynamicCheckboxRequiredText+"</label>");a("a[data-role=gdpr_dynamic_privacy_policy_checkbox][data-placeholder='"+b+"']").css({color:"#F00","font-weight":"bold"});return!1};a("input[type=submit],button[type=submit],input[type=button].subbutton",
e).on("click",function(a){return g.apply(c,[b])});a(e).on("submit",function(a){return g.apply(c,[b])})}})})}}};window.GdprCheckbox.disabledByLaw=!1;a(function(){(new GdprCheckbox).dispatch()})})(jQuery);
