<?php
require('path.inc.php');
header('content-Type: text/html; charset=utf-8');
$p2=$_REQUEST[p2];
$p3=$_REQUEST[p3];
$p4=$_REQUEST[p4];
$p5=$_REQUEST[p5];
$p6=$_REQUEST[p6];
$p7=$_REQUEST[p7];
$p8=$_REQUEST[p8];
$p9=$_REQUEST[p9];
$p10=$_REQUEST[p10];
$p11=$_REQUEST[p11];
$p12=$_REQUEST[p12];
$p13=$_REQUEST[p13];
//输出地图点的位置
if($p11==0){
$where='where 1=1';
if($p3){
	$where .= ' and b.lat>'.$p3.' and b.lat<'.$p4.' and b.lng>'.$p5.' and b.lng<'.$p6;
}
if($p7){
	$tmp = explode('-',$p7);
	if($tmp[0]){
		$where .= ' and b.sell_price >= '.intval($tmp[0]);
	}
	if($tmp[1]){
		$where .= ' and b.sell_price <= '.intval($tmp[1]);
	}	
} 
if($p8){
	$tmp = explode('-',$p8);
	if($tmp[0]){
		$where .= ' and c.borough_totalarea >= '.intval($tmp[0]);
	}
	if($tmp[1]){
		$where .= ' and c.borough_totalarea <= '.intval($tmp[1]);
	}
}
if($p9){
    $tmp = explode('-',$p9);
	if($tmp[0]){
		$where .= ' and b.sell_time = '.intval($tmp[0]);
	}
}
if($p10){
	$where .= ' and b.borough_type = '.$p10;
}
$sql='select count(b.id) as num,b.id as id,b.borough_name as name,b.lat as lat,b.lng as lng,b.isnew as isnew,b.sell_time as sell_time,c.* from (fke_borough as b left join fke_houserent as a on b.id = a.borough_id) left join fke_borough_info as c on b.id = c.id '.$where.' and b.isnew = 1 group by b.id';

mysql_query("set names gbk");
$result = mysql_query($sql);

$total = mysql_num_rows($result);
echo "this.markersNum = ".$total.";";
while($row = mysql_fetch_array($result))
  {
 if($row["id"] == null){
 }
 else{
 $str=iconv("gb2312","UTF-8",substrs($row['name'],16)); 
?>
this.metaMarkers.set("<?php echo $row['id'] ?>", {id:"<?php echo $row['id'] ?>", num:"<?php echo $row['num'] ?>", name:"<?php echo $str ?>", lat:"<?php echo $row['lat'] ?>", lng:"<?php echo $row['lng'] ?>"});
<?php
}
}
}
 //输出弹窗
else
{
$where='where id is not null';
if($p7){
	$tmp = explode('-',$p7);
	if($tmp[0]){
		$where .= ' and house_price >= '.intval($tmp[0]);
	}
	if($tmp[1]){
		$where .= ' and house_price <= '.intval($tmp[1]);
	}	
} 
if($p8){
	$tmp = explode('-',$p8);
	if($tmp[0]){
		$where .= ' and house_totalarea >= '.intval($tmp[0]);
	}
	if($tmp[1]){
		$where .= ' and house_totalarea <= '.intval($tmp[1]);
	}
}
if($p9){
	$where .= ' and house_room = '.$p9;
}
if($p10){
	$where .= ' and house_type = '.$p10;
}
if($p11){
mysql_query("set names gbk");
$where .= ' and borough_id = '.$p11;
$result = mysql_query("SELECT * FROM fke_borough WHERE id=".$p11);
$row = mysql_fetch_array($result);
$borough_name=iconv("gb2312","UTF-8",$row['borough_name']); 
$borough_avgprice=iconv("gb2312","UTF-8",$row['borough_avgprice']);
$sell_phone=iconv("gb2312","UTF-8",$row['sell_phone']);
$sell_time=iconv("gb2312","UTF-8",$row['sell_time']); 
$borough_address=iconv("gb2312","UTF-8",$row['borough_address']);
$borough_thumb = iconv("gb2312","UTF-8",$row['borough_thumb']);
}
if($p12){
$page=$p12;
}
$order='order by id desc';
if($p13){
$order='order by '.$p13;
}
?>
<div class="mapFinddingExtInofWind">
  <div class="mapFinddingExtInofWind_TopLine"> <span class="mapFinddingExtInofWind_CommName"><a href="<?php echo $cfg['url_newHouse']; ?>d-<?php echo $p11;?>.html" target="_blank" ><?php echo $borough_name;?></a></span> <span class="mapFinddingExtInofWind_PosError">(<a href="#" target="_blank" >位置有错误?</a>)</span> </div>
  <div class="mapFinddingExtInofWind_TopLine1"></div>
  <div class="mapFinddingExtInofWind_TopLine"><span style="float:left;width:200px;" class="newhouseview"><ul>
								<li>均价：<span class="familyAlpha colorF90 size14px weightBold"><?php echo $borough_avgprice;?></span>元/㎡</li>
								<li>销售电话：<span class="familyAlpha colorF90 size14px"><?php echo $sell_phone;?></span></li>
								<li>开盘时间：<span class="familyAlpha"><?php echo $sell_time;?></span></li>
								<li>楼盘地址：<span class="familyAlpha"><?php echo $borough_address;?></span></li>
								<li class="description"></li>
								<li class="detail"><a href="<?php echo $cfg['url_newHouse']; ?>d-<?php echo $p11;?>.html" target="_blank"><span class="color136">查看楼盘详情…</span></a></li>
								<li class="detail"><a href="<?php echo $cfg['url_newHouse']; ?>p-<?php echo $p11;?>.html" target="_blank"><span class="color136">楼盘图片</span></a> <a href="<?php echo $cfg['url_newHouse']; ?>s-<?php echo $p11;?>.html" target="_blank"><span class="color136">楼盘户型</span></a></li>
							</ul></span> <span style="float:right; margin-top:3px;"><img src="<?php if ($borough_thumb){ ?><?php echo $cfg['url']; ?>/upfile/<?php echo $borough_thumb;?><?php }else{ ?><?php echo $cfg['url']; ?>themes/2010a/images/demoNewHouse.jpg<?php } ?>" width="105" height="135" class="mapnewhousepic" /></span> </div>
  <div style="clear:both;"></div>
  </div>
<?php
}
?>