$(document).ready(function () {
   
   
   
   
   
   
   
    $('.photo img:first-child').show();
    $(function () {
        $('.photo img:gt(0)').hide();
        setInterval(function () {
            $('.photo img:first-child').fadeOut().next().show().end().appendTo('.photo')
        }, 3000)
    });
    $('.control img').animate({
        right: -55,
        opacity: 0
    }, 1);
    $('.desc').hover(function () {
        $(this).find('.control img').stop().animate({
            right: -45,
            opacity: 1
        }, 200).show()
    }, function () {
        $(this).find('.control img').stop().animate({
            right: -55,
            opacity: 0
        }, function () {
            $(this).hide()
        })
    });
    $(window).load(function () {
        function filterPath(a) {
            return a.replace(/^\//, '').replace(/(index|default).[a-zA-Z]{3,4}$/, '').replace(/\/$/, '')
        }
        var e = filterPath(location.pathname);
        var f = scrollableElement('html', 'body');
        $('a[href*=#]').each(function () {
            var b = filterPath(this.pathname) || e;
            if (e == b && (location.hostname == this.hostname || !this.hostname) && this.hash.replace(/#/, '')) {
                var c = $(this.hash),
                    target = this.hash;
                if (target) {
                        var d = c.offset().top;
                        $(this).click(function (a) {
                            a.preventDefault();
                            $(f).animate({
                                scrollTop: d
                            }, 400, function () {
                                location.hash = target
                            })
                        })
                    }
            }
        });

        function scrollableElement(a) {
            for (var i = 0, argLength = arguments.length; i < argLength; i++) {
                var b = arguments[i],
                    $scrollElement = $(b);
                if ($scrollElement.scrollTop() > 0) {
                        return b
                    } else {
                        $scrollElement.scrollTop(1);
                        var c = $scrollElement.scrollTop() > 0;
                        $scrollElement.scrollTop(0);
                        if (c) {
                            return b
                        }
                    }
            }
            return []
        }
    });
    if ($(".scrollbox").length > 0) {
        var g = $('.scrollbox').offset().top - parseFloat($('.scrollbox').css('marginTop').replace(/auto/, 0));
        $('li.web').addClass('active');
        $(window).scroll(function (a) {
            var y = $(this).scrollTop();
            if (y >= g) {
                $('.scrollbox').addClass('fixed');
                $('.scrollbox .backtop').show()
            } else {
                $('.scrollbox').removeClass('fixed');
                $('.scrollbox .backtop').hide()
            }

        })
    }
   
});
