--- storm.theme.inc.09112011	2011-11-10 00:07:35.000000000 +0100
+++ storm.theme.inc	2011-11-13 23:20:27.000000000 +0100
@@ -118,7 +118,47 @@
   return $o;
 }
 
+/*RH@C /
+/**
+*Count number of tasks, notes, timetrackings and tickets per project.
+*
+*$source_module
+* A string of module where the request is comming from
+*
+*$destination_module 
+* A string with name of targeted module
+*
+*$project_nid
+* id of project
+* 
+*/
+function number_of_items($source_module, $destination_module, $project_nid) {
+ $nmb_of_items = ''; 
+ if ($source_module == 'stormproject')
+ {
+  switch ($destination_module)
+  {
+  case 'stormtask':
+   $qr = "SELECT COUNT(*) FROM node AS n INNER JOIN $destination_module AS sta ON n.vid=sta.vid WHERE n.status=1 AND n.type='stormtask' and sta.project_nid = '%d'";
+  break;
+  case 'stormnote':
+   $qr = "select count(*) from $destination_module where `project_nid` = '%d'";
+  break;
+  case 'stormticket':
+   $qr = "select count(*) from $destination_module where `project_nid` = '%d'";
+  break;
+  case 'stormtimetracking':
+   $qr = "select count(*) from $destination_module where `project_nid` = '%d'";
+  break;
+  }
+  $nmb_of_items = db_result(db_query($qr, $project_nid));
+ }
+ return $nmb_of_items;
+}
+/*end of RH@C*/
+
 function theme_storm_link($source_module='', $destination_module='', $node_nid=0, $weight=0) {
+
   switch ($source_module) {
  
    case "stormorganization":
@@ -138,6 +178,8 @@
       break;
   }
 
+
+
   switch ($destination_module) {
     case "stormattribute":
       $user_access_check = 'Storm: access administration pages';
@@ -191,6 +233,7 @@
       $add_icon_type = 'stormnote';
       $add_path = 'node/add/'. $destination_module;
       $dt_id = 'stormnotes';
+      $nmb_itms = number_of_items($source_module, $destination_module, $node_nid);
       break;
 
     case "stormorganization":
@@ -227,6 +270,7 @@
       $add_icon_type = 'stormtask';
       $add_path = 'node/add/'. $destination_module;
       $dt_id = 'stormtasks';
+      $nmb_itms = number_of_items($source_module, $destination_module, $node_nid);
       break;
 
     case "stormteam":
@@ -245,6 +289,7 @@
       $add_icon_type = 'stormticket';
       $add_path = 'node/add/'. $destination_module;
       $dt_id = 'stormtickets';
+      $nmb_itms = number_of_items($source_module, $destination_module, $node_nid);
       break;
 
     case "stormtimetracking":
@@ -255,7 +300,7 @@
       $node_links_key = 'timetrackings';
       $add_path = 'node/add/'. $destination_module;
       $dt_id = 'stormtimetrackings';
-
+      $nmb_itms = number_of_items($source_module, $destination_module, $node_nid);
       break;
   }
 
@@ -289,7 +334,7 @@
     else {
       $r = array(
         '#prefix' => variable_get('storm_icons_display', TRUE) ? '<dt id="'. $dt_id .'" class="stormcomponent">' : '<dt class="stormcomponent">',
-        '#suffix' => '</dt>',
+        '#suffix' => $nmb_itms.'</dt>',
         '#value' => $v,
         '#weight' => $weight,
       );
