Index: /extensions/bbcode_bar/bbcode_bar.inc.php
===================================================================
--- /extensions/bbcode_bar/bbcode_bar.inc.php	(revision 20795)
+++ /extensions/bbcode_bar/bbcode_bar.inc.php	(revision 20796)
@@ -3,5 +3,5 @@
 
 // add BBCodeBar to textarea
-function set_bbcode_bar($prefilter='picture')
+function set_bbcode_bar($prefilter='picture', $textarea_id='contentid')
 {
   global $template, $conf, $pwg_loaded_plugins, $page;
@@ -9,12 +9,54 @@
   load_language('plugin.lang', dirname(__FILE__) . '/');
   $conf_bbcode_bar = unserialize($conf['bbcode_bar']);
-
+  
+  
   // buttons
-  foreach(unserialize(BBcode_codes) as $key) 
-  {
-    if ($conf_bbcode_bar[$key]) $template->assign('BBC_'.$key, true);
-  }
-
-  $template->assign('BBCODE_PATH', BBcode_PATH);
+  $tpl_codes = array();
+  foreach (unserialize(BBcode_codes) as $key) 
+  {
+    $tpl_codes[$key] = (bool)$conf_bbcode_bar[$key];
+  }
+  $tpl_codes['smilies'] = isset($pwg_loaded_plugins['SmiliesSupport']);
+  
+  
+  // calculate separators between groups
+  $groups = array(
+    array('b','i','u','s'),
+    array('p','center','right','quote'),
+    array('ol','ul'),
+    array('img','url','email'),
+    array('size','color','smilies'),
+    );
+    
+  $tpl_groups = array();
+  $count = 0;
+  for ($i=0; $i<count($groups)-1; $i++)
+  {
+    $separator = false;
+    foreach ($groups[$i] as $code)
+    {
+      if ($tpl_codes[$code]) $count++;
+    }
+    if ($count>0)
+    {
+      foreach ($groups[$i+1] as $code)
+      {
+        if ($tpl_codes[$code]) $separator = true;
+      }
+    }
+    if ($separator)
+    {
+      $tpl_groups[$i] = true;
+      $count = 0;
+    }
+  }
+  
+  $template->assign(array(
+    'BBC' => $tpl_codes,
+    'SEP' => $tpl_groups,
+    'BBCODE_PATH' => BBcode_PATH,
+    'BBCODE_ID' => $textarea_id,
+    ));
+  
   $template->set_prefilter($prefilter, 'set_bbcode_bar_prefilter');    
 
@@ -22,5 +64,4 @@
   if (isset($pwg_loaded_plugins['SmiliesSupport'])) 
   {
-    $template->assign('BBC_smilies', true);
     set_smiliessupport($prefilter);
   }  
@@ -29,5 +70,5 @@
 function set_bbcode_bar_prefilter($content, &$smarty)
 {
-  $search = '#(<div id="guestbookAdd">|<div id="commentAdd">)#';
+  $search = '#(<div id="guestbookAdd">|<div id="commentAdd">|<div class="contact">)#';
   $replace = file_get_contents(BBcode_PATH.'/template/bbcode_bar.tpl').'$1';
   return preg_replace($search, $replace, $content);
Index: /extensions/bbcode_bar/main.inc.php
===================================================================
--- /extensions/bbcode_bar/main.inc.php	(revision 20795)
+++ /extensions/bbcode_bar/main.inc.php	(revision 20796)
@@ -21,4 +21,5 @@
   remove_event_handler('render_comment_content', 'render_comment_content');
   add_event_handler('render_comment_content', 'BBCodeParse');
+  add_event_handler('render_contact_content', 'BBCodeParse');
   add_event_handler('loc_after_page_header', 'add_bbcode_bar');
 }
@@ -31,4 +32,5 @@
   {
     $prefilter = 'picture';
+    $textarea_id = 'contentid';
   }
   else if (
@@ -38,13 +40,20 @@
   {
     $prefilter = 'comments_on_albums';
+    $textarea_id = 'contentid';
   }
   else if (isset($page['section']) and $page['section'] == 'guestbook') 
   {
     $prefilter = 'index';
+    $textarea_id = 'contentid';
+  }
+  else if (isset($page['section']) and $page['section'] == 'contact') 
+  {
+    $prefilter = 'index';
+    $textarea_id = 'cf_content';
   }
   
   if (isset($prefilter))
   {
-    set_bbcode_bar($prefilter);
+    set_bbcode_bar($prefilter, $textarea_id);
   }
 }
Index: /extensions/bbcode_bar/template/bbcode_bar.tpl
===================================================================
--- /extensions/bbcode_bar/template/bbcode_bar.tpl	(revision 20795)
+++ /extensions/bbcode_bar/template/bbcode_bar.tpl	(revision 20796)
@@ -7,31 +7,31 @@
     {counter start=0 print=false assign=bbc_counter}
     
-    {if isset($BBC_b)}{counter}{ldelim}name:'{'Bold : [b]bold[/b]'|@translate}', key:'B', openWith:'[b]', closeWith:'[/b]', className:'markItUpBold'},{/if}
-    {if isset($BBC_i)}{counter}{ldelim}name:'{'Italic : [i]italic[/i]'|@translate}', key:'I', openWith:'[i]', closeWith:'[/i]', className:'markItUpItalic'},{/if}
-    {if isset($BBC_u)}{counter}{ldelim}name:'{'Underline : [u]underline[/u]'|@translate}', key:'U', openWith:'[u]', closeWith:'[/u]', className:'markItUpUnderline'},{/if}
-    {if isset($BBC_s)}{counter}{ldelim}name:'{'Striped  : [s]striped[/s]'|@translate}', key:'S', openWith:'[s]', closeWith:'[/s]', className:'markItUpStroke'},{/if}
+    {if $BBC.b}{counter}{ldelim}name:'{'Bold : [b]bold[/b]'|@translate}', key:'B', openWith:'[b]', closeWith:'[/b]', className:'markItUpBold'},{/if}
+    {if $BBC.i}{counter}{ldelim}name:'{'Italic : [i]italic[/i]'|@translate}', key:'I', openWith:'[i]', closeWith:'[/i]', className:'markItUpItalic'},{/if}
+    {if $BBC.u}{counter}{ldelim}name:'{'Underline : [u]underline[/u]'|@translate}', key:'U', openWith:'[u]', closeWith:'[/u]', className:'markItUpUnderline'},{/if}
+    {if $BBC.s}{counter}{ldelim}name:'{'Striped  : [s]striped[/s]'|@translate}', key:'S', openWith:'[s]', closeWith:'[/s]', className:'markItUpStroke'},{/if}
     
