function INDEX1_k_focus(){
var k=document.getElementById("k");
k.className="theinp1";
if(k.value=="请输入关键字"){k.value="";}
}
function INDEX1_k_blur(){
var k=document.getElementById("k");
if(k.value==""){k.className="theinp2";k.value="请输入关键字";}

if(k.value==""||k.value=="请输入关键字")document.getElementById("baidu").href="http://www.baidu.com";else document.getElementById("baidu").href="http://www.baidu.com/s?wd="+encodeURI(k.value)+"&ie=utf-8";
}

/*
function INDEX1_toQzoneLogin_(){window.location="/user/logintoqq.aspx";}
*/

function INDEX1_selsearch(obj,value){
var parent=obj.parentNode;
var arr1=parent.getElementsByTagName("span"); 
for(var i=0;i<arr1.length;i++)
{arr1[i].className="";}
obj.className="on";
document.getElementById("search_type_value").value=value;
}


function INDEX1_selsearch_init(){
var url=location.href.toLowerCase();
var arr1=document.getElementById("index1_head_search").getElementsByTagName("span"); 
if(url.indexOf("/life/")!=-1)INDEX1_selsearch(arr1[0],"life");
else if(url.indexOf("/job/")!=-1)INDEX1_selsearch(arr1[1],"job");
else if(url.indexOf("/house/rent_list.aspx")!=-1||url.indexOf("/houserent/")!=-1)INDEX1_selsearch(arr1[2],"rent");
else if(url.indexOf("/house/sell_list.aspx")!=-1||url.indexOf("/housesell/")!=-1)INDEX1_selsearch(arr1[3],"sell");
else if(url.indexOf("/news/")!=-1)INDEX1_selsearch(arr1[4],"news");
else if(url.indexOf("/bbs/")!=-1)INDEX1_selsearch(arr1[5],"bbs");
else if(url.indexOf("/company/")!=-1)INDEX1_selsearch(arr1[6],"company");
}


function INDEX1_dosearch(channeltype,k)
{
var url="";if(k=="请输入关键字")k="";if(k=="")return false;
if(channeltype=="life")
{
if(location.href.indexOf("/life/list.aspx?")!=-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.aspx?classid=0&k="+escape(k);
}
else if(channeltype=="rent")
{
if(location.href.indexOf("/house/rent_list.aspx?")!=-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.aspx?k="+escape(k);
}
else if(channeltype=="sell")
{
if(location.href.indexOf("/house/sell_list.aspx?")!=-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.aspx?k="+escape(k);
}
else if(channeltype=="job")
{
if(location.href.indexOf("/job/list.aspx?")!=-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.aspx?classid=0&k="+escape(k);
}
else if(channeltype=="company")url="/company/list.aspx?classid=0&k="+escape(k);
else if(channeltype=="news")url="/news/list.aspx?classid=0&k="+escape(k);
else if(channeltype=="bbs")url="/bbs/bbs_more.aspx?k="+escape(k);
else {top.location="/search.aspx?k="+escape(k);}
if(url!="")top.location=url;
}


function INDEX1_k_keydown(e)
{
var theEvent=window.event||e;var keyNum=theEvent.keyCode||theEvent.which;
if(keyNum==13)INDEX1_dosearch(document.getElementById('search_type_value').value,document.getElementById('k').value);
}


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 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;}});}