// 回到顶部
function my_gotop(){
    var top = $(document).scrollTop();
    var hei = $(window).height();
    var obj = $('#goTopBtn').css('top', 'auto');
    if (obj.attr('bot') == undefined) {
        obj.attr('bot', obj.css('bottom').replace('px',''));
    }
    var bot = parseInt(obj.attr('bot'));
    if (top == 0) {
        obj.fadeOut(500);
    } else {
        var cs = $('#CustomerService');
        var h = cs.height();
        
        if ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent)) {
            var t = cs.offset().top;
            var tt = top + hei - obj.height() - bot;
            if ((t+h) >= tt) {
                obj.css('top', (t+h));
            } else {
                obj.css('top', tt);
            }
        } else {
            var t = cs.offset().top - top;
            if ((hei-t-h) < (obj.height()+bot)) {
                obj.css({'bottom': (hei-t-h-obj.height())});
            } else {
                obj.css({'bottom': bot});
            }
        }
        obj.fadeIn(500);
    }
}
$(document).ready(function(){
    $(window).scroll(function(){
        my_gotop();
    }).resize(function(){
        my_gotop();
    });
});
