﻿
$(document).ready(function() {
    $("#SearchbtnPost").click(function() { GoSearchPage(); });


    $('#SearchKeyWord').bind('keyup', function(event) {
        if (event.keyCode == 13) {
            GoSearchPage();
        }
    });
})

function GoSearchPage() {

    if (SearchTextCheck()) {
        var keyword = $("#SearchKeyWord").val();
        //var state = $("#SearchState").val();
        var PageToUrl = "http://www.google.com.hk/search?hl=zh-CN&source=hp&q=site%3Awww.hnredstar.gov.cn%2Fzizhizhou%2F+" + encodeURI(keyword) + "&btnG=Google+%E6%90%9C%E7%B4%A2&aq=f&aqi=&aql=&oq=&gs_rfai=";
        //location.href = PageToUrl;
        window.open(PageToUrl);
    }
}

function SearchTextCheck() {
    if ($("#SearchKeyWord").val() == "") {
        alert("请输入您需要搜索的关键词.");
        $("#SearchKeyWord").focus();
        return false;
    }
    return true;
}
