var tx_iportaluser_labels={button_login:"Login",button_register:"Register now!",connecting:"Connecting to the server...",email:"E-mail",error_title:"Error",login:"Login",login_title:"Login",logout:"Logout",password:"Password",password_copy:"Repeat password",passwords_do_not_match:"Passwords do not match",register_title:"Register a new user",registered_success:"Welcome to our portal!<br /><br />You are now registered. You can update your profile and have other privileges of registered users.<br /><br />Good luck!",rules:'By creating an account you confirm that you agree to portal <a href="{0}" target="_blank">rules</a>.',server_error:"The server cannot log you in. Please, try again in 10 minutes",thank_you:"Thank you!"};function tx_iportaluser_login(b,a){var d=new Ext.form.FormPanel({baseParams:{action:"login",eID:"tx_iportaluser",id:tx_iportal_pid,logintype:"login",pid:b},bodyStyle:"padding: 5px 7px",defaultType:"textfield",defaults:{msgTarget:"side",width:"80%"},items:[{allowBlank:false,fieldLabel:tx_iportaluser_labels.login,id:"user-login-field",minLength:1,name:"user"},{allowBlank:false,fieldLabel:tx_iportaluser_labels.password,inputType:"password",minLength:1,name:"pass"}],modal:true,url:"/index.php",waitMsgTarget:document.body});var c=new Ext.Window({buttons:[{text:tx_iportaluser_labels.button_login,handler:function(){d.getForm().submit({failure:tx_iportaluser_showError,success:function(){c.close();Ext.getBody().mask(tx_iportaluser_labels.connecting,"x-mask-loading");if(a!=""){document.location.href=a}else{document.location.reload()}},waitMsg:tx_iportaluser_labels.connecting})}},{text:Ext.MessageBox.buttonText.cancel,handler:function(){c.close()}}],items:d,modal:true,title:tx_iportaluser_labels.login_title,width:400});c.show()}function tx_iportaluser_showError(a,b){if(typeof b.result.error!="undefined"){Ext.MessageBox.alert(tx_iportaluser_labels.error_title,b.result.error)}else{Ext.MessageBox.alert(tx_iportaluser_labels.error_title,tx_iportaluser_labels.server_error)}}function tx_iportaluser_logout(a){Ext.Ajax.request({url:"/index.php",method:"POST",params:{action:"logout",eID:"tx_iportaluser",id:tx_iportal_pid,logintype:"logout",pid:a,redirect_url:""},success:function(){document.location.reload()},failure:Ext.emptyFn})}function tx_iportaluser_register(a,d){var c=new Ext.form.FormPanel({baseParams:{action:"register",eID:"tx_iportaluser",id:tx_iportal_pid,pid:a},defaultType:"textfield",defaults:{msgTarget:"side",width:"80%"},items:[{allowBlank:false,fieldLabel:tx_iportaluser_labels.login,minLength:1,name:"user"},{allowBlank:false,fieldLabel:tx_iportaluser_labels.password,id:"pass1",inputType:"password",minLength:1,name:"pass"},{allowBlank:false,fieldLabel:tx_iportaluser_labels.password_copy,id:"pass2",inputType:"password",minLength:1,name:"pass2",validator:function(){return tx_iportaluser_checkPasswords(c.getForm())}},{allowBlank:false,fieldLabel:tx_iportaluser_labels.email,name:"email",vtype:"email"}],url:"/index.php",waitMsgTarget:document.body});var b=new Ext.Window({buttons:[{text:tx_iportaluser_labels.button_register,handler:function(){var e=c.getForm();if(e.isValid()){e.submit({failure:tx_iportaluser_showError,success:function(){b.destroy();tx_iportaluser_registered()},waitMsg:tx_iportaluser_labels.connecting})}}},{text:Ext.MessageBox.buttonText.cancel,handler:function(){b.destroy()}}],defaults:{bodyStyle:"padding: 5px 7px"},items:[c,{xtype:"panel",cls:"x-form-item",html:String.format(tx_iportaluser_labels.rules,d)}],modal:true,title:tx_iportaluser_labels.register_title,width:400});b.show()}function tx_iportaluser_checkPasswords(a){if(a.findField("pass1").getValue()!=a.findField("pass2").getValue()){return tx_iportaluser_labels.passwords_do_not_match}return true}function tx_iportaluser_registered(){Ext.MessageBox.alert(tx_iportaluser_labels.thank_you,'<img src="/typo3conf/ext/iportal_user/resources/smile.png" style="margin-right: 15px" width="75" height="75" alt="" align="left" />'+tx_iportaluser_labels.registered_success,function(){document.location.reload()})};