﻿function toggleSearch(event) {
    var current = event;
    for (var i = 1; i <= 7; i++) {
        var et = $('#search_t' + i)[0];
        var ec = $('#search_c' + i);
        if (current.id == et.id) {
            et.className = 's_t_2';
            ec.show();
        } else {
            et.className = 's_t_3';
            ec.hide();
        }
    }
}

function toggleSh(event) {
    var current = event;
    for (var i = 1; i <= 2; i++) {
        var et = $('#sh_t' + i)[0];
        var ec = $('#sh_c' + i);
        if (current.id == et.id) {
            et.className = 'smallbox_b_1';
            ec.show();
        } else {
            et.className = 'smallbox_b_2';
            ec.hide();
        }
    }
}

function toggleBiz(event) {
    var current = event;
    for (var i = 1; i <= 2; i++) {
        var et = $('#biz_t' + i)[0];
        var ec = $('#biz_c' + i);
        if (current.id == et.id) {
            et.className = 'smallbox_b_1';
            ec.show();
        } else {
            et.className = 'smallbox_b_2';
            ec.hide();
        }
    }
}
//首页选项卡
function showHotSpechover(j)
        {
            for(var i=1;i<4;i++)
            {
                var id="spec"+i;
                document.getElementById(id).style.display="none";
                document.getElementById("h"+i).className="current0 current2";
            }
            document.getElementById("spec"+j).style.display="block";
            document.getElementById("h"+j).className="current0 current1";
        }

//首页站内搜索
function CheckToSearch(SearchType,Name,KeyWord,Type)
{
	var LinkUrl;
	//alert(SearchType);
	var KeyWords=document.getElementById(KeyWord).value;
	if(SearchType == 'News')
	{
		LinkUrl="http://www.lousun.com/search.aspx?searchtype=0&Keyword="+ escape(KeyWords);
	}
	if(SearchType == 'Price')
	{
		LinkUrl="http://www.lousun.com/search.aspx?searchtype=1&ModelId=106&nodeId=54&Keyword="+ KeyWords +"&fieldOption="+ Type;
	}
	if(SearchType == 'Type')
	{
		LinkUrl="http://www.lousun.com/search.aspx?searchtype=1&ModelId=106&nodeId=54&Keyword="+ escape(KeyWords) +"&fieldOption="+ Type;
	}
	if(SearchType == 'PC')
	{
		LinkUrl="http://www.lousun.com/search.aspx?searchtype=1&ModelId=1&nodeId=34&Keyword="+ escape(KeyWords) +"&fieldOption="+ Type;
	}
	if(SearchType == 'Area')
	{
		LinkUrl="http://www.lousun.com/search.aspx?searchtype=1&ModelId=106&nodeId=54&Keyword="+ escape(KeyWords) +"&fieldOption="+ Type;
	}
	//alert(LinkUrl);
//	document.getElementById(Name).href=LinkUrl;
//	document.getElementById(Name).target="_blank";

	window.open(LinkUrl);
}


//首页右边
function ClickSearchThree(Areas,ComTypes,Prices,Name) 
{
	var nodeId = 54;
	var Url;
	var minPrice,maxPrice
	var Area = document.getElementById(Areas).value;
	var ComType = document.getElementById(ComTypes).value; 
	var Price = document.getElementById(Prices).value;
	if(Price ==0)
	{
		minPrice=0;
		maxPrice=0;
	}
	if(Price ==1)
	{
		minPrice=0;
		maxPrice=3000;
	}
	
	if(Price ==2)
	{
		minPrice=3000;
		maxPrice=4000;
	}
	if(Price ==3)
	{
		minPrice=4000;
		maxPrice=5000;
	}
	if(Price ==4)
	{
		minPrice=5000;
		maxPrice=6000;
	}
	if(Price ==5)
	{
		minPrice=6000;
		maxPrice=7000;
	}
	if(Price ==6)
	{
		minPrice=7000;
		maxPrice=8000;
	}
	if(Price ==7)
	{
		minPrice=8000;
		maxPrice=10000;
	}
	if(Price ==8)
	{
		minPrice=10000;
		maxPrice=100000;
	}
	switch(ComType)
	{
		case "小户型":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=54&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		case "高层":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=54&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		case "花园":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=54&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		case "普通":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=113&nodeId=62&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		case "独栋":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=113&nodeId=62&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		case "商铺":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=121&nodeId=77&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		case "写字楼":
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=122&nodeId=85&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
		default:
			Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=54&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice;
			window.open(Url);
			break;
	}
}


function ClickSearchTwo(Name) 
{
	var nodeId = 54;
	var Url;
	//var Developers = document.getElementById("Developers").value;
	var Prices = document.getElementById("Prices").value;
	var ComType = document.getElementById("ComType").value; 
	var Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=" + nodeId + "&pc=" + Prices + "&lx="+ escape(ComType);
	//alert(Url);
	document.getElementById(Name).href=Url;
	document.getElementById(Name).target="_blank";
}

//首页底部二手房搜索

function OnSampleSearch(MyKeyword,fieldOptionValue)
{
	window.location.href="/search.aspx?searchtype=1&ModelId=124&nodeId=91&Keyword=" + escape(MyKeyword) + "&fieldOption=" + fieldOptionValue + "";
}
//首页底部二手房搜索+类型

