/*****************************AFFINAGE DETAIL********************************/

function Affin_ListeDeroulAction(id) {
    document.location.href = $('#' + id).val();
}

/*****************************MESSAGE ATTENTE********************************/

function MessageAttente() {

    $get('lbl_100').innerHTML = "<div id=DIV_LigneArticleCommentaire></div><div id='DIV2_LigneArticleCommentaire' style='TEXT-ALIGN:CENTER; overflow:hidden'><center><img border='0' src='Image/WEB/loading.gif' class='ImgLoading100' /><br><br>Chargement en cours<br>Merci de patienter.</center></div>";
    showTextLightbox(150, 150, true);
}

/* checked Adresse compte
--------------------------------*/
function CheckAdresse(Adresse1, Adresse2, Adresse3) {
    var mValid = false;
    try {
        if ($('#' + Adresse1).val() != '') { mValid = true; }
        if ($('#' + Adresse2).val() != '') { mValid = true; }
        if ($('#' + Adresse3).val() != '') { mValid = true; }
        return mValid;
    }
    catch (ex) { return false; }
}

/* repositionner titre page
--------------------------------*/
$(document).ready(function () {
    $('#bloc_titre_page').append($('#TitreHead'));
});


/* Fonction de debugage InfoDev
--------------------------------*/
function InfoDev(message, cumul) { if (!$('#InfoDev').length) { $('BODY').append('<div id="InfoDev" style="position: absolute; top:0; left:0; font-size:15px;"></div>'); } cumul ? $('#InfoDev').append("<br>" + message) : $('#InfoDev').html(message); }

/* colorbox 
--------------------------------*/
function showTextLightbox(largeurBox, hauteurBox, pasDeCroixFermer) {
    $.colorbox({
        html: $('#DIV2_LigneArticleCommentaire').html(),
        onCleanup: function() { $('#DIV2_LigneArticleCommentaire').remove(); }
    });
}
function hideLightbox() { $.colorbox.close(); }

/* mini panier
--------------------------------*/
$(document).ready(function() {
$('#mini_panier').qtip({
        content: $("#mini_panier_detail", this).html(),
        style: { width: { max: 420} },
        position: { corner: { target: 'bottomRight', tooltip: 'topRight' }, adjust: { x: 0, y: 0} },
        hide: { fixed: true }
    });
    $('#bloc_panier_compte').hover(function() { //quand on arrive sur la zone on update le panier au cas ou il a ete rempli
        $('#mini_panier').qtip("api").updateContent($("#mini_panier_detail", this).html());
        if ($("#mini_panier_detail").html().length > 25) { $('#lbl_005').qtip("api").updateWidth(410); }
    });
});


/* Fonction ShowBlocIdentification
--------------------------------*/
function ShowBlocIdentification(montrer) {
    var cacher = '';
    (montrer == 'old') ? cacher = 'new' : cacher = 'old';  
    $('#r_compte_' + montrer).attr('checked', 'checked');
    $('#r_compte_' + cacher).removeAttr('checked');
    $('#a_compte_' + montrer).addClass('checked');
    $('#a_compte_' + cacher).removeClass('checked');
    $('#div_compte_' + cacher).hide();
    $('#div_compte_' + montrer).show();
}

/*Gestion des cookis pour intro accueil*/

function ScanCookie(variable) {
    cook = document.cookie;
    variable += "=";
    place = cook.indexOf(variable, 0);
    if (place <= -1)
        return ("0");
    else {
        end = cook.indexOf(";", place)
        if (end <= -1)
            return (unescape(cook.substring(place + variable.length, cook.length)));
        else
            return (unescape(cook.substring(place + variable.length, end)));
    }
}

function CreationCookie(nom, valeur, permanent) {
    if (permanent) {
        dateExp = new Date(2020, 11, 11);
        dateExp = dateExp.toGMTString();
        ifpermanent = '; expires=' + dateExp + ';';
    }
    else
        ifpermanent = '';
    document.cookie = nom + '=' + escape(valeur) + ifpermanent;
}

/* Par contexte
--------------------------------*/

