Index: /extensions/gally/gally-default/admin/Conf.class.inc.php
===================================================================
--- /extensions/gally/gally-default/admin/Conf.class.inc.php	(revision 16015)
+++ /extensions/gally/gally-default/admin/Conf.class.inc.php	(revision 16016)
@@ -175,5 +175,13 @@
       "menuMSIEMaxWidth" => '',
       "imageSimulateHighRes" => '',
-      "imageScrollMinDeadArea" => ''
+      "imageScrollMinDeadArea" => '',
+      "manageTips" => '',
+      "manageTipsPos" => '',
+      "tipsSize" => '',
+      "randomPositionBoxX" => '',
+      "randomPositionBoxY" => '',
+      "metaNumCols" => '',
+      "interfaceTimerDelay" => '',
+      "imageAutoScroll" => ''
       //"expandMenu" => '',
     );
Index: /extensions/gally/gally-default/admin/GallyDefault.class.inc.php
===================================================================
--- /extensions/gally/gally-default/admin/GallyDefault.class.inc.php	(revision 16015)
+++ /extensions/gally/gally-default/admin/GallyDefault.class.inc.php	(revision 16016)
@@ -20,5 +20,5 @@
 class GallyDefault
 {
-  const THEME_VERSION = '1.4.1';
+  const THEME_VERSION = '1.5.0';
 
   private $directories=Array(
Index: /extensions/gally/gally-default/admin/gally_img_high_res.tpl
===================================================================
--- /extensions/gally/gally-default/admin/gally_img_high_res.tpl	(revision 16015)
+++ /extensions/gally/gally-default/admin/gally_img_high_res.tpl	(revision 16016)
@@ -2,13 +2,4 @@
 <br>
 <form method="post" action="" class="general">
-
-  <fieldset>
-    <legend>{'gally_display_high_res_icon'|@translate}</legend>
-
-    <p class="leftAlign">{'gally_display_high_res_icon_desc'|@translate}</p>
-
-    <label><input type="radio" name="f_displayHighResIcon" id="idisplayHighResIcon" value="yes" {if $options.displayHighResIcon=="yes"}checked{/if}>&nbsp;{'gally_displayHighResIcon_yes'|@translate}</label><br>
-    <label><input type="radio" name="f_displayHighResIcon" id="idisplayHighResIcon" value="no" {if $options.displayHighResIcon=="no"}checked{/if}>&nbsp;{'gally_displayHighResIcon_no'|@translate}</label>
-  </fieldset>
 
   <fieldset>
Index: /extensions/gally/gally-default/conf/default.conf
===================================================================
--- /extensions/gally/gally-default/conf/default.conf	(revision 16015)
+++ /extensions/gally/gally-default/conf/default.conf	(revision 16016)
@@ -190,10 +190,4 @@
 
 # -- 1.3.0 --
-# the 'displayHighResIcon' option can take theses values :
-#   "yes" => display an icon 'view full res' in the toolbar
-#   "no"  => don't display an icon 'view full res' in the toolbar
-displayHighResIcon="yes"
-
-# -- 1.3.0 --
 # the 'highResClickMode' option can take theses values :
 #   "close" => click on the high res picture close the high res picture
@@ -216,4 +210,9 @@
 manageTipsPos="tipOnBottom"
 
+# -- 1.5.0 --
+# the 'tipsSize' option can take any positive integer values.
+# This option define the size (Width&Height) of an arrow
+tipsSize=12
+
 # ------- Menu parameters ------------------------------------------------------
 
Index: /extensions/gally/gally-default/css/theme.css
===================================================================
--- /extensions/gally/gally-default/css/theme.css	(revision 16015)
+++ /extensions/gally/gally-default/css/theme.css	(revision 16016)
@@ -21,2 +21,26 @@
   display:inline-block;
 }
+
+.switchBox {
+  padding: 0.5em 5px;
+  border-radius: 4px;
+  z-index: 100;
+  text-align:left;
+  display: none;
+  position: absolute;
+  left: 0; top: 0; /*left, right set through js*/
+}
+
+.switchBoxTitle {
+  padding-bottom:5px;
+  margin-bottom:5px;
+}
+
+.relSwitchBox {
+  position: relative;
+}
+
+#derivativeSwitchBox a {
+  cursor:pointer;
+}
+
Index: /extensions/gally/gally-default/css/thumbnails.css
===================================================================
--- /extensions/gally/gally-default/css/thumbnails.css	(revision 16015)
+++ /extensions/gally/gally-default/css/thumbnails.css	(revision 16016)
@@ -54,6 +54,4 @@
   padding:0px;
   float:left;
-  width:240px;
-  height:210px;
 }
 
@@ -120,9 +118,9 @@
 .illustration {
   float:left;
-  width:140px;
+  min-width:140px;
 }
 
 .description {
-  height:140px;
+  min-height:140px;
   overflow:auto;
   padding-left:8px;
Index: /extensions/gally/gally-default/js/gallyjs-tcp.js
===================================================================
--- /extensions/gally/gally-default/js/gallyjs-tcp.js	(revision 16015)
+++ /extensions/gally/gally-default/js/gallyjs-tcp.js	(revision 16016)
@@ -136,4 +136,44 @@
       $("#additional_infoTOP").css("visibility", "visible");
     }
+
+    $("#icon_derivatives").click(function()
+      {
+        var elt = $("#derivativeSwitchBox");
+        elt.css("left", 0);
+
+        $("#sortOrderBox").hide();
+        elt.css("left", Math.min( $(this).position().left + $('#tabRandomButtons').outerWidth(true) - 5, $('#the_page').width() - elt.outerWidth(true) - 5))
+          .css("top", $(this).position().top)
+          .toggle();
+          $('#iSimpleTip').css('display', 'none'); // if tip activated, hide it..
+      }
+    );
+    $("#derivativeSwitchBox").on("mouseleave click", function()
+      {
+        $(this).hide();
+      }
+    );
+
+    $("#icon_sort").click(function()
+      {
+        var elt = $("#sortOrderBox");
+        elt.css("left", 0);
+
+        $("#derivativeSwitchBox").hide();
+        elt.css("left", Math.min( $(this).position().left + $('#tabRandomButtons').outerWidth(true) - 5, $('#the_page').width() - elt.outerWidth(true) - 5))
+          .css("top", $(this).position().top)
+          .toggle();
+          $('#iSimpleTip').css('display', 'none'); // if tip activated, hide it..
+      }
+    );
+    $("#sortOrderBox").on("mouseleave click", function()
+      {
+        $(this).hide();
+      }
+    );
+
+    liWidth=$('ul.thumbnails li').outerWidth();
+    thumbListWidth=$('#thumbnails').width();
+    $('div ul.thumbnails').css('padding-left', (thumbListWidth-liWidth*Math.floor(thumbListWidth/liWidth))/2-1);
   },
 
Index: /extensions/gally/gally-default/js/gallyjs-tpp.js
===================================================================
--- /extensions/gally/gally-default/js/gallyjs-tpp.js	(revision 16015)
+++ /extensions/gally/gally-default/js/gallyjs-tpp.js	(revision 16016)
@@ -44,4 +44,5 @@
       },
       container=null,
+      initialThumbPos=null,
 
   /**
@@ -109,10 +110,4 @@
                         .bind("mousemove", function () { switchInterface('y', true); } );
     }
-
-
-    $("#navThumbPrev").css("top", $("#navThumbPrev").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
-    $("#navThumbNext").css("top", $("#navThumbNext").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
-
-    $("#theImage").css("top", $("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
 
     $("#contentid").attr("rows", options.commentRows);
@@ -166,4 +161,31 @@
     );
 
+    $("#icon_derivatives").click(function()
+      {
+        var elt = $("#derivativeSwitchBox");
+
+        elt.css("left", Math.min( $(this).position().left + $('#tabRandomButtons').outerWidth(true), $(window).width() - elt.outerWidth(true) - 5))
+          .css("top", $(this).position().top)
+          .toggle();
+          $('#iSimpleTip').css('display', 'none'); // if tip activated, hide it..
+      }
+    );
+    $("#derivativeSwitchBox, #privacyLevelBox").on("mouseleave click", function()
+      {
+        $(this).hide();
+      }
+    );
+
+    $('#iPrivacyLevelLink').click(function ()
+      {
+        var elt = $("#privacyLevelBox"),
+            ePos = $("#privacyLevelLink");
+
+        elt.css("left", $(this).position().left)
+           .css("top", $(this).position().top)
+           .toggle();
+      }
+    );
+
     $(window).resize( function () { initializeImageMode("resize"); } );
 
@@ -192,4 +214,5 @@
     var thumbWidth=0,
         imgTop=0,
+        imgPos='',
         cssValues = new Object;
 
@@ -272,9 +295,13 @@
       if($("#navThumbPrev").length>0)
       {
-        $("#navThumbPrev").css("height", $("#copyright").prop("offsetTop")-$("#navThumbPrev").prop("offsetTop")-options.tabsHidden+"px");
-      }
-      if($("#navThumbNext").length>0)
-      {
-        $("#navThumbNext").css("height", $("#copyright").prop("offsetTop")-$("#navThumbNext").prop("offsetTop")-options.tabsHidden+"px");
+        initialThumbPos=$("#navThumbPrev").position().top;
+      }
+      else if($("#navThumbNext").length>0)
+      {
+        initialThumbPos=$("#navThumbNext").position().top;
+      }
+      else
+      {
+        initialThumbPos=-1;
       }
     }
@@ -311,6 +338,21 @@
     }
 
-
-
+    imgTop=initialThumbPos;
+    //if position equals -1, mean top calculate it automatically - valid for "#navThumbPrev" & "#navThumbNext"
+    if(imgTop==-1)
+    {
+      imgTop=$("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+($("#theImgContainer").height()-$("#navThumbPrev").height())/2;
+    }
+
+    $("#navThumbPrev")
+        .css("top", imgTop)
+        .css("height", $("#copyright").prop("offsetTop")-$("#navThumbPrev").prop("offsetTop")-options.tabsHidden+"px");
+
+    $("#navThumbNext")
+        .css("top", imgTop)
+        .css("height", $("#copyright").prop("offsetTop")-$("#navThumbNext").prop("offsetTop")-options.tabsHidden+"px");
+
+
+    $("#theImage").css("top", $("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
 
     simulateHighRes();
@@ -634,4 +676,38 @@
   };
 
+  function changeImgSrc(url,typeSave,typeMap,cookiePath)
+  {
+    $("#theMainImage")
+      .removeAttr("width height")
+      .attr("src", url)
+      .load(function ()
+        {
+          initializeImageMode("resize");
+        }
+      );
+
+    $('#derivativeSwitchBox .switchCheck').css('visibility','hidden');
+    $('#derivativeChecked'+typeSave).css('visibility','visible');
+
+    document.cookie = 'picture_deriv='+typeSave+';path='+cookiePath;
+  }
+
+  function setPrivacyLevel(rootUrl, id, level)
+  {
+    var y = new PwgWS(rootUrl);
+
+    y.callService(
+      "pwg.images.setPrivacyLevel",
+      {image_id: id, level:level} ,
+      {
+        method: "POST",
+        onFailure: function(num, text) { alert(num + " " + text); },
+        onSuccess: function(result) {
+          jQuery('#privacyLevelBox .switchCheck').css('visibility','hidden');
+          jQuery('#levelCheck'+level).css('visibility','visible');
+        }
+      }
+    );
+  }
 
   this.closeDisplayHigh = function () { closeDisplayHigh(); };
@@ -641,4 +717,6 @@
   this.getTabsProp = function () { return tabs; };
   this.openDisplayHigh = function (url) { openDisplayHigh(url); };
+  this.changeImgSrc = function (url,typeSave,typeMap,cookiePath) { changeImgSrc(url,typeSave,typeMap,cookiePath); };
+  this.setPrivacyLevel = function (rootUrl, id, level) { setPrivacyLevel(rootUrl, id, level); };
 
   init();
Index: /extensions/gally/gally-default/js/gallyjs-ttm.js
===================================================================
--- /extensions/gally/gally-default/js/gallyjs-ttm.js	(revision 16015)
+++ /extensions/gally/gally-default/js/gallyjs-ttm.js	(revision 16016)
@@ -56,9 +56,8 @@
                   targetPos:'top-middle',
                   tipPos:'bottom-middle',
-                  offsetY:14,
-                  arrowHeight:13,
-                  arrowWidth:17,
-                  drawArrow:true,
-                  arrowImgDir:options.themePath
+                  offsetY:options.tipsSize,
+                  arrowHeight:options.tipsSize,
+                  arrowWidth:options.tipsSize,
+                  drawArrow:true
                 }
               );
@@ -71,9 +70,8 @@
                   targetPos:'middle-right',
                   tipPos:'middle-left',
-                  offsetX:12,
-                  arrowHeight:17,
-                  arrowWidth:12,
-                  drawArrow:true,
-                  arrowImgDir:options.themePath
+                  offsetX:options.tipsSize,
+                  arrowHeight:options.tipsSize,
+                  arrowWidth:options.tipsSize,
+                  drawArrow:true
                 }
               );
@@ -86,9 +84,8 @@
                   targetPos:'middle-left',
                   tipPos:'middle-right',
-                  offsetX:12,
-                  arrowHeight:17,
-                  arrowWidth:12,
-                  drawArrow:true,
-                  arrowImgDir:options.themePath
+                  offsetX:options.tipsSize,
+                  arrowHeight:options.tipsSize,
+                  arrowWidth:options.tipsSize,
+                  drawArrow:true
                 }
               );
@@ -101,9 +98,8 @@
                   targetPos:'bottom-middle',
                   tipPos:'top-middle',
-                  offsetY:12,
-                  arrowHeight:12,
-                  arrowWidth:17,
-                  drawArrow:true,
-                  arrowImgDir:options.themePath
+                  offsetY:options.tipsSize,
+                  arrowHeight:options.tipsSize,
+                  arrowWidth:options.tipsSize,
+                  drawArrow:true
                 }
               );
Index: /extensions/gally/gally-default/js/simpleTip.js
===================================================================
--- /extensions/gally/gally-default/js/simpleTip.js	(revision 16015)
+++ /extensions/gally/gally-default/js/simpleTip.js	(revision 16016)
@@ -70,5 +70,4 @@
       offsetY:0,
       classes:'',
-      arrowImgDir: '',
       arrowWidth: 12,
       arrowHeight: 12
@@ -322,5 +321,5 @@
         arrowX=-bwX;
         arrowY=-items[itemIndex].options.arrowHeight+bwY;
-        arrowModel='up';
+        arrowModel='Up';
         break;
 
@@ -330,5 +329,5 @@
         arrowX=(stWidthI-items[itemIndex].options.arrowWidth)/2;
         arrowY=-items[itemIndex].options.arrowHeight+bwY;
-        arrowModel='up';
+        arrowModel='Up';
         break;
 
@@ -338,5 +337,5 @@
         arrowX=stWidthI-items[itemIndex].options.arrowWidth+bwX;
         arrowY=-items[itemIndex].options.arrowHeight+bwY;
-        arrowModel='up';
+        arrowModel='Up';
         break;
 
@@ -346,5 +345,5 @@
         arrowX=-items[itemIndex].options.arrowWidth+bwX;
         arrowY=(stHeightI-items[itemIndex].options.arrowHeight)/2+bwY;
-        arrowModel='left';
+        arrowModel='Left';
         break;
 
@@ -359,5 +358,5 @@
         arrowX=stWidthI+bwX;
         arrowY=(stHeightI-items[itemIndex].options.arrowHeight)/2+bwY;
-        arrowModel='right';
+        arrowModel='Right';
         break;
 
@@ -367,5 +366,5 @@
         arrowX=-bwX;
         arrowY=stHeightI+bwY;
-        arrowModel='down';
+        arrowModel='Down';
         break;
 
@@ -375,5 +374,5 @@
         arrowX=(stWidthI-items[itemIndex].options.arrowWidth)/2+bwX;
         arrowY=stHeightI+bwY;
-        arrowModel='down';
+        arrowModel='Down';
         break;
 
@@ -383,5 +382,5 @@
         arrowX=stWidthI-items[itemIndex].options.arrowWidth+bwX;
         arrowY=stHeightI+bwY;
-        arrowModel='down';
+        arrowModel='Down';
         break;
     }
@@ -389,8 +388,23 @@
     if(items[itemIndex].options.drawArrow & arrowModel!='')
     {
+      switch(arrowModel)
+      {
+        case 'Up':
+          bgp='0px -'+items[itemIndex].options.arrowHeight+'px';
+          break;
+        case 'Left':
+          bgp='-'+items[itemIndex].options.arrowWidth+'px 0px';
+          break;
+        case 'Down':
+          bgp='0px 0px';
+          break;
+        case 'Right':
+          bgp='-'+items[itemIndex].options.arrowHeight+'px -'+items[itemIndex].options.arrowWidth+'px';
+          break;
+      }
       $('#iSimpleTipArrow'+options.name).css(
         {
           display: 'block',
-          background: 'url("'+items[itemIndex].options.arrowImgDir+'/arrow_'+arrowModel+'.png") no-repeat scroll 0 0 transparent',
+          backgroundPosition: bgp,
           marginLeft: arrowX+'px',
           marginTop: arrowY+'px',
@@ -434,5 +448,5 @@
     if($('#iSimpleTip'+options.name).length==0)
     {
-      text="<div id='iSimpleTip"+options.name+"' style='z-index:15000;display:none;position:absolute;left:0px;top:0px;'><div id='iSimpleTipShadow"+options.name+"' style='position:absolute;width:100%;height:100%;background:#000000;opacity:0.4;filter:alpha(opacity:40);display:block;z-index:-1;margin-left:2px;margin-top:2px;'></div><div id='iSimpleTipArrow"+options.name+"' style='position:absolute;'></div><div id='iSimpleTipContent"+options.name+"'></div></div>";
+      text="<div class='cSimpleTip' id='iSimpleTip"+options.name+"' style='z-index:15000;display:none;position:absolute;left:0px;top:0px;'><div class='cSimpleTipShadow' id='iSimpleTipShadow"+options.name+"'></div><div class='cSimpleTipArrow' id='iSimpleTipArrow"+options.name+"'></div><div class='cSimpleTipContent' id='iSimpleTipContent"+options.name+"'></div></div>";
       $('body').append(text);
     }
Index: /extensions/gally/gally-default/language/en_UK/theme.lang.php
===================================================================
--- /extensions/gally/gally-default/language/en_UK/theme.lang.php	(revision 16015)
+++ /extensions/gally/gally-default/language/en_UK/theme.lang.php	(revision 16016)
@@ -6,24 +6,17 @@
 $lang['gally_save_local_conf'] = 'Saving settings';
 
-$lang['gally_img_high_res'] = 'Picture/High resolution';
 $lang['gally_img_interface'] = 'Picture/Interface';
 $lang['gally_img_other'] = 'Picture/Other';
 
-$lang['gally_img_high_res_desc'] = 'This page lets you define the properties of the user interface when viewing an image in high resolution';
 $lang['gally_img_interface_desc'] = 'This page lets you define the properties of the user interface when viewing an image';
 $lang['gally_img_other_desc'] = 'This page lets you define various properties of the user interface when viewing an image';
 
 $lang['gally_default_zoom_size'] = 'Default zoom size';
-$lang['gally_default_zoom_size_desc'] = 'This option sets the display type used by default when a high definition image is loaded';
 $lang['gally_defaultZoomSize_full'] = 'Actual size (if image doesn\'t fit on the screen, it\'s possible to scroll horizontally and vertically)';
 $lang['gally_defaultZoomSize_fit'] = 'The image is resized to be fully displayed on the screen';
 $lang['gally_display_high_res_icon'] = 'Icon in the toolbar';
-$lang['gally_display_high_res_icon_desc'] = 'This option, if the image has a version in high resolution, display an icon in the toolbar';
 $lang['gally_displayHighResIcon_yes'] = 'Show icon';
 $lang['gally_displayHighResIcon_no'] = 'Do not display the icon';
-$lang['gally_display_high_res_click_mode'] = 'Action associated with the high resolution image';
-$lang['gally_display_high_res_click_mode_desc'] = 'This option defines how the interface behaves when you click on the image in high resolution';
 $lang['gally_highResClickMode_zoom'] = 'Changing the type of zoom (Actual Size / resized)';
-$lang['gally_highResClickMode_close'] = 'Quit displaying the image in high resolution';
 
 $lang['gally_interface_on_image'] = 'Display hover';
@@ -68,4 +61,16 @@
 $lang['gally_alternate_banner_content'] = 'Alternative banner content:';
 
+// v1.5.0
+$lang['gally_img_high_res'] = 'Picture/Lightbox view';
+$lang['gally_img_high_res_desc'] = 'This page lets you define the properties of the user interface when viewing an image in a lightbox';
 
+$lang['gally_default_zoom_size_desc'] = 'This option sets the display type used by default in a lightbox when an image bigger than the screen size is loaded';
+
+$lang['gally_display_high_res_click_mode'] = 'Action associated with the lightbox';
+$lang['gally_display_high_res_click_mode_desc'] = 'This option defines how the interface behaves when you click on the image in the lightbox';
+$lang['gally_highResClickMode_close'] = 'Close the lightbox';
+
+/* --removed
+$lang['gally_display_high_res_icon_desc'] = '';
+*/
 ?>
