﻿function convalidaForm(sender) {
    var privacyChecked = document.getElementById('ctl00_ContentPlaceHolder1_chkPrivacy').checked;
    var email = document.getElementById('ctl00_ContentPlaceHolder1_txtAgModMail').value;
    var name = document.getElementById('ctl00_ContentPlaceHolder1_txtAgModNome').value;

    var text = '';
    if ((email=='')||(email=='E-mail'))
        text = text + '- Inserire l\'indirizzo E-mail\n';
    if ((name == '') || (name == 'Nome e cognome'))
        text = text + '- Inserire nome e cognome\n';
    if (!privacyChecked)
        text = text + '- Accettare le condizioni sulla privacy\n';
    if (text != '') {
        alert(text);
        return false;
    }
    return true;
}

function checkMail() {
    if (location.href.toString().indexOf('result=OK') > 0)
        alert('Richiesta effettuata con successo!\nUn nostro agente si metterà in conttato appena possibile.\n\nGrazie per la fiducia accordataci,\nlo staff di Unire.');
    if (location.href.toString().indexOf('result=FAIL') > 0)
        alert('Si è verificato un errore durante la spedizione della richiesa.\nSi prega di riprovare più tardi e, se il problema persiste, di segnalarlo al nostro numero verde');
}
