// JavaScript Document
function tab (mod,cursor,n){
	for(i=1;i<=n;i++){
		var nav=document.getElementById(mod+i);
		var cont=document.getElementById(mod+"_"+"cont"+i);
		nav.className=(i==cursor)?"current":"";
		cont.style.display=(i==cursor)?"block":"none";
	}
}
function tabSearch (mod,cursor,n){
	for(i=1;i<=n;i++){
		var nav=document.getElementById(mod+i);
		nav.className=(i==cursor)?"current":"";
	}
		if(cursor<=4){
			document.getElementById(mod+"_"+"cont1").style.display="block";
			document.getElementById(mod+"_"+"cont2").style.display="none";
		}
	    else{
			document.getElementById(mod+"_"+"cont1").style.display="none";
			document.getElementById(mod+"_"+"cont2").style.display="block";
		}

}
function Search() {
	 var intention = document.getElementById("dropIntention").value;
	 var province = document.getElementById("province").value;
	 var city = document.getElementById("city").value;
	 var county = document.getElementById("county").value;
	 var area=document.getElementById("dropRentalArea").value;
     var typeid=document.getElementById("dropSupplyType").value;
	 var day=document.getElementById("dropDate").value;
	 var key=document.getElementById("keyword").value;
	 if(key=='输入搜索关键字')key='';
	var	url="/search.aspx?province="+province+"&city="+city+"&county="+county+"&intention="+intention+"&typeid="+typeid+"&area="+area+"&day="+day+"&key="+escape(key)+"";
	document.location.href=url;
	return true;
}
function Search_estate() {
	 var intention = document.getElementById("dropIntention").value;
	 var province = document.getElementById("province").value;
	 var city = document.getElementById("city").value;
	 var county = document.getElementById("county").value;
	 var area=document.getElementById("dropRentalArea").value;
     var typeid=document.getElementById("dropSupplyType").value;
	 var code=document.getElementById("txtCodeID").value;
	 var day=document.getElementById("dropDate").value;
	 var key=document.getElementById("keyword").value;
	 if(key=='输入搜索关键字')key='';
	var	url="/search.aspx?province="+province+"&city="+city+"&county="+county+"&intention="+intention+"&code="+code+"&typeid="+typeid+"&area="+area+"&day="+day+"&key="+escape(key)+"";
	document.location.href=url;
	return true;
}

function Search_news() {
	var t=document.getElementById("dropSupplyType").value;
	var key=document.getElementById("skeyword").value;
	if(key == "" || key == "输入搜索关键字")
    {
        alert("输入搜索关键字！");
        document.getElementById("skeyword").focus();
    }else
	{
		var	url="/search_news.aspx?key="+escape(key)+"&t="+t+"";
		if(document.getElementById("typeid").value=="6")
		{
			url="/ParkUnit.aspx?province=&city=&county=&key="+escape(key);		
		}
		document.location.href=url;
		return true;
	}
}
function UnitSearch() {
	var province = document.getElementById("province").value;
	var city = document.getElementById("city").value;
	var county = document.getElementById("county").value;
	var key=document.getElementById("keyword").value;
    if(key=='输入搜索关键字')key='';
	var	url="/ParkUnit.aspx?province="+province+"&city="+city+"&county="+county+"&key="+escape(key)+"";
	document.location.href=url;
	return true;
}

function So_Search() {
	 var intention = document.getElementById("top1_dropIntention").value;
	 var province = document.getElementById("province").value;
	 var city = document.getElementById("city").value;
	 var county = document.getElementById("county").value;
	 var area=document.getElementById("dropRentalArea").value;
     var typeid=document.getElementById("dropSupplyType").value;
	 var day=document.getElementById("dropDate").value;
	 var key=document.getElementById("keyword").value;
	 if(key=='输入搜索关键字')key='';
	var	url="../search.aspx?province="+province+"&city="+city+"&county="+county+"&intention="+intention+"&typeid="+typeid+"&area="+area+"&day="+day+"&key="+escape(key)+"";
	document.location.href=url;
	return true;
}

