function showLogIn(redirect){
	var remember_active, login;
    remember_active = new Ext.form.Checkbox({
        fieldLabel: lang.check_remember,
        name: 'remember'
    });
    
    
    login = new Ext.FormPanel({
        labelWidth: 80,
        url: 'phplib/security/login.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_username,
            name: 'loginUsername',
            allowBlank: false
        }, {
            fieldLabel: lang.label_password,
            name: 'loginPassword',
            inputType: 'password',
            allowBlank: false
        }, remember_active
        ],
        
        // All the magic happens after the user clicks the button     
        buttons: [{
            text: lang.button_enter,
            formBind: true,
            // Function that fires when user clicks the button 
            handler: function(){
                login.getForm().submit({
                    method: 'POST',
                    waitTitle: lang.message_validating_user + '......',
                    waitMsg: lang.label_wait,
                    
                    success: function(){
                        if (!redirect) {
                            redirect = 'index.php';
                        }
                        window.location = redirect;
                    },
                    
                    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);
                        }
                        login.getForm().reset();
                    }
                });
            }
        }]
    });
    
    
    // This just creates a window to wrap the login form. 
    // The login object is passed to the items collection.       
    winLogin = new Ext.Window({
        title: lang.window_tittle_access,
        layout: 'fit',
        width: 300,
        height: 150,
        closable: true,
        resizable: false,
        plain: true,
        border: false,
        modal: true,
        items: [login]
    });
    winLogin.show();
}

