// 右边滑动
function my_scroll_box(left_obj, right_obj){
    var left = $(left_obj);
    var obj = $(right_obj);
    if (obj.attr('min') == undefined) {
        obj.attr('min', left.offset().top);
    }
    if (obj.attr('max') == undefined) {
        obj.attr('max', left.offset().top + left.height() - obj.height());
    }
    if (obj.attr('mtp') == undefined) {
        obj.attr('mtp', obj.css('margin-top').replace('px', '').replace('auto', 0));
    }
    var min = obj.attr('min');
    var max = obj.attr('max');
    var mtp = obj.attr('mtp');
    var top = $(document).scrollTop();
    var h = $('.menu').outerHeight(true);
    var w = left.outerWidth(true);
    if ((top+h) <= min) {
        obj.css({'position':'static', 'margin-top': mtp, 'margin-left': 0});
    } else if ((top+h) > min && (top+h) <= max) {
        if ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent)) {
            obj.css('margin-top', (top+h - min) + 'px');
        } else {
            obj.css({'position':'fixed', 'top':0, 'left':'50%', 'margin-top': h, 'margin-left': 190});
        }
    } else if ((top+h) > max) {
        obj.css({'position':'static', 'top':0, 'margin-top': max - min, 'margin-left': 0});
    }
}
$(document).ready(function(){
    $(window).scroll(function(){
        my_scroll_box('.center-box-01', '.center-box-02');
        my_scroll_box('.center-box-03', '.center-box-04');
    });
});
