﻿//document.getElementById 简写
function $(obj) {
    return document.getElementById(obj);
}
//扩展js字符串去除空格字符的方法 e.g. \t &nbsp;
String.prototype.Trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}  
function OnFocus() {
    document.getElementById("txtSearch").value = "";
}
function OnBlur() {
    if (document.getElementById("txtSearch").value.length == 0) {
        document.getElementById("txtSearch").value = "站内搜索";
    }
}
function AddBookmark(title) {
    var url = window.location.href;
    if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    } else if (document.all) {
        window.external.AddFavorite(url, title);
    } else if (window.opera && window.print) {
        return true;
    }
}
var flag = false;
function DivHidden(obj) {
    var div = $("dvSiteNotice");
    if (flag==true) {
        $("divShadow").style.display = "block";
        div.style.display = "block";
        $("back").style.height = "238px";
        obj.src = "images/jian.gif";
        obj.alt = "收缩公告";
        flag = false;
    }
    else {
        $("divShadow").style.display = "none";
        $("back").style.height = "33px";
        div.style.display = "none"
        obj.src = "images/add.gif";
        obj.alt = "展开公告";
        flag = true;
    }
}
function ChangeURL() {
    if ($("txtSearch").value.Trim() == "") {
        alert("请输入要查找的关键字");
        return;
    }
    var httpDomain = "http://" + window.location.host + "/";
    //var search = document.getElementById("txtSearch").value + "+site%3Awww.ntintl.com.cn";
    var search = "http://www.google.cn/search?hl=zh-CN&q=" + document.getElementById("txtSearch").value + "+site%3Awww.joyohr.com&btnG=Google+%E6%90%9C%E7%B4%A2&meta=&aq=f&oq=";
    //http://www.google.cn/search?hl=zh-CN&q=%E7%94%B5%E6%BA%90+site%3Awww.ntintl.com.cn&btnG=Google+%E6%90%9C%E7%B4%A2&meta=&aq=f&oq=
    window.location.href = httpDomain + "Section/SearchResult.aspx?KeyValue=" + search;
}
function ChangeURLByPage(obj,num) {
    var search = "";
    if (num == "1") { 
        search="http://www.google.cn/search" + obj + "sa=N";
    }else if(num=="0"){
        search="http://www.google.cn/search" + obj;
    }
    if (search.lastIndexOf("sa=N") != search.indexOf("sa=N")) {
        search = search.substring(0, search.lastIndexOf("sa=N"));
        search +="filter=0";
    }
//    var search = "http://www.google.cn/search" + obj + "sa=N"
    window.location.href = httpDomain + "Section/SearchResult.aspx?KeyValue=" + search;
}

