﻿    var ucName = "SearchBar1_";
    var hidBorough = document.getElementById(ucName + "hidBorough");
    var hidPlate = document.getElementById(ucName + "hidPlate"); 
    var DCityID= 1;
    var spBoroughinnerHTML;
    var spPlateinnerHTML;
    	if(hidBorough.value != "0"){
            spBoroughinnerHTML = '城区不限';
        }
        
        if(hidPlate.value != "0"){
            spPlateinnerHTML = '片区不限';
        }

var spBorough = document.getElementById("spBorough");
var spPlate = document.getElementById("spPlate");
var spprice = document.getElementById("spprice");
var Fitment = document.getElementById("spFitment");
var $;
$=function(e){return document.getElementById(e);};
SetSelectValue();

function CsBg($){$.className = "csbg";}
function ReBg($){$.className = "rebg";}

function ShowDiv(divName,ShowType)
    {             
        var divControl = document.getElementById(divName);
        var Content = "<ul>";
        switch(ShowType)
        {
            //城区
            case "Borough"://显示区域的弹出信息
                for (i=0; i<AreaBoroughList.length; i++)
			    {
				    if (AreaBoroughList[i][0] == DCityID)//[0] [1] 第一列 第二列 
				    {
				        if(i == 0)
				        {
				            Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectBorough('0','城区不限');\">不限</a></li>";
				        }
					    Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectBorough('" + AreaBoroughList[i][2] + "','" + AreaBoroughList[i][1] + "');\">" + AreaBoroughList[i][1] + "</a></li>";
					}
				};
                break;
           
	     //片区
            case "Plate"://显示板块的弹出信息                        
                for (i=0; i<AreaPlateList.length; i++)
			    {			        
			        if(i == 0 && hidBorough.value != "0")
			        {			            
			            Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('0','片区不限','Plate');\">不限</a></li>";
			        }
				    if (AreaPlateList[i][0] == hidBorough.value)//[0] [1] 第一列 第二列 
				    {				        
					    Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + AreaPlateList[i][2] + "','" + AreaPlateList[i][1] + "','Plate');\">" + AreaPlateList[i][1] + "</a></li>";
					}
				}
                break;
         	
			//价格
           	case "price"://显示价格的弹出信息
				Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('0','价格不限','price');\">价格不限</a></li>";
             	 for (i=0; i<priceList.length; i++)
			    {			        			            
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + priceList[i][2] + "','" + priceList[i][1] + "','price');\">" + priceList[i][1] + "</a></li>"; 
				}
			  
            break;
			
			
			
			
			//物业类型
           	case "HouseType"://显示房屋类型的弹出信息                        
             	 for (i=0; i<HouseType.length; i++)
			    {			        
			       			            
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + HouseType[i][2] + "','" + HouseType[i][1] + "','HouseType');\">" + HouseType[i][1] + "</a></li>";
			        
				}
				
            break;
            case "HouseType2"://显示房屋类型的弹出信息                        
             	 for (i=0; i<HouseType.length; i++)
			    {			        
			       			            
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + HouseType[i][2] + "','" + HouseType[i][1] + "','HouseType2');\">" + HouseType[i][1] + "</a></li>";
			        
				}
				
            break;
			
			//二手房
			case "OldHouseType": //二的房房源类型
				for(i=0;i<OldHouseType.length;i++)
				{
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + OldHouseType[i][2] + "','" + OldHouseType[i][1] + "','OldHouseType');\">" + OldHouseType[i][1] + "</a></li>";
				}
			break;
                        case "OldHouseType3": //二的房房源类型
				for(i=0;i<OldHouseType.length;i++)
				{
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + OldHouseType[i][2] + "','" + OldHouseType[i][1] + "','OldHouseType3');\">" + OldHouseType[i][1] + "</a></li>";
				}
			break;
			
			case "OldHouseType2": //二的房房源类型
				for(i=0;i<OldHouseType2.length;i++)
				{
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + OldHouseType2[i][2] + "','" + OldHouseType2[i][1] + "','OldHouseType2');\">" + OldHouseType2[i][1] + "</a></li>";
				}
			break;
			case "OldHouseType4": //二的房房源类型
				for(i=0;i<OldHouseType2.length;i++)
				{
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + OldHouseType2[i][2] + "','" + OldHouseType2[i][1] + "','OldHouseType4');\">" + OldHouseType2[i][1] + "</a></li>";
				}
			break;
            //城区
            case "Borough2"://显示区域的弹出信息

                for (i=0; i<AreaBoroughList.length; i++)
			    {
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + AreaBoroughList[i][2] + "','" + AreaBoroughList[i][1] + "','Borough2');\">" + AreaBoroughList[i][1] + "</a></li>";
				};
            break;

 //城区
            case "Borough3"://显示区域的弹出信息

                for (i=0; i<AreaBoroughList.length; i++)
			    {
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + AreaBoroughList[i][2] + "','" + AreaBoroughList[i][1] + "','Borough3');\">" + AreaBoroughList[i][1] + "</a></li>";
				};
            break;
//城区
            case "Borough4"://显示区域的弹出信息

                for (i=0; i<AreaBoroughList.length; i++)
			    {
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + AreaBoroughList[i][2] + "','" + AreaBoroughList[i][1] + "','Borough4');\">" + AreaBoroughList[i][1] + "</a></li>";
				};
            break;


			//价格
           	case "price2"://显示价格的弹出信息
				Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('0','价格不限','price');\">价格不限</a></li>";
             	 for (i=0; i<HousePriceList.length; i++)
			    {		
					if( HousePriceList[i][0]==document.getElementById('SearchBar1_hidOldHouseType').value)
					{
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + HousePriceList[i][0] + "','" + HousePriceList[i][1] + "','price2');\">" + HousePriceList[i][1] + "</a></li>"; 
					}
				}
			break;
				
			//资讯
			case "News":
                for (i=0; i<NewType.length; i++)
			    {
			     Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + NewType[i][2] + "','" + NewType[i][1] + "','News');\">" + NewType[i][1] + "</a></li>";
				};
			break;
		 
		   //资讯类别
		   case "NewsKind":
		   	   for(i=0;i<NewsClass.length;i++)
			   {
				   if(NewsClass[i][0]== document.getElementById('SearchBar1_hidNews').value)
				   {
				   Content += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:SelectValue('" + NewsClass[i][2] + "','" + NewsClass[i][1] + "','NewsKind');\">" + NewsClass[i][1] + "</a></li>";
				   }
			   }
		   break;
			
        }
        Content += "</ul>";
		divControl.innerHTML = Content;
		divControl.style.display = "block";
	}
	 
    function HideDiv(divName)
    {
        var divControl = document.getElementById(divName);
        divControl.style.display = "none";
    }
	
   
   //城区连动 
    function SelectBorough(boroughId,boroughName)
    {
    var ucName = "SearchBar1_";
    var hidBorough = document.getElementById(ucName + "hidBorough");
	
        document.getElementById("Borough").style.display = "none";
        hidBorough.value = boroughId;   
        spBorough.innerHTML = boroughName;
               
        spPlate.innerHTML = "片区不限";
        hidPlate.value = "0";
		
    }
	
	
   //显示
    function SelectValue(id,name,controlName)
    {
		         
        document.getElementById(controlName).style.display = "none";
		var ucName = "SearchBar1_";
		var ConValues=id;
        var hidControl = document.getElementById(ucName + "hid" + controlName);
        var spControl = document.getElementById("sp" + controlName);
        if(hidControl == null)
        {
            hidControl = "0";
        }
        hidControl.value = id;        
        spControl.innerHTML = name; 
		
    }   
    

   function SetSelectValue()
   {    
        if(hidBorough.value != "0")
        {
            spBorough.innerHTML = spBoroughinnerHTML;
        }
        
        if(hidPlate.value != "0")
        {
            spPlate.innerHTML = spPlateinnerHTML;
        }
		
    }