Index: /extensions/gally/gally-default/language/fr_FR/theme.lang.php
===================================================================
--- /extensions/gally/gally-default/language/fr_FR/theme.lang.php	(revision 16015)
+++ /extensions/gally/gally-default/language/fr_FR/theme.lang.php	(revision 16016)
@@ -6,29 +6,17 @@
 $lang['gally_save_local_conf'] = 'Enregistrement de la configuration';
 
-$lang['gally_img_high_res'] = 'Image/Haute résolution';
 $lang['gally_img_interface'] = 'Image/Interface';
 $lang['gally_img_other'] = 'Image/Autres';
 
-$lang['gally_img_high_res_desc'] = 'Cette page permet de définir les propriétés de l\'interface utilisateur lors de la visualisation d\'une image en haute résolution';
 $lang['gally_img_interface_desc'] = 'Cette page permet de définir les propriétés de l\'interface utilisateur lors de la visualisation d\'une image';
 $lang['gally_img_other_desc'] = 'Cette page permet de définir diverses propriétés de l\'interface utilisateur lors de la visualisation d\'une image';
 
 $lang['gally_default_zoom_size'] = 'Taille du zoom par défaut';
-$lang['gally_default_zoom_size_desc'] = 'Cette option permet de définir le type d\'affichage utilisé par défaut lorsqu\'une image en haute définition est chargée';
 $lang['gally_defaultZoomSize_full'] = 'Taille réelle (si l\'image ne tiens pas sur l\'écran, il est possible de la faire défiler en largeur et en hauteur)';
 $lang['gally_defaultZoomSize_fit'] = 'L\'image est redimensionnée pour être affichée entièrement sur l\'écran';
 $lang['gally_display_high_res_icon'] = 'Icône dans la barre d\'outil';
-$lang['gally_display_high_res_icon_desc'] = 'Cette option permet, si l\'image dispose d\'une version en haute résolution, d\'afficher une icône dans la barre d\'outil';
 $lang['gally_displayHighResIcon_yes'] = 'Afficher l\'icône';
 $lang['gally_displayHighResIcon_no'] = 'Ne pas afficher l\'icône';
-$lang['gally_display_high_res_click_mode'] = 'Action associée à l\'image en haute résolution';
-$lang['gally_display_high_res_click_mode_desc'] = 'Cette option permet de définir comment se comporte l\'interface lorsque que l\'on clique sur l\'image en haute résolution';
 $lang['gally_highResClickMode_zoom'] = 'Changer le type de zoom (Taille réelle / redimensionné)';
-$lang['gally_highResClickMode_close'] = 'Quitter l\'affichage de l\'image en haute résolution';
-
-$lang['gally_image_interface_can_switch']='Visibilité permanente de l\'interface';
-$lang['gally_image_interface_can_switch_desc']='Cette option permet de déterminer si l\'interface est affichée en permanence ou si elle peut être masquée';
-$lang['gally_image_interface_can_switch_yes']='L\'interface n\'est visible que selon les règles définies';
-$lang['gally_image_interface_can_switch_no']='L\'interface est visible en permanence';
 
 $lang['gally_interface_on_image'] = 'Affichage au survol';
@@ -54,6 +42,5 @@
 $lang['gally_display_banner_yes'] = 'Afficher la bannière';
 $lang['gally_display_banner_no'] = 'Ne pas afficher la bannière';
-$lang['gally_display_banner_alternate'] = 'Afficher une bannière alternative';
-$lang['gally_alternate_banner_content'] = 'Contenu de la bannière alternative :';
+
 
 $lang['gally_image_auto_scroll'] = 'Gestion des images panoramiques';
@@ -66,3 +53,26 @@
 $lang['gally_image_simulate_high_res'] = 'Simuler la présence d\'une image haute résolution pour les images panomariques';
 
+// v1.3.5
+$lang['gally_image_interface_can_switch']='Visibilité permanente de l\'interface';
+$lang['gally_image_interface_can_switch_desc']='Cette option permet de déterminer si l\'interface est affichée en permanence ou si elle peut être masquée';
+$lang['gally_image_interface_can_switch_yes']='L\'interface n\'est visible que selon les règles définies';
+$lang['gally_image_interface_can_switch_no']='L\'interface est visible en permanence';
+$lang['gally_display_banner_alternate'] = 'Afficher une bannière alternative';
+$lang['gally_alternate_banner_content'] = 'Contenu de la bannière alternative :';
+
+// v1.5.0
+$lang['gally_img_high_res'] = 'Image/Affichage lightbox';
+$lang['gally_img_high_res_desc'] = 'Cette page permet de définir les propriétés de l\'interface utilisateur lors de la visualisation d\'une image dans une lightbox';
+
+$lang['gally_default_zoom_size_desc'] = 'Cette option permet de définir le type d\'affichage utilisé par défaut dans la lightbox lorsqu\'une image plus grande que l\'écran est affichée';
+
+$lang['gally_display_high_res_click_mode'] = 'Action associée à la lightbox';
+$lang['gally_display_high_res_click_mode_desc'] = 'Cette option permet de définir comment se comporte l\'interface lorsque que l\'on clique sur l\'image dans la lightbox';
+$lang['gally_highResClickMode_close'] = 'Fermer la lightbox';
+
+/* --removed
+$lang['gally_display_high_res_icon_desc'] = '';
+*/
+
+
 ?>
Index: /extensions/gally/gally-default/release_notes.txt
===================================================================
--- /extensions/gally/gally-default/release_notes.txt	(revision 16015)
+++ /extensions/gally/gally-default/release_notes.txt	(revision 16016)
@@ -158,4 +158,7 @@
   |         |            |   . html code in picture nav title
   |         |            |
+  | 1.5.0   | 2012-05-29 | * mantis feature:????
+  |         |            |   . compatibility with piwigo 2.4
+  |         |            |   . add GallyTpl class {$gally} var in template
   |         |            |
   |         |            |
Index: /extensions/gally/gally-default/template/comment_list.tpl
===================================================================
--- /extensions/gally/gally-default/template/comment_list.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/comment_list.tpl	(revision 16016)
@@ -6,6 +6,5 @@
 *}
 
-<script type="text/javascript">
-{literal}
+{footer_script}{literal}
   function editInside(url, text, imageId, key, index)
   {
@@ -18,18 +17,15 @@
 
   }
-{/literal}
-
-</script>
+{/literal}{/footer_script}
 
 
 <div id="formEditInside" style="display:none;">
-  <form  method='post' action='' class='filter' id='editComment'>
-    <fieldset>
-      <legend>{'Edit a comment'|@translate}</legend>
+  <form  method='post' action='' id='editComment'>
+      {'Edit'|@translate}<br>
       <textarea name='content' id='contentEditId' rows='5' cols='80'></textarea></label><br>
       <input type='hidden' name='key' id='feiKey' value=''>
+      <input type="hidden" name="pwg_token" id='feiToken' value="{$gally->getToken()}">
       <input type='hidden' name='image_id' id='feiImageId' value=''>
       <input class='submit' type='submit' value='{"Submit"|@translate}'>
-    </fieldset>
   </form>
 </div>
@@ -39,60 +35,28 @@
 <li>
   <div class="commentDetail">
-    {if isset($comment.TN_SRC)}
+    {if isset($comment.src_image)}
     <div class="illustration">
       <a href="{$comment.U_PICTURE}">
-        <img src="{$comment.TN_SRC}" alt="{$comment.ALT}" />
+        <img src="{$pwg->derivative_url($derivative_params, $comment.src_image)}" alt="{$comment.ALT}">
       </a>
     </div>
     {/if}
     <div class="description">
-      {if isset($comment.U_DELETE) or isset($comment.U_VALIDATE) or isset($comment.U_EDIT) }
+      {if isset($comment.U_DELETE) or isset($comment.U_VALIDATE) or isset($comment.U_EDIT)}
       <ul class="actions" style="float:right">
         {if isset($comment.U_DELETE)}
         <li>
-          <span class="button id_delete" onclick="document.location='{$comment.U_DELETE}';" title="{'delete this comment'|@translate}"></span>
+          <span class="button id_delete" onclick="document.location='{$comment.U_DELETE}';" title="{'Delete'|@translate}"></span>
         </li>
         {/if}
 
-        {if isset($comment.U_EDIT) and !isset($comment.IN_EDIT)}
+        {if isset($comment.U_EDIT)}
         <li>