function OnSampleSearchWithType(MyKeyword,fieldOptionValue,HouseType)
{
	window.location.href="/search.aspx?searchtype=1&ModelId=124&nodeId=91&Keyword=" + escape(MyKeyword) + "&lx="+ escape(HouseType) +"&fieldOption=" + fieldOptionValue + "";
}


//新房搜索
function NewHouseSearch(Areas,ComTypes,Prices,Name,Titles) 
{
	var nodeId = 54;
	var Url;
	var minPrice,maxPrice
	var Area = document.getElementById(Areas).value;
	var ComType = document.getElementById(ComTypes).value; 
	var Price = document.getElementById(Prices).value;
	var Title = document.getElementById(Titles).value;
	if(Price ==0)
	{
		minPrice='';
		maxPrice='';
	}
	if(Price ==1)
	{
		minPrice=0;
		maxPrice=3000;
	}
	
	if(Price ==2)
	{
		minPrice=3000;
		maxPrice=4000;
	}
	if(Price ==3)
	{
		minPrice=4000;
		maxPrice=5000;
	}
	if(Price ==4)
	{
		minPrice=5000;
		maxPrice=6000;
	}
	if(Price ==5)
	{
		minPrice=6000;
		maxPrice=7000;
	}
	if(Price ==6)
	{
		minPrice=7000;
		maxPrice=8000;
	}
	if(Price ==7)
	{
		minPrice=8000;
		maxPrice=10000;
	}
	if(Price ==8)
	{
		minPrice=10000;
		maxPrice=100000;
	}
	var Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=" + nodeId + "&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice+"&title="+ escape(Title);
	//alert(Url);
	//document.getElementById(Name).href=Url;
	//document.getElementById(Name).target="_blank";
	window.open(Url);
}

//别墅首页搜索
function VillaSearch(Areas,ComTypes,Prices,Name,Titles) 
{
	var nodeId = 62;
	var Url;
	var minPrice,maxPrice
	var Area = document.getElementById(Areas).value;
	var ComType = document.getElementById(ComTypes).value; 
	var Price = document.getElementById(Prices).value;
	var Title = document.getElementById(Titles).value;
	if(Price ==0)
	{
		minPrice='';
		maxPrice='';
	}
	if(Price ==1)
	{
		minPrice=0;
		maxPrice=5000;
	}
	
	if(Price ==2)
	{
		minPrice=5000;
		maxPrice=8000;
	}
	if(Price ==3)
	{
		minPrice=8000;
		maxPrice=10000;
	}
	if(Price ==4)
	{
		minPrice=10000;
		maxPrice=20000;
	}
	if(Price ==5)
	{
		minPrice=20000;
		maxPrice=10000;
	}
	var Url= "/search.aspx?searchtype=2&showtype=1&ModelId=113&nodeId=" + nodeId + "&dq=" + escape(Area) + "&lx=" + escape(ComType) + "&minPrice="+ minPrice +"&maxPrice="+ maxPrice+"&title="+ escape(Title);
	//alert(Url);
	//document.getElementById(Name).href=Url;
	//document.getElementById(Name).target="_blank";
	window.open(Url);
}

//站内搜索按区域
function HeadSearchOnType(Names,MyKeywords,fieldOptionValues)
{
	var MyKeyword,fieldOptionValue
	var Url
	MyKeyword=document.getElementById(MyKeywords).value;
	//fieldOptionValue=document.getElementById(fieldOptionValues).value;
	Url="/search.aspx?searchtype=1&ModelId=106&nodeId=54&Keyword=" + escape(MyKeyword) + "&fieldOption=" + fieldOptionValues + "";
	//document.getElementById(Names).href=Url;
//	document.getElementById(Names).target="_blank";
	window.open(Url);
}
function HeadSearchOnTypeAuto(Names,MyKeywords,fieldOptionValues)
{
	var MyKeyword,fieldOptionValue
	var Url
	//MyKeyword=document.getElementById(MyKeywords).value;
	//fieldOptionValue=document.getElementById(fieldOptionValues).value;
	Url="../search.aspx?searchtype=1&ModelId=106&nodeId=54&Keyword=" + escape(MyKeywords) + "&fieldOption=" + fieldOptionValues + "";
	document.getElementById(Names).href=Url;
	document.getElementById(Names).target="_blank";
}

//站内搜索按区域
function HeadSearchOnPrice(Names,MyKeyword,fieldOptionValue)
{
	var Url
	Url="../search.aspx?searchtype=1&ModelId=106&nodeId=54&Keyword=" + escape(MyKeyword) + "&fieldOption=" + fieldOptionValue + "";
	document.getElementById(Names).href=Url;
	document.getElementById(Names).target="_blank";
}


//站内搜索新房
function InSiteSearch(Titles) 
{
	var nodeId = 54;
	var Url;
	var Title = document.getElementById(Titles).value;
	var Url= "/search.aspx?searchtype=2&showtype=1&ModelId=106&nodeId=" + nodeId + "&title="+ escape(Title);
	window.open(Url);
}
