function doSearch() {
	var keyword = trim(document.searchForm.keyword.value);
	var type = trim(document.searchForm.type.value);
	if((keyword == "")  || (keyword == "开始新搜索...")) {
		alert("请输入关键字！");
		document.searchForm.keyword.focus();
		return false;
	}
	if(type == "all") {
		window.location.href = "http://so.fus.com.cn/Search/Result.htm?keyword=" + encodeURI(keyword) + "&type=" + type;
	}
	if(type == "brand") {
		window.location.href = "http://so.fus.com.cn/Search/Brand.htm?keyword=" + encodeURI(keyword) + "&type=" + type;
	}
	if(type == "news") {
		window.location.href = "http://so.fus.com.cn/Search/Result.htm?keyword=" + encodeURI(keyword) + "&type=" + type;
	}
	if(type == "news_fus") {
		window.location.href = "http://news.fus.com.cn/search.aspx?keyword=" + keyword + "&type=" + type;
	}
	if(type == "news_fashion") {
		window.location.href = "http://fashion.fus.com.cn/search.aspx?keyword=" + keyword + "&type=" + type;
	}
	if(type == "news_jxs") {
		window.location.href = "http://fus.com.cn/search.aspx?keyword=" + keyword + "&type=" + type;
	}
	if(type == "offerlist") {
		window.location.href = "http://so.fus.com.cn/Search/Result.htm?keyword=" + encodeURI(keyword) + "&type=" + type;
	}
	if(type == "company") {
		window.location.href = "http://so.fus.com.cn/Search/Result.htm?keyword=" + encodeURI(keyword) + "&type=" + type;
	}
	if(type == "product") {
		window.location.href = "http://so.fus.com.cn/Search/Result.htm?keyword=" + encodeURI(keyword) + "&type=" + type;
	}
	if(type == "zs_gb") {
		window.location.href = "http://zs.fus.com.cn/search.aspx?keyword=" + keyword + "&type=" + type;
	}
}

function KeyDown()
{
    if (event.keyCode == 13)
    {
        event.returnValue=false;
        event.cancel = true;
        doSearch();
    }
}

function trim(inputString) {

if (typeof inputString != "string") { return inputString; }
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == " ") { 
  //检查字符串开始部分的空格
  retValue = retValue.substring(1, retValue.length);
  ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == " ") {
 //检查字符串结束部分的空格
 retValue = retValue.substring(0, retValue.length-1);
 ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf("  ") != -1) { 
 //将文字中间多个相连的空格变为一个空格
 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
}
return retValue;
} 