-          {php}
-            /*
-              this php code is used to calculate the key need to be allowed to
-              edit the comment, and determine the picture number if necessary
-              (theses properties are not in the template var because with the
-              default template, Piwigo reloads the page for editing an item :
-              this template is abble to edit an item without reloading the page)
-            */
-            global $conf;
-            $comment=$this->get_template_vars('comment');
-            $current=$this->get_template_vars('current');
-            if(!array_key_exists('image_id', $comment))
-            {
-              if(isset($current['id']))
-              {
-                $comment['IMAGE_ID']=$current['id'];
-              }
-              else
-              {
-                preg_match('#picture\.php\?/(\d+)/category/#i', $comment['U_PICTURE'], $result);
-                if(isset($result[1]))
-                {
-                  $comment['IMAGE_ID']=$result[1];
-                }
-              }
-            }
-            $now=time();
-            $comment['KEY']=$now.":".hash_hmac('md5', $now.':'.$comment['IMAGE_ID'], $conf['secret_key']);
-            $this->assign_by_ref('comment', $comment);
-          {/php}
-          <span class="button id_edit" onclick="editInside('{$comment.U_EDIT}#edit_comment}', '{$comment.CONTENT|@escape}', {$comment.IMAGE_ID|@default:$current.id}, '{$comment.KEY}', {$smarty.foreach.comment_loop.index});" title="{'edit this comment'|@translate}"></span>
-
+          <span class="button id_edit" onclick="editInside('{$comment.U_EDIT}#edit_comment', '{$comment.CONTENT|@escape}', {$gally->getCommentImage($comment.ID)}, '{$gally->getCommentKey($comment.ID)}', {$smarty.foreach.comment_loop.index});" title="{'Edit'|@translate}"></span>
         </li>
         {/if}
-
         {if isset($comment.U_VALIDATE)}
         <li>
-          <span class="button id_validate" onclick="document.location='{$comment.U_VALIDATE}';" title="{'validate this comment'|@translate}"></span>
+          <span class="button id_validate" onclick="document.location='{$comment.U_VALIDATE}';" title="{'Validate'|@translate}"></span>
         </li>
         {/if}
Index: /extensions/gally/gally-default/template/comments.tpl
===================================================================
--- /extensions/gally/gally-default/template/comments.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/comments.tpl	(revision 16016)
@@ -82,5 +82,5 @@
 {if isset($comments)}
 <div id="comments">
-  {include file='comment_list.tpl'}
+  {include file='comment_list.tpl' comment_derivative_params=$derivative_params}
 </div>
 {/if}
