function check_login(){
var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
if(document.getElementById("city_user")&&document.getElementById("city_pwd")){
var _user=document.getElementById("city_user").value.replace(/ /g,"").replace(/　/g,"");var _pwd=document.getElementById("city_pwd").value.replace(/ /g,"").replace(/　/g,"");
if(_user==""||_user=="用户名/手机号/邮箱"){TINY.box.show("<div class=\"msgon\" style=\"background-position: 0px 4px;*background-position:0px 2px;\">请输入用户帐号！</div>",0,200,23,0,2);return false;}else if(_pwd==""){TINY.box.show("<div class=\"msgon\" style=\"background-position: 0px 4px;*background-position:0px 2px;\">请输入用户密码！</div>",0,200,23,0,2);return false;}
else ajax("post","/user/ajax.aspx?act=ajax&type=login&rd="+Math.random(),"u="+base64en(_user)+"&p="+base64en(_pwd),function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ok')window.location=url;else {TINY.box.show("<div class=\"msgon\" style=\"background-position: 0px 4px;*background-position:0px 2px;\">"+xmlHttp.responseText+"</div>",0,200,23,0,2);}}});
}}

function logout(){
if(confirm("确定退出登录吗？")){
var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
window.location="/user/logout.aspx?ReturnUrl="+base64en(url);
}
}

function logininputonkeyup(e){ 
if(location.href.toLowerCase().indexOf("/user/login.aspx")==-1||location.href.toLowerCase().indexOf("/user/login.htm")==-1){
if(document.getElementById("city_user"))SetCookie('CK_city_user',document.getElementById("city_user").value,365);
var theEvent=window.event||e;var keyNum=theEvent.keyCode||theEvent.which;
if(keyNum==13)document.getElementById("head_login_btn").click();
}
}

function show_search_type(){
if(document.getElementById("search_type")){
var obj=document.getElementById("search_type");if(obj.style.display=="none")obj.style.display="";else obj.style.display="none";
}}

function set_search_type(value,text){
if(document.getElementById("search_type_value")&&document.getElementById("search_type_text")){
if(text=="不限")text="所有类型";else{if(text.indexOf("<")!=-1) text=text.substring(0,text.indexOf("<")).replace(/(^\s*)/g,"");}
document.getElementById("search_type_value").value=value;document.getElementById("search_type_text").value="搜索"+text;show_search_type();
}}


function dosearch(channeltype,k)
{
var url="";if(k=="请输入关键字")k="";
if(channeltype=="life")
{
if(location.href.indexOf("/life/list.aspx?")!=-1||location.href.indexOf("/life/list.htm?")!=-1){if(location.href.indexOf("k=")!=-1){var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=location.href.replace("k="+p2,"k="+escape(k));}else url=location.href+"&k="+escape(k);}
else url="/life/list.htm?classid=0&k="+escape(k);
}
else if(channeltype=="rent")
{
if(location.href.indexOf("/house/rent_list.aspx?")!=-1||location.href.indexOf("/house/rent_list.htm?")!=-1){if(location.href.indexOf("k=")!=-1){var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=location.href.replace("k="+p2,"k="+escape(k));}else url=location.href+"&k="+escape(k);}
else url="/house/rent_list.htm?k="+escape(k);
}
else if(channeltype=="sell")
{
if(location.href.indexOf("/house/sell_list.aspx?")!=-1||location.href.indexOf("/house/sell_list.htm?")!=-1){if(location.href.indexOf("k=")!=-1){var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=location.href.replace("k="+p2,"k="+escape(k));}else url=location.href+"&k="+escape(k);}
else url="/house/sell_list.htm?k="+escape(k);
}
else if(channeltype=="job")
{
if(location.href.indexOf("/job/list.aspx?")!=-1||location.href.indexOf("/job/list.htm?")!=-1){if(location.href.indexOf("k=")!=-1){var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=location.href.replace("k="+p2,"k="+escape(k));}else url=location.href+"&k="+escape(k);}
else url="/job/list.htm?classid=0&k="+escape(k);
}
else if(channeltype=="company")url="/company/list.htm?classid=0&k="+escape(k);
else if(channeltype=="news")url="/news/list.htm?classid=0&k="+escape(k);
else if(channeltype=="bbs")url="/bbs/bbs_more.htm?k="+escape(k);
else {top.location="/search.htm?k="+escape(k);}
if(url!="")top.location=url;
}

function search_count(channeltype)
{
if(document.getElementById('search_count_'+channeltype).innerHTML==""||document.getElementById('search_count_'+channeltype).innerHTML=="Loading..."){
if(document.getElementById("search_type").innerHTML.split("Loading...").length==1){
document.getElementById('search_count_'+channeltype).innerHTML="Loading...";
var where="";if(channeltype=="life")where="select count(*) from life";
else if(channeltype=="rent")where="select count(*) from houserent";
else if(channeltype=="sell")where="select count(*) from housesell";
else if(channeltype=="job")where="select count(*) from job";
else if(channeltype=="company")where="select count(*) from m_company";
else if(channeltype=="news")where="select count(*) from info";
else if(channeltype=="bbs")where="select count(*) from bbs";
ajax("get","/user/ajax.aspx?act=ajax&type=search_count&channeltype="+channeltype+"&where="+base64en(where)+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){if(!isNaN(xmlHttp.responseText))document.getElementById('search_count_'+channeltype).innerHTML='('+xmlHttp.responseText+'条)';}});
}}}

