//view.js

/**
*  搜索
**/
function xf_search(){
	if (document.form1.minprice.value!= null){
		if (!isFloat(document.form1.minprice.value)) {
	        	alert('价格必须为数字型');
	        	return false;
	    }  
    }
    if (document.form1.maxprice.value!= null){
		if (!isFloat(document.form1.maxprice.value)) {
	        	alert('价格必须为数字型');
	        	return false;
	    }  
    }
    document.form1.target = "_blank";
	document.form1.action = "../xf_list.jsp";
	document.form1.submit();
}

/**
 *  城区搜索
 */
function zonePage(cityzoneid) {
   // location.href = "../xf_list.jsp?cityzoneid=" + cityzoneid + "&cq=1";
   var url = "../xf_list.jsp?cityzoneid=" + cityzoneid + "&cq=1";
   window.open(url);
}


/**
 *  价格区间搜索
 */
function pricePage(minprice, maxprice) {
    //location.href = "../xf_list.jsp?minprice=" + minprice + "&maxprice=" + maxprice;
    var url = "../xf_list.jsp?minprice=" + minprice + "&maxprice=" + maxprice;
     window.open(url);
}

/**
*  左侧菜单城区快捷搜索
**/
function cityzone_menusearch(id){
	if (id == -1){
		document.form1.cityzone.value = id;
	}else{
		document.form1.cityzoneid.value = id;
	}
    document.form1.opt.value = "searchCS";
    document.form1.action = "http://fz.china-house.com/esf/cs_list.jsp?service=ls";
	document.form1.submit();
}

/**
*  左侧评估列表城区快捷搜索
**/
function cityzone_evalsearch(id){
	if (id == -1){
		document.form1.cityzone.value = id;
	}else{
		document.form1.cityzoneid.value = id;
	}
    document.form1.opt.value = "search";
    document.form1.action = "http://fz.china-house.com/esf/eval_list.jsp?service=ls";
	document.form1.submit();
}

/**
*  查询更多同地段房源
**/
function aroundfy_search(id){
	document.form1.cityzoneid.value = id;
    document.form1.opt.value = "searchCS";
    document.form1.target = "_blank";
    document.form1.action = "http://fz.china-house.com/esf/cs_list.jsp?service=ls";
	document.form1.submit();
}


/**
 * 留意新房
 */
function F_Advert() {
    var url="../advert.jsp?id=" + form1.houseId.value
    		+ "&randid=" + Math.random();
	document.getElementById("advertxf").src = url;
	//document.getElementById("adverthref").href = "#enterlogin",
}


/**
 * 只能输入实数
 */ 
function FloatKeyPress() {
    if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46)
	    event.keyCode=0;
}

/**
 * 判断参数是否为数值(含整型和浮点型)类型
 */
function isFloat(str) {
   if(!isNaN(str)) {
      return true;
	} else {
	   return false;   
	}
}

function onFormSubmit() {
    var sMemberName = document.getElementById("memberName").value;
    var sContent = document.getElementById("content").value;
    if (sMemberName=="" || sContent=="") {
        alert("对不起，用户名和评论内容都必须填写！");
        return false;
    } else if (sContent.length > 500) {
        alert("对不起，评论内容的字数必须小于500个！");
        return false;
    }
    if (typeof(lp_tid) != "undefined") {
        formv.action = formv.action + "&tid=" + lp_tid;
    }
   formv.submit();
}

function preComment() {
    var lpUrl = "http://bbs.china-house.com/frame.php";
    var cityzoneid = formv.cityzoneid.value;
    switch (cityzoneid) {
		    	case 7:
		    		lpUrl += "?fid=255";
		    		break;
		    	case 9:
		    		lpUrl += "?fid=252";
		    		break;
		    	case 11:
		    		lpUrl += "?fid=254";
		    		break;
		    	case 16:
		    		lpUrl += "?fid=253";
		    		break;
		    	default:
		    		lpUrl += "?fid=273";
		    	}
    if (typeof(lp_tid) != "undefined") {
        lpUrl += "&tid=" + lp_tid;        
    }
    window.open(lpUrl);
}