<?php include "app_modal.php"; ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.0.2/wow.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.js"></script>
<!-- <script src="<?= site_url; ?>/designer/js/lozad.js"></script> -->

<script>
    function stickyHeader() {
        if ($('.header').length) {
            var strickyScrollPos = 100;
            if ($(window).scrollTop() > strickyScrollPos) {
                $('.header').addClass('stricky-fixed');
            } else if ($(this).scrollTop() <= strickyScrollPos) {
                $('.header').removeClass('stricky-fixed');
            }
        };
    }

    jQuery(window).on('scroll', function() {
        (function($) {
            stickyHeader();
        })(jQuery);
    });

    if ($(".navigation").length) {
        $(".navigation .navbar button").on("click", function() {
            $(".navigation .menu").slideToggle();
            $(this).toggleClass('open');
            return false;
        });
        $(".navigation .cs-submenu").children("a").append(function() {
            return '<button class="dropdown-expander"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg></button>';
        });

    }

    if (document.documentElement.clientWidth < 1023) {
        $(".navigation .menu .dropdown-expander").on("click", function() {
            $(this).parent().parent().children(".cs-dropdown").slideToggle();
            console.log($(this).parents("li"));
            console.log($(this).parents().children(".dropdown-expander").toggleClass("rotated"));
            return false
        })
        $(document).click(function(e) {
            if (!$(e.target).closest('.navigation .navbar button').length) {
                $('.navigation .menu').stop(true).slideUp();
                $(".navigation .navbar button").removeClass('open');

            }
        });
    }

    var featuredProducts = $("#featuredProducts");
    featuredProducts.owlCarousel({
        loop: true,
        margin: 10,
        navSpeed: 500,
        nav: true,
        navText: ['<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>', '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>'],
        autoplay: false,
        dots: false,
        items: 3,
        responsiveClass: true,
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 1,
            },
            768: {
                items: 2
            },
            1024: {
                items: 3
            },
            1100: {
                items: 3
            }
        }
    });


    var ourProducts = $("#ourProducts");
    ourProducts.owlCarousel({
        loop: false,
        margin: 20,
        navSpeed: 500,
        nav: false,
        navText: ['<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>', '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>'],
        autoplay: false,
        dots: true,
        items: 4,
        responsiveClass: true,
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 1,
            },
            768: {
                items: 2
            },
            1024: {
                items: 2
            },
            1100: {
                items: 3
            }
        }
    });

    var testimonials = $("#testimonials");
    testimonials.owlCarousel({
        loop: true,
        margin: 0,
        navSpeed: 500,
        nav: false,
        navText: ['<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>', '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>'],
        autoplay: true,
        dots: true,
        items: 1,
        responsiveClass: true,
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 1,
            },
            768: {
                items: 1
            },
            1024: {
                items: 1
            },
            1100: {
                items: 1
            }
        }
    });

    var clients = $("#clients");
    clients.owlCarousel({
        loop: true,
        margin: 15,
        navSpeed: 500,
        nav: false,
        navText: ['<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>', '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>'],
        autoplay: true,
        dots: false,
        items: 4,
        responsiveClass: true,
        responsive: {
            0: {
                items: 2
            },
            600: {
                items: 2,
            },
            1024: {
                items: 4
            },
            1100: {
                items: 4
            }
        }
    });

    wow = new WOW({
        animateClass: 'animated',
        offset: 100,
        mobile: false
    });
    wow.init();

    $(window).on('scroll', function() {
        if ($(this).scrollTop() > 100) {
            $("#scrollUp").fadeIn();
        } else {
            $("#scrollUp").fadeOut();
        }
    });
    $("#scrollUp").on('click', function() {
        $("html, body").animate({
            scrollTop: 0
        }, 600);
        return false;
    });

    $('#thumbs img').click(function() {
        $('#largeImage').attr('src', $(this).attr('src').replace('thumb', 'large'));
        if ($(this).hasClass("active")) {
            $("#thumbs img").removeClass("active");
        } else {
            $("#thumbs img").removeClass("active");
            $(this).addClass("active");
        }
    });

    $(".wps_right table").wrap('<div class="table-responsive"></div>');
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.9.0/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.13/js/intlTelInput-jquery.min.js"></script> -->
<script src="<?= site_url; ?>/designer/js/intlTelInput-jquery.js"></script>
<script>
    setTimeout(function() {
        $.getScript("https://www.google.com/recaptcha/api.js");
    }, 7000);