Index: /extensions/gally/gally-default/template/config.js.tpl
===================================================================
--- /extensions/gally/gally-default/template/config.js.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/config.js.tpl	(revision 16016)
@@ -27,5 +27,4 @@
   interfaceTimerDelay:{#interfaceTimerDelay#},
   defaultZoomSize:"{#defaultZoomSize#}",
-  displayHighResIcon:{if #displayHighResIcon#=='yes'}true{else}false{/if},
   highResClickMode:"{#highResClickMode#}",
 {/if} {if $BODY_ID=='theCategoryPage' or isset($MENUBAR)}
@@ -37,4 +36,5 @@
   manageTips:{if #manageTips#=='yes'}true{else}false{/if},
   manageTipsPos:"{#manageTipsPos#}",
+  tipsSize:{#tipsSize#},
   animateDelay:{#animateDelay#},
   themePath:"{$themeconf.icon_dir}"
Index: /extensions/gally/gally-default/template/footer.tpl
===================================================================
--- /extensions/gally/gally-default/template/footer.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/footer.tpl	(revision 16016)
@@ -1,17 +1,14 @@
 <!-- **GBL** >FOOTER> -->
 <div id="copyright">
- <a name="EoP"></a> <!-- End of Page -->
- {if isset($debug.TIME) }
+ {if isset($debug.TIME)}
  {'Page generated in'|@translate} {$debug.TIME} ({$debug.NB_QUERIES} {'SQL queries in'|@translate} {$debug.SQL_TIME}) -
  {/if}
-
- {* Please, do not remove this copyright. If you really want to,
+ {* 
+    Please, do not remove this copyright. If you really want to,
       contact us on http://piwigo.org to find a solution on how
       to show the origin of the script...
   *}
-
   {'Powered by'|@translate}
-  <a href="{$PHPWG_URL}" class="Piwigo">
-  <span class="Piwigo">Piwigo</span></a>
+  <a href="{$PHPWG_URL}" class="Piwigo"><span class="Piwigo">Piwigo</span></a>
   {$VERSION}
   {if isset($CONTACT_MAIL)}
@@ -19,4 +16,9 @@
   <a href="mailto:{$CONTACT_MAIL}?subject={'A comment on your site'|@translate|@escape:url}">{'Webmaster'|@translate}</a>
   {/if}
+  {if isset($TOGGLE_MOBILE_THEME_URL)}
+  - {'View in'|@translate} : <a href="{$TOGGLE_MOBILE_THEME_URL}">{'Mobile'|@translate}</a> | <b>{'Desktop'|@translate}</b>
+  {/if}
+
+{get_combined_scripts load='footer'}
 
 {if isset($footer_elements)}
@@ -25,10 +27,9 @@
 {/foreach}
 {/if}
-</div> <!-- copyright -->
-</div> <!-- the_page -->
+</div>{* copyright *}
+</div> {* the_page *}
 
 {if isset($debug.QUERIES_LIST)}<div id="debug">{$debug.QUERIES_LIST}</div>{/if}
 
-{get_combined_scripts load='footer'}
 </body>
 <!-- **GBL** <FOOTER< -->
Index: /extensions/gally/gally-default/template/header.tpl
===================================================================
--- /extensions/gally/gally-default/template/header.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/header.tpl	(revision 16016)
@@ -8,5 +8,5 @@
   {if isset($meta_ref) }
     {if isset($INFO_AUTHOR)}
-      <meta name="author" content="{$INFO_AUTHOR|@replace:'"':' '}">
+      <meta name="author" content="{$INFO_AUTHOR|@strip_tags:false|@replace:'"':' '}">
     {/if}
     {if isset($related_tags)}
@@ -25,5 +25,5 @@
     <title>{$PAGE_TITLE} | {$GALLERY_TITLE}</title>
   {/if}
-
+ <link rel="shortcut icon" type="image/x-icon" href="{$ROOT_URL}{$themeconf.icon_dir}/favicon.ico">
 
   <link rel="start" title="{'Home'|@translate}" href="{$U_HOME}" >
@@ -43,41 +43,13 @@
   <link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/gally-default/css/content.css">
 
-  {combine_script id="jquery" path="themes/default/js/jquery.min.js"}
-  {combine_script id="jquery.ui" path="themes/default/js/ui/minified/jquery.ui.core.min.js"}
-  {combine_script id="jquery.ui.tabs" path="themes/default/js/ui/minified/jquery.ui.tabs.min.js"}
-  {combine_script id="jquery.ui.dialog" path="themes/default/js/ui/minified/jquery.ui.dialog.min.js"}
-
-
-  {php}
-    $themes=$this->get_template_vars('themes');
-    foreach($themes as $theme)
-    {
-      $dir=dirname($_SERVER['SCRIPT_FILENAME'])."/themes/".$theme['id']."/conf/";
-      $dirlocal=dirname($_SERVER['SCRIPT_FILENAME'])."/".PWG_LOCAL_DIR."themes/".$theme['id']."/conf/";
-      $this->assign("default_conf", $dir."default.conf");
-      if(file_exists($dirlocal."local.conf"))
-      {
-        $this->assign("local_conf", $dirlocal."local.conf");
-      }
-      else
-      {
-        $this->assign("local_conf", "");
-      }
-    }
-  {/php}
-
-  {config_load file=$default_conf}
-  {if $local_conf!=""}
-    {config_load file=$local_conf}
-  {/if}
-
-  {php}
-      $this->assign("alternateBannerContent", html_entity_decode($this->get_config_vars('alternateBannerContent')));
-  {/php}
+  {combine_script id="jquery" path="themes/default/js/jquery.js"}
+  {combine_script id="jquery.ui" path="themes/default/js/ui/jquery.ui.core.js"}
+  {combine_script id="jquery.ui.tabs" path="themes/default/js/ui/jquery.ui.tabs.js"}
+  {combine_script id="jquery.ui.dialog" path="themes/default/js/ui/jquery.ui.dialog.js"}
 
   {include file='config.js.tpl'}
 
   {if #manageTips#=='yes'}
-    {combine_script id="gpc.simpleTip" path="themes/gally-default/js/simpleTip.min.js" require="jquery"}
+    {combine_script id="gpc.simpleTip" path="themes/gally-default/js/simpleTip.js" require="jquery"}
     {combine_script id="gallyjs-ttm" path="themes/gally-default/js/gallyjs-ttm.js" require="jquery"}
   {/if}
@@ -109,4 +81,9 @@
 {/foreach}
 
+{if isset($U_PREFETCH)}<link rel="prefetch" href="{$U_PREFETCH}">{/if}
+{if isset($U_CANONICAL)}<link rel="canonical" href="{$U_CANONICAL}">{/if}
+
+{if not empty($page_refresh)    }<meta http-equiv="refresh" content="{$page_refresh.TIME};url={$page_refresh.U_REFRESH}">{/if}
+
 {if not empty($head_elements)}
   {foreach from=$head_elements item=elt}{$elt}
@@ -115,4 +92,6 @@
 
 {get_combined_scripts load='header'}
+{combine_script id="jquery" load="footer"}
+
 </head>
 
@@ -137,5 +116,5 @@
 <div id="theHeader" style="display:none;"></div>
 <div id="theHeaderAlt">
-  {$alternateBannerContent}
+  {$gally->getAlternateBannerContent()}
 </div>
 {else}
Index: /extensions/gally/gally-default/template/identification.tpl
===================================================================
--- /extensions/gally/gally-default/template/identification.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/identification.tpl	(revision 16016)
@@ -31,12 +31,9 @@
   {/if}
 
-{include file='dialogs.tpl'}
-
+{include file='infos_errors.tpl'}
 
 <form action="{$F_LOGIN_ACTION}" method="post" name="login_form" class="properties" id="identification">
   <fieldset>
     <legend>{'Connection settings'|@translate}</legend>
-
-    <input type="hidden" name="redirect" value="{$U_REDIRECT}">
 
     <ul>
@@ -45,5 +42,5 @@
           <label for="username">{'Username'|@translate}</label>
         </div>
-        <input tabindex="1" class="login" type="text" name="username" id="username" size="25" maxlength="40" />
+        <input tabindex="1" class="login" type="text" name="username" id="username" size="25" maxlength="40">
       </li>
 
@@ -52,5 +49,5 @@
           <label for="password">{'Password'|@translate}</label>
         </div>
-        <input tabindex="2" class="login" type="password" name="password" id="password" size="25" maxlength="25" />
+        <input tabindex="2" class="login" type="password" name="password" id="password" size="25" maxlength="25">
       </li>
 
@@ -66,18 +63,19 @@
   </fieldset>
 
-  <p><input class="submit" tabindex="4" type="submit" name="login" value="{'Submit'|@translate}"></p>
+  <p>
+    <input type="hidden" name="redirect" value="{$U_REDIRECT|@urlencode}">
+    <input class="submit" tabindex="4" type="submit" name="login" value="{'Submit'|@translate}">
+  </p>
 
   <p>
     {if isset($U_REGISTER) }
-    <a id="icon_register2" class="button" href="{$U_REGISTER}" title="{'Register'|@translate}"></a>
+    <a href="{$U_REGISTER}" title="{'Register'|@translate}" id="icon_register2" class="button"></a>
     {/if}
-    <a id="icon_lost_password2" class="button" href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}"></a>
+    {if isset($U_LOST_PASSWORD)}
+    <a href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" id="icon_lost_password2" class="button"></a>
+    {/if}
   </p>
 
 </form>
-
-
-
-
 
 <script type="text/javascript"><!--
Index: /extensions/gally/gally-default/template/index.tpl
===================================================================
--- /extensions/gally/gally-default/template/index.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/index.tpl	(revision 16016)
@@ -15,51 +15,77 @@
     {/if}
 
+      {if !empty($image_orders)}
+      <div id="sortOrderBox" class="switchBox switchBoxCat">
+        <div class="switchBoxTitle">{'Sort order'|@translate}</div>
+        {foreach from=$image_orders item=image_order name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
+        {if $image_order.SELECTED}
+        <span>&#x2714; </span>{$image_order.DISPLAY}
+        {else}
+        <span style="visibility:hidden">&#x2714; </span><a href="{$image_order.URL}" rel="nofollow">{$image_order.DISPLAY}</a>
+        {/if}
+        {/foreach}
+      </div>
+      {/if}
+
+      {if !empty($image_derivatives)}
+      <div id="derivativeSwitchBox" class="switchBox switchBoxCat">
+        <div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
+        {foreach from=$image_derivatives item=image_derivative name=loop}
+        {if !$smarty.foreach.loop.first}<br>{/if}
+        {if $image_derivative.SELECTED}
+        <span>&#x2714; </span>{$image_derivative.DISPLAY}
+        {else}
+        <span style="visibility:hidden">&#x2714; </span>
+        <a href="{$image_derivative.URL}" rel=nofollow">{$image_derivative.DISPLAY}</a>
+        {/if}
+        {/foreach}
+      </div>
+      {/if}
+
       <ul class="categoryActions" id="categoryActionsID">
         <li>&nbsp;</li>
         {if !empty($image_orders) }
-        <li class="selector">
-        {'Sort order'|@translate}:
-        <select onchange="document.location = this.options[this.selectedIndex].value;">
-          {foreach from=$image_orders item=image_order }
-          <option value="{$image_order.URL}"{if $image_order.SELECTED} selected="selected"{/if}>{$image_order.DISPLAY}</option>
-          {/foreach}
-        </select>
-        </li>
-        {/if}
-
-        {if isset($favorite) }
-        <li><a id="icon_delall_favorite" class="button" href="{$favorite.U_FAVORITE}" title="{'delete all photos from your favorites'|@translate}"></a></li>
-        {/if}
-
-        {if isset($U_CADDIE) }
-        <li><a id="icon_caddie" class="button" href="{$U_CADDIE}" title="{'caddie'|@translate}"></a></li>
-        {/if}
-
-        {if isset($U_EDIT) }
-        <li><a id="icon_category_edit" class="button" href="{$U_EDIT}" title="{'edit'|@translate}"></a></li>
-        {/if}
-
-        {if isset($U_SEARCH_RULES) }
-        <li><a id="icon_search_rules" class="button" href="{$U_SEARCH_RULES}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{'Search rules'|@translate}" rel="nofollow"></a></li>
-        {/if}
-
-        {if isset($U_SLIDESHOW) }
-        <li><a id="icon_start_slideshow" class="button" href="{$U_SLIDESHOW}" title="{'slideshow'|@translate}" rel="nofollow"></a></li>
-        {/if}
-
-        {if isset($U_MODE_FLAT) }
-        <li><a id="icon_flat" class="button" href="{$U_MODE_FLAT}" title="{'display all photos in all sub-albums'|@translate}" rel="nofollow"></a></li>
-        {/if}
-
-        {if isset($U_MODE_NORMAL) }
-        <li><a id="icon_normal_mode" class="button" href="{$U_MODE_NORMAL}" title="{'return to normal view mode'|@translate}"></a></li>
-        {/if}
-
-        {if isset($U_MODE_POSTED) }
-        <li><a id="icon_calendar" class="button" href="{$U_MODE_POSTED}" title="{'display a calendar by posted date'|@translate}" rel="nofollow"></a></li>
-        {/if}
-
-        {if isset($U_MODE_CREATED) }
-        <li><a id="icon_calendar_created" class="button" href="{$U_MODE_CREATED}" title="{'display a calendar by creation date'|@translate}" rel="nofollow"></a></li>
+        <li><a title="{'Sort order'|@translate}" id="icon_sort" class="button"></a></li>
+        {/if}
+
+        {if !empty($image_derivatives) }
+        <li><a title="{'Photo sizes'|@translate}" id="icon_derivatives" class="button"></a></li>
+        {/if}
+
+
+        {if isset($favorite)}
+        <li><a href="{$favorite.U_FAVORITE}" title="{'delete all photos from your favorites'|@translate}" id="icon_delall_favorite" class="button"></a></li>
+        {/if}
+
+        {if isset($U_CADDIE)}
+        <li><a href="{$U_CADDIE}" title="{'Add tocaddie'|@translate}" id="icon_caddie" class="button"></a></li>
+        {/if}
+
+        {if isset($U_EDIT)}
+        <li><a href="{$U_EDIT}" title="{'Edit album'|@translate}" id="icon_category_edit" class="button" ></a></li>
+        {/if}
+
+        {if isset($U_SEARCH_RULES)}
+        <li><a href="{$U_SEARCH_RULES}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{'Search rules'|@translate}" rel="nofollow" id="icon_search_rules" class="button"></a></li>
+        {/if}
+
+        {if isset($U_SLIDESHOW)}
+        <li><a href="{$U_SLIDESHOW}" title="{'slideshow'|@translate}" rel="nofollow" id="icon_start_slideshow" class="button"></a></li>
+        {/if}
+
+        {if isset($U_MODE_FLAT)}
+        <li><a href="{$U_MODE_FLAT}" title="{'display all photos in all sub-albums'|@translate}" rel="nofollow" id="icon_flat" class="button"></a></li>
+        {/if}
+
+        {if isset($U_MODE_NORMAL)}
+        <li><a href="{$U_MODE_NORMAL}" title="{'return to normal view mode'|@translate}" id="icon_normal_mode" class="button"></a></li>
+        {/if}
+
+        {if isset($U_MODE_POSTED)}
+        <li><a href="{$U_MODE_POSTED}" title="{'display a calendar by posted date'|@translate}" rel="nofollow" id="icon_calendar" class="button"></a></li>
+        {/if}
+
+        {if isset($U_MODE_CREATED)}
+        <li><a href="{$U_MODE_CREATED}" title="{'display a calendar by creation date'|@translate}" rel="nofollow" id="icon_calendar_created" class="button"></a></li>
         {/if}
 
@@ -81,5 +107,5 @@
 <div id="subContent">
   <div class="titrePage{if !(isset($chronology_views) or isset($chronology.TITLE))}Empty{/if}" id="titreContent1">
-    {if isset($chronology_views) }
+    {if isset($chronology_views)}
     <div class="calendarViews">{'View'|@translate}:
       <select onchange="document.location = this.options[this.selectedIndex].value;">
@@ -91,12 +117,15 @@
     {/if}
 
-    {if isset($chronology.TITLE) }
-    <h2>{$chronology.TITLE}</h2>
+    {if isset($chronology.TITLE)}
+    <h2 class="calendarTitle">{$chronology.TITLE}</h2>
     {/if}
   </div>
 
+  {if isset($errors) or not empty($infos)}
+  {include file='infos_errors.tpl'}
+  {/if}
   {if !empty($PLUGIN_INDEX_CONTENT_BEGIN)}{$PLUGIN_INDEX_CONTENT_BEGIN}{/if}
 
-  {if !empty($category_search_results) }
+  {if !empty($category_search_results)}
   <div style="font-size:16px;text-align:left;margin:10px">{'Album results for'|@translate} <strong>{$QUERY_SEARCH}</strong> :
     <em><strong>
@@ -109,5 +138,5 @@
   {/if}
 
-  {if !empty($tag_search_results) }
+  {if !empty($tag_search_results)}
   <div style="font-size:16px;text-align:left;margin:10px">{'Tag results for'|@translate} <strong>{$QUERY_SEARCH}</strong> :
     <em><strong>
@@ -120,5 +149,5 @@
   {/if}
 
-  {if isset($FILE_CHRONOLOGY_VIEW) }
+  {if isset($FILE_CHRONOLOGY_VIEW)}
   {include file=$FILE_CHRONOLOGY_VIEW}
   {/if}
@@ -144,6 +173,6 @@
         </div>
 
-        {if !empty($CATEGORIES) }<div id="categories">{$CATEGORIES}</div>{/if}
-        {if !empty($THUMBNAILS) }<div id="thumbnails">{$THUMBNAILS}</div>{/if}
+        {if !empty($CATEGORIES)}<div id="categories">{$CATEGORIES}</div>{/if}
+        {if !empty($THUMBNAILS)}<div id="thumbnails">{$THUMBNAILS}</div>{/if}
 
         <div id="additional_infoBOTTOM">
@@ -159,12 +188,12 @@
   {/if}
 
-  {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
-
-</div> <!-- subContent -->
+  {if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
+
+</div>{* subContent *}
 
 
 
 {if !empty($PLUGIN_INDEX_CONTENT_END) }{$PLUGIN_INDEX_CONTENT_END}{/if}
-</div> <!-- content -->
+</div> {* content *}
 
 {if !empty($PLUGIN_INDEX_CONTENT_AFTER)}{$PLUGIN_INDEX_CONTENT_AFTER}{/if}
Index: /extensions/gally/gally-default/template/infos_errors.tpl
===================================================================
--- /extensions/gally/gally-default/template/infos_errors.tpl	(revision 16016)
+++ /extensions/gally/gally-default/template/infos_errors.tpl	(revision 16016)
@@ -0,0 +1,37 @@
+{* common file for errors/infos dialog box *}
+
+{if isset($errors) and count($errors) or isset($infos) and count($infos)}
+
+{literal}
+<script type="text/javascript">
+  $(function() {
+    $("#divMsg").dialog({
+      modal: true,
+      dialogClass: '{/literal}{if isset($errors) and count($errors)}errors{elseif isset($infos) and count($infos)}infos{/if}{literal}',
+      buttons: {
+        "{/literal}{'Ok'|@translate}{literal}": function()
+        {
+          $(this).dialog("close");
+        }
+      }
+    });
+  });
+</script>
+{/literal}
+
+<div id="divMsg">
+  <ul>
+    {if isset($errors) and count($errors)}
+      {foreach from=$errors item=error}
+      <li>{$error}</li>
+      {/foreach}
+    {/if}
+    {if isset($infos) and count($infos)}
+      {foreach from=$infos item=info}
+      <li>{$info}</li>
+      {/foreach}
+    {/if}
+  </ul>
+</div>
+
+{/if}
Index: /extensions/gally/gally-default/template/mainpage_categories.tpl
===================================================================
--- /extensions/gally/gally-default/template/mainpage_categories.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/mainpage_categories.tpl	(revision 16016)
@@ -2,10 +2,10 @@
 
 <ul class="thumbnailCategories">
-  {foreach from=$category_thumbnails item=cat name=catloop}
-  <li class="odd{if ($smarty.foreach.catloop.iteration-1) % 2 == 0}0{else}1{/if}">
-    <div class="thumbnailCategory"  onclick="window.location='{$cat.URL}';">
+  {foreach from=$category_thumbnails item=cat name=cat_loop}
+  <li class="odd{if ($smarty.foreach.cat_loop.iteration-1) % 2 == 0}0{else}1{/if}">
+    <div class="thumbnailCategory"  onclick="window.location='{$cat.URL}';" title="{$cat.NAME|@replace:'"':' '|@strip_tags:false}<br>{'display this album'|@translate}">
       <div class="illustration">
 
-          <img {if isset($cat.EXTRA_CLASS)}class="{$cat.EXTRA_CLASS}"{/if} src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" title="{$cat.NAME|@replace:'"':' '|@strip_tags:false} - {'display this album'|@translate}">
+          <img {if isset($cat.EXTRA_CLASS)}class="{$cat.EXTRA_CLASS}"{/if} src="{$pwg->derivative_url($derivative_params, $cat.representative.src_image)}" alt="{$cat.TN_ALT}">
 
       </div>
@@ -27,4 +27,5 @@
         </div>
       </div>
+      <div class='fixHeight'></div>
     </div>
   </li>
Index: /extensions/gally/gally-default/template/menubar_categories.tpl
===================================================================
--- /extensions/gally/gally-default/template/menubar_categories.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/menubar_categories.tpl	(revision 16016)
@@ -1,12 +1,11 @@
 <dt>
   {if isset($U_START_FILTER)}
-  <a id="icon_start_filter" class="button sTipOnTop" href="{$U_START_FILTER}" title="{'display only recently posted photos'|@translate}" rel="nofollow"></a>
+  <a href="{$U_START_FILTER}" title="{'display only recently posted photos'|@translate}" rel="nofollow" id="icon_start_filter" class="button sTipOnTop"></a>
   {/if}
   {if isset($U_STOP_FILTER)}
-  <a id="icon_stop_filter" class="button sTipOnTop" href="{$U_STOP_FILTER}" title="{'return to the display of all photos'|@translate}"></a>
+  <a href="{$U_STOP_FILTER}" title="{'return to the display of all photos'|@translate}" id="icon_stop_filter" class="button sTipOnTop" ></a>
   {/if}
   <a href="{$block->data.U_CATEGORIES}">{'Albums'|@translate}</a>
 </dt>
-
 <dd>
   {assign var='ref_level' value=0}
@@ -19,30 +18,17 @@
     {/if}
       <li {if $cat.SELECTED}class="selected"{/if}>
-        <a href="{$cat.URL}" {if $cat.IS_UPPERCAT}rel="up"{/if} title="{$cat.TITLE}">{$cat.NAME}</a>
-        {if $cat.count_images > 0}
-        <span class="{if $cat.nb_images > 0}menuInfoCat{else}menuInfoCatByChild{/if} sTipOnTop" title="{$cat.TITLE}">[{$cat.count_images}]</span>
-        {/if}
-        {if !empty($cat.icon_ts)}
-        <span class="button {if $cat.icon_ts.IS_CHILD_DATE}id_recent_cat_by_child{else}id_recent_cat{/if}"></span>
-        {/if}
+        <span title="{$cat.TITLE}" {if $cat.count_categories > 0}class="sTipOnTop"{/if}>
+          <a href="{$cat.URL}" {if $cat.IS_UPPERCAT}rel="up"{/if}>{$cat.NAME}</a>
+          {if $cat.count_images > 0}
+          <span class="{if $cat.nb_images > 0}menuInfoCat{else}menuInfoCatByChild{/if}">[{$cat.count_images}]</span>
+          {/if}
+          {if !empty($cat.icon_ts)}
+          <span class="button {if $cat.icon_ts.IS_CHILD_DATE}id_recent_cat_by_child{else}id_recent_cat{/if}"></span>
+          {/if}
+        </span>
     {assign var='ref_level' value=$cat.LEVEL}
   {/foreach}
   {'</li></ul>'|@str_repeat:$ref_level}
 
-  {if isset($block->data.U_UPLOAD)}
-  <ul>
-    <li>
-      <a href="{$block->data.U_UPLOAD}">{'Upload a picture'|@translate}</a>
-    </li>
-  </ul>
-  {/if}
   <p class="totalImages">{$pwg->l10n_dec('%d photo', '%d photos', $block->data.NB_PICTURE)}</p>
 </dd>
-
-
-
-
-
-
-
-
Index: /extensions/gally/gally-default/template/menubar_identification.tpl
===================================================================
--- /extensions/gally/gally-default/template/menubar_identification.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/menubar_identification.tpl	(revision 16016)
@@ -2,47 +2,42 @@
 <dt>{'Identification'|@translate}</dt>
 <dd>
+{strip}
   {if isset($USERNAME)}
-  <p>{'Hello'|@translate}&nbsp;{$USERNAME}&nbsp;!</p>
+  <p>{'Hello'|@translate} {$USERNAME} !</p>
   {/if}
-
   <ul>
   {if isset($U_REGISTER)}
   <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
   {/if}
-
   {if isset($U_LOGIN)}
   <li><a href="{$U_LOGIN}" rel="nofollow">{'Login'|@translate}</a></li>
   {/if}
-
   {if isset($U_LOGOUT)}
   <li><a href="{$U_LOGOUT}">{'Logout'|@translate}</a></li>
   {/if}
-
   {if isset($U_PROFILE)}
   <li><a href="{$U_PROFILE}" title="{'customize the appareance of the gallery'|@translate}">{'Customize'|@translate}</a></li>
   {/if}
-
   {if isset($U_ADMIN)}
   <li><a href="{$U_ADMIN}" title="{'available for administrators only'|@translate}">{'Administration'|@translate}</a></li>
   {/if}
   </ul>
-
+{/strip}
   {if isset($U_LOGIN)}
+{strip}
   <form method="post" action="{$U_LOGIN}" id="quickconnect">
   <fieldset>
   <legend>{'Quick connect'|@translate}</legend>
   <div>
-  <label for="username">{'Username'|@translate}</label><br/>
+  <label for="username">{'Username'|@translate}</label><br>
   <input type="text" name="username" id="username" value="" style="width:90%">
   </div>
 
-  <div><label for="password">{'Password'|@translate}</label>
-  <br/>
+  <div><label for="password">{'Password'|@translate}</label><br>
   <input type="password" name="password" id="password" style="width:90%">
   </div>
 
   {if $AUTHORIZE_REMEMBERING}
-  <div><label for="remember_me">
-  {'Auto login'|@translate}
+  <div><label for="remember_me"> {'Auto login'|@translate}
   <input type="checkbox" name="remember_me" id="remember_me" value="1">
   </label></div>
@@ -50,5 +45,6 @@
 
   <div id='iValid'>
-  <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
+  <input type="hidden" name="redirect" value="{$smarty.server.REQUEST_URI|@urlencode}">
+  <input type="submit" name="login" value="{'Submit'|@translate}" class="submit">
   <ul class="actions">
     <li><a id="icon_lost_password3" class="button sTipOnBottom" href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" rel="nofollow"></a></li>
@@ -61,5 +57,5 @@
   </fieldset>
   </form>
+{/strip}
   {/if}
 </dd>
-
Index: /extensions/gally/gally-default/template/menubar_links.tpl
===================================================================
--- /extensions/gally/gally-default/template/menubar_links.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/menubar_links.tpl	(revision 16016)
@@ -1,15 +1,12 @@
 <dt>{'Links'|@translate}</dt>
 <dd>
-  <ul>
+  <ul>{strip}
     {foreach from=$block->data item=link}
       <li>
-        <a href="{$link.URL}" class="external"
-          {if isset($link.new_window) }onclick="window.open(this.href, '{$link.new_window.NAME}','{$link.new_window.FEATURES}'); return false;"{/if}
-        >
+        <a href="{$link.URL}" class="external"{if isset($link.new_window)} onclick="window.open(this.href, '{$link.new_window.NAME}','{$link.new_window.FEATURES}'); return false;"{/if}>
         {$link.LABEL}
         </a>
       </li>
     {/foreach}
-  </ul>
+  {/strip}</ul>
 </dd>
-
Index: /extensions/gally/gally-default/template/menubar_menu.tpl
===================================================================
--- /extensions/gally/gally-default/template/menubar_menu.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/menubar_menu.tpl	(revision 16016)
@@ -4,17 +4,15 @@
     <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch" onsubmit="return this.q.value!='' && this.q.value!=qsearch_prompt;">
       <p style="margin:0;padding:0"{*this <p> is for html validation only - does not affect positioning*}>
-        <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" style="width:90%"/>
+        <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" style="width:90%">
       </p>
     </form>
     <script type="text/javascript">var qsearch_prompt="{'Quick search'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
   {/if}
-
-	<ul>
-	{foreach from=$block->data item=link}
-		{if is_array($link)}
-			<li><a href="{$link.URL}" title="{$link.TITLE}" {if isset($link.REL)}{$link.REL}{/if}>{$link.NAME}</a></li>
-		{/if}
-	{/foreach}
-	</ul>
+  <ul>{strip}
+    {foreach from=$block->data item=link}
+      {if is_array($link)}
+        <li><a href="{$link.URL}" title="{$link.TITLE}"{if isset($link.REL)} {$link.REL}{/if}>{$link.NAME}</a></li>
+      {/if}
+    {/foreach}
+  {/strip}</ul>
 </dd>
-
Index: /extensions/gally/gally-default/template/menubar_specials.tpl
===================================================================
--- /extensions/gally/gally-default/template/menubar_specials.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/menubar_specials.tpl	(revision 16016)
@@ -1,9 +1,8 @@
 <dt>{'Specials'|@translate}</dt>
 <dd>
-  <ul>
+  <ul>{strip}
     {foreach from=$block->data item=link}
-    <li><a href="{$link.URL}" title="{$link.TITLE}" {if isset($link.REL)}{$link.REL}{/if}>{$link.NAME}</a></li>
+    <li><a href="{$link.URL}" title="{$link.TITLE}"{if isset($link.REL)} {$link.REL}{/if}>{$link.NAME}</a></li>
     {/foreach}
-  </ul>
+  {/strip}</ul>
 </dd>
-
Index: /extensions/gally/gally-default/template/menubar_tags.tpl
===================================================================
--- /extensions/gally/gally-default/template/menubar_tags.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/menubar_tags.tpl	(revision 16016)
@@ -3,6 +3,6 @@
   <div id="menuTagCloud">
     {foreach from=$block->data item=tag}
-    <span>
-      <a href="{$tag.URL}" class="tagLevel{$tag.level} sTipOnTop" title="{'display photos linked to this tag'|@translate}">{$tag.name}</a>
+    <span>{strip}
+      <a class="tagLevel{$tag.level} sTipOnTop" href="{$tag.URL}" title="{'display photos linked to this tag'|@translate}">{$tag.name}</a>
       {if !empty($tag.U_ADD) }
       <a class="tagaddbutton sTipOnTop" href="{$tag.U_ADD}"
@@ -12,7 +12,6 @@
       </a>
       {/if}
-    </span>
+    </span>{/strip}
     {/foreach}
   </div>
 </dd>
-
Index: /extensions/gally/gally-default/template/month_calendar.tpl
===================================================================
--- /extensions/gally/gally-default/template/month_calendar.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/month_calendar.tpl	(revision 16016)
@@ -15,5 +15,5 @@
   {else}
     {foreach from=$bar.items item=item}
-    <span class="calItem{if !isset($item.URL)}Empty{/if}" {if isset($item.NB_IMAGES)}title="{$pwg->l10n_dec('%d image', '%d images', $item.NB_IMAGES)}"{/if}>
+    <span class="calItem{if !isset($item.URL)}Empty{/if}" {if isset($item.NB_IMAGES)}title="{$pwg->l10n_dec('%d photo', '%d photos', $item.NB_IMAGES)}"{/if}>
     {if isset($item.URL)}
       <a href="{$item.URL}">{$item.LABEL}</a>
@@ -23,5 +23,4 @@
     </span>
     {/foreach}
-
   {/if}
   </div>
@@ -60,9 +59,5 @@
   </thead>
   {html_head} {*add the style to html head for strict standard compliance*}
-  <style type="text/css">
-  TABLE.calMonth TBODY TD, TABLE.calMonth TBODY TD DIV.calImg {ldelim}
-    width:{$chronology_calendar.month_view.CELL_WIDTH}px;height:{$chronology_calendar.month_view.CELL_HEIGHT}px;
-  }
-  </style>
+
   {/html_head}
   {foreach from=$chronology_calendar.month_view.weeks item=week}
@@ -73,5 +68,5 @@
         <td class="calDayCellFull">
           <div class="calBackDate">{$day.DAY}</div><div class="calForeDate">{$day.DAY}</div>
-          <div class="calImg sTipOnRight" title="{$pwg->l10n_dec('%d image','%d images', $day.NB_ELEMENTS)}" >
+          <div class="calImg sTipOnRight" title="{$pwg->l10n_dec('%d photo','%d photos', $day.NB_ELEMENTS)}" >
             <a href="{$day.U_IMG_LINK}">
                 <img style="{$day.IMAGE_STYLE}" src="{$day.IMAGE}" alt="{$day.IMAGE_ALT}" />
Index: /extensions/gally/gally-default/template/nbm.tpl
===================================================================
--- /extensions/gally/gally-default/template/nbm.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/nbm.tpl	(revision 16016)
@@ -25,5 +25,5 @@
 
 
-{include file='dialogs.tpl'}
+{include file='infos_errors.tpl'}
 
 </div>
Index: /extensions/gally/gally-default/template/password.tpl
===================================================================
--- /extensions/gally/gally-default/template/password.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/password.tpl	(revision 16016)
@@ -11,10 +11,8 @@
   </div>
 
-{include file='dialogs.tpl'}
-
+{include file='infos_errors.tpl'}
 
 {if $action != 'none'}
   <form id="lostPassword" action="{$form_action}?action={$action}{if isset($key)}&amp;key={$key}{/if}" method="post">
-
     <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
 
@@ -30,8 +28,5 @@
       </p>
 
-      <p class="bottomButtons">
-        <input type="submit" name="submit" value="{'Change my password'|@translate}">
-      </p>
-
+      <p class="bottomButtons"><input type="submit" name="submit" value="{'Change my password'|@translate}"></p>
     {elseif $action == 'reset'}
 
@@ -54,8 +49,5 @@
       </p>
 
-      <p class="bottomButtons">
-        <input type="submit" name="submit" value="{'Submit'|@translate}">
-      </p>
-
+      <p class="bottomButtons"><input type="submit" name="submit" value="{'Submit'|@translate}"></p>
     {/if}
 
@@ -79,8 +71,5 @@
     {/literal}
   {/if}
-
   </script>
 </div> <!-- content -->
-
-
 <!-- **GBL** <PASSWORD< -->
Index: /extensions/gally/gally-default/template/picture.tpl
===================================================================
--- /extensions/gally/gally-default/template/picture.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/picture.tpl	(revision 16016)
@@ -1,5 +1,5 @@
 <!-- **GBL** >PICTURE> -->
 
-{include file='dialogs.tpl'}
+{include file='infos_errors.tpl'}
 
 <div id="content" {if isset($MENUBAR)}class="pictureContent"{/if}>
@@ -11,12 +11,8 @@
       <div id="theImgHighZoomButton" class="fit" onclick="gallyPP.switchZoomHigh();"></div>
       <div id="theImgHighContainer2">
-        <img id="theImgHigh" src="" style="display:none;" alt="{$ALT_IMG}"
-          {if isset($COMMENT_IMG)}
-            title="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}" {else} title="{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}"
-          {/if}>
+        <img id="theImgHigh" src="" style="display:none;" alt="{$ALT_IMG}">
       </div>
     </div>
   </div>
-
 
 {if isset($MENUBAR)}
@@ -37,4 +33,6 @@
 {/if}
 
+
+
     <div class="browsePath">
       <h2>
@@ -44,52 +42,91 @@
     <div class="imageNumber">{$PHOTO}</div>
     <h2>&nbsp;</h2>
-  </div> <!-- imageHeaderBar -->
+  </div> 
 
   {if !empty($PLUGIN_PICTURE_BEFORE)}{$PLUGIN_PICTURE_BEFORE}{/if}
 
+  {if $DISPLAY_NAV_THUMB}
+    {if isset($previous) }
+    <div id="navThumbPrev">
+      <table id="navThumbPrevContainer" class="uiImg"><tr><td>
+        <div class="navThumbPrevBg">&nbsp;</div>
+        <div class="navThumbPrevContent">
+          <a class="navThumb" id="thumbPrev" href="{$previous.U_IMG}" title="{'Previous'|@translate} : {$previous.TITLE}" rel="prev">
+            <img src="{$previous.derivatives.square->get_url()}" class="thumbLink" id="linkPrev" alt="{$previous.TITLE}">
+          </a>
+        </div>
+      </td></tr></table>
+    </div> <!-- navThumbPrev -->
+    {/if}
+
+    {if isset($next) }
+    <div id="navThumbNext">
+      <table id="navThumbNextContainer" class="uiImg"><tr><td>
+        <div class="navThumbNextBg">&nbsp;</div>
+        <div class="navThumbNextContent">
+          <a class="navThumb" id="thumbNext" href="{$next.U_IMG}" title="{'Next'|@translate} : {$next.TITLE}" rel="next">
+            <img src="{$next.derivatives.square->get_url()}" class="thumbLink" id="linkNext" alt="{$next.TITLE}">
+          </a>
+        </div>
+      </td></tr></table>
+    </div> <!-- navThumbNext -->
+    {/if}
+  {/if}
+
   <div id="imageToolBar">
-    <div id="imageToolBarContainer" class="uiImg">
+        <div id="imageToolBarContainer" class="uiImg">
         <div class="imageToolBarBg">&nbsp;</div>
 
+        {if count($current.unique_derivatives)>1}
+        <div id="derivativeSwitchBox" class="switchBox">
+        <div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
+        {foreach from=$current.unique_derivatives item=derivative key=derivative_type}
+        <span class="switchCheck" id="derivativeChecked{$derivative_type}"{if $derivative->get_type() ne $current.selected_derivative->get_type()} style="visibility:hidden"{/if}>&#x2714; </span>
+        <a onclick="gallyPP.changeImgSrc('{$derivative->get_url()|@escape:javascript}','{$derivative_type}','{$derivative->get_type()}', '{$COOKIE_PATH}')">
+          {$derivative->get_type()|@translate}<span class="derivativeSizeDetails"> ({$derivative->get_size_hr()})</span>
+        </a><br>
+        {/foreach}
+        {if isset($U_ORIGINAL)}
+        <span class="switchCheck" style="visibility:hidden">&#x2714; </span><a onclick="gallyPP.openDisplayHigh('{$U_ORIGINAL}');">{'Original'|@translate}</a>
+        {/if}
+        </div>
+        {/if}
+
         <div class="randomButtons">
-          {if isset($U_SLIDESHOW_START) }
-            <a id="icon_start_slideshow" class="button" href="{$U_SLIDESHOW_START}" title="{'Play of slideshow'|@translate}" rel="nofollow"></a>
-          {/if}
-          {if isset($U_SLIDESHOW_STOP) }
-            <a id="icon_stop_slideshow" class="button" href="{$U_SLIDESHOW_STOP}" title="{'Pause of slideshow'|@translate}" rel="nofollow"></a>
-          {/if}
+
+          {if count($current.unique_derivatives)>1}
+            <a id="icon_derivatives" title="{'Photo sizes'|@translate}" rel="nofollow" class="button" ></a>
+          {/if}
+
+          {if isset($U_SLIDESHOW_START)}
+            <a href="{$U_SLIDESHOW_START}" title="{'slideshow'|@translate}" rel="nofollow" id="icon_start_slideshow" class="button" ></a>
+          {/if}
+
           {if isset($U_METADATA)}
-            <a id="icon_metadata" class="button" href="{$U_METADATA}" title="{'Show file metadata'|@translate}" rel="nofollow"></a>
-          {/if}
-
-          {if #displayHighResIcon#=="yes" and isset($high) }
-            <a id="icon_high_res" class="button pointer" onclick="gallyPP.openDisplayHigh('{$high.U_HIGH}');" title="" rel="nofollow" ></a>
-          {/if}
-
-          {if isset($current.U_DOWNLOAD) }
-            <a id="icon_save" class="button" href="{$current.U_DOWNLOAD}" title="{'download this file'|@translate}"></a>
+            <a href="{$U_METADATA}" title="{'Show file metadata'|@translate}" rel="nofollow" id="icon_metadata" class="button" ></a>
+          {/if}
+
+          {if isset($current.U_DOWNLOAD)}
+            <a href="{$current.U_DOWNLOAD}" title="{'Download this file'|@translate}" id="icon_save" class="button" ></a>
           {/if}
 
           {if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
 
-
-          {if isset($favorite) }
-            <a id="icon_{if $favorite.IS_FAVORITE}del_{/if}favorite" class="button" href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this photo from your favorites'|@translate}{else}{'add this photo to your favorites'|@translate}{/if}"></a>
-          {/if}
-          {if !empty($U_SET_AS_REPRESENTATIVE) }
-            <a id="icon_representative" class="button" href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as album representative'|@translate}"></a>
-          {/if}
-          {if isset($U_ADMIN) }
-            <a id="icon_preferences" class="button" href="{$U_ADMIN}" title="{'Modify information'|@translate}"></a>
+          {if isset($favorite)}
+            <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this photo from your favorites'|@translate}{else}{'add this photo to your favorites'|@translate}{/if}" id="icon_{if $favorite.IS_FAVORITE}del_{/if}favorite" class="button"></a>
+          {/if}
+          {if isset($U_SET_AS_REPRESENTATIVE)}
+            <a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as album representative'|@translate}" id="icon_representative" class="button" ></a>
+          {/if}
+          {if isset($U_ADMIN)}
+            <a href="{$U_ADMIN}" title="{'Modify information'|@translate}" id="icon_preferences" class="button"></a>
           {/if}
           {if isset($U_CADDIE) }{*caddie management BEGIN*}
-          <script type="text/javascript">
-          {literal}
-          function addToCadie(aElement, rootUrl, id)
+          {footer_script}
+          {literal}function addToCadie(aElement, rootUrl, id)
           {
             if (aElement.disabled) return;
             aElement.disabled=true;
             var y = new PwgWS(rootUrl);
-
             y.callService(
               "pwg.caddie.add", {image_id: id} ,
@@ -100,48 +137,16 @@
             );
           }{/literal}
-          </script>
-          <a id="icon_caddie" class="button" onclick="addToCadie(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}); return false;" title="{'add to caddie'|@translate}"></a>
-          {/if}
-          <script type="text/javascript">
-            $('div.randomButtons a.button').addClass('sTipOnRight');
-          </script>
+          {/footer_script}
+          <a onclick="addToCadie(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}); return false;" title="{'Add to caddie'|@translate}" id="icon_caddie" class="button"></a>
+          {/if}{*caddie management END*}
+          {footer_script}
+            $('div.randomButtons a.button').addClass('sTipOnTop');
+          {/footer_script}
         </div>
 
         {include file='picture_nav_buttons.tpl'|@get_extent:'picture_nav_buttons'}
 
-        {if $SHOW_PICTURE_NAME_ON_TITLE }
-        <div><h2>{$current.TITLE}</h2></div>
-        {/if}
-
     </div>
-  </div> <!-- imageToolBar -->
-
-  {if $DISPLAY_NAV_THUMB}
-    {if isset($previous) }
-    <div id="navThumbPrev">
-      <table id="navThumbPrevContainer" class="uiImg"><tr><td>
-        <div class="navThumbPrevBg">&nbsp;</div>
-        <div class="navThumbPrevContent">
-          <a class="navThumb" id="thumbPrev" href="{$previous.U_IMG}" title="{'Previous'|@translate} : {$previous.TITLE}" rel="prev">
-            <img src="{$previous.THUMB_SRC}" class="thumbLink" id="linkPrev" alt="{$previous.TITLE}">
-          </a>
-        </div>
-      </td></tr></table>
-    </div> <!-- navThumbPrev -->
-    {/if}
-
-    {if isset($next) }
-    <div id="navThumbNext">
-      <table id="navThumbNextContainer" class="uiImg"><tr><td>
-        <div class="navThumbNextBg">&nbsp;</div>
-        <div class="navThumbNextContent">
-          <a class="navThumb" id="thumbNext" href="{$next.U_IMG}" title="{'Next'|@translate} : {$next.TITLE}" rel="next">
-            <img src="{$next.THUMB_SRC}" class="thumbLink" id="linkNext" alt="{$next.TITLE}">
-          </a>
-        </div>
-      </td></tr></table>
-    </div> <!-- navThumbNext -->
-    {/if}
-  {/if}
+  </div>{*<!-- imageToolBar -->*}
 
   <div id="theImage">
@@ -153,6 +158,5 @@
     <p>&nbsp;</p>
     {/if}
-
-    {if isset($U_SLIDESHOW_STOP) }
+    {if isset($U_SLIDESHOW_STOP)}
     <p>
       [ <a href="{$U_SLIDESHOW_STOP}">{'stop the slideshow'|@translate}</a> ]
@@ -201,27 +205,23 @@
             <tr  class="emptyrow" style="line-height:0px;">
               <td colspan="2">&nbsp;</td>
-              <td width="10px">&nbsp;</td>
-              <td width="12%">&nbsp;</td>
-              <td width="18%">&nbsp;</td>
-              <td width="10px">&nbsp;</td>
-              <td width="12%">&nbsp;</td>
-              <td width="18%">&nbsp;</td>
+              <td class='cTitle'>&nbsp;</td>
+              <td class='cNfo' >&nbsp;</td>
+              <td class='cTitle'>&nbsp;</td>
+              <td class='cNfo' >&nbsp;</td>
             </tr>
 
             {if $display_info.author or $display_info.created_on or $display_info.posted_on}
             <tr>
-              {assign var='colspan' value=8}
+              {assign var='colspan' value=6}
               {if $display_info.author}
-                {assign var='colspan' value=`$colspan-3`}
+                {assign var='colspan' value=`$colspan-2`}
                 <td class="label">{'Author'|@translate}</td>
                 <td class="value" style="min-width:214px;">{if isset($INFO_AUTHOR)}{$INFO_AUTHOR}{else}{'N/A'|@translate}{/if}</td>
-                <td>&nbsp;</td>
               {/if}
 
               {if $display_info.created_on}
-                {assign var='colspan' value=`$colspan-3`}
+                {assign var='colspan' value=`$colspan-2`}
                 <td class="label">{'Created on'|@translate}</td>
                 <td class="value">{if isset($INFO_CREATION_DATE)}{$INFO_CREATION_DATE}{else}{'N/A'|@translate}{/if}</td>
-                <td>&nbsp;</td>
               {/if}
 
@@ -241,18 +241,16 @@
             {if $display_info.dimensions or $display_info.file or $display_info.filesize}
             <tr>
-              {assign var='colspan' value=8}
+              {assign var='colspan' value=6}
 
               {if $display_info.dimensions}
-                {assign var='colspan' value=`$colspan-3`}
+                {assign var='colspan' value=`$colspan-2`}
                 <td class="label">{'Dimensions'|@translate}</td>
                 <td class="value">{if isset($INFO_DIMENSIONS)}{$INFO_DIMENSIONS|@replace:"*":"x"}{else}{'N/A'|@translate}{/if}</td>
-                <td>&nbsp;</td>
               {/if}
 
               {if $display_info.file}
-                {assign var='colspan' value=`$colspan-3`}
+                {assign var='colspan' value=`$colspan-2`}
                 <td class="label">{'File'|@translate}</td>
                 <td class="value">{$INFO_FILE}</td>
-                <td>&nbsp;</td>
               {/if}
 
@@ -270,8 +268,8 @@
 
             {if isset($related_tags) and $display_info.tags}
-              <tr class="emptyrow"><td colspan="8">&nbsp;</td></tr>
+              <tr class="emptyrow"><td colspan="6">&nbsp;</td></tr>
               <tr id="infoTags">
                 <td class="label">{'Tags'|@translate}</td>
-                <td colspan="7" class="value">
+                <td colspan="5" class="value">
                     {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}
                     <a href="{$tag.URL}">{$tag.name}</a>{/foreach}
@@ -281,8 +279,8 @@
 
             {if isset($related_categories) and $display_info.categories}
-              <tr class="emptyrow"><td colspan="8">&nbsp;</td></tr>
+              <tr class="emptyrow"><td colspan="6">&nbsp;</td></tr>
               <tr id="infoCats">
                 <td class="label">{'Albums'|@translate}</td>
-                <td colspan="7" class="value">
+                <td colspan="5" class="value">
                   {foreach from=$related_categories item=cat name=tag_loop}{if !$smarty.foreach.tag_loop.first},&nbsp;{/if}
                   {$cat}
@@ -291,10 +289,22 @@
               </tr>
             {/if}
-
             {if $display_info.visits}
-              <tr class="emptyrow"><td colspan="8">&nbsp;</td><tr>
+              <tr class="emptyrow"><td colspan="6">&nbsp;</td><tr>
               <tr>
                 <td class="label">{'Visits'|@translate}</td>
-                <td colspan="7" class="value">{$INFO_VISITS}</td>
+                <td {if !($display_info.privacy_level and isset($available_permission_levels))}colspan="5"{/if} class="value">{$INFO_VISITS}</td>
+
+                  {if $display_info.privacy_level and isset($available_permission_levels)}
+                      <td colspan="4" class="label"><a id="iPrivacyLevelLink">{'Who can see this photo?'|@translate}</a>
+
+                        <div id="privacyLevelBox" class="switchBox">
+                          {foreach from=$available_permission_levels item=label key=level}
+                          <span id="levelCheck{$level}" class="switchCheck" {if $level != $current.level} style="visibility:hidden"{/if}>&#x2714; </span>
+                          <a id="switchLevel{$level}" onclick="gallyPP.setPrivacyLevel('{$ROOT_URL}', {$current.id}, {$level})">{$label}</a><br>
+                          {/foreach}
+                        </div>
+                     </td>
+                  {/if}
+
               </tr>
             {/if}
@@ -315,8 +325,7 @@
                   <td colspan="2">&nbsp;</td>
                 {/if}
-                <td>&nbsp;</td>
 
                 {if isset($rating)}
-                  <td class="label" colspan="5">
+                  <td class="label" colspan="4">
                     <span id="updateRate">{if isset($rating.USER_RATE)}{'Update your rating'|@translate}{else}{'Rate this photo'|@translate}{/if}</span>
 
@@ -355,34 +364,6 @@
                   </td>
                 {else}
-                  <td colspan="5">&nbsp;</td>
+                  <td colspan="4">&nbsp;</td>
                 {/if}
-              </tr>
-            {/if}
-
-          {if isset($available_permission_levels) and $display_info.privacy_level}
-            <tr>
-              <td class="label">{'Who can see this photo?'|@translate}:</td>
-              <td colspan="4" class="value">
-                <script type="text/javascript">
-                {literal}function setPrivacyLevel(selectElement, rootUrl, id, level)
-                {
-                selectElement.disabled = true;
-                var y = new PwgWS(rootUrl);
-                y.callService(
-                  "pwg.images.setPrivacyLevel", {image_id: id, level:level} ,
-                  {
-                    method: "POST",
-                    onFailure: function(num, text) { selectElement.disabled = false; alert(num + " " + text); },
-                    onSuccess: function(result) { selectElement.disabled = false; }
-                  }
-                  );
-                }{/literal}
-                </script>
-                <select onchange="setPrivacyLevel(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}, this.options[selectedIndex].value)">
-                  {foreach from=$available_permission_levels item=label key=level}
-                  <option label="{$label}" value="{$level}"{if $level == $current.level} selected="selected"{/if}>{$label}</option>
-                  {/foreach}
-                </select>
-              </td>
             </tr>
           {/if}
@@ -437,5 +418,5 @@
           {/if}
             <h4>{'Add a comment'|@translate}</h4>
-            <form  method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment">
+            <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment">
               <table>
                 {if $comment_add.SHOW_AUTHOR}
@@ -450,6 +431,6 @@
                 <tr>
                   <td {if $comment_add.SHOW_AUTHOR}colspan="2"{/if}>
-                    <input type="hidden" name="key" value="{$comment_add.KEY}" />
-                    <input class="submit" type="submit" value="{'Submit'|@translate}"/>
+                    <input type="hidden" name="key" value="{$comment_add.KEY}">
+                    <input class="submit" type="submit" value="{'Submit'|@translate}">
                   </td>
                 </tr>
Index: /extensions/gally/gally-default/template/picture_content.tpl
===================================================================
--- /extensions/gally/gally-default/template/picture_content.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/picture_content.tpl	(revision 16016)
@@ -1,9 +1,10 @@
 <!-- **GBL** >PICTURE_CONTENT> -->
 
-  <div id="theImgContainer" {if isset($high) }onclick="gallyPP.openDisplayHigh('{$high.U_HIGH}');" class="pointer"{/if}>
-    <img id="theMainImage" src="{$SRC_IMG}" style="width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;" alt="{$ALT_IMG}"
+  <div id="theImgContainer" {if isset($U_ORIGINAL)}onclick="gallyPP.openDisplayHigh('{$U_ORIGINAL}');" class="sTipOnTop {if !isset($U_SLIDESHOW_STOP)}pointer{/if}"{else}class="sTipOnTop"{/if}
       {if isset($COMMENT_IMG)}
-        title="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}" {else} title="{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}"
+        title="{$COMMENT_IMG|@replace:'"':'&quot;'}" {else} title="{$current.TITLE|@replace:'"':'&quot;'} - {$ALT_IMG}"
       {/if}>
+    <img src="{$current.selected_derivative->get_url()}" {$current.selected_derivative->get_size_htm()}
+         alt="{$ALT_IMG}" id="theMainImage" usemap="#map{$current.selected_derivative->get_type()}">
   </div>
 
Index: /extensions/gally/gally-default/template/picture_nav_buttons.tpl
===================================================================
--- /extensions/gally/gally-default/template/picture_nav_buttons.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/picture_nav_buttons.tpl	(revision 16016)
@@ -2,60 +2,45 @@
 {if $DISPLAY_NAV_BUTTONS or isset($slideshow)}
 
-  {if isset($last)}
-    <a id="icon_last" class="navButton" href="{$last.U_IMG}"
-       title="{$last.TITLE}"
-       rel="last"></a>
-  {else}
-    <a id="icon_last_unactive" class="navButton"></a>
-  {/if}
-
-  {if isset($next)}
-    <a id="icon_right" class="navButton" href="{$next.U_IMG}"
-       title="{$next.TITLE}"
+{strip}{if isset($next)}
+    <a href="{$next.U_IMG}"
+       title="{'Next'|@translate} : {$next.TITLE}"
+       id="icon_right" class="navButton" 
        rel="next"></a>
   {else}
     <a id="icon_right_unactive" class="navButton"></a>
-  {/if}
+  {/if}{/strip}
 
-  {if isset($slideshow.U_START_PLAY)}
-    <a id="icon_play" class="navButton" href="{$slideshow.U_START_PLAY}" title="{'Play of slideshow'|@translate}"></a>
-  {/if}
+{strip}{if isset($slideshow.U_START_PLAY)}
+    <a href="{$slideshow.U_START_PLAY}" title="{'Play of slideshow'|@translate}" id="icon_play" class="navButton" ></a>
+  {/if}{/strip}
 
-  {if isset($slideshow.U_STOP_PLAY)}
-    <a id="icon_pause" class="navButton" href="{$slideshow.U_STOP_PLAY}" title="{'Pause of slideshow'|@translate}"></a>
-  {/if}
+{strip}{if isset($slideshow.U_STOP_PLAY)}
+    <a href="{$slideshow.U_STOP_PLAY}" title="{'Pause of slideshow'|@translate}" id="icon_pause" class="navButton" ></a>
+  {/if}{/strip}
 
-  {if isset($U_UP) and !isset($slideshow)}
-    <a id="icon_up" class="navButton" href="{$U_UP}" title="{'Thumbnails'|@translate}" rel="up"></a>
-  {/if}
+{strip}{if isset($U_UP) and !isset($slideshow)}
+    <a href="{$U_UP}" title="{'Thumbnails'|@translate}" rel="up" id="icon_up" class="navButton"></a>
+  {/if}{/strip}
 
-  {if isset($previous)}
-    <a id="icon_left" class="navButton" href="{$previous.U_IMG}"
-       title="{$previous.TITLE}"
+{strip}{if isset($previous)}
+    <a href="{$previous.U_IMG}" 
+       title="{'Previous'|@translate} : {$previous.TITLE}"
+       id="icon_left" class="navButton"
        rel="prev"></a>
   {else}
     <a id="icon_left_unactive" class="navButton"></a>
-  {/if}
-
-  {if isset($first)}
-    <a id="icon_first" class="navButton" href="{$first.U_IMG}"
-       title="{$first.TITLE}"
-       rel="first"></a>
-  {else}
-    <a id="icon_first_unactive" class="navButton"></a>
-  {/if}
-
+  {/if}{/strip}
 
   {if isset($slideshow.U_START_REPEAT)}
-    <a id="icon_start_repeat" class="navButton" href="{$slideshow.U_START_REPEAT}" title="{'Repeat the slideshow'|@translate}"></a>
+    <a href="{$slideshow.U_START_REPEAT}" title="{'Repeat the slideshow'|@translate}" id="icon_start_repeat" class="navButton" ></a>
   {/if}
 
   {if isset($slideshow.U_STOP_REPEAT)}
-    <a id="icon_stop_repeat" class="navButton" href="{$slideshow.U_STOP_REPEAT}" title="{'Not repeat the slideshow'|@translate}"></a>
+    <a href="{$slideshow.U_STOP_REPEAT}" title="{'Not repeat the slideshow'|@translate}" id="icon_stop_repeat" class="navButton" ></a>
   {/if}
 
   {if isset($slideshow)}
     {if isset($slideshow.U_DEC_PERIOD)}
-      <a id="icon_dec_period" class="navButton" href="{$slideshow.U_DEC_PERIOD}" title="{'Accelerate diaporama speed'|@translate}"></a>
+      <a href="{$slideshow.U_DEC_PERIOD}" title="{'Accelerate diaporama speed'|@translate}" id="icon_dec_period" class="navButton"></a>
     {else}
       <a id="icon_dec_period_unactive" class="navButton" ></a>
@@ -63,5 +48,5 @@
 
     {if isset($slideshow.U_INC_PERIOD)}
-      <a id="icon_inc_period" class="navButton" href="{$slideshow.U_INC_PERIOD}" title="{'Reduce diaporama speed'|@translate}"></a>
+      <a href="{$slideshow.U_INC_PERIOD}" title="{'Reduce diaporama speed'|@translate}" id="icon_inc_period" class="navButton" ></a>
     {else}
       <a id="icon_inc_period_unactive" class="navButton"></a>
@@ -70,42 +55,38 @@
 {/if}
 </div>
-
-<script type="text/javascript">// <![CDATA[
-{literal}
-function keyboardNavigation(e)
-{
-  if(!e) e=window.event;
+{strip}
+{footer_script}
+document.onkeydown = function(e){ldelim}
+	e=e||window.event;
   if (e.altKey) return true;
-  var target = e.target || e.srcElement;
-  if (target && target.type) return true; //an input editable element
-  var keyCode=e.keyCode || e.which;
-  var docElem = document.documentElement;
-  switch(keyCode) {
-{/literal}
+	var target=e.target||e.srcElement;
+	if (target && target.type) return true;{* an input editable element *}
+	var keyCode=e.keyCode||e.which, docElem=document.documentElement, url;
+	switch(keyCode){ldelim}
 {if isset($next)}
-  case 63235: case 39: if (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth ){ldelim}window.location="{$next.U_IMG}".replace( "&amp;", "&" ); return false; } break;
+	case 63235: case 39: if (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth)url="{$next.U_IMG}"; break;
 {/if}
 {if isset($previous)}
-  case 63234: case 37: if (e.ctrlKey || docElem.scrollLeft==0){ldelim}window.location="{$previous.U_IMG|@escape:jasvascript}".replace("&amp;","&"); return false; } break;
+	case 63234: case 37: if (e.ctrlKey || docElem.scrollLeft==0)url="{$previous.U_IMG}"; break;
 {/if}
 {if isset($first)}
-  /*Home*/case 36: if (e.ctrlKey){ldelim}window.location="{$first.U_IMG|@escape:jasvascript}".replace("&amp;","&"); return false; } break;
+	{* Home *}case 36: if (e.ctrlKey)url="{$first.U_IMG}"; break;
 {/if}
 {if isset($last)}
-  /*End*/case 35: if (e.ctrlKey){ldelim}window.location="{$last.U_IMG|@escape:jasvascript}".replace("&amp;","&"); return false; } break;
+	{* End *}case 35: if (e.ctrlKey)url="{$last.U_IMG}"; break;
 {/if}
 {if isset($U_UP) and !isset($slideshow)}
-  /*Up*/case 38: if (e.ctrlKey){ldelim}window.location="{$U_UP|@escape:jasvascript}".replace("&amp;","&"); return false; } break;
+	{* Up *}case 38: if (e.ctrlKey)url="{$U_UP}"; break;
 {/if}
-
 {if isset($slideshow.U_START_PLAY)}
-  /*Pause*/case 32: {ldelim}window.location="{$slideshow.U_START_PLAY|@escape:jasvascript}".replace("&amp;","&"); return false; } break;
+	{* Pause *}case 32: url="{$slideshow.U_START_PLAY}"; break;
 {/if}
 {if isset($slideshow.U_STOP_PLAY)}
-  /*Play*/case 32: {ldelim}window.location="{$slideshow.U_STOP_PLAY|@escape:jasvascript}".replace("&amp;","&"); return false; } break;
+	{* Play *}case 32: url="{$slideshow.U_STOP_PLAY}"; break;
 {/if}
   }
+  if (url) {ldelim}window.location=url.replace("&amp;","&"); return false;}
   return true;
 }
-document.onkeydown=keyboardNavigation;
-// ]]></script>
+{/footer_script}
+{/strip}
Index: /extensions/gally/gally-default/template/profile.tpl
===================================================================
--- /extensions/gally/gally-default/template/profile.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/profile.tpl	(revision 16016)
@@ -3,5 +3,5 @@
 <div id="content" class="content">
 
-{include file='dialogs.tpl'}
+{include file='infos_errors.tpl'}
 
   <div class="titrePage" id='titrePageID'>
Index: /extensions/gally/gally-default/template/profile_content.tpl
===================================================================
--- /extensions/gally/gally-default/template/profile_content.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/profile_content.tpl	(revision 16016)
@@ -4,5 +4,5 @@
   <fieldset>
     <legend>{'Registration'|@translate}</legend>
-    <input type="hidden" name="redirect" value="{$REDIRECT}" />
+    <input type="hidden" name="redirect" value="{$REDIRECT}">
     <ul>
       <li>
@@ -17,5 +17,4 @@
         <input type="text" name="mail_address" id="mail_address" value="{$EMAIL}" size=35>
       </li>
-{if not $IN_ADMIN} {* admins do not need old password*}
       <li>
         <div class="property">
@@ -24,5 +23,4 @@
         <input type="password" name="password" id="password" value="">
       </li>
-{/if}
       <li>
         <div class="property">
@@ -37,6 +35,6 @@
         <input type="password" name="passwordConf" id="passwordConf" value="">
       </li>
+{/if}
     </ul>
-{/if}
   </fieldset>
 
@@ -50,5 +48,5 @@
           <label for="nb_image_page">{'Number of photos per page'|@translate}</label>
         </div>
-        <input type="text" size="3" maxlength="2" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}">
+        <input type="text" size="4" maxlength="3" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}">
       </li>
       <li>
