"use strict";
var $ = window.jQuery;
$(document).ready(function() {
    if (svg4everybody(), $(".gallery-slider").length && $(".gallery-slider").owlCarousel({
            items: 3,
            margin: 50,
            nav: !0,
            loop: !0,
            navText: !1,
            responsive: {
                0: {
                    items: 1,
                    margin: 5
                },
                768: {
                    items: 2,
                    margin: 5
                },
                1024: {
                    items: 3
                }
            }
        }), $(".partner-slider").length && $(".partner-slider").owlCarousel({
            items: 5,
            navText: !1,
            nav: !0,
            loop: !0,
            responsive: {
                0: {
                    items: 2
                },
                768: {
                    items: 3
                },
                1025: {
                    items: 5
                }
            }
        }), $(".preferences-slider").length && $(".preferences-slider").owlCarousel({
            items: 1,
            navText: !1,
            nav: !0,
            loop: !0,
            animateOut: "fadeOut"
        }), $(".open-popup-link").length && $(".open-popup-link").magnificPopup({
            type: "inline",
            closeBtnInside: !0,
            removalDelay: 300,
            mainClass: "mfp-fade",
            fixedContentPos: !0,
            overflowY: !0,
            callbacks: {
                open: function() {
                    window.matchMedia("(min-width: 1025px)").matches && $("#popup-link3").length && $("#popup-link3").niceScroll({
                        zindex: 9999,
                        cursorwidth: 10,
                        cursorborder: "1px solid #3d1e0d",
                        cursorcolor: "#ff9800",
                        cursorfixedheight: 30,
                        cursorborderradius: 50
                    })
                }
            }
        }), $(document).on("click", '.primary-navigation a[href^="#"]', function(e) {
            e.preventDefault(), $("html, body").animate({
                scrollTop: $($.attr(this, "href")).offset().top - 100
            }, 500)
        }), $('.hero a[href^="#"], .home-link').on("click", function(e) {
            e.preventDefault();
            var o = this.hash,
                i = $(o),
                r = $(window).width();
            r <= 1024 ? $("html, body").stop().animate({
                scrollTop: i.offset().top - 90
            }, 300, "swing", function() {
                window.location.hash = o
            }) : $("html, body").stop().animate({
                scrollTop: i.offset().top
            }, 300, "swing", function() {
                window.location.hash = o
            })
        }), $(".burger-menu").on("click", function() {
            $(".burger-item").toggleClass("is-open"), $(".primary-navigation").slideToggle()
        }), $(".site-header .list-item a").on("click", function() {
            var e = $(window).width();
            e < 1024 && ($(".burger-item").removeClass("is-open"), $(".primary-navigation").slideToggle())
        }), $(".hero").length && $(document).alton({
            firstClass: "hero",
            scrollMode: "headerScroll"
        }), $(".input-textarea").length) {						//end of if condition
        var e = $(window).width();
        e > 1024 && $(".input-textarea").niceScroll({
            zindex: 9999,
            cursorwidth: 10,
            cursorborder: "1px solid #3d1e0d",
            cursorcolor: "#ff9800",
            cursorfixedheight: 30,
            cursorborderradius: 50,
            nativeparentscrolling: !0
        })														// end of if statement
    }
    var e = $(window).width();
    e <= 1024 && ($(".hero-scroll-down").attr("href", "#about"), $(".home-link").attr("href", "#hero")), $.fn.contactUs = function(e) {
        var o = $.extend({
                form: ""
            }, e),
            i = $(this),
            r = o.form.attr("action"),
            n = '<span class="form-error" style="font-weight:bold;font-size:18px;position:absolute;bottom:5px;left:0;width:100%;">Please fill out all required fields properly. Thank you!</span>';
        i.on("click", function(e) {
            e.preventDefault();
            var i = o.form.serialize(),
                t = o.form.find('input[name="m_name"]'),
                s = o.form.find('input[name="m_email"]'),
                a = o.form.find('textarea[name="m_msg"]');
				
			/*$('#contactCheckbox').change(function(){
					var isCheckboxOk=this.checked ? true : false;
			});*/
			var isEmailOk = ("" !== s.val() && s.val().match('.+@.+\..+'));
			
            "" !== t.val() && isEmailOk && "" !== a.val() /*&& $("#contactCheckbox").prop("checked")*/ ? ($.ajax({
                type: "post",
                url: r,
                data: i,
                success: function(e) {
                    if (e.indexOf("successfully") !== -1) {
                        var o = $(".contact-overlay");
                        o.find("p").html(e), o.fadeIn(500, function() {
                            setTimeout(function() {
                                o.fadeOut(500, function() {
                                    var e = window.location;
                                    window.location.href = e
                                })
                            }, 2500)
                        })
                    }
                }
            }), t.css("border", "none"),
				s.css("border", "none"),
				a.css("border", "none"),
				$("#contactCheckboxLabel").css("color", "white")) 	: 
				
				(0 === $(".form-error").length && o.form.css("position", "relative").append(n), 
				"" === t.val() ? t.css("border", "2px solid red") : t.css("border", "none"), 
				isEmailOk ? s.css("border", "none") : s.css("border", 
				"2px solid red"), "" === a.val() ? a.css("border", "2px solid red") : a.css("border", "none"), 
				/*$("#contactCheckbox").prop("checked") ? $("#contactCheckboxLabel").css("color", "white") : $("#contactCheckboxLabel").css("color", "red"), */
				setTimeout(function() {
					$(".form-error").detach()
				}, 5e3))
        })
    }, $(".Submit").contactUs({
        form: $("#contact-us")
    })
}), $(window).load(function() {
    $(window).on("resize", function() {
        var e = $(window).height();
        $(".hero").css("height", e), $(window).on("scroll", function() {
            var e = $(".hero").height(),
                o = $(".subheader-bgr").height(),
                i = $(".site-header"),
                r = $(".subheader"),
                n = $(window).width();
            n > 1024 ? e + o - 200 < $(window).scrollTop() ? (i.addClass("is-fixed"), r.addClass("is-fixed")) : (i.removeClass("is-fixed"), r.removeClass("is-fixed")) : e - 150 < $(window).scrollTop() ? (i.addClass("is-fixed"), r.addClass("is-fixed")) : (i.removeClass("is-fixed"), r.removeClass("is-fixed")), 20 < $(window).scrollTop() ? $(".hero a").addClass("is-invisible") : $(".hero a").removeClass("is-invisible")
        }).trigger("scroll")
    }).trigger("resize")
});

/*
$(document).ready(function() {
	$('.galleryy').magnificPopup({
		delegate: 'a',
		
		type: 'image',
		tLoading: 'Loading image #%curr%...',
		mainClass: 'mfp-img-mobile',
		gallery: {
			enabled: true,
			navigateByImgClick: true,
			preload: [0,1], // Will preload 0 - before current, and 1 after the current image
			
		},
		image: {
			tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
			titleSrc: function(item) {
				return item.el.attr('title') + '<h6>by Cocktail Cruiser</h6>';
			}
		}
	});
});*/

$(document).ready(function() {
	$('.galleryy').magnificPopup({
		delegate: 'a',
		type: 'image',
		closeOnContentClick: false,
		closeBtnInside: false,
		mainClass: 'mfp-with-zoom mfp-img-mobile',
		image: {
			verticalFit: true,
			cursor: null,
			titleSrc: null, /*function(item) {
				return item.el.attr('title') + '<span style="font-family:Lobster;">, by Cocktail Cruiser</span>';
			}*/
		},
		gallery: {
			enabled: true
			
		},
		zoom: {
			enabled: true,
			duration: 300, // don't foget to change the duration also in CSS
			opener: function(element) {
				return element.find('img');
			}
		}
		
	});
});
