﻿function $$(id){return document.getElementById(id);}
function changemenu()
{
  var id=$$('slt_Menu').options[$$('slt_Menu').selectedIndex].value;
  currnetsearchid=id;
  $$('div_search1').style.display='none';  $$('div_search2').style.display='none';  $$('div_search3').style.display='none';  $$('div_search4').style.display='none';      
  $$('div_search'+id).style.display=''; 
  setKey();
}
function setKey()
{
if($$('txt_headsearch').value=='请输入楼盘名或位置' || $$('txt_headsearch').value=='请输入小区名或位置'|| $$('txt_headsearch').value=='')
{
  var s='';
  switch(currnetsearchid)
  {
   case '1':
   s='请输入楼盘名或位置';
   break;
   case '2':
   s='请输入小区名或位置';
   break;
   case '3':
   s='请输入小区名或位置';
   break;
   case '4':
   s='请输入小区名或位置';
   break;
  } 
  $$('txt_headsearch').value=s; 
  }
}
var site='http://'+CitySeed+'.homev.cn/';
var houseUrl=site+"house/list";
//新房
var houseareabj=['海淀','朝阳','丰台','石景山','东城','西城','崇文','宣武','通州','昌平','大兴','平谷','房山','顺义','密云','怀柔','延庆','门头沟','河北','天津'];
var houseareacq=['渝中','江北','渝北','南岸','沙坪坝','九龙坡','大渡口','北碚','巴南','合川','万州','永川','涪陵','璧山','潼南','铜梁','梁平','綦江','长寿','南川','江津'];
var housepriceArray;
var housepriceArray1;
var housetypeArray=['住宅','公寓','别墅','写字楼','商铺','平房','四合院','花园洋房'];
var plottypeArray=['住宅','公寓','别墅','写字楼','商铺','平房','四合院'];

if(CitySeed=='bj')
{
housepriceArray=['5000元以下','5000-1万','1万-1.5万','1.5万-2万','2万以上'];
}
else if(CitySeed=='cq')
{
housepriceArray=['3000元以下','3000-4000','4000-5000','5000-7000','7000-9000','9000以上'];
}

