function ValidarLogin (login, password) { var loginRegisto = document.getElementById(login); var passwordRegisto = document.getElementById(password); if(loginRegisto.value.length == 0) { notify('Tem de indicar um email', loginRegisto); SetBoldStyleToMandatoryFields_Login (); return false; } if(IsNotValidEmail(loginRegisto)) { notify('O utilizador não foi considerado correcto. Tem de ser uma conta de email', loginRegisto); return false; } if(passwordRegisto.value.length == 0) { notify('Tem de indicar a sua palavra-chave', passwordRegisto); SetBoldStyleToMandatoryFields_Login (); return false; } return true; } function ValidarRecuperarPass(registrationEmail) { var emailRegisto = document.getElementById(registrationEmail); if(emailRegisto.value.length == 0) { notify('Tem de indicar um email', emailRegisto); SetBoldStyleToMandatoryFields_Recover (); return false; } if(IsNotValidEmail(emailRegisto)) { notify('O utilizador não foi considerado correcto. Tem de ser uma conta de email', emailRegisto); return false; } return true; } function ValidarRegisto(registrationEmail, name, nif, country, mobile, pass1, pass2, conditions) { var emailRegisto = document.getElementById(registrationEmail); var nome = document.getElementById(name); var contribuinte = document.getElementById(nif); var pais = document.getElementById(country); var telemovel = document.getElementById(mobile); var password1 = document.getElementById(pass1); var password2 = document.getElementById(pass2); var condicoes = document.getElementById(conditions); if(emailRegisto.value.length == 0) { notify('Tem de indicar um email', emailRegisto); SetBoldStyleToMandatoryFields_NewUser (); return false; } if(IsNotValidEmail(emailRegisto)) { notify('O utilizador não foi considerado correcto. Tem de ser uma conta de email', emailRegisto); return false; } if(nome.value.length == 0) { notify('Tem de indicar o seu nome', nome); SetBoldStyleToMandatoryFields_NewUser (); return false; } if(pais.value == "") { notify('Por favor, seleccione o País', pais); SetBoldStyleToMandatoryFields_NewUser (); return false; } if(telemovel.value.length > 0 && telemovel.value.length < 7) { notify('O telemovel aparenta não estar correcto', telemovel); return false; } if(telemovel.value.length > 0 && IsNotValidInt(telemovel)) { notify('O telemovel apenas pode ter numeros', telemovel); return false; } if(password1.value.length == 0) { notify('Tem de indicar a sua palavra-chave', password1); SetBoldStyleToMandatoryFields_NewUser (); return false; } if(password1.value.length < 4) { notify('A palavra-chave tem de ter no minimo 4 caracteres', password1); return false; } if(password1.value != password2.value) { notify('As palavras-chave indicadas tem de ser iguais', password2); return false; } if(!condicoes.checked) { notify('Tem de aceitar as condições para se poder registar', condicoes); SetBoldStyleToMandatoryFields_NewUser (); return false; } return true; } function ValidarAlterarDadosRegisto(name, contactEmail, nif, country, phone, mobile, faxNr, smsNr) { var nome = document.getElementById(name); var emailContacto = document.getElementById(contactEmail); var contribuinte = document.getElementById(nif); var pais = document.getElementById(country); var telefone = document.getElementById(phone); var telemovel = document.getElementById(mobile); var fax = document.getElementById(faxNr); var sms = document.getElementById(faxNr); if(nome.value.length == 0) { SetBoldStyleToMandatoryFields_MinimalLoginData(); notify('Tem de indicar o seu nome', nome); return false; } if(emailContacto.value.length == 0) { SetBoldStyleToMandatoryFields_MinimalLoginData(); notify('Tem de indicar o seu email de contacto', emailContacto); return false; } if(IsNotValidEmail(emailContacto)) { SetBoldStyleToMandatoryFields_MinimalLoginData(); notify('O email de contacto não foi considerado correcto.', emailContacto); return false; } if(pais.value == "") { SetBoldStyleToMandatoryFields_MinimalLoginData(); notify('Por favor, seleccione o País', pais); return false; } if(telefone.value.length > 0 && telefone.value.length < 7) { notify('O telefone aparenta não estar correcto', telefone); return false; } if(telefone.value.length > 0 && IsNotValidInt(telefone)) { notify('O telefone apenas pode ter números', telefone); return false; } if(telemovel.value.length > 0 && telemovel.value.length < 7) { notify('O telemovel aparenta não estar correcto', telemovel); return false; } if(telemovel.value.length > 0 && IsNotValidInt(telemovel)) { notify('O telemovel apenas pode ter numeros', telemovel); return false; } if(fax.value.length > 0 && fax.value.length < 7) { notify('O fax aparenta não estar correcto', fax); return false; } if(fax.value.length > 0 && IsNotValidInt(fax)) { notify('O fax apenas pode ter numeros', fax); return false; } if(sms.value.length > 0 && sms.value.length < 7) { notify('O contacto SMS aparenta não estar correcto', sms); return false; } if(sms.value.length > 0 && IsNotValidInt(sms)) { notify('O contacto SMS apenas pode ter numeros', sms); return false; } return true; } function ValidarMudarPass (oldPass, pass1, pass2) { var oldPassword = document.getElementById(oldPass); var password1 = document.getElementById(pass1); var password2 = document.getElementById(pass2); if(oldPassword.value.length == 0) { notify('Tem de indicar a sua palavra-chave', oldPassword); SetBoldStyleToMandatoryFields_ChangePassword (); return false; } if(password1.value.length == 0) { notify('Tem de indicar a sua palavra-chave', password1); SetBoldStyleToMandatoryFields_ChangePassword (); return false; } if(password1.value.length < 4) { notify('A palavra-chave tem de ter no minimo 4 caracteres', password1); return false; } if(password1.value != password2.value) { notify('As palavras-chave indicadas tem de ser iguais', password2); return false; } return true; }