Ext.BLANK_IMAGE_URL='myNewsletter/extjs/resources/images/default/s.gif';Ext.namespace('INSC');Ext.onReady(function(){Ext.QuickTips.init();INSC.ErrorMessage=function(message){Ext.Msg.show({title:'Erreur',msg:message,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,width:400})};INSC.WarningMessage=function(message){Ext.Msg.show({title:'Attention',msg:message,buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING,width:400})};INSC.infoMessage=function(message){Ext.Msg.show({title:'Information',msg:message,buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO,width:400})};INSC.function_submit=function(){login.getEl().mask();if(login.getForm().isValid()){login.getForm().submit({url:'myNewsletter/php_ajax/inscrinptionNL.php',method:'POST',success:function(form,action){var objSuc=Ext.util.JSON.decode(action.response.responseText);if(objSuc.hasOwnProperty('success')&&objSuc.success=='false'){INSC.ErrorMessage(objSuc.errors.msg);return}INSC.infoMessage(objSuc.sucMSG[0].msg);login.getForm().reset()},failure:function(form,action){var obj=Ext.util.JSON.decode(action.response.responseText);var message=obj.errors.msg;INSC.ErrorMessage(message)}})}else{INSC.WarningMessage('Veuillez remplir chacune des cases.')}login.getEl().unmask()};var login=new Ext.FormPanel({id:'login',frame:false,width:375,height:100,labelWidth:150,labelAlign:'left',buttonAlign:'center',border:false,items:[{xtype:'textfield',fieldLabel:'Votre nom',id:'username',width:210,name:'username',allowBlank:false,blankText:"Veuillez saisir votre prénom suivi du nom."},{xtype:'textfield',fieldLabel:'Votre adresse courriel',width:210,id:'usermail',name:'usermail',allowBlank:false,blankText:'Votre adresse courriel est requise',vtype:'email',vtypeText:'Votre adresse courriel doit être de la forme user@domain.com'},{xtype:'button',id:'buttonLoggin',text:'Envoyer',handler:INSC.function_submit}]});login.render('centerDiv');new Ext.KeyNav("usermail",{"enter":INSC.function_submit})});