function isQuickQueryValid(thisForm){
  with(thisForm){
    return (query.value != "");
  }
}
function validateQuickForm(){  
	var lang=0;
	if (window.location.href.match("http://gb.hyd.gov.hk/TuniS/")){
		lang=2;
	}
	else if (window.location.href.match(".hyd.gov.hk/chi/") || window.location.href.match(".hyd.gov.hk/textonly/chi/"))
	{
		lang=1;
	}
	else 
	{
		lang=0;
	}
  var backForm = document.quick_search;
  /* avoid null query */
  if (!isQuickQueryValid(backForm)){ alert(alertMsg[0][lang]); return 0;}

  return 1;
}
function trimQuickForm(){
  var lang_code;
  /*
  with (frontForm){
    lang_code = ui_lang.value;
  }
  */
	var backForm = document.quick_search;
	with (backForm){
		if (window.location.href.match("http://gb.hyd.gov.hk/TuniS/")){
			ui_lang.value="zh-cn";
		}
		else if (window.location.href.match(".hyd.gov.hk/chi/")  || window.location.href.match(".hyd.gov.hk/textonly/chi/"))
		{
			ui_lang.value="zh-hk";
		}
		else 
		{
			ui_lang.value="en";
		}
		if (window.location.href.match(".hyd.gov.hk/textonly/")){
			txtonly.value="1";
		}
//		ui_lang.value = lang_code;
		init_query.value = encodeURIComponent(query.value);
  }
}