function searchinputonkeyup(e){ 
if(document.getElementById("k").value!=""){
var theEvent=window.event||e;var keyNum=theEvent.keyCode||theEvent.which;
if(keyNum==13)document.getElementById("search_btn").click();
}
}


function life_search(value1,value2){
var url=location.href;if(value1=="根据信息标题搜索")value1="";if(value2=="根据信息内容搜索")value2="";if(value1=="根据企业名称搜索")value1="";if(value2=="根据企业简介搜索")value2="";
if(location.href.indexOf("k=")!=-1)
{
var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=url.replace("k="+p2,"k="+escape(value1));
}
else url+="&k="+escape(value1);
if(location.href.indexOf("k_content=")!=-1)
{
var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k_content"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=url.replace("k_content="+p2,"k_content="+escape(value2));
}
else url+="&k_content="+escape(value2);
window.location=url.replace(".aspx&",".aspx?").replace(".htm&",".htm?");
}

function job_search(value1,value2,typeclassid){
var url=location.href;if(value1=="根据信息标题搜索")value1="";if(value2=="根据信息内容搜索")value2="";
if(location.href.indexOf("k=")!=-1)
{
var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=url.replace("k="+p2,"k="+escape(value1));
}
else url+="&k="+escape(value1);
if(location.href.indexOf("k_content=")!=-1)
{
var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="k_content"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}url=url.replace("k_content="+p2,"k_content="+escape(value2));
}
else url+="&k_content="+escape(value2);

var arr1 = location.search.substr(1).split("&");var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="classid"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}
if(p2>2)window.location=url;
else window.location=url.replace(".aspx&",".aspx?").replace(".htm&",".htm?").replace("classid=0","classid="+typeclassid).replace("classid=1","classid="+typeclassid).replace("classid=2","classid="+typeclassid);
}

