﻿function $_D(id) {
	return document.getElementById(id);
}
 

$(document).ready(function(){
	//backTop('gotopbtn');
	$(window).resize(function() 
	{
		/*var $window=$(window)
		var controlx= 950 + ($window.width() -950)/2 +5;
		$("#gotopbtn").css({left:controlx+'px'});
		*/
	});
	$("#AntInfoNavLink_Help").hover(function(){
		$("#AntInfo-menu_Help").show();
		$("#AntInfoNavLink_Helpa").removeClass();
		$("#AntInfoNavLink_Helpa").addClass('AntInfoHelpCurrent');
	},function(){
		$("#AntInfo-menu_Help").hide();
		$("#AntInfoNavLink_Helpa").removeClass();
		$("#AntInfoNavLink_Helpa").addClass('A');
	});
	$("#AntInfoNavLink_Company").hover(function(){
		$("#AntInfo-menu_Company").show();
		$("#AntInfoNavLink_Companya").removeClass();
		$("#AntInfoNavLink_Companya").addClass('AntInfoHelpCurrent');
	},function(){
		$("#AntInfo-menu_Company").hide();
		$("#AntInfoNavLink_Companya").removeClass();
		$("#AntInfoNavLink_Companya").addClass('A');
	});
	$("#AntInfoNavLink_daohang").hover(function(){
		$("#AntInfo-menu_daohang").show();
		$("#AntInfoNavLink_daohanga").removeClass();
		$("#AntInfoNavLink_daohanga").addClass('AntInfoHelpCurrent');
	},function(){
		$("#AntInfo-menu_daohang").hide();
		$("#AntInfoNavLink_daohanga").removeClass();
		$("#AntInfoNavLink_daohanga").addClass('A');
	});
	$("#DialogYouke1").click(function(){
		window.parent.closeopendiv();
	});
	
	$("#ShopTable").find("h2 a").each(function(){
		$(this).mouseover(function(){
			var obj=$(this);
			$("#ShopTable").find("h2 a").each(function(){
				if( $(this).parent().attr("rel")!=obj.parent().attr("rel") )
				{
					$(this).parent().removeClass("Current");
					$("#ShopFloating"+$(this).parent().attr("rel")).hide();
				}
				else
				{
					obj.parent().addClass("Current");
					$("#ShopFloating"+obj.parent().attr("rel")).show();	
				}
			});
			
		});
	});


$("#HouseTab").find("li a").each(function(){
		$(this).mouseover(function(){
			var obj=$(this);
			$("#HouseMoreButton").html("更多"+$(this).html());
			$("#HouseMoreButton").attr("href",$(this).attr("href"));
			$("#HouseTab").find("li a").each(function(){
				if( $(this).parent().attr("rel")!=obj.parent().attr("rel") )
				{
					$(this).parent().removeClass("c");
					$("#HouseFloating"+$(this).parent().attr("rel")).hide();
				}
				else
				{
					obj.parent().addClass("c");
					$("#HouseFloating"+obj.parent().attr("rel")).show();	
				}
			});
			
		});
	});

	$("#BuildTab").find("li").each(function(){
		$(this).mouseover(function(){
			var obj=$(this);
			$("#BuildTab").find("li").each(function(){
				if( $(this).attr("rel")!=obj.attr("rel") )
				{
					$(this).removeClass("c");
					$("#BuildFloating"+$(this).attr("rel")).hide();
				}
				else
				{
					obj.addClass("c");
					$("#BuildFloating"+obj.attr("rel")).show();	
				}
			});
			
		});
	});

	$("#HomeSearchKeyword").focus(function(){
		if($.trim(this.value) == "请输入关键词...")
			this.value = "";
	}).blur(function(){
		if($.trim(this.value) == "")
			this.value = "请输入关键词...";												  
	});
	$("#Home3SearchKeyword").focus(function(){
		if($.trim(this.value) == "输入您要搜索的信息及关键词！")
			this.value = "";
	}).blur(function(){
		if($.trim(this.value) == "")
			this.value = "输入您要搜索的信息及关键词！";												  
	});
	if($(".AntSearch").length>0)
	{
		$(".Search").find("a").each(function(){
			var obj=$(this);
			obj.click(function(){
				var aa=obj.attr("rel");
				$(".Search").find("a").each(function(){
					$(this).removeClass("Current_"+$(this).attr("rel").split(',')[0] );							 
				});
				obj.addClass("Current_"+aa.split(',')[0]);
				$("#HiddenUrl").val( aa.split(',')[1] );
				$("#HomeSearchKeyword").attr("rel",obj.html());
			});
		});
	}
	if($("#Ant3Search").length>0)
	{
		$("#Ant3Search").find("a").each(function(){
			var obj=$(this);
			obj.click(function(){
				var aa=obj.attr("rel");
				$("#Ant3Search").find("a").each(function(){
					$(this).parent().removeClass("cu");							 
				});
				obj.parent().addClass("cu");
				$("#Hidden3Url").val( aa.split(',')[1] );
				$("#Home3SearchKeyword").attr("rel",obj.html());
			});
		});
	}
	if($("#Home3SearchSubmit").length>0)
	{
		$("#Home3SearchSubmit").click(function(){
			var keyword=$.trim($("#Home3SearchKeyword").val());
			var url=$("#Hidden3Url").val();	
			if(keyword.length==0 || keyword=="请输入要搜索的关键词...")
			{
				alert("请输入要搜索的关键词...");
				$("#Home3SearchKeyword").focus();
				return false;
			}
			var type=$("#Home3SearchKeyword").attr("rel");
			var aa=$("#Home3hiddenvalue").val();
			var bb=aa.split(",");
			if(type=="分类信息")
			{
				if(bb[0]=="0")
					url= url + encodeURIComponent("live/search.aspx?keyword="+keyword+bb[1]);
				else
					url=url + "live/search.aspx?keyword="+escape(keyword);
			}
			else if(type=="房产")
			{
				if(bb[0]=="0")
					url= url + encodeURIComponent("Sale-0-0-0-0-0-0-0-0-0-"+keyword+"-p0"+bb[1]);
				else
					url=url +"house/loupan.html?keyword="+escape(keyword);
			}
			else if(type=="商家")
			{
				if(bb[0]=="0")
					url= url + encodeURIComponent("company/index.html?a="+keyword+"S-p0"+bb[1]);
				else
					url=url +"company/index.html?a="+escape(keyword);
			}
			else if(type=="招聘")
			{
				if(bb[0]=="0")
					url= url + encodeURIComponent("SearchJob-0-0-0-0-0-0-A"+keyword+"A-p0"+bb[1]);
				else
					url=url +"SearchJob.aspx?Keyword="+escape(keyword);
			}
			else if(type=="资讯")
			{
				if(bb[0]=="0")
					url= url + encodeURIComponent("article/list.aspx?action=s&a="+keyword+"&key="+bb[1]);
				else
					url=url +"article/list.aspx?action=s&a="+escape(keyword)+"&key=";
			}
			window.open(url,"_blank");
			return false;
		});
			
	}



});
