function initJQuery() { // if the jQuery object isn't available if (typeof(jQuery) == 'undefined') { if (typeof initJQuery.jQueryScriptOutputted == 'undefined') { // only output the script once.. initJQuery.jQueryScriptOutputted = true; // output the script (load it from google api) document.write(""); } setTimeout("initJQuery()", 50); } } initJQuery(); var InstallationUrl = 'newsletter/'; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; 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; drawrecaptcha(); }; } function drawrecaptcha(){ $.getScript("//www.google.com/recaptcha/api/js/recaptcha_ajax.js", function() {Recaptcha.create("6LfsnMASAAAAAMay1HSKHhntGHQriaR5W0_yngQB", "recaptchaDiv",{theme : "white"}); }); } function SubmitNewsletterForm1(poststr, vcode) { var flagCaptcha = false; if(http.readyState == 4) { var showcheck = http.responseText; if(showcheck == '1') { flagCaptcha = true; } else { flagCaptcha = false; }; if (flagCaptcha == false) { alert('Incorrect verification code'); } else { poststr += '&captcha=' + vcode.value; ajaxpage('newsletter/frontend/form.php?do=save&group=1'+poststr,'divNewsletter1'); } } }; function refreshImg1(){ var url = InstallationUrl + 'frontend/captcha-refresh.php?grid=1'; doRefresh1(url, displayImg1); }; function doRefresh1(url, callback) { http.open('POST', url, true); http.onreadystatechange = displayImg1; http.send(null); }; function displayImg1() { if(http.readyState == 4) { var showimage = http.responseText; document.getElementById('captchaImage').innerHTML = showimage; }; }; 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; } if (flagFields) { if (checkonly == false) { if (document.NewsletterForm1.vercode) { http.open('POST', InstallationUrl + 'frontend/captcha-process.php?captcha=' + document.NewsletterForm1.vercode.value, true); http.onreadystatechange = function () { SubmitNewsletterForm1(poststr, document.NewsletterForm1.vercode); }; http.send(null); } else { ajaxpage('newsletter/frontend/form.php?do=save&group=1'+poststr+'&recaptcha_response_field='+document.NewsletterForm1.recaptcha_response_field.value+'&recaptcha_challenge_field='+document.NewsletterForm1.recaptcha_challenge_field.value,'divNewsletter1'); } } } else { alert(message); } return flagFields; }; function pop(div, submit) { document.getElementById(div).style.display='block'; document.getElementById(submit).disabled=false; return false } function hide(div, submit) { document.getElementById(div).style.display='none'; document.getElementById(submit).disabled=true; return false } loadNewsletter = '
'; document.writeln(loadNewsletter);