@@ -74,23 +72,13 @@
         {html_radios name='expand' options=$radio_options selected=$EXPAND}
       </li>
+    {if $ACTIVATE_COMMENTS}
       <li>
         <div class="property">{'Show number of comments'|@translate}</div>
         {html_radios name='show_nb_comments' options=$radio_options selected=$NB_COMMENTS}
       </li>
+    {/if}
       <li>
         <div class="property">{'Show number of hits'|@translate}</div>
         {html_radios name='show_nb_hits' options=$radio_options selected=$NB_HITS}
-      </li>
-      <li>
-        <div class="property">
-          <label for="maxwidth">{'Maximum photo width'|@translate}</label>
-        </div>
-        <input type="text" size="4" maxlength="4" name="maxwidth" id="maxwidth" value="{$MAXWIDTH}">
-      </li>
-      <li>
-        <div class="property">
-          <label for="maxheight">{'Maximum photo height'|@translate}</label>
-        </div>
-        <input type="text" size="4" maxlength="4" name="maxheight" id="maxheight" value="{$MAXHEIGHT}">
       </li>
     </ul>
@@ -108,5 +96,3 @@
 
 </form>
-
-
 <!-- **GBL** <PROFILE_CONTENT< -->
Index: /extensions/gally/gally-default/template/redirect.tpl
===================================================================
--- /extensions/gally/gally-default/template/redirect.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/redirect.tpl	(revision 16016)
@@ -1,4 +1,8 @@
 <!-- **GBL** >REDIRECT> -->
