  function regionFromCookie(obj)
  {
    var strCity;
    
    strCity = readFromCookie("Region");
    	
    if (strCity != "")
    {
    	strCity = unescape(strCity);
    	if (strCity != "城市")
    	{
    		obj.value = strCity;    		
    	}
     }
  }
  
  function regionToCookie(obj)
  {
    var expires = new Date();
    expires.setTime(expires.getTime() + 12 * 30 * 24 * 60 * 60 * 1000);
    document.cookie = "Region=" + escape(obj.value) + ";expires=" + expires.toGMTString();
  }
  
  function submitForm(obj)
  {
  	obj.action = "house_search.aspx";
	  if(obj.city.value == "")
	  {
		  alert("请选择城市！");
		  obj.city.focus();
		  return false;
 	  }
	  if(obj.keywords.value == "输入关键字")
	  {
	    obj.keywords.value = "";
	  }
	  else
		{
			if (obj.keywords.value.indexOf("'") > -1)
			{
				alert("关键字格式不正确！");
		    obj.keywords.focus();
		    return false;
			}
		}	  
	  getDistrcitURL(obj);
	  regionToCookie(obj.city);
	  obj.submit();
  }
    
    
  function onKeyPress(obj){
    if(window.event.keyCode == 13)
    {
      if(!submitForm(obj))
      {
	      return false;
	    }
    }
    return true;
  }  
    
  
  function getInitalOption()
  {
  	getCity(document.frmSearch.city);  	
  	getDistrcit(document.frmSearch.city.value,document.frmSearch.district);
  	document.frmSearch.district.value = "";
  	getPrice("sale","normal",document.frmSearch.price);
  	getArea(document.frmSearch.area);
 	}
 	
 	function searchChange(obj)
 	{ 		
 		getPrice(obj.saletype.value, obj.housetype.value, obj.price)
 	}
 	
 	