(function ($) {
    "use strict";


    
    /*----------------------------------------
	   Slider Activation
	------------------------------------------*/

	/* Hero Slider Activation */

	
	/* Product Carousel Activation */
    var productCarousel = new Swiper('.product-carousel .swiper-container', {
		loop: true,
		slidesPerView: 3,
		spaceBetween: 0,
		pagination: true,
		navigation: true,
		observer: true,
		observeParents: true,

		navigation: {
			nextEl: '.product-carousel .swiper-product-button-next',
			prevEl: '.product-carousel .swiper-product-button-prev'
		},
		pagination: {
			el: '.product-carousel .swiper-pagination',
			type: 'bullets',
			clickable: 'true'
		},
		
		// Responsive breakpoints
		breakpoints: {
			// when window width is >= 320px
			320: {
				slidesPerView: 1,
			},
			// when window width is >= 480px
			480: {
				slidesPerView: 1,
			},
			// when window width is >= 575px
			575: {
				slidesPerView: 2,
			},
			// when window width is >= 768px
			768: {
				slidesPerView: 2,
			},
			// when window width is >= 992px
			992: {
				slidesPerView: 3,
			},
			// when window width is >= 1200px
			1200: {
				slidesPerView: 4,
			}
		}
	});	
	/* Modal Product Carousel Activation */
    var productCarousel = new Swiper('.modal-product-carousel .swiper-container', {
		loop: true,
		slidesPerView: 1,
		spaceBetween: 0,
		pagination: false,
		navigation: true,
		observer: true,
		observeParents: true,

		navigation: {
			nextEl: '.modal-product-carousel .swiper-product-button-next',
			prevEl: '.modal-product-carousel .swiper-product-button-prev'
		}
	});

	/* Product Deal Crousel Activation */
	var productCarousel = new Swiper('.product-deal-carousel .swiper-container', {
        loop: true,
        slidesPerView: 2,
		spaceBetween: 0,
		pagination: true,
		navigation: true,
		observer: true,
		observeParents: true,

		navigation: {
			nextEl: '.product-deal-carousel .swiper-product-deal-next',
			prevEl: '.product-deal-carousel .swiper-product-deal-prev'
		},
		pagination: {
			el: '.product-deal-carousel .swiper-pagination',
			type: 'bullets',
			clickable: 'true'
		},
		breakpoints: {
			// when window width is >= 320px
			320: {
				slidesPerView: 1,
			},
			// when window width is >= 480px
			480: {
				slidesPerView: 1,
			},
			// when window width is >= 575px
			575: {
				slidesPerView: 1,
			},
			// when window width is >= 768px
			768: {
				slidesPerView: 2,
			}
		}
	});

	/* Product List Crousel Activation */
	var productCarousel = new Swiper('.product-list-carousel .swiper-container', {
		loop: true,
		slidesPerView: 1,
		spaceBetween: 0,
		pagination: false,
		navigation: true,
		observer: true,
		observeParents: true,

		navigation: {
			nextEl: '.product-list-carousel .swiper-product-list-next',
			prevEl: '.product-list-carousel .swiper-product-list-prev'
		},
		// pagination: {
		// 	el: '.product-list-carousel .swiper-pagination',
		// 	type: 'bullets',
		// 	clickable: 'true'
		// }
	});
	var productCarousel = new Swiper('.product-list-carousel-2 .swiper-container', {
		loop: true,
		slidesPerView: 1,
		spaceBetween: 0,
		pagination: false,
		navigation: true,
		observer: true,
		observeParents: true,

		navigation: {
			nextEl: '.product-list-carousel-2 .swiper-product-list-next',
			prevEl: '.product-list-carousel-2 .swiper-product-list-prev'
		},
		// pagination: {
		// 	el: '.product-list-carousel-2 .swiper-pagination',
		// 	type: 'bullets',
		// 	clickable: 'true'
		// }
	});
	var productCarousel = new Swiper('.product-list-carousel-3 .swiper-container', {
		loop: true,
		slidesPerView: 1,
		spaceBetween: 0,
		pagination: false,
		navigation: true,
		observer: true,
		observeParents: true,

		navigation: {
			nextEl: '.product-list-carousel-3 .swiper-product-list-next',
			prevEl: '.product-list-carousel-3 .swiper-product-list-prev'
		}
	});

	/*-- Brand Logo --*/
	var brandCarousel = new Swiper('.brand-logo-carousel .swiper-container', {
		loop: true,
		speed: 750,
		spaceBetween: 30,
		slidesPerView: 5,
		effect: 'slide',
		//autoplay: {},

		// Responsive breakpoints
		breakpoints: {
			// when window width is >= 320px
			320: {
			slidesPerView: 2,
			spaceBetween: 20
			},
			// when window width is >= 480px
			480: {
			slidesPerView: 3,
			spaceBetween: 30
			},
			// when window width is >= 768px
			768: {
			slidesPerView: 4,
			spaceBetween: 30
			},
			// when window width is >= 992px
			992: {
			slidesPerView: 5,
			spaceBetween: 30
			}
		}
	});

    /*-- Single product with Thumbnail Vertical -- */
    var zoomThumb = new Swiper('.product-thumb-vertical', {
        spaceBetween: 0,
		slidesPerView: 4,
        direction: 'vertical',
        freeMode: true,
        watchSlidesVisibility: true,
		watchSlidesProgress: true,
		// Responsive breakpoints
		breakpoints: {
			// when window width is >= 320px
			320: {
			slidesPerView: 2,
			},
			// when window width is >= 480px
			480: {
			slidesPerView: 3,
			},
			// when window width is >= 575px
			575: {
			slidesPerView: 3,
			},
			// when window width is >= 767px
			767: {
			slidesPerView: 3,
			},
			// when window width is >= 991px
			991: {
				slidesPerView: 3,
			},
			// when window width is >= 1200px
			1200: {
				slidesPerView: 4,
			},
		}
	});
    var zoomTop = new Swiper('.single-product-vertical-tab', {
		spaceBetween: 10,
		loop: true,
		navigation: {
			nextEl: '.product-thumb-vertical .swiper-button-vertical-next',
			prevEl: '.product-thumb-vertical .swiper-button-vertical-prev',
		},
        thumbs: {
            swiper: zoomThumb
        }
	});
	
    /*-- Single product with Thumbnail Horizental -- */
	var galleryThumbs = new Swiper('.single-product-thumb', {
		spaceBetween: 10,
		slidesPerView: 4,
		// loop: false,
		freeMode: true,
		watchSlidesVisibility: true,
		watchSlidesProgress: true,
		// Responsive breakpoints
		breakpoints: {
			// when window width is >= 320px
			320: {
			slidesPerView: 2,
			},
			// when window width is >= 575px
			575: {
			slidesPerView: 3,
			},
			// when window width is >= 767px
			767: {
			slidesPerView: 4,
			},
			// when window width is >= 991px
			991: {
				slidesPerView: 3,
			},
			// when window width is >= 1200px
			1200: {
				slidesPerView: 4,
			},
		}
	});
	var galleryTop = new Swiper('.single-product-img', {
		spaceBetween: 10,
		loop: true,
		navigation: {
			nextEl: '.single-product-thumb, .swiper-button-horizental-next',
			prevEl: '.single-product-thumb, .swiper-button-horizental-prev',
		},
		// loop: true,
		// loopedSlides: 5, //looped slides should be the same
		thumbs: {
			swiper: galleryThumbs,
		},
	});


	


	/*----------------------------------------*/
	/*  Lightgallery Active
	/*----------------------------------------*/

	$(".popup-gallery").lightGallery({
		pager: false, // Enable/Disable pager
		thumbnail: false, // Enable thumbnails for the gallery
		fullScreen: true, // Enable/Disable fullscreen mode
		zoom: true, // Enable/Disable zoom option
		rotateLeft: true, // Enable/Disable Rotate Left
		rotateRight: true, // Enable/Disable Rotate Right
	  });


	
	/*-------------------------
        Ajax Contact Form 
    ---------------------------*/
    $(function() {

        // Get the form.
        var form = $('#contact-form');

        // Get the messages div.
        var formMessages = $('.form-messege');

        // Set up an event listener for the contact form.
        $(form).submit(function(e) {
            // Stop the browser from submitting the form.
            e.preventDefault();

            // Serialize the form data.
            var formData = $(form).serialize();

            // Submit the form using AJAX.
            $.ajax({
                type: 'POST',
                url: $(form).attr('action'),
                data: formData
            })
            .done(function(response) {
                // Make sure that the formMessages div has the 'success' class.
                $(formMessages).removeClass('error');
                $(formMessages).addClass('success');

                // Set the message text.
                $(formMessages).text(response);

                // Clear the form.
                $('#contact-form input,#contact-form textarea').val('');
            })
            .fail(function(data) {
                // Make sure that the formMessages div has the 'error' class.
                $(formMessages).removeClass('success');
                $(formMessages).addClass('error');

                // Set the message text.
                if (data.responseText !== '') {
                    $(formMessages).text(data.responseText);
                } else {
                    $(formMessages).text('Oops! An error occured and your message could not be sent.');
                }
            });
        });

    });



})(jQuery);