-<p>{$REDIRECT_MSG}</p>
-<p><a href="{$page_refresh.U_REFRESH}">{'Click here if your browser does not automatically forward you'|@translate}</a></p>
+<div>
+  {$REDIRECT_MSG}
+</div>
+
+<p>
+  <a href="{$page_refresh.U_REFRESH}">{'Click here if your browser does not automatically forward you'|@translate}</a></p>
 <!-- **GBL** <REDIRECT< -->
Index: /extensions/gally/gally-default/template/register.tpl
===================================================================
--- /extensions/gally/gally-default/template/register.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/register.tpl	(revision 16016)
@@ -29,5 +29,5 @@
   {/if}
 
-{include file='dialogs.tpl'}
+{include file='infos_errors.tpl'}
 
 <form method="post" action="{$F_ACTION}" class="properties" name="register_form" id="register">
@@ -58,6 +58,15 @@
           <label for="mail_address">{'Email address'|@translate}</label>
         </div>
-        <input type="text" name="mail_address" id="mail_address" value="{$F_EMAIL}" size=35>{if $obligatory_user_mail_address}<span class="mandatorystar">*</span>{else}({'useful when password forgotten'|@translate}){/if}
-
+        <input type="text" name="mail_address" id="mail_address" value="{$F_EMAIL}" size=35>
+         {if $obligatory_user_mail_address}<span class="mandatorystar">*</span>
+         {else}
+         ({'useful when password forgotten'|@translate})
+         {/if}
+      </li>
+      <li>
+        <div class="property">
+          <label for="send_password_by_mail">{'Send my connection settings by email'|@translate}</label>
+        </div>
+        <input type="checkbox" name="send_password_by_mail" id="send_password_by_mail" value="1" checked="checked">
       </li>
     </ul>
