var InstallationUrl = '/newsletter/'; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function createRequestObject2(){ try { xmlhttp2 = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLhttp"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp2; }; var http2 = createRequestObject2(); function ajaxpage2(url, containerid){ var page_request = createRequestObject2(); 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(){ loadpage2(page_request, containerid) } } function loadpage2(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; }; } function SubmitNewsletterForm1(poststr, vcode) { var flagCaptcha = false; if(http2.readyState == 4) { var showcheck = http2.responseText; if(showcheck == '1') { flagCaptcha = true; } else { flagCaptcha = false; }; if (flagCaptcha == false) { alert(''); } else { poststr += '&captcha=' + vcode.value; ajaxpage2('/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) { http2.open('POST', url, true); http2.onreadystatechange = displayImg1; http2.send(null); }; function displayImg1() { if(http2.readyState == 4) { var showimage = http2.responseText; document.getElementById('captchaImage').innerHTML = showimage; }; }; function ReloadPage1() { ajaxpage2('/newsletter/frontend/form.php?group=1','divNewsletter1'); }; function CheckNewsletterForm1() { //var submission = document.NewsletterForm1.vercode.value; //var url = InstallationUrl + 'frontend/captcha-process.php?captcha=' + submission; var flagFields = true; var re = /([0-9a-zA-Z\.\-\_]+)@([0-9a-zA-Z\.\-\_]+)/; var message = 'Porfavor, llenar todos los espacios! \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 (document.NewsletterForm1.vercode) { http2.open('POST', InstallationUrl + 'frontend/captcha-process.php?captcha=' + document.NewsletterForm1.vercode.value, true); http2.onreadystatechange = function () { SubmitNewsletterForm1(poststr, document.NewsletterForm1.vercode); }; http2.send(null); } else { ajaxpage2('/newsletter/frontend/form.php?do=save&group=1'+poststr,'divNewsletter1'); } } else { alert(message); } }; loadNewsletter = '
'; document.writeln(loadNewsletter);