function k(id) {
    return document.getElementById(id);
}
function setHome() {
    if (document.all) {
        document.body.style.behavior ="url(#default#homepage)";
        document.body.setHomePage(window.location.href);
    }else {
        alert("您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!");
    }  
}
function addFav() {
    try {
        if (document.all)
            window.external.addFavorite(location.href, document.title);
        else (window.sidebar)
            window.sidebar.addPanel(location.href, document.title, "");      
    } catch (e) { alert("加入收藏失败，请按Ctrl+D进行添加"); }   
}  

function OnSel() {
    txt = k("searchKey").value;
    if (txt == "请输入您要搜索的内容！" || txt == "") {
        alert("请输入要搜索的内容！");
        return false;
    }
    url = "/search/?s=" + txt;
    window.location.href = url;
}
function SO() {
    txt = k("s").value;
    if (txt == "请输入您要搜索的内容！" || txt == "") {
        alert("请输入要搜索的内容！");
        return false;
    }
    window.location.href = "/s?s=" + escape(txt); 
}
function GO(n) {
    location.href = "/class?" + k("cid").value + "_" + k("od").value + "_" + k(n).value + ".html";
}
function GO1(n) {
    location.href = "/class1?" + k("cid").value + "_" + k("od").value + "_" + k(n).value + ".html";
}
function GO2(n) {
    location.href = "/replay?" + k("id").value +  "_" + k(n).value + ".html";
}
function GO3(n) {
    location.href = "/s?s=" + k("sss").value + "&o=" + k("od").value + "&p=" + k(n).value ;
}

function onlyNum() {
    c = event.keyCode;
    return (c >= 48 && c <= 57); //|| (c== 46)
}
function onlyDecimal() {
    c = event.keyCode;
    return (c >= 48 && c <= 57) || (c == 46);
}

function onlyChar() {
    c = event.keyCode;
    if (!(c == 46) && !(c == 8) && !(c == 37) && !(c == 39))
        if (!((c >= 48 && c <= 57) || (c >= 96 && c <= 105)))
            event.returnValue = false;
}

function onlyNumPaste() {
    return !clipboardData.getData('text').match(/\D/);
}
function recomment() {
    if (k("rdes").value.length < 5) {
        alert("回复内容太短,(5-1000)");
        return ;
    }
    if (k("code").value == "") {
        alert("请输入验证码！");
        return ;
    }
    ss = escape($("#rdes").val());
    $.post("/replaya.aspx", { des:ss, code: $("#code").val(), id: $("#id").val(), reid: $("#reid").val() },
    function (data) {
        alert(data);
    },
    "text");

}