        
var winDokumentUpload; 

var dokumentUploadFormPanel = new Ext.FormPanel({
    fileUpload: true,
    width: 500,
    frame: true,
    autoHeight: true,
    bodyStyle: 'padding: 10px 10px 0 10px;',
    labelWidth: 75,
    defaults: {
        allowBlank: false,
        msgTarget: 'side',
        anchor: '95%'
    },
    items: [{
		id:'upload_helptext',
		height:90,
        fieldLabel: text_78,
        xtype: 'textarea',
        readOnly: true,
        value: text_107
    },{
        id: 'Beschreibung',
		height:90,
        fieldLabel: text_46,
        xtype: 'textarea',
        allowBlank: true
    },{
        xtype: 'fileuploadfield',
        id: 'form-file',
        emptyText: text_108,
        fieldLabel: text_75, 
        name: 'dok-file',
        msgTarget: 'qtip',
        buttonText: '',
        buttonCfg: {
            iconCls: 'upload-icon'
        }                   
    }],
    buttons: [{
        text: text_76,
        handler: function(){
            if(dokumentUploadFormPanel.getForm().isValid()){
            	
                dokumentUploadFormPanel.getForm().submit({
                    url: 'dokument_upload.php', 
                    params: {
      			  		Folder: dokument_folder,
      			  		Subfolder: dokument_subfolder 
    				},
                    waitMsg: text_77,
			    	success: function(form, action) {                                        
                        winDokumentUpload.hide();						
			   	   		dokumentEditor.store.reload();   
			            dokumentEditor.getView().refresh();
						reloadDokumentSize();
			        },
				    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_31);
				                break;
				            default:
				               Ext.Msg.alert(text_29, action.result.msg);
				       }
				    }
                });
            }
        }
    },{
        text: text_15,
        handler: function(){
			winDokumentUpload.hide();						
        }
    },{
		text: text_169,
	    handler: function(){
	    	dokumentUploadFormPanel.getForm().reset();
	    }
    }] 
});

function dokumentUploadWindow() {

	if (!winDokumentUpload) {
               
         if (version == PREMIUM_VERSION)
         	Ext.getCmp('upload_helptext').setValue(text_107);
         else if (version == BASIC_VERSION)
         	Ext.getCmp('upload_helptext').setValue(text_121);
         else
           	Ext.getCmp('upload_helptext').setValue(text_118);
         	
	     winDokumentUpload = new Ext.Window({
	         layout:'fit',
	         width:500,
	         autoHeight:true,
	         closeAction:'hide',
	         plain: true,  
			 modal: true,
			 title: text_106,                      
		     items: dokumentUploadFormPanel 
			});
	}  
 	winDokumentUpload.show();
 	winDokumentUpload.center();

}	
	