/*--登录--*/
	function CheckLoginForm()
    {
		var msg="";
		if($("#txtuid").val()==""){_window.Alert("请输入你的用户名！","提示");return false;}
		if($("#txtpwd").val()==""){_window.Alert("请输入你的密码！","提示");return false;}
		if($("#txtValidateCode").val()==""){_window.Alert("请输入验证码！","提示");return false;}
		 var solen_low_window=_window.Open("<div style='text-align:center;font-size:14px;'><img src=\"images/loading.gif\" />正在登录中，请稍候！</div>","正在登录中...","height=80","");

		 setTimeout(function(){
		 var win = _window.Alert("登录超时，请重新尝试登录！","提示");
		 win.OnOK=function(){
		 window.location.href="?"; 
		 };
		 },30*1000);

		 $.ajax({
		   type: "POST",
		   url: "ashx/UserLogin.ashx",
		   data: "uid="+escape($("#txtuid").val())+"&pwd="+escape($("#txtpwd").val())+"&vc="+escape($("#txtValidateCode").val()),
		   success: function(date){
			 if(date>0)
			 { 
				 window.location.href="?";
				 // window.location.href="member.aspx";
				  return true;
			 } 
			 else if(date==0)
			 {
				 var win = _window.Alert("你的帐号正在审核中...！","提示");
				 win.OnOK=function(){
				 window.location.href="?"; 
				 }
			 }
			 else if(date==-2)
			 {
				 solen_low_window.Close();
				 var win = _window.Alert("你的帐号已给管理员锁定,请和网站客服联系！","提示");
			 }
			 else if(date==-3)
			 {
				 solen_low_window.Close();
				 document.getElementById('top1_ValidateCode').click();
				 var win = _window.Alert("验证码错误！","提示");
			 }else
			 {
				 solen_low_window.Close();
				 var win = _window.Alert("用户名或密码错误！","提示");
			 }
		   }
		});
	}

/*--登录--*/
	function CheckLogin_Form()
    {
		var msg="";
		if($("#txtuid1").val()==""){_window.Alert("请输入你的用户名！","提示");return false;}
		if($("#txtpwd1").val()==""){_window.Alert("请输入你的密码！","提示");return false;}
		if($("#txtValidateCode1").val()==""){_window.Alert("请输入验证码！","提示");return false;}
		 var solen_low_window=_window.Open("<div style='text-align:center;font-size:14px;'><img src=\"images/loading.gif\" />正在登录中，请稍候！</div>","正在登录中...","height=80","");

		 setTimeout(function(){
		 var win = _window.Alert("登录超时，请重新尝试登录！","提示");
		 win.OnOK=function(){
		 window.location.href="?"; 
		 };
		 },30*1000);

		 $.ajax({
		   type: "POST",
		   url: "ashx/UserLogin.ashx",
		   data: "uid="+escape($("#txtuid1").val())+"&pwd="+escape($("#txtpwd1").val())+"&vc="+escape($("#txtValidateCode1").val()),
		   success: function(date){
			 if(date>0)
			 { 
				 window.location.href="?";
				 // window.location.href="member.aspx";
				  return true;
			 } 
			 else if(date==0)
			 {
				 var win = _window.Alert("你的帐号正在审核中...！","提示");
				 win.OnOK=function(){
				 window.location.href="?"; 
				 }
			 }
			 else if(date==-2)
			 {
				 solen_low_window.Close();
				 var win = _window.Alert("你的帐号已给管理员锁定,请和网站客服联系！","提示");
			 }
			 else if(date==-3)
			 {
				 solen_low_window.Close();
				 document.getElementById('txtValidateCode1').click();
				 var win = _window.Alert("验证码错误！","提示");
			 }else
			 {
				 solen_low_window.Close();
				 var win = _window.Alert("用户名或密码错误！","提示");
			 }
		   }
		});
	}
/*--省份登录--*/
	function CheckProvinceLoginForm()
    {
		var msg="";
		if($("#txtuid").val()==""){_window.Alert("请输入你的用户名！","提示");return false;}
		if($("#txtpwd").val()==""){_window.Alert("请输入你的密码！","提示");return false;}
		if($("#txtValidateCode").val()==""){_window.Alert("请输入验证码！","提示");return false;}
		 var solen_low_window=_window.Open("<div style='text-align:center;font-size:14px;'><img src=\"../images/loading.gif\" />正在登录中，请稍候！</div>","正在登录中...","height=80","");

		 setTimeout(function(){
		 var win = _window.Alert("登录超时，请重新尝试登录！","提示");
		 win.OnOK=function(){
		 window.location.href="?"; 
		 };
		 },30*1000);

		 $.ajax({
		   type: "POST",
		   url: "../ashx/UserLogin.ashx",
		   data: "uid="+escape($("#txtuid").val())+"&pwd="+escape($("#txtpwd").val())+"&vc="+escape($("#txtValidateCode").val()),
		   success: function(date){
			 if(date>0)
			 { 
				 window.location.href=document.referrer;
				 // window.location.href="member.aspx";
				  return true;
			 } 
			 else if(date==0)
			 {
				 var win = _window.Alert("你的帐号正在审核中...！","提示");
				 win.OnOK=function(){
				 window.location.href=document.referrer; 
				 }
			 }
			 else if(date==-2)
			 {
				 solen_low_window.Close();
				 var win = _window.Alert("你的帐号已给管理员锁定,请和网站客服联系！","提示");
			 }
			 else if(date==-3)
			 {
				 solen_low_window.Close();
				 document.getElementById('ValidateCode').click();
				 var win = _window.Alert("验证码错误！","提示");
			 }else
			 {
				 solen_low_window.Close();
				 var win = _window.Alert("用户名或密码错误！","提示");
			 }
		   }
		});
	}
