Index: /extensions/SmiliesSupport/main.inc.php
===================================================================
--- /extensions/SmiliesSupport/main.inc.php	(revision 11293)
+++ /extensions/SmiliesSupport/main.inc.php	(revision 11294)
@@ -18,10 +18,12 @@
 add_event_handler('loc_after_page_header', 'add_smiliessupport');
 
-function add_smiliessupport() {
+function add_smiliessupport() 
+{
   global $page, $pwg_loaded_plugins;
   
-  if (!isset($pwg_loaded_plugins['bbcode_bar']) 
-    AND isset($page['body_id']) AND $page['body_id'] == 'thePicturePage')
-  {
+  if (
+    !isset($pwg_loaded_plugins['bbcode_bar']) 
+    AND isset($page['body_id']) AND $page['body_id'] == 'thePicturePage'
+  ) {
     set_smiliessupport();
   }
@@ -35,5 +37,6 @@
     array_push($menu, array(
       'NAME' => 'Smilies Support',
-      'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_DIR));
+      'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_DIR
+    ));
     return $menu;
   }
Index: /extensions/SmiliesSupport/smiliessupport.inc.php
===================================================================
--- /extensions/SmiliesSupport/smiliessupport.inc.php	(revision 11293)
+++ /extensions/SmiliesSupport/smiliessupport.inc.php	(revision 11294)
@@ -5,9 +5,36 @@
 function set_smiliessupport()
 {
-  global $conf, $lang;
+  global $conf, $template, $page;
+  
+  load_language('plugin.lang', SMILIES_PATH);
   $conf_smiliessupport = explode(',' , $conf['smiliessupport']);
   
   $smilies = get_smilies($conf_smiliessupport);
-  $lang['Comment'] .= SmiliesTable($conf_smiliessupport, $smilies);  
+  
+  // edit field has different id
+  // if (
+    // (isset($_GET['action']) AND $_GET['action'] == 'edit_comment') 
+    // OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')
+  // ) {
+    // $template->assign('smilies_textarea', 'contenteditid');
+  // } else {
+    // $template->assign('smilies_textarea', 'contentid');
+  // }
+  $template->assign('smilies_textarea', 'contentid');
+  
+  $template->assign(array(
+    'SMILIES_PATH' => SMILIES_PATH,
+    'REPRESENTANT' => PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2],
+    'smiliesfiles' => $smilies,
+  ));
+  
+  $template->set_prefilter('picture', 'set_smiliessupport_prefilter');  
+}
+
+function set_smiliessupport_prefilter($content, &$smarty)
+{
+  $search = "<label>{'Comment'|@translate}";
+  $replace = file_get_contents(SMILIES_PATH.'/template/smiliessupport_page.tpl').$search;
+  return str_replace($search, $replace, $content);
 }
 
@@ -34,34 +61,9 @@
     
     return $smilies;
-  } else {
+  } 
+  else 
+  {
     return false;
   }
-}
-
-// get the smilies button ## must received the unserialized configuration array AND the smilies array
-function SmiliesTable($conf_smiliessupport, $smilies)
-{
-  global $template;
-  load_language('plugin.lang', SMILIES_PATH);
-
-  // edit field has different id
-  // if (
-    // (isset($_GET['action']) AND $_GET['action'] == 'edit_comment') 
-    // OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')
-  // ) {
-    // $template->assign('form_name', 'editComment');
-  // } else {
-    // $template->assign('form_name', 'addComment');
-  // }
-  $template->assign('form_name', 'addComment');
-
-  $template->assign(array(
-    'SMILIES_PATH' => SMILIES_PATH,
-    'REPRESENTANT' => PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2],
-    'smiliesfiles' => $smilies,
-  ));
-  
-  $template->set_filename('smiliessupport_page', dirname(__FILE__).'/template/smiliessupport_page.tpl');
-  return $template->parse('smiliessupport_page', true);
 }
 
@@ -74,4 +76,5 @@
   $def_path = $conf_smiliessupport[0].'/smilies.txt';
   $accepted_ext = array('gif', 'jpg', 'png');
+  $str = ' '.$str;
   
   if ($handle = opendir(PHPWG_ROOT_PATH.$conf_smiliessupport[0]))
