Index: /extensions/Back2Front/Back2Front.php
===================================================================
--- /extensions/Back2Front/Back2Front.php	(revision 10851)
+++ /extensions/Back2Front/Back2Front.php	(revision 10852)
@@ -1,4 +1,6 @@
 <?php 
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+include_once(B2F_PATH.'functions.inc.php');
 
 /*
@@ -7,5 +9,5 @@
 function Back2Front_picture_content($content, $image)
  {
-  global $template, $conf;
+  global $template, $user, $conf;
 
   /* search for a verso picture */
@@ -14,5 +16,7 @@
       i.id, 
       i.path,
-      i.has_high
+      i.has_high,
+      i.width,
+      i.height
     FROM ".IMAGES_TABLE." as i
       INNER JOIN ".B2F_TABLE." as v
@@ -26,7 +30,30 @@
   {
     $verso = pwg_db_fetch_assoc($result);
+    $conf['back2front'] = explode(',',$conf['back2front']);
+    
+    // calculation of width and height
+    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
+    
+    if (!empty($verso['width']))
+    {
+      list(
+        $verso['scaled_width'],
+        $verso['scaled_height']
+        ) = get_picture_size(
+          $verso['width'],
+          $verso['height'],
+          @$user['maxwidth'],
+          @$user['maxheight']
+        );
+    }
 
     /* websize picture */
-    $template->assign('VERSO_URL', $verso['path']);
+    $template->assign(array(
+      'VERSO_URL' => $verso['path'],
+      'VERSO_WIDTH' => $verso['scaled_width'],
+      'VERSO_HEIGHT' => $verso['scaled_height'],
+      'b2f_switch_mode' => $conf['back2front'][1],
+      'b2f_transition' => $conf['back2front'][2],
+    ));
     
     /* admin link */
@@ -48,5 +75,5 @@
     $template->assign('B2F_PATH', B2F_PATH);
     
-    return $content . $template->parse('B2F_picture_content', true);  
+    return $template->parse('B2F_picture_content', true).$content;  
   }
   else 
@@ -60,51 +87,56 @@
  * Add field on picture modify page
  */
