Index: extensions/Back2Front/Back2Front.php
===================================================================
--- extensions/Back2Front/Back2Front.php	(revision 10819)
+++ extensions/Back2Front/Back2Front.php	(revision 10819)
@@ -0,0 +1,215 @@
+<?php 
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+/*
+ * Add verso link on picture page
+ */
+function Back2Front_picture_content($content, $image)
+ {
+  global $template, $conf;
+
+  /* search for a verso picture */
+  $query = "
+    SELECT 
+      i.id, 
+      i.path,
+      i.has_high
+    FROM ".IMAGES_TABLE." as i
+      INNER JOIN ".B2F_TABLE." as v
+      ON i.id = v.verso_id
+    WHERE
+      v.image_id = ".$image['id']."
+  ;";
+  $result = pwg_query($query);
+
+  if (pwg_db_num_rows($result)) 
+  {
+    $verso = pwg_db_fetch_assoc($result);
+
+    /* websize picture */
+    $template->assign('VERSO_URL', $verso['path']);
+    
+    /* admin link */
+    if (is_admin())
+    {
+      $template->assign('VERSO_U_ADMIN', get_root_url().'admin.php?page=picture_modify&amp;cat_id=&amp;image_id='.$verso['id']);
+      $template->set_filename('B2F_admin_button', dirname(__FILE__).'/template/admin_button.tpl');
+      $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('B2F_admin_button', true));
+    }
+
+    /* high picture */
+    if ($verso['has_high'])
+    {
+      $template->assign('VERSO_HD', get_high_url($verso));
+    }
+
+    /* template & output */
+    $template->set_filenames(array('B2F_picture_content' => dirname(__FILE__).'/template/picture_content.tpl') );
+    $template->assign('B2F_PATH', B2F_PATH);
+    
+    return $content . $template->parse('B2F_picture_content', true);  
+  }
+  else 
+  {
+    return $content;
+  }
+}
+
+
+/*
+ * Add field on picture modify page
+ */
+function Back2Front_picture_modify()
+{
+  global $page, $template;
+  
+  if ($page['page'] == 'picture_modify')
+  {
+    /* change values */
+    if (isset($_POST['b2f_submit']))
+    {
+      /* picture is verso */
+      if (isset($_POST['b2f_is_verso']))
+      {
+        /* frontside exists */
+        if (picture_exists($_POST['b2f_front_id']))
+        {
+          $query = "
+            INSERT INTO ".B2F_TABLE."
+            VALUES(".$_POST['b2f_front_id'].", ".$_GET['image_id'].", ".$_POST['b2f_old_level'].")
+            ON DUPLICATE KEY UPDATE image_id = ".$_POST['b2f_front_id'].", old_level = ".$_POST['b2f_old_level']."
+          ;";
+          pwg_query($query);
+          
+          $query = "
+            UPDATE ".IMAGES_TABLE."
+            SET level = 99
+            WHERE id = ".$_GET['image_id']."
+          ;";
+          pwg_query($query);
+          
+          $template->assign(array(
+            'B2F_IS_VERSO' => 'checked="checked"',
+            'B2F_FRONT_ID' => $_POST['b2f_front_id'],
+            'B2F_OLD_LEVEL' => $_POST['b2f_old_level'],
+          ));
+        }
+        else
+        {
+          $template->assign('errors', l10n('Unknown id for frontside picture'));
+        }
+      }
+      /* picture isn't verso */
+      else
+      {
+        $query = "
+          DELETE FROM ".B2F_TABLE." 
+          WHERE verso_id = ".$_GET['image_id']."
+        ;";
+        pwg_query($query);
+        
+        $query = "
+          UPDATE ".IMAGES_TABLE."
+          SET level = ".$_POST['b2f_old_level']."
+          WHERE id = ".$_GET['image_id']."
+        ;";
+        pwg_query($query);
+        
+        $template->assign(array(
+          'level_options_selected' => array($_POST['b2f_old_level']),
+        ));
+      }
+    }
+    /* get saved values */
+    else
+    {
+      /* is the pisture a verso ? */
+      $query = "
+        SELECT image_id, old_level
+        FROM ".B2F_TABLE."
+        WHERE verso_id = ".$_GET['image_id']."
+      ;";
+      $result = pwg_query($query);
+      
+      if (pwg_db_num_rows($result))
+      {
+        $item = pwg_db_fetch_assoc($result);
+        $template->assign(array(
+          'B2F_IS_VERSO' => 'checked="checked"',
+          'B2F_FRONT_ID' => $item['image_id'],
+          'B2F_OLD_LEVEL' => $item['old_level'],
+        ));
+      }
+      /* is the picture a front ? */
+      else
+      {
+        $query = "
+          SELECT verso_id
+          FROM ".B2F_TABLE."
+          WHERE image_id = ".$_GET['image_id']."
+        ;";
+        $result = pwg_query($query);
+        
+        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;cat_id=&amp;image_id='.$item['id'],
+            'B2F_VERSO_NAME' => get_image_name($item['name'], $item['file']),
+          ));
+        }
+      }
+    }
+    
+    $template->set_filename('B2F_picture_modify', dirname(__FILE__).'/template/picture_modify.tpl');
+    $template->concat('ADMIN_CONTENT', $template->parse('B2F_picture_modify', true));
+  }
+}
+
+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;
+}
+
+
+$versos = null; // needs to be declared outside any function for the array_filter callback ?!
+/*
+ * Change/remove navigation thumbnails
+ */
+function Back2Front_items()
+{
+  global $template, $page, $versos;
+  
+  /* search all verso ids */
+  $query = "
+    SELECT verso_id as id
+    FROM ".B2F_TABLE."
+  ;";
+  $versos = array_values(array_from_query($query, 'id'));
+  
+  /* output */
+  function remove_versos($item)
+  {
+    global $versos;
+    return !in_array($item, $versos);
+  }
+  $page['items'] = array_values(array_filter($page['items'], 'remove_versos'));
+}
+
+?>
Index: extensions/Back2Front/admin.php
===================================================================
--- extensions/Back2Front/admin.php	(revision 10819)
+++ extensions/Back2Front/admin.php	(revision 10819)
@@ -0,0 +1,36 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+global $conf, $template;
+load_language('plugin.lang', F2B_PATH);
+$conf['Front2Back'] = explode(',', $conf['Front2Back']);
+
+// Enregistrement de la configuration
+if (isset($_POST['submit']))
+{
+	$conf['Front2Back'] = array(
+		!empty($_POST['path']) ? rtrim($_POST['path'],'/').'/' : '',
+		!empty($_POST['parent']) ? rtrim($_POST['parent'],'/').'/' : '',
+		!empty($_POST['hd_parent']) ? rtrim($_POST['hd_parent'],'/').'/' : '',
+		!empty($_POST['suffix']) ? $_POST['suffix'] : '',
+	);
+			
+    $query = 'UPDATE ' . CONFIG_TABLE . '
+		SET value="' . implode (',', $conf['Front2Back']) . '"
+		WHERE param="Front2Back"';
+    pwg_query($query);
+	
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+
+$template->assign(array(
+	'PATH' => $conf['Front2Back'][0],
+	'PARENT' => $conf['Front2Back'][1],
+	'HD_PARENT' => $conf['Front2Back'][2],
+	'SUFFIX' => $conf['Front2Back'][3],
+));
+	
+$template->set_filename('Front2Back_conf', dirname(__FILE__).'/template/admin.tpl');
+$template->assign_var_from_handle('ADMIN_CONTENT', 'Front2Back_conf');
+
+?>
Index: extensions/Back2Front/index.php
===================================================================
--- extensions/Back2Front/index.php	(revision 10819)
+++ extensions/Back2Front/index.php	(revision 10819)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Back2Front/language/en_UK/description.txt
===================================================================
--- extensions/Back2Front/language/en_UK/description.txt	(revision 10819)
+++ extensions/Back2Front/language/en_UK/description.txt	(revision 10819)
@@ -0,0 +1,1 @@
+Add a link on picture's page to show a alternative version of the pic (for postcards for example)
Index: extensions/Back2Front/language/en_UK/index.php
===================================================================
--- extensions/Back2Front/language/en_UK/index.php	(revision 10819)
+++ extensions/Back2Front/language/en_UK/index.php	(revision 10819)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Back2Front/language/en_UK/plugin.lang.php
===================================================================
--- extensions/Back2Front/language/en_UK/plugin.lang.php	(revision 10819)
+++ extensions/Back2Front/language/en_UK/plugin.lang.php	(revision 10819)
@@ -0,0 +1,13 @@
+<?php
+
+$lang['See back'] = 'See back';
+$lang['See front'] = 'See front';
+$lang['Unknown id for frontside picture'] = 'Unknown id for frontside picture';
+$lang['Nobody (backside)'] = 'Nobody (backside)';
+$lang['Level 99'] = 'Backside';
+$lang['This picture is a backside...'] = 'This picture is a backside...';
+$lang['...of the picture n°'] = '...of the picture n°';
+$lang['Backside management'] = 'Backside management';
+$lang['This picture has a backside :'] = 'This picture has a backside :';
+
+?>
Index: extensions/Back2Front/language/fr_FR/description.txt
===================================================================
--- extensions/Back2Front/language/fr_FR/description.txt	(revision 10819)
+++ extensions/Back2Front/language/fr_FR/description.txt	(revision 10819)
@@ -0,0 +1,1 @@
+Ajoute un lien sous l'image pour afficher une version alternative (pour des cartes-postales par exemple)
Index: extensions/Back2Front/language/fr_FR/index.php
===================================================================
--- extensions/Back2Front/language/fr_FR/index.php	(revision 10819)
+++ extensions/Back2Front/language/fr_FR/index.php	(revision 10819)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Back2Front/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/Back2Front/language/fr_FR/plugin.lang.php	(revision 10819)
+++ extensions/Back2Front/language/fr_FR/plugin.lang.php	(revision 10819)
@@ -0,0 +1,13 @@
+<?php
+
+$lang['See back'] = 'Voir le verso';
+$lang['See front'] = 'Voir le recto';
+$lang['Unknown id for frontside picture'] = 'id inconnu pour le recto';
+$lang['Nobody (backside)'] = 'Personne (verso)';
+$lang['Level 99'] = 'Verso';
+$lang['This picture is a backside...'] = 'Cette image est le verso...';
+$lang['...of the picture n°'] = "...de l'image n°";
+$lang['Backside management'] = 'Gestion recto/verso';
+$lang['This picture has a backside :'] = 'Cette image a un verso :';
+
+?>
Index: extensions/Back2Front/language/index.php
===================================================================
--- extensions/Back2Front/language/index.php	(revision 10819)
+++ extensions/Back2Front/language/index.php	(revision 10819)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Back2Front/main.inc.php
===================================================================
--- extensions/Back2Front/main.inc.php	(revision 10819)
+++ extensions/Back2Front/main.inc.php	(revision 10819)
@@ -0,0 +1,35 @@
+<?php 
+/*
+Plugin Name: Back2Front
+Version: auto
+Description: Add a link on picture's page to show a alternative version of the pic (for postcards for example)
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=533
+Author: Mistic
+Author URI: http://www.strangeplanet.fr
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $prefixeTable;
+
+define('B2F_DIR', basename(dirname(__FILE__)));
+define('B2F_PATH', PHPWG_PLUGINS_PATH . B2F_DIR . '/');
+define('B2F_TABLE', $prefixeTable . 'image_verso');
+
+load_language('plugin.lang', B2F_PATH);
+include_once(B2F_PATH . 'Back2Front.php');
+
+add_event_handler('render_element_content', 'Back2Front_picture_content', 99, 2);
+//add_event_handler('loc_end_section_init', 'Back2Front_items');
+add_event_handler('loc_end_admin', 'Back2Front_picture_modify');
+
+
+/* 	add_event_handler('get_admin_plugin_menu_links', 'Front2Back_admin_menu');
+	function Front2Back_admin_menu($menu) 
+	{
+		array_push($menu, array(
+			'NAME' => 'Front2Back',
+			'URL' => get_root_url().'admin.php?page=plugin-' . B2F_DIR));
+		return $menu;
+	} */
+
+?>
Index: extensions/Back2Front/maintain.inc.php
===================================================================
--- extensions/Back2Front/maintain.inc.php	(revision 10819)
+++ extensions/Back2Front/maintain.inc.php	(revision 10819)
@@ -0,0 +1,32 @@
+<?php
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_install() {
+	global $prefixeTable;
+
+	pwg_query("CREATE TABLE `" . $prefixeTable . "image_verso` (
+    `image_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
+    `verso_id` smallint(8) unsigned NOT NULL DEFAULT '0',
+    `old_level` tinyint unsigned NOT NULL DEFAULT '0',
+    PRIMARY KEY (`image_id`,`verso_id`)
+	) DEFAULT CHARSET=utf8;");
+}
+
+function plugin_activate(){
+	global $conf, $prefixeTable;
+
+}
+
+function plugin_uninstall() {
+	global $prefixeTable;
+
+  $query = "SELECT * FROM `" . $prefixeTable . "image_verso`;";
+  $result = pwg_query($query);
+  while ($item = pwg_db_fetch_assoc($result))
+  {
+    pwg_query("UPDATE ".IMAGES_TABLE." SET level = ".$item['old_level']." WHERE id = ".$item['verso_id'].";");
+  }
+  
+	pwg_query("DROP TABLE `" . $prefixeTable . "image_verso`;");
+}
+?>
Index: extensions/Back2Front/template/admin.tpl
===================================================================
--- extensions/Back2Front/template/admin.tpl	(revision 10819)
+++ extensions/Back2Front/template/admin.tpl	(revision 10819)
@@ -0,0 +1,31 @@
+<div class="titrePage">
+	<h2>Front2Back</h2>
+</div>
+
+<form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 
+	<fieldset>
+		<legend>{'Configuration'|@translate}</legend>	  
+		<ul>			
+			<li>
+				<span class="property">{'f2b_path'|@translate}</span>
+				<input type="text" name="path" value="{$PATH}"/>
+			</li>
+			<li>
+				<span class="property">{'f2b_parent'|@translate}</span>
+				<input type="text" name="parent" value="{$PARENT}"/>
+			</li>		
+			<li>
+				<span class="property">{'f2b_hd_parent'|@translate}</span>
+				<input type="text" name="hd_parent" value="{$HD_PARENT}"/>
+			</li>
+			<li>
+				<span class="property">{'f2b_suffix'|@translate}</span>
+				<input type="text" name="suffix" value="{$SUFFIX}"/>
+			</li>
+		</ul>
+	</fieldset>
+		
+	<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
+</form>
+
+{'f2b_help'|@translate}
Index: extensions/Back2Front/template/admin_button.tpl
===================================================================
--- extensions/Back2Front/template/admin_button.tpl	(revision 10819)
+++ extensions/Back2Front/template/admin_button.tpl	(revision 10819)
@@ -0,0 +1,3 @@
+<a href="{$VERSO_U_ADMIN}" title="{'Modify verso information'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
+  <span class="pwg-icon pwg-icon-edit"> </span><span class="pwg-button-text">{'edit'|@translate}</span>
+</a>
Index: extensions/Back2Front/template/index.php
===================================================================
--- extensions/Back2Front/template/index.php	(revision 10819)
+++ extensions/Back2Front/template/index.php	(revision 10819)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: extensions/Back2Front/template/picture_content.tpl
===================================================================
--- extensions/Back2Front/template/picture_content.tpl	(revision 10819)
+++ extensions/Back2Front/template/picture_content.tpl	(revision 10819)
@@ -0,0 +1,44 @@
+{combine_css path=$B2F_PATH|@cat:"template/style.css"}
+
+{footer_script require="jquery"}
+	jQuery('.reverse').click(function() {ldelim}
+		if (jQuery(this).attr('rel') == 'front') {ldelim}
+			/* picture attributes */
+			jQuery('#theImage img:first-child').attr({ldelim}
+				src: '{$VERSO_URL}',
+				style: 'width:;height:;',
+			});
+			
+			/* hd link atributes */
+			{if isset($VERSO_HD)}
+			jQuery('#theImage a:first-child').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');
+			
+		} else if (jQuery(this).attr('rel') == 'back') {ldelim}
+			jQuery('#theImage img:first-child').attr({ldelim}
+				src: '{$SRC_IMG}',
+				style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
+			});
+			
+			{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}
+			
+			jQuery(this).html('<img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}');
+			jQuery(this).attr('rel', 'front');
+		}
+	});
+{/footer_script}
+
+<a class="reverse" rel="front" href="#">
+	<img src="{$B2F_PATH}template/rotate_1.png"/>
+	{'See back'|@translate}
+</a>
Index: extensions/Back2Front/template/picture_modify.tpl
===================================================================
--- extensions/Back2Front/template/picture_modify.tpl	(revision 10819)
+++ extensions/Back2Front/template/picture_modify.tpl	(revision 10819)
@@ -0,0 +1,62 @@
+{footer_script}
+$(document).ready(function () {ldelim}
+  $('input[name="b2f_is_verso"]').change(function () {ldelim}
+    if (this.checked) {ldelim}
+      $('#frontside_id').css('visibility', '');
+      $('select[name="level"]').prepend('<option label="{'Nobody (backside)'|@translate}" value="99">{'Nobody (backside)'|@translate}</option>');
+      $('select[name="level"]').val('99').attr('readonly', 'readonly').css('opacity', '0.6');
+      
+    } else {ldelim}
+      $('#frontside_id').css('visibility', 'hidden');
+      $('select[name="level"] option[value="99"]').remove();
+      $('select[name="level"]').val($('input[name="b2f_old_level"]').val()).removeAttr('readonly').css('opacity', '1');
+    }
+  });
+
+  {if isset($B2F_IS_VERSO)}
+  $('#frontside_id').css('visibility', '');
+  $('select[name="level"]').prepend('<option label="{'Nobody (backside)'|@translate}" value="99">{'Nobody (backside)'|@translate}</option>');
+  $('select[name="level"]').val('99').attr('readonly', 'readonly').css('opacity', '0.6');
+  {else}
+  $('#frontside_id').css('visibility', 'hidden');
+  $('select[name="level"]').val('{$level_options_selected.0}');
+  {/if}
+});
+{/footer_script}
+
+
+<form action="{$F_ACTION}#back2front" method="post" id="back2front">
+
+  <fieldset>
+    <legend>{'Backside management'|@translate}</legend>
+
+    <table>
+    {if isset($B2F_VERSO_ID)}
+      <tr>
+        <td><strong>{'This picture has a backside :'|@translate}</strong></td>
+        <td><a href="{$B2F_VERSO_URL}">{$B2F_VERSO_ID} - {$B2F_VERSO_NAME}</a></td>
+      </tr>
+    </table>
+    {else}
+
+      <tr>
+        <td><strong>{'This picture is a backside...'|@translate}</strong></td>
+        <td><input type="checkbox" name="b2f_is_verso" {$B2F_IS_VERSO}></td>
+      </tr>
+
+      <tr id="frontside_id">
+        <td><strong>{'...of the picture n°'|@translate}</strong></td>
+        <td><input type="text" size="4" name="b2f_front_id" value="{$B2F_FRONT_ID}"></td>
+      </tr>
+
+    </table>
+
+    <p style="text-align:center;">
+      <input type="hidden" name="b2f_old_level" value="{if isset($B2F_OLD_LEVEL)}{$B2F_OLD_LEVEL}{else}{$level_options_selected.0}{/if}">
+      <input class="submit" type="submit" value="{'Submit'|@translate}" name="b2f_submit">
+    </p>
+    {/if}
+
+  </fieldset>
+
+</form>
Index: extensions/Back2Front/template/style.css
===================================================================
--- extensions/Back2Front/template/style.css	(revision 10819)
+++ extensions/Back2Front/template/style.css	(revision 10819)
@@ -0,0 +1,12 @@
+a.reverse {
+  display:inline-block;
+  border:1px solid #666 !important;
+  padding:3px 5px;
+  margin-bottom:10px;
+  font-size:15px;
+  font-style:italic;	
+}
+a.reverse img {
+  vertical-align:top;
+  border:none !important;
+}