-    {if (isset($BBC_p) OR isset($BBC_center) OR isset($BBC_right) OR isset($BBC_quote)) AND $bbc_counter>0}{counter start=0 print=false assign=bbc_counter}{ldelim}separator:'|'},{/if}
+    {if $SEP[0]}{counter}{ldelim}separator:'|'},{/if}
     
-    {if isset($BBC_p)}{counter}{ldelim}name:'{'Paragraph : [p]Paragraph[/p]'|@translate}', openWith:'[p]', closeWith:'[/p]', className:'markItUpParagraph'},{/if}
-    {if isset($BBC_center)}{counter}{ldelim}name:'{'Center : [center]center[/center]'|@translate}', openWith:'[center]', closeWith:'[/center]', className:'markItUpCenter'},{/if}
-    {if isset($BBC_right)}{counter}{ldelim}name:'{'Right : [right]right[/right]'|@translate}', openWith:'[right]', closeWith:'[/right]', className:'markItUpRight'},{/if}
-    {if isset($BBC_quote)}{counter}{ldelim}name:'{'Quote : [quote]quote[/quote]'|@translate}', openWith:'[quote]', closeWith:'[/quote]', className:'markItUpQuote'},{/if}
+    {if $BBC.p}{counter}{ldelim}name:'{'Paragraph : [p]Paragraph[/p]'|@translate}', openWith:'[p]', closeWith:'[/p]', className:'markItUpParagraph'},{/if}
+    {if $BBC.center}{counter}{ldelim}name:'{'Center : [center]center[/center]'|@translate}', openWith:'[center]', closeWith:'[/center]', className:'markItUpCenter'},{/if}
+    {if $BBC.right}{counter}{ldelim}name:'{'Right : [right]right[/right]'|@translate}', openWith:'[right]', closeWith:'[/right]', className:'markItUpRight'},{/if}
+    {if $BBC.quote}{counter}{ldelim}name:'{'Quote : [quote]quote[/quote]'|@translate}', openWith:'[quote]', closeWith:'[/quote]', className:'markItUpQuote'},{/if}
     
-    {if (isset($BBC_ul) OR isset($BBC_ol) OR isset($BBC_li)) AND $bbc_counter>0}{counter start=0 print=false assign=bbc_counter}{ldelim}separator:'|'},{/if}
+    {if $SEP[1]}{counter}{ldelim}separator:'|'},{/if}
     
