/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function validation(thisform) {
        var espressione = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
        if(!document.register.consenso.checked) {
            alert("Non hai dato il consenso al trattamento dei dati personali");
            return false;
        }
        if(document.register.username.value == "") {
            alert("Il campo username è vuoto");
            return false;
        } else {
            if (!document.register.username.value.match(espressione)) {
                alert("Il campo username non è un'indirizzo e-mail");
                return false;
            }
        }
        if(document.register.password.value.toString() != document.register.repeatPassword.value.toString()){
            alert("Le password non conicidono");
            return false;
        }
        if(document.register.password.value.toString() == "") {
            alert("Il campo password è vuoto");
            return false;
        }
        return true;
    }