function stickyHeader() {
    if ($(".menubar").length) {
        var HeaderPos = 100;
        if ($(window).scrollTop() > HeaderPos) {
            $(".menubar").addClass("stricky-fixed")
        } else {
            if ($(this).scrollTop() <= HeaderPos) {
                $(".menubar").removeClass("stricky-fixed");
            }
        }
    }
}
jQuery(window).on("scroll", function () {
    (function (HeaderPos) {
        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"></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');

        }
    });
}

jQuery(document).ready(function($) {
        $("#contact_form").validate({
            rules: {
               names: "required",
                messages: "required",
                locations: "required",
                emails: {
                    required: true,
                    email: true
                },
                mobiles: {
                    required: true,
                    number: true,
                    minlength: 10,
                }
            },
            messages: {
                names: "Please enter your name",
                messages: "Please enter message",
                emails: {
                    required: "Please enter your email address"
                },
                locations: "Please enter your location",
                mobiles: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be at least 10 characters long",
                }
            },
        })
    });
jQuery(document).ready(function($) {
        $("#quick_enquiry").validate({
            rules: {
                names: "required",
                messages: "required",
                locations: "required",
                emails: {
                    required: true,
                    email: true
                },
                mobiles: {
                    required: true,
                    number: true,
                    minlength: 10,
                }
            },
            messages: {
                names: "Please enter your name",
                messages: "Please enter message",
                emails: {
                    required: "Please enter your email address"
                },
                locations: "Please enter your location",
                mobiles: {
                    required: "Please enter your mobile no.",
                    number: "Mobile No. contains only numbers",
                    minlength: "Your Mobile No. must be at least 10 characters long",
                }
            },
        })
    });

var homeSlider = $("#slider");
homeSlider.owlCarousel({
    loop: true,
    margin: 0,
    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: true,
    dots: false,
    animateOut: "fadeOut",
    items: 1,
    responsiveClass: true,
    responsive: {
        0: {
            nav: false
        },
        600: {
            nav: false
        },
        1024: {},
        1100: {}
    }
});


var popularCourse = $("#popularCourse");
popularCourse.owlCarousel({
    loop: false,
    margin: 20,
    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,
        },
        1024: {
            items: 3
        },
        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: false,
    dots: true,
    items: 1,
    responsiveClass: true,
    responsive: {
        0: {
            items: 1
        },
        600: {
            items: 1,
        },
        1024: {
            items: 1
        },
        1100: {
            items: 1
        }
    }
});

$(document).ready(function() {
    var owl = $('.owl-carousel');
    owl.owlCarousel({
      loop: true,
      margin: 10,
      navRewind: false,
      responsive: {
        0: {
          items: 1
        },
        600: {
          items: 1
        },
        1000: {
          items: 1
        }
      }
    })
  })



var clients = $("#clients");
clients.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: false,
    items: 1,
    responsiveClass: true,
    responsive: {
        0: {
            items: 2
        },
        600: {
            items: 2,
        },
        1024: {
            items: 6
        },
        1100: {
            items: 6
        }
    }
});
wow = new WOW({
    animateClass: 'animated',
    offset: 100,
    mobile: false
});
wow.init();


$(window).on("scroll", function () {
    if ($(this).scrollTop() > 100) {
        $("#web-pulse-scroll-up").fadeIn()
    } else {
        $("#web-pulse-scroll-up").fadeOut()
    }
});
$("#web-pulse-scroll-up").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");
    }
});