Index: /extensions/hr_glass_xl/24x.pattern.php
===================================================================
--- /extensions/hr_glass_xl/24x.pattern.php	(revision 16380)
+++ /extensions/hr_glass_xl/24x.pattern.php	(revision 16380)
@@ -0,0 +1,7 @@
+<?php
+
+$pattern['hr_glass_xl_prefilter_picture']['S']['get_url']='{$current.selected_derivative->get_url()}';
+$pattern['hr_glass_xl_prefilter_picture']['R']['get_url']='{$der->get_url()}';
+$pattern['hr_glass_xl_prefilter_picture']['S']['get_size_htm']='{$current.selected_derivative->get_size_htm()';
+$pattern['hr_glass_xl_prefilter_picture']['R']['get_size_htm']='{$der->get_size_htm()';
+?>
Index: /extensions/hr_glass_xl/theme.css
===================================================================
--- /extensions/hr_glass_xl/theme.css	(revision 16379)
+++ /extensions/hr_glass_xl/theme.css	(revision 16380)
@@ -49,4 +49,29 @@
 	color: #000000;
 }
+#derivativeSwitchBox, #sortOrderBox {
+	font-size: 11px;
+	color: #000033;
+	text-shadow: 0 0 2px #ccc;
+	padding: 4px 8px;
+	border: 1px solid rgba(255,255,255,0.25);
+	background-color: rgb(255,255,255);
+	background-color: rgba(255,255,255,0.92);
+	background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#fff));
+	border-radius: 3px;
+	-webkit-border-radius: 3px;
+	-moz-border-radius: 3px;
+	box-shadow: 0 0 5px #555;
+	-webkit-box-shadow: 0 0 5px #555;
+	-moz-box-shadow: 0 0 5px #555;
+}
+#derivativeSwitchBox A, #sortOrderBox A {
+	color: #000;
+}
+
+#derivativeSwitchBox A:hover, #sortOrderBox A:hover {
+	text-shadow: 0 0 2px #000;
+}
+
+
 /* Page
 -------------------------------------------------------- */
@@ -56,5 +81,4 @@
 	width: 940px;
 	margin: 0 auto;
-	position: relative;
 	background: transparent url(img/fond_milieu.png) repeat-y top center;
 }
@@ -149,9 +173,14 @@
 	padding: 5px 8px;
 }
-
+#imageToolBar .imageNumber {
+    float: right;
+    margin: -30px 9px 0 0;
+}
 #theImage IMG {
   padding: 5px;
   border: 1px solid #aaa;
-}
+  margin-left: -10px;
+}
+#theMainImage {max-width:900px}
 
 #imageHeaderBar H2 { 
@@ -219,7 +248,6 @@
 position:absolute;
 }
-#menubar { position: relative; z-index: 2; }
-#content { position: relative; z-index: 1; }
-
+#menubar { position: relative; }
+#theHeader { position: relative; }
 #content div.thumbnailCategory div.description {
 	overflow: hidden; /* bug in FF 1.0 (not 1.5) */
Index: /extensions/hr_glass_xl/themeconf.inc.php
===================================================================
--- /extensions/hr_glass_xl/themeconf.inc.php	(revision 16379)
+++ /extensions/hr_glass_xl/themeconf.inc.php	(revision 16380)
@@ -58,3 +58,88 @@
   $template->assign('display_hr_glass_xl_banner', $header);
 }
