Index: extensions/metasimple/main.inc.php
===================================================================
--- extensions/metasimple/main.inc.php	(revision 7470)
+++ extensions/metasimple/main.inc.php	(revision 7517)
@@ -18,18 +18,38 @@
 
 
-add_event_handler('loc_begin_page_header', 'add_metadesc' );
-function add_metadesc()
-{
-  global $template, $page, $meta_infosdesc;
+add_event_handler('loc_begin_page_header', 'add_metadescacc',55);
+add_event_handler('loc_begin_page_header', 'add_metadesccat',60);
+add_event_handler('loc_begin_page_header', 'add_metadescimg',70);
+add_event_handler('loc_after_page_header', 'set_metadesc_back',80);
 
-  $meta_infosdesc = array();
-  $meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE');
-  $meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE');
+function add_metadescacc()
+  //meta homepage
+	{
+		global $template, $page, $meta_infosdesc;
+	$meta_infosdesc = array();
+	$meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE');
+	$meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE');
+	$meta_infosdesc['comment'] = $template->get_template_vars('COMMENT_IMG');
+  
+  if (isset($page['section']) and $page['section'] == 'categories' and empty($page['category']['id']))
+		{
+		$descindex='ttz';
+  				if (!empty($descindex))
+					{
+						$template->assign('COMMENT_IMG', $descindex);
+						$template->clear_assign('INFO_FILE');
+					}
+		}
+	}
 
- 
-  //meta categories
-  if ( !empty($page['category']['id']) )   
-  {
-
+function add_metadesccat()
+	{
+		global $template, $page, $meta_infosdesc;
+	$meta_infosdesc = array();
+	$meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE');
+	$meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE');
+	$meta_infosdesc['comment'] = $template->get_template_vars('COMMENT_IMG');
+			  if ( !empty($page['category']['id']) )   
+				{
     $query = '
     select id,comment
@@ -39,14 +59,21 @@
     $result = pwg_query($query);
     $row = mysql_fetch_array($result);
-    if (!empty($row['comment']))
-    {
-      $template->assign('COMMENT_IMG', $row['comment']);
-	  $template->clear_assign('INFO_FILE');
-    }
-  }
-  
-    //meta images
-  if ( !empty($page['image_id']) )   
-  {
+		if (!empty($row['comment']))
+			{
+				$template->assign('COMMENT_IMG', $row['comment']);
+				$template->clear_assign('INFO_FILE');
+			}
+				}
+	}
+
+function add_metadescimg()
+	{
+		global $template, $page, $meta_infosdesc;
+	$meta_infosdesc = array();
+	$meta_infosdesc['info'] = $template->get_template_vars('INFO_FILE');
+	$meta_infosdesc['page'] = $template->get_template_vars('PAGE_TITLE');
+	$meta_infosdesc['comment'] = $template->get_template_vars('COMMENT_IMG');
+			  if ( !empty($page['image_id']) )   
+				{
     $query = '
     select id,comment
@@ -56,35 +83,23 @@
     $result = pwg_query($query);
     $row = mysql_fetch_array($result);
-    if (!empty($row['comment']))
-    {
-      $template->assign('COMMENT_IMG', $row['comment']);
-	  $template->clear_assign('INFO_FILE');
-    }
-	
-  }
+		if (!empty($row['comment']))
+			{
+				$template->assign('COMMENT_IMG', $row['comment']);
+				$template->clear_assign('INFO_FILE');
+			}
+				}
+	}
+
+function set_metadesc_back()
+	{
+		global $template, $meta_infosdesc;
   
-  //meta homepage
-  if (isset($page['section']) and $page['section'] == 'categories' and empty($page['category']['id']))
-  {
-  $descindex='';
-  
-    if (!empty($descindex))
-    {
-      $template->assign('COMMENT_IMG', $descindex);
-	  $template->clear_assign('INFO_FILE');
-    }
-  }
-
-}
-
-add_event_handler('loc_after_page_header', 'set_metadesc_back');
-function set_metadesc_back()
-{
-  global $template, $meta_infosdesc;
-  
-  $template->assign(array(
-    'INFO_FILE'    => $meta_infosdesc['info']
-    )
-  );
-}
+		$template->assign
+			(array
+				(
+		'INFO_FILE'    => $meta_infosdesc['info'],
+		'COMMENT_IMG'    => $meta_infosdesc['comment']
+				)
+			);
+	}
 ?>
