function check1(form)  {
  r = true;
  if (Trim(form.q1.value)=="")  {
    alert("請 輸 入 樓 宇 名 稱 或 地 址。");
    r = false;
  }else{
	ls1 = "paddresssearch1.aspx?search="+ escape(form.q1.value);
	if(mstartuptype=="newpopup"){
//		wpopup3(ls1,"directory","");
		this.location.href = ls1;
	}else{
		this.location.href = ls1;
	}
	//setTimeout(ls1,300);
	//alert(2);
    r = false;
  }
  return r;
}

	function Trim(TRIM_VALUE){
		if(TRIM_VALUE.length < 1){
			return "";
		}
		TRIM_VALUE = RTrim(TRIM_VALUE);
		TRIM_VALUE = LTrim(TRIM_VALUE);
		if(TRIM_VALUE==""){
			return "";
		}
		else{
			return TRIM_VALUE;
		}
	} 

	function RTrim(VALUE){
		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";
		if(v_length < 0){
			return"";
		}
		var iTemp = v_length -1;

		while(iTemp > -1){
			if(VALUE.charAt(iTemp) == w_space){
			}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

		}
		return strTemp;

	} 
	
	function LTrim(VALUE){
		var w_space = String.fromCharCode(32);
		if(v_length < 1){
		return"";
		}
		var v_length = VALUE.length;
		var strTrim = "";

		var iTrim = 0;

		while(iTrim < v_length){
			if(VALUE.charAt(iTrim) == w_space){
			}
			else{
				strTrim = VALUE.substring(iTrim,v_length);
				break;
			}
			iTrim = iTrim + 1;
		} 
		return strTrim;
	} 