$(document).ready(function() {
    var contexte = $("#H_MEM_CONTEXTE").val();
    switch (contexte) {

        case "Accueil": /*############################ CONTEXTE ACCUEIL ###################################*/
            // if (ScanCookie("dejapopup") == 0) { //si on entre pour la premier fois sur le site
            /*pas de scroll*/
            //if (jQuery.browser.msie) { $('html').css({ "overflow": "hidden" }) } else { $('body').css({ "overflow": "hidden" }) }
            /*intro de la bonne taille et en absolut*/
            //$('#IntroAccueil, #IntroAccueil div').css({ "position": 'absolute', "top": 0, "left": 0, width: $(window).width(), height: $(window).height() - 138 });
            /*remettre contenu page visisble (derriere into)*/
            //$('#content').css({ 'display': 'block' });
            /*au clique sur div intro*/
            //$('#IntroAccueil').click(function() {
            //    $(this).slideUp('slow', 'swing',
            //        function() {
            //            $('html').css({ "overflow": "auto" });
            //            $('body').css({ "overflow": "auto" })
            //            $('#content').css({ 'display': 'block' });
            //        });
            //});
            //$(window).resize(function() { //si redimensionnement de la fenetre
            //       $('#IntroAccueil, #IntroAccueil div').css({ "position": 'absolute', "top": 0, "left": 0, width: $(window).width(), height: $(window).height() - 138 });
            //});
            //$('#IntroAccueil').cycle({
            //    fx: 'fade' //choose your transition type, ex: fade, scrollUp, shuffle, etc...
            //});

            //    CreationCookie("dejapopup", "oui", false)/*creer cookie*/
            //}
            //else {
            //    $('#content').show();
            //    $('#IntroAccueil').hide();
            //}

            break;
        case "View": /*############################### CONTEXTE VIEW ######################################*/

            /******Infobule sur bouton panier inactif ou choix taille ******/
            $('.ajout_panier_indisponible[tooltip]').each(function() {
                $(this).qtip({
                    content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
                    style: { tip: true, border: { radius: 5 }, name: 'dark' }, // Give it a crea mstyle to make it stand out
                    position: { corner: { tooltip: 'bottomMiddle', target: 'topMiddle'} }
                });
            })

            /****** zoom ICI et zoom XL ******/
            lancerGallery();

            break;
        case "PageStatique": /*####################### CONTEXTE PAGES SATTIQUES ###########################*/
            /******Caroussel******/
            $('#AccueilSlide').tinycarousel({ pager: true, display: 1, interval: true, controls: true, animation: true });


            break
        case "Identification": /*##################### CONTEXTE IDENTIFICATION ############################*/

            /****** suivi commande ******/
            $('.sc_detail').click(function() {
                var $tab1 = $(this).parent().parent().parent().parent('#suivi_commande_liste');
                $tab1.next('.sc_detail_tab').slideToggle('slow');
                return false;
            });

            /****** suivi devis ******/
            $('.sd_detail').click(function() {
                var $tab1 = $(this).parent().parent().parent().parent('#suivi_devis_liste');
                $tab1.next('.sd_detail_tab').slideToggle('slow');
                return false;
            });

            /****** sauvegarde panier ******/

            $('.sv_detail').click(function() {
                var $tab1 = $(this).parent().parent().parent().parent('#sauvegarde_panier_liste');
                $tab1.next('.sv_detail_tab').slideToggle('slow');
                return false;
            });

            /****** login (nouveau et ancien compte) ******/
            if ($('#r_compte_old').attr('checked') == true) {
                $('#div_compte_new').hide(); $('#a_compte_old').addClass('checked');
            }
            else {
                $('#div_compte_old').hide(); $('#a_compte_new').addClass('checked');
            }

            $('#a_compte_old').click(function() { ShowBlocIdentification('old') });
            $('#a_compte_new').click(function() { ShowBlocIdentification('new') });

            /****** liste de souhaits ******/
            $('#bloc_list_souhaits .commentaire .txt').each(function() {
                if ($(this).html().length < 2) { $(this).html('<span class="AjouterCommentaire">Ajouter un commentaire....</span>'); }
            });
            $('#bloc_list_souhaits .enlever').each(function(i) {
                $(this).qtip({
                    content: "supprimer de la liste",
                    show: 'mouseover',
                    hide: 'mouseout',
                    position: { corner: { tooltip: 'bottomMiddle', target: 'topMiddle'} },
                    style: { border: { width: 2, radius: 5, color: '#333' }, tip: true, background: '#333', color: '#fff' }
                });
            });

            /*titre du menu*/

            $('#WUC_Fiche1_MenuMonCompte').append('<div class="titre"><span>Mon Compte</span></div>')
            $('#WUC_Fiche1_MenuMonCompte').append($('#WUC_Fiche1_MenuMonCompte ul'));

            break
        case "AfficheResultatRechercheAvancee": /*#### CONTEXTE RECHERCHE #################################*/


            break
        case "ValidationPanier": /*################### CONTEXTE PANIER ####################################*/

            /******Point Relais Horaires ******/
            $(document).ready(function() {
                $('#gk_listerelais .horaire').each(function(i) {
                    $(this).qtip({
                        content: "<div class='BulleKiala'>" + $('#gk_listerelais p').eq(i).html() + "</div>",
                        show: 'mouseover',
                        hide: 'mouseout',
                        position: { corner: { tooltip: 'bottomMiddle', target: 'topMiddle'} },
                        style: { border: { width: 2, radius: 5, color: '#BAB3B3' }, tip: true, width: '400' }
                    });
                    $(this).click(function() { return false });
                });
            });

            /******Liste point relais Kiala deplacement******/
            $(document).ready(function() {

                if ($('#KIALA')) {

                    $('#grille_kiala').insertAfter('#KIALA');
                }

                if ($('#SOCOLISSIMO')) {
                    $('#info_socolissimo').insertAfter('#SOCOLISSIMO');
                    $('#btn_socolissimo').insertAfter('#SOCOLISSIMO');
                }

            });

            /******Caroussel******/
            $("#slide_panier").tinycarousel({ display: 5 });


            break
        default: /*################################## AUTRES #############################################*/

    }
});


