Common subdirectories: /home/xenatt/tag_editor/images and /var/www/html/sites/all/modules/tag_editor/images
Common subdirectories: /home/xenatt/tag_editor/scripts and /var/www/html/sites/all/modules/tag_editor/scripts
diff -up /home/xenatt/tag_editor/tag_editor.module /var/www/html/sites/all/modules/tag_editor/tag_editor.module
--- /home/xenatt/tag_editor/tag_editor.module	2009-07-28 06:02:24.000000000 +0700
+++ /var/www/html/sites/all/modules/tag_editor/tag_editor.module	2011-01-21 17:06:17.117320625 +0700
@@ -4,8 +4,11 @@ sleep(1);
 /**
  * Implementation of hook_nodeapi().
  */
+
+
+
 function tag_editor_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-	if ($op == 'prepare') {
+	if (($op == 'prepare') || ($op == 'validate')) {
 	  $node_type_vids = array();
 	  // this builds our query
     $query = db_query("SELECT vid FROM {vocabulary_node_types} WHERE type = '%s'", $node->type);
@@ -20,12 +23,14 @@ function tag_editor_nodeapi(&$node, $op,
       // filter them for which tag editor is enabled
       // in context of current node type.
       if (variable_get('tag_editor_' . $vid, 0) == 1 && in_array($vid, $node_type_vids)) {
-        $settings['tag_fields'][] = '#edit-taxonomy-tags-' . $vid;
+        $settings_[] = '#edit-taxonomy-tags-' . $vid;
       }
     }
-    if (count($settings['tag_fields']) > 0) {
+    if (count($settings_) > 0) {
     	$path = drupal_get_path('module', 'tag_editor');
-      drupal_add_js(array('tag_editor' => $settings), 'setting');
+	  $settings_ = array_unique($settings_); 
+/*          $settings['tag_fields'] = $settings_;
+          drupal_add_js(array('tag_editor' => $settings), 'setting'); */
   	  // Override existing autocomplete behavior
   	  // instead of adding another for efficiency.
   	  // That's why it's priority is 'theme' and not 'module'.
@@ -33,8 +38,19 @@ function tag_editor_nodeapi(&$node, $op,
   	  drupal_add_js($path . '/scripts/tag_editor.autocomplete.js', 'theme');
   	  drupal_add_js($path . '/scripts/tag_editor.js', 'module');
   	  drupal_add_css($path . '/scripts/tag_editor.css', 'module');
+             
+          $settings_x['_tag_fields'] = $settings_;
+          $t_f = NULL;
+          $t_f = json_encode($settings_x);
+          $script = '_tag_editor = ' . $t_f;
+
+          drupal_add_js($script, 'inline');
+/*          $script_ = 'alert(tag_editor.tag_fields[0])';
+	  drupal_add_js($script_, 'inline');
+*/
+
     }
-  }
+  } 
 }
 
 /**
