var t = "";
var temp = "";
function TimerC() { //构造函数
    this.overClassName = function(obj) {
        if (obj.className != "CellActive") {
            clearTimeout(t);
            if (temp != "") {
                Ext.get(temp).setDisplayed(false);
            }
            clearCss();
            obj.className = "CellSelected";
            var top = obj.offsetParent.offsetParent.offsetParent.offsetTop + obj.offsetParent.offsetParent.offsetParent.offsetParent.offsetTop;
            t = setTimeout(function() {
                Ext.get(obj).setTop(Ext.get(obj).getTop(false) - top);
                Ext.get(obj).setLeft(Ext.get(obj).getLeft(false) - (Ext.get(obj).getLeft(false) - obj.offsetParent.offsetLeft));
                //alert(Ext.get(obj).getTop(false));
                obj.className = "CellActive";
                Ext.get('d' + obj.id).setDisplayed(true);
                temp = 'd' + obj.id;
            }, 3000);
        }
    }

    this.createNewDiv = function (obj) {
        clearTimeout(t);
        Ext.get(obj).setTop(Ext.get(obj).getTop(false) - (obj.offsetParent.offsetParent.offsetParent.offsetTop + obj.offsetParent.offsetParent.offsetParent.offsetParent.offsetTop));
        Ext.get(obj).setLeft(Ext.get(obj).getLeft(false) - (Ext.get(obj).getLeft(false) - obj.offsetParent.offsetLeft));
        obj.className = "CellActive";
        Ext.get('d' + obj.id).setDisplayed(true);
        temp = 'd' + obj.id;
    }
}

function clearCss() {
    var selected = Ext.select("div.CellSelected");
    selected.each(function(el) {
        Ext.get(el).replaceClass("CellSelected", "Cell");
    });
    var active = Ext.select("div.CellActive");
    active.each(function(el) {
        Ext.get(el).replaceClass("CellActive", "Cell");
    });
}
var category = new TimerC();
function showDiv(showId) {
    category.createNewDiv(document.getElementById(showId));
}
function changeOverCss(obj) {
    category.overClassName(obj);
}
function changeOutCss() {
    clearTimeout(t);
}

function zhuan(art) {
    var as = new Array("一", "二", "三", "四", "五", "六", "七", "八", "九", "十");
    if (art > 10) {
        var a = art % 10;
        var b = art / 10;
        if (Math.floor(b) == 1) {
            return "" + as[9] + as[a - 1];
        } else {
            if (Math.floor(a) == 0) {
                return "" + as[Math.floor(b - 1)] + as[9];
            } else {
                return "" + as[Math.floor(b - 1)] + as[9] + as[a - 1];
            }
        }
    } else {
        var c = art;
        return   as[c - 1];
    }
}