function form_check(){
var IsTrue=true;
var mess="";

if (document.form_newhouse.strCity.value==""){
IsTrue=false;
mess=mess+"--city"
}

if (mess!="") {
mess="please select"+mess;
alert(mess);
}

return IsTrue;
}

function clear(o){
//window.alert("2222222222");
l=o.length;
//window.alert(l)
for (i = 0; i < l; i ++){
	o.options[0]=null;
}
}

function fullup(obj1,val){
var vn = new Option(val,val); 
    obj1.add(vn);
}

function sel(val,obj){

    //window.alert("true");

    //window.alert(obj.length);
	for (i=0;i<obj.length;i++){
		if (obj[i]==val){
			return i;
			}
		}
	if (i==obj.length){return 0;}
}

function fullcity(obj){
for (i=0;i<L.length;i++){
	for (j=0;j<C[i].length;j++){
		obj.add(new Option(C[i][j],C[i][j]));
	}
}
}
function SelectProvince()
{
///fbox=document.form_newhouse.strPurpose;
pbox=document.form_newhouse.strProvince;
cbox=document.form_newhouse.strCity;
dbox=document.form_newhouse.strDistrict;
val=pbox.value;
//window.alert("1111111111")
//window.alert(val);
   if (val!=""){
		err=1;
		m=sel(val,L);
		clear(cbox);
		for (i=0;i<C[m].length;i++){fullup(cbox,C[m][i])}
		clear(dbox);
		fullup(dbox,"");
		for (i=0;i<D[m][0].length;i++){fullup(dbox,D[m][0][i])}
		///clear(fbox);
		///pu=sel(C[m][0],CF);
		///for (i=0;i<F[pu].length;i++){fullup(fbox,F[pu][i])}
	}
	else{
	//window.alert("try to clear cbox");
		clear(cbox);
	//window.alert("try to clear dbox");
		clear(dbox);
	//window.alert("try to clear fbox");
		///clear(fbox);
		//window.alert("over");
	
		fullup(cbox,"please select")
		fullup(dbox,"please select")
		///for(i=0;i<F[0].length;i++){fullup(fbox,F[0][i])}
	}
}
function sdistrict(oj,v){
m=-1;
n=-1;
for (i=0;i<L.length;i++){
	for (j=0;j<C[i].length;j++){
		if (C[i][j]==v){
			m=i;
			n=j;
		}
	}
}
clear(oj);
oj.add(new Option("please select",""));
if (m!=-1&&n!=-1){
for (i=0;i<D[m][n].length;i++){
oj.add(new Option(D[1][n][i],D[m][n][i]));
}
}

}
function check_housetype_search_form(){
var IsTrue=true;
var mess="";
if (document.nh_housetype_search_form.intRoom.value=="0" && document.nh_housetype_search_form.intHall.value=="0" && document.nh_housetype_search_form.intToilet.value=="0" && document.nh_housetype_search_form.intKitchen.value=="0" && document.nh_housetype_search_form.intBuildingarea.value=="0" && (document.nh_housetype_search_form.strHouseTypeDesp.value=="»§ÐÍÃèÊö" || document.nh_housetype_search_form.strHouseTypeDesp.value=="")){
IsTrue=false;
mess=mess+"--Please select Structure or Size£¡--"
alert(mess);
}
//alert (IsTrue);
return IsTrue;
}

function showcity(city){
	var city_c="";
	for (i=0;i<C[0].length;i++){
		if (C[0][i]==city)
		{city_c=C[1][i];
		break;
		}	
	}	
	return city_c;
}

function showcity_z(city){
	var city_c="";
	for (i=0;i<C[1].length;i++){
		if (C[1][i]==city)
		{city_c=C[0][i];
		break;
		}	
	}	
	return city_c;
}

function showdistrict(city,district){

	var district_c="";
	
	for (i=0;i<C[0].length;i++){
		if (C[0][i]==city)
		{
			
			for (j=0;j<D[0][i].length;j++){
				if(D[0][i][j]==district)
				{
					district_c=D[1][i][j];
					break;
				}
			}
			break;
		}	
	}	
	return district_c;
}


