Index: /extensions/ExtendedDescription/main.inc.php
===================================================================
--- /extensions/ExtendedDescription/main.inc.php	(revision 19281)
+++ /extensions/ExtendedDescription/main.inc.php	(revision 19282)
@@ -137,20 +137,16 @@
 
   // Balises [img=xx.yy,xx.yy,xx.yy;left|right|;name|titleName|]
-  //$patterns[] = '#\[img=(\d*)\.?(\d*|);?(left|right|);?(name|titleName|)\]#ie';
   $patterns[] = '#\[img=([\d\s\.,]*);?(left|right|);?(name|titleName|)\]#ie';
   $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_img_thumb("$1", "$2", "$3")';
   
   // Balises [photo id=xx album=yy size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no]
-  // $patterns[] = '#\[photo(?:(?:\s+(id)=(\d+))|(?:\s+(album)=(\d+))|(?:\s+(size)=(SQ|TH|XXS|XS|S|M|L|XL|XXL))|(?:\s+(html)=(yes|no))|(?:\s+(link)=(yes|no))){1,5}\s*\]#ie'; //10
   $patterns[] = '#\[photo ([^\]]+)\]#ie';
   $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_photo_sized("$1")';
 
   // Balises [random album=xx size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no]
-  // $patterns[] = '#\[random(?:(?:\s+(album|cat)=(\d+))|(?:\s+(size)=(SQ|TH|XXS|XS|S|M|L|XL|XXL))|(?:\s+(html)=(yes|no))|(?:\s+(link)=(yes|no))){1,4}\s*\]#ie'; //8
-  $patterns[] = '#\[random ([^\]]+)\]#ie';
+  $patterns[] = '#\[random([^\]]*)\]#ie';
   $replacements[] = ($param == 'subcatify_category_description') ? '' : 'extdesc_get_random_photo("$1")';
   
   // Balises [slider album=xx nb_images=yy random=yes|no list=aa,bb,cc size=SQ|TH|XXS|XS|S|M|L|XL|XXL speed=z title=yes|no effect=... arrows=yes|no control=yes|no elastic=yes|no]
-  // $patterns[] = '#\[slider(?:(?:\s+(album)=(\d+))|(?:\s+(nb_images)=(\d+))|(?:\s+(random)=(yes|no))|(?:\s+(list)=([\d,]+))|(?:\s+(size)=(SQ|TH|XXS|XS|S|M|L|XL|XXL))|(?:\s+(speed)=(\d+))|(?:\s+(title)=(yes|no))|(?:\s+(effect)=([a-zA-Z]+))|(?:\s+(arrows)=(yes|no))|(?:\s+(control)=(yes|no))|(?:\s+(elastic)=(yes|no))){1,11}\s*\]#ie'; //22
   $patterns[] = '#\[slider ([^\]]+)\]#ie';
   $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_slider("$1")';
@@ -490,5 +486,5 @@
  * Return html code for a random photo
  *
- * @int    album: select picture from this album
+ * @int    album: select picture from this album (default: all)
  * @string size:  picture size                   (default: M)
  * @string html:  return complete html structure (default: yes)
@@ -508,7 +504,6 @@
   
   // check album id
-  if (empty($params['album']))
-  {
-    if (empty($params['cat'])) return 'missing album id';
+  if ( empty($params['album']) and !empty($params['cat']) )
+  {
     $params['album'] = $params['cat'];
   }
@@ -516,8 +511,19 @@
   // get picture id
   $query = '
-SELECT id
+SELECT id, category_id
   FROM '.IMAGES_TABLE.'
     JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id
-  WHERE category_id = '.$params['album'].'
+  WHERE 
+    '.(empty($params['album']) ? '1=1': 'category_id = '.$params['album']);
+    
+  $query.= ' '.get_sql_condition_FandF(array(
+                  'forbidden_categories' => 'category_id',
+                  'visible_categories' => 'category_id',
+                  'visible_images' => 'id'
+                  ),
+                'AND'
+                );
+  
+  $query.= '
   ORDER BY '.DB_RANDOM_FUNCTION.'()
   LIMIT 1
@@ -527,6 +533,6 @@
   if (pwg_db_num_rows($result))
   {
-    list($img_id) = pwg_db_fetch_row($result);
-    return get_photo_sized('id='.$img_id.' album='.$params['album'].' size='.$params['size'].' html='.$params['html'].' link='.$params['link']);
+    list($params['id'], $params['album']) = pwg_db_fetch_row($result);
+    return get_photo_sized($params);
   }
 
@@ -549,5 +555,5 @@
  * @string arrows:    display navigation arrows         (default: yes)
  * @string control:   display navigation bar            (default: yes)
- * @string elastic:   adapt slider size to each picture (default: no)
+ * @string elastic:   adapt slider size to each picture (default: yes)
  */
 function get_slider($param)
@@ -566,5 +572,5 @@
     'arrows' =>    array('yes|no', 'yes'),
     'control' =>   array('yes|no', 'yes'),
-    'elastic' =>   array('yes|no', 'no'),
+    'elastic' =>   array('yes|no', 'yes'),
     );
     