@@ -79,7 +82,9 @@
     while (false !== ($file = readdir($handle)))
     { 
-      if ($file != "." && $file != ".." && in_array(get_extension($file), $accepted_ext)) {
-        $v = ':'.get_filename_wo_extension($file).':'; 
-        $s = '<img src="'.$conf_smiliessupport[0].'/'.$file.'" alt=":'.get_filename_wo_extension($file).':" title=":'.get_filename_wo_extension($file).':"/>';
+      if ($file != "." && $file != ".." && in_array(get_extension($file), $accepted_ext)) 
+      {
+        $filename = get_filename_wo_extension($file);
+        $v = ':'.$filename.':'; 
+        $s = '<img src="'.$conf_smiliessupport[0].'/'.$file.'" alt=":'.$filename.':"/>';
         $str = str_replace($v, $s, $str);
       }
@@ -93,13 +98,15 @@
     {
       $v = trim($v);
-      if (preg_match('|^([^\t]*)[\t]+(.*)$|',$v,$matches)) {  
-        $r = '#'.preg_quote($matches[1],'/').'#';          
-        $t = '<img src="'.$conf_smiliessupport[0].'/'.$matches[2].'" alt=":'.get_filename_wo_extension($matches[2]).':" title=":'.get_filename_wo_extension($matches[2]).':"/>';
-        $str = preg_replace($r, $t, $str);
+      if (preg_match('#^([^\t]+)[ \t]+(.+)$#', $v, $matches)) 
+      {  
+        $filename = get_filename_wo_extension($matches[2]);
+        $v = '#[^"]'.preg_quote($matches[1],'/').'#';          
+        $t = '<img src="'.$conf_smiliessupport[0].'/'.$matches[2].'" alt=":'.$filename.':"/>';
+        $str = preg_replace($v, $t, $str);
       }
     }
   } 
   
-  return $str;
+  return trim($str);
 }
 
Index: /extensions/SmiliesSupport/template/markitup/style.markitup.css
===================================================================
--- /extensions/SmiliesSupport/template/markitup/style.markitup.css	(revision 11293)
+++ /extensions/SmiliesSupport/template/markitup/style.markitup.css	(revision 11294)
@@ -1,82 +1,82 @@
 /* common */
 .markItUp {
-	display:inline-block;
+  display:inline-block;
 }
 .markItUp * {
-	margin:0px; padding:0px;
-	outline:none;
+  margin:0px; padding:0px;
+  outline:none;
 }
 .markItUp a:link,
 .markItUp a:visited {
-	color:#000;
-	text-decoration:none;
+  color:#000;
+  text-decoration:none;
 }
 .markItUp textarea {
-	display:block;
+  display:block;
 }
 .markItUpContainer  {
-	font:11px Verdana, Arial, Helvetica, sans-serif;
+  font:11px Verdana, Arial, Helvetica, sans-serif;
 }
 .markItUpEditor {
-	font:12px 'Courier New', Courier, monospace;
-	padding:5px;
-	clear:both;
-	overflow:auto;
+  font:12px 'Courier New', Courier, monospace;
+  padding:5px;
+  clear:both;
+  overflow:auto;
 }
 .markItUpFooter {
-	display:none;
+  display:none;
 }
 
 /* first row of buttons */
-.markItUpHeader ul li	{
-	list-style:none;
-	float:left;
-	position:relative;
+.markItUpHeader ul li  {
+  list-style:none;
+  float:left;
+  position:relative;
 }
 .markItUpHeader ul li:hover > ul{
-	display:block;
+  display:block;
 }
 /* next rows of buttons */
 .markItUpHeader ul ul {
-	display:none;
-	position:absolute;
-	top:22px; left:0px;	
-	background:#FFF;
-	border:1px solid #444;
-	border-radius:5px;
+  display:none;
+  position:absolute;
+  top:22px; left:0px;  
+  background:#FFF;
+  border:1px solid #444;
+  border-radius:5px;
 }
 .markItUpHeader ul ul li {
-	float:none;
-	margin:0px;
+  float:none;
+  margin:0px;
 }
 /* links */
 .markItUpHeader ul a {
-	display:block;
-	width:16px; height:16px;
-	text-indent:-10000px;
-	background-position:center center;
-	background-repeat:no-repeat;
-	padding:2px;
-	border:1px solid transparent;
+  display:block;
+  width:16px; height:16px;
+  text-indent:-10000px;
+  background-position:center center;
+  background-repeat:no-repeat;
+  padding:2px;
+  border:1px solid transparent;
 }
 .markItUpHeader ul a:hover {
-	border-color:#08e;
+  border-color:#08e;
 }
 .markItUpHeader ul ul a {
-	display:block;
-	text-indent:0;
-	border:0;
+  display:block;
+  text-indent:0;
+  border:0;
 }
 
 /* smiliessupport */
 #smiliesdiv a {
-	width:auto;	height:auto;
-	border:0;
+  width:auto;  height:auto;
+  border:0;
   padding:0;
 }
 #smiliesdiv img {
-	border:1px solid transparent;
+  border:1px solid transparent;
 }
 #smiliesdiv img:hover {
-	border-color:#08e;
+  border-color:#08e;
 }
Index: /extensions/SmiliesSupport/template/smiliessupport_page.tpl
===================================================================
--- /extensions/SmiliesSupport/template/smiliessupport_page.tpl	(revision 11293)
+++ /extensions/SmiliesSupport/template/smiliessupport_page.tpl	(revision 11294)
@@ -6,9 +6,9 @@
 jQuery(document).ready(function() {
   if (jQuery('.markItUp').length == 0) {
-    jQuery('#{/literal}{$form_name}{literal} textarea').markItUp({markupSet: []});
+    jQuery('#{/literal}{$smilies_textarea}{literal}').markItUp({markupSet: []});
   }
   jQuery('#SmiliesSupport').appendTo('.markItUpHeader ul:first-child');
-  jQuery('#allsmilies').mouseover(function(){ 
-    jQuery("#{/literal}{$form_name}{literal} textarea").focus();
+  jQuery('#allsmilies').hover(function(){ 
+    jQuery("#{/literal}{$smilies_textarea}{literal}").focus();
     jQuery('#smiliesdiv').css('display',''); 
   });
