Ext.onReady(function() {
	        Ext.QuickTips.init();
	        var login = new Ext.FormPanel({
		                labelWidth : 80,
		                url : 'authentication/ajax/login',
		                frame : true,
		                bodyStyle : 'padding:5px;',
		                defaultType : 'textfield',
		                monitorValid : true,
		                items : [{
			                        fieldLabel : 'Username',
			                        id : 'username',
			                        name : 'username',
			                        allowBlank : false
		                        },{
			                        fieldLabel : 'Password',
			                        id : 'password',
			                        name : 'password',
			                        inputType : 'password',
			                        allowBlank : false
		                        },{
			                        id : 'lbError',
			                        name : 'lbError',
			                        cls : 'lbError',
			                        xtype : 'label',
			                        text : '',
			                        width : 160
		                        }],
		                buttons : [{
			                        text : 'Login',
			                        formBind : true,
			                        // Function that fires when user clicks the button
			                        handler : function() {
				                        login.getForm().submit({
					                                method : 'POST',
					                                waitTitle : 'Connexion en cours...',
					                                waitMsg : 'envoi des données ...',
					                                success : function(form,action) {
						                                if (action&&action.result) {
							                                var redirect = action.result.link;
							                                window.location = redirect;
						                                }
					                                },
					                                // en cas d'echec de l'autentification .
					                                // en renvois les l'utilisateur le motif
					                                failure : function(form,action) {
						                                login.getComponent('lbError').setText(action.result.msg.text);
						                                if (action.result.msg.code=='2') {
							                                login.getComponent('username').focus();
						                                } else
							                                if (action.result.msg.code=='3') {
								                                login.getComponent('password').focus();
							                                }
					                                }
				                                });
			                        }
		                        }]
	                });
	        // ici on vas créer une fenetre qui va contenir Notre formPanel
	        var win = new Ext.Window({
		                layout : 'fit',
		                title : 'Identifiez vous',
		                iconCls : 'image_login',
		                width : 300,
		                height : 150,
		                closable : false,
		                resizable : false,
		                modal : true,
		                plain : true,
		                border : false,
		                items : [login]
	                });
	        win.show();
        });

