MyDesktop.Contactenos = Ext.extend(Ext.app.Module, {
    id: 'contactenos-module',
    init : function(){
        this.launcher = {
            text: 'Contactenos',
            iconCls:'mail',
            handler : this.createWindow,
            scope: this
        }
    },
    createWindow : function(){
        Ext.form.Field.prototype.msgTarget = 'side';
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('contactenos-win');
        if(!win){
            win = desktop.createWindow({
                id: 'contactenos-win',
                title:'Contactenos',
                resizable: false,
                maximizable: false,
                labelWidth: 75, // label settings here cascade unless overridden
                frame:true,
                bodyStyle:'padding:5px 5px 0',
                width: 400,
                shim:false,
                animCollapse:false,
                constrainHeader:true,
                defaultType: 'textfield',
                items: new Ext.form.FormPanel({
                            id: 'contactenos-form-panel',
                            baseCls: 'x-plain',
                            labelWidth:100,
                            defaultType: 'textfield',
                            items: [{
                                    fieldLabel: 'Nombre',
                                    name: 'nombre',
                                     width: 250,
                                     blankText: 'Por favor ingrese su nombre',
                                    allowBlank:false
                                },{
                                    fieldLabel: 'Apellido',
                                    width: 250,
                                    name: 'apellido'
                                },{
                                    fieldLabel: 'Email',
                                    width: 250,
                                    name: 'email',
                                    vtype:'email',
                                    blankText: 'Por favor ingrese un email valido para que podamos contactarlo',
                                    allowBlank:false
                                },{
                                    fieldLabel: 'Consulta',
                                    xtype: 'textarea',
                                    name: 'consulta',
                                     width: 250,
                                     blankText: 'Por favor ingrese su consulta',
                                    allowBlank:false
                                }],
                            buttons: [{
                                text: 'Save',
                                handler: function(){
                                    var fp = Ext.getCmp('contactenos-form-panel');
                                    if(fp.getForm().isValid()){
                                        fp.getForm().submit({
                                            url: 'index.php/contactenos/index',
                                            waitMsg: 'Enviando...',
                                            //params: "nuevo=" + nuevo,
                                            success: function(fp, o){
                                                Ext.MessageBox.alert('Contacto', o.result.Guardar);
                                                win.close();
                                            }
                                        });
                                    }
                                }
                            },{
                                text: 'Cancel',
                                handler: function(){
                                    win.close();
                                }
                            }]
                        })
            });
        }
        win.show();
    }
});