
$(document).ready(function () {

    jQuery('body').on('click', '#cformsubmit', function (e) {

        jQuery('#cform-form-msg').removeClass('alert-success');
        jQuery('#cform-form-msg').removeClass('alert-danger');
        jQuery('#cformsubmit').attr('disabled', 'disabled');
        jQuery('#cform #ajax-loader-cform').css('display', 'block');
        jQuery.ajax({
            type: "POST",
            url: "send-cform.php",
            data: jQuery("#cform").serialize(),
            dataType: "json",
            success: function (data) {
                if ('success' == data.result)
                {
                    console.log(data.msg);
                    jQuery('#cform-form-msg').css('visibility', 'visible').hide().fadeIn().removeClass('hidden').addClass('alert-success');
                    jQuery('#cform-form-msg').html(data.msg);
                    jQuery('#cformsubmit').removeAttr('disabled');
                    jQuery('#ajax-loader-cform').css('display', 'none');
                    jQuery('html,body').animate({
                        scrollTop: jQuery("#cform-form-msg").offset().top - 20},
                            'slow');
                    window.setTimeout(function () {
                        window.location.href = "/SAB/thank-you.php"
                    }, 1000)

                }

                if ('error' == data.result)
                {
                    jQuery('#cform-form-msg').css('visibility', 'visible').hide().fadeIn().removeClass('hidden').addClass('alert-danger');
                    jQuery('#cform-form-msg').html(data.msg[0]);
                    jQuery('#cformsubmit').removeAttr('disabled');
                    jQuery('#ajax-loader-cform').css('display', 'none');
                    jQuery('html,body').animate({
                        scrollTop: $("#cform-form-msg").offset().top - 20},
                            'slow');
                }

            }
        });
        return false;
    });

   jQuery('body').on('click', '#cformsubmit2', function (e) {

        jQuery('#cform-form-msg').removeClass('alert-success');
        jQuery('#cform-form-msg').removeClass('alert-danger');
        jQuery('#cformsubmit2').attr('disabled', 'disabled');
        jQuery('#cform #ajax-loader-cform').css('display', 'block');
        jQuery.ajax({
            type: "POST",
            url: "send-cform2.php",
            data: jQuery("#cform2").serialize(),
            dataType: "json",
            success: function (data) {
                if ('success' == data.result)
                {
                    console.log(data.msg);
                    jQuery('#cform-form-msg').css('visibility', 'visible').hide().fadeIn().removeClass('hidden').addClass('alert-success');
                    jQuery('#cform-form-msg').html(data.msg);
                    jQuery('#cformsubmit2').removeAttr('disabled');
                    jQuery('#ajax-loader-cform').css('display', 'none');
                    jQuery('html,body').animate({
                        scrollTop: jQuery("#cform-form-msg").offset().top - 20},
                            'slow');
         

                }

                if ('error' == data.result)
                {
                    jQuery('#cform-form-msg').css('visibility', 'visible').hide().fadeIn().removeClass('hidden').addClass('alert-danger');
                    jQuery('#cform-form-msg').html(data.msg[0]);
                    jQuery('#cformsubmit2').removeAttr('disabled');
                    jQuery('#ajax-loader-cform').css('display', 'none');
                    jQuery('html,body').animate({
                        scrollTop: $("#cform-form-msg").offset().top - 20},
                            'slow');
                }

            }
        });
        return false;
    });
    var practice_area = $('#testimonial');
    practice_area.owlCarousel({
        autoplay: false,
        loop: false,
        nav: true,
        navText: ["<div class='nav-btn prev-slide'></div>", "<div class='nav-btn next-slide'></div>"],
        margin: 10,
        autoplayTimeout: 4000,
        responsiveClass: true,
        touchDrag: true,
        mouseDrag: false,
        responsive: {
            0: {
                items: 1,
                loop: true,

                nav: false
            },
            600: {
                items: 1,
                loop: true,

                nav: false
            },
            1000: {
                items: 1,
                nav: false,
                loop: false
            },

        }
    });
});


