//function killErrors() { return true; } window.onerror = killErrors; 
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
function isNumber(obj)
{ if (isNaN(obj.value)) { alert('只能输入数字！'); obj.value = 0 } }
function $() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
        var element = arguments[i];
        if (typeof element == 'string')
            element = document.getElementById(element);
        if (arguments.length == 1)
            return element;
        elements.push(element);
    }
    return elements;
}
function char_test(chr)
//字符检测函数 
{
    var i;
    var smallch = "abcdefghijklmnopqrstuvwxyz";
    var bigch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for (i = 0; i < 26; i++)
        if (chr == smallch.charAt(i) || chr == bigch.charAt(i))
        return (1);
    return (0);
}
function spchar_test(chr)
//数字和特殊字符检测函数 
{
    var i;
    var spch = "_-.0123456789";
    for (i = 0; i < 13; i++)
        if (chr == spch.charAt(i))
        return (1);
    return (0);
}

function email_test(str) {
    var i, flag = 0;
    var at_symbol = 0;
    //“@”检测的位置 
    var dot_symbol = 0;
    //“.”检测的位置 
    for (i = 1; i < str.length; i++)
        if (str.charAt(i) == '@') {
        at_symbol = i;
        break;
    }
    //检测“@”的位置 

    if (at_symbol == str.length - 1 || at_symbol == 0)
        return (2);
    //没有邮件服务器域名 

    for (i = 1; i < at_symbol; i++)
        if (char_test(str.charAt(i)) == 0 && spchar_test(str.charAt(i)) == 0)
        return (5);
    for (i = at_symbol + 1; i < str.length; i++)
        if (char_test(str.charAt(i)) == 0 && spchar_test(str.charAt(i)) == 0)
        return (5);
    //不能用其它的特殊字符   

    for (i = at_symbol + 1; i < str.length; i++)
        if (str.charAt(i) == '.') dot_symbol = i;
    for (i = at_symbol + 1; i < str.length; i++)
        if (dot_symbol == 0 || dot_symbol == str.length - 1)
    //简单的检测有没有“.”，以确定服务器名是否合法 
        return (6);

    return (0);
    //邮件名合法
}

//menu
var timer
function s_out() {
    var posSel = $("head1Sel").style.display;
    if (posSel == "block") {
        timer = setTimeout("drop_hide('head1')", 1000);
    }
}
function s_over() {
    try { window.clearTimeout(timer); } catch (e) { }
}
function s_show(st1, href1) {
    $("s_cateID").value = st1;
    $("head1Sel").style.display = "none";
    $("head1Slected").innerHTML = href1.innerHTML;
    $("keyword").focus();
    try { window.clearTimeout(timer); } catch (e) { }
    return false;
}
function s_click()
{ if ($('head1Sel').style.display == 'none') { $('head1Sel').style.display = 'block'; } else { $('head1Sel').style.display = 'none'; }; return false; }

//站点头部搜索
function fEvent(sType, oInput) {
    switch (sType) {
        case "focus":
            oInput.isfocus = true;
        case "mouseover":
            oInput.style.borderColor = '#9ecc00';
            break;
        case "blur":
            oInput.isfocus = false;
        case "mouseout":
            if (!oInput.isfocus) {
                oInput.style.borderColor = '#84a1bd';
            }
            break;
    }
}
//添加收藏
function addCollect(id) {
    if (isLogin) {
        return true;
    }
    else {
        window.external.addFavorite(document.location.href, document.title);
        return false;
    }
}