﻿function Knowssearch(frm) {  

  var keyword = document.getElementById("KnowsKey").value;
  var formAction = frm.action;
  if(keyword == "请输入关键字") {
    keyword = "";
  }
  keyword = escape(keyword);
  keyword = escape(keyword);
  formAction = "http://www.jtzhiye.com/NewsList.aspx?key=" + keyword;
  location.replace(formAction);

  return false;
}

function Newssearch(frm) {  

  var keyword = document.getElementById("NewsKey").value;
  var formAction = frm.action;
  if(keyword == "请输入关键字") {
    keyword = "";
  }
  keyword = escape(keyword);
  keyword = escape(keyword);
  formAction = "http://www.jtzhiye.com/NewsList.aspx?key=" + keyword;
  location.replace(formAction);

  return false;
}

function search(frm) {  
  var houseskind = document.getElementById("houseskind").value;
  var district = document.getElementById("district").value;
  var bedroomtype = document.getElementById("bedroomtype").value;
  var area = document.getElementById("area").value;
  var rprice = document.getElementById("rprice").value;
  var eprice = document.getElementById("eprice").value;
  var companysid = document.getElementById("companysid").value;
  var keyword = document.getElementById("keyword").value;
  var formAction = frm.action;
  if(keyword == "请输入关键字 中文/拼音首字母") {
    keyword = "";
  }
//  keyword = keyword;
//  keyword = escape(keyword);
  if(houseskind == "11") {
    formAction = "http://www.jtzhiye.com/search.aspx?key=" + keyword + "&area=" + district + "&hx=" + bedroomtype + "&price="+rprice+"&mj="+area+"&type=1";
  } else if(houseskind == "21") {
    formAction = "http://www.jtzhiye.com/search.aspx?key=" + keyword + "&area=" + district + "&hx=" + bedroomtype + "&price="+eprice+"&mj="+area+"&type=0";
  }
  location.replace(formAction);
//  location.href(formAction);
//  location.reload(formAction);

  return false;
}

