﻿var _MapItvalAdd;
var _MapItvalSub;
var _MapTableHeight;
var _MapDivHeight = 0;
var _ContentID;
function OpenCWSList(objContent, keys) {
    var daps = document.getElementById("SetCWSList").style;
    var contentID = objContent.id;
    _ContentID = contentID;
    var object = document.getElementById(contentID);
    var objBCR = object.getBoundingClientRect();

    daps.left = document.documentElement.scrollLeft + objBCR.left - 4;
    daps.top = document.documentElement.scrollTop + objBCR.top - 4;
    daps.width = object.clientWidth;
    //daps.height = object.clientHeight;
    DisPlayCMSList(contentID);
    _MapTableHeight = object.clientHeight;
    daps.display = "";
    GetCMSListDetail(keys);
}
function DisPlayCMSList(contentID) {
    _MapItvalAdd = setInterval('AddHeight(' + contentID + ')', 1);
}
function DisplayCWSListNone() {
    _MapItvalSub = setInterval('SubHeight()', 1);
}
function ShowUpBtn(objContent) {
    if (document.getElementById("NewMapDiv")) {
        document.getElementById("NewMapDiv").style.height = (document.getElementById(objContent.id).clientHeight - 40) + "px";
    }
    document.getElementById("UpBtn").style.display = "block";
}
function AddHeight(contentID) {
    var obj = document.getElementById("SetCWSList").style;
    if (_MapTableHeight > _MapDivHeight) {
        obj.height = _MapDivHeight;
        _MapDivHeight = _MapDivHeight + 5;
    }
    else {
        ShowUpBtn(contentID);
        clearInterval(_MapItvalAdd);
    }
}
function SubHeight() {
    var obj = document.getElementById("SetCWSList").style;
    if (_MapDivHeight > 0) {
        obj.height = _MapDivHeight;
        _MapDivHeight = _MapDivHeight - 5;
    }
    else {
        clearInterval(_MapItvalSub);
    }
}
function ClostCWSList() {
    var daps = document.getElementById("SetCWSList").style;
    daps.display = "none";
    _MapDivHeight = 0;
    clearInterval(_MapItvalAdd);
    clearInterval(_MapItvalSub);
}
function GetCMSListDetail(keys) {
    CreateXMLHttpRequest();
    var url = "/GetCWList.aspx?k=" + keys + "&CID=" + _ContentID;
    _Global_XMLHttpReq.open("GET", url, true);
    _Global_XMLHttpReq.onreadystatechange = callback;
    _Global_XMLHttpReq.send(null);
}
function callback() {
    if (_Global_XMLHttpReq.readyState == 4) {
        if (_Global_XMLHttpReq.status == 200) {
            var htmlText = _Global_XMLHttpReq.responseText;
            if (htmlText != null) {
                document.getElementById("SetCWSList").innerHTML = htmlText;
            }
            else {
                document.getElementById("SetCWSList").innerText = "暂无数据！";
            }
        }
    }
}
