//搜索
function doSearchtitle() {
  var keywords = trim(document.searchForm.keywords.value);
  document.searchForm.keywords.value = keywords;
  var searchType = document.searchForm.Type.value;

  if((keywords == "")  || (keywords == "开始新搜索...")) {
    alert("请输入关键字！");
    document.searchForm.keywords.focus();
    return false;
  }
		  if(searchType == "offer_sale") {
		  	url = "http://www.fus.com.cn/buy/trade/search.asp?keywords="+ keywords;
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "offer_buy") {
		  	url = "http://www.fus.com.cn/sell/trade/search.asp?keywords="+ keywords;
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "product_gb") {
		  	url = "http://www.fus.com.cn/trade/product/search.asp?keywords="+ keywords;
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "company_gb") {
		  	url = "http://www.fus.com.cn/trade/company/search.asp?keywords="+ keywords;
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "brand_gb") {
		  	url = "http://www.fus.com.cn/trade/brand/search.asp?keywords="+ keywords + "&sources=home";
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "news_gb") {
		  	url = "http://news.fus.com.cn/search.aspx?keyword="+ keywords + "&sources=home";
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "dealer_gb") {
		  	url = "http://fus.com.cn/search.aspx?keyword="+ keywords + "&sources=home";
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "fashion") {
		  	url = "http://fashion.fus.com.cn/search.aspx?keyword="+ keywords + "&sources=home";
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
		  if (searchType == "expo_gb") {
		  	url = "http://www.fus.com.cn/expo/search.asp?k="+ keywords + "&sources=home";
		  	document.searchForm.action = url;
		  	document.searchForm.submit;
		  }
}

//字符处理
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;
} 