function setHousePrice(obj)
{  obj.innerHTML='价&nbsp;&nbsp;格：&nbsp;';
    for(i=0;i<housepriceArray.length;i++)
        obj.innerHTML+='<a href="'+houseUrl+'------'+(i+1)+'-.vhtml" name="Price" target="_blank" class="head_a8">'+housepriceArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);   
}
function setHouseType(obj)
{
    obj.innerHTML='类&nbsp;&nbsp;型：&nbsp;';
    for(i=0;i<housetypeArray.length;i++)
        obj.innerHTML+='<a href="'+houseUrl+'-'+(i+1)+'------.vhtml" name="Type" target="_blank" class="head_a8">'+housetypeArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);   
}
function sethouseArea(obj)
{
   var ar;
   if(CitySeed=='bj')
   ar=houseareabj;
   else if(CitySeed=='cq')
   ar=houseareacq;
   obj.innerHTML='区&nbsp;&nbsp;域：&nbsp;';
   for(i=0;i<ar.length;i++)
      obj.innerHTML+='<a href="'+houseUrl+'----'+i+'---.vhtml" name="Area" target="_blank" class="head_a8">'+ar[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);   
}
//二手房,租房,小区
function setArea(oj,pv,cv,str)
{
  var tmpurl=site+str+'/list'
	m=-1;
	n=-1;
	for (i=0;i<P.length;i++)
	{
		if(P[i]==pv)
		{
			for (j=0;j<C[i].length;j++)
			{
				if (C[i][j]==cv)
				{
					m=i;
					n=j;
				}
			}
		}
	}	
	oj.innerHTML='区&nbsp;&nbsp;域：&nbsp;';
	if (m!=-1&&n!=-1)
	{   	   
	 	for (i=0;i<D[m][n].length;i++)
		{		  
		  oj.innerHTML+='<a href="'+tmpurl+'-'+i+'-------------.vhtml" name="Area" target="_blank" class="head_a8">'+D[m][n][i]+'</a>&nbsp;&nbsp;';		 
		}
	}
}
var priceArray=['50万↓','50-80万','80-100万','100-120万','120-150万','150-200万','200-250万','250-300万','300-500万','500-1000万','1000万↑'];
function setSalePrice(obj)
{   
    var tmpurl=site+'sale/list';
    obj.innerHTML='价&nbsp;&nbsp;格：&nbsp;';
    for(i=0;i<priceArray.length;i++)
        obj.innerHTML+='<a href="'+tmpurl+'------'+(i+1)+'--------.vhtml" name="Price" target="_blank" class="head_a8">'+priceArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);
}
var rentpriceArray=['500元↓','500元-1000元','1000元-2000元','2000元-3000元','3000元-5000元','5000元-8000元','8000元-1万元','1万元↑'];
function setRentPrice(obj)
{
    var tmpurl=site+'rent/list';
     obj.innerHTML='价&nbsp;&nbsp;格：&nbsp;';
    for(i=0;i<rentpriceArray.length;i++)
        obj.innerHTML+='<a href="'+tmpurl+'------'+(i+1)+'--------.vhtml" name="Price" target="_blank" class="head_a8">'+rentpriceArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);  
}
function setsaleType(obj)
{ var tmpurl=site+'sale/list';
    obj.innerHTML='类&nbsp;&nbsp;型：&nbsp;';
    for(i=0;i<housetypeArray.length;i++)
        obj.innerHTML+='<a href="'+tmpurl+'----'+(i+1)+'----------.vhtml" name="Type" target="_blank" class="head_a8">'+housetypeArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);   
}
function setrentType(obj)
{var tmpurl=site+'rent/list';
    obj.innerHTML='类&nbsp;&nbsp;型：&nbsp;';
    for(i=0;i<housetypeArray.length;i++)
        obj.innerHTML+='<a href="'+tmpurl+'----'+(i+1)+'----------.vhtml" name="Type" target="_blank" class="head_a8">'+housetypeArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);   
}
var plotpriceArray=['5000元↓','5000元-1万','1万-1.5万','1.5万-2万','2万↑'];
function setPlotPrice(obj)
{ 
 var tmpurl=site+'plot/list';
  obj.innerHTML='价&nbsp;&nbsp;格：&nbsp;';
 for(i=0;i<plotpriceArray.length;i++)
 obj.innerHTML+='<a href="'+tmpurl+'----'+(i+1)+'-------.vhtml" name="Price" target="_blank" class="head_a8">'+plotpriceArray[i]+'</a>&nbsp;&nbsp;';
  obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);
}
function setplotType(obj)
{var tmpurl=site+'plot/list';
    obj.innerHTML='类&nbsp;&nbsp;型：&nbsp;';
    for(i=0;i<plottypeArray.length;i++)
        obj.innerHTML+='<a href="'+tmpurl+'---'+(i+1)+'--------.vhtml" name="Type" target="_blank" class="head_a8">'+plottypeArray[i]+'</a>&nbsp;&nbsp;';
    obj.innerHTML = obj.innerHTML.substring(0,obj.innerHTML.length-1);   
}
function goSearchMore()
{
 var s='';
 switch(currnetsearchid)
 {
  case '1':
  s='house/Search.aspx';
  break;
  case '2':
  s='sale/Search.aspx';
  break;
  case '3':
  s='rent/Search.aspx';
  break;
  case '4':
  s='plot/Search.aspx';
  break;
 }
 window.location.href=site+s;
}
function goSearch()
{
  var key =$$('txt_headsearch').value;
  if(key=='请输入楼盘名或位置' || key=='请输入小区名或位置')
    key='';
  var s='';
  switch(currnetsearchid)
  {
   case '1':
   s=site+'house/Search.aspx?KeyWord=';
   break;
   case '2':
   s=site+'sale/Search.aspx?Key=';
   break;
   case '3':
   s=site+'rent/Search.aspx?Key=';
   break;
   case '4':
   s=site+'plot/Search.aspx?Key=';
   break;
  }   
 window.location.href= s+encodeURIComponent(key);   
}
function goMapSearch()
{
 var s='';
 switch(currnetsearchid)
 {
  case '1':
  s='house/MapSearch/MapSearch.aspx';
  break;
  case '2':
  s='sale/MapSearch.aspx';
  break;
  case '3':
  s='rent/MapSearch.aspx';
  break;
  case '4':
  s='plot/MapSearch.aspx';
  break;
 } 
  window.location.href= site+s;
}
function gotosearch(ev,key)
{
    ev = ev || event;
    if(ev.keyCode==13) goSearch();
}
function Search_Init()
{
    sethouseArea($$('div_search1_area'));
    setHousePrice($$('div_search1_price'));
    setHouseType($$('div_search1_Type'));setsaleType($$('div_search2_Type'));setrentType($$('div_search3_Type'));setplotType($$('div_search4_Type'));
    setArea($$('div_search2_area'),CurrentPorvince ,CurrentCity,'sale');    
    setSalePrice($$('div_search2_price'));
    setArea($$('div_search3_area'),CurrentPorvince ,CurrentCity,'rent'); 
    setRentPrice($$('div_search3_price'));
    setArea($$('div_search4_area'),CurrentPorvince ,CurrentCity,'plot');  
    setPlotPrice($$('div_search4_price'));     
}
function changejiazhumenu(index)
{             
for(i=0;i<JIAZHUCOUNT;i++)
{
HomeV.$("jiazhu_menu"+i).className='tag_two';
HomeV.$("jiazhu_content"+i).style.display='none';
}
HomeV.$("jiazhu_menu"+index).className='tag_one';
HomeV.$("jiazhu_content"+index).style.display='block';
}
var index=0;
function menuloop()
{
index=(index)%MenuCount;          
changejiazhumenu(index);
index++;
}
function ShowVideo(newsid,index,videoid,img,cDomain)
{                                     
    var hotnews = new myFlash('http://lib.homevcache.com/player/v1/miniplayer_preview.swf',264,202,"9.0")
    hotnews.addAttrib("id","flash_prev");
    hotnews.addParam("allowScriptAccess","always");
    hotnews.addParam("bgcolor","#ffffff");
    hotnews.addParam("allowFullScreen","true");   
    hotnews.addParam("wmode","transparent");  
    hotnews.addVars("videoUrlType",0);
    hotnews.addVars("videoUrl","http://"+cDomain+"/News/IndexMini.ashx?ID=" + newsid);                  
    hotnews.addVars("previewImgUrl",img); 
    hotnews.addVars("navUrl","http://"+cDomain+"/house/goNews.aspx?ID=" + newsid);                               
    hotnews.toObject("hotnews:player"); 
}        
function ChangeTopList(type)
{      
 var menu;                  
 for(i=1;i<5;i++)
 {
  menu=HomeV.$('TopList_menu'+i);
  menu.className='head_b';        
  $(menu).css('font-weight','normal');  
 }
 for(i=1;i<5;i++)
 {HomeV.$('div_TopList'+i).style.display='none';                      
 }
 menu=HomeV.$('TopList_menu'+type);         
 menu.className='head_a';
 $(menu).css('font-weight','bold');
 HomeV.$('div_TopList'+type).style.display='';
}

