function $(id){
	return document.getElementById(id);
};

function r_changeDiv(objId){
	var i;
	for(i = 1; i < 8; i++){
		if($('zbf0' + i)){
			$('zbf0' + i).className = 'search_iterm_menu';
			$('zbli0' + i).style.display = 'none';
		}
	}
	$('zbf0' + objId).className = 'search_iterm_menu_c';
	$('zbli0' + objId).style.display = 'block';
	search_index_result(objId);
}

function initialDistricts(objNum){
	var group = new ComboBox.Group();
	document.comboBoxes['District' + objNum].textBox.value = '全部区域';
	var item = new ComboBox.Item('全部区域', '');
	item.initial = '-1';
	group.add(item);
	for(var i = 0; i < Districts.length; i++){
		item = new ComboBox.Item(Districts[i].name, Districts[i].name);
		item.initial = Districts[i].index;
		group.add(item);
	}
	document.comboBoxes['District' + objNum].addGroup(group);
}

function initialPurposes(objNum){
	document.comboBoxes['Purpose' + objNum].textBox.value = '建筑类型';
	var group = new ComboBox.Group();
	if(objNum == '0'){
		var item = new ComboBox.Item("不限", "");
	}else{
		var item = new ComboBox();
	}
	item.initial = '-1';
	group.add(item);
	for(var i = 0; i < Purposes.length; i++){
		item = new ComboBox.Item(Purposes[i].name, Purposes[i].name);
		item.initial = Purposes[i].index;
		group.add(item);
	}
	document.comboBoxes['Purpose' + objNum].addGroup(group);
}

function initialRoom(objNum){
	document.comboBoxes['Room' + objNum].textBox.value = '居室';
	var group = new ComboBox.Group();
	var item = new ComboBox;
	item.initial = '-1';
	group.add(item);
	for(var i = 0; i < Room.length; i++){
		item = new ComboBox.Item(Room[i].name, Room[i].value);
		item.initial = Room[i].index;
		group.add(item);
	}
	document.comboBoxes['Room' + objNum].addGroup(group);
}

function form_action_new(){
	if(document.comboBoxes["District0"].selectedItem == null){
		$('strDistrict0').value = '';
	}else if(document.comboBoxes["District0"].selectedItem.initial > 99){
		$('strDistrict0').value = '';
	}else{
		$('strDistrict0').value = document.comboBoxes["District0"].hiddenField.value;
	}
	$('strPurpose0').value = document.comboBoxes["Purpose0"].hiddenField.value;
	$('strPrice0').value = document.comboBoxes["Price0"].hiddenField.value;
	if($('input_keyw0').value == '关键字' || $('input_keyw0').value == 'undefined'){
		$('strnamekeyword0').value = '';
	}else{
		$('strnamekeyword0').value = $('input_keyw0').value;
	}
}

function form_action_sell(){
	
	if(document.comboBoxes["District1"].selectedItem == null){
		$('strDistrict1').value = '';
	}else{
		$('strDistrict1').value = document.comboBoxes["District1"].hiddenField.value;
	}
	$('strPurpose1').value = document.comboBoxes["Purpose1"].hiddenField.value;
	$('strRoom1').value = document.comboBoxes["Room1"].hiddenField.value;
	$('strPrice1').value = document.comboBoxes["Price1"].hiddenField.value;

	if($('input_keyw1').value == '关键字' || $('input_keyw1').value == 'undefined'){
		$('strnamekeyword1').value = '';
	}else{
		$('strnamekeyword1').value = $('input_keyw1').value;
	}
}

function form_action_buy(){
	
	if(document.comboBoxes["District2"].selectedItem == null){
		$('strDistrict2').value = '';
	}else{
		$('strDistrict2').value = document.comboBoxes["District2"].hiddenField.value;
	}
	$('strPurpose2').value = document.comboBoxes["Purpose2"].hiddenField.value;
	$('strRoom2').value = document.comboBoxes["Room2"].hiddenField.value;
	$('strPrice2').value = document.comboBoxes["Price2"].hiddenField.value;

	if($('input_keyw2').value == '入关键字' || $('input_keyw2').value == 'undefined'){
		$('strnamekeyword2').value = '';
	}else{
		$('strnamekeyword2').value = $('input_keyw2').value;
	}
}

function form_action_rent(){
	if(document.comboBoxes["District3"].selectedItem == null){
		$('strDistrict3').value = '';
	}else{
		$('strDistrict3').value = document.comboBoxes["District3"].hiddenField.value;
	}
	$('strPurpose3').value     = document.comboBoxes["Purpose3"].hiddenField.value;
	$('strRoom3').value        = document.comboBoxes["Room3"].hiddenField.value;
	$('strPrice3').value       = document.comboBoxes["Price3"].hiddenField.value;
	if($('input_keyw3').value  == '关键字' || $('input_keyw3').value == 'undefined'){
		$('strnamekeyword3').value = '';
	}else{
		$('strnamekeyword3').value = $('input_keyw3').value;
	}
	
}

function form_action_hire(){
	
	if(document.comboBoxes["District4"].selectedItem == null){
		$('strDistrict4').value = '';
	}else{
		$('strDistrict4').value = document.comboBoxes["District4"].hiddenField.value;
	}
	$('strPurpose14').value = document.comboBoxes["Purpose4"].hiddenField.value;
	$('strRoom4').value = document.comboBoxes["Room4"].hiddenField.value;
	$('strPrice4').value = document.comboBoxes["Price4"].hiddenField.value;

	if($('input_keyw4').value == '入关键字' || $('input_keyw4').value == 'undefined'){
		$('strnamekeyword4').value = '';
	}else{
		$('strnamekeyword4').value = $('input_keyw4').value;
	}
}


function form_action_news(){
	if($('input_keyw5').value == '入关键字' || $('input_keyw5').value == 'undefined'){
		$('strnamekeyword5').value = '';
	}else{
		$('strnamekeyword5').value = $('input_keyw5').value;
	}
}


