Index: common/common.php
===================================================================
--- common/common.php	(revision 1082)
+++ common/common.php	(working copy)
@@ -46,7 +46,7 @@
 // Short identifiers. FIXME: limit length here too?
 define("IA_RE_ROUND_ID", '[a-z0-9][a-z0-9_\-\.]*');
 define("IA_RE_TASK_ID", '(?-i:[a-z0-9][a-z0-9_\-\.]*)');
-define("IA_RE_TAG_NAME", '[a-z0-9\-\.\ \@]+');
+define("IA_RE_TAG_NAME", '[a-z0-9\-\.\ \@\(\)]+');
 define("IA_RE_SCORE_NAME", '[a-z0-9][a-z0-9_\-\.]*');
 define("IA_RE_USER_NAME", '[_@a-z0-9][a-z0-9_\-\.\@]*');
 
Index: common/tags.php
===================================================================
--- common/tags.php	(revision 1082)
+++ common/tags.php	(working copy)
@@ -61,13 +61,13 @@
     $parent_tags_key = Array();
     foreach ($parent_tags as $key => $tag) {
         $parent_tags[$key]['sub_tags'] = Array();
-        $parent_tags_key[ $tag['tag_id'] ] = $key;
+        $parent_tags_key[$tag['tag_id']] = $key;
     }
 
     foreach ($sub_tags as $tag) {
-        log_assert(isset($parent_tags_key[ $tag['tag_parent'] ]), "Child tag doesn't have a parent");
-        $parent_tag_key = $parent_tags_key[ $tag['tag_parent'] ];
-        $parent_tags[ $parent_tag_key ]['sub_tags'][] = $tag;
+        log_assert(isset($parent_tags_key[$tag['tag_parent']]), "Child tag doesn't have a parent");
+        $parent_tag_key = $parent_tags_key[$tag['tag_parent']];
+        $parent_tags[$parent_tag_key]['sub_tags'][] = $tag;
     }
 
     return $parent_tags;
Index: www/controllers/task.php
===================================================================
--- www/controllers/task.php	(revision 1082)
+++ www/controllers/task.php	(working copy)
@@ -65,7 +65,7 @@
 
     // Tag data
     $tag_types = Array('author', 'contest', 'year', 'round', 'age_group');
-    $tag_parents = Array('year' => 'contest', 'round' => 'year', 'age_group' => 'contest');
+    $tag_parents = Array('year' => 'contest', 'round' => 'year');
 
     // FIXME: tags that have children such as contest, year or round should have only one tag
     foreach ($tag_types as $type) {
Index: www/controllers/task_tags.php
===================================================================
--- www/controllers/task_tags.php	(revision 1082)
+++ www/controllers/task_tags.php	(working copy)
@@ -11,6 +11,9 @@
         // Get all sub tags for current category
         $category["sub_tags"] = tag_get_all(array("algorithm"),
             $category["id"]);
+        foreach ($category["sub_tags"] as &$tag) {
+            $tag["task_count"] = tag_count_objects("task", array($tag["id"]));
+        }
     }
 
     // Create view.
@@ -68,6 +71,21 @@
         redirect(url_task_tags());
     }
 
+    // Do not delete tags if they have been added to tasks.
+    if ($tag["type"] == "algorithm") {
+        $task_count = tag_count_objects("task", array($tag_id));
+    } else if ($tag["type"] == "method") {
+        $task_count = 0;
+        $sub_tags = tag_get_all(array("algorithm"), $tag_id);
+        foreach ($sub_tags as $sub_tag) {
+            $task_count += tag_count_objects("task", array($sub_tag["id"]));
+        }
+    }
+    if ($task_count != 0) {
+        flash_error("Nu poti sterge un tag care a fost asociat deja unei probleme.");
+        redirect(url_task_tags());
+    }
+
     tag_delete_by_id($tag_id);
     flash("Tag-ul a fost sters.");
     redirect(url_task_tags());
Index: www/index.php
===================================================================
--- www/index.php	(revision 1082)
+++ www/index.php	(working copy)
@@ -95,7 +95,7 @@
 }
 
 // Task algorithm tags
