var bShowThankYou = false; var E_INVALID_EMAIL = ''; var E_INVALID_CODE = 'Le code de sécurité que vous avez saisi est erroné.'; var E_MIN6CATS = ''; var E_MIN100CHARS = 'Votre texte doit comporter au moins 100 caractères.'; var E_TRAVELPERIOD = ''; var E_TRAVELCOMPANY = ''; var E_NAME = ''; var E_EMAIL = ''; var E_GENERAL_ERROR = 'Erreur à l\'envoi du formulaire'; function fnHideReviewDiv() { try { document.getElementById('reviews').style.display = 'none'; } catch(e) { } } function fnShowReviewList() { fnHideReviewItems(); fnShowReviewResult(); try { document.getElementById('review_list').style.display = 'block'; } catch(e) { } initPage(); } function fnHideReviewList() { try { document.getElementById('review_list').style.display = 'none'; } catch(e) { } } function fnShowThankYou() { fnHideReviewItems(); try { document.getElementById('review_thankyou').style.display = 'block'; } catch(e) { } initPage(); } function fnHideThankYou() { try { document.getElementById('review_thankyou').style.display = 'none'; } catch(e) { } } function fnShowAddReview() { fnHideReviewItems(); try { document.getElementById('review_add').style.display = 'block'; } catch(e) { } initPage(); } function fnHideAddReview() { try { document.getElementById('review_add').style.display = 'none'; } catch(e) { } } function fnShowReviewResult() { try { document.getElementById('review_result').style.display = 'block'; } catch(e) { } } function fnHideReviewResult() { try { document.getElementById('review_result').style.display = 'none'; } catch(e) { } } function fnHideReviewItems() { fnHideReviewResult(); fnHideReviewList(); fnHideAddReview(); fnHideThankYou(); initPage(); } function fnCheckForm() { var iMinOpinion = 6; var iMinMessageSize = 100; var iOpinionCount = 0; var oForm = $('add_review'); oForm.getElements('input.review_category').each( function(el) { if (el.value != 0 && el.checked == true) iOpinionCount++; }); if (iOpinionCount < iMinOpinion) { alert(E_MIN6CATS); return false; } if ($('message').value.length < iMinMessageSize) { alert(E_MIN100CHARS); $('message').focus(); return false; } if ($('period').value == -1) { alert(E_TRAVELPERIOD); $('period').focus(); return false; } if ($('family').value == -1) { alert(E_TRAVELCOMPANY); $('family').focus(); return false; } if ($('name').value == '') { alert(E_NAME); $('name').focus(); return false; } if ($('email').value == '') { alert(E_EMAIL); $('email').focus(); return false; } return true; } function fnInvalidEmail() { alert(E_INVALID_EMAIL); } function fnInvalidCode() { alert(E_INVALID_CODE); } function fnGeneralError() { alert(E_GENERAL_ERROR); } function countMessage() { var iMax = 1000; var iRemaining = 0; var oTextarea = $('message'); var oTextRemain = $('message_remain'); var sCurrText = oTextarea.value; if (sCurrText.length > 1000) { oTextarea.value = sCurrText.substr(0, 1000); iRemaining = 0; } else iRemaining = iMax - sCurrText.length; oTextRemain.innerHTML = iRemaining; }