﻿

/*背景滚动js*/
jQuery(function($) {
    var top; //滚动条顶部距离
    var beishu = 2; //倍数
    function getObj(id) { return document.getElementById(id) }
    var lays = [{ top: -236, b: 5 }, { top: -216, b: 5 }, { top: -206, b: 5 }, { top: -176, b: 5 }, { top: -220, b: 5 }, { top: -230, b: 5}]; //6个第一个废弃，top：posistionY，b:倍数
    function move() {
        for (var i = 1; i < 6; i++) {
            top = document.documentElement.scrollTop;
            addTop = lays[i].top - (top - 625 * (i - 1)) / lays[i].b;
            getObj("lay" + i).style.backgroundPosition = "center " + addTop + "px";
        }
    }
    //setInterval(move,10);
    (function($) {
        jQuery.fn.backgroundPosition = function() {
            var bgPosition = $(this).css('background-position');
            if (typeof (bgPosition) == 'undefined') {
                return $(this).css('background-positionX') + ' ' + $(this).css('background-positionY');
            } else {
                return bgPosition;
            }
        };
    })(jQuery);
    function getPositionY(divId) {
        return $(divId).backgroundPosition().split(" ")[1].replace(/px/, "");

    }
    //document.getElementById('bigPic').setAttribute('src', '');
    if (!($.browser.msie && $.browser.version == "6.0"))
        window.onscroll = move;
})


/*右侧导航栏js*/
jQuery(function($) {
    $(".anchorLi a").hover(function() {
        $(this).prev("h1").fadeTo(100, 1);
    }, function() {
    $(this).prev("h1").fadeTo(100, 0);
    });
    var scrollTop = [0, 611, 1236, 1861, 2486];
    $(".anchorLi").click(function() {
        $("html").animate({
        scrollTop: scrollTop[$(".anchorLi").index($(this))]
        }, 500)
        //document.documentElement.scrollTop = scrollTop[$(".anchorLi").index($(this))];
    });

})