@@ -66,4 +75,5 @@
 
   <p class="bottomButtons">
+    <input type="hidden" name="key" value="{$F_KEY}" >
     <input class="submit" type="submit" name="submit" value="{'Register'|@translate}">
     <input class="submit" type="reset" value="{'Reset'|@translate}">
@@ -76,8 +86,4 @@
 </form>
 
-
-
-
-
 <script type="text/javascript"><!--
 document.register_form.login.focus();
@@ -86,5 +92,3 @@
 </div> <!-- content -->
 </div> <!-- registerPage -->
-
-
 <!-- **GBL** <REGISTER< -->
Index: /extensions/gally/gally-default/template/search.tpl
===================================================================
--- /extensions/gally/gally-default/template/search.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/search.tpl	(revision 16016)
@@ -28,5 +28,5 @@
   {/if}
 
-{include file='dialogs.tpl'}
+{include file='infos_errors.tpl'}
 
 <form class="filter" method="post" name="search" action="{$F_SEARCH_ACTION}">
@@ -34,16 +34,16 @@
   <legend>{'Filter'|@translate}</legend>
   <label>{'Search for words'|@translate}
-    <input type="text" style="width: 300px" name="search_allwords" size="30"  />
+    <input type="text" style="width: 300px" name="search_allwords" size="30">
   </label>
   <ul>
     <li><label>
-      <input type="radio" name="mode" value="AND" checked="checked" />{'Search for all terms'|@translate}
+      <input type="radio" name="mode" value="AND" checked="checked">{'Search for all terms'|@translate}
     </label></li>
     <li><label>
-      <input type="radio" name="mode" value="OR" />{'Search for any terms'|@translate}
+      <input type="radio" name="mode" value="OR">{'Search for any term'|@translate}
     </label></li>
   </ul>
   <label>{'Search for Author'|@translate}
-    <input type="text" style="width: 300px" name="search_author" size="30"  />
+    <input type="text" style="width: 300px" name="search_author" size="30">
   </label>
 </fieldset>
@@ -53,18 +53,18 @@
   <legend>{'Search tags'|@translate}</legend>
   {$TAG_SELECTION}
-  <label><span><input type="radio" name="tag_mode" value="AND" checked="checked" /> {'All tags'|@translate}</span></label>
-  <label><span><input type="radio" name="tag_mode" value="OR" /> {'Any tag'|@translate}</span></label>
+  <label><span><input type="radio" name="tag_mode" value="AND" checked="checked"> {'All tags'|@translate}</span></label>
+  <label><span><input type="radio" name="tag_mode" value="OR"> {'Any tag'|@translate}</span></label>
 </fieldset>
 {/if}
 
 <fieldset>
-  <legend>{'Search by Date'|@translate}</legend>
+  <legend>{'Search by date'|@translate}</legend>
   <ul>
     <li><label>{'Kind of date'|@translate}</label></li>
     <li><label>
-      <input type="radio" name="date_type" value="date_creation" checked="checked" />{'Creation date'|@translate}
+      <input type="radio" name="date_type" value="date_creation" checked="checked">{'Creation date'|@translate}
     </label></li>
     <li><label>
-      <input type="radio" name="date_type" value="date_available" />{'Post date'|@translate}
+      <input type="radio" name="date_type" value="date_available">{'Post date'|@translate}
     </label></li>
   </ul>
@@ -72,5 +72,5 @@
     <li><label>{'Date'|@translate}</label></li>
     <li>
-      <select name="start_day">
+      <select id="start_day" name="start_day">
           <option value="0">--</option>
         {section name=day start=1 loop=32}
@@ -78,12 +78,12 @@
         {/section}
       </select>
-      <select name="start_month">
+      <select id="start_month" name="start_month">
         {html_options options=$month_list selected=$START_MONTH_SELECTED}
       </select>
-      <input name="start_year" type="text" size="4" maxlength="4" >
+      <input id="start_year" name="start_year" type="text" size="4" maxlength="4" >
       <input id="start_linked_date" name="start_linked_date" type="hidden" size="10" disabled="disabled">
     </li>
     <li>