</script>

<script>
     $(".telePhone").intlTelInput({
        preferredCountries: ["in", "us"],
        initialCountry: "in",
        separateDialCode: true,
    });


    function setupPhoneValidation(formId) {
        $(formId + ' .telePhone').on('countrychange', function() {
            let countryData = $(this).intlTelInput("getSelectedCountryData");
            let validator = $(formId).validate();

            if (countryData.iso2 === 'in') {
                $(this).attr('maxlength', 10);
                validator.settings.rules.mobile.minlength = 10;
                validator.settings.rules.mobile.maxlength = 10;
                validator.settings.messages.mobile.minlength = "Your Mobile No. must be at least 10 digits long";
                validator.settings.messages.mobile.maxlength = "Your Mobile No. must be at least 10 digits long";
            } else {
                $(this).attr('maxlength', 17); // Increase maxlength for other countries
                validator.settings.rules.mobile.minlength = 4; // Set a minimum length
                validator.settings.rules.mobile.maxlength = 17; // Allow up to 17 digits
                validator.settings.messages.mobile.minlength = "Your Mobile No. must be 4-17 digits long";
                validator.settings.messages.mobile.maxlength = "Your Mobile No. must be 4-17 digits long";
            }

            $(this).valid();
        });
    }
    $(document).ready(function() {
        setupPhoneValidation("#contact_id");
        $("#contact_id").validate({
            rules: {
                wname: "required",
                wmobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                wname: "Please Enter Your Name",
                wmobile: {
                    required: "Please Enter Your mobile Number",
                    number: "Mobile Number Must be Number",
                    minlength: "Mobile Number must have 10 digits",
                    maxlength: "Mobile Number must have 10 digits",
                }
            },
        });
    });
    $(document).ready(function() {
        setupPhoneValidation("#contact_form");
        $("#contact_form").validate({
            rules: {
                name: "required",
                message: {
                    required: true,
                },
                location: {
                    required: true,
                },
                email: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "Please enter your name",
                message: {
                    required: "Please enter your message",
                },
                email: {
                    required: "Please enter your email address"
                },
                location: {
                    required: "Please enter your location",
                },
                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: '<?= site_url; ?>/contacts.php',
                    type: 'POST',
                    data: $('#contact_form').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#pop_up').text(response.message_response).css('color',
                                'green');
                            $('#contact_form')[0].reset();
                            grecaptcha.reset();
                        } else {
                            $('#pop_up').text(response.message_response).css('color',
                                'red');
                        }
                    }
                });
            }
        });
    });
    $(document).ready(function() {
        setupPhoneValidation("#enq_pop_form1");
        $("#enq_pop_form1").validate({
            rules: {
                name: "required",

                message: {
                    required: true,
                },
                location: {
                    required: true,
                },
                email: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "Please enter your name",
                message: {
                    required: "Please enter your message",
                },
                email: {
                    required: "Please enter your email address"
                },
                location: {
                    required: "Please enter Your Location",
                },

                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: '<?= site_url; ?>/enquiry_popup.php',
                    type: 'POST',
                    data: $('#enq_pop_form1').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#enq_pop_up').text(response.message_response).css('color',
                                'green');
                            $('#enq_pop_form1')[0].reset();
                            grecaptcha.reset();
                        } else {
                            $('#enq_pop_up').text(response.message_response).css('color',
                                'red');
                        }
                    }
                });
            }
        });
    });

    $(document).ready(function() {
        setupPhoneValidation("#product_pop_form");
        $("#product_pop_form").validate({
            rules: {
                name: "required",
                quantity: "required",
                message: {
                    required: true,
                },
                location: {
                    required: true,
                },
                email: {
                    required: true,
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "Please enter your name",
                message: {
                    required: "Please enter your message",
                },
                email: {
                    required: "Please enter your email address"
                },
                location: {
                    required: "Please enter Your Location",
                },
                quantity: {
                    required: "Please enter order quantity",
                },
                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: '<?= site_url; ?>/enquirycat_popup.php',
                    type: 'POST',
                    data: $('#product_pop_form').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#cat_pop_up').text(response.message_response).css('color',
                                'green');
                            $('#product_pop_form')[0].reset();
                            grecaptcha.reset();
                        } else {
                            $('#cat_pop_up').text(response.message_response).css('color',
                                'red');
                        }
                    }
                });
            }
        });
    });

    $(document).ready(function() {
        setupPhoneValidation("#callback_form");
        $("#callback_form").validate({
            rules: {
                name: "required",
                mobile: {
                    required: true,
                    number: true,
                    minlength: 10,
                    maxlength: 10,
                }
            },
            messages: {
                name: "Please enter your name",
                mobile: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be 10 digits long",
                    maxlength: "Your Mobile No. must be 10 digits long",
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: '<?= site_url; ?>/ajax_enq_action.php',
                    type: 'POST',
                    data: $('#callback_form').serialize(),
                    dataType: 'json',
                    success: function(response) {
                        if (response.status == true) {
                            $('#cpop_up').text(response.message_response).css('color',
                                'green');
                            $('#callback_form')[0].reset();
                            grecaptcha.reset();
                        } else {
                            $('#cpop_up').text(response.message_response).css('color',
                                'red');
                        }
                    }
                });
            }
        });
    });

    