if(location.href.toLowerCase().indexOf("/user/")==-1)SetCookieS("CK_cssskinid_interval","true",1);
function switch_style(){
if(GetCookie("CK_cssskinid_interval")=="true")setTimeout(switch_style_do,1000);else switch_style_do();
}
function switch_style_do()
{var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
if(url.indexOf("?cssrd=")!=-1){var str1=url.substring(url.indexOf("?cssrd="));str1=str1.substring(0,str1.indexOf("cssrend")+7);url=url.replace(str1,"");}
else if(url.indexOf("&cssrd=")!=-1){var str1=url.substring(url.indexOf("&cssrd="));str1=str1.substring(0,str1.indexOf("cssrend")+7);url=url.replace(str1,"");}
if(url.indexOf("?")!=-1)url=url+"&cssrd="+Math.random()+"cssrend";else url=url+"?cssrd="+Math.random()+"cssrend";
ajax("get","/user/ajax.aspx?act=ajax&type=css&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ok')window.location=url;}});
}

function showregagreement(){
TINY.box.show("regagreement.aspx?rd="+Math.random(),1,600,450,1,0);
}

function findpwd(){
TINY.box.show("findpwd.aspx?u="+base64en(document.getElementById('city_user_').value)+"&ReturnUrl="+base64en(location.href)+"&rd="+Math.random(),1,470,70,1,0);
}

function check_email_for_findpwd(){
var self_email=document.getElementById("findpwd_email").value.replace(/＠/g,"@");
if(self_email==""||self_email=="请输入您的会员邮箱，密码将会发至邮箱！"){alert("请输入您的会员邮箱！");return false;}else if (!emailReg.test(self_email)){alert("请输入正确的邮箱！");return false;}
}


function show_pl_smiley(obj,pl_inp_init,T)
{
var str1="";if(T==null)T=18;
for(var i=1 ;i<T;i++){
str1+="<img style=\"cursor: pointer;margin-right: 5px\" onclick=\"do_pl_smiley(\'"+obj+"\',"+i+",'"+pl_inp_init+"')\" src=\"/s/tool/fck/editor/images/smiley/1/"+i+".gif\">";
}
document.write(str1);
}
function do_pl_smiley(obj1 ,value1,pl_inp_init)
{
if(pl_inp_init!=""){if(document.getElementById(obj1).value.indexOf(pl_inp_init)!=-1)document.getElementById(obj1).value=document.getElementById(obj1).value.replace(pl_inp_init,"");}
document.getElementById(obj1).value+="{s"+value1+"}";document.getElementById(obj1).focus();
}
function save_pl(uid,strTableName,obj1,obj2,id,pl_inp_init,authorid)
{
if(!isNaN(document.getElementById(obj2).value))alert("请稍候发表留言！");
else{
if(uid==""){alert("请登录后发表留言！");/*setInterval(intervalCheckLogin,1000);TINY.box.show("/user/minilogin.aspx?rd="+Math.random(),1,345,230,1,0);*/}
else{
var value1=document.getElementById(obj1).value;
if(value1!=""&&value1!=pl_inp_init){
if(GetLength(value1)>4){
if(GetLength(value1)<800){
document.getElementById(obj2).value="留言中...";document.getElementById(obj2).setAttribute("disabled","disabled");hover(document.getElementById(obj2),0.5);
var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
ajax("post","/user/ajax.aspx?act=ajax&type=savepl&rd="+Math.random(),"uid="+uid+"&authorid="+authorid+"&url="+base64en(url)+"&tablename="+strTableName+"&content="+base64en(value1.replace(/\r\n/g,"pl_content_enter"))+"&id="+id,function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ban'){alert('禁止发表不文明或反动言论！');document.getElementById(obj2).value='发表留言';document.getElementById(obj2).removeAttribute('disabled');hover(document.getElementById(obj2),1);}else if(xmlHttp.responseText=='same'){alert('不要重复发表一些无意义的留言！');document.getElementById(obj2).value='发表留言';document.getElementById(obj2).removeAttribute('disabled');hover(document.getElementById(obj2),1);}else if(xmlHttp.responseText=='safe'){alert('检测到提交的数据缺乏安全性，请不要输入与系统安全有冲突的字符！');document.getElementById(obj2).value='发表留言';document.getElementById(obj2).removeAttribute('disabled');hover(document.getElementById(obj2),1);}else if(xmlHttp.responseText=='ok'){SetCookieS("CK_pl"+id,id,15);window.location=url;}else alert('留言失败！');}});
}
else alert("您输入的留言内容太多了！");
}
else alert("请不要灌水！");
}}}}
function interval_pl(id,obj){
if(GetCookie("CK_pl"+id)!=null&&GetCookie("CK_pl"+id)!="")var interval_pl_setInterval=setInterval(interval_pl_,1000);
function interval_pl_()
{
if(document.getElementById("pl_but")){
if(document.getElementById("pl_but").value=="1"){clearInterval(interval_pl_setInterval);document.getElementById("pl_but").value="发表留言";}else{if(isNaN(document.getElementById("pl_but").value))document.getElementById("pl_but").value="15";else document.getElementById("pl_but").value=parseInt( document.getElementById("pl_but").value)-1;}
}
}
}

function show_minilogin(ifDZ){if(ifDZ=="1"){/*alert("请登录后发表留言！");return;*/}else{TINY.box.show("/user/minilogin.aspx?rd="+Math.random(),1,345,230,1,0);}}

function minilogin_login(){
var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
if(document.getElementById("minilogin_u")&&document.getElementById("minilogin_p")&&document.getElementById("minilogin_autologin")){
var _user=document.getElementById("minilogin_u").value.replace(/ /g,"").replace(/　/g,"");var _pwd=document.getElementById("minilogin_p").value.replace(/ /g,"").replace(/　/g,"");
if(_user==""||_user=="用户名/手机号/邮箱"){alert("请输入用户帐号！");return false;}else if(_pwd==""){alert("请输入用户密码！");return false;}
else ajax("post","/user/minilogin.aspx?act=ajax&rd="+Math.random(),"u="+base64en(_user)+"&p="+base64en(_pwd)+"&a="+document.getElementById("minilogin_autologin").checked,function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ok')window.location=url;else {alert(xmlHttp.responseText);}}});
}}

function hide_view_tip_box(){
document.getElementById("view_tip_box").style.display="none";
SetCookie("CK_view_tip_box","hide",1);
}

function show_pl_re(id)
{
var obj=document.getElementById("pl_re_"+id);
if(obj.style.display=="none")obj.style.display="";else obj.style.display="none";
}

function save_pl_re(uid,strTableName,id,obj)
{
if(GetCookie("CK_pl_re"+id)!=null&&GetCookie("CK_pl"+id)!="")alert("您的留言速度过快，请稍候回复！");
else{
if(uid=="")alert("请登录后发表回复！");
else{
var value1=document.getElementById("pl_re_content_"+id).value;
if(value1!=""){
if(GetLength(value1)>4){
if(GetLength(value1)<800){
var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
obj.setAttribute("disabled","disabled");obj.value="提交中";ajax("post","/user/ajax.aspx?act=ajax&type=savepl_re&rd="+Math.random(),"uid="+uid+"&url="+base64en(url)+"&tablename="+strTableName+"&content="+base64en(value1.replace(/\r\n/g,"pl_content_enter"))+"&id="+id,function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ban'){alert('禁止发表不文明或反动言论！');obj.removeAttribute('disabled');obj.value='发表回复';}else if(xmlHttp.responseText=='same'){alert('不要重复发表一些无意义的回复！');obj.removeAttribute('disabled');obj.value='发表回复';}else if(xmlHttp.responseText=='safe'){alert('检测到提交的数据缺乏安全性，请不要输入与系统安全有冲突的字符！');obj.removeAttribute('disabled');obj.value='发表回复';}else if(xmlHttp.responseText=='ok'){SetCookieS("CK_pl_re"+id,id,15);window.location=url;}else alert('回复失败！');}});
}
else alert("您输入的回复内容太多了！");
}
else alert("请不要灌水！");
}else alert("请输入回复内容！");
}}}

function del_pl_re(strTableName,id){
if(confirm("确定删除这条留言吗？")){
var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));
ajax("get","/user/ajax.aspx?act=ajax&type=delpl_re&id="+id+"&tablename="+strTableName+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ok'){if(confirm('删除成功，是否刷新本页！')){window.location=url;}}}});
}}

function list_item_more_content(tablename,id)
{
ajax("post","/user/ajax.aspx?act=ajax&type=list_item_more_content&rd="+Math.random(),"id="+id+"&tablename="+tablename,function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText.indexOf('list_item_more_content')!=-1){if(document.getElementById('list_item_more_img'+id)){document.getElementById('list_item_more_img'+id).style.display='none';}document.getElementById('list_item_more_content'+id).innerHTML=xmlHttp.responseText.replace('list_item_more_content','').replace('LIST_ITEM_MORE_CONTENT','');}}});
}

