function setTab(name, cursel, n) {
    for (i = 1; i<= n; i++) {
        var menu = document.getElementById(name + i);
        var con = document.getElementById("con_" + name + "_" + i);
        menu.className = i == cursel ? "hover" : "";
        con.style.display = i == cursel ? "block" : "none";
    }
}

function g(o) { return document.getElementById(o); }
function hoverli(n,count) {
    for (var i = 1; i <= count; i++) {
        g('tb_' + i).className = 'aa';
        g('tbc_0' + i).className = 'undis';
    }
    g('tbc_0' + n).className = 'list2'; 
     g('tb_' + n).className = 'bb';
}

function hoverlie(n) {
    for (var i = 1; i <= 4; i++) {
        g('tbe_' + i).className = 'aa';
        g('tbce_0' + i).className = 'undis';
    }
    g('tbce_0' + n).className = 'dis';
    g('tbe_' + n).className = 'bb';
}

function AddFavorite(sURL, sTitle) {
    try {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e) {
        try {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e) {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}

function checkForm() {

    if (document.getElementById("Contents").value.length < 10 || document.getElementById("Contents").value.length > 200) {
        document.getElementById("errorTrips").innerHTML = "评论内容不足10字符或超过200字符";
        return false;
    }

}

function checkLen(obj) {

    var maxChars = 200;  //最多字符数 

    if (obj.value.length > maxChars) obj.value = obj.value.substring(0, maxChars);

    var nowCount = obj.value.length;  //已输入字符数
    var leftCount = maxChars - obj.value.length; //剩余输入字符数 
    document.getElementById("nowCount").innerHTML = nowCount.toString();
    document.getElementById("leftCount").innerHTML = leftCount.toString();

}

function cleanTips() {

    document.getElementById("errorTrips").innerHTML = "";

}


  
    