$("#ButtonContactForm").click(function(Event) {


    if ($("#formContact")[0].checkValidity()) {

        var nom = $("#nomContact").val();
        var mail = $("#emailContact").val();
        var tel = $("#telephoneContact").val();
        var dept = $("#deptContact").val();
        var message = $("#messageContact").val();


        $('#containerOverlayContactForm').css('display', 'flex');


        var res = grecaptcha.execute('6Lccxp4UAAAAAJdVtCP-jnkmaD7jJYagy8f3_3i2', {
            action: 'contactHomePage'
        }).then(function(token) {

            // Recaptcha check    
            $.ajax({
                url: 'php/checkReCAPTCHA.php',
                type: 'POST',
                data: {
                    'g-recaptcha-response': token
                },
                dataType: 'html',
                success: function(resCAPCHA, statut) {

                    console.log(resCAPCHA);
                    if (resCAPCHA > 0.5) {

                        //   Email Send 

                        $.ajax({
                            url: 'php/ajax/contact_site.php',
                            type: 'POST',
                            data: {

                                'nom': nom,
                                'mail': mail,
                                'tel': tel,
                                'dept': dept,
                                'message': message

                            },
                            dataType: 'html',
                            success: function(code_html, statut) {


                                $('#texteOverlayContactForm').html("Merci, nous allons vous contacter dès que possible!");

                                setTimeout(function() {

                                    window.location = "/";

                                }, 2000)



                            }
                        });

                    } else {


                        alert("ERROR -> reCAPTCHA Veuillez contacter le sièges 04 50 45 82 47");

                        Event.preventDefault();
                    }

                }
            });
        });




        Event.preventDefault();

    } else {

    }

});