function showRegister(){
    var register = new Ext.FormPanel({
        labelWidth: 80,
        url: 'phplib/security/register.php',
        frame: true,
        defaultType: 'textfield',
        monitorValid: true,
        // Specific attributes for the text fields for username / password. 
        // The "name" attribute defines the name of variables sent to the server.
        items: [{
            fieldLabel: lang.label_name,
            name: 'name',
            allowBlank: false
        }, {
            fieldLabel: lang.label_surname,
            name: 'surname',
            allowBlank: false
        }, {
            fieldLabel: lang.label_email,
            name: 'email',
            allowBlank: false
        }, {
            fieldLabel: lang.label_web,
            name: 'web',
            allowBlank: true
        }, {
            fieldLabel: 'Secuity Code',
            name: 'antispam',
            width:160,
            allowBlank:false
        }, {
        	xtype:'box',
        	autoEl:{
        		tag:'img',
        		src:'phplib/captcha/captcha.php?'+Math.floor(Math.random()*111)
        	}
        }        
        ],
        
        // All the magic happens after the user clicks the button     
        buttons: [{
            text: lang.button_register_request,
            formBind: true,
            // Function that fires when user clicks the button 
            handler: function(){
                register.getForm().submit({
                    method: 'POST',
                    waitTitle: lang.message_requesting_register + ' ......',
                    waitMsg: lang.label_wait,
                    
                    success: function(){
                        Ext.Msg.alert('OK!!', lang.message_user_register);
                        winRegister.close();
                    },
                    
                    failure: function(form, action){
                        if (action.failureType == 'server') {
                            obj = Ext.util.JSON.decode(action.response.responseText);
                            Ext.Msg.alert('ERROR', obj.errors.reason);
                        }
                        else {
                            Ext.Msg.alert('Warning!', 'ERROR' + action.response.responseText);
                        }
                        register.getForm().reset();
                    }
                });
            }
        }]
    });
    
    
    // This just creates a window to wrap the login form. 
    // The login object is passed to the items collection.       
    winRegister = new Ext.Window({
        title: lang.window_tittle_register_request,
        layout: 'fit',
        width: 300,
        height: 300,
        closable: true,
        resizable: false,
        plain: true,
        border: false,
        modal: true,
        items: [register]
    });
    winRegister.show();
}

