$(document).ready(function () {

    $(window).scroll(function () {
        if ($(this).scrollTop() >= 100) {
            $('header').addClass("sticky");
        } else {
            $('header').removeClass("sticky");
        }
    });

    $(".menu-toggle").click(function () {
        if ($(".mob-nav").hasClass("open")) {
            $(".mob-nav").removeClass("open");
            $('#main').animate({
                left: '0'
            }, 400, 'easeOutBack');
            $(this).removeClass("active");
            $("#main").removeClass("active");
        } else {
            $(".mob-nav").addClass("open");
            $(this).addClass("active");
            $("#main").addClass("active");
            $('#main').animate({
                left: '-250px'
            }, 400, 'easeOutBack');
        }
    });
    
    if ($('.profile-feature-more').length != 0) {
    $('.profile-feature-more').magnificPopup({
                delegate: 'a'
                , type: 'image'
                , tLoading: 'Loading image #%curr%...'
                , mainClass: 'mfp-img-mobile'
                , transition: 'elastic'
                , gallery: {
                    enabled: true
                    , navigateByImgClick: false
                    , preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
                }
            });
    }
    /*if ($('.filter-btn').length != 0) {
        $(".filter-btn").click(function () {
            $(".filter-panel").fadeToggle("slow");
        });
    }*/
     if ($('.image-link').length != 0) {
    $('.image-link').magnificPopup({
  type:'image'
 
});
     }
    
    
});

$(window).load(function () {

    $('li.dropdown').hover(function () {
        $(this).find('.dropdown-menu').stop(true, true).fadeIn(500);
    }, function () {
        $(this).find('.dropdown-menu').stop(true, true).fadeOut(500);
    });

});

if ($('select').length != 0) {
    (function ($) {
        function floatLabel(inputType) {
            $(inputType).each(function () {
                var $this = $(this);
                // on focus add cladd active to label
                $this.focus(function () {
                    $this.next().addClass("select-active");
                });
                //on blur check field and remove class if needed
                $this.blur(function () {
                    if ($this.val() === '' || $this.val() === 'blank') {
                        $this.next().removeClass();
                    }
                });
            });
        }
        // just add a class of "float-label to the input field!"
        floatLabel(".float-label");
    })(jQuery);
}

