Ext.onReady(function(){

  Ext.QuickTips.init();
  Ext.form.Field.prototype.msgTarget = 'side';
  
  var redirectFormulaire= function(){
        location.href="conf.htm";
  };

  
  var formulaire_contact = new Ext.FormPanel({
    title: 'Contacter Zebestof',
    url:'save-form.php',
    method:'POST',
    frame:true,
    bodyStyle:'padding:2px 2px 0;',
    width: '100%',
    items: [{
      layout:'column',
      items:[{
        columnWidth:.20,
        html: '<a href="https://adwords.google.com/select/ProfessionalStatus?id=Jtl4Pceo8DDM5r4gMu25og&hl=fr" target="_blank"><img src="https://adwords.google.fr/select/logo_qualified_ind_80.jpg" style="border:1px solid gray;margin-top:15%;margin-left:20%;"></a>'
      },{
        columnWidth:.40,
        layout: 'form',
        style:'font-size:4px;',
        items: [{
          xtype:'textfield',
          emptyText: 'Prenom ',
          name: 'first',
          anchor:'85%',
          hideLabel:true
        },{
          xtype:'textfield',
          emptyText: 'Nom * ',
          name: 'last',
          anchor:'85%',
          allowBlank:false,
          blankText:'Le champ Nom est obligatoire',
          hideLabel:true
        },{
          xtype:'textfield',
          emptyText: 'Telephone * ',
          name: 'phone',
          anchor:'85%',
          allowBlank:false,
          blankText:'Le champ Telephone est obligatoire',
          hideLabel:true
        },{
          xtype:'textfield',
          emptyText: 'Email * ',
          name: 'email',
          vtype:'email',
          anchor:'85%',
          allowBlank:false,
          blankText:'Le champ Email est obligatoire',
          hideLabel:true
        },{
          xtype:'textfield',
          emptyText: 'Societe ',
          name: 'company',
          anchor:'85%',
          hideLabel:true
        }]
      },{
        columnWidth:.40,
        layout: 'form',
        items: [{
          xtype:'textarea',
            id:'question',
            emptyText:'Posez vos questions ici... ',
            height:90,
            anchor:'95%',
            hideLabel:true
        },{
          buttons: [{
            text: 'Envoyer',
            type: 'submit',
            style:'margin-right:60%;',
            handler: function() {
              if (formulaire_contact.getForm().isValid()) {
                formulaire_contact.getForm().submit();
                redirectFormulaire();
              }else{
                Ext.MessageBox.alert('Erreurs', 'Renseignez les champs obligatoires correctement svp...');
              }
            }
          }]
        }]
      }]
    }]
  });
  
  formulaire_contact.render('form-ct');
  
});

