﻿var WS = {
    CreateSearchView: function() {
    return ("<div id=\"link-url\"><div id=\"d-k\"><input type=\"text\" id=\"SearchKeyword\" value=\"请输入...\" onfocus=\"WS.cls()\" onblur=\"WS.res()\"/><input type=\"button\" id=\"btnSearch\" onclick=\"WS.onClickbox('Layer1')\" onMouseOut=\"WS.onMouseOutbox('Layer1')\"/></div><div id=\"Layer1\" style=\"display:none;\" onMouseOver=\"WS.onMouseOverbox('Layer1')\" onMouseOut=\"WS.onMouseOutbox('Layer1')\"><a href=\"javascript:WS.SelectSearch('知识库')\" title=\"知识库\">知识库</a><br><a href=\"javascript:WS.SelectSearch('问答')\" title=\"问答\">问答</a><br><a href=\"javascript:WS.SelectSearch('论坛')\" title=\"论坛\">论坛</a></div></div>");
    },
    SelectSearch: function(t) {
        var keyword = $("#SearchKeyword").val();
        if (keyword == "" || keyword == "请输入...") {
            alert("请输入关键字！");
            return;
        }
        var selecttype = t;
        location.href = "/Search/index?Page=1&SearchType=" + selecttype + "&KeyWords=" + keyword;
    },
    Change: function(x) {
        document.getElementById(x).style.display = "none";
    },
    onClickbox: function(y) {
        document.getElementById(y).style.display = "";
    },
    onMouseOutbox: function(z) {
        document.getElementById(z).style.display = "none";
    },
    onMouseOverbox: function(a) {
        document.getElementById(a).style.display = "";
    },
    //清空文本框的内容
    cls: function() {
        var txtKeyWord = document.getElementById("SearchKeyword");
        if (txtKeyWord.value == "请输入...") {
            txtKeyWord.value = "";
        }
    },
    //恢复文本框的提示内容
    res: function() {
        var txtKeyWord = document.getElementById("SearchKeyword");
        if (txtKeyWord.value == "") {
            txtKeyWord.value = "请输入...";
        }
    }
}
