/*************************
*Description:前端实用类库
*Author:
*Date/Time:2014.12.06
*Copyright:
*************************/
var win = {
    slideWindow: function (_params) {//右下角滑出窗口(//参数{height:"100px";width:"200px",text:"显示内容"})
        var winpop = document.getElementById("bottom_right_corner");
        if (winpop == null) {
            winpop = document.createElement("div"); winpop.id = winpop.className = "bottom_right_corner";
            winpop.style.cssText = "height:0px;width:" + (_params != null && _params.width != null ? _params.width : "200px") + ";position:fixed; right:5px; bottom:5px; border:1px solid #F7F7F7; margin:0; padding:0px; overflow:hidden;background-color:white;";
            winpop.innerHTML = (_params != null && _params.text != null ? _params.text : "&nbsp;"); document.body.appendChild(winpop);
            var iobj = setInterval(function () {
                var h = parseInt(winpop.style.height), maxh = (_params != null && _params.height != null ? parseInt(_params.height.replace("px", "")) : 100);
                if (h < maxh) { winpop.style.height = (h + 4) + "px"; } else { clearInterval(iobj); }
            }, 2)
        }
        else {
            var iobj = setInterval(function () {
                var h = parseInt(winpop.style.height);
                if (h > 0) { winpop.style.height = (h - 4) + "px"; } else { clearInterval(iobj); winpop.parentNode.removeChild(winpop); }
            }, 2)
        }
    }
};
//异步加载js脚本或css样式(参数:多个url使用分号隔开，是否按顺序加载(默认false),回调)
function getScript(_urlList, _sequence, _callback) {
    var locadScript = function (_url, __callback) {
        var f;
        if (_url.substring(_url.lastIndexOf(".")) == ".css") {
            f = document.createElement("link"); f.href = _url; f.rel = "stylesheet"; f.type = "text/css";
        } else { f = document.createElement("script"); f.type = "text/javascript"; f.src = _url; }
        if (f.readyState) {
            f.onreadystatechange = function () { if (f.readyState == "loaded" || f.readyState == "complete") { if (__callback != null) { __callback(); } } }
        } else { f.onload = f.onerror = function () { if (__callback != null) { __callback(); } } };
        document.body.appendChild(f);
    };
    var urlList = _urlList.split(";"), i = 0;
    if (_sequence == null || _sequence == false) {
        for (; i < urlList.length; i++) { locadScript(urlList[i]); }
        if (typeof _callback == "function") { _callback(); }
    } else {
        var sequenceLoad = function (_url) {
            locadScript(_url, function () { i++; if (i < urlList.length) { sequenceLoad(urlList[i]); } else { if (typeof _callback == "function") { _callback(); } } });
        };
        sequenceLoad(urlList[i]);
    }
}
var bx={
    store: {
            cookie: {
                get: function (name) {
                    var cklist = document.cookie.split(";");
                    for (var i = 0; i < cklist.length; i++) {
                        var ck = cklist[i].split("=");
                        if (ck[0] == name) { return unescape(ck[1]); }
                    }
                    return "";
                },
                set: function (name, value, expires) { var d = new Date(); d.setTime(d.getTime() + expires); document.cookie = name + "=" + escape(value) + ";expires=" + d.toGMTString(); },
                clear: function (name) {this.set(name,"",-1000); }
            }
    }
}
