

function vf_formvalidatecontatti(f) {
var alerted = false;
var result = true;

if (f['tipologiarichiesta'].value == '') {
if (!alerted) alert('Select the Type of Information Request.');
if (!alerted) f['tipologiarichiesta'].focus();
alerted = true;
result = false;
}

if (f['nominativo'].value == '') {
if (!alerted) alert('Enter your Name.');
if (!alerted) f['nominativo'].focus();
alerted = true;
result = false;
}

if (f['email'].value == '') {
if (!alerted) alert('Please enter a valid email address.');
if (!alerted) f['email'].focus();
alerted = true;
result = false;
}
var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
if (f['email'].value != '' && (!reg.test(f['email'].value))) {
if (!alerted) alert('E-Mail is not inserted correctly.');
if (!alerted) f['email'].focus();
alerted = true;
result = false;
}
if (f['telefono'].value == '') {
if (!alerted) alert('Enter a phone number.');
if (!alerted) f['telefono'].focus();
alerted = true;
result = false;
}
var reg = /^[0-9]*$/;
if (f['telefono'].value != '' && (!reg.test(f['telefono'].value))) {
if (!alerted) alert('The phone number is not correct risculta (only numbers).');
if (!alerted) f['telefono'].focus();
alerted = true;
result = false;
}
if (f['telefono'].value != '' && (f['telefono'].value.length < 5 || f['telefono'].value.length > 22)) {
if (!alerted) alert('The phone number is not correct risculta (min 5 - max 22).');
if (!alerted) f['telefono'].focus();
alerted = true;
result = false;
}

if (f['messaggio'].value == '') {
if (!alerted) alert('Enter a personal message.');
if (!alerted) f['messaggio'].focus();
alerted = true;
result = false;
}


var testa=false; for (i=0; i<f['informativaprivacy'].length; i++) { if (f['informativaprivacy'][i].checked) testa=true; };
if (!testa) {if (!alerted) alert('To send the form you must agree to the Privacy Act Statement.');
alerted = true;
result = false;
}
test=false; for (i=0; i<f['informativaprivacy'].length; i++) { if (f['informativaprivacy'][i].checked && f['informativaprivacy'][i].value=='acconsento') test=true; };
if (!test) {if (!alerted) alert('To send the form you must agree to the Privacy Act Statement');
alerted = true;
result = false;
}
return result;
}
