GO.ab2users.randomPassword=function(e){var d="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";var c="";var b;for(var a=0;a<e;a++){b=Math.floor(Math.random()*62);c+=d.charAt(b)}return c};GO.moduleManager.onModuleReady("addressbook",function(){Ext.override(GO.addressbook.ContactDialog,{initComponent:GO.addressbook.ContactDialog.prototype.initComponent.createInterceptor(function(){this.height+=25;this.elements+=",tbar";this.tbar=[{iconCls:"btn-save",text:GO.ab2users.lang.createUser,handler:function(){GO.users.showUserDialog();var a=this.formPanel.form.getValues();a.username=a.last_name;a.password1=a.password2=GO.ab2users.randomPassword(8);a.company=this.formPanel.form.findField("company_id").getRawValue();GO.users.userDialog.formPanel.form.setValues(a)},scope:this}]})});Ext.override(GO.addressbook.CompanyDialog,{initComponent:GO.addressbook.CompanyDialog.prototype.initComponent.createInterceptor(function(){this.height+=25;this.tbar=[{iconCls:"btn-save",text:GO.ab2users.lang.createUser,handler:function(){GO.users.showUserDialog();var b=this.companyForm.form.getValues();var a={};a.username=b.email;a.password1=a.password2=GO.ab2users.randomPassword(8);a.email=b.name;a.first_name=GO.ab2users.lang.companyUserFirstName;a.last_name=a.company=b.name;a.address=a.work_address=b.post_address;a.address_no=a.work_address_no=b.post_address_no;a.zip=a.work_zip=b.zip;a.city=a.work_city=b.city;a.state=a.work_state=b.state;a.country=a.work_country=b.country;a.home_phone=a.work_phone=b.phone;a.fax=a.work_fax=b.fax;GO.users.userDialog.formPanel.form.setValues(a)},scope:this}]})})});