var uaeu;
(function ($) {
    "use strict";
    $("a.page-scroll").bind("click", function (event) {
        var $anchor = $(this);
        $("html, body")
            .stop()
            .animate({ scrollTop: $($anchor.attr("href")).offset().top - 100 }, 1250, "easeInOutExpo");
        event.preventDefault();
    });
    var windowWidth = $(window).width();
    if (windowWidth > 1024) {
        $("a.goToId").bind("click", function (event) {
            var $anchor2 = $(this);
            $("html, body")
                .stop()
                .animate({ scrollTop: $($anchor2.attr("href")).offset().top - 200 }, 1250, "easeInOutExpo");
            event.preventDefault();
        });
    } else {
        $("a.goToId").bind("click", function (event) {
            var $anchor2 = $(this);
            $("html, body")
                .stop()
                .animate({ scrollTop: $($anchor2.attr("href")).offset().top }, 1250, "easeInOutExpo");
            event.preventDefault();
        });
    }
    $("body").scrollspy({ target: ".navbar-fixed-top", offset: 51 });
    $(".navbar-collapse ul li a").click(function () {
        $(".navbar-toggle:visible").click();
    });
    $("#mainNav").affix({ offset: { top: 100 } });
    $(".mainMenu > li:not(:first)").hover(
        function () {
            $(this).addClass("activeNav");
            $(this).addClass("active");
            $(".mainNavBar").addClass("mainNavBarHovered");
        },
        function () {
            $(this).removeClass("active");
            $(this).removeClass("activeNav");
            $(".mainNavBar").removeClass("mainNavBarHovered");
        }
    );
    $(".tabgroup > div").hide();
    $(".tabgroup > div:first-of-type").show();
    $(".tabs a").click(function (e) {
        e.preventDefault();
        var tab = $(this).parents(".tabs").attr("data-tabgroup");
        var $this = $(this),
            tabgroup = "#" + $this.parents(".tabs").data("tabgroup"),
            others = $this.closest("li").siblings().children("a"),
            target = $this.attr("href");
        others.removeClass("active");
        $this.addClass("active");
        $(tabgroup).children("div").hide();
        $(tabgroup).children("div").removeClass("slideActive");
        $(target).show();
        setTimeout(function () {
            $(target).addClass("slideActive");
        }, 100);
    });
    $('[dir="ltr"] .tab1 a').click(function (e) {
        e.preventDefault();
        $(".tab-content").find(".spotlightSlider").slick("unslick");
        setTimeout(function () {
            uaeu.uaeuSlider(".spotlightSlider", 4, 1, 3600);
            $(window).trigger("resize");
        }, 50);
    });
    $('[dir="rtl"] .tab1 a').click(function (e) {
        e.preventDefault();
        $(".tab-content").find(".spotlightSlider").slick("unslick");
        setTimeout(function () {
            uaeu.uaeuSlider_ar(".spotlightSlider", 4, 1, 3600);
            $(window).trigger("resize");
        }, 50);
    });
    $('[dir="ltr"] .tab2 a').click(function (e) {
        e.preventDefault();
        $(".tab-content").find(".mediaSlider").slick("unslick");
        setTimeout(function () {
            uaeu.uaeuSlider(".mediaSlider", 4, 1, 3600);
            $(window).trigger("resize");
        }, 50);
    });
    $('[dir="rtl"] .tab2 a').click(function (e) {
        e.preventDefault();
        $(".tab-content").find(".mediaSlider").slick("unslick");
        setTimeout(function () {
            uaeu.uaeuSlider_ar(".mediaSlider", 4, 1, 3600);
            $(window).trigger("resize");
        }, 50);
    });
    $(".tab-style-3 .tab_list li").click(function (e) {
        e.preventDefault();
        $(".tab_content").find(".scheduleSlider").slick("unslick");
        setTimeout(function () {
            uaeu.uaeuVerticalSliderCustomCount(".scheduleSlider", 1000, 3);
            $(window).trigger("resize");
        }, 50);
    });
    uaeu = {
        uaeuSlider: function (elem, slidesToShow, slidesToScroll, speed) {
            $(elem).on("init", function (event, slick) {
                var elem = $(this).find(".slick-dots");
                $(this).siblings(".dotsContainer").find(".dotsWrap").append(elem);
            });
            var slider = $(elem).slick({
                dots: true,
                infinite: true,
                slidesToShow: slidesToShow,
                slidesToScroll: slidesToScroll,
                autoplay: true,
                autoplaySpeed: speed,
                responsive: [
                    { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true } },
                    { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 2 } },
                    { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } },
                ],
            });
            return slider;
        },
        uaeuSlider_ar: function (elem, slidesToShow, slidesToScroll, speed) {
            $(elem).on("init", function (event, slick) {
                var elem = $(this).find(".slick-dots");
                $(this).addClass("rtlSliderInitialised");
                $(this).siblings(".dotsContainer").find(".dotsWrap").append(elem).addClass("slick-dots-rtl");
            });
            var slider = $(elem).slick({
                rtl: true,
                dots: true,
                infinite: true,
                slidesToShow: slidesToShow,
                slidesToScroll: slidesToScroll,
                autoplay: true,
                autoplaySpeed: speed,
                responsive: [
                    { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true } },
                    { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 2 } },
                    { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } },
                ],
            });
            return slider;
        },
        uaeuSliderTwoBlock: function (elem, slidesToShow, slidesToScroll, speed) {
            $(elem).on("init", function (event, slick) {
                var elem = $(this).find(".slick-dots");
                $(this).siblings(".dotsContainer").find(".dotsWrap").append(elem);
            });
            var slider = $(elem).slick({
                dots: true,
                infinite: true,
                slidesToShow: slidesToShow,
                slidesToScroll: slidesToScroll,
                autoplay: true,
                autoplaySpeed: speed,
                responsive: [
                    { breakpoint: 1024, settings: { slidesToShow: 2, slidesToScroll: 2, infinite: true } },
                    { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 2 } },
                    { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } },
                ],
            });
            return slider;
        },
        uaeuSliderTwoBlock_ar: function (elem, slidesToShow, slidesToScroll, speed) {
            $(elem).on("init", function (event, slick) {
                var elem = $(this).find(".slick-dots");
                $(this).addClass("rtlSliderInitialised");
                $(this).siblings(".dotsContainer").find(".dotsWrap").append(elem).addClass("slick-dots-rtl");
            });
            var slider = $(elem).slick({
                dots: true,
                rtl: true,
                infinite: true,
                slidesToShow: slidesToShow,
                slidesToScroll: slidesToScroll,
                autoplay: true,
                autoplaySpeed: speed,
                responsive: [
                    { breakpoint: 1024, settings: { slidesToShow: 2, slidesToScroll: 2, infinite: true } },
                    { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 2 } },
                    { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } },
                ],
            });
            return slider;
        },
        uaeuVerticalSlider: function (elem, speed) {
            var slider = $(elem).slick({
                dots: true,
                pauseOnHover: true,
                pauseOnFocus: false,
                arrows: false,
                nextArrow: '<a class="next  bannerButton"><span class="icon-wrap"></span></a>',
                prevArrow: '<a class="prev bannerButton"><span class="icon-wrap"></span></a>',
                speed: speed,
                autoplay: true,
                vertical: true,
                slidesToShow: 1,
                slidesToScroll: 1,
                cssEase: "linear",
                adaptiveHeight: true,
                infinite: true,
            });
            return slider;
        },
        uaeuVerticalSliderCustomCount: function (elem, speed, items) {
            $(elem).on("init", function (event, slick) {
                var elem = $(this).find(".slick-dots");
                $(this).siblings(".dotsContainer").find(".dotsWrap").append(elem);
            });
            var slider = $(elem).slick({
                dots: true,
                pauseOnHover: true,
                pauseOnFocus: false,
                arrows: false,
                nextArrow: '<a class="next  bannerButton"><span class="icon-wrap"></span></a>',
                prevArrow: '<a class="prev bannerButton"><span class="icon-wrap"></span></a>',
                speed: speed,
                autoplay: true,
                vertical: true,
                slidesToShow: items,
                slidesToScroll: 1,
                verticalSwiping: true,
                cssEase: "linear",
                adaptiveHeight: true,
                infinite: true,
            });
            return slider;
        },
        uaeuSingleSlider: function (elem, speed) {
            $(elem).on("init", function (event, slick) {
                $(this).addClass("ltrTrue");
                var elem = $(this).find(".slick-dots");
                $(this).siblings(".dotsContainer").find(".dotsWrap").append(elem);
            });
            var slider = $(elem).slick({
                dots: true,
                pauseOnHover: false,
                pauseOnFocus: false,
                autoplaySpeed: speed,
                arrows: true,
                nextArrow: '<a class="next  bannerButton"><span class="icon-wrap"></span></a>',
                prevArrow: '<a class="prev bannerButton"><span class="icon-wrap"></span></a>',
                autoplay: true,
                slidesToShow: 1,
                slidesToScroll: 1,
                cssEase: "linear",
                infinite: true,
                fade: true,
            });
            return slider;
        },
    };
})(jQuery);
(function (window, document, $, undefined) {
    "use strict";
    window.myPrefix = {};
    // myPrefix.init = function () {
    //     myPrefix.introVideo();
    // };
    myPrefix.wow = function () {
        new WOW().init();
    };
    // myPrefix.introVideo = function () {
    //     var videoUrl = $(".youtubeBgVideo").attr("data-video-id");
    //      var a = $(".youtubeBgVideo").YTPlayer({ fitToBackground: true, videoId: videoUrl, mute: true, playerVars: { modestbranding: 0, autoplay: 1, controls: 0, showinfo: 0, branding: 0, rel: 0, autohide: 0 } });
    // };
    // myPrefix.abtVideo = function () {
    //     var playState = false;
    //     $(function () {
    //         $("#about__video").YTPlayer({
    //             fitToBackground: false,
    //             videoId: "KtGFIK2LIRQ",
    //             playerVars: { modestbranding: 0, autoplay: 0, controls: 0, showinfo: 0, branding: 0, rel: 0, autohide: 0 },
    //             callback: function () {
    //                 var player = $("#about__video").data("ytPlayer").player;
    //                 myPrefix.abPlayer = player;
    //                 player.addEventListener("onStateChange", function (yplayer) {
    //                     console.log(yplayer);
    //                     if (yplayer.data == 1 && window.innerWidth > 767) {
    //                         if (!playState) {
    //                             player.pauseVideo();
    //                             playState = true;
    //                         }
    //                     }
    //                 });
    //             },
    //         });
    //     });
    // };
    $(document).on("ready", myPrefix.init);
})(window, document, jQuery);
$("#myCarousel").carousel({ interval: 4000 });
$(document).ready(function () {});
function changeColor(color) {
    for (var i = 0; i < themeNames.length; i++) {
        $("body").removeClass(themeNames[i]);
    }
    $("body").addClass(color);
}
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
        var expires = "; expires=" + date.toGMTString();
    } else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(";");
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == " ") c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}
function eraseCookie(name) {
    createCookie(name, "", -1);
}
$(document).ready(function () {
    function fileUpload(fname, elem) {
        var filepath = fname;
        var m = filepath.match(/([^\/\\]+)$/);
        var filename = m[1];
        $(elem).parents(".fileUploadWrap").find(".filename").html(filename);
    }
    $("#file-upload1, #file-upload2").change(function (e) {
        fileUpload(e.target.value, e.target);
    });
    $(".header-style-3 ul.nav li.dropdown > a").hover(
        function () {
            $(this).next(".dropdown-menu").addClass("hovered");
        },
        function () {
            $(this).closest(".dropdown-menu").removeClass("hovered");
        }
    );
    $(".header-style-3 .dropdown-submenu > a").hover(
        function () {
            $(this).next(".dropdown-menu").addClass("hovered");
        },
        function () {
            $(this).closest(".dropdown-menu").removeClass("hovered");
        }
    );
    $(".forgetPass").click(function (event) {
        event.preventDefault();
        $(".login-tab a").addClass("active");
    });
    tab = $(".signinLoginPopUpWrap h3 a");
    tab.on("click", function (event) {
        event.preventDefault();
        tab.removeClass("active");
        $(this).addClass("active");
        tab_content = $(this).attr("href");
        $('div[id$="tab-content"]').removeClass("active");
        $(tab_content).addClass("active");
    });
    $(".tabs-menu a").click(function (event) {
        event.preventDefault();
        $(this).parent().addClass("current");
        $(this).parent().siblings().removeClass("current");
        var tab = $(this).attr("href");
        $(".tab-content").not(tab).css("display", "none");
        $(tab).fadeIn();
    });
    $('[data-toggle="tooltip"]').tooltip();
    $(".fancybox").fancybox({ padding: 1, maxWidth: 860, fitToView: true, width: "90%", height: "80%" });
    $(".fancybox-media")
        .attr("rel", "media-gallery")
        .fancybox({ openEffect: "none", padding: 1, closeEffect: "none", prevEffect: "none", nextEffect: "none", arrows: false, helpers: { media: {}, buttons: {} } });
    var i = 0;
    var $target = $(".navbar-brand a");
    setInterval(function () {
        $target.removeClass("active");
        $target.eq(i).addClass("active");
        if (i == $target.length - 1) i = 0;
        else i++;
    }, 4000);
    $(".mobileHeaderExpandBtn").click(function (event) {
        event.preventDefault();
        setTimeout(function () {
            $(".navbar-collapse").removeClass("in");
            $(".navbar-toggle").removeClass("collapsed");
            $(".push-nav-wrapper").removeClass("show-menu");
        }, 100);
        setTimeout(function () {
            $(".navRightElements").toggleClass("active");
        }, 200);
    });
    $(".navbar-toggle").click(function (event) {
        event.preventDefault();
        setTimeout(function () {
            $(".navRightElements").removeClass("active");
            $(".push-nav-wrapper").removeClass("show-menu");
        }, 100);
    });
    $(".js-nav-toggle").click(function (event) {
        event.preventDefault();
        setTimeout(function () {
            $(".navRightElements").removeClass("active");
            $(".navbar-toggle").removeClass("collapsed");
            $(".navbar-collapse").removeClass("in");
        }, 100);
    });
    var clickFlag = false;
    $(".invertColor").click(function (e) {
        e.preventDefault();
        $("body").toggleClass("color-invert");
        if (clickFlag === false) {
            $(".color-invert img").gray();
        }
        $(".grayscale").toggleClass("grayscale-off");
        clickFlag = true;
    });
    $(".themeSwitchDropDown .themeSwitchBtn").click(function (event) {
        event.preventDefault();
        var bodyClass = $(this).attr("data-value");
        changeColor(bodyClass);
        createCookie("Themecolor", bodyClass, 365);
        currentColor = bodyClass;
    });
    var fontSizes = ["text-normal", "text-medium", "text-large"];
    $(".resizer a").click(function (e) {
        var fontClass = $(this).attr("data-fontsize");
        for (var i = 0; i < fontSizes.length; i++) {
            $("body").removeClass(fontSizes[i]);
        }
        $("body").addClass(fontClass);
    });
    $(function () {
        $(".submenu-toggle").click(function (event) {
            event.preventDefault();
            if ($(this).closest("li").hasClass("active")) {
                $(this).closest("li").removeClass("active");
                return;
            }
            $(".mainMenu > li").removeClass("active");
            $(".submenu-toggle").removeClass("active");
            $(this).closest("li").toggleClass("active");
            $(this).toggleClass("active");
        });
    });
    $(window).scroll(function () {
        if ($(this).scrollTop() > 100) {
            $("#toTop").fadeIn();
        } else {
            $("#toTop").fadeOut();
        }
        var scroll = $(window).scrollTop();
        if (scroll >= 100) {
            $("body").addClass("bodyScrolled");
        } else {
            $("body").removeClass("bodyScrolled");
        }
    });
    $("#toTop").click(function () {
        $("html, body").animate({ scrollTop: 0 }, 600);
        return false;
    });
});
