function ValidateForm4(){ var flag = true; var message = 'Por favor, rellene todos los campos obligatorios!!'; var showcheck = -1;var showcheck = http.responseText; if (showcheck=='0') { message = 'Código de verificación no es correcto (*)'; flag = false; } if (document.ContactForm4.field12.value.length==0){ flag = false; } if (document.ContactForm4.field13.value.length==0){ flag = false; } if (document.ContactForm4.field14.value.length==0){ flag = false; } if (document.ContactForm4.field15.value.length==0){ flag = false; } if (!document.ContactForm4.field14.value.match(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) { flag = false; message += '\n"Email" no es válido!'; } if (flag == false) { alert(message); } else { document.ContactForm4.submit(); } }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 ValidateResult4() { if(http.readyState == 4) { ValidateForm4(); } } function CheckForm4() { var captchacheck = document.ContactForm4.captchacode.value; var captchasalt = document.ContactForm4.captchacodesalt.value; var url = '/mail/captcha-process.php?captcha=' + captchacheck + '&captchasalt=' + captchasalt; http.open('GET', url, true); http.onreadystatechange = ValidateResult4; http.send(null); }