function onEnter() { 
  	var frm = document.frmsearch;
  	if(frm.keyword.value == "请输入搜索信息") {
	  	frm.keyword.value = "";
	}
}
function search() {
  var frm=document.frmsearch;
  var keyword=frm.keyword.value;
  if (Trim(keyword).length<1) {
  	alert("请输入搜索信息");
  	return;
  }
  if (keyword.length>=50){
	  alert("搜索词过长，请重新填写");
	  return;
  }
  if(keyword == "请输入搜索信息") {
	return;
  }
  frm.action="/search/";
  frm.submit();
}


function IsShortDate(sDate){
	if(sDate.length!=6)
		return false;
	else
		return IsYear(sDate.substring(0,4))&&IsMonth(sDate.substring(4,6));
}

function doSearch(){
	var enabledate = document.forms['search_form'].elements['enabledate'].value;
	if(enabledate!=""&&!IsShortDate(enabledate)){
		alert("日期格式为yyyyMM，例如200601");
		document.forms['search_form'].elements['enabledate'].focus();
		return false;
	}
	var expiredate = document.forms['search_form'].elements['expiredate'].value;
	if(expiredate!=""&&!IsShortDate(expiredate)){
		alert("日期格式为yyyyMM，例如200601");
		document.forms['search_form'].elements['expiredate'];
		return false;
	}
	var mindiscount = document.forms['search_form'].elements['mindiscount'].value;
	var maxdiscount = document.forms['search_form'].elements['maxdiscount'].value;
	if(mindiscount != "" || maxdiscount != "") {
		if (1*maxdiscount < 1*mindiscount) {
			alert("最大折扣必须大于等于最小折扣");
			return false;
		}
	}
	var minprice = document.forms['search_form'].elements['minprice'].value;
	var maxprice = document.forms['search_form'].elements['maxprice'].value;
	if(minprice != "" && maxprice != "") {
		if(1*maxprice < 1*minprice) {
			alert("定价的最大金额必须大于等于最小金额");
			return false;
		}
	}
}

function showAllBrand() {
	document.getElementById("brand").style.display="block";
	document.getElementById("showBrandButton").style.display="none";
}