/*function $( element ) { return document.getElementById( element ); }*/ function videInput( input, type ) { var defaut; switch ( type ) { case 'log' : defaut = 'Login'; break; case 'password' : defaut = 'Mot de passe'; break; } input.value = ( input.value == defaut ) ? '' : input.value; input.className = 'inputRempli'; } function verifInput( input, type ) { var defaut; switch ( type ) { case 'log' : defaut = 'Login'; break; case 'password' : defaut = 'Mot de passe'; break; } if ( input.value == '' || input.value == defaut ) { input.value = defaut; input.className = 'inputDefaut'; } else { input.className = 'inputRempli'; } } function verifFormLogin( form ) { if ( form.login.value == '' || form.login.value == 'Login' || form.password.value == '' || form.password.value == 'Mot de passe' ) { alert( 'Veuillez remplir tous les champs' ); return false; } else { return true; } } function verifFormInscription( tInputs ) { var alerte = ''; var statut = $('status'); for ( var i = 0; i <= tInputs.length - 1; i++ ) { var input = $(tInputs[i]); if ( input.value == '' && input.parentNode.style.display != 'none' ) { var label = input.parentNode.getElementsByTagName('label')[0]; alerte += 'Le champ "' + label.innerHTML.substr( 0, label.innerHTML.length - 2 ) + '" n\'est pas rempli.\n'; } } if ( $('company_identity_number').value == '' ) { switch ( statut.value ) { case '1' : var company_identity_number = 'SIRET'; break; case '4' : var company_identity_number = 'RSI/URSSAF'; break; } alerte += 'Le champ "N° ' + company_identity_number + '" n\'est pas rempli.\n'; } if ( $('password').value != $('password2').value ) alerte += 'Le mot de passe et sa confirmation ne sont pas identiques.\n'; var regMail = /^[-+.\w]{1,64}@[-.\w]{1,64}\.[-.\w]{2,6}$/i; if ( !regMail.test( $('email').value ) ) alerte += 'L\'adresse e-mail n\'est pas valide.\n'; if ( alerte ) { alert( alerte ); return false; } else { return true; } } function switchTxtCompanyIdentity( valeur ) { var societe = $( 'champ_societe' ); var champsARemplir = { 'societe' : 'WEBPORTAGE', 'nom' : 'TARTING', 'prenom' : 'Jérôme', 'adresse' : 'BP 9', 'code_postal' : '13580', 'ville' : 'LA FARE LES OLIVIERS', 'pays' : 'FRANCE' }; if ( valeur == 'WP' ) { societe.style.display = 'block'; for ( var champ in champsARemplir ) { $( champ ).readOnly = true; $( champ ).value = champsARemplir[champ]; $( champ ).style.background = '#e6e6e6'; $( champ ).style.border = '1px solid #e6e6e6'; $( champ ).style.color = '#808080'; if ( champ == 'pays' ) { $( champ ).parentNode.style.display = 'none'; } } } else { for ( var champ in champsARemplir ) { $( champ ).readOnly = false; $( champ ).value = ''; $( champ ).style.background = '#fff'; $( champ ).style.border = '1px solid #a7a7a7'; $( champ ).style.color = '#000'; if ( champ == 'pays' ) { $( champ ).parentNode.style.display = 'block'; } } if ( valeur == 'SOC' ) { societe.style.display = 'block'; } else { societe.style.display = 'none'; } } var contentStatut = $( 'content-statut' ).getElementsByTagName( 'blockquote' ); var nbStatut = contentStatut.length; for ( var i = 0; i < nbStatut; i++ ) { contentStatut[i].style.display = 'none'; } $( 'content-' + valeur ).style.display = 'block'; } function selectMoyenCom( select, value ) { var n = select.id.substr( select.id.lastIndexOf( '_' ) + 1 ); if ( value == '' ) { $( 'moyen_com_values_' + n ).disabled = true; $( 'moyen_com_values_' + n ).value = ''; $( 'moyen_com_values_' + n ).style.background = '#ebe9ec'; } else { $( 'moyen_com_values_' + n ).disabled = false; $( 'moyen_com_values_' + n ).style.background = '#fff'; } } function addMoyenCom( button ) { var select = button.parentNode.parentNode.getElementsByTagName( 'select' )[0]; var n = select.id.substr( select.id.lastIndexOf( '_' ) + 1 ); if ( $( 'moyen_com_values_' + n ).value != '' ) { var contenu = button.parentNode.parentNode.innerHTML; var p = document.createElement( 'p' ); var next = parseInt( n ) + 1; var reg1 = new RegExp( 'moyen_com_values_' + n, 'g' ); var reg2 = new RegExp( 'moyen_com_choix_' + n, 'g' ); p.innerHTML = contenu.replace( reg1, 'moyen_com_values_' + next ).replace( reg2, 'moyen_com_choix_' + next ); $( 'moyen-de-communication' ).appendChild( p ); $( 'moyen_com_values_' + next ).disabled = true; $( 'moyen_com_values_' + next ).value = ''; $( 'moyen_com_values_' + next ).style.background = '#ebe9ec'; $( 'moyen_com_choix_' + next ).selectedIndex = 0; button.getElementsByTagName( 'img' )[0].src = 'images/del-field.png'; button.getElementsByTagName( 'img' )[0].alt = '-'; button.onclick = function() { delMoyenCom( this ); }; } } function delMoyenCom( button ) { $( 'moyen-de-communication' ).removeChild( button.parentNode.parentNode ); } function verif_pseudo( value ) { new Ajax.Updater( 'verif-pseudo', 'ajax/verif-form/verif-pseudo.ajax.php', { parameters : 'pseudo=' + value, method : 'get', encoding : 'iso-8859-1' } ); } function verif_mdp( value ) { if ( value.length < 3 ) { $( 'verif-mdp' ).getElementsByTagName( 'img' )[0].src = 'images/ko-form.png'; } else { $( 'verif-mdp' ).getElementsByTagName( 'img' )[0].src = 'images/ok-form.png'; } } function verif_confirm_mdp() { if ( $( 'password' ).value != $( 'password2' ).value || $( 'password2' ).value == '' ) { $( 'verif-confirm-mdp' ).getElementsByTagName( 'img' )[0].src = 'images/ko-form.png'; } else { $( 'verif-confirm-mdp' ).getElementsByTagName( 'img' )[0].src = 'images/ok-form.png'; } } function verif_mail( value ) { if ( !/^[-a-z0-9!#$%&'*+\/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+\/=?^_`{|}~]+)*@(([a-z0-9]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z0-9]([-a-z0-9]*[a-z0-9]+)?){2,63}$/i.test( value ) ) { $( 'verif-mail' ).getElementsByTagName( 'img' )[0].src = 'images/ko-form.png'; } else { $( 'verif-mail' ).getElementsByTagName( 'img' )[0].src = 'images/ok-form.png'; } } function switchHelp( id ) { var div = $( id ); if ( div.style.display == 'none' ) { div.style.display = 'block'; } else { div.style.display = 'none'; } } function changeCompte() { $( 'form-keep-log' ).style.display = 'none'; $( 'form-no-keep-log' ).style.display = 'block'; }