Index: /extensions/akBookStyle/trunk/CHANGELOG
===================================================================
--- /extensions/akBookStyle/trunk/CHANGELOG	(revision 5444)
+++ /extensions/akBookStyle/trunk/CHANGELOG	(revision 5445)
@@ -1,2 +1,7 @@
+akBookStyle 0.2.1 - 2010-03-29
+================================
+* fix links problem when number of images 
+ is less than number images by page
+
 akBookStyle 0.2.0 - 2010-03-28
 ================================
Index: /extensions/akBookStyle/trunk/css/style.css
===================================================================
--- /extensions/akBookStyle/trunk/css/style.css	(revision 5444)
+++ /extensions/akBookStyle/trunk/css/style.css	(revision 5445)
@@ -24,4 +24,8 @@
   width: 24px;
   padding: 200px 0 0 0;
+}
+
+#akPreviousPicture, #akNextPicture { 
+  visibility: hidden;
 }
 
Index: /extensions/akBookStyle/trunk/include/akContent.class.php
===================================================================
--- /extensions/akBookStyle/trunk/include/akContent.class.php	(revision 5444)
+++ /extensions/akBookStyle/trunk/include/akContent.class.php	(revision 5445)
@@ -47,4 +47,5 @@
         $this->applicable = true;
         $page['nb_image_page'] = $this->plugin_config->ak_by_page;
+        $GLOBALS['user']['nb_image_page'] = $this->plugin_config->ak_by_page;
       }
       else
@@ -58,5 +59,8 @@
     global $template;
     
-    if ($this->applicable === false) return;
+    if (!$this->applicable) {
+      return;
+    }
+
     $this->category_url = make_index_url(array('section' => 'category',
 					       'category' => $GLOBALS['page']['category'],
Index: /extensions/akBookStyle/trunk/js/ak_jquery-load.js
===================================================================
--- /extensions/akBookStyle/trunk/js/ak_jquery-load.js	(revision 5444)
+++ /extensions/akBookStyle/trunk/js/ak_jquery-load.js	(revision 5445)
@@ -1,10 +1,19 @@
 $(function() {
+    next_link = $('table.thumbnails div.navbar a[rel=next]');
+    if (next_link.length!=0) {
+      $('#akNextPicture').css('visibility', 'visible');
+    }
+    previous_link = $('table.thumbnails div.navbar a[rel=previous]');
+    if (previous_link.length!=0) {
+      $('#akPreviousPicture').css('visibility', 'visible');
+    }
+    
     $("a.load")
       .bind(ak_mouse_event, function() {
-	  $('table.thumbnails tr td.ncol').each(function() {
-	      if ($(this).hasClass('selected')) {
-		$(this).removeClass('selected');
-	      }
-	    });
+          $('table.thumbnails tr td.ncol').each(function() {
+              if ($(this).hasClass('selected')) {
+                $(this).removeClass('selected');
+              }
+            });
 
 	  $a = $(this);
@@ -17,5 +26,7 @@
 	    }
             next_link = $('table.thumbnails div.navbar a[rel='+rel+']');
-            window.location = next_link.attr('href');
+            if (next_link.length!=0) {
+              window.location = next_link.attr('href');
+            }
           } else {
             next_thumbnail.parent().parent().parent().addClass('selected');
Index: /extensions/akBookStyle/trunk/main.inc.php
===================================================================
--- /extensions/akBookStyle/trunk/main.inc.php	(revision 5444)
+++ /extensions/akBookStyle/trunk/main.inc.php	(revision 5445)
@@ -23,5 +23,5 @@
 /*
 Plugin Name: akBookStyle
-Version: 0.2.0
+Version: 0.2.1
 Description: Book style for designers
 Plugin URI: http://piwigo.org/ext/extension_links.php?eid=307
Index: /extensions/akBookStyle/trunk/template/ak_thumbnails.tpl
===================================================================
--- /extensions/akBookStyle/trunk/template/ak_thumbnails.tpl	(revision 5444)
+++ /extensions/akBookStyle/trunk/template/ak_thumbnails.tpl	(revision 5445)
@@ -19,16 +19,10 @@
 
 <div id="akBack">
-  <a id="akHome" class="navButton" href="{$SCRIPT_NAME}" 
-   title="{'Home'|@translate}" 
-   rel="start">
-  <img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" 
-       class="button" alt="{'Home'|@translate}">
+  <a id="akHome" class="navButton" href="{$SCRIPT_NAME}" title="{'Home'|@translate}" rel="start">
+    <img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}">
   </a>
   {if !empty($akUP)}
-  <a id="akUp" class="navButton" href="{$akUP}" 
-   title="{'Thumbnails'|@translate}" 
-   rel="up">
-  <img src="{$ROOT_URL}{$themeconf.icon_dir}/up.png" 
-       class="button" alt="{'Thumbnails'|@translate}">
+  <a id="akUp" class="navButton" href="{$akUp}" title="{'Thumbnails'|@translate}" rel="up">
+    <img src="{$ROOT_URL}{$themeconf.icon_dir}/up.png" class="button" alt="{'Thumbnails'|@translate}">
   </a>
   {/if}
