function changePanel(type){
	if(type==1){
		makeRequest("include/search_panel.php","searchPanel","","");
	}else if(type==2){
		makeRequest("include/search_panel2.php","searchPanel","","");
	}else if(type==3){
		makeRequest("include/search_panel3.php","searchPanel","","");
	}
}

function checkpanel1form(){
	area=document.getElementById("area");
	zip=document.getElementById("zip");
	v1=area.options[area.selectedIndex].value;
	v2=zip.options[zip.selectedIndex].value;
	if(v1==""){
	 	alert("請選擇縣市");
		area.className="bgred";
	 	return false;	
	}else{
		if(checkprice()){
			document.panel1form.action="rentSec"+area.options[area.selectedIndex].value+"-"+zip.options[zip.selectedIndex].value+".htm";
			return true;
		}
		return false;
	}
}
function checkpanel2form(){
	var sub_="";
	var sub2_="";
	if(document.getElementById("sub")){
		if(document.getElementById("sub").options.length>0){
			sub_=document.getElementById("sub").options[document.getElementById("sub").selectedIndex].value;
		}
	}
	if(document.getElementById("sub2")){
		if(document.getElementById("sub2").options.length>0){
			sub2_=document.getElementById("sub2").options[document.getElementById("sub2").selectedIndex].value;
		}
	}
	if(checkprice()){
		if(sub_=="") sub_=0;
		if(sub2_=="") sub2_=0;
		document.panel2form.action="rentSub"+sub_+"-"+sub2_+".htm";
		return true;
	}
	return false;
}
function checkpanel3form(){
	var school="";
	var url="";
	school=document.getElementById("school").options[document.getElementById("school").selectedIndex].value;
	if(school==""){
		alert('請選擇大專院校後再送出');
	}else{
		if(checkprice()){
			document.panel3form.action="rentSchool"+school+".htm";
			return true;
		}
	}
	return false;
}

function checkprice(){
	var tmp=0;
	p1_=document.getElementById("p1").value;
	p2_=document.getElementById("p2").value;
	if(p1_=="" || p2_==""){
		p1_=0;
		p2_=0;
	}
	if(isNaN(p1_) ||isNaN(p2_)){
		alert("價錢請輸入數字");
		return false;
	}
	if(parseInt(p1_)>parseInt(p2_)){
		tmp=p1_;
		p1_=p2_;
		p2_=tmp;
		document.getElementById("p1").value=p1_;
		document.getElementById("p2").value=p2_;
	}
	return true;
}