/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    var bd = Ext.getBody();






     /*
     * ================  Formulaire inscription  =======================
     */
    bd.createChild({tag: 'h2', html: 'test'});

     var simple = new Ext.FormPanel({
         standardSubmit: true,
        labelWidth: 60, // label settings here cascade unless overridden

        id:'simple',
        frame:true,
        title: 'Contactez-Nous',
        bodyStyle:'padding:5px 5px 0',
        width: 380,
        defaults: {width: 250},
        defaultType: 'textfield',

        items: [{
                xtype:'textfield',
                fieldLabel:'Nom',
                name:'nom',

                allowBlank:false
               },{
               xtype:'textfield',
               fieldLabel:'Prénom',
                name:'prenom',

                allowBlank:false
               },{
                xtype:'textfield',
                    fieldLabel: 'Courriel',
                    name: 'courriel',
                    vtype:'email',
                allowBlank:false
            },{
                xtype:'textfield',
                    fieldLabel: 'Téléphone',
                    name: 'tel'


            },{
             fieldLabel: 'Message',
             name:'comment',
             xtype:'textarea',
             allowBlank: false
         },
            new Ext.form.Hidden({
            name:'set',
            value:'send_mail'
         })
        ],

        buttons: [{
text: 'Envoyez',
handler: function() {
if (simple.form.isValid()) {
simple.form.submit({
waitMsg:'Patientez....',
handler: function() {
		simple.getForm().getEl().dom.action = 'contact.php';
	        simple.getForm().getEl().dom.method = 'POST';
                simple.getForm().submit();

}
});
} else Ext.MessageBox.alert("Erreur","Formulaire incomplet.");
}

}]

    });

    simple.render("contact_form");
});



