//Verifica la correttezza dell'email function checkMail (str) { var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if (filter.test(str)) return true; else return false; } //contactBasic Send function checkAndSubmit_contactBasic() { var errMsg = ""; if (document.contact_contactBasic.contact_name.value == "") errMsg = errMsg + " - Please provide a valid Name;\n"; if (!checkMail(document.contact_contactBasic.email.value)) errMsg = errMsg + " - Please provide a valid email;\n"; if (document.contact_contactBasic.email.value != document.contact_contactBasic.email_confirm.value) errMsg = errMsg + " - Attention: Your emails do not match;\n"; if (document.contact_contactBasic.message.value == "") errMsg = errMsg + " - Please write a message;\n"; if (document.contact_contactBasic.security_code.value == "") errMsg = errMsg + " - Please copy the security code in the image into the text field alongside it;\n"; //if (document.contact_contactBasic.check_privacy.checked == false) errMsg = errMsg + " - Please check the box to acknowledge that you accept the terms of Privacy;\n"; if (errMsg != "") alert("Error:\n" + errMsg); else document.contact_contactBasic.submit(); } //contactSubscribe Send function checkAndSubmit_contactSubscribe() { var errMsg = ""; if ( (document.contact_contactSubscribe.data_0.value == "") || (document.contact_contactSubscribe.data_1.value == "") || (document.contact_contactSubscribe.data_2.value == "") || (document.contact_contactSubscribe.data_3.value == "") || (1==0) ) errMsg = errMsg + " - All data fields are required. Please fill out the form in its entirety:\n"; if (!checkMail(document.contact_contactSubscribe.email.value)) errMsg = errMsg + " - Please provide a valid email;\n"; if (document.contact_contactSubscribe.email.value != document.contact_contactSubscribe.email_confirm.value) errMsg = errMsg + " - Attention: Your emails do not match;\n"; if (document.contact_contactSubscribe.message.value == "") errMsg = errMsg + " - Please write a message;\n"; if (document.contact_contactSubscribe.security_code.value == "") errMsg = errMsg + " - Please copy the security code in the image into the text field alongside it;\n"; if (document.contact_contactSubscribe.check_privacy.checked == false) errMsg = errMsg + " - Please check the box to acknowledge that you accept the terms of Privacy;\n"; if (errMsg != "") alert("Error:\n" + errMsg); else document.contact_contactSubscribe.submit(); } //subscribe Send function checkAndSubmit_subscribe() { var errMsg = ""; if ( (document.contact_subscribe.data_0.value == "") || (document.contact_subscribe.data_1.value == "") || (document.contact_subscribe.data_2.value == "") || (document.contact_subscribe.data_3.value == "") || (1==0) ) errMsg = errMsg + " - All data fields are required. Please fill out the form in its entirety:\n"; if (!checkMail(document.contact_subscribe.email.value)) errMsg = errMsg + " - Please provide a valid email;\n"; if (document.contact_subscribe.email.value != document.contact_subscribe.email_confirm.value) errMsg = errMsg + " - Attention: Your emails do not match;\n"; if (document.contact_subscribe.security_code.value == "") errMsg = errMsg + " - Please copy the security code in the image into the text field alongside it;\n"; if (document.contact_subscribe.check_privacy.checked == false) errMsg = errMsg + " - Please check the box to acknowledge that you accept the terms of Privacy;\n"; if (errMsg != "") alert("Error:\n" + errMsg); else document.contact_subscribe.submit(); }