window.Comts = function(coms,cDomain)
{
var html="";
var fid,floorname,content;
var item;        
for(var i=0;i<coms.length;i++)
{
 item = coms[i];
 fid=item.ObjId;
 floorname=item.ObjName;
 content=item.Content;
 var len=parseInt(floorname.length)+parseInt(content.length);
 if(parseInt(len)>16)
 { 
 content=content.substr(0,parseInt(18)-parseInt(floorname.length))+"";}
 html+='·[<a href="http://'+cDomain+'/house/'+fid+'.vhtml"  title="'+ floorname +'" target="_blank" class="head_a12">'+ floorname +'</a>]<a href="http://'+cDomain+'/house/'+fid+'.vhtml" target="_blank" title="'+item.Content+'" class="head_a8">'+content+'</a><br />';
}
document.getElementById('detial_Comments').innerHTML = html+'<div class="clear"></div>';
} 
function BigAD(surl)
{
var player = new myFlash("http://lib.homevcache.com/player/newhouseflvp/newhouse.swf","970", "410", "9");
	player.addAttrib("id","player_video_cont");
	player.addParam("allowScriptAccess","always");
	player.addParam("allowFullScreen","true");
	player.addParam("wmode","opaque");
	player.addVars("xmlDoc",surl);
	player.addVars("aniTime","3");
	player.addVars("showList","false");
	player.toObject("player");
}