'; jQuery('body').append(overlay); jQuery('body').css('overflow-y', 'hidden'); newsletterOverlay = new VarienForm('newsletter-overlay'); googleAmastyRecaptchaFlag = 0; googleAmastyRecaptchaFlag = 1; siteKeyAmastyRecaptcha = "6LeIs_YUAAAAAH4q8FoiJs9Tgel8HUUc8HSal1aJ"; themeAmastyRecaptcha = "light"; badgePositionAmastyRecaptcha = "bottomright"; initInvisibleRecaptcha(); if(!googleAmastyRecaptchaFlag){ jQuery("#overlay-subscribe").click( function(e) { e.preventDefault(); submitForm(); } ); } } function __go() { // no block, or logged and already subscribed, or cookie exists if (!b || isSubscribed || cno.get(cookieName)) return; var overlay = {"enabled":false,"delay":0,"type":"catalog_product_view"}; var enabled = overlay.enabled; if (!enabled) return; var delay = parseInt(overlay.delay); setTimeout(function() { showOverlay(); }, delay * 1000); } __go(); }); function submitForm() { if (!newsletterOverlay.validator.validate()) return; //jQuery('body').css("overflow", "hidden"); jQuery('.resp-message').html(""); var params = { 'email': jQuery("input[name=ol_email]").val(), 'privacy': jQuery('input[name="privacy"]:checked').val(), 'ajax': true } jQuery.ajax({ url: "https://store.vespa.com/dk_en/newsletteroverlay/newsletter/subscribe/", type: "post", dataType: "json", data: params, success: function(checkJson) { jQuery("#overlay-subscribe").fadeOut('slow'); if (!checkJson || typeof checkJson != 'object') { jQuery('.resp-message').html(checkJson); jQuery('.resp-message').addClass('red-message'); jQuery("#overlay-subscribe").fadeIn('slow'); return; } if (!checkJson.success) { jQuery('.resp-message').html(checkJson.message); jQuery('.resp-message').addClass('red-message'); jQuery("#overlay-subscribe").fadeIn('slow'); return; } var closedelay = parseInt(5); if (isNaN(closedelay)) { if (checkJson.redirect !== null) { window.location.href = checkJson.redirect + '?r=' + encodeURIComponent('https://store.vespa.com/dk_en/catalog/product/view/id/2125/s/wall-keychains/category/248/'); return; } else { window.location.href = window.location.href + "?isc=ok"; return; } } //invio gtm iscrizione utente var dataLayer = dataLayer || []; dataLayer.push({'event':'GAevent', 'eventCategory':'iscrizione','eventAction':'ok', 'eventLabel' : 'popup'}); jQuery("#newsletter-overlay").hide(); jQuery('.resp-message').addClass('green-message'); jQuery('.resp-message').html(checkJson.message); setTimeout(function() { closeNl(); }, closedelay * 1000); } }) } function submitOverlayNewsletter(){ submitForm(); } function closeNl() { //cookie jQuery('.window').fadeOut('fast'); jQuery('.overlay-nl').fadeOut('fast'); jQuery('.overlay').fadeOut('fast'); jQuery('body').css("overflow-y", "visible"); //cookie = cookie === undefined ? true : cookie; if (!cno.get(cookieName)) cno.set(cookieName, 1, parseInt(cookieExp)); }