+
+// function load_pattern
+// include the right ***.pattern.php
+// not compatible 2.2and<2.2
+
+function load_pattern()
+{
+  global $pattern;
+  $pwgversion=str_replace('.','',PHPWG_VERSION);
+  $pwgversion_array=explode('.', PHPWG_VERSION);
+  if (file_exists($pwgversion.'pattern.php'))
+  {
+    include($pwgversion.'.pattern.php');
+    return true;
+  }
+  elseif (file_exists(PHPWG_ROOT_PATH.'themes/hr_glass_xl/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php'))
+  {
+    include(PHPWG_ROOT_PATH.'themes/hr_glass_xl/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php');
+    return true;
+  }
+  else
+  {
+    $list_pattern_path=array();
+    $dir=PHPWG_ROOT_PATH.'themes/hr_glass_xl';
+    $dh = opendir($dir);
+    while (($file = readdir ($dh)) !== false ) {
+      if ($file !== '.' && $file !== '..') {
+        $path =$dir.'/'.$file;
+        if (!is_dir ($path)) { 
+          if(strpos($file,'pattern.php')!==false) { //On ne prend que les .pattern.php
+            $list_pattern_path[]=$file;
+          }
+        }
+      }
+    }
+    closedir($dh);
+    $f=0;
+    for($i = 10; $i >=0; $i--)
+    {
+      if (in_array($pwgversion_array[0].$i.'.pattern.php',$list_pattern_path))
+      {
+        include($pwgversion_array[0].$i.'.pattern.php');
+        return true;
+        $f=1;
+        break;
+      }
+    }
+    if ($f=0)
+    {
+      return false;
+    }
+  }
+  
+}
+if(!load_pattern())
+{
+  global $page;
+  $page['errors'][]='Theme not compatible';
+}
+
+/************************************ picture.tpl ************************************/
+add_event_handler('render_element_content', 'hr_glass_xl_picture',  EVENT_HANDLER_PRIORITY_NEUTRAL, 20 );
+function hr_glass_xl_picture($content, $element_info)
+{
+  global $template;
+  $template->set_prefilter('default_content', 'hr_glass_xl_prefilter_picture');
+  return $content;
+}
+function hr_glass_xl_prefilter_picture($content, &$smarty)
+{
+  global $pattern;
+  $r=$pattern['hr_glass_xl_prefilter_picture']['R'];
+  $ps=$pattern['hr_glass_xl_prefilter_picture']['S'];
+  foreach($r as $i => $pr)
+  {
+    $content = str_replace($ps[$i], $pr, $content);
+  }
+  
+  $content ='{define_derivative name=\'der_hr_glass_xl\' width=900 height=9999 crop=false}
+{assign var=der value=$pwg->derivative($der_hr_glass_xl, $current.src_image)}
+'.$content;
+  return $content;
+}
+
+
 ?>
Index: /extensions/hr_os/24x.pattern.php
===================================================================
--- /extensions/hr_os/24x.pattern.php	(revision 16380)
+++ /extensions/hr_os/24x.pattern.php	(revision 16380)
@@ -0,0 +1,7 @@
+<?php
+
+$pattern['hr_os_prefilter_picture']['S']['get_url']='{$current.selected_derivative->get_url()}';
+$pattern['hr_os_prefilter_picture']['R']['get_url']='{$der->get_url()}';
+$pattern['hr_os_prefilter_picture']['S']['get_size_htm']='{$current.selected_derivative->get_size_htm()';
+$pattern['hr_os_prefilter_picture']['R']['get_size_htm']='{$der->get_size_htm()';
+?>
Index: /extensions/hr_os/theme.css
===================================================================
--- /extensions/hr_os/theme.css	(revision 16379)
+++ /extensions/hr_os/theme.css	(revision 16380)
@@ -55,4 +55,28 @@
 
 img{ border: 0; }
+#derivativeSwitchBox, #sortOrderBox {
+	font-size: 11px;
+	color: #000033;
+	text-shadow: 0 0 2px #ccc;
+	padding: 4px 8px;
+	border: 1px solid rgba(255,255,255,0.25);
+	background-color: rgb(255,255,255);
+	background-color: rgba(255,255,255,0.92);
+	background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#fff));
+	border-radius: 3px;
+	-webkit-border-radius: 3px;
+	-moz-border-radius: 3px;
+	box-shadow: 0 0 5px #555;
+	-webkit-box-shadow: 0 0 5px #555;
+	-moz-box-shadow: 0 0 5px #555;
+}
+#derivativeSwitchBox A, #sortOrderBox A {
+	color: #000;
+}
+
+#derivativeSwitchBox A:hover, #sortOrderBox A:hover {
+	text-shadow: 0 0 2px #000;
+}
+
 
 /* Page
@@ -63,5 +87,4 @@
 	width: 800px;
 	margin: 0 auto;
-	position: relative;
 	background: transparent url(img/back.jpg) repeat-y top center;
 }
@@ -127,4 +150,8 @@
 	margin: 10px auto;
 }
+#imageToolBar .imageNumber {
+    float: right;
+    margin: -30px 9px 0 0;
+}
 #imageHeaderBar{
 	background: #F5F5F5;
@@ -200,7 +227,6 @@
 }
 
-#menubar { position: relative; z-index: 2; }
-#content { position: relative; z-index: 1; }
-
+#menubar { position: relative; }
+#theHeader { position: relative; }
 #content div.thumbnailCategory div.description {
 	overflow: hidden; /* bug in FF 1.0 (not 1.5) */