$(document).ready(function () {
    setupPhoneValidation("#whatsapp_form");
$("#whatsapp_form").validate({

   rules: {

      name: "required",

      mobile: {

         required: true,

         number: true,

         minlength: 10,

         maxlength: 10,

      }

   },

   messages: {

      name: "Please Enter Your Name",

      mobile: {

         required: "Please Enter Your mobile Number",

         number: "Mobile Number Must be Number",

         minlength: "Mobile Number must have 10 digits",

         maxlength: "Mobile Number must have 10 digits",

      }

   },

});

});

$('#whatsapp_form').submit(function (e) {

e.preventDefault();

$(':input[type="submit"]').prop('disabled', true);

$.ajax({

   'url': '<?= site_url; ?>/whatsapp_enq.php',

   'type': 'POST',

   'dataType': 'json',

   'data': $(this).serialize(),

   'success': function (result) {

      if (result.status == false) {

         $('.wht_success_message').text('');

         $('.wht_error_message').text(result.message_response)

         $(':input[type="submit"]').prop('disabled', false);

      } else {

         $('.wht_error_message').text('');

         $('.wht_success_message').text("You Have Successfully Submitted enquiry. We will contact you soon.");

         $('#whatsapp_form').trigger("reset");

         window.open(result.message_response, '_blank');

         $(':input[type="submit"]').prop('disabled', false);

      }

   }

});

});

    // code for form validation 
    function ValidateAlpha(evt) {
        var keyCode = (evt.which) ? evt.which : evt.keyCode
        if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 123) && keyCode != 32)
            return false;
        return true;
    }

    function isNumberKey(evt) {
        //var e = evt || window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode
        if (charCode != 46 && charCode > 31 &&
            (charCode < 48 || charCode > 57))
            return false;
        return true;
    }

    function validateOnlyTextField(element) {
        var str = element.value;
        if (str == ' ') {
            element.value = "";
        }
        if (!(/^[a-zA-Z\s]+$/.test(str))) {
            // console.log('String contain number characters');
            str = str.substr(0, str.length - 1);
            element.value = "";
        }
    }


    $('.iti__country-list li').click(function() {
        $("#code").val($(this).data('dial-code'));
        $(".mobile").val($(this).data('country-code-code'));
        $('#countryName').val($(".iti__country-name", this).text());
        $(".code").val($(this).data('dial-code'));
        $('.countryName').val($(".iti__country-name", this).text());
    })
</script>

<!--Start of Tawk.to Script-->
<script>
    setTimeout(function() {
        var Tawk_API = Tawk_API || {},
            Tawk_LoadStart = new Date();
        (function() {
            var s1 = document.createElement("script"),
                s0 = document.getElementsByTagName("script")[0];
            s1.async = true;
            s1.src = 'https://embed.tawk.to/659b79750ff6374032bd87ba/1hjjl4toh';
            s1.charset = 'UTF-8';
            s1.setAttribute('crossorigin', '*');
            s0.parentNode.insertBefore(s1, s0);
        })();
    }, 7000);

    //disabling context menu
document.onkeydown = function (e) {
    if (e.ctrlKey &&
        (e.keyCode === 67 ||
            e.keyCode === 86 ||
            e.keyCode === 85 ||
            e.keyCode === 117)) {
        return false;
    } else {
        return true;
    }
};
$(document).keypress("u", function (e) {
    if (e.ctrlKey) {
        return false;
    }
    else {
        return true;
    }
});
document.addEventListener("contextmenu", function (e) {
    e.preventDefault();
}, false);

</script>
<!--End of Tawk.to Script-->
