/********************************************************************************************************************/
/*************************************** Kontaktformular anzeigen ***************************************************/
/********************************************************************************************************************/
MV_Kontakt = function() {
    
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';

    var frmContent = new Ext.form.FormPanel({
        baseCls: 'x-plain',
        labelWidth: 55,
        defaultType: 'textfield',
        itemCls: 'mv-form-kontakt',
        items: [{
            fieldLabel: 'Absender',
            id: 'from',
            allowBlank: false,
            vtype:'email',
            anchor: '75%'
        }, {
            fieldLabel: 'Betreff',
            id: 'subject',
            anchor: '100%'  // anchor width by percentage
        }, {
            xtype: 'textarea',
            hideLabel: true,
            id: 'msg',
            anchor: '100% -53'  // anchor width by percentage and height by raw adjustment
        }]
    });

    var winKontakt = new Ext.Window({
        sendMessage: function(){
            if(Ext.getCmp('from').isValid(false)==true){
                Ext.Ajax.request({
				    url: './includes/HandleData.php',
				    params:{
				        DataHandle: 'SendMessage', 
				        MyFrom: Ext.getCmp('from').getValue(),
				        MySubject: Ext.getCmp('subject').getValue(),
				        MyMessage: Ext.getCmp('msg').getValue()
				    },
				    success: function(resp){
					    try{
						    var respArr = Ext.decode(resp.responseText);
					    }catch(e){}
					    if(respArr){
						    if(respArr.success){
    						    
							    winKontakt.close();
						    }
					    }
				    }
			    });
            }
        },
        title: 'Nachricht senden!',
        width: 500,
        height:300,
        minWidth: 300,
        minHeight: 200,
        layout: 'fit',
        modal:true,
        bodyStyle:'padding:5px;',
        buttonAlign:'center',
        items: frmContent,
        buttons: [{
            text: 'Senden',
            handler: function(){
				winKontakt.sendMessage();
			}
        },{
            text: 'Abbrechen',
            handler: function(){
				winKontakt.close();
			}
        }]
    });

    winKontakt.show();
};