Index: /extensions/hr_os/themeconf.inc.php
===================================================================
--- /extensions/hr_os/themeconf.inc.php	(revision 16379)
+++ /extensions/hr_os/themeconf.inc.php	(revision 16380)
@@ -57,4 +57,87 @@
   $template->assign('display_hr_os_banner', $header);
 }
+// function load_pattern
+// include the right ***.pattern.php
+// not compatible 2.2and<2.2
+
+function load_pattern()
+{
+  global $pattern;
+  $pwgversion=str_replace('.','',PHPWG_VERSION);
+  $pwgversion_array=explode('.', PHPWG_VERSION);
+  if (file_exists($pwgversion.'pattern.php'))
+  {
+    include($pwgversion.'.pattern.php');
+    return true;
+  }
+  elseif (file_exists(PHPWG_ROOT_PATH.'themes/hr_os/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php'))
+  {
+    include(PHPWG_ROOT_PATH.'themes/hr_os/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php');
+    return true;
+  }
+  else
+  {
+    $list_pattern_path=array();
+    $dir=PHPWG_ROOT_PATH.'themes/hr_os';
+    $dh = opendir($dir);
+    while (($file = readdir ($dh)) !== false ) {
+      if ($file !== '.' && $file !== '..') {
+        $path =$dir.'/'.$file;
+        if (!is_dir ($path)) { 
+          if(strpos($file,'pattern.php')!==false) { //On ne prend que les .pattern.php
+            $list_pattern_path[]=$file;
+          }
+        }
+      }
+    }
+    closedir($dh);
+    $f=0;
+    for($i = 10; $i >=0; $i--)
+    {
+      if (in_array($pwgversion_array[0].$i.'.pattern.php',$list_pattern_path))
+      {
+        include($pwgversion_array[0].$i.'.pattern.php');
+        return true;
+        $f=1;
+        break;
+      }
+    }
+    if ($f=0)
+    {
+      return false;
+    }
+  }
+  
+}
+if(!load_pattern())
+{
+  global $page;
+  $page['errors'][]='Theme not compatible';
+}
+
+/************************************ picture.tpl ************************************/
+add_event_handler('render_element_content', 'hr_os_picture',  EVENT_HANDLER_PRIORITY_NEUTRAL, 20 );
+function hr_os_picture($content, $element_info)
+{
+  global $template;
+  $template->set_prefilter('default_content', 'hr_os_prefilter_picture');
+  return $content;
+}
+function hr_os_prefilter_picture($content, &$smarty)
+{
+  global $pattern;
+  $r=$pattern['hr_os_prefilter_picture']['R'];
+  $ps=$pattern['hr_os_prefilter_picture']['S'];
+  foreach($r as $i => $pr)
+  {
+    $content = str_replace($ps[$i], $pr, $content);
+  }
+  
+  $content ='{define_derivative name=\'der_hr_os\' width=730 height=9999 crop=false}
+{assign var=der value=$pwg->derivative($der_hr_os, $current.src_image)}
+'.$content;
+  return $content;
+}
+
 
 ?>
Index: /extensions/hr_os_xl/24x.pattern.php
===================================================================
--- /extensions/hr_os_xl/24x.pattern.php	(revision 16380)
+++ /extensions/hr_os_xl/24x.pattern.php	(revision 16380)
@@ -0,0 +1,7 @@
+<?php
+
+$pattern['hr_os_xl_prefilter_picture']['S']['get_url']='{$current.selected_derivative->get_url()}';
+$pattern['hr_os_xl_prefilter_picture']['R']['get_url']='{$der->get_url()}';
+$pattern['hr_os_xl_prefilter_picture']['S']['get_size_htm']='{$current.selected_derivative->get_size_htm()';
+$pattern['hr_os_xl_prefilter_picture']['R']['get_size_htm']='{$der->get_size_htm()';
+?>
Index: /extensions/hr_os_xl/theme.css
===================================================================
--- /extensions/hr_os_xl/theme.css	(revision 16379)
+++ /extensions/hr_os_xl/theme.css	(revision 16380)
@@ -59,4 +59,28 @@
 	color: #FFF;
 }