@@ -577,15 +583,13 @@
   
   // parameters
-  $params['arrows'] = $params['arrows']==='no' ? 'false' : 'true';
-  $params['control'] = $params['control']==='no' ? 'false' : 'true';
+  $params['arrows'] = $params['arrows']==='yes' ? 'true' : 'false';
+  $params['control'] = $params['control']==='yes' ? 'true' : 'false';
   $params['elastic'] = $params['elastic']==='yes' ? true : false;
   $params['title'] = $params['title']==='yes' ? true : false;
+  $params['random'] = $params['random']==='yes' ? true : false;
   
   // pictures from album...
   if (!empty($params['album']))
   {
-    // parameters
-    $params['random'] = $params['random']==='yes' ? true : false;
-    
     // get image order inside category
     if ($params['random'])
@@ -689,4 +693,9 @@
 function parse_parameters($param, $default_params)
 {
+  if (is_array($param))
+  {
+    return $param;
+  }
+  
   $params = array();
   
Index: /extensions/ExtendedDescription/template/slider.tpl
===================================================================
--- /extensions/ExtendedDescription/template/slider.tpl	(revision 19281)
+++ /extensions/ExtendedDescription/template/slider.tpl	(revision 19282)
@@ -24,11 +24,14 @@
 {/footer_script}
 
-{if not $elastic_size}
-{assign var=slider_min_h value=$img_size.h}
+{if $elastic_size}
+{assign var=slider_full_height value=0}
+{else}
+{assign var=slider_full_height value=$img_size.h}
 {/if}
+{assign var=slider_full_width value=0}
 
-<div class="slider-wrapper theme-default" style="width:{$img_size.w}px;{if $elastic_size}height:{math equation='x+y' x=$img_size.h y=40}px;{/if}">
-  <div id="slider{$slider_id}" class="nivoSlider" style="width:{$img_size.w}px;{if $elastic_size}height:{$img_size.h}px;{/if}">
-  {foreach from=$slider_content item=thumbnail}{strip}
+<div class="slider-wrapper theme-default">
+  <div id="slider{$slider_id}" class="nivoSlider">
+  {foreach from=$slider_content item=thumbnail name=slider}{strip}
     {assign var=derivative value=$pwg->derivative($derivative_params, $thumbnail.src_image)}
     {if !$derivative->is_cached()}
@@ -39,17 +42,29 @@
     <img {if $derivative->is_cached()}src="{$derivative->get_url()}"{else}src="" data-src="{$derivative->get_url()}"{/if} alt="{$thumbnail.TN_ALT}" {$derivative->get_size_htm()} {if $show_title}title="<a href='{$thumbnail.URL}'>{$thumbnail.NAME|replace:'"':"'"}</a>"{/if}>
     
-    {if not $elastic_size}
     {assign var=derivative_size value=$derivative->get_size()}
-    {math assign=slider_min_h equation="min(x,y)" x=$slider_min_h y=$derivative_size[1]}
-    {/if}
-  {/strip}{/foreach}
+    {math assign=slider_full_width equation="max(x,y)" x=$slider_full_width y=$derivative_size[0]}
+  {if $elastic_size}
+    {math assign=slider_full_height equation="max(x,y)" x=$slider_full_height y=$derivative_size[1]}
+  {else}
+    {math assign=slider_full_height equation="min(x,y)" x=$slider_full_height y=$derivative_size[1]}
+  {/if}
+  {if $smarty.foreach.slider.first}
+    {assign var=slider_init_width value=$derivative_size[0]}
+    {assign var=slider_init_height value=$derivative_size[1]}
+  {/if}
+  
+  {/strip}
+  {/foreach}
   </div>
 </div>
 
-{if not $elastic_size}
 {footer_script}
+$("#slider{$slider_id}").parent(".slider-wrapper").css({ldelim}
+  height: {$slider_full_height}{if $controlNav=='true'}+40{/if},
+  width: {$slider_full_width}
+});
 $("#slider{$slider_id}").css({ldelim}
-  height: {$slider_min_h}
+  height: {if $elastic_size}{$slider_init_height}{else}{$slider_full_height}{/if},
+  width: {$slider_init_width}
 });
 {/footer_script}
-{/if}
