var Login=new Class({Implements:[Events,Options],options:{username:"",score:0,nextLv:0,lvname:"",rep:0,life:0,post:0,probReplies:0,probBest:0,updates:0,tlogin:0,gender:0,level:0,logined:false},initialize:function(A){},_init:function(AC){var p=this;var AD=$("loginPanel");AD.empty();var A=$("userinfoPanel");A.empty();new IFrame({frameborder:0,height:0,width:0,scrolling:"no",src:"/ping_session.jsp",name:"ping"}).inject($("loginPanel"));var D=new Element("li",{"class":"left"}).inject(A);if(p.options.logined){var O;if(p.options.gender==0){O="<font color=#33CCCC>"+p.options.username+"</font>"}else{O="<font color=#CC6699>"+p.options.username+"</font>"}var g=new Element("li",{html:O}).inject(A);new Element("li",{text:"|"}).inject(A);if(p.options.nextLv!=0){var r=new colorBar({barwidth:80,barheight:14});r.set(p.options.score,p.options.nextLv);var N=new Element("li",{text:""}).inject(A);N.grab(r.element);var y=(N.getSize().y-r.options.barheight)/2;r.element.setStyles({position:"relative",top:y});r.progress.setStyle("top",-r.options.barheight+r.options.barmargin)}var h=new Element("div",{id:"loginContent"}).inject(AD);var T=new Element("table",{styles:{width:"600px",align:"center",color:"white"}}).inject(h);var o=new Element("tbody").inject(T);var l=new Element("tr").inject(o);var f=new Element("td",{html:"积分",styles:{width:"15%"}}).inject(l);var d=new Element("td",{styles:{width:"20%"}}).inject(l);var r=new colorBar({barwidth:120,barheight:16,inPercentage:false});r.set(p.options.score,p.options.nextLv);var i=new Element("div").inject(d);i.grab(r.element);var c=new Element("td",{html:"&nbsp;",styles:{width:"2%"}}).inject(l);var a=new Element("td",{html:"级别",styles:{width:"15%"}}).inject(l);var Z=new Element("td",{text:p.options.rep,level:{width:"15%"}}).inject(l);var Y=new Element("td",{html:"&nbsp;",styles:{width:"2%"}}).inject(l);var X=new Element("td",{html:"威望",styles:{width:"15%"}}).inject(l);var V=new Element("td",{text:p.options.rep,styles:{width:"15%"}}).inject(l);var k=new Element("tr").inject(o);var L=new Element("td",{html:"提交更新"}).inject(k);var K=new Element("td",{html:p.options.updates}).inject(k);var J=new Element("td",{html:"&nbsp;"}).inject(k);var I=new Element("td",{html:"问答问题"}).inject(k);var H=new Element("td",{html:p.options.probReplies}).inject(k);var z=new Element("td",{html:"&nbsp;"}).inject(k);var x=new Element("td",{html:"生命力"}).inject(k);var w=new Element("td",{html:p.options.life}).inject(k);var j=new Element("tr").inject(o);var AB=new Element("td",{html:"发文"}).inject(j);var AA=new Element("td",{html:p.options.post}).inject(j);var F=new Element("td",{html:"&nbsp;"}).inject(j);var E=new Element("td",{html:"最佳答案"}).inject(j);var C=new Element("td",{html:p.options.probBest}).inject(j);var v=new Element("td",{html:"&nbsp;"}).inject(j);var u=new Element("td",{html:"登录次数"}).inject(j);var q=new Element("td",{html:p.options.tlogin}).inject(j);var b=new Element("li",{text:p.options.lvname}).inject(A);var M=new Element("li",{text:"|"}).inject(A);var e=new Element("li",{html:'<a href="#">Profile</a>'}).inject(A)}else{var h=new Element("div",{id:"loginContent"}).inject(AD);var Q=new Element("label",{html:"<b>邮箱地址: </b>"}).inject(h);var AG=new Element("input",{type:"text",id:"email",name:"email",value:"",size:14}).inject(h);var P=new Element("label",{html:"<b>密码: </b>"}).inject(h);var n=new Element("input",{type:"password",id:"pwd",name:"pwd",value:"",size:14}).inject(h);var AF=new Element("input",{type:"submit","class":"button_login",name:"submit",value:""}).inject(h);AF.focus();var AE=new Element("span",{name:"info",value:"",styles:{visibility:"hidden"}}).inject(h);AF.addEvent("click",function(m){if(AG.value==""||n.value==""){alert("user name or password can not be blank")}else{p._login(AG.value,n.value,AE)}});var W=new Element("div",{styles:{display:"block",width:"275px"}}).inject(h);var U=new Element("span",{styles:{"float":"right"}}).inject(W);U.adopt(new Element("input",{type:"checkbox",id:"autologin",checked:"checked"})).adopt(new Element("span",{html:"保持自动登录"}));var B=new Element("div",{"class":"right",html:'还不是飞跃会员？<a href="/user/insert.jhtml">马上注册</a> | <a href="/user/lostPassword.jhtml">忘记密码？</a>'}).inject(h);var e=new Element("li",{html:'<a href="#"><font size=-1>登录</font></a>'}).inject(A);e.addEvent("click",function(m){m.stop();AG.focus()})}var M=new Element("li",{text:"|"}).inject(A);var S=new Element("li",{html:'<a href="#"><font size=-1>注销</font></a>'}).inject(A);var s=new Element("li",{"class":"right"}).inject(A);S.addEvent("click",function(m){m.stop();p._logout()});var R=new Element("div",{"class":"loginClose"}).inject(AD);var G=new Element("span",{html:'<a href="#" >关闭<div class="loginCloseImg"></div></a>'}).inject(R);G.addEvent("click",function(m){m=new Event(m);p.Slide.slideOut();m.stop()});e.addEvent("click",function(m){m=new Event(m);p.Slide.toggle();m.stop()});if(AC){AD.setStyle("height","auto");p.Slide=new Fx.Slide("loginPanel").hide()}else{p.Slide.toggle()}},_login:function(C,E,G){var D=this;var F=new Date().getTime();var A={t:F,email:C,password:E};if($("autologin").get("checked")){A.autologin="on"}var B=new Request.JSON({url:"/user/ajaxLogin.jhtml",onSuccess:function(H,I){if($defined(H.fail)){G.setStyle("visibility","visible");G.set("html",'<font color="red">'+H.fail+"</font>");$("username").set("value","");$("pwd").set("value","");$("username").focus()}else{D.options.username=H.username;D.options.lvname=H.lvname;D.options.score=H.score;D.options.nextLv=H.nextLv;D.options.rep=H.rep;D.options.life=H.life;D.options.updates=H.updates;D.options.probBest=H.probBest;D.options.probReplies=H.probReplies;D.options.tlogin=H.tlogin;D.options.gender=H.gender;D.options.level=H.level;D.options.logined=true;D._init(false)}}}).post(A)},_logout:function(){var B=this;var D=document.location.href;var C=new Date().getTime();var A=new Request.JSON({url:"/user/logout.jhtml",onSuccess:function(E,F){window.location="/"}}).post()}});