var a=$.cookie("pp.login.name");function rtim(b){return b.replace(/\s/g,"")}function clean(b){b.style.backgroundColor="#FFFFCC";if(rtim(b.value)=="邮箱/手机号码"){b.value=""}}function recover(b){b.style.backgroundColor="";if(rtim(b.value)==""&&a==null){b.value="邮箱/手机号码"}if(rtim(b.value)==""&&a!=null&&a!=""){$("#paccount").val(a)}}function p_clean(b){b.style.backgroundColor="#FFFFCC"}function p_recover(b){b.style.backgroundColor=""}function checkEnter(c,b){if($.trim($("#paccount").val())==""&&c.keyCode==13){$("#tip_content").html("<font color=red>帐号不能为空！</font>");$("#paccount").focus();showTip(document.getElementById("paccount"));$("#tips").css("width","130px");return false}else{if($.trim($("#ppassword").val())==""&&c.keyCode==13){$("#tip_content").html("<font color=red>密码不能为空！</font>");$("#ppassword").focus();showTip(document.getElementById("ppassword"));$("#tips").css("width","130px");return false}else{if(c.keyCode!=13&&$.trim(b.value)!=""){$("#tips").hide()}else{if($.trim($("#ppassword").val())!=""&&c.keyCode==13&&$.trim($("#paccount").val())!=""){login()}}}}}function login(){if($.trim($("#paccount").val())==""||rtim($("#paccount").val())=="邮箱/手机号码"){$("#tip_content").html("<font color=red>帐号不能为空！</font>");$("#paccount").focus();$("#tips").css("width","130px");showTip(document.getElementById("paccount"));return false}else{if($.trim($("#ppassword").val())==""){$("#tip_content").html("<font color=red>密码不能为空！</font>");$("#ppassword").focus();$("#tips").css("width","130px");showTip(document.getElementById("ppassword"));return false}}$("#tip_content").html("正在处理中......");showTip(document.getElementById("ppassword"),true);$("#tips").css("width","130px");var b="method=login&caccount="+$.trim($("#paccount").val())+"&cpassword="+$.trim($("#ppassword").val())+"&now="+new Date().getTime();if(document.getElementById("prememberMe").checked){b+="&rememberMe=1"}$.ajax({type:"post",contentType:"application/x-www-form-urlencoded",url:"/loginOrOut",data:b,success:function(f){if(f!="-1"){$.cookie("pp.login.name",$("#paccount").val(),{expires:7,path:"/",domain:"xiangrikui.com"});var d=f.split(",");var c=document.location.href;var e=d[1].split(":")[1];if(e=="1"&&c.indexOf("www")>-1){document.location.href="http://quick.xiangrikui.com/"}else{document.location.reload()}return false}else{$("#tip_content").html("<font color=red>登录失败（用户名或密码错误）！</font>");$("#tips").css("width","230px");showTip(document.getElementById("ppassword"))}},error:function(c){$("#tip_content").html("<font color=red>服务忙，请稍候登录！</font>");showTip(document.getElementById("ppassword"));$("#tips").css("width","230px")}});return false}function doLogout(){$.ajax({type:"POST",url:"/loginOrOut",data:"method=logout&now="+new Date().getTime(),success:function(b){document.location.reload()},error:function(b){}});return false}function showTip(c,b){$("#tips").css("top",30+($(c).offset().top?$(c).offset().top:0));$("#tips").css("left",70+($(c).offset().left?$(c).offset().left:0)-$(c).width());if(b){$("#tips").css("background","url(http://static.xiangrikui.com/sso/images/reg_dd_ok.gif) no-repeat #EEFFD0");$("#tips").css("color","#339933");$("#tips").css("border","1px #339933 solid")}else{$("#tips").css("background","url(http://static.xiangrikui.com/sso/images/reg_dd_error.gif) no-repeat #FFFFCC");$("#tips").css("color","#FF0000");$("#tips").css("border","1px #FF0000 solid")}$("#tips").css({zIndex:1005,position:"absolute"});$("#tips").hide();$("#tips").fadeIn("normal")}function closePTip(){$("#tips").fadeOut("normal")}function showHeadLoginBar(b,f,d,e){var c="";if(b){c='<div class="phone">全国服务热线：<span class="a12_orange"><b>400-669-8808</b></span></div> <div class="biaodan"><div class="left"><div style="padding:5px 15px 0 8px;"> 欢迎您：'+f+"　&nbsp;"+(b=="2"?'<span  id="ummd" style="display: none;margin-top: 2px" ><img src="http://static.xiangrikui.com/quick/images/sm.gif"/><a target="_blank" href="http://i.xiangrikui.com/admin/personInfo/loadMessage.do?type=1">您有<span  id="USMGCONUT"></span>个消息</a></span>　'+(e=="wenba"?'<a href="/ask/myAskList.do?user.id='+d+'&isReply=false">我的提问</a>':"")+'  <a href="http://i.xiangrikui.com/admin" target="_blank">进入个人空间</a> ':"")+(b=="1"?'<span  id="ummd" style="display: none;margin-top: 2px" ><img src="http://static.xiangrikui.com/quick/images/sm.gif"/><a target="_blank" href="http://quick.xiangrikui.com/umsg/queryReceive.do">您有<span  id="USMGCONUT"></span>个消息</a></span> '+(e=="wenba"?'<a href="/ask/myAskList.do?user.id='+d+'&isReply=true">我的回答</a>':"")+'  <a href="http://quick.xiangrikui.com/sns/home.do" target="_blank">进入葵园</a> ':"")+'<a isA="void" href="#this" onclick="doLogout();">退出</a></div></div></div>'}else{c='<div class="phone">全国服务热线：<span class="a12_orange"><b>400-669-8808</b></span></div> <a href="http://sso.xiangrikui.com/user/initRetPasWod.do" target="_blank"><div class="b_password">忘记密码</div></a> <a href="http://sso.xiangrikui.com/loginreg/showAgRegPage.do?reg=1&source='+document.location.href+'" target="_blank"><div class="b_reg">保险营销员注册</div></a> <div class="biaodan"><div class="left">帐号 <input name="caccount" id="paccount" value="邮箱/手机号码" onkeydown="checkEnter(event,this);" class="input" type="text" onfocus="clean(this)" onblur="recover(this)" style=" width:100px; height:13px; font-size:12px;" /> 密码 <input name="cpassword" id="ppassword" class="input" type="password" onkeydown="checkEnter(event,this);" onfocus="p_clean(this);" onblur="p_recover(this);"  style=" width:100px; height:13px; font-size:12px;" /> <input type="checkbox" name="rememberMe" id="prememberMe" />记住密码</div> <div class="b"><a href="#this" onclick="login(this);"><img src="http://static.xiangrikui.com/www/images/b_login.gif" width="47" height="18" /></a></div> </div> '}document.getElementById("head_login_bar").innerHTML=c;if(b){document.write(unescape("%3Cscript src='http://static.xiangrikui.com/quick/script/msg/msg.js' type='text/javascript'%3E%3C/script%3E"))}};