﻿function $O(element) {
    return element = document.getElementById(element);
}
function $D() {
    var d = $O('class1content');
    var h = d.offsetHeight;
    var maxh = 210;
    function dmove() {
        h += 50; //层展开速度
        if (h >= maxh) {
            d.style.height = '210px';
            clearInterval(iIntervalId);
        } else {
            d.style.display = 'block';
            d.style.height = h + 'px';
        }
    }
    iIntervalId = setInterval(dmove, 2);
}
function $D2() {
    var d = $O('class1content');
    var h = d.offsetHeight;
    var maxh = 210;
    function dmove() {
        h -= 50; //层收缩速度
        if (h <= 0) {
            d.style.display = 'none';
            clearInterval(iIntervalId);
        } else {
            d.style.height = h + 'px';
        }
    }
    iIntervalId = setInterval(dmove, 2);
}
function $use() {
    var d = $O('class1content');
    var sb = $O('stateBut');
    if (d.style.display == 'none') {
        $D();
        sb.innerHTML = '- 收起';
    } else {
        $D2();
        sb.innerHTML = '+ 展开';
    }
}