-      <a href="#" onClick="document.search.start_day.value={$smarty.now|date_format:"%d"};document.search.start_month.value={$smarty.now|date_format:"%m"};document.search.start_year.value={$smarty.now|date_format:"%Y"};return false;">{'today'|@translate}</a>
+      <a class="date_today" href="#" onClick="document.search.start_day.value={$smarty.now|date_format:"%d"};document.search.start_month.value={$smarty.now|date_format:"%m"};document.search.start_year.value={$smarty.now|date_format:"%Y"};return false;">{'today'|@translate}</a>
     </li>
   </ul>
@@ -100,9 +100,9 @@
         {html_options options=$month_list selected=$END_MONTH_SELECTED}
       </select>
-      <input name="end_year" type="text" size="4" maxlength="4" >
+      <input id="end_year" name="end_year" type="text" size="4" maxlength="4" >
       <input id="end_linked_date" name="end_linked_date" type="hidden" size="10" disabled="disabled">
     </li>
     <li>
-      <a href="#" onClick="document.search.end_day.value={$smarty.now|date_format:"%d"};document.search.end_month.value={$smarty.now|date_format:"%m"};document.search.end_year.value={$smarty.now|date_format:"%Y"};return false;">{'today'|@translate}</a>
+      <a class="date_today" href="#" onClick="document.search.end_day.value={$smarty.now|date_format:"%d"};document.search.end_month.value={$smarty.now|date_format:"%m"};document.search.end_year.value={$smarty.now|date_format:"%Y"};return false;">{'today'|@translate}</a>
     </li>
   </ul>
@@ -110,6 +110,6 @@
 
 <fieldset>
-  <legend>{'Search Options'|@translate}</legend>
-  <label>{'Search in albums'|@translate}<br/>
+  <legend>{'Search in albums'|@translate}</legend>
+  <label>{'Albums'|@translate}
     <select class="categoryList" name="cat[]" multiple="multiple" >
       {html_options options=$category_options selected=$category_options_selected}
@@ -119,14 +119,14 @@
     <li><label>{'Search in sub-albums'|@translate}</label></li>
     <li><label>
-      <input type="radio" name="subcats-included" value="1" checked="checked" />{'Yes'|@translate}
+      <input type="radio" name="subcats-included" value="1" checked="checked">{'Yes'|@translate}
     </label></li>
     <li><label>
-      <input type="radio" name="subcats-included" value="0" />{'No'|@translate}
+      <input type="radio" name="subcats-included" value="0">{'No'|@translate}
     </label></li>
   </ul>
 </fieldset>
 <p>
-  <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}" />
-  <input class="submit" type="reset" value="{'Reset'|@translate}" />
+  <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}">
+  <input class="submit" type="reset" value="{'Reset'|@translate}">
 </p>
 </form>
Index: /extensions/gally/gally-default/template/search_rules.tpl
===================================================================
--- /extensions/gally/gally-default/template/search_rules.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/search_rules.tpl	(revision 16016)
@@ -4,5 +4,5 @@
 <ul class="categoryActions">
   <li>
-    <a id="icon_exit" class="button" href="#" onclick="window.close();" title="{'Close this window'|@translate}">      
+    <a href="#" onclick="window.close();" title="{'Close this window'|@translate}" id="icon_exit" class="button">      
     </a>
   </li>
@@ -11,5 +11,5 @@
 <h2>{'Search rules'|@translate}</h2>
 
-{if isset($INTRODUCTION) }
+{if isset($INTRODUCTION)}
 <p>{$INTRODUCTION}</p>
 {/if}
@@ -17,5 +17,5 @@
 <ul>
 
-  {if isset($search_words) }
+  {if isset($search_words)}
   {foreach from=$search_words item=v}
   <li>{$v}</li>
@@ -25,5 +25,5 @@
   {if isset($SEARCH_TAGS_MODE) }
   <li>
-    <p>{if 'AND'==$SEARCH_TAGS_MODE}{'At least one tag must match'|@translate}{else}{'At least one tag must match'|@translate}{/if}</p>
+    <p>{if 'AND'==$SEARCH_TAGS_MODE}{'All tags'|@translate}{else}{'Any tag'|@translate}{/if}</p>
     <ul>
       {foreach from=$search_tags item=v}
@@ -34,13 +34,13 @@
   {/if}
 
-  {if isset($DATE_CREATION) }
+  {if isset($DATE_CREATION)}
   <li>{$DATE_CREATION}</li>
   {/if}
 
-  {if isset($DATE_AVAILABLE) }
+  {if isset($DATE_AVAILABLE)}
   <li>{$DATE_AVAILABLE}</li>
   {/if}
 
-  {if isset($search_categories) }
+  {if isset($search_categories)}
   <li>
     <p>{'Albums'|@translate}</p>
@@ -56,4 +56,8 @@
 </ul>
 
+<p>
+    <a href="#" onclick="window.close();">{'Close this window'|@translate}</a>
+</p>
+
 </div> <!-- content -->
 
Index: /extensions/gally/gally-default/template/slideshow.tpl
===================================================================
--- /extensions/gally/gally-default/template/slideshow.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/slideshow.tpl	(revision 16016)
@@ -7,7 +7,7 @@
       [ <a href="{$U_SLIDESHOW_STOP}">{'stop the slideshow'|@translate}</a> ]
       {/if}
-      {if $SHOW_PICTURE_NAME_ON_TITLE }
+      {* if $SHOW_PICTURE_NAME_ON_TITLE *}
         <span class="showtitle">{$current.TITLE}</span>
-      {/if}
+      {* /if *}
     </div>
     <div class="imageNumber">{$PHOTO}</div>
Index: /extensions/gally/gally-default/template/tags.tpl
===================================================================
--- /extensions/gally/gally-default/template/tags.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/tags.tpl	(revision 16016)
@@ -17,16 +17,17 @@
     <ul class="categoryActions">
 {if $display_mode == 'letters'}
-      <li><a id="icon_cloud" class="button" href="{$U_CLOUD}" title="{'cloud'|@translate}"></a></li>
+      <li><a href="{$U_CLOUD}" title="{'cloud'|@translate}" id="icon_cloud" class="button"></a></li>
 {/if}
 
 {if $display_mode == 'cloud'}
-      <li><a id="icon_tag_letters" class="button" href="{$U_LETTERS}" title="{'letters'|@translate}"></a></li>
+      <li><a href="{$U_LETTERS}" title="{'letters'|@translate}" id="icon_tag_letters" class="button"></a></li>
 {/if}
 
-      <li><a id="icon_home" class="button" href="{$U_HOME}" title="{'return to homepage'|@translate}"></a></li>
+      <li><a id="icon_home" class="button" href="{$U_HOME}" title="{'Home'|@translate}"></a></li>
     </ul>
     <h2>{'Tags'|@translate}</h2>
   </div>
 
+{include file='infos_errors.tpl'}
 
   {if #menuAnimated# != "noswitch" and isset($MENUBAR)}
@@ -38,5 +39,5 @@
   <div id="fullTagCloud">
     {foreach from=$tags item=tag}
-    <span><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$tag.counter}">{$tag.name}</a></span>
+    <span><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}<br>{'display photos linked to this tag'|@translate}">{$tag.name}</a></span>
     {/foreach}
   </div>
@@ -53,5 +54,5 @@
       {foreach from=$letter.tags item=tag}
       <tr class="tagLine">
-        <td><a href="{$tag.URL}"  title="{$tag.name}">{$tag.name}</a></td>
+        <td><a href="{$tag.URL}" title="{'display photos linked to this tag'|@translate}" class="sTipOnTop">{$tag.name}</a></td>
         <td class="nbEntries">{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}</td>
       </tr>
Index: /extensions/gally/gally-default/template/thumbnails.tpl
===================================================================
--- /extensions/gally/gally-default/template/thumbnails.tpl	(revision 16015)
+++ /extensions/gally/gally-default/template/thumbnails.tpl	(revision 16016)
@@ -1,22 +1,37 @@
 <!-- **GBL** >THUMBNAILS> -->
 {if !empty($thumbnails)}
+{* get thumbnails loader manager from piwigo default's theme *}
+{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
+{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
+{html_style}
+.content ul.thumbnails table.wrap1 tr.imgRow td, .wrap2
+{ldelim}
+  width:{$derivative_params->max_width()+20}px;
+  height:{$derivative_params->max_height()+20}px;
+}
+{/html_style}
+
 <ul class="thumbnails">
 {foreach from=$thumbnails item=thumbnail}
+{assign var=derivative value=$pwg->derivative($derivative_params, $thumbnail.src_image)}
   <li>
     <table class="wrap1">
-      <tr>
+      <tr class="imgRow">
         <td>
-          <span class="wrap2">
           <a href="{$thumbnail.URL}">
+          <span class="wrap2 sTipOnTop"
+                  {if isset($thumbnail.NB_COMMENTS) or isset($thumbnail.NB_HITS) }
+                  title="{if isset($thumbnail.NB_COMMENTS)}<span class='{if 0==$thumbnail.NB_COMMENTS}zero {/if}nb-comments'>{$pwg->l10n_dec('%d comment', '%d comments',$thumbnail.NB_COMMENTS)}</span>{/if}
+                         {if isset($thumbnail.NB_HITS)}<span class='{if 0==$thumbnail.NB_HITS}zero {/if}nb-hits'>{$pwg->l10n_dec('%d hit', '%d hits',$thumbnail.NB_HITS)}</span>{/if}"
+                  {/if}>
             <img {if isset($thumbnail.LONGDESC) and $thumbnail.LONGDESC!=""}longdesc="{$thumbnail.LONGDESC}"{/if}
                   class="thumbnail {if isset($thumbnail.EXTRA_CLASS)}{$thumbnail.EXTRA_CLASS}{/if}"
-                  src="{$thumbnail.TN_SRC}"
-                  alt="{$thumbnail.TN_ALT}"
-                  title="{$thumbnail.TN_TITLE}" />
+                  {if !$derivative->is_cached()}data-{/if}src="{$derivative->get_url()}"
+                  alt="{$thumbnail.TN_ALT}"/>
+          </span>
           </a>
-          </span>
         </td>
       </tr>
-      <tr>
+      <tr class="nfoRow">
         <td>
           {if $SHOW_THUMBNAIL_CAPTION }
@@ -28,18 +43,4 @@
             {if !empty($thumbnail.NAME)}{$thumbnail.NAME}{/if}
 
-
-            {if isset($thumbnail.NB_COMMENTS)}
-            <span class="{if 0==$thumbnail.NB_COMMENTS}zero {/if}nb-comments">
-            <br />
-            {$pwg->l10n_dec('%d comment', '%d comments',$thumbnail.NB_COMMENTS)}
-            </span>
-            {/if}
-
-            {if isset($thumbnail.NB_HITS)}
-            <span class="{if 0==$thumbnail.NB_HITS}zero {/if}nb-hits">
-            <br />
-            {$pwg->l10n_dec('%d hit', '%d hits',$thumbnail.NB_HITS)}
-            </span>
-            {/if}
             </span>
           {/if}
Index: /extensions/gally/gally-default/themeconf.inc.php
===================================================================
--- /extensions/gally/gally-default/themeconf.inc.php	(revision 16015)
+++ /extensions/gally/gally-default/themeconf.inc.php	(revision 16016)
@@ -2,5 +2,5 @@
 /*
 Theme Name: Gally
-Version: 1.4.5
+Version: 1.5.0
 Description: Parent theme for all the Gally themes
 Theme URI: http://piwigo.org/ext/extension_view.php?eid=382
@@ -13,5 +13,140 @@
   'icon_dir' => 'themes/gally-default/icon',
   'mime_icon_dir' => 'themes/gally-default/icon/mimetypes/',
-  'activable' => false,
+  'activable' => false
 );
+
+
+if(!defined('IN_ADMIN')) add_event_handler('init', 'initTemplateVar');
+
+/**
+ * GallyTpl class is used to initialise some templates variable and provide some
+ * usefull function in template
+ */
+class GallyTpl
+{
+  private $comment=array(
+            'id' => null
+          );
+
+  public function __construct()
+  {
+    global $template, $themeconf;
+
+    $this->loadConfDirectories();
+    $this->loadThemeJS();
+
+    $template->assign('gally', $this);
+  }
+
+  public function getToken()
+  {
+    return(get_pwg_token());
+  }
+
+  public function getCommentKey($id)
+  {
+    if($this->loadComment($id))
+    {
+      return(get_ephemeral_key(2, $this->comment['image_id']));
+    }
+    return('');
+  }
+
+  public function getCommentImage($id)
+  {
+    if($this->loadComment($id))
+    {
+      return($this->comment['image_id']);
+    }
+    return('');
+  }
+
+  public function getAlternateBannerContent()
+  {
+    global $template;
+
+    return(html_entity_decode($template->smarty->get_config_vars('alternateBannerContent')));
+  }
+
+  public function getRandomBox($value)
+  {
+    global $template;
+
+    if(is_numeric($value)) return(rand(-$value, $value));
+
+    $v=$template->smarty->get_config_vars($value);
+    return(rand(-$v, $v));
+  }
+
+  /**
+   *
+   */
+  private function loadThemeJS()
+  {
+    global $template;
+
+    $currentTheme=$template->get_template_vars('themeconf');
+    $file="themes/".$currentTheme['id']."/js/theme.js";
+
+    if(file_exists(dirname($_SERVER['SCRIPT_FILENAME']).'/'.$file))
+    {
+      $template->scriptLoader->add($currentTheme['id'].'.theme.js', 'header', array('jquery'), $file, 0);
+    }
+  }
+
+  /**
+   * load conf directories in smarty variables
+   *  {$default_conf}
+   *  {$local_conf}
+   */
+  private function loadConfDirectories()
+  {
+    global $template;
+
+    $themes=$template->get_template_vars('themes');
+    foreach($themes as $theme)
+    {
+      $dir=dirname($_SERVER['SCRIPT_FILENAME'])."/themes/".$theme['id']."/conf/";
+      $dirlocal=dirname($_SERVER['SCRIPT_FILENAME'])."/".PWG_LOCAL_DIR."themes/".$theme['id']."/conf/";
+
+      if(file_exists($dir."local.conf")) $template->smarty->config_load($dir."default.conf");
+      if(file_exists($dirlocal."local.conf")) $template->smarty->config_load($dirlocal."local.conf");
+    }
+  }
+
+  /**
+   * load comment properties
+   *  result is stored in $this->comment
+   *
+   * @param Integer $id: comment id
+   */
+  private function loadComment($id)
+  {
+    if($id==null or $id=='') return(false);
+    if($id==$this->comment['id']) return(true);
+
+    $sql="SELECT image_id FROM ".COMMENTS_TABLE." WHERE id=$id";
+    $result=pwg_query($sql);
+    if($result)
+    {
+      while($row=pwg_db_fetch_assoc($result))
+      {
+        $this->comment=array(
+          'id' => $id,
+          'image_id' => $row['image_id']
+        );
+        return(true);
+      }
+    }
+    return(false);
+  }
+}
+
+
+
+function initTemplateVar()
+{
+  $gallyVar=new GallyTpl();
+}
+
 ?>
