//QQ在线客服漂浮效果

lastScrollY = 0;
function FloatScroll() {
    var diffY;
    if (document.documentElement && document.documentElement.scrollTop){
        diffY = document.documentElement.scrollTop;
    }
    else if (document.body){
        diffY = document.body.scrollTop;
    }
    else
    {}
    percent = .1 * (diffY - lastScrollY);
    if (percent > 0){
        percent = Math.ceil(percent);
    }
    else{
        percent = Math.floor(percent);
    }
    document.getElementById("livehelp").style.top = parseInt(document.getElementById("livehelp").style.top) + percent + "px";
    lastScrollY = lastScrollY + percent;
}

//QQ在线客服折叠效果
jQuery(function(){
    var Height = jQuery("#livehelpMain").height()+ 13 + 'px';
    jQuery(".livebox").attr("style","height:" + Height);
    jQuery('.livehelpIcon').click(function(){
        jQuery('#livehelpMain').animate({
            right: '0',
            width: '126px'
        },500);
        jQuery('.livebox').animate({
            width: '126px'
        },500);
        jQuery(this).animate({
            left: '35px'
        },500);
        jQuery('#livehelp').animate({
            width:"126px"
        },400);
    });
    jQuery('#livehelpMain .close').click(function(){
        jQuery('#livehelpMain').animate({
            right: '-126px',
            width: '0'
        },500);
        jQuery('.livebox').animate({
            width: '34px'
        },500);
        jQuery(".livehelpIcon").animate({
            left: '0'
        },500);
        jQuery('#livehelp').animate({
            width:'34px'
        },400);
    });
});