function sendmail(touid,fromuid)
{
if(touid==fromuid)alert("不能给自己发送站内信！");else{
if(fromuid==""){if(confirm("您还没有登录，是否现在登录！"))window.location="/user/login.htm?ReturnUrl="+base64en(location.href);}
else{
var furl="/user/mail_mini_send.aspx?touid="+touid+"&fromuid="+fromuid+"&url="+base64en(location.href)+"&rd="+Math.random();
TINY.box.show("<iframe allowtransparency=\"true\" width=\"400\" height=\"250\" frameborder=\"0\" scrolling=\"no\" src=\""+furl+"\"></iframe>",0,400,250,1,0);
}
}}

function intervalCheckLogin(){var url=location.href;if(url.indexOf("#")!=-1)url=url.substring(0,url.lastIndexOf("#"));if(url.indexOf("/user/login.aspx?ReturnUrl=")!=-1||url.indexOf("/user/reg.aspx?ReturnUrl=")!=-1||url.indexOf("/user/login.htm?ReturnUrl=")!=-1||url.indexOf("/user/reg.htm?ReturnUrl=")!=-1){var str1=(base64de(url.substring(url.indexOf("?ReturnUrl=")+11)));if(str1!=""){url=str1;}}ajax("get","/user/ajax.aspx?type=interval_check_login&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){if(xmlHttp.responseText=='ok')window.location=url;}});}