var m = {
    $e: function(z) {
        return typeof (z) == "object" ? z : document.getElementById(z);
    },
    $E: function(o, z) {
        return typeof (o) == "string" ? ge(o).getElementsByTagName(z) : o.getElementsByTagName(z);
    },
    show: function(o) {
        this.$e(o).style.display = "block";
    },
    hide: function(o) {
        this.$e(o).style.display = "none";
    },
    tagCutover: function(tagObj, listName) {			//标签切换  tagObj:标签列表对象, listName:同级内容对象标签名
        if (!this.$e(tagObj)) return;
        var t = this;
        var tg = this.$e(tagObj), tgList = this.$E(tg, "a"),
			cnList = this.$E(tg.parentNode, !listName ? "ul" : listName);
        tg.cnList = cnList;

        for (i = 0; i < tgList.length; i++) {

            if (tgList[i].parentNode != tg) {
                tgList[i].no = i;
                tgList[i].href = "javascript:;"
                cnList[i].style.display = "none";
                tgList[i + 2].style.display = "none";
                if (tgList[i].parentNode.className == "current") {
                    tg.current = tgList[i];
                    cnList[i].style.display = "";
                    tgList[i + 2].style.display = "";
                }
                tgList[i].onclick = function() {
                    var tp = this.parentNode;
                    tg.current.parentNode.className = '';
                    tg.cnList[tg.current.no].style.display = "none";
                    tgList[tg.current.no + 2].style.display = "none";
                    tp.className = "current";
                    tg.cnList[this.no].style.display = "block";
                    tgList[this.no + 2].style.display = "";
                    tg.current = this;
                    this.blur();
                }
            }
        }
        //end for
    },
    selection: function(t, n) {			//下拉选择框	t:目标对象	n:下拉框个数
        if (!this.$e(t)) return;
        var _t = this;
        var root = this.$e(t);
        var tb = this.$E(root, "div")[0],
			tl = this.$E(root, "div")[1],
			tla = this.$E(tl, "a"),
			v = this.$E(tb, "i")[0];

        tb.openStatus = false;
        tb.onmouseover = function() { v.className = "hover"; this.onmouseout = function() { if (!this.openStatus) v.className = ""; }; }
        tb.onclick = function() { tl.style.width = this.clientWidth + "px"; adjust(!this.openStatus); }

        for (i = 0; i < tla.length; i++) {
            tla[i].href = "javascript:;";
            tla[i].onclick = function() {
                _t.$E(tb, "em")[0].innerHTML = this.innerHTML;
                adjust(false);
            }
        }

        function adjust(flag) {
            if (!flag) {
                tl.style.display = "none";
                v.className = "";
                tb.openStatus = false;
                document.onclick = null;
            } else {
                tl.style.display = "block";
                v.className = "hover";
                tb.openStatus = true;
                setTimeout(function() { document.onclick = function() { adjust(gp(getEvent().srcElement || getEvent().target)); } }, 10);
            }
        }
        function gp(o) { var o = _t.$e(o).parentNode; while (o.nodeName != "BODY") { if (o == tl) return true; o = o.parentNode; }; return false; }
        //dclick
    }
}
function coopScroll() {
    var cp = m.$e("coop");
    if (cp != null) {
        var p = m.$E(cp, "p")[0],
		a = m.$E(cp, "a");
        if (a[0] != null) {
            if (a[0].clientWidth * a.length > cp.clientWidth) {
                p.innerHTML = p.innerHTML + p.innerHTML;
                p.style.width = a[0].clientWidth * a.length + "px";
                var cinter = setInterval(function() { cp.scrollLeft = cp.scrollLeft < p.clientWidth / 2 ? cp.scrollLeft + 1 : 0; }, 20);
                cp.onmouseover = function() { clearInterval(cinter); }
                cp.onmouseout = function() { cinter = setInterval(function() { cp.scrollLeft = cp.scrollLeft < p.clientWidth / 2 ? cp.scrollLeft + 1 : 0; }, 20); }
            }
        }
    }
}

function getEvent() {     //同时兼容ie和ff的写法　　取得操作对像
    if (document.all) return window.event;
    func = getEvent.caller;
    while (func != null) {
        var arg0 = func.arguments[0];
        if (arg0) {
            if ((arg0.constructor == Event || arg0.constructor == MouseEvent)
				 || (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) {
                return arg0;
            }
        }
        func = func.caller;
    }
    return null;
}

