--- drupal-6.13/sites/all/modules/webfm/modules/webfm_popup/webfm_popup.module.org	2009-08-27 14:42:59.000000000 +0200
+++ drupal-6.13/sites/all/modules/webfm/modules/webfm_popup/webfm_popup.module	2009-08-27 14:44:19.000000000 +0200
@@ -46,10 +46,14 @@
   if (arg(0) == 'webfm_popup') {
     $modulepath = drupal_get_path('module', 'webfm_popup');
     drupal_add_js($modulepath.'/webfm_popup.js');
+    $filepath = 'system/files';
+    if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
+      $filepath = file_directory_path();
+    }
     if(($user->uid == 1) || user_access('administer webfm')) {
-      drupal_add_js(array('webfm_popup' => array('fileDirectory' => file_directory_path())), 'setting');
+      drupal_add_js(array('webfm_popup' => array('fileDirectory' => $filepath)), 'setting');
     } else {
-      drupal_add_js(array('webfm_popup' => array('fileDirectory' => file_directory_path().webfm_get_root_path())), 'setting');
+      drupal_add_js(array('webfm_popup' => array('fileDirectory' => $filepath.webfm_get_root_path())), 'setting');
     }
   }
 }