-function Back2Front_picture_modify()
+function Back2Front_picture_modify($menu)
 {
   global $page, $template, $conf;
+  
+  if ($page['page'] != 'picture_modify') return $menu;
   $conf['back2front'] = explode(',',$conf['back2front']);
-  
-  if ($page['page'] != 'picture_modify')
-  {
-    return;
-  }
   
 /* SAVE VALUES */
   if (isset($_POST['b2f_submit']))
   {
+    /* catch all verso and recto ids and original categories */
+    $query = "SELECT image_id, verso_id, categories
+      FROM ".B2F_TABLE.";";
+    $rectos = array_from_query($query, 'image_id');
+    $versos = array_from_query($query, 'verso_id');
+    $cats = array_from_query($query, 'categories');
+    
+    if (count($rectos) != 0)
+    {
+      $all_recto_verso = array_combine($rectos, $versos);
+      $verso_cats = array_combine($versos, $cats);
+    }
+    else
+    {
+      $all_recto_verso = array(0=>0);
+      $verso_cats = array(0=>NULL);
+    }
+    unset($rectos, $versos, $cats);
+    
     /* picture is verso */
     if (isset($_POST['b2f_is_verso']))
-    {
-      /* catch all verso and recto ids */
-      $query = "SELECT image_id, verso_id
-        FROM ".B2F_TABLE.";";
-      $rectos = array_from_query($query, 'image_id');
-      $versos = array_from_query($query, 'verso_id');
-      if (count($rectos) != 0)
-      {
-        $all_recto_verso = array_combine($rectos, $versos);
-      }
-      else
-      {
-        $all_recto_verso = array(0=>0);
-      }
-      unset($rectos, $versos);
-      
+    {      
       /* verso don't exists */
       if (!picture_exists($_POST['b2f_front_id']))
       {
-        $template->append('errors', l10n('Unknown id for frontside picture : ').$_POST['b2f_front_id']);
+        array_push($page['errors'], l10n_args(get_l10n_args('Unknown id %d for frontside picture', $_POST['b2f_front_id'])));
       }
       /* verso same as recto  */
       else if ($_POST['b2f_front_id'] == $_GET['image_id'])
       {
-        $template->append('errors', l10n('Backside and frontside can\'t be the same picture'));
+        array_push($page['errors'], l10n('Backside and frontside can\'t be the same picture'));
       }
       /* recto has already a verso */
-      else if (in_array($_POST['b2f_front_id'], array_keys($all_recto_verso)))
+      else if (in_array($_POST['b2f_front_id'], array_keys($all_recto_verso)) AND $all_recto_verso[$_POST['b2f_front_id']] != $_GET['image_id'])
       {
           $recto_current_verso['id'] = $all_recto_verso[$_POST['b2f_front_id']];
           $recto_current_verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$recto_current_verso['id'];
-          $template->append('errors', l10n('This picture has already a backside : ').'<a href="'.$recto_current_verso['link'].'">'.$recto_current_verso['id'].'</a>');
+          array_push($page['errors'], 
+            l10n_args(get_l10n_args('The picture n°%d has already a backside : %s', 
+              array($_POST['b2f_front_id'], '<a href="'.$recto_current_verso['link'].'">'.$recto_current_verso['id'].'</a>')
+            ))
+          );
       }
       /* recto is already a verso */
@@ -113,24 +145,18 @@
           $recto_is_verso['id'] = $_POST['b2f_front_id'];
           $recto_is_verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$recto_is_verso['id'];
-          $template->append('errors', l10n('This picture is already a backside : ').'<a href="'.$recto_is_verso['link'].'">'.$recto_is_verso['id'].'</a>');
+          array_push($page['errors'], l10n_args(get_l10n_args('The picture n°%s is already a backside', '<a href="'.$recto_is_verso['link'].'">'.$recto_is_verso['id'].'</a>')));
       }
       /* everything is fine */
       else
       {
-        // get current categories
-        $query = "SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$_GET['image_id'].";";
-        $verso_categories = array_from_query($query, 'category_id');
-        
-        // insert or update verso associations
-        pwg_query("INSERT INTO ".B2F_TABLE."
-          VALUES(".$_POST['b2f_front_id'].", ".$_GET['image_id'].", '".implode(',',$verso_categories)."')
-          ON DUPLICATE KEY UPDATE image_id = ".$_POST['b2f_front_id'].";");
-        
-        // move the verso ?
-        if (isset($_POST['b2f_move_verso']))
+        // move the verso - if first save
+        if (isset($_POST['b2f_move_verso']) AND (!array_key_exists($_GET['image_id'], $verso_cats) OR $verso_cats[$_GET['image_id']] == NULL))
         {
+          // get current categories
+          $query = "SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$_GET['image_id'].";";
+          $verso_categories = array_from_query($query, 'category_id');
+          
           pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
             WHERE image_id = ".$_GET['image_id'].";");
-            
           pwg_query("INSERT INTO ".IMAGE_CATEGORY_TABLE."
             VALUES(".$_GET['image_id'].", ".$conf['back2front'][0].", NULL);");
@@ -138,5 +164,29 @@
           // random representant for each categories
           set_random_representant($verso_categories);
+          
+          $verso_categories = isset($verso_cats[$_GET['image_id']]) ? $verso_cats[$_GET['image_id']] : implode(',',$verso_categories);
+          $template->assign('B2F_MOVE_VERSO', 'checked="checked"');
         }
+        // restore the verso - if precedently moved
+        else if (!isset($_POST['b2f_move_verso']) AND array_key_exists($_GET['image_id'], $verso_cats) AND $verso_cats[$_GET['image_id']] != NULL)
+        {
+          $item['verso_id'] = $_GET['image_id'];
+          $item['categories'] = $verso_cats[$_GET['image_id']];
+          back2front_restaure_categories($item);
+          
+          $verso_categories = 'NULL';
+          $template->assign('B2F_MOVE_VERSO', '');
+        }
+        // leave the verso
+        else
+        {
+          $verso_categories = isset($verso_cats[$_GET['image_id']]) ? $verso_cats[$_GET['image_id']] : 'NULL';
+          $template->assign('B2F_MOVE_VERSO', isset($verso_cats[$_GET['image_id']]) ? 'checked="checked"' : '');
+        }
+        
+        // insert or update verso associations
+        pwg_query("INSERT INTO ".B2F_TABLE."
+          VALUES(".$_POST['b2f_front_id'].", ".$_GET['image_id'].", '".$verso_categories."')
+          ON DUPLICATE KEY UPDATE image_id = ".$_POST['b2f_front_id'].", categories = ".$verso_categories.";");
       
         $template->assign(array(
@@ -145,5 +195,7 @@
         ));
         
-        $template->append('infos', l10n('This picture is now the backside of the picture n° ').$_POST['b2f_front_id']);
+        $verso['id'] = $_POST['b2f_front_id'];
+        $verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$verso['id'];
+        array_push($page['infos'], l10n_args(get_l10n_args('This picture is now the backside of the picture n°%s', '<a href="'.$verso['link'].'">'.$verso['id'].'</a>')));
       }
     }
@@ -160,40 +212,12 @@
       if (pwg_db_num_rows($result))
       {
-        // original categories
+        $item['verso_id'] = $_GET['image_id'];
         list($item['categories']) = pwg_db_fetch_row($result);
-        // catch current categories
-        $versos_infos = pwg_query("SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$_GET['image_id'].";");
-        while (list($verso_cat) = pwg_db_fetch_row($versos_infos))
-        {
-          $current_verso_cats[] = $verso_cat;
-        }
-        
-        /* if verso € 'versos' cat only */
-        if (count($current_verso_cats) == 1 AND $current_verso_cats[0] == $conf['back2front'][0])
-        {
-          foreach (explode(',',$item['categories']) as $cat)
-          {
-            $datas[] = array(
-              'image_id' => $_GET['image_id'],
-              'category_id' => $cat,
-              );
-          }
-          if (isset($datas))
-          {
-            mass_inserts(
-              IMAGE_CATEGORY_TABLE,
-              array('image_id', 'category_id'),
-              $datas
-              );
-          }
-        }
-        
-        pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
-          WHERE image_id = ".$_GET['image_id']." AND category_id = ".$conf['back2front'][0].";");
+        back2front_restaure_categories($item);
         
         pwg_query("DELETE FROM ".B2F_TABLE." 
           WHERE verso_id = ".$_GET['image_id'].";");
           
-        $template->append('infos', l10n('This picture is no longer a backside'));
+        array_push($page['infos'], l10n('This picture is no longer a backside'));
       }
     }
@@ -203,7 +227,9 @@
   if ($template->get_template_vars('B2F_IS_VERSO') == null)
   {
+    $template->assign('B2F_MOVE_VERSO', 'checked="checked"');
+    
     /* is the picture a verso ? */
     $query = "
-      SELECT image_id
+      SELECT image_id, categories
       FROM ".B2F_TABLE."
       WHERE verso_id = ".$_GET['image_id']."
@@ -213,8 +239,9 @@
     if (pwg_db_num_rows($result))
     {
-      list($recto_id) = pwg_db_fetch_row($result);
+      list($recto_id, $cats) = pwg_db_fetch_row($result);
       $template->assign(array(
         'B2F_IS_VERSO' => 'checked="checked"',
         'B2F_FRONT_ID' => $recto_id,
+        'B2F_MOVE_VERSO' => $cats != NULL ? 'checked="checked"' : '',
       ));
     }
@@ -228,17 +255,10 @@
       
       if (pwg_db_num_rows($result))
-      {
-        include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
-        
+      {      
         $item = pwg_db_fetch_assoc($result);
-        $query = "SELECT id, name, file
-          FROM ".IMAGES_TABLE."
-          WHERE id = ".$item['verso_id'].";";
-        $item = pwg_db_fetch_assoc(pwg_query($query));
-        
+
         $template->assign(array(
-          'B2F_VERSO_ID' => $item['id'],
-          'B2F_VERSO_URL' => get_root_url().'admin.php?page=picture_modify&amp;image_id='.$item['id'],
-          'B2F_VERSO_NAME' => get_image_name($item['name'], $item['file']),
+          'B2F_VERSO_ID' => $item['verso_id'],
+          'B2F_VERSO_URL' => get_root_url().'admin.php?page=picture_modify&amp;image_id='.$item['verso_id'],
         ));
       }
@@ -246,17 +266,15 @@
   }
   
-  $template->set_filename('B2F_picture_modify', dirname(__FILE__).'/template/picture_modify.tpl');
-  $template->concat('ADMIN_CONTENT', $template->parse('B2F_picture_modify', true));
+  $template->set_prefilter('picture_modify', 'Back2front_picture_modify_prefilter');
+  
+  return $menu;
 }
 
-function picture_exists($id)
+
+function Back2front_picture_modify_prefilter($content, &$smarty)
 {
-  if (!preg_match('#([0-9]{1,})#', $id) OR $id == '0') return false;
-  
-  $query = "SELECT id FROM ".IMAGES_TABLE." WHERE id = ".$id.";";
-  $result = pwg_query($query);
-  
-  if (pwg_db_num_rows($result)) return true;
-  else return false;
+  $search = '<form id="associations" method="post" action="{$F_ACTION}#associations">';
+  $replacement = file_get_contents(B2F_PATH.'template/picture_modify.tpl')."\n".$search;
+  return str_replace($search, $replacement, $content);
 }
 
Index: /extensions/Back2Front/admin.php
===================================================================
--- /extensions/Back2Front/admin.php	(revision 10852)
+++ /extensions/Back2Front/admin.php	(revision 10852)
@@ -0,0 +1,29 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $conf, $template;
+load_language('plugin.lang', B2F_PATH);
+$conf['back2front'] = explode(',', $conf['back2front']);
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']))
+{
+	$conf['back2front'] = array($conf['back2front'][0], $_POST['switch_mode'], $_POST['transition']);
+			
+    $query = 'UPDATE ' . CONFIG_TABLE . '
+		SET value="' . implode (',', $conf['back2front']) . '"
+		WHERE param="back2front"';
+    pwg_query($query);
+	
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+
+$template->assign(array(
+	'SWITCH_MODE' => $conf['back2front'][1],
+	'TRANSITION' => $conf['back2front'][2],
+));
+	
+$template->set_filename('back2front_conf', dirname(__FILE__).'/template/admin.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'back2front_conf');
+
+?>
Index: /extensions/Back2Front/functions.inc.php
===================================================================
--- /extensions/Back2Front/functions.inc.php	(revision 10852)
+++ /extensions/Back2Front/functions.inc.php	(revision 10852)
@@ -0,0 +1,51 @@
+<?php
+/* $item = array('verso_id', 'categories'); */
+function back2front_restaure_categories($item)
+{
+  global $conf;
+        
+  /* catch current verso categories */
+  $versos_infos = pwg_query("SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$item['verso_id'].";");
+  $item['current_verso_cats'] = array();
+  while (list($verso_cat) = pwg_db_fetch_row($versos_infos))
+  {
+    $item['current_verso_cats'][] = $verso_cat;
+  }
+
+  /* if verso  'versos' cat only */
+  if (count($item['current_verso_cats']) == 1 AND $item['current_verso_cats'][0] == $conf['back2front'][0])
+  {
+    foreach (explode(',',$item['categories']) as $cat)
+    {
+      $datas[] = array(
+        'image_id' => $item['verso_id'],
+        'category_id' => $cat,
+        );
+    }
+  }
+
+  if (isset($datas))
+  {
+    mass_inserts(
+      IMAGE_CATEGORY_TABLE,
+      array('image_id', 'category_id'),
+      $datas
+      );
+  }
+  
+  pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
+    WHERE image_id = ".$item['verso_id']." AND category_id = ".$conf['back2front'][0].";");
+}
+
+function picture_exists($id)
+{
+  if (!preg_match('#([0-9]{1,})#', $id) OR $id == '0') return false;
+  
+  $query = "SELECT id FROM ".IMAGES_TABLE." WHERE id = ".$id.";";
+  $result = pwg_query($query);
+  
+  if (pwg_db_num_rows($result)) return true;
+  else return false;
+}
+
+?>
Index: /extensions/Back2Front/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/Back2Front/language/en_UK/plugin.lang.php	(revision 10851)
+++ /extensions/Back2Front/language/en_UK/plugin.lang.php	(revision 10852)
@@ -4,4 +4,9 @@
 $lang['See front'] = 'See front';
 $lang['Modify backside information'] = 'Modify backside information';
+
+$lang['Switch mode'] = 'Switch mode';
+$lang['Click'] = 'Click';
+$lang['Mouseover'] = 'Mouseover';
+$lang['Fade'] = 'Fade';
 
 $lang['This picture is a backside...'] = 'This picture is a backside...';
@@ -12,8 +17,8 @@
 
 $lang['Backside and frontside can\'t be the same picture'] = 'Backside and frontside can\'t be the same picture';
-$lang['This picture has already a backside : '] = 'This picture has already a backside : ';
-$lang['This picture id already a backside : '] = 'This picture is already a backside : ';
-$lang['This picture is now the backside of the picture n° '] = 'This picture is now the backside of the picture n° ';
-$lang['Unknown id for frontside picture : '] = 'Unknown id for frontside picture : ';
+$lang['The picture n°%d has already a backside : %s'] = 'The picture n°%d has already a backside : %s';
+$lang['The picture n°%s is already a backside'] = 'The picture n°%s is already a backside';
+$lang['This picture is now the backside of the picture n°%s'] = 'This picture is now the backside of the picture n°%s';
+$lang['Unknown id %d for frontside picture'] = 'Unknown id %d for frontside picture';
 $lang['This picture is no longer a backside'] = 'This picture is no longer a backside';
 
Index: /extensions/Back2Front/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/Back2Front/language/fr_FR/plugin.lang.php	(revision 10851)
+++ /extensions/Back2Front/language/fr_FR/plugin.lang.php	(revision 10852)
@@ -4,4 +4,9 @@
 $lang['See front'] = 'Voir le recto';
 $lang['Modify backside information'] = 'Modifier les informations du verso';
+
+$lang['Switch mode'] = 'Interchanger les images au';
+$lang['Click'] = 'Clic';
+$lang['Mouseover'] = 'Survol';
+$lang['Fade'] = 'Fondu';
 
 $lang['This picture is a backside...'] = 'Cette image est le verso...';
@@ -12,8 +17,8 @@
 
 $lang['Backside and frontside can\'t be the same picture'] = 'Verso et recto ne peuvent être la même image';
-$lang['This picture has already a backside : '] = 'Cette image a déjà un verso : ';
-$lang['This picture is already a backside : '] = 'Cette image est déjà un verso : ';
-$lang['This picture is now the backside of the picture n° '] = 'Cette image est maintenant le verso de l\'image n° ';
-$lang['Unknown id for frontside picture : '] = 'Id inconnu pour le recto : ';
+$lang['The picture n°%d has already a backside : %s'] = 'L\'image n°%d a déjà un verso';
+$lang['The picture n°%s is already a backside'] = 'L\'image n°%s est déjà un verso';
+$lang['This picture is now the backside of the picture n°%s'] = 'Cette image est maintenant le verso de l\'image n°%s';
+$lang['Unknown id %d for frontside picture'] = 'Identifiant %d inconnu';
 $lang['This picture is no longer a backside'] = 'Cette image n\'est plus un verso';
 
Index: /extensions/Back2Front/main.inc.php
===================================================================
--- /extensions/Back2Front/main.inc.php	(revision 10851)
+++ /extensions/Back2Front/main.inc.php	(revision 10852)
@@ -19,6 +19,23 @@
 include_once(B2F_PATH . 'Back2Front.php');
 
-add_event_handler('render_element_content', 'Back2Front_picture_content', 99, 2);
-add_event_handler('loc_end_admin', 'Back2Front_picture_modify');
+if (script_basename() == 'picture')
+{
+  add_event_handler('render_element_content', 'Back2Front_picture_content', 99, 2);
+}
+
+if (script_basename() == 'admin')
+{
+  add_event_handler('get_admin_plugin_menu_links', 'Back2Front_picture_modify');
+  // add_event_handler('loc_begin_admin_page', 'Back2Front_picture_modify'); /* for Piwigo 2.2.2 */
+  
+	add_event_handler('get_admin_plugin_menu_links', 'Back2Front_admin_menu');
+	function Back2Front_admin_menu($menu) 
+	{
+		array_push($menu, array(
+			'NAME' => 'Back2Front',
+			'URL' => get_root_url().'admin.php?page=plugin-' . B2F_DIR));
+		return $menu;
+	}
+}
 
 ?>
Index: /extensions/Back2Front/maintain.inc.php
===================================================================
--- /extensions/Back2Front/maintain.inc.php	(revision 10851)
+++ /extensions/Back2Front/maintain.inc.php	(revision 10852)
@@ -1,4 +1,6 @@
 <?php
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+include_once(PHPWG_PLUGINS_PATH.'back2front/functions.inc.php');
 
 function plugin_install() {
@@ -34,5 +36,5 @@
   /* config parameter */
   pwg_query("INSERT INTO `" . CONFIG_TABLE . "`
-    VALUES ('back2front', '".$versos_cat['id']."', 'Configuration for Back2Front plugin');");
+    VALUES ('back2front', '".$versos_cat['id'].",click,none', 'Configuration for Back2Front plugin');");
 }
 
@@ -53,37 +55,8 @@
   while ($item = pwg_db_fetch_assoc($images_versos))
   {
-    /* catch current verso categories */
-    $versos_infos = pwg_query("SELECT category_id FROM ".IMAGE_CATEGORY_TABLE." WHERE image_id = ".$item['verso_id'].";");
-    while (list($verso_cat) = pwg_db_fetch_row($versos_infos))
-    {
-      $item['current_verso_cats'][] = $verso_cat;
-    }
-    
-    /* if verso  'versos' cat only */
-    if (count($item['current_verso_cats']) == 1 AND $item['current_verso_cats'][0] == $conf['back2front'][0])
-    {
-      foreach (explode(',',$item['categories']) as $cat)
-      {
-        $datas[] = array(
-          'image_id' => $item['verso_id'],
-          'category_id' => $cat,
-          );
-      }
-    }
-    
-    pwg_query("DELETE FROM ".IMAGE_CATEGORY_TABLE."
-      WHERE image_id = ".$item['verso_id']." AND category_id = ".$conf['back2front'][0].";");
-  }
-  
-  if (isset($datas))
-  {
-    mass_inserts(
-      IMAGE_CATEGORY_TABLE,
-      array('image_id', 'category_id'),
-      $datas
-      );
+    back2front_restaure_categories($item);
   }
 
-	pwg_query("DROP TABLE `" . $prefixeTable . "image_verso`;");
+  pwg_query("DROP TABLE `" . $prefixeTable . "image_verso`;");
   pwg_query("DELETE FROM `" . CONFIG_TABLE . "` WHERE param = 'back2front';");
   pwg_query("DELETE FROM `" . CATEGORIES_TABLE ."`WHERE id = ".$conf['back2front'][0].";");
Index: /extensions/Back2Front/template/admin.tpl
===================================================================
--- /extensions/Back2Front/template/admin.tpl	(revision 10852)
+++ /extensions/Back2Front/template/admin.tpl	(revision 10852)
@@ -0,0 +1,23 @@
+<div class="titrePage">
+	<h2>Back2Front</h2>
+</div>
+
+<form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 
+	<fieldset>
+		<legend>{'Display'|@translate}</legend>	  
+		<ul>			
+			<li>
+				<span class="property">{'Switch mode'|@translate}</span>
+				<label><input type="radio" name="switch_mode" value="click" {if $SWITCH_MODE == 'click'}checked="checked"{/if}/> {'Click'|@translate}</label>
+				<label><input type="radio" name="switch_mode" value="hover" {if $SWITCH_MODE == 'hover'}checked="checked"{/if}/> {'Mouseover'|@translate}</label>
+			</li>
+			<li>
+				<span class="property">{'Transition'|@translate}</span>
+				<label><input type="radio" name="transition" value="none" {if $TRANSITION == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
+				<label><input type="radio" name="transition" value="fade" {if $TRANSITION == 'fade'}checked="checked"{/if}/> {'Fade'|@translate}</label>
+			</li>		
+		</ul>
+	</fieldset>
+		
+	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
+</form>
Index: /extensions/Back2Front/template/picture_content.tpl
===================================================================
--- /extensions/Back2Front/template/picture_content.tpl	(revision 10851)
+++ /extensions/Back2Front/template/picture_content.tpl	(revision 10852)
@@ -3,32 +3,78 @@
 {footer_script require="jquery"}
 jQuery(document).ready(function () {ldelim}
+
+{if $b2f_switch_mode == 'click'}
   jQuery('.reverse').click(function() {ldelim}
     if (jQuery(this).attr('rel') == 'front') {ldelim}
-      /* picture attributes */
-      jQuery('#theImage img:first-child').attr({ldelim}
+{else}
+  jQuery('.reverse').hover(function() {ldelim}
+{/if}
+
+      /* picture switch */
+    {if $b2f_transition == 'fade'}
+      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
+        opacity:0
+      }, 400, function() {ldelim}
+        jQuery(this).animate({ldelim}
+          width:'{$VERSO_WIDTH}px',
+          height:'{$VERSO_HEIGHT}px'
+        }, 200, function() {ldelim}
+            jQuery(this).attr('src', '{$VERSO_URL}');
+            jQuery(this).animate({ldelim}
+              opacity:1
+            }, 400);
+        });
+      });
+    {else}
+      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
         src: '{$VERSO_URL}',
-        style: 'width:;height:;',
+        style: 'width:{$VERSO_WIDTH}px;height:{$VERSO_HEIGHT}px;',
       });
-      
-      /* hd link atributes */
+    {/if}
+    
+    {if $b2f_switch_mode == 'click'}
+      /* hd link */
       {if isset($VERSO_HD)}
-      jQuery('#theImage a:first-child').attr({ldelim}
+      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
         href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
       });
       {/if}
-      
+    
       /* B2F link content */
       jQuery(this).html('<img src="{$B2F_PATH}template/rotate_2.png"/> {'See front'|@translate}');
       jQuery(this).attr('rel', 'back');
+    {/if}
       
+{if $b2f_switch_mode == 'click'}
     } else if (jQuery(this).attr('rel') == 'back') {ldelim}
-      jQuery('#theImage img:first-child').attr({ldelim}
+{else}
+  }, function() {ldelim}
+{/if} 
+
+    {if $b2f_transition == 'fade'}
+      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
+        opacity:0
+      }, 400, function() {ldelim}
+        jQuery(this).animate({ldelim}
+          width:'{$WIDTH_IMG}px',
+          height:'{$HEIGHT_IMG}px'
+        }, 200, function() {ldelim}
+            jQuery(this).attr('src', '{$SRC_IMG}');
+            jQuery(this).animate({ldelim}
+              opacity:1
+            }, 400);
+        });
+      });
+    {else}
+      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
         src: '{$SRC_IMG}',
         style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
       });
