var boxProductPic = document.getElementById("boxProductPic");

// 展开高度
function $D() {
    var h = boxProductPic.offsetHeight;
    var maxh = 242;

    function dmove() {
        h += 20; //设置层展开的速度 
        if (h >= maxh) {
            boxProductPic.style.height = '242px';
            clearInterval(iIntervalId);
        }
        else {
            boxProductPic.style.display = 'block';
            boxProductPic.style.height = h + 'px';
        }
    }
    iIntervalId = setInterval(dmove, 2);
}

// 收缩高度
function $D2() {
    var h = boxProductPic.offsetHeight;
    function dmove() {
        h -= 15; //设置层收缩的速度 
        if (h <= 0) {
            boxProductPic.style.display = 'none';
            clearInterval(iIntervalId);
        }
        else {
            boxProductPic.style.height = h + 'px';
        }
    }
    iIntervalId = setInterval(dmove, 2);
}

function $open(objID, objID2) {
    if (boxProductPic.style.display == 'none') {
        $D();
        $getPic(objID, objID2)
    }
}

function $close() {
    boxProductPic.innerHTML = "";
    $D2();
}

function $getPic(objID, objID2) {
    var xmlloginhttp;
    var ToURL = "Ajax.aspx?AcType=GetProductPic&ID=" + objID + "&ProductPicBaseID=" + objID2 + "&rd=" + Math.random();
    if (window.ActiveXObject) {
        xmlloginhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlloginhttp = new XMLHttpRequest();
    }

    xmlloginhttp.open("get", ToURL, true);
    xmlloginhttp.onreadystatechange = function() {
        if (xmlloginhttp.readyState == 4) {
            var DataSource = xmlloginhttp.responseText;

            if (DataSource != null && DataSource != "0" && boxProductPic!=null) {
                boxProductPic.innerHTML = DataSource;
            }
        }
    }
    xmlloginhttp.send(null);
}