// JavaScript Document
//人物秀滚动
function peopleScroll(o) {
    var box = $(o);
    var ul = box.find(".moveBox");
    var li = ul.find(".photoItem");
    var w = li.outerWidth(true);
    var l = li.length;
    var max_w = l * w;
    var autoId = null;
    var ul_pos = null;
    var init_test = true;
    init();
    function init() {
        box.css({ "width": "auto" });
        var box_w = box.outerWidth(true);
        var ul_w = w * l;
        var v = Math.floor(box_w / w) >= 1 ? Math.floor(box_w / w) : 1;
        for (var i = 0; i < v; i++) {
            ul.append(li.eq(i).clone(true));
        }
        var l = box.find(".photoItem").length;
        ul.width(l * w);
        if (init_test) {
            bindFn();
            move();
        };
    };
    function bindFn() {
        $(window).bind("resize", function() { init(); })
        box.bind("mouseover", function() {
            if (autoId) { clearInterval(autoId); };
        });
        box.bind("mouseout", function() {
            move();
        });
        init_test = false;
    };
    function move() {
        autoId = setInterval(function() {
            ul_pos > -max_w ? ul_pos-- : ul_pos = 0;
            ul.css({ "left": ul_pos });
        }, 15);
    };

};

//tab
function tab(m, c, t, n) {
    try {
        for (var i = 1; i <= n; i++) {

            document.getElementById(m + i).className = "liOut";
            document.getElementById(c + i).style.display = "none";
        }
        document.getElementById(m + t).className = "liOver";
        document.getElementById(c + t).style.display = "block";
    } catch (ex) {
        return;
    }

};

//高度设置
var setHeight = {
    init: function(o, m) {
        if (!document.getElementById(o) || !document.getElementById(m)) return false;
        this.div = document.getElementById(m);
        this.obj = document.getElementById(o);
        this.windowHeight;
        if (document.documentElement && document.documentElement.clientHeight) {
            this.windowHeight = document.documentElement.clientHeight;
        } else if (document.body) {
            this.windowHeight = document.body.clientHeight;
        };
        this.o_h = this.obj.offsetHeight;
        this.m_h = this.div.offsetHeight;
        if (this.o_h < this.windowHeight) { //先判断对象是否小于浏览器高度
            this.obj.style.height = this.windowHeight + "px";
            this.o_h = this.obj.offsetHeight; //重新取高度
        };

        if (this.m_h < this.o_h) {
            this.div.style.height = this.o_h + "px";
        }

    }
};

window.onload = function() {
    if (document.getElementById('listPageContent')) {
        setHeight.init('pageContainer', 'listPageContent');
    } else {
        setHeight.init('pageContainer', 'teacherListPageContent');
    }

};