function doZoom(size){
	document.getElementById('content').style.fontSize=size+'px'
}

function SetHome(obj,url){
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(url);
	}catch(e){
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch(e){
				alert("抱歉，此操作被浏览器拒绝！\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");
			}
		}else{
			alert("抱歉，您所使用的浏览器无法完成此操作。\n\n您需要手动将 "+url+" 设置为首页。");
		}
	}
}
function AddFavorite(url,title){
    if (document.all){
		window.external.addFavorite(url,title);
	}else if (window.sidebar){
		window.sidebar.addPanel(title, url, "");
    }
}


function CloseWin(){
	var browserName=navigator.appName; 
	if (browserName=="Netscape") {
		window.open('','_parent','');
		window.close(); 
	} else if (
		browserName=="Microsoft Internet Explorer") {
		window.opener = "whocares"; window.close();
	}
}
//城市地图
var timeout;
function morecityon(id)
{
	clearTimeout(timeout)
	document.getElementById("Layer"+id).style.display="block";
}

function morecityout(id)
{
    if(id==2)
	   timeout=setTimeout('document.getElementById("Layer2").style.display="none"',1000);
	else
       timeout=setTimeout('document.getElementById("Layer1").style.display="none"',1000);
}
var WinBook="";
function book_box(title,id,fid,date){
   WinBook =_window.Open('[url]/book.aspx?fid='+fid+'&date='+date+'&id='+id,title,'width=620,height=320');
}
//标题/ID/查看者用户ID/积分/是否登录/是否以前查看过/是否自己发的项目/是否星级会员或VIP会员
function OpenContact(title,id,UserID,Points,isLogin,isOldShow,isSelfSend,isVIP,date){
	if(isLogin=='0'){
		//是否登录
		var winl = _window.Alert("请先<a href=\"/login.aspx?url="+escape(location.href)+"\"><font color=red>登录</font></a>/<a href=\"/register.aspx\"><font color=red>注册</font></a>再查看联系信息！","提示");
		 winl.OnOK=function(){
		    window.location.href='/login.aspx?url='+escape(location.href);
		 }
	}else{
		 var solen_low_window=_window.Open("<div style='text-align:center;font-size:14px;'><img src=\"/images/loading.gif\" />数据正在读取中，请稍候！</div>","正在读取中...","height=80","");
		 /*setTimeout(function(){
		 var winm = _window.Alert("数据读取超时，请重新点击查看！","提示");
		 win.OnOK=function(){
             solen_low_window.Close();
		     winm.Close(); 
		 };
		 },30*1000);
		 */

			$.ajax({
				  url: "/ashx/UserRecordUpdate.ashx",
				  type: "POST",
				  data: "id="+escape(id)+"&userid="+escape(UserID),
				  success: function(s){
						if(isSelfSend=='1' || s=="1"){
							//是否自己发的信息/是否已扣查看积分信息
							solen_low_window.Close();
						   OpenWin =_window.Open('[url]/info.aspx?fid='+UserID+'&id='+id,title,'width=620,height=320');
						}else{
							//是否星级会员或VIP会员
							if(isVIP=="0"){
								solen_low_window.Close();
								var winMsg = _window.Alert("这是星级会员和VIP会员服务,请和我们联系进行用户升级,咨询电话：020-85268663","提示");
							}else{
								//积份是否已用完
								if(Points=='1'){
									//是否有积分
									solen_low_window.Close();
									var win =_window.Confirm("查看联系信息将扣取1积分,确定？",'提示');
									 win.OnOK=function(){
										 win.Close();
										 OpenWin =_window.Open('[url]/info.aspx?fid='+UserID+'&id='+id,title,'width=620,height=320');
									 }
							   }else{
								   solen_low_window.Close();
									var wins = _window.Alert("你本月积分已用完,确要查看联系信息请和我们联系,咨询电话：020-85268663","提示");
							   }
						   }
						}
				  },
				  error:function(xhr){$("#em_"+typeid).html("Error:"+xhr.status);}
			   });
	}

}
