              
var winDokumentEdit;

function dokumentEditWindow(DokumentID) {

	if (!winDokumentEdit) {
	    winDokumentEdit = new Ext.Window({
	        layout:'fit',
	        width:400,
	        autoHeight:true,
	        closeAction:'hide',
	        plain: true,
			modal: true,
			title:text_114,                      
			items:  new Ext.FormPanel({
				id:"DokumentEdit",
		        frame:true,
		        bodyStyle:'padding:10px 10px 0', 
		        autoHeight:true,
				labelWidth:75,
			    reader : new Ext.data.XmlReader({
			        record : 'Dokument',
			        success: '@success'
			    }, [
			        'DokumentID', 
					'Name', 
					'Beschreibung'
			    ]),
		        defaults: {width: 230},
		        defaultType: 'textfield',
		        items: [{
	            	name: 'DokumentID',
					hidden:true,
	                height:0
   	            }, {
	                fieldLabel: text_45,        
	                name: 'Name',
	                tabindex:1,
					allowBlank: false,
			        width: 260
			    },{
			        name: 'Beschreibung',
	        		height:80,
			        fieldLabel: text_46,
			        xtype: 'textarea',
			        allowBlank: true,
			        height: 90,
			        width: 260
			    }],

		       	buttons: [{
		            id:'Speichern',
		            text:text_47,
					handler: function () {
						Ext.getCmp("DokumentEdit").getForm().submit({
						    clientValidation: true,   
							url:'dokument_data.php?action=saveDokumentData', 
							waitMsg:text_39,             
						    success: function(form, action) {
					   	   		dokumentEditor.store.reload();   
					            dokumentEditor.getView().refresh();
								reloadDokumentSize();
							    winDokumentEdit.hide();
						    },
						    failure: function(form, action) {
						        switch (action.failureType) {
						            case Ext.form.Action.CLIENT_INVALID:
						                Ext.Msg.alert(text_29, text_30);
						                break;
						            case Ext.form.Action.CONNECT_FAILURE:
						                Ext.Msg.alert(text_29, text_30);
						                break;
						            default:
						               Ext.Msg.alert(text_29, action.result.msg);
						       }
						    }
						});
					}
		        },{
	             	text: text_15,
	             	handler: function() {
	                 	winDokumentEdit.hide();
	             	}
	         	}]
			})
	     });
	}        
	winDokumentEdit.show(); 
	winDokumentEdit.center(); 
  	Ext.getCmp("DokumentEdit").getForm().load({url:'dokument_data.php?action=readDokumentData&DokumentID='+DokumentID, 
    	waitMsg:text_41});
}

