+    // Preventing page from redirecting
+    $("#" + ns.list_div_id).on("dragover", function(e) {
+      e.preventDefault();
+      e.stopPropagation();
+    });
+
+    $("#" + ns.list_div_id).on("drop", function(e) {
+      e.preventDefault();
+      e.stopPropagation();
+    });
+
+    // Drag enter
+    $('.upload_drop_zone').on('dragenter', function (e) {
+      e.stopPropagation();
+      e.preventDefault();
+    });
+
+    // Drag over
+    $('.upload_drop_zone').on('dragover', function (e) {
+      e.stopPropagation();
+      e.preventDefault();
+    });
+
+    // Drop
+    $('.upload_drop_zone').on('drop', function (e) {
+      e.stopPropagation();
+      e.preventDefault();
+
+      ns.upload_status_dialog();
+
+      var object_type = $(e.target).data('object-type');
+      var object_id   = $(e.target).data('object-id');
+      var file_type   = $(e.target).data('file-type');
+      var is_global   = $(e.target).data('is-global');
+      var maxsize     = $(e.target).data('maxsize');
+      var files       = e.originalEvent.dataTransfer.files;
+      ns.upload_files(object_id, object_type, file_type, maxsize, is_global, files);
+    });
+
+    $('.thumbnail').on('mouseover', ns.add_enlarged_thumbnail);
+    $('.overlay_img').on('mouseout', ns.remove_enlarged_thumbnail);
+    $('.overlay_div img').on('click', ns.download);
+  };
+
+  ns.doc_tab_init = function(tabs_id, doc_tab_id, id, object_type) {
+    var url = 'controller.pl?action=File/list&file_type=document&object_type=' + object_type  + '&object_id=' + $('#id').val();
+
+    $('#' + tabs_id).on('tabsbeforeactivate', function(e, ui) {
+      if (ui.newPanel.attr('id') !== doc_tab_id) return;
+      $('#' + doc_tab_id).html(kivi.t8('Loading...'));
+      $('#' + doc_tab_id).load(url);
+    });
+
+    $('#' + tabs_id).on('tabscreate', function(e, ui) {
+      if (ui.panel.attr('id') !== doc_tab_id) return;
+      $('#' + doc_tab_id).html(kivi.t8('Loading...'));
+      $('#' + doc_tab_id).load(url);
+    });
+  };