var InstallationUrl = 'newsletter/'; var bustcachevar = 1; // bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter = ""; var recaptchaRendered = false; function createRequestObject() { try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; var http = createRequestObject(); function ajaxpage(url, containerid) { var page_request = createRequestObject(); if (bustcachevar) { bustcacheparameter = (url.indexOf("?") != -1) ? "&" + new Date().getTime() : "?" + new Date().getTime(); } page_request.open('GET', url + bustcacheparameter, true); page_request.send(null); page_request.onreadystatechange = function() { loadpage(page_request, containerid); } }; function loadpage(page_request, containerid) { if (page_request.readyState == 4 && (page_request.status == 200 || window.location.href.indexOf("http") == -1)) { document.getElementById(containerid).innerHTML = page_request.responseText; if (!recaptchaRendered) { recaptchaCallback(); } }; }; function CheckNewsletterForm1(checkonly) { checkonly = typeof checkonly !== 'undefined' ? checkonly : false; var flagFields = true; var re = /^(?!\+)[_a-z0-9-+']+(\.[_a-z0-9-+']+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i; var message = 'Please fill in all fields! \n'; var poststr = "&email=" + encodeURIComponent(document.NewsletterForm1.email.value); if (document.NewsletterForm1.name.value == '') { message += 'Name \n'; flagFields = false; } else { poststr += "&name=" + encodeURIComponent(document.NewsletterForm1.name.value); } if (document.NewsletterForm1.email.value == '') { message += 'Email \n'; flagFields = false; } if (document.NewsletterForm1.email.value.length != 0 && document.NewsletterForm1.email.value.match(re) == null) { message += 'Email \n'; flagFields = false; } var response = grecaptcha.getResponse(); if (response == '') { message += 'Incorrect verification code \n'; flagFields = false; } else { poststr += "&g-recaptcha-response=" + encodeURIComponent(response); } if (flagFields) { if (checkonly == false) { ajaxpage('newsletter/frontend/form.php?do=save&group=1' + poststr, 'divNewsletter1'); } } else { alert(message); } return flagFields; }; function recaptchaCallback() { if (typeof grecaptcha == 'undefined') { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://www.google.com/recaptcha/api.js?onload=recaptchaCallback&hl=en'; script.setAttribute('async', 'async'); script.setAttribute('defer', 'defer'); document.getElementsByTagName('head')[0].appendChild(script); return; } grecaptcha.render('recaptchaContainer', { 'sitekey': '6LcaM0IUAAAAAJ3xff0DCYVITv9fb_DtBUc3UbP8', 'callback': 'recaptchaCompleted', 'render': 'explicit', 'theme': 'light' }); recaptchaRendered = true; }; function recaptchaCompleted() { $('#subscribeButton').prop('disabled', false); }; loadNewsletter = '
'; document.writeln(loadNewsletter);