/* liste de souhaits
--------------------------------*/
function OnSucceeded_AjaxAjoutCommentaireWebLigne(result) {
    var Tab = result.split('~#~');
    var mParamRetour = Tab[0];
    var mResult = Tab[1];
    if (mResult != '') { document.getElementById('commentaire_commentaire_' + mParamRetour).innerHTML = mResult; } else { document.getElementById('commentaire_commentaire_' + mParamRetour).innerHTML = '<span class="AjouterCommentaire">Ajouter un commentaire....</span>' }
    document.getElementById('commentaire_modification_' + mParamRetour).style.display = 'none';
    document.getElementById('commentaire_commentaire_' + mParamRetour).style.display = 'block';
}

function OnFailed_AjaxAjoutCommentaireWebLigne(error) {
    //alert('La méthode Ajax à causé une erreur : ' + error.get_message());
}
/*************************************************************************/
function OnSucceeded_AjaxEnvoiMail(result) {
    alert(result);
}

function OnFailed_AjaxEnvoiMail(error) {
    alert(error);
}


/* formulaires
--------------------------------*/

    function VerifEmail(email)
    {
        var indexOfArobase = email.indexOf("@");
        var indexOfPoint = email.lastIndexOf(".");
        return !((indexOfArobase < 3) || (indexOfPoint + 2 > email.length) || (indexOfPoint < indexOfArobase + 3));
    }

    function VerifFormAlerteDispo()
    {
        var mRetour = true;
        try
        {
            if (document.getElementById("FORM_MAIL").value.length < 1) { document.getElementById("FORM_MAIL").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("FORM_MAIL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_MAIL2").value.length < 1) { document.getElementById("FORM_MAIL2").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("FORM_MAIL2").style.borderColor = 'black'; }
            if (mRetour == false) { document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner SVP tous les champs marqu&eacute; s d'une ast&eacute; risque.</p>"; }
            else if (!VerifEmail(document.getElementById("FORM_MAIL").value)) {
                document.getElementById("FORM_MAIL").style.borderColor = 'red'; mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre saisie d'email comporte une erreur.</p>"; 
                }
            else if (document.getElementById("FORM_MAIL").value != document.getElementById("FORM_MAIL2").value) {
                document.getElementById("FORM_MAIL").style.borderColor = 'red'; document.getElementById("FORM_MAIL2").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>L'adresse email et la confirmation sont diff&eacute;rentes.</p>";
                }
        }
        catch (e) { alert(e); }  return mRetour;
    }

    function VerifFormQuestion() {
        var mRetour = true;
        try {
            if (document.getElementById("FORM_MESSAGE").value.length < 1) { document.getElementById("FORM_MESSAGE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_MESSAGE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL").value.length < 1) { document.getElementById("FORM_EMAIL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL2").value.length < 1) { document.getElementById("FORM_EMAIL2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL2").style.borderColor = 'black'; }
            if (document.getElementById("FORM_CIVILITE").value.length < 1) { document.getElementById("FORM_CIVILITE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CIVILITE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_NOM").value.length < 1) { document.getElementById("FORM_NOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_NOM").style.borderColor = 'black'; }
            if (document.getElementById("FORM_PRENOM").value.length < 1) { document.getElementById("FORM_PRENOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PRENOM").style.borderColor = 'black'; }
            if (document.getElementById("FORM_ADRESSE2").value.length < 1) { document.getElementById("FORM_ADRESSE2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_ADRESSE2").style.borderColor = 'black'; }
            if (document.getElementById("FORM_CODE_POSTAL").value.length < 1) { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_VILLE").value.length < 1) { document.getElementById("FORM_VILLE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_VILLE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_PAYS").value.length < 1) { document.getElementById("FORM_PAYS").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PAYS").style.borderColor = 'black'; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner SVP tous les champs marqu&eacute; s d'une ast&eacute; risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EMAIL").value)) {
                document.getElementById("FORM_EMAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre saisie d'email comporte une erreur.</p>";
            }
        }
        catch (e) { }
        return mRetour;
    }



    function VerifFormAvis() {
        var mRetour = true; try {
            if (document.getElementById("FORM_PSEUDO").value.length < 1) { document.getElementById("FORM_PSEUDO").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PSEUDO").style.borderColor = 'black'; }

            if (document.getElementById("FORM_TITRE").value.length < 1) { document.getElementById("FORM_TITRE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_TITRE").style.borderColor = 'black'; }

            if (document.getElementById("FORM_MESSAGE").value.length < 1) { document.getElementById("FORM_MESSAGE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_MESSAGE").style.borderColor = 'black'; }

            if (!mRetour)
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner tous les champs marqu&eacute;s d'une ast&eacute;risque.</p>";
        }
        catch (e) { }
        return mRetour;
    }

    function VerifContact() {
        var mRetour = true;
        try {
            if (document.getElementById("FORM_MESSAGE").value.length < 1) { document.getElementById("FORM_MESSAGE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_MESSAGE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL").value.length < 1) { document.getElementById("FORM_EMAIL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL2").value.length < 1) { document.getElementById("FORM_EMAIL2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL2").style.borderColor = 'black'; }
            if (document.getElementById("FORM_CIVILITE").value.length < 1) { document.getElementById("FORM_CIVILITE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CIVILITE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_NOM").value.length < 1) { document.getElementById("FORM_NOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_NOM").style.borderColor = 'black'; }
            if (document.getElementById("FORM_PRENOM").value.length < 1) { document.getElementById("FORM_PRENOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PRENOM").style.borderColor = 'black'; }
          //  if (document.getElementById("FORM_ADRESSE2").value.length < 1) { document.getElementById("FORM_ADRESSE2").style.borderColor = 'red'; mRetour = false; }
          //  else { document.getElementById("FORM_ADRESSE2").style.borderColor = 'black'; }
          //  if (document.getElementById("FORM_CODE_POSTAL").value.length < 1) { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'red'; mRetour = false; }
          //  else { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'black'; }
          //  if (document.getElementById("FORM_VILLE").value.length < 1) { document.getElementById("FORM_VILLE").style.borderColor = 'red'; mRetour = false; }
          //  else { document.getElementById("FORM_VILLE").style.borderColor = 'black'; }
          //  if (document.getElementById("FORM_PAYS").value.length < 1) { document.getElementById("FORM_PAYS").style.borderColor = 'red'; mRetour = false; }
          //  else { document.getElementById("FORM_PAYS").style.borderColor = 'black'; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner SVP tous les champs marqu&eacute; s d'une ast&eacute; risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EMAIL").value)) {
                document.getElementById("FORM_EMAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre saisie d'email comporte une erreur.</p>";
            }
        }
        catch (e) { }
        return mRetour;
    }

    function VerifFormDemandeCatalogue() {
        var mRetour = true;
        try {
            if (document.getElementById("FORM_CIVILITE").value.length < 1) { document.getElementById("FORM_CIVILITE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CIVILITE").style.borderColor = 'black'; }

            if (document.getElementById("FORM_NOM").value.length < 1) { document.getElementById("FORM_NOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_NOM").style.borderColor = 'black'; }

            if (document.getElementById("FORM_PRENOM").value.length < 1) { document.getElementById("FORM_PRENOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PRENOM").style.borderColor = 'black'; }

            if (document.getElementById("FORM_ADRESSE2").value.length < 1) { document.getElementById("FORM_ADRESSE2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_ADRESSE2").style.borderColor = 'black'; }

            if (document.getElementById("FORM_CODE_POSTAL").value.length < 1) { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'black'; }

            if (document.getElementById("FORM_VILLE").value.length < 1) { document.getElementById("FORM_VILLE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_VILLE").style.borderColor = 'black'; }

            if (document.getElementById("FORM_PAYS").value.length < 1) { document.getElementById("FORM_PAYS").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PAYS").style.borderColor = 'black'; }

            if (document.getElementById("FORM_EMAIL").value.length < 1) { document.getElementById("FORM_EMAIL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL").style.borderColor = 'black'; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner SVP tous les champs marqu&eacute; s d'une ast&eacute; risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EMAIL").value)) {
                document.getElementById("FORM_EMAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre saisie d'email comporte une erreur.</p>";
            }
        }
        catch (e) { } return mRetour;
    }

    function VerifFormEnvoiAmi() {
        var mRetour = true; try {
            if (document.getElementById("FORM_DESTINATAIRE_NOM").value.length < 1) { mRetour = false; }

            if (document.getElementById("FORM_DESTINATAIRE_MAIL").value.length < 1) { mRetour = false; }

            if (document.getElementById("FORM_MESSAGE").value.length < 1) { mRetour = false; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner tous les champs marqu&eacute;s d'une ast&eacute;risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EXPEDITEUR_MAIL").value)) {
                document.getElementById("FORM_EXPEDITEUR_MAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "Votre adresse email comporte une erreur.";
            }
            else if (!VerifEmail(document.getElementById("FORM_DESTINATAIRE_MAIL").value)) {
                document.getElementById("FORM_DESTINATAIRE_MAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "L'adresse email de votre ami comporte une erreur.";
            }
        }
        catch (e) { }
        return mRetour;
    }

    function VerifFormDemandeCatalogueAmi() { var mRetour = true; try { if (document.getElementById("CATALOGUE_PRENOM_PARRAIN").value.length < 1) { document.getElementById("CATALOGUE_PRENOM_PARRAIN").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_PRENOM_PARRAIN").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_EMAIL_PARRAIN").value.length < 1) { document.getElementById("CATALOGUE_EMAIL_PARRAIN").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_EMAIL_PARRAIN").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_CIVILITE").value.length < 1) { document.getElementById("CATALOGUE_CIVILITE").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_CIVILITE").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_NOM").value.length < 1) { document.getElementById("CATALOGUE_NOM").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_NOM").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_PRENOM").value.length < 1) { document.getElementById("CATALOGUE_PRENOM").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_PRENOM").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_ADRESSE2").value.length < 1) { document.getElementById("CATALOGUE_ADRESSE2").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_ADRESSE2").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_CODE_POSTAL").value.length < 1) { document.getElementById("CATALOGUE_CODE_POSTAL").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_CODE_POSTAL").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_VILLE").value.length < 1) { document.getElementById("CATALOGUE_VILLE").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_VILLE").style.borderColor = 'black'; } if (document.getElementById("CATALOGUE_PAYS").value.length < 1) { document.getElementById("CATALOGUE_PAYS").style.borderColor = 'red'; mRetour = false; } else { document.getElementById("CATALOGUE_PAYS").style.borderColor = 'black'; } if (!mRetour) { document.getElementById("CATALOGUE_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner tous les champs marqués d'une astérisque.</p>"; } else if (!VerifEmail(document.getElementById("CATALOGUE_EMAIL_PARRAIN").value)) { document.getElementById("CATALOGUE_EMAIL_PARRAIN").style.borderColor = 'red'; mRetour = false; document.getElementById("CATALOGUE_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre adresse email comporte une erreur.</p>"; } else if (!VerifEmail(document.getElementById("CATALOGUE_EMAIL").value)) { document.getElementById("CATALOGUE_EMAIL").style.borderColor = 'red'; mRetour = false; document.getElementById("CATALOGUE_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>L'adresse email de votre ami comporte une erreur.</p>"; } } catch (e) { } return mRetour; }

    function VerifEmail(email) {
        var indexOfArobase = email.indexOf("@"); var indexOfPoint = email.lastIndexOf("."); return !((indexOfArobase < 3) || (indexOfPoint + 2 > email.length) || (indexOfPoint < indexOfArobase + 3));
    }

    function VerifFormDisponibiliteSurDemande() {
        var mRetour = true;
        try {
            if (document.getElementById("FORM_MESSAGE").value.length < 1) { document.getElementById("FORM_MESSAGE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_MESSAGE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL").value.length < 1) { document.getElementById("FORM_EMAIL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL2").value.length < 1) { document.getElementById("FORM_EMAIL2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL2").style.borderColor = 'black'; }
            if (document.getElementById("FORM_CIVILITE").value.length < 1) { document.getElementById("FORM_CIVILITE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CIVILITE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_NOM").value.length < 1) { document.getElementById("FORM_NOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_NOM").style.borderColor = 'black'; }
            if (document.getElementById("FORM_PRENOM").value.length < 1) { document.getElementById("FORM_PRENOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PRENOM").style.borderColor = 'black'; }
            if (document.getElementById("FORM_ADRESSE2").value.length < 1) { document.getElementById("FORM_ADRESSE2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_ADRESSE2").style.borderColor = 'black'; }
            if (document.getElementById("FORM_CODE_POSTAL").value.length < 1) { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_CODE_POSTAL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_VILLE").value.length < 1) { document.getElementById("FORM_VILLE").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_VILLE").style.borderColor = 'black'; }
            if (document.getElementById("FORM_PAYS").value.length < 1) { document.getElementById("FORM_PAYS").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PAYS").style.borderColor = 'black'; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner SVP tous les champs marqu&eacute; s d'une ast&eacute; risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EMAIL").value)) {
                document.getElementById("FORM_EMAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre saisie d'email comporte une erreur.</p>";
            }
        }
        catch (e) { }
        return mRetour;
    }

    function VerifFormEnvoiAmi() {
        var mRetour = true; try {
            if (document.getElementById("FORM_EXPEDITEUR_NOM").value.length < 1) { mRetour = false; }

            if (document.getElementById("FORM_EXPEDITEUR_MAIL").value.length < 1) { mRetour = false; }

            if (document.getElementById("FORM_DESTINATAIRE_NOM").value.length < 1) { mRetour = false; }

            if (document.getElementById("FORM_DESTINATAIRE_MAIL").value.length < 1) { mRetour = false; }

            if (document.getElementById("FORM_MESSAGE").value.length < 1) { mRetour = false; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner tous les champs marqu&eacute;s d'une ast&eacute;risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EXPEDITEUR_MAIL").value)) {
                document.getElementById("FORM_EXPEDITEUR_MAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "Votre adresse email comporte une erreur.";
            }
            else if (!VerifEmail(document.getElementById("FORM_DESTINATAIRE_MAIL").value)) {
                document.getElementById("FORM_DESTINATAIRE_MAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "L'adresse email de votre ami comporte une erreur.";
            }
        }
        catch (e) { }
        return mRetour;
    }

    function VerifFormNewsletter() {
        var mRetour = true; try {
            if (document.getElementById("FORM_EMAIL").value.length < 1) { document.getElementById("FORM_EMAIL").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL").style.borderColor = 'black'; }
            if (document.getElementById("FORM_EMAIL2").value.length < 1) { document.getElementById("FORM_EMAIL2").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_EMAIL2").style.borderColor = 'black'; }
            if (document.getElementById("FORM_NOM").value.length < 1) { document.getElementById("FORM_NOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_NOM").style.borderColor = 'black'; }
            if (document.getElementById("FORM_PRENOM").value.length < 1) { document.getElementById("FORM_PRENOM").style.borderColor = 'red'; mRetour = false; }
            else { document.getElementById("FORM_PRENOM").style.borderColor = 'black'; }

            if (!mRetour) {
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Veuillez renseigner SVP tous les champs marqu&eacute; s d'une ast&eacute; risque.</p>";
            }
            else if (!VerifEmail(document.getElementById("FORM_EMAIL").value)) {
                document.getElementById("FORM_EMAIL").style.borderColor = 'red';
                mRetour = false;
                document.getElementById("FORM_TEXTE_ERREUR").innerHTML = "<p style='color:#ff0000'>Votre saisie d'email comporte une erreur.</p>";
            }
        }
        catch (e) { }
        return mRetour;
    }      