function SubList(t){
	var Oid=t.id;

	var Tid=Oid.split("_")[1];//1
	var Root=Oid.split("_")[0];//..
	var Tid1=Math.floor(Tid)-1;//0
	var Tid2=Tid;//1
	var Tid3=Math.floor(Tid)+1;//2
	
	var OTid1=document.getElementById(Root+"_"+Tid1);//0
	var OTid2=document.getElementById(Root+"_"+Tid2);//..1
	var OTid3=document.getElementById(Root+"_"+Tid3);//..2

	for (x=1;x<=3;x++){
		  var temp=document.getElementById(Root+"_"+x);
		  temp.className=temp.className.replace("_","");
		  if (document.getElementById(Root+"_"+x+"_Data")!=null) document.getElementById(Root+"_"+x+"_Data").style.display="none";
	}

	OTid2.className="headsub_";
	document.getElementById(Root+"_"+Tid+"_Data").style.display="block";

}
function BarList(t){

	var Oid=t.id;//bar_2

	var Tid=Oid.split("_")[1];//1//2
	var Root=Oid.split("_")[0];//..bar
	var Tid1=Math.floor(Tid)-1;//0//1
	var Tid2=Tid;//1//2
	var Tid3=Math.floor(Tid)+1;//2//3
	
	var OTid1=document.getElementById(Root+"_"+Tid1);//0
	var OTid2=document.getElementById(Root+"_"+Tid2);//..1
	var OTid3=document.getElementById(Root+"_"+Tid3);//..2

	for (x=1;x<=5;x++){
		  var temp=document.getElementById(Root+"_"+x);
		  temp.className=temp.className.replace("_","");
	}

	OTid2.className="headbar_";


}

	function tab(i){
		document.getElementById("housesKind").value = i;
	}
	
	function setTab(num,type,isclick){
 		document.getElementById("P1").className="ditch-tab ditch-unfocused";
 		document.getElementById("P2").className="ditch-tab ditch-unfocused";
 		document.getElementById("P3").className="ditch-tab ditch-unfocused";
 		document.getElementById("P"+num).className="ditch-tab ditch-focused";

 		if(type==11){
 			document.getElementById("price_1_1").innerText = "1000Ԫ/������";
 			document.getElementById("price_2_1").innerText = "2000-3000Ԫ/��";
 			document.getElementById("price_3_1").innerText = "3000-4000Ԫ/��";
 			document.getElementById("price_4_1").innerText = "4000-5000Ԫ/��";
 			document.getElementById("price_5_1").innerText = "5000-6000Ԫ/��";
 			document.getElementById("price_6_1").innerText = "6000-7000Ԫ/��";
 			document.getElementById("price_7_1").innerText = "7000Ԫ/������";
 			var tempdiv = document.getElementById("type3_options").children;
 			for (i = 0; i <tempdiv.length; i++){
 				tempdiv[i].style.width=160;
 			}
 			tempdiv[tempdiv.length-1].style.width=320;
 			document.getElementById("type3_options").style.width=320;
 			document.getElementById("type3").style.width=130;
 		}else if(type==21){ 		
 			document.getElementById("price_1_1").innerText = "60��Ԫ����";
 			document.getElementById("price_2_1").innerText = "60-80��Ԫ";
 			document.getElementById("price_3_1").innerText = "80-100��Ԫ";
 			document.getElementById("price_4_1").innerText = "100-120��Ԫ";
 			document.getElementById("price_5_1").innerText = "120-150��Ԫ";
 			document.getElementById("price_6_1").innerText = "150-200��Ԫ";
 			document.getElementById("price_7_1").innerText = "200��Ԫ����";
 			var tempdiv = document.getElementById("type3_options").children;
 			for (i = 0; i <tempdiv.length; i++){
 				tempdiv[i].style.width=90;
 			}
 			tempdiv[tempdiv.length-1].style.width=180;
 			document.getElementById("type3_options").style.width=180;
 			document.getElementById("type3").style.width=104;
 		}
 		if(isclick==1)
   		document.getElementById("jumpPage").value = 1;
 		tab(type);
	}	
	
	var currentFocusPanel=null;
	function showOptions(obj,reviseNum){
		var srcTop = 0;
		var srcLeft = 0;
		var srcObj = obj;
		while (srcObj = srcObj.offsetParent){
			srcTop+=srcObj.offsetTop;
			srcLeft+=srcObj.offsetLeft;
		}

		if(currentFocusPanel!=null)
			currentFocusPanel.style.display="none";
		var optPanel=document.getElementById(obj.id+"_options");

		optPanel.style.display="block";
		optPanel.style.pixelTop = srcTop + 18;
		optPanel.style.pixelLeft = document.documentElement.scrollLeft+document.getElementById(obj.id).offsetLeft+150;
		currentFocusPanel=optPanel;
	}
	function showCityOptions(obj,reviseNum){
    var srcTop = 0;
    var srcLeft = 0;
    var srcObj = obj;
    while (srcObj = srcObj.offsetParent){
      srcTop+=srcObj.offsetTop + 3;
      srcLeft+=srcObj.offsetLeft;
    }

    if(currentFocusPanel!=null)
      currentFocusPanel.style.display="none";
    var optPanel=document.getElementById(obj.id+"_options");
    optPanel.style.display="block";
    optPanel.style.pixelTop = srcTop + 18;
    optPanel.style.pixelLeft = srcLeft + reviseNum;
    currentFocusPanel=optPanel;
  }
	function chooseOpt(obj,aTag,typeName,value){
		document.getElementById(aTag).innerHTML = obj.innerText;
		//document.getElementById(obj.parentElement.targetBox).innerText = obj.innerText;
		closeOptPanel(obj.parentElement.id);
		document.getElementById(typeName).value = value;
		
		if(aTag == 'type0a' && value == '11') {
		  document.getElementById("rPriceDiv").style.display = "";
      document.getElementById("ePriceDiv").style.display = "none";
		} else if(aTag == 'type0a' && value == '21') {
      document.getElementById("rPriceDiv").style.display = "none";
      document.getElementById("ePriceDiv").style.display = "";
		}
	}
	
	function closeOptPanel(pid){
		document.getElementById(pid).style.display="none";
		currentFocusPanel=null;
	}
	
	function chooseOptAuto(obj,typeName,value){
		var tempDiv = obj.children;
		for (i = 0; i <tempDiv.length; i++){
			if(tempDiv[i].children[0].id == value){
				document.getElementById(obj.targetBox).innerText=tempDiv[i].children[0].innerText;				
			}
		}
		closeOptPanel(obj.id);
		document.getElementById(typeName).value = value;
	}
function HouseNewsList(t){
	var Oid=t.id;

	var Tid=Oid.split("_")[1];//1
	var Root=Oid.split("_")[0];//..
	var Tid1=Math.floor(Tid)-1;//0
	var Tid2=Tid;//1
	var Tid3=Math.floor(Tid)+1;//2
	
	var OTid1=document.getElementById(Root+"_"+Tid1);//0
	var OTid2=document.getElementById(Root+"_"+Tid2);//..1
	var OTid3=document.getElementById(Root+"_"+Tid3);//..2

	for (x=1;x<=2;x++){
		  var temp=document.getElementById(Root+"_"+x);
		  temp.className=temp.className.replace("_","");
		  if (document.getElementById(Root+"_"+x+"_Data")!=null) document.getElementById(Root+"_"+x+"_Data").style.display="none";
	}

	OTid2.className="HouseNewsCenter_";
	document.getElementById(Root+"_"+Tid+"_Data").style.display="block";

}
function HouseList(t){
	var Oid=t.id;

	var Tid=Oid.split("_")[1];//1
	var Root=Oid.split("_")[0];//..
	var Tid1=Math.floor(Tid)-1;//0
	var Tid2=Tid;//1
	var Tid3=Math.floor(Tid)+1;//2
	
	var OTid1=document.getElementById(Root+"_"+Tid1);//0
	var OTid2=document.getElementById(Root+"_"+Tid2);//..1
	var OTid3=document.getElementById(Root+"_"+Tid3);//..2

	for (x=1;x<=3;x++){
		  var temp=document.getElementById(Root+"_"+x);
		  temp.className=temp.className.replace("_","");
		  if (document.getElementById(Root+"_"+x+"_Data")!=null) document.getElementById(Root+"_"+x+"_Data").style.display="none";
	}

	OTid2.className="HouseCenter_";
	document.getElementById(Root+"_"+Tid+"_Data").style.display="block";

}