+#derivativeSwitchBox, #sortOrderBox {
+	font-size: 11px;
+	color: #000033;
+	text-shadow: 0 0 2px #ccc;
+	padding: 4px 8px;
+	border: 1px solid rgba(255,255,255,0.25);
+	background-color: rgb(255,255,255);
+	background-color: rgba(255,255,255,0.92);
+	background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#fff));
+	border-radius: 3px;
+	-webkit-border-radius: 3px;
+	-moz-border-radius: 3px;
+	box-shadow: 0 0 5px #555;
+	-webkit-box-shadow: 0 0 5px #555;
+	-moz-box-shadow: 0 0 5px #555;
+}
+#derivativeSwitchBox A, #sortOrderBox A {
+	color: #000;
+}
+
+#derivativeSwitchBox A:hover, #sortOrderBox A:hover {
+	text-shadow: 0 0 2px #000;
+}
+
 /* Page
 -------------------------------------------------------- */
@@ -66,5 +90,4 @@
 	width: 940px;
 	margin: 0 auto;
-	position: relative;
 	background: transparent url(img/back.jpg) repeat-y top center;
 }
@@ -135,9 +158,13 @@
 	padding: 5px 8px;
 }
-
+#imageToolBar .imageNumber {
+    float: right;
+    margin: -30px 9px 0 0;
+}
 #theImage IMG {
   padding: 5px;
   border: 1px solid #aaa;
 }
+#theMainImage {max-width:880px}
 
 #imageHeaderBar H2 { 
@@ -201,6 +228,6 @@
 }
 
-#menubar { position: relative; z-index: 2; }
-#content { position: relative; z-index: 1; }
+#menubar { position: relative; }
+#theHeader { position: relative; }
 
 #content div.thumbnailCategory div.description {
Index: /extensions/hr_os_xl/themeconf.inc.php
===================================================================
--- /extensions/hr_os_xl/themeconf.inc.php	(revision 16379)
+++ /extensions/hr_os_xl/themeconf.inc.php	(revision 16380)
@@ -57,3 +57,87 @@
   $template->assign('display_hr_os_xl_banner', $header);
 }
+// function load_pattern
+// include the right ***.pattern.php
+// not compatible 2.2and<2.2
+
+function load_pattern()
+{
+  global $pattern;
+  $pwgversion=str_replace('.','',PHPWG_VERSION);
+  $pwgversion_array=explode('.', PHPWG_VERSION);
+  if (file_exists($pwgversion.'pattern.php'))
+  {
+    include($pwgversion.'.pattern.php');
+    return true;
+  }
+  elseif (file_exists(PHPWG_ROOT_PATH.'themes/hr_os_xl/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php'))
+  {
+    include(PHPWG_ROOT_PATH.'themes/hr_os_xl/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php');
+    return true;
+  }
+  else
+  {
+    $list_pattern_path=array();
+    $dir=PHPWG_ROOT_PATH.'themes/hr_os_xl';
+    $dh = opendir($dir);
+    while (($file = readdir ($dh)) !== false ) {
+      if ($file !== '.' && $file !== '..') {
+        $path =$dir.'/'.$file;
+        if (!is_dir ($path)) { 
+          if(strpos($file,'pattern.php')!==false) { //On ne prend que les .pattern.php
+            $list_pattern_path[]=$file;
+          }
+        }
+      }
+    }
+    closedir($dh);
+    $f=0;
+    for($i = 10; $i >=0; $i--)
+    {
+      if (in_array($pwgversion_array[0].$i.'.pattern.php',$list_pattern_path))
+      {
+        include($pwgversion_array[0].$i.'.pattern.php');
+        return true;
+        $f=1;
+        break;
+      }
+    }
+    if ($f=0)
+    {
+      return false;
+    }
+  }
+  
+}
+if(!load_pattern())
+{
+  global $page;
+  $page['errors'][]='Theme not compatible';
+}
+
+/************************************ picture.tpl ************************************/
+add_event_handler('render_element_content', 'hr_os_xl_picture',  EVENT_HANDLER_PRIORITY_NEUTRAL, 20 );
+function hr_os_xl_picture($content, $element_info)
+{
+  global $template;
+  $template->set_prefilter('default_content', 'hr_os_xl_prefilter_picture');
+  return $content;
+}
+function hr_os_xl_prefilter_picture($content, &$smarty)
+{
+  global $pattern;
+  $r=$pattern['hr_os_xl_prefilter_picture']['R'];
+  $ps=$pattern['hr_os_xl_prefilter_picture']['S'];
+  foreach($r as $i => $pr)
+  {
+    $content = str_replace($ps[$i], $pr, $content);
+  }
+  
+  $content ='{define_derivative name=\'der_hr_os_xl\' width=900 height=9999 crop=false}
+{assign var=der value=$pwg->derivative($der_hr_os_xl, $current.src_image)}
+'.$content;
+  return $content;
+}
+
+
 ?>