-    {if isset($BBC_ul)}{counter}{ldelim}name:'{'Unordered list : [ul][li]element[/li][/ul]'|@translate}', openWith:'[ul]\n', closeWith:'\n[/ul]', className:'markItUpListUL'},{/if}
-    {if isset($BBC_ol)}{counter}{ldelim}name:'{'Ordered list : [ol][li]element[/li][/ol]'|@translate}', openWith:'[ol]\n', closeWith:'\n[/ol]', className:'markItUpListOL'},{/if}
-    {if isset($BBC_ul) OR isset($BBC_ol)}{counter}{ldelim}name:'{'List element : [li]element[/li]'|@translate}', openWith:'[li]', closeWith:'[/li]', className:'markItUpListLI'},{/if}
+    {if $BBC.ul}{counter}{ldelim}name:'{'Unordered list : [ul][li]element[/li][/ul]'|@translate}', openWith:'[ul]\n', closeWith:'\n[/ul]', className:'markItUpListUL'},{/if}
+    {if $BBC.ol}{counter}{ldelim}name:'{'Ordered list : [ol][li]element[/li][/ol]'|@translate}', openWith:'[ol]\n', closeWith:'\n[/ol]', className:'markItUpListOL'},{/if}
+    {if $BBC.ul OR $BBC.ol}{counter}{ldelim}name:'{'List element : [li]element[/li]'|@translate}', openWith:'[li]', closeWith:'[/li]', className:'markItUpListLI'},{/if}
     
-    {if (isset($BBC_img) OR isset($BBC_url) OR isset($BBC_mail)) AND $bbc_counter>0}{counter start=0 print=false assign=bbc_counter}{ldelim}separator:'|' },{/if}
+    {if $SEP[2]}{counter}{ldelim}separator:'|' },{/if}
     
-    {if isset($BBC_img)}{counter}{ldelim}name:'{'Picture : [img]picture[/img]'|@translate}', key:'P', replaceWith:'[img][![Url]!][/img]', className:'markItUpPicture'},{/if}
-    {if isset($BBC_url)}{counter}{ldelim}name:'{'URL : [url=URL]Title[/url]'|@translate}', key:'L', openWith:'[url=[![Url]!]]', closeWith:'[/url]', className:'markItUpLink'},{/if}
-    {if isset($BBC_email)}{counter}{ldelim}name:'{'E-mail : [email]Email[/email]'|@translate}', key:'M', replaceWith:'[email][![Mail]!][/email]', className:'markItUpMail'},{/if}
+    {if $BBC.img}{counter}{ldelim}name:'{'Picture : [img]picture[/img]'|@translate}', key:'P', replaceWith:'[img][![Url]!][/img]', className:'markItUpPicture'},{/if}
+    {if $BBC.url}{counter}{ldelim}name:'{'URL : [url=URL]Title[/url]'|@translate}', key:'L', openWith:'[url=[![Url]!]]', closeWith:'[/url]', className:'markItUpLink'},{/if}
+    {if $BBC.email}{counter}{ldelim}name:'{'E-mail : [email]Email[/email]'|@translate}', key:'M', replaceWith:'[email][![Mail]!][/email]', className:'markItUpMail'},{/if}
     
-    {if (isset($BBC_size) OR isset($BBC_color) OR isset($BBC_smilies)) AND $bbc_counter>0}{counter start=0 print=false assign=bbc_counter}{ldelim}separator:'|'},{/if}
+    {if $SEP[3]}{counter}{ldelim}separator:'|'},{/if}
     
-    {if isset($BBC_size)}{counter}
+    {if $BBC.size}{counter}
     {ldelim}name:'{'Font size : [size=X]text[/size]'|@translate}', className:'markItUpSize',
       dropMenu :[
@@ -44,5 +44,5 @@
     },
     {/if}
-    {if isset($BBC_color)}{counter}
+    {if $BBC.color}{counter}
     {ldelim}name:'{'Font color : [color=color]text[/color]'|@translate}', className:'markItUpColors', openWith:'[color=[![Color]!]]', closeWith:'[/color]', 
       dropMenu: [
@@ -65,5 +65,6 @@
 
 jQuery(document).ready(function() {ldelim}
-  jQuery('#contentid').markItUp(BBCodeBar);
+  jQuery('#{$BBCODE_ID}').markItUp(BBCodeBar);
+  jQuery('.markItUpHeader>ul').css('width', {$bbc_counter}*22);
 });
 {/footer_script}
