function validateLogin() {
    $('#formLogin [name=email]').on('change keyup', validate.mail);
    $('#formLogin [name=password]').on('change keyup', validate.notEmpty);
}

function validateChangeAddress() {
    $('#formChangeAddress [name=firstName]').on('change keyup', validate.name);
    $('#formChangeAddress [name=lastName]').on('change keyup', validate.name);
    $('#formChangeAddress [name=address]').on('change keyup', validate.nameNumberExtra);
    $('#formChangeAddress [name=city]').on('change keyup', validate.name);
    $('#formChangeAddress [name=postalCode]').on('change keyup', validate.postal);
    $('#formChangeAddress [name=phoneNumber]').on('change keyup', validate.numberExtra);
}

function validateChangeCreditCard() {
    $('#formChangeCreditCard [name=cardHolder]').on('change keyup', validate.name);
    $('#formChangeCreditCard [name=cardNumber]').on('change keyup', validate.creditCard);
    $('#formChangeCreditCard [name=expiryDate]').on('change keyup', validate.expiryDate);
    $('#formChangeCreditCard [name=cvcNumber]').on('change keyup', validate.numberCvc);
}

function validateChangeEmailAddress() {
    $('#formChangeEmailAddress [name=emailAddress]').on('change keyup', validate.mail);
}

function validateChangePassword() {
    $('#formChangePassword [name=oldPassword]').on('change keyup', validate.notEmpty);
    $('#formChangePassword [name=newPassword]').on('change keyup', validate.notEmpty);
    $('#formChangePassword [name=newPasswordRepeat]').on('change keyup', validate.notEmpty);
}

function validateForgottenPassword() {
    $('#formForgottenPassword [name=emailAddress]').on('change keyup', validate.mail);
}


//Init functions

$(function () {
    validateLogin();
    validateChangeAddress();
    validateChangeCreditCard();
    validateChangeEmailAddress();
    validateChangePassword();
    validateForgottenPassword();
});