Namespace.register("U.ZX");
var state = true;
var aa;
var bb;
var bar_array_e = new Array("index", "zy", "byj", "ftp", "jzdiy", "qmzj", "gw", "yswh");
U.ZX.click_check = function () {
    var tab_btn = $(".bar_li"); //获取导航按钮
    for (var i = 0; i < tab_btn.length; i++) {//获取所有导航按钮并循环
        var col = new click_to_show(i); //运用构造函数将对应得i与按钮绑定
        tab_btn[i].onclick = col.clickf; //给每个绑定点击事件
    }
    function click_to_show(col) {
        this.clickf = function () {
            for (var j = 0; j < aa.length; j++) {//获取所有的class，当点击后，所有为aa的div隐藏，显示指定的aa
                aa[j].style.display = "none"; //隐藏所有aa
                bb[j].style.borderBottom = "none";
                bb[j].style.color = '#000';
            }
            aa[col].style.display = "block"; //显示导航栏所对应的aa
            bb[col].style.borderBottom = "2px #0058c9 solid";
            bb[col].style.color = '#0058c9';
            $('#title')[0].innerHTML = bar_array_e[col];
            U.ZX.qh_sj();
            state = false;
        }
    }
}

aaaaaaaa = -1;
U.ZX.auto_check = function () {
    if (state && aa.length) {
        aaaaaaaa++;
        if (aaaaaaaa == aa.length) {
            aaaaaaaa = 0;
        }
        for (var i = 0; i < aa.length; i++) {//获取所有的class，当点击后，所有为aa的div隐藏，显示指定的aa
            bb[i].style.color = '#000';
            bb[i].style.borderBottom = "none";
            aa[i].style.display = 'none';
        }
        bb[aaaaaaaa].style.color = '#0058c9';
        aa[aaaaaaaa].style.display = "block"; //显示导航栏所对应的aa
        bb[aaaaaaaa].style.borderBottom = "2px #0058c9 solid";
        setTimeout("U.ZX.auto_check()", 5000);
    }
    $('#title')[0].innerHTML = bar_array_e[aaaaaaaa];
    U.ZX.qh_sj();
}
/*动态创建导航*/
U.ZX.create_bar = function () {
    var bar_container = $$("div", { "class": 'index_content_header', 'id': 'index_content_header' }, $('.index_bar')[0]); //创建导航栏容器
    var bar = document.createElement("ul");
    bar_container.appendChild(bar);
    var bar_array = new Array("教学案例", "作业", "毕业季", "ftp共享", "建站diy", "期末总结", "购物", "有思文化"); //定义导航栏内容的数组
    for (var i = 0; i < bar_array.length; i++) {
        $$("li", { "class": "bar_li", "innerHTML": bar_array[i], 'id': 'bar_li' + [i] }, bar); //循环数组长度创建导航按钮
        U.ZX.click_check(); //添加到导航切换
    }
   aa = $(".index_content"); //获取内容板块的class
   bb = $(".bar_li"); //获取按钮
   U.ZX.auto_check();
}

U.ZX.create_bar();