+    {/if}
       
-      {if isset($VERSO_HD)}
-      jQuery('#theImage a:first-child').attr({ldelim}
-        href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')')"
+    {if $b2f_switch_mode == 'click'}
+      {if isset($high.U_HIGH)}
+      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
+        href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
       });
       {/if}
@@ -36,11 +82,20 @@
       jQuery(this).html('<img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}');
       jQuery(this).attr('rel', 'front');
+    {/if}
+      
+{if $b2f_switch_mode == 'click'}
     }
   });
+{else}
+  });
+{/if} 
+
 });
 {/footer_script}
 
-<a class="reverse" rel="front" href="#">
-  <img src="{$B2F_PATH}template/rotate_1.png"/>
-  {'See back'|@translate}
+<img src="{$VERSO_URL}" style="display:none;"> {* <!-- force preload the verso --> *}
+
+<a class="reverse" rel="front" name="verso-link" {if $b2f_switch_mode == 'hover'}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
+  <img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}
 </a>
+<br/>
Index: /extensions/Back2Front/template/picture_modify.tpl
===================================================================
--- /extensions/Back2Front/template/picture_modify.tpl	(revision 10851)
+++ /extensions/Back2Front/template/picture_modify.tpl	(revision 10852)
@@ -2,9 +2,5 @@
 $(document).ready(function () {ldelim}
   $('input[name="b2f_is_verso"]').change(function () {ldelim}
-    if (this.checked) {ldelim}
-      $('.frontside_id').css('visibility', '');
-    } else {ldelim}
-      $('.frontside_id').css('visibility', 'hidden');
-    }
+     $('.frontside_param').toggle();
   });
 });
