var scrollH=0;
function setScroll(anchorCur) {
    jQuery("html,body").delay(300).animate({ scrollTop: jQuery(anchorCur).offset().top - atH - scrollH }, 800, 'easeInOutExpo');
};
$(document).ready(function () {
    var acH;
    if (jQuery(".pagenav").length >= 1) {
        acH = jQuery(".pagenav").offset().top - atH;
    }
    jQuery(window).scroll(function () {
        var windowTop = jQuery(window).scrollTop();
        if (windowTop > acH) {
            jQuery(".pagenav").addClass("fixed");
        } else {
            jQuery(".pagenav").removeClass("fixed");
        };
    });
});

$(document).on('click', '.overlayClose', function () {
    $('.imgShowBox').removeClass('img-show');
    jQuery('html').removeClass('openImg');
    setTimeout(function () { jQuery('.imgShowBox').remove(); }, 800);
});
function openshowImg(num, imgthis) {
    jQuery('html').addClass('openImg');
    jQuery("body").append('<div class="imgShowBox"><div class="imgShowDemo imgShowDemo2"></div><a class="overlayClose"><i></i></a>');
    var imgList = jQuery(imgthis);
    for (var i = 0 ; i < imgList.length ; i++) {
        jQuery('.imgShowDemo').append('<div class="item"><img src="" class="img"/><div class="txt"><p class="i"></p></div></div>')
        var imgurl = imgList.eq(i).attr('data-img');
        var imgtitle = imgList.eq(i).attr('data-title');
        jQuery('.imgShowDemo .item').eq(i).find(".img").attr("src", imgurl);
        jQuery('.imgShowDemo .item').eq(i).find('.i').html(imgtitle);
    }
    jQuery(".imgShowBox").css({ height: win_height });
    jQuery('.imgShowDemo').css({ height: win_height });
    jQuery('.imgShowDemo .item').css({ height: win_height });

    jQuery(window).resize(function () {
        jQuery(".imgShowBox").css({ height: win_height });
        jQuery('.imgShowDemo').css({ height: win_height });
        jQuery('.imgShowDemo .item').css({ height: win_height });
    });
    var imgowl = jQuery(".imgShowDemo").slick({
        autoplay: false,
        arrows: true,
        dots: false,
        infinite: true,
        speed: 500,
        pauseOnHover: false
    });
    jQuery(".imgShowDemo").slick('slickGoTo', num);
    setTimeout(function () { $('.imgShowBox').addClass('img-show'); }, 500);
};