-else if ($page == 'admin/task_tags') {
+else if ($page == 'admin/task-tags') {
     require_once(IA_ROOT_DIR.'www/controllers/task_tags.php');
     if (request("action") == "add") {
         controller_task_tags_add();
Index: www/static/css/screen.css
===================================================================
--- www/static/css/screen.css	(revision 1082)
+++ www/static/css/screen.css	(working copy)
@@ -551,7 +551,7 @@
 }
 
 input[type='text'], input[type='password'], select {
-    width: 150px;
+    width: 250px;
 }
 
 #sidebar input[type='text'], #sidebar input[type='password'], #sidebar select {
@@ -1523,9 +1523,16 @@
 }
 
 /* Task algorithm tags page */
-.task_tag_actions {
+.task-tag-actions {
     margin: 0.5em;
 }
-ul.task_tag_actions li {
+ul.task-tag-actions li {
     display: inline;
 }
+
+.tag-table .tag-task-count {
+    width: 20%;
+}
+.tag-table .tag-operations {
+    width: 25%;
+}
Index: www/static/css/wick.css
===================================================================
--- www/static/css/wick.css	(revision 1082)
+++ www/static/css/wick.css	(working copy)
@@ -27,6 +27,7 @@
     border:1px inset #979797;
     color:black;
     padding: 0;
+    width: 257px;
 }
 
 .matchedSmartInputItem {
Index: www/static/js/inline_form.js
===================================================================
--- www/static/js/inline_form.js	(revision 1082)
+++ www/static/js/inline_form.js	(working copy)
@@ -5,7 +5,8 @@
 function bindToggleLinkToForm(toggleElement, formElement, originalElement) {
     var initialText = toggleElement.innerHTML;
     formElement.style.display = "none";
-    connect(toggleElement, "onclick", function() {
+    connect(toggleElement, "onclick", function(e) {
+        e.preventDefault();
         if (formElement.style.display == "none") {
             // Display inline form and replace toggleElement with "Anuleaza"
             formElement.style.display = "inline";
Index: www/url.php
===================================================================
--- www/url.php	(revision 1082)
+++ www/url.php	(working copy)
@@ -271,19 +271,19 @@
 }
 
 function url_task_tags() {
-    return url_complex("admin/task_tags");
+    return url_complex("admin/task-tags");
 }
 
 function url_task_tags_add() {
-    return url_complex("admin/task_tags", array("action" => "add"));
+    return url_complex("admin/task-tags", array("action" => "add"));
 }
 
 function url_task_tags_delete() {
-    return url_complex("admin/task_tags", array("action" => "delete"));
+    return url_complex("admin/task-tags", array("action" => "delete"));
 }
 
 function url_task_tags_rename() {
-    return url_complex("admin/task_tags", array("action" => "rename"));
+    return url_complex("admin/task-tags", array("action" => "rename"));
 }
 
 function url_round_edit($round_id) {
Index: www/views/tags_header.php
===================================================================
--- www/views/tags_header.php	(revision 1082)
+++ www/views/tags_header.php	(working copy)
@@ -8,14 +8,14 @@
 
 // Format a tag input box
 // FIXME: Width parameter does not work, I hate CSS
-function tag_format_input_box($field, $value = null, $width = "50", $name = "tags", $autocomplete = true) {
+function tag_format_input_box($field, $value = null, $width = "50", $name = "tags") {
     $esc_name = html_escape($field['name']);
     $esc_width = html_escape($width);
     // presume $value is html-escaped
 
     $output = '<li><label for="form_'.$esc_name.'">'.$field['label'].'</label>';
     $output .= ferr_span($name);
-    $output .= '<input class="wickEnabled" type="text" name="'.$esc_name.
+    $output .= '<input class="wickEnabled:wick_'.$name.'" type="text" name="'.$esc_name.
                '" id="form_'.$esc_name.'"';
     if (!is_null($width)) {
         $output .= ' size="'.$esc_width.'"';
@@ -23,9 +23,8 @@
     if (!is_null($value)) {
         $output .= ' value="'.$value.'"';
     }
-    $output .= ' />';
-    $output .= '<script type="text/javascript" language="JavaScript" src="'.
-                html_escape(url_static("js/wick.js")).'"></script>';
+    $output .= ' autocomplete="off" />';
+    $output .= '<table id="wick_'.$name.'" class="floater"><tr><td><div class="wick_content"></div></td></tr></table>';
     $output .= "</li>";
     return $output;
 }
@@ -33,6 +32,7 @@
 
 <link rel="stylesheet" type="text/css" href="<?= html_escape(url_static("css/wick.css")) ?> " />
 <script type="text/javascript" language="JavaScript">
+/* <![CDATA[ */
 function checkForm() {
     answer = true;
     if (siw && siw.selectingSomething) {
@@ -48,4 +48,6 @@
 }
 echo "];\n";
 ?>
+/* ]]> */
 </script>
+<script type="text/javascript" language="JavaScript" src="<?php echo html_escape(url_static("js/wick.js")) ?>"></script>
Index: www/views/task_edit.php
===================================================================
--- www/views/task_edit.php	(revision 1082)
+++ www/views/task_edit.php	(working copy)
@@ -145,7 +145,7 @@
             <ul class="form">
             <?php
                 foreach (array_keys($tag_fields) as $tag) {
-                    echo tag_format_input_box($tag_fields[$tag], fval('tag_'.$tag), 50, 'tag_'.$tag, false);
+                    echo tag_format_input_box($tag_fields[$tag], fval('tag_'.$tag), 50, 'tag_'.$tag);
                 }
             ?>
             </ul>
Index: www/views/task_tags.php
===================================================================
--- www/views/task_tags.php	(revision 1082)
+++ www/views/task_tags.php	(working copy)
@@ -45,18 +45,25 @@
 $column_infos = array(
     array(
         'title' => 'Tag',
-        'rowform' => 'format_tag_name'
+        'rowform' => 'format_tag_name',
+        'css_class' => 'tag-name',
     ),
     array(
+        'title' => 'Numar probleme',
+        'key' => 'task_count',
+        'css_class' => 'tag-task-count',
+    ),
+    array(
         'title' => 'Operatii',
         'rowform' => 'format_operations',
+        'css_class' => 'tag-operations',
     ),
 );
 
 ?>
 
 <h1>Editare taguri algoritmi</h1>
-<div id="add_category" class="task_tag_actions">
+<div id="add_category" class="task-tag-actions">
 [<a href="#">Adauga categorie noua</a><?php
     echo inline_post_form(url_task_tags_add(), array("type" => "method"), "", "Adauga");
 ?>]
@@ -65,7 +72,7 @@
 foreach ($categories as $category) {
 ?>
     <h2><?php echo html_escape($category["name"]); ?></h2>
-    <ul class="task_tag_actions">
+    <ul class="task-tag-actions">
         <li class="algorithm_tag_add">[<a class="toggle_add" href="#">Adauga tag nou</a><?php
             echo inline_post_form(url_task_tags_add(),
                 array("type" => "algorithm", "parent" => $category["id"]),
@@ -81,7 +88,7 @@
     </ul>
     <?php
     echo format_table($category["sub_tags"], $column_infos,
-        array('css_class' => 'category fill-screen'));
+        array('css_class' => 'category fill-screen tag-table'));
     ?>
 <?php
 }