@@ -21,22 +17,22 @@
       <tr>
         <td><b>{'This picture has a backside :'|@translate}</b></td>
-        <td><a href="{$B2F_VERSO_URL}">{$B2F_VERSO_ID} - {$B2F_VERSO_NAME}</a></td>
+        <td><a href="{$B2F_VERSO_URL}">{$B2F_VERSO_ID}</a></td>
       </tr>
     </table>
   {else}
-    <table>
+    <table style="min-width:400px;">
       <tr>
         <td><b>{'This picture is a backside...'|@translate}</b></td>
-        <td><input type="checkbox" name="b2f_is_verso" {$B2F_IS_VERSO}></td>
+        <td style="width:70px"><input type="checkbox" name="b2f_is_verso" {$B2F_IS_VERSO}></td>
       </tr>
-
-      <tr class="frontside_id" {if !isset($B2F_IS_VERSO)}style="visibility:hidden;"{/if}>
+      
+      <tr class="frontside_param" {if !isset($B2F_IS_VERSO)}style="display:none;"{/if}>
         <td><b>{'...of the picture n°'|@translate}</b></td>
         <td><input type="text" size="4" name="b2f_front_id" value="{$B2F_FRONT_ID}"></td>
       </tr>
       
-      <tr class="frontside_id" {if !isset($B2F_IS_VERSO)}style="visibility:hidden;"{/if}>
+      <tr class="frontside_param" {if !isset($B2F_IS_VERSO)}style="display:none;"{/if}>
         <td><b>{'Move backside to private album'|@translate}</b></td>
-        <td><input type="checkbox" name="b2f_move_verso" checked="checked"></td>
+        <td><input type="checkbox" name="b2f_move_verso" {$B2F_MOVE_VERSO}></td>
       </tr>
     </table>
Index: /extensions/Back2Front/template/style.css
===================================================================
--- /extensions/Back2Front/template/style.css	(revision 10851)
+++ /extensions/Back2Front/template/style.css	(revision 10852)
@@ -6,6 +6,8 @@
   font-size:15px;
   font-style:italic;	
+  height:1em;
 }
 a.reverse img {
+  margin:0 !important;
   vertical-align:top;
   border:none !important;
