
function funcSearch(MGUID) 
{
    var obj = document.getElementById("SearchType");
    var type = obj.options[obj.selectedIndex].value;
    var keywords = document.getElementById("txtKeywords").value;
    
    if (keywords == null || Trim(keywords) == "" || keywords == "请输入搜索关键字！") 
    {
        alert("请输入搜索关键字！");
        return false;
    }
    else 
    {
        window.location.href="/"+MGUID+"/"+type+"/search.xhtml?keywords=" + escape(keywords);
    }
    
}

function funcEnter() 
{
    if(event.keyCode == 13) 
    {
        funcSearch();
    }
}

function funcFocus(text) 
{
    if (text.value=="请输入搜索关键字！" || Trim(text.value)=="")
    {
        text.value="";
    }
}

function funconmouseup(obj)
{
    if (Trim(obj.value)=="")
    {
        obj.value="请输入搜索关键字！";
    }
}

function Trim(str)
{
    if(str.charAt(0) == " ")
    {
        str = str.slice(1);
        str = Trim(str);
    }
    return str;
}

function allSearch()
{
    var objKey  = window.document.getElementById("txtKeywords");
    var objType = window.document.getElementById("SearchType");
    var objArea = "";
    var strUrl = "";
    var strKeywords = "";

    if(objKey != null && objKey.value != "")
    {
        strKeywords = encodeURI(objKey.value);
        strKeywords = strKeywords.replace("%20","+");
    }

    var arrArea = [""];
    switch(objType.options[objType.selectedIndex].value)
    {
        case "product":
        {
            strUrl = "http://sou.wjw.cn/gongying/_"+strKeywords+"____________.xhtml";
            break;
        }
        case "procurement":
        {
            strUrl = "http://sou.wjw.cn/qiugou/_"+strKeywords+"________.xhtml";
            break;
        }
        case "merchants":
        {
            strUrl = "http://sou.wjw.cn/zhaoshang/_"+strKeywords+"_________.xhtml";
            break;
        }
        case "process":
        {
            strUrl = "http://sou.wjw.cn/jiagong/_"+strKeywords+"________1__.xhtml";
            break;
        }
        case "service":
        {
            strUrl = "http://sou.wjw.cn/fuwu/_"+strKeywords+"_______1__.xhtml";
            break;
        }

    }
    window.location.href = strUrl;
    
}