<link href="<?php echo front_css(); ?>css/magnific-popup.css" rel="stylesheet" />
<script src="<?php echo front_css(); ?>js/jquery.magnific-popup.min.js"></script>
<link href="<?php echo front_css(); ?>css/swiper-bundle.min.css" rel="stylesheet" />
<script src="<?php echo front_css(); ?>js/swiper.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-js/1.3.0/sticky.min.js" integrity="sha512-3z3zGiu0PabNyuTAAfznBJFpOg4owG9oQQasE5BwiiH5BBwrAjbfgIe0RCdtHJ0BQV1YF2Shgokbz2NziLnkuQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->
<script type="text/javascript">
    document.getElementById("tele").href = "https://api.whatsapp.com/send?phone=<?php echo $product->prd_whatsapp_link ?>";
</script>

<?php
if (get_cookie('prd_inq') != 557528 && $app_setting->prd_first_pop_up == 1):
?>
    <script type="text/javascript">
        function close_adv_modal_2() {
            $('#grad1').hide();
        }
        $(document).ready(function() {

            var current_fs, next_fs, previous_fs;
            var opacity;
            $(".next").click(function() {
                current_fs = $(this).parent();
                next_fs = $(this).parent().next();
                $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
                next_fs.show();
                current_fs.animate({
                    opacity: 0
                }, {
                    step: function(now) {
                        opacity = 1 - now;
                        current_fs.css({
                            'display': 'none',
                            'position': 'relative'
                        });
                        next_fs.css({
                            'opacity': opacity
                        });
                    },
                    duration: 600
                });
            });
            $(".previous").click(function() {
                current_fs = $(this).parent();
                previous_fs = $(this).parent().prev();
                $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
                previous_fs.show();
                current_fs.animate({
                    opacity: 0
                }, {
                    step: function(now) {
                        opacity = 1 - now;
                        current_fs.css({
                            'display': 'none',
                            'position': 'relative'
                        });
                        previous_fs.css({
                            'opacity': opacity
                        });
                    },
                    duration: 600
                });
            });
            $('.radio-group .radio').click(function() {
                $(this).parent().find('.radio').removeClass('selected');
                $(this).addClass('selected');
            });
        });


        function close_adv_modal() {
            $("#dekstop-adv-popup").hide();
            $("#mydiv").removeClass("mydiv");
            // setTimeout(function() {
            //     $('#dekstop-adv-popup').show();
            //     $("#mydiv").addClass("mydiv");
            // }, 30000);
        }

        function myFunction(x) {
            if (x.matches) {
                window.onload = () => {
                    setTimeout(function() {
                        $('#grad1').show();
                    }, 60000);
                }
            } else {
                window.onload = () => {
                    setTimeout(function() {
                        $('#dekstop-adv-popup').show();
                        $("#mydiv").addClass("mydiv");
                    }, 60000);
                }
            }
        }

        var x = window.matchMedia("(max-width: 700px)")
        // myFunction(x)
        x.addListener(myFunction)
    </script>
<?php endif; ?>

<script>
    function open_model_product(e) {
        $('#price').val(e)
        $('#open_model').modal('show');
    }

    function open_demo_model_product() {
        $('#open_model_demo').modal('show');
    }

    function close_demo_model() {
        $('#open_model_demo').modal('hide');
    }

    function download_brochur() {
        $('#open_model_brochur').modal('show');
    }

    function close_brochur_model() {
        $('#open_model_brochur').modal('hide');
    }

    function close_video_model() {
        $('#open_video_brochur').modal('hide');
    }

    function brochure_form_submit() {
        var f_name = $('#b_f_name_1').val();
        var l_name = $('#b_l_name_1').val();
        var email = $('#b_email_1').val();
        var mobile = $('#b_mobile_1').val();
        var prd_id = $('#b_prd_id_1').val();
        $.ajax({
            url: '<?php echo base_url() ?>home/download_product_brochure',
            type: 'POST',
            data: {
                f_name: f_name,
                l_name: l_name,
                email: email,
                prd_id: prd_id,
                mobile: mobile
            },
            success: function(data) {
                window.open(data, '_blank');
                alert('Brochure Successfully Downloaded');
                location.reload();
            }
        })
    }

    function video_form_submit() {
        var f_name = $('#b_f_name').val();
        var l_name = $('#b_l_name').val();
        var email = $('#b_email').val();
        var mobile = $('#b_mobile').val();
        var prd_id = $('#b_prd_id').val();
        $.ajax({
            url: '<?php echo base_url() ?>home/video_form_submit',
            type: 'POST',
            data: {
                f_name: f_name,
                l_name: l_name,
                email: email,
                prd_id: prd_id,
                mobile: mobile
            },
            success: function(data) {
                $('#open_video_brochur').modal('hide');
                $('#homeVideo').modal('show');
            }
        })
    }

    $('.swiper-wrapper').magnificPopup({
        delegate: 'a',
        type: 'image',
        closeOnContentClick: false,
        closeBtnInside: false,
        mainClass: 'mfp-with-zoom mfp-img-mobile',
        gallery: {
            enabled: true
        },
        zoom: {
            enabled: true,
            duration: 300,
            opener: function(element) {
                return element.find('img');
            }
        }

    });
    var swiper = new Swiper(".mySwiper", {
        spaceBetween: 10,
        slidesPerView: 4,
        freeMode: true,
        watchSlidesProgress: true,
    });
    var swiper2 = new Swiper(".mySwiper2", {
        spaceBetween: 10,
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev",
        },
        thumbs: {
            swiper: swiper,
        },
    });
    var swiper = new Swiper(".mySwiper4", {
        spaceBetween: 10,
        slidesPerView: 4,
        freeMode: true,
        watchSlidesProgress: true,
    });
    var swiper2 = new Swiper(".mySwiper3", {
        spaceBetween: 10,
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev",
        },
        thumbs: {
            swiper: swiper,
        },
    });



   
</script>