﻿// JScript 文件
$(document).ready(function(){
    //头部
    $("#topone").html(topshow());
    $("#topnowtime").html(nowtimeshow());
    //搜索条 
    $("#sowner").change(function() { ownertype("sowner","sbtype"); });
    $("#btnca").click(function() { casun(); });
    //户型搜索事件
    husou();
    $("#twower").change(function() { ownertype("twower","twobtype"); });
    $("#btnfu").click(function() { husou(); });
    
    var newshtml='';
    $(showyenei).each(function(i){ //点评新楼 遍历结果数组 
            if(i<10)
            {
            if(showyenei[i].name.length>12)
            newshtml+='<a href="'+showyenei[i].url+'" target="_blank"><span class="flo1 pb3 col5" title="'+showyenei[i].name+'">'+showyenei[i].name.substring(0,11)+'..</span> ';    
            else
            newshtml+='<a href="'+showyenei[i].url+'" target="_blank"><span class="flo1 pb3 col5" title="'+showyenei[i].name+'">'+showyenei[i].name+'</span> ';  
            newshtml+='<span class="flo2 pb3" title="'+showyenei[i].date+'">'+showyenei[i].date.substring(0,4)+'..</span>  '; 
            if(showyenei[i].publisher.length>7)
            newshtml+='<span class="flo2 marr2 pb3" title="'+showyenei[i].publisher+'">'+showyenei[i].publisher.substring(0,6)+'..</span>';  
            else
            newshtml+='<span class="flo2 marr1 pb3" title="'+showyenei[i].publisher+'">'+showyenei[i].publisher+'</span>';            
            newshtml+='</a><br />';
              }  })

    $("#nunnew").html(newshtml);
   
})
//户型搜索事件
function husou()
{
    var huwhe="$11=" +$("#jushi").val();
    var owner = $("#twower").val();if (owner != "10"){ huwhe += "$5=" + owner;}
    var btype = $("#twobtype").val();if (btype != "10"){ huwhe += "$6=" + btype;}
    var eareone = $("#eareone").val();if (eareone.length>1){ huwhe += "$10=" + eareone;}
    var earetwo = $("#earetwo").val();if (earetwo.length>1){ huwhe += "$9=" + earetwo;} 
    $.post("index.aspx",{ Action: "post",9: huwhe},
           function(responseText, textStatus, XMLHttpRequest) { //回调函数 可以是 xmlDoc, jsonObj, html, text, 等等.
                              $("#fushow").html(responseText);
                           },"html");
}
//搜索事件
function casun() {
    //1音序2热点区域3区县4地址5物业类型6建筑类型7楼盘名称8楼盘价格
    var whe = "";
    var ddlq = $('#ddlqu').val();if (ddlq != "500118"){ whe += "$3=" + ddlq;}
    var address = $("#saddress").val();if (address.length > 0 && address.indexOf("地址")==-1){whe+="$4=" + address; }
    var ptwo = $("#sptwo").val();if (ptwo != "10"){ whe += "$8=" + ptwo;}
    var owner = $("#sowner").val();if (owner != "10"){ whe += "$5=" + owner;}
    var btype = $("#sbtype").val();if (btype != "10"){ whe += "$6=" + btype;}
    var name = $("#sname").val();if (name.length > 0 && name.indexOf("名称")==-1){whe+="$7=" + name; }
    window.open("NHAll.htm?"+whe